196b9a
From f5d430581dc8ddf3a67c90b753849b806a604e73 Mon Sep 17 00:00:00 2001
196b9a
From: Bjorn Andersson <bjorn.andersson@linaro.org>
196b9a
Date: Tue, 22 Mar 2022 20:32:55 -0700
196b9a
Subject: [PATCH 7/9] net: stmmac: dwmac-qcom-ethqos: Enable RGMII functional
196b9a
 clock on resume
196b9a
Git-commit: ffba2123e1714a27e9362fda57c42155dda37efc
196b9a
Patch-mainline: v5.18-rc1
196b9a
References: git-fixes
196b9a
196b9a
When the Qualcomm ethqos driver is properly described in its associated
196b9a
GDSC power-domain, the hardware will be powered down and loose its state
196b9a
between qcom_ethqos_probe() and stmmac_init_dma_engine().
196b9a
196b9a
The result of this is that the functional clock from the RGMII IO macro
196b9a
is no longer provides and the DMA software reset in dwmac4_dma_reset()
196b9a
will time out, due to lacking clock signal.
196b9a
196b9a
Re-enable the functional clock, as part of the Qualcomm specific clock
196b9a
enablement sequence to avoid this problem.
196b9a
196b9a
The final clock configuration will be adjusted by ethqos_fix_mac_speed()
196b9a
once the link is being brought up.
196b9a
196b9a
Fixes: a7c30e62d4b8 ("net: stmmac: Add driver for Qualcomm ethqos")
196b9a
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
196b9a
Tested-and-reviewed-by: Bhupesh Sharma <bhupesh.sharma@linaro.org>
196b9a
Link: https://lore.kernel.org/r/20220323033255.2282930-1-bjorn.andersson@linaro.org
196b9a
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
196b9a
Signed-off-by: Denis Kirjanov <denis.kirjanov@suse.com>
196b9a
---
196b9a
 drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c | 7 +++++++
196b9a
 1 file changed, 7 insertions(+)
196b9a
196b9a
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c
196b9a
index 2ffa0a11eea5..569683f33804 100644
196b9a
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c
196b9a
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c
196b9a
@@ -460,6 +460,13 @@ static int ethqos_clks_config(void *priv, bool enabled)
196b9a
 			dev_err(&ethqos->pdev->dev, "rgmii_clk enable failed\n");
196b9a
 			return ret;
196b9a
 		}
196b9a
+
196b9a
+		/* Enable functional clock to prevent DMA reset to timeout due
196b9a
+		 * to lacking PHY clock after the hardware block has been power
196b9a
+		 * cycled. The actual configuration will be adjusted once
196b9a
+		 * ethqos_fix_mac_speed() is invoked.
196b9a
+		 */
196b9a
+		ethqos_set_func_clk_en(ethqos);
196b9a
 	} else {
196b9a
 		clk_disable_unprepare(ethqos->rgmii_clk);
196b9a
 	}
196b9a
-- 
196b9a
2.16.4
196b9a