mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-12 13:55:32 +00:00
net: stmmac: add platform level clocks management
This patch intends to add platform level clocks management. Some platforms may have their own special clocks, they also need to be managed dynamically. If you want to manage such clocks, please implement clks_config callback. Reviewed-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: Joakim Zhang <qiangqing.zhang@nxp.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
5ec5582343
commit
b4d45aee66
2 changed files with 11 additions and 0 deletions
|
@ -127,9 +127,19 @@ int stmmac_bus_clks_config(struct stmmac_priv *priv, bool enabled)
|
|||
clk_disable_unprepare(priv->plat->stmmac_clk);
|
||||
return ret;
|
||||
}
|
||||
if (priv->plat->clks_config) {
|
||||
ret = priv->plat->clks_config(priv->plat->bsp_priv, enabled);
|
||||
if (ret) {
|
||||
clk_disable_unprepare(priv->plat->stmmac_clk);
|
||||
clk_disable_unprepare(priv->plat->pclk);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
clk_disable_unprepare(priv->plat->stmmac_clk);
|
||||
clk_disable_unprepare(priv->plat->pclk);
|
||||
if (priv->plat->clks_config)
|
||||
priv->plat->clks_config(priv->plat->bsp_priv, enabled);
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
|
|
@ -184,6 +184,7 @@ struct plat_stmmacenet_data {
|
|||
int (*init)(struct platform_device *pdev, void *priv);
|
||||
void (*exit)(struct platform_device *pdev, void *priv);
|
||||
struct mac_device_info *(*setup)(void *priv);
|
||||
int (*clks_config)(void *priv, bool enabled);
|
||||
void *bsp_priv;
|
||||
struct clk *stmmac_clk;
|
||||
struct clk *pclk;
|
||||
|
|
Loading…
Reference in a new issue