Commit caee3174 authored by Christophe Roullier's avatar Christophe Roullier Committed by David S. Miller

net: ethernet: stmmac: Add support for syscfg clock

Add optional support for syscfg clock in dwmac-stm32.c
Now Syscfg clock is activated automatically when syscfg
registers are used
Signed-off-by: default avatarChristophe Roullier <christophe.roullier@st.com>
Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent d408bef4
...@@ -155,17 +155,13 @@ static int stm32mp1_clk_prepare(struct stm32_dwmac *dwmac, bool prepare) ...@@ -155,17 +155,13 @@ static int stm32mp1_clk_prepare(struct stm32_dwmac *dwmac, bool prepare)
ret = clk_prepare_enable(dwmac->syscfg_clk); ret = clk_prepare_enable(dwmac->syscfg_clk);
if (ret) if (ret)
return ret; return ret;
if (dwmac->clk_eth_ck) {
ret = clk_prepare_enable(dwmac->clk_eth_ck); ret = clk_prepare_enable(dwmac->clk_eth_ck);
if (ret) { if (ret) {
clk_disable_unprepare(dwmac->syscfg_clk); clk_disable_unprepare(dwmac->syscfg_clk);
return ret; return ret;
} }
}
} else { } else {
clk_disable_unprepare(dwmac->syscfg_clk); clk_disable_unprepare(dwmac->syscfg_clk);
if (dwmac->clk_eth_ck)
clk_disable_unprepare(dwmac->clk_eth_ck); clk_disable_unprepare(dwmac->clk_eth_ck);
} }
return ret; return ret;
...@@ -320,12 +316,10 @@ static int stm32mp1_parse_data(struct stm32_dwmac *dwmac, ...@@ -320,12 +316,10 @@ static int stm32mp1_parse_data(struct stm32_dwmac *dwmac,
return PTR_ERR(dwmac->clk_ethstp); return PTR_ERR(dwmac->clk_ethstp);
} }
/* Clock for sysconfig */ /* Optional Clock for sysconfig */
dwmac->syscfg_clk = devm_clk_get(dev, "syscfg-clk"); dwmac->syscfg_clk = devm_clk_get(dev, "syscfg-clk");
if (IS_ERR(dwmac->syscfg_clk)) { if (IS_ERR(dwmac->syscfg_clk))
dev_err(dev, "No syscfg clock provided...\n"); dwmac->syscfg_clk = NULL;
return PTR_ERR(dwmac->syscfg_clk);
}
/* Get IRQ information early to have an ability to ask for deferred /* Get IRQ information early to have an ability to ask for deferred
* probe if needed before we went too far with resource allocation. * probe if needed before we went too far with resource allocation.
...@@ -437,7 +431,6 @@ static int stm32mp1_suspend(struct stm32_dwmac *dwmac) ...@@ -437,7 +431,6 @@ static int stm32mp1_suspend(struct stm32_dwmac *dwmac)
clk_disable_unprepare(dwmac->clk_tx); clk_disable_unprepare(dwmac->clk_tx);
clk_disable_unprepare(dwmac->syscfg_clk); clk_disable_unprepare(dwmac->syscfg_clk);
if (dwmac->clk_eth_ck)
clk_disable_unprepare(dwmac->clk_eth_ck); clk_disable_unprepare(dwmac->clk_eth_ck);
return ret; return ret;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment