[openwrt/openwrt] ipq806x: backport GMAC_AHB_RESET deassert patches

LEDE Commits lede-commits at lists.infradead.org
Sun Nov 28 09:48:32 PST 2021


hauke pushed a commit to openwrt/openwrt.git, branch master:
https://git.openwrt.org/771691ec839b8e6925b5cd1d1a34a7ba67c0313f

commit 771691ec839b8e6925b5cd1d1a34a7ba67c0313f
Author: Matthew Hagan <mnhagan88 at gmail.com>
AuthorDate: Thu May 13 21:49:43 2021 +0100

    ipq806x: backport GMAC_AHB_RESET deassert patches
    
    Add backports of the following patches:
    "net: stmmac: explicitly deassert GMAC_AHB_RESET" and
    "ARM: dts: qcom: add ahb reset to ipq806x-gmac"
    Required for Meraki MR42/MR52.
    
    Signed-off-by: Matthew Hagan <mnhagan88 at gmail.com>
---
 ...stmmac-explicitly-deassert-gmac-ahb-reset.patch | 75 ++++++++++++++++++++++
 ...rm-dts-qcom-add-ahb-reset-to-ipq806x-gmac.patch | 64 ++++++++++++++++++
 2 files changed, 139 insertions(+)

diff --git a/target/linux/ipq806x/patches-5.10/108-v5.14-net-stmmac-explicitly-deassert-gmac-ahb-reset.patch b/target/linux/ipq806x/patches-5.10/108-v5.14-net-stmmac-explicitly-deassert-gmac-ahb-reset.patch
new file mode 100644
index 0000000000..a797492bee
--- /dev/null
+++ b/target/linux/ipq806x/patches-5.10/108-v5.14-net-stmmac-explicitly-deassert-gmac-ahb-reset.patch
@@ -0,0 +1,75 @@
+From e67f325e9cd67562b761e884680c0fec03a6f404 Mon Sep 17 00:00:00 2001
+From: Matthew Hagan <mnhagan88 at gmail.com>
+Date: Tue, 8 Jun 2021 19:59:06 +0100
+Subject: net: stmmac: explicitly deassert GMAC_AHB_RESET
+
+We are currently assuming that GMAC_AHB_RESET will already be deasserted
+by the bootloader. However if this has not been done, probing of the GMAC
+will fail. To remedy this we must ensure GMAC_AHB_RESET has been deasserted
+prior to probing.
+
+v2 changes:
+ - remove NULL condition check for stmmac_ahb_rst in stmmac_main.c
+ - unwrap dev_err() message in stmmac_main.c
+ - add PTR_ERR() around plat->stmmac_ahb_rst in stmmac_platform.c
+
+v3 changes:
+ - add error pointer to dev_err() output
+ - add reset_control_assert(stmmac_ahb_rst) in stmmac_dvr_remove
+ - revert PTR_ERR() around plat->stmmac_ahb_rst since this is performed
+   on the returned value of ret by the calling function
+
+Signed-off-by: Matthew Hagan <mnhagan88 at gmail.com>
+Signed-off-by: David S. Miller <davem at davemloft.net>
+---
+ drivers/net/ethernet/stmicro/stmmac/stmmac_main.c     | 5 +++++
+ drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c | 6 ++++++
+ include/linux/stmmac.h                                | 1 +
+ 3 files changed, 12 insertions(+)
+
+--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
++++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+@@ -4990,6 +4990,10 @@ int stmmac_dvr_probe(struct device *devi
+ 			reset_control_reset(priv->plat->stmmac_rst);
+ 	}
+ 
++	ret = reset_control_deassert(priv->plat->stmmac_ahb_rst);
++	if (ret == -ENOTSUPP)
++		dev_err(priv->device, "unable to bring out of ahb reset\n");
++
+ 	/* Init MAC and get the capabilities */
+ 	ret = stmmac_hw_init(priv);
+ 	if (ret)
+@@ -5214,6 +5218,7 @@ int stmmac_dvr_remove(struct device *dev
+ 	phylink_destroy(priv->phylink);
+ 	if (priv->plat->stmmac_rst)
+ 		reset_control_assert(priv->plat->stmmac_rst);
++	reset_control_assert(priv->plat->stmmac_ahb_rst);
+ 	pm_runtime_put(dev);
+ 	pm_runtime_disable(dev);
+ 	if (priv->hw->pcs != STMMAC_PCS_TBI &&
+--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
++++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
+@@ -616,6 +616,12 @@ stmmac_probe_config_dt(struct platform_d
+ 		plat->stmmac_rst = NULL;
+ 	}
+ 
++	plat->stmmac_ahb_rst = devm_reset_control_get_optional_shared(
++							&pdev->dev, "ahb");
++	if (IS_ERR(plat->stmmac_ahb_rst))
++		if (PTR_ERR(plat->stmmac_ahb_rst) == -EPROBE_DEFER)
++			goto error_hw_init;
++
+ 	return plat;
+ 
+ error_hw_init:
+--- a/include/linux/stmmac.h
++++ b/include/linux/stmmac.h
+@@ -192,6 +192,7 @@ struct plat_stmmacenet_data {
+ 	unsigned int clk_ref_rate;
+ 	s32 ptp_max_adj;
+ 	struct reset_control *stmmac_rst;
++	struct reset_control *stmmac_ahb_rst;
+ 	struct stmmac_axi *axi;
+ 	int has_gmac4;
+ 	bool has_sun8i;
diff --git a/target/linux/ipq806x/patches-5.10/109-v5.15-arm-dts-qcom-add-ahb-reset-to-ipq806x-gmac.patch b/target/linux/ipq806x/patches-5.10/109-v5.15-arm-dts-qcom-add-ahb-reset-to-ipq806x-gmac.patch
new file mode 100644
index 0000000000..4a047ed6eb
--- /dev/null
+++ b/target/linux/ipq806x/patches-5.10/109-v5.15-arm-dts-qcom-add-ahb-reset-to-ipq806x-gmac.patch
@@ -0,0 +1,64 @@
+From f95c4c56d65225a537a2d88735fde7ec4d37641d Mon Sep 17 00:00:00 2001
+From: Matthew Hagan <mnhagan88 at gmail.com>
+Date: Sat, 5 Jun 2021 18:35:38 +0100
+Subject: ARM: dts: qcom: add ahb reset to ipq806x-gmac
+
+Add GMAC_AHB_RESET to the resets property of each gmac node.
+
+Signed-off-by: Matthew Hagan <mnhagan88 at gmail.com>
+Link: https://lore.kernel.org/r/20210605173546.4102455-2-mnhagan88@gmail.com
+Signed-off-by: Bjorn Andersson <bjorn.andersson at linaro.org>
+---
+ arch/arm/boot/dts/qcom-ipq8064.dtsi | 20 ++++++++++++--------
+ 1 file changed, 12 insertions(+), 8 deletions(-)
+
+--- a/arch/arm/boot/dts/qcom-ipq8064.dtsi
++++ b/arch/arm/boot/dts/qcom-ipq8064.dtsi
+@@ -1335,8 +1335,9 @@
+ 			clocks = <&gcc GMAC_CORE1_CLK>;
+ 			clock-names = "stmmaceth";
+ 
+-			resets = <&gcc GMAC_CORE1_RESET>;
+-			reset-names = "stmmaceth";
++			resets = <&gcc GMAC_CORE1_RESET>,
++				 <&gcc GMAC_AHB_RESET>;
++			reset-names = "stmmaceth", "ahb";
+ 
+ 			status = "disabled";
+ 		};
+@@ -1358,8 +1359,9 @@
+ 			clocks = <&gcc GMAC_CORE2_CLK>;
+ 			clock-names = "stmmaceth";
+ 
+-			resets = <&gcc GMAC_CORE2_RESET>;
+-			reset-names = "stmmaceth";
++			resets = <&gcc GMAC_CORE2_RESET>,
++				 <&gcc GMAC_AHB_RESET>;
++			reset-names = "stmmaceth", "ahb";
+ 
+ 			status = "disabled";
+ 		};
+@@ -1381,8 +1383,9 @@
+ 			clocks = <&gcc GMAC_CORE3_CLK>;
+ 			clock-names = "stmmaceth";
+ 
+-			resets = <&gcc GMAC_CORE3_RESET>;
+-			reset-names = "stmmaceth";
++			resets = <&gcc GMAC_CORE3_RESET>,
++				 <&gcc GMAC_AHB_RESET>;
++			reset-names = "stmmaceth", "ahb";
+ 
+ 			status = "disabled";
+ 		};
+@@ -1404,8 +1407,9 @@
+ 			clocks = <&gcc GMAC_CORE4_CLK>;
+ 			clock-names = "stmmaceth";
+ 
+-			resets = <&gcc GMAC_CORE4_RESET>;
+-			reset-names = "stmmaceth";
++			resets = <&gcc GMAC_CORE4_RESET>,
++				 <&gcc GMAC_AHB_RESET>;
++			reset-names = "stmmaceth", "ahb";
+ 
+ 			status = "disabled";
+ 		};



More information about the lede-commits mailing list