netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net/stmmac: Use clk_prepare_enable and clk_disable_unprepare
@ 2012-09-21 11:06 Stefan Roese
  2012-09-21 11:21 ` Viresh Kumar
  0 siblings, 1 reply; 3+ messages in thread
From: Stefan Roese @ 2012-09-21 11:06 UTC (permalink / raw)
  To: netdev; +Cc: Viresh Kumar, Giuseppe Cavallaro

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>
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c  | 10 +++++-----
 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 c136162..3be8833 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)
 	} else
 		priv->tm->enable = 1;
 #endif
-	clk_enable(priv->stmmac_clk);
+	clk_prepare_enable(priv->stmmac_clk);
 
 	stmmac_check_ether_addr(priv);
 
@@ -1188,7 +1188,7 @@ open_error:
 	if (priv->phydev)
 		phy_disconnect(priv->phydev);
 
-	clk_disable(priv->stmmac_clk);
+	clk_disable_unprepare(priv->stmmac_clk);
 
 	return ret;
 }
@@ -1246,7 +1246,7 @@ static int stmmac_release(struct net_device *dev)
 #ifdef CONFIG_STMMAC_DEBUG_FS
 	stmmac_exit_fs();
 #endif
-	clk_disable(priv->stmmac_clk);
+	clk_disable_unprepare(priv->stmmac_clk);
 
 	return 0;
 }
@@ -2178,7 +2178,7 @@ int stmmac_suspend(struct net_device *ndev)
 	else {
 		stmmac_set_mac(priv->ioaddr, false);
 		/* 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);
 	return 0;
@@ -2203,7 +2203,7 @@ int stmmac_resume(struct net_device *ndev)
 		priv->hw->mac->pmt(priv->ioaddr, 0);
 	else
 		/* enable the clk prevously disabled */
-		clk_enable(priv->stmmac_clk);
+		clk_prepare_enable(priv->stmmac_clk);
 
 	netif_device_attach(ndev);
 
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_timer.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_timer.c
index 2a0e1ab..63ea9987 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;
 static void stmmac_tmu_start(unsigned int new_freq)
 {
 	clk_set_rate(timer_clock, new_freq);
-	clk_enable(timer_clock);
+	clk_prepare_enable(timer_clock);
 }
 
 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)
@@ -126,7 +126,7 @@ int stmmac_open_ext_timer(struct net_device *dev, struct stmmac_timer *tm)
 
 int stmmac_close_ext_timer(void)
 {
-	clk_disable(timer_clock);
+	clk_disable_unprepare(timer_clock);
 	tmu2_unregister_user();
 	clk_put(timer_clock);
 	return 0;
-- 
1.7.12.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] net/stmmac: Use clk_prepare_enable and clk_disable_unprepare
  2012-09-21 11:06 [PATCH] net/stmmac: Use clk_prepare_enable and clk_disable_unprepare Stefan Roese
@ 2012-09-21 11:21 ` Viresh Kumar
  2012-09-21 19:00   ` David Miller
  0 siblings, 1 reply; 3+ messages in thread
From: Viresh Kumar @ 2012-09-21 11:21 UTC (permalink / raw)
  To: Stefan Roese; +Cc: netdev, Giuseppe Cavallaro, spear-devel

On 21 September 2012 16:36, Stefan Roese <sr@denx.de> wrote:
> 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.

I can't believe i have done this. :)

IIRC, when i wrote this code prepare/unprepare weren't there. And by the
time my code got merged, they were. And this mistake was missed there.

Thanks for fixing it.

Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] net/stmmac: Use clk_prepare_enable and clk_disable_unprepare
  2012-09-21 11:21 ` Viresh Kumar
@ 2012-09-21 19:00   ` David Miller
  0 siblings, 0 replies; 3+ messages in thread
From: David Miller @ 2012-09-21 19:00 UTC (permalink / raw)
  To: viresh.kumar; +Cc: sr, netdev, peppe.cavallaro, spear-devel

From: Viresh Kumar <viresh.kumar@linaro.org>
Date: Fri, 21 Sep 2012 16:51:28 +0530

> On 21 September 2012 16:36, Stefan Roese <sr@denx.de> wrote:
>> 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.
> 
> I can't believe i have done this. :)
> 
> IIRC, when i wrote this code prepare/unprepare weren't there. And by the
> time my code got merged, they were. And this mistake was missed there.
> 
> Thanks for fixing it.
> 
> Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>

Applied, thanks.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-09-21 19:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-21 11:06 [PATCH] net/stmmac: Use clk_prepare_enable and clk_disable_unprepare Stefan Roese
2012-09-21 11:21 ` Viresh Kumar
2012-09-21 19:00   ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).