[openwrt/openwrt] ramips: mtk_eth_soc: allow multiple resets

LEDE Commits lede-commits at lists.infradead.org
Sat Jan 6 07:30:30 PST 2024


hauke pushed a commit to openwrt/openwrt.git, branch openwrt-22.03:
https://git.openwrt.org/ca942a5910293a2583f656f731cb921b169ac436

commit ca942a5910293a2583f656f731cb921b169ac436
Author: Lech Perczak <lech.perczak at gmail.com>
AuthorDate: Fri Dec 15 17:15:47 2023 +0100

    ramips: mtk_eth_soc: allow multiple resets
    
    Use devm_reset_control_array_get_exclusive to register multiple
    reset lines in FE driver. This is required to reattach ESW reset to FE
    driver again, based on device tree bindings.
    
    While at that, remove unused fe_priv.rst_ppe field, and add error
    message if getting the reset fails.
    
    Fixes: 60fadae62b64 ("ramips: ethernet: ralink: move reset of the esw into the esw instead of fe")
    
    Co-developed-by: Maxim Anisimov <maxim.anisimov.ua at gmail.com>
    Signed-off-by: Maxim Anisimov <maxim.anisimov.ua at gmail.com>
    
    [Split out of the bigger commit, provide commit mesage, refactor error
    handling]
    Signed-off-by: Lech Perczak <lech.perczak at gmail.com>
    
    (cherry picked from commit 3f1be8edee29fe79fc33c88cbd9d647a490410e5)
    Signed-off-by: Lech Perczak <lech.perczak at gmail.com>
---
 .../ramips/files/drivers/net/ethernet/ralink/mtk_eth_soc.c | 14 ++++++++------
 .../ramips/files/drivers/net/ethernet/ralink/mtk_eth_soc.h |  3 +--
 2 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/target/linux/ramips/files/drivers/net/ethernet/ralink/mtk_eth_soc.c b/target/linux/ramips/files/drivers/net/ethernet/ralink/mtk_eth_soc.c
index e07e5ed5a8..38369d6752 100644
--- a/target/linux/ramips/files/drivers/net/ethernet/ralink/mtk_eth_soc.c
+++ b/target/linux/ramips/files/drivers/net/ethernet/ralink/mtk_eth_soc.c
@@ -143,12 +143,12 @@ void fe_reset(u32 reset_bits)
 
 void fe_reset_fe(struct fe_priv *priv)
 {
-	if (!priv->rst_fe)
+	if (!priv->resets)
 		return;
 
-	reset_control_assert(priv->rst_fe);
+	reset_control_assert(priv->resets);
 	usleep_range(60, 120);
-	reset_control_deassert(priv->rst_fe);
+	reset_control_deassert(priv->resets);
 	usleep_range(60, 120);
 }
 
@@ -1597,9 +1597,11 @@ static int fe_probe(struct platform_device *pdev)
 
 	priv = netdev_priv(netdev);
 	spin_lock_init(&priv->page_lock);
-	priv->rst_fe = devm_reset_control_get(&pdev->dev, "fe");
-	if (IS_ERR(priv->rst_fe))
-		priv->rst_fe = NULL;
+	priv->resets = devm_reset_control_array_get_exclusive(&pdev->dev);
+	if (IS_ERR(priv->resets)) {
+		dev_err(&pdev->dev, "Failed to get resets for FE and ESW cores: %pe\n", priv->resets);
+		priv->resets = NULL;
+	}
 
 	if (soc->init_data)
 		soc->init_data(soc, netdev);
diff --git a/target/linux/ramips/files/drivers/net/ethernet/ralink/mtk_eth_soc.h b/target/linux/ramips/files/drivers/net/ethernet/ralink/mtk_eth_soc.h
index 968db366cf..892ffb2126 100644
--- a/target/linux/ramips/files/drivers/net/ethernet/ralink/mtk_eth_soc.h
+++ b/target/linux/ramips/files/drivers/net/ethernet/ralink/mtk_eth_soc.h
@@ -497,8 +497,7 @@ struct fe_priv {
 	struct work_struct		pending_work;
 	DECLARE_BITMAP(pending_flags, FE_FLAG_MAX);
 
-	struct reset_control		*rst_ppe;
-	struct reset_control		*rst_fe;
+	struct reset_control		*resets;
 	struct mtk_foe_entry		*foe_table;
 	dma_addr_t			foe_table_phys;
 	struct flow_offload __rcu	**foe_flow_table;




More information about the lede-commits mailing list