From 0940193c47d2fe5b84d10af90568b2ce1b36de7d Mon Sep 17 00:00:00 2001 From: David Wu Date: Mon, 18 Apr 2022 15:35:33 +0800 Subject: [PATCH] ethernet: stmmac: dwmac-rk: Set input/output before disable pclk_gmac For rk3588, the input/output of the clock direction needs to set the php_grf register, and the pclk of php_grf is associated with pclk_gmac, so you need to set the input/output before closing pclk_gmac. Signed-off-by: David Wu Change-Id: Idddec040660aaadd80d7dd6d8aba6220b65425fe --- drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c index 62a1dcc8de53..7cf7c1bdaf31 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c @@ -1982,6 +1982,10 @@ static int gmac_clk_enable(struct rk_priv_data *bsp_priv, bool enable) } } else { if (bsp_priv->clk_enabled) { + if (bsp_priv->ops && bsp_priv->ops->set_clock_selection) + bsp_priv->ops->set_clock_selection(bsp_priv, + bsp_priv->clock_input, false); + if (phy_iface == PHY_INTERFACE_MODE_RMII) { clk_disable_unprepare(bsp_priv->mac_clk_rx); @@ -2002,9 +2006,6 @@ static int gmac_clk_enable(struct rk_priv_data *bsp_priv, bool enable) clk_disable_unprepare(bsp_priv->pclk_xpcs); - if (bsp_priv->ops && bsp_priv->ops->set_clock_selection) - bsp_priv->ops->set_clock_selection(bsp_priv, - bsp_priv->clock_input, false); /** * if (!IS_ERR(bsp_priv->clk_mac)) * clk_disable_unprepare(bsp_priv->clk_mac);