diff options
| author | Stefan Roese <sr@denx.de> | 2012-09-20 21:06:29 -0400 |
|---|---|---|
| committer | David S. Miller <davem@davemloft.net> | 2012-09-21 14:59:52 -0400 |
| commit | a630844d898ae8a0b4a3db84af061150682e0d3c (patch) | |
| tree | 8317ae037bf24b70c0fa00d560f46c724045ed5d | |
| parent | bf5b30b8a4416de04f1ac1196281ddb318669464 (diff) | |
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: Stefan Roese <sr@denx.de>
Cc: Viresh Kumar <viresh.kumar@linaro.org>
Cc: Giuseppe Cavallaro <peppe.cavallaro@st.com>
Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
| -rw-r--r-- | drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 10 | ||||
| -rw-r--r-- | drivers/net/ethernet/stmicro/stmmac/stmmac_timer.c | 6 |
2 files changed, 8 insertions, 8 deletions
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index c136162e6473..3be88331d17a 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | |||
| @@ -1066,7 +1066,7 @@ static int stmmac_open(struct net_device *dev) | |||
| 1066 | } else | 1066 | } else |
| 1067 | priv->tm->enable = 1; | 1067 | priv->tm->enable = 1; |
| 1068 | #endif | 1068 | #endif |
| 1069 | clk_enable(priv->stmmac_clk); | 1069 | clk_prepare_enable(priv->stmmac_clk); |
| 1070 | 1070 | ||
| 1071 | stmmac_check_ether_addr(priv); | 1071 | stmmac_check_ether_addr(priv); |
| 1072 | 1072 | ||
| @@ -1188,7 +1188,7 @@ open_error: | |||
| 1188 | if (priv->phydev) | 1188 | if (priv->phydev) |
| 1189 | phy_disconnect(priv->phydev); | 1189 | phy_disconnect(priv->phydev); |
| 1190 | 1190 | ||
| 1191 | clk_disable(priv->stmmac_clk); | 1191 | clk_disable_unprepare(priv->stmmac_clk); |
| 1192 | 1192 | ||
| 1193 | return ret; | 1193 | return ret; |
| 1194 | } | 1194 | } |
| @@ -1246,7 +1246,7 @@ static int stmmac_release(struct net_device *dev) | |||
| 1246 | #ifdef CONFIG_STMMAC_DEBUG_FS | 1246 | #ifdef CONFIG_STMMAC_DEBUG_FS |
| 1247 | stmmac_exit_fs(); | 1247 | stmmac_exit_fs(); |
| 1248 | #endif | 1248 | #endif |
| 1249 | clk_disable(priv->stmmac_clk); | 1249 | clk_disable_unprepare(priv->stmmac_clk); |
| 1250 | 1250 | ||
| 1251 | return 0; | 1251 | return 0; |
| 1252 | } | 1252 | } |
| @@ -2178,7 +2178,7 @@ int stmmac_suspend(struct net_device *ndev) | |||
| 2178 | else { | 2178 | else { |
| 2179 | stmmac_set_mac(priv->ioaddr, false); | 2179 | stmmac_set_mac(priv->ioaddr, false); |
| 2180 | /* Disable clock in case of PWM is off */ | 2180 | /* Disable clock in case of PWM is off */ |
| 2181 | clk_disable(priv->stmmac_clk); | 2181 | clk_disable_unprepare(priv->stmmac_clk); |
| 2182 | } | 2182 | } |
| 2183 | spin_unlock_irqrestore(&priv->lock, flags); | 2183 | spin_unlock_irqrestore(&priv->lock, flags); |
| 2184 | return 0; | 2184 | return 0; |
| @@ -2203,7 +2203,7 @@ int stmmac_resume(struct net_device *ndev) | |||
| 2203 | priv->hw->mac->pmt(priv->ioaddr, 0); | 2203 | priv->hw->mac->pmt(priv->ioaddr, 0); |
| 2204 | else | 2204 | else |
| 2205 | /* enable the clk prevously disabled */ | 2205 | /* enable the clk prevously disabled */ |
| 2206 | clk_enable(priv->stmmac_clk); | 2206 | clk_prepare_enable(priv->stmmac_clk); |
| 2207 | 2207 | ||
| 2208 | netif_device_attach(ndev); | 2208 | netif_device_attach(ndev); |
| 2209 | 2209 | ||
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_timer.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_timer.c index 197fb8cde1d3..4ccd4e2977b7 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_timer.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_timer.c | |||
| @@ -97,12 +97,12 @@ static struct clk *timer_clock; | |||
| 97 | static void stmmac_tmu_start(unsigned int new_freq) | 97 | static void stmmac_tmu_start(unsigned int new_freq) |
| 98 | { | 98 | { |
| 99 | clk_set_rate(timer_clock, new_freq); | 99 | clk_set_rate(timer_clock, new_freq); |
| 100 | clk_enable(timer_clock); | 100 | clk_prepare_enable(timer_clock); |
| 101 | } | 101 | } |
| 102 | 102 | ||
| 103 | static void stmmac_tmu_stop(void) | 103 | static void stmmac_tmu_stop(void) |
| 104 | { | 104 | { |
| 105 | clk_disable(timer_clock); | 105 | clk_disable_unprepare(timer_clock); |
| 106 | } | 106 | } |
| 107 | 107 | ||
| 108 | int stmmac_open_ext_timer(struct net_device *dev, struct stmmac_timer *tm) | 108 | 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 | 126 | ||
| 127 | int stmmac_close_ext_timer(void) | 127 | int stmmac_close_ext_timer(void) |
| 128 | { | 128 | { |
| 129 | clk_disable(timer_clock); | 129 | clk_disable_unprepare(timer_clock); |
| 130 | tmu2_unregister_user(); | 130 | tmu2_unregister_user(); |
| 131 | clk_put(timer_clock); | 131 | clk_put(timer_clock); |
| 132 | return 0; | 132 | return 0; |
