Commit a630844d authored by Stefan Roese's avatar Stefan Roese Committed by David S. Miller

net/stmmac: Use clk_prepare_enable and clk_disable_unprepare

This patch fixes an issue introduced by commit ID 6a81c26f
[net/stmmac: remove conditional compilation of clk code], which
switched from the internal stmmac_clk_{en}{dis}able calls to
clk_{en}{dis}able. By this, calling clk_prepare and clk_unprepare
was removed.

clk_{un}prepare is mandatory for platforms using common clock framework.
Since these drivers are used by SPEAr platform, which supports common
clock framework, add clk_{un}prepare() support for them. Otherwise
the clocks are not correctly en-/disabled and ethernet support doesn't
work.
Signed-off-by: default avatarStefan Roese <sr@denx.de>
Cc: Viresh Kumar <viresh.kumar@linaro.org>
Cc: Giuseppe Cavallaro <peppe.cavallaro@st.com>
Reviewed-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent bf5b30b8
...@@ -1066,7 +1066,7 @@ static int stmmac_open(struct net_device *dev) ...@@ -1066,7 +1066,7 @@ static int stmmac_open(struct net_device *dev)
} else } else
priv->tm->enable = 1; priv->tm->enable = 1;
#endif #endif
clk_enable(priv->stmmac_clk); clk_prepare_enable(priv->stmmac_clk);
stmmac_check_ether_addr(priv); stmmac_check_ether_addr(priv);
...@@ -1188,7 +1188,7 @@ static int stmmac_open(struct net_device *dev) ...@@ -1188,7 +1188,7 @@ static int stmmac_open(struct net_device *dev)
if (priv->phydev) if (priv->phydev)
phy_disconnect(priv->phydev); phy_disconnect(priv->phydev);
clk_disable(priv->stmmac_clk); clk_disable_unprepare(priv->stmmac_clk);
return ret; return ret;
} }
...@@ -1246,7 +1246,7 @@ static int stmmac_release(struct net_device *dev) ...@@ -1246,7 +1246,7 @@ static int stmmac_release(struct net_device *dev)
#ifdef CONFIG_STMMAC_DEBUG_FS #ifdef CONFIG_STMMAC_DEBUG_FS
stmmac_exit_fs(); stmmac_exit_fs();
#endif #endif
clk_disable(priv->stmmac_clk); clk_disable_unprepare(priv->stmmac_clk);
return 0; return 0;
} }
...@@ -2178,7 +2178,7 @@ int stmmac_suspend(struct net_device *ndev) ...@@ -2178,7 +2178,7 @@ int stmmac_suspend(struct net_device *ndev)
else { else {
stmmac_set_mac(priv->ioaddr, false); stmmac_set_mac(priv->ioaddr, false);
/* Disable clock in case of PWM is off */ /* Disable clock in case of PWM is off */
clk_disable(priv->stmmac_clk); clk_disable_unprepare(priv->stmmac_clk);
} }
spin_unlock_irqrestore(&priv->lock, flags); spin_unlock_irqrestore(&priv->lock, flags);
return 0; return 0;
...@@ -2203,7 +2203,7 @@ int stmmac_resume(struct net_device *ndev) ...@@ -2203,7 +2203,7 @@ int stmmac_resume(struct net_device *ndev)
priv->hw->mac->pmt(priv->ioaddr, 0); priv->hw->mac->pmt(priv->ioaddr, 0);
else else
/* enable the clk prevously disabled */ /* enable the clk prevously disabled */
clk_enable(priv->stmmac_clk); clk_prepare_enable(priv->stmmac_clk);
netif_device_attach(ndev); netif_device_attach(ndev);
......
...@@ -97,12 +97,12 @@ static struct clk *timer_clock; ...@@ -97,12 +97,12 @@ static struct clk *timer_clock;
static void stmmac_tmu_start(unsigned int new_freq) static void stmmac_tmu_start(unsigned int new_freq)
{ {
clk_set_rate(timer_clock, new_freq); clk_set_rate(timer_clock, new_freq);
clk_enable(timer_clock); clk_prepare_enable(timer_clock);
} }
static void stmmac_tmu_stop(void) static void stmmac_tmu_stop(void)
{ {
clk_disable(timer_clock); clk_disable_unprepare(timer_clock);
} }
int stmmac_open_ext_timer(struct net_device *dev, struct stmmac_timer *tm) int stmmac_open_ext_timer(struct net_device *dev, struct stmmac_timer *tm)
...@@ -126,7 +126,7 @@ int stmmac_open_ext_timer(struct net_device *dev, struct stmmac_timer *tm) ...@@ -126,7 +126,7 @@ int stmmac_open_ext_timer(struct net_device *dev, struct stmmac_timer *tm)
int stmmac_close_ext_timer(void) int stmmac_close_ext_timer(void)
{ {
clk_disable(timer_clock); clk_disable_unprepare(timer_clock);
tmu2_unregister_user(); tmu2_unregister_user();
clk_put(timer_clock); clk_put(timer_clock);
return 0; return 0;
......
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