* [PATCH V2 02/14] ARM: mxc: time: add clk_prepare/clk_unprepare
2011-11-11 1:10 [PATCH V2 00/14] add clk_prepare/clk_unprepare to imx drivers Richard Zhao
@ 2011-11-11 1:10 ` Richard Zhao
[not found] ` <1320973829-4388-1-git-send-email-richard.zhao-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
` (10 subsequent siblings)
11 siblings, 0 replies; 22+ messages in thread
From: Richard Zhao @ 2011-11-11 1:10 UTC (permalink / raw)
To: linux-arm-kernel, linux-i2c, linux-mmc, netdev, linux-serial
Cc: linux, amit.kucheria, kernel, ben-linux, cjb, alan, eric.miao,
Richard Zhao
Signed-off-by: Richard Zhao <richard.zhao@linaro.org>
---
arch/arm/plat-mxc/time.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/arch/arm/plat-mxc/time.c b/arch/arm/plat-mxc/time.c
index 4b0fe28..b4e8b18 100644
--- a/arch/arm/plat-mxc/time.c
+++ b/arch/arm/plat-mxc/time.c
@@ -292,7 +292,7 @@ void __init mxc_timer_init(struct clk *timer_clk, void __iomem *base, int irq)
{
uint32_t tctl_val;
- clk_enable(timer_clk);
+ clk_prepare_enable(timer_clk);
timer_base = base;
--
1.7.5.4
^ permalink raw reply related [flat|nested] 22+ messages in thread[parent not found: <1320973829-4388-1-git-send-email-richard.zhao-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>]
* [PATCH V2 01/14] clk: add helper functions clk_prepare_enable and clk_disable_unprepare
[not found] ` <1320973829-4388-1-git-send-email-richard.zhao-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
@ 2011-11-11 1:10 ` Richard Zhao
2011-11-11 7:28 ` Baruch Siach
2011-11-11 8:49 ` Sascha Hauer
2011-11-11 1:10 ` [PATCH V2 03/14] ARM: mxc: ahci: add clk_prepare/clk_unprepare Richard Zhao
2011-11-11 1:10 ` [PATCH V2 09/14] ARM: mx31moboard: " Richard Zhao
2 siblings, 2 replies; 22+ messages in thread
From: Richard Zhao @ 2011-11-11 1:10 UTC (permalink / raw)
To: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
linux-i2c-u79uwXL29TY76Z2rM5mHXA,
linux-mmc-u79uwXL29TY76Z2rM5mHXA, netdev-u79uwXL29TY76Z2rM5mHXA,
linux-serial-u79uwXL29TY76Z2rM5mHXA
Cc: linux-lFZ/pmaqli7XmaaqVzeoHQ,
amit.kucheria-Z7WLFzj8eWMS+FvcfC7Uqw,
kernel-bIcnvbaLZ9MEGnE8C9+IrQ, ben-linux-elnMNo+KYs3YtjvyW6yDsg,
cjb-2X9k7bc8m7Mdnm+yROfE0A, alan-VuQAYsv1563Yd54FQh9/CA,
eric.miao-QSEj5FYQhm4dnm+yROfE0A, Richard Zhao
Signed-off-by: Richard Zhao <richard.zhao-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
---
include/linux/clk.h | 19 +++++++++++++++++++
1 files changed, 19 insertions(+), 0 deletions(-)
diff --git a/include/linux/clk.h b/include/linux/clk.h
index 7213b52..63985f7 100644
--- a/include/linux/clk.h
+++ b/include/linux/clk.h
@@ -107,6 +107,25 @@ static inline void clk_unprepare(struct clk *clk)
}
#endif
+static inline int clk_prepare_enable(struct clk *clk)
+{
+ int ret;
+
+ ret = clk_prepare(clk);
+ if (!ret)
+ ret = clk_enable(clk);
+ if (ret)
+ clk_unprepare(clk);
+
+ return ret;
+}
+
+static inline void clk_disable_unprepare(struct clk *clk)
+{
+ clk_disable(clk);
+ clk_unprepare(clk);
+}
+
/**
* clk_get_rate - obtain the current clock rate (in Hz) for a clock source.
* This is only valid once the clock source has been enabled.
--
1.7.5.4
^ permalink raw reply related [flat|nested] 22+ messages in thread* Re: [PATCH V2 01/14] clk: add helper functions clk_prepare_enable and clk_disable_unprepare
2011-11-11 1:10 ` [PATCH V2 01/14] clk: add helper functions clk_prepare_enable and clk_disable_unprepare Richard Zhao
@ 2011-11-11 7:28 ` Baruch Siach
2011-11-11 8:49 ` Sascha Hauer
1 sibling, 0 replies; 22+ messages in thread
From: Baruch Siach @ 2011-11-11 7:28 UTC (permalink / raw)
To: Richard Zhao
Cc: linux-arm-kernel, linux-i2c, linux-mmc, netdev, linux-serial,
amit.kucheria, linux, kernel, eric.miao, ben-linux, cjb, alan
Hi Richard,
On Fri, Nov 11, 2011 at 09:10:16AM +0800, Richard Zhao wrote:
> Signed-off-by: Richard Zhao <richard.zhao@linaro.org>
> ---
> include/linux/clk.h | 19 +++++++++++++++++++
> 1 files changed, 19 insertions(+), 0 deletions(-)
>
> diff --git a/include/linux/clk.h b/include/linux/clk.h
> index 7213b52..63985f7 100644
> --- a/include/linux/clk.h
> +++ b/include/linux/clk.h
> @@ -107,6 +107,25 @@ static inline void clk_unprepare(struct clk *clk)
> }
> #endif
>
> +static inline int clk_prepare_enable(struct clk *clk)
> +{
> + int ret;
> +
> + ret = clk_prepare(clk);
> + if (!ret)
> + ret = clk_enable(clk);
> + if (ret)
Using 'else' here makes the code more readable IMO.
baruch
> + clk_unprepare(clk);
> +
> + return ret;
> +}
> +
> +static inline void clk_disable_unprepare(struct clk *clk)
> +{
> + clk_disable(clk);
> + clk_unprepare(clk);
> +}
> +
> /**
> * clk_get_rate - obtain the current clock rate (in Hz) for a clock source.
> * This is only valid once the clock source has been enabled.
> --
> 1.7.5.4
--
~. .~ Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
- baruch@tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -
^ permalink raw reply [flat|nested] 22+ messages in thread* Re: [PATCH V2 01/14] clk: add helper functions clk_prepare_enable and clk_disable_unprepare
2011-11-11 1:10 ` [PATCH V2 01/14] clk: add helper functions clk_prepare_enable and clk_disable_unprepare Richard Zhao
2011-11-11 7:28 ` Baruch Siach
@ 2011-11-11 8:49 ` Sascha Hauer
2011-11-11 9:05 ` Richard Zhao
1 sibling, 1 reply; 22+ messages in thread
From: Sascha Hauer @ 2011-11-11 8:49 UTC (permalink / raw)
To: Richard Zhao
Cc: linux-arm-kernel, linux-i2c, linux-mmc, netdev, linux-serial,
linux, amit.kucheria, kernel, ben-linux, cjb, alan, eric.miao
On Fri, Nov 11, 2011 at 09:10:16AM +0800, Richard Zhao wrote:
> Signed-off-by: Richard Zhao <richard.zhao@linaro.org>
> ---
> include/linux/clk.h | 19 +++++++++++++++++++
> 1 files changed, 19 insertions(+), 0 deletions(-)
>
> diff --git a/include/linux/clk.h b/include/linux/clk.h
> index 7213b52..63985f7 100644
> --- a/include/linux/clk.h
> +++ b/include/linux/clk.h
> @@ -107,6 +107,25 @@ static inline void clk_unprepare(struct clk *clk)
> }
> #endif
>
> +static inline int clk_prepare_enable(struct clk *clk)
> +{
> + int ret;
> +
> + ret = clk_prepare(clk);
> + if (!ret)
> + ret = clk_enable(clk);
> + if (ret)
> + clk_unprepare(clk);
As Baruch already pointed out this is hard to read. Also it contains a
bug. When clk_prepare fails clk_unprepare is called afterwards.
Hint: Kernel guys are not afraid of having multiple return statements
in a function, instead they like it when something is handled early
without having to read the rest of the function.
Sascha
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
^ permalink raw reply [flat|nested] 22+ messages in thread* Re: [PATCH V2 01/14] clk: add helper functions clk_prepare_enable and clk_disable_unprepare
2011-11-11 8:49 ` Sascha Hauer
@ 2011-11-11 9:05 ` Richard Zhao
2011-11-11 9:15 ` Sascha Hauer
0 siblings, 1 reply; 22+ messages in thread
From: Richard Zhao @ 2011-11-11 9:05 UTC (permalink / raw)
To: Sascha Hauer
Cc: amit.kucheria, linux, kernel, netdev, linux-mmc, ben-linux,
eric.miao, linux-i2c, linux-serial, cjb, linux-arm-kernel, alan
On Fri, Nov 11, 2011 at 09:49:50AM +0100, Sascha Hauer wrote:
> On Fri, Nov 11, 2011 at 09:10:16AM +0800, Richard Zhao wrote:
> > Signed-off-by: Richard Zhao <richard.zhao@linaro.org>
> > ---
> > include/linux/clk.h | 19 +++++++++++++++++++
> > 1 files changed, 19 insertions(+), 0 deletions(-)
> >
> > diff --git a/include/linux/clk.h b/include/linux/clk.h
> > index 7213b52..63985f7 100644
> > --- a/include/linux/clk.h
> > +++ b/include/linux/clk.h
> > @@ -107,6 +107,25 @@ static inline void clk_unprepare(struct clk *clk)
> > }
> > #endif
> >
> > +static inline int clk_prepare_enable(struct clk *clk)
> > +{
> > + int ret;
> > +
> > + ret = clk_prepare(clk);
> > + if (!ret)
> > + ret = clk_enable(clk);
> > + if (ret)
> > + clk_unprepare(clk);
>
> As Baruch already pointed out this is hard to read. Also it contains a
> bug. When clk_prepare fails clk_unprepare is called afterwards.
>
> Hint: Kernel guys are not afraid of having multiple return statements
> in a function, instead they like it when something is handled early
> without having to read the rest of the function.
{
int ret;
ret = clk_prepare(clk);
if (ret)
return ret;
ret = clk_enable(clk);
if (ret)
clk_unprepare(clk);
return ret;
Like above code? Thanks for review.
Richard
>
> Sascha
>
> --
> Pengutronix e.K. | |
> Industrial Linux Solutions | http://www.pengutronix.de/ |
> Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
> Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
>
^ permalink raw reply [flat|nested] 22+ messages in thread* Re: [PATCH V2 01/14] clk: add helper functions clk_prepare_enable and clk_disable_unprepare
2011-11-11 9:05 ` Richard Zhao
@ 2011-11-11 9:15 ` Sascha Hauer
2011-11-11 10:27 ` Russell King - ARM Linux
0 siblings, 1 reply; 22+ messages in thread
From: Sascha Hauer @ 2011-11-11 9:15 UTC (permalink / raw)
To: Richard Zhao
Cc: amit.kucheria, linux, kernel, netdev, linux-mmc, ben-linux,
eric.miao, linux-i2c, linux-serial, cjb, linux-arm-kernel, alan
On Fri, Nov 11, 2011 at 05:05:47PM +0800, Richard Zhao wrote:
> On Fri, Nov 11, 2011 at 09:49:50AM +0100, Sascha Hauer wrote:
> > On Fri, Nov 11, 2011 at 09:10:16AM +0800, Richard Zhao wrote:
> > > Signed-off-by: Richard Zhao <richard.zhao@linaro.org>
> > > ---
> > > include/linux/clk.h | 19 +++++++++++++++++++
> > > 1 files changed, 19 insertions(+), 0 deletions(-)
> > >
> > > diff --git a/include/linux/clk.h b/include/linux/clk.h
> > > index 7213b52..63985f7 100644
> > > --- a/include/linux/clk.h
> > > +++ b/include/linux/clk.h
> > > @@ -107,6 +107,25 @@ static inline void clk_unprepare(struct clk *clk)
> > > }
> > > #endif
> > >
> > > +static inline int clk_prepare_enable(struct clk *clk)
> > > +{
> > > + int ret;
> > > +
> > > + ret = clk_prepare(clk);
> > > + if (!ret)
> > > + ret = clk_enable(clk);
> > > + if (ret)
> > > + clk_unprepare(clk);
> >
> > As Baruch already pointed out this is hard to read. Also it contains a
> > bug. When clk_prepare fails clk_unprepare is called afterwards.
> >
> > Hint: Kernel guys are not afraid of having multiple return statements
> > in a function, instead they like it when something is handled early
> > without having to read the rest of the function.
> {
> int ret;
>
> ret = clk_prepare(clk);
> if (ret)
> return ret;
> ret = clk_enable(clk);
> if (ret)
> clk_unprepare(clk);
> return ret;
Yes, looks good.
Sascha
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
^ permalink raw reply [flat|nested] 22+ messages in thread* Re: [PATCH V2 01/14] clk: add helper functions clk_prepare_enable and clk_disable_unprepare
2011-11-11 9:15 ` Sascha Hauer
@ 2011-11-11 10:27 ` Russell King - ARM Linux
2011-11-11 11:56 ` Sascha Hauer
0 siblings, 1 reply; 22+ messages in thread
From: Russell King - ARM Linux @ 2011-11-11 10:27 UTC (permalink / raw)
To: Sascha Hauer
Cc: Richard Zhao, amit.kucheria, kernel, netdev, linux-mmc, ben-linux,
eric.miao, linux-i2c, linux-serial, cjb, linux-arm-kernel, alan
On Fri, Nov 11, 2011 at 10:15:56AM +0100, Sascha Hauer wrote:
> On Fri, Nov 11, 2011 at 05:05:47PM +0800, Richard Zhao wrote:
> > {
> > int ret;
> >
> > ret = clk_prepare(clk);
> > if (ret)
> > return ret;
> > ret = clk_enable(clk);
> > if (ret)
> > clk_unprepare(clk);
> > return ret;
>
> Yes, looks good.
While this looks like a nice easy solution for converting existing
drivers, I'd suggest thinking about this a little more...
I would suggest some thought is given to the placement of clk_enable()
and clk_disable() when adding clk_prepare(), especially if your existing
clk_enable() function can only be called from non-atomic contexts.
Obviously, the transition path needs to be along these lines:
1. add clk_prepare() to drivers
2. implement clk_prepare() and make clk_enable() callable from non-atomic
contexts
3. move clk_enable() in drivers to places it can be called from non-atomic
contexts to achieve greater power savings (maybe via the runtime pm)
and where a driver is shared between different sub-architectures which
have non-atomic clk_enable()s, (3) can only happen when all those sub-
architectures have been updated to step (2).
^ permalink raw reply [flat|nested] 22+ messages in thread* Re: [PATCH V2 01/14] clk: add helper functions clk_prepare_enable and clk_disable_unprepare
2011-11-11 10:27 ` Russell King - ARM Linux
@ 2011-11-11 11:56 ` Sascha Hauer
[not found] ` <20111111115644.GT16886-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
0 siblings, 1 reply; 22+ messages in thread
From: Sascha Hauer @ 2011-11-11 11:56 UTC (permalink / raw)
To: Russell King - ARM Linux
Cc: Richard Zhao, amit.kucheria, kernel, netdev, linux-mmc, ben-linux,
eric.miao, linux-i2c, linux-serial, cjb, linux-arm-kernel, alan
On Fri, Nov 11, 2011 at 10:27:27AM +0000, Russell King - ARM Linux wrote:
> On Fri, Nov 11, 2011 at 10:15:56AM +0100, Sascha Hauer wrote:
> > On Fri, Nov 11, 2011 at 05:05:47PM +0800, Richard Zhao wrote:
> > > {
> > > int ret;
> > >
> > > ret = clk_prepare(clk);
> > > if (ret)
> > > return ret;
> > > ret = clk_enable(clk);
> > > if (ret)
> > > clk_unprepare(clk);
> > > return ret;
> >
> > Yes, looks good.
>
> While this looks like a nice easy solution for converting existing
> drivers, I'd suggest thinking about this a little more...
>
> I would suggest some thought is given to the placement of clk_enable()
> and clk_disable() when adding clk_prepare(), especially if your existing
> clk_enable() function can only be called from non-atomic contexts.
>
> Obviously, the transition path needs to be along these lines:
>
> 1. add clk_prepare() to drivers
> 2. implement clk_prepare() and make clk_enable() callable from non-atomic
> contexts
> 3. move clk_enable() in drivers to places it can be called from non-atomic
> contexts to achieve greater power savings (maybe via the runtime pm)
>
> and where a driver is shared between different sub-architectures which
> have non-atomic clk_enable()s, (3) can only happen when all those sub-
> architectures have been updated to step (2).
The drivers changed here all do clk_prepare/enable in their probe
function. I agree that this clk_prepare_enable patch gives kind of
wrong motivation to just use this function and to forget about
potential power savings with proper integration of clk_prepare/enable.
I think though that it will take a long time until all drivers really
do this no matter if we have such a helper or not. I think that in the
meantime it's better to have a little helper than to clobber the probe
code with additional error handling.
Sascha
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
^ permalink raw reply [flat|nested] 22+ messages in thread
* [PATCH V2 03/14] ARM: mxc: ahci: add clk_prepare/clk_unprepare
[not found] ` <1320973829-4388-1-git-send-email-richard.zhao-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2011-11-11 1:10 ` [PATCH V2 01/14] clk: add helper functions clk_prepare_enable and clk_disable_unprepare Richard Zhao
@ 2011-11-11 1:10 ` Richard Zhao
2011-11-11 1:10 ` [PATCH V2 09/14] ARM: mx31moboard: " Richard Zhao
2 siblings, 0 replies; 22+ messages in thread
From: Richard Zhao @ 2011-11-11 1:10 UTC (permalink / raw)
To: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
linux-i2c-u79uwXL29TY76Z2rM5mHXA,
linux-mmc-u79uwXL29TY76Z2rM5mHXA, netdev-u79uwXL29TY76Z2rM5mHXA,
linux-serial-u79uwXL29TY76Z2rM5mHXA
Cc: linux-lFZ/pmaqli7XmaaqVzeoHQ,
amit.kucheria-Z7WLFzj8eWMS+FvcfC7Uqw,
kernel-bIcnvbaLZ9MEGnE8C9+IrQ, ben-linux-elnMNo+KYs3YtjvyW6yDsg,
cjb-2X9k7bc8m7Mdnm+yROfE0A, alan-VuQAYsv1563Yd54FQh9/CA,
eric.miao-QSEj5FYQhm4dnm+yROfE0A, Richard Zhao
Signed-off-by: Richard Zhao <richard.zhao-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
---
arch/arm/plat-mxc/devices/platform-ahci-imx.c | 16 ++++++++--------
1 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/arch/arm/plat-mxc/devices/platform-ahci-imx.c b/arch/arm/plat-mxc/devices/platform-ahci-imx.c
index d8a56ae..ade4a1c 100644
--- a/arch/arm/plat-mxc/devices/platform-ahci-imx.c
+++ b/arch/arm/plat-mxc/devices/platform-ahci-imx.c
@@ -60,9 +60,9 @@ static int imx_sata_init(struct device *dev, void __iomem *addr)
dev_err(dev, "no sata clock.\n");
return PTR_ERR(sata_clk);
}
- ret = clk_enable(sata_clk);
+ ret = clk_prepare_enable(sata_clk);
if (ret) {
- dev_err(dev, "can't enable sata clock.\n");
+ dev_err(dev, "can't prepare/enable sata clock.\n");
goto put_sata_clk;
}
@@ -73,9 +73,9 @@ static int imx_sata_init(struct device *dev, void __iomem *addr)
ret = PTR_ERR(sata_ref_clk);
goto release_sata_clk;
}
- ret = clk_enable(sata_ref_clk);
+ ret = clk_prepare_enable(sata_ref_clk);
if (ret) {
- dev_err(dev, "can't enable sata ref clock.\n");
+ dev_err(dev, "can't prepare/enable sata ref clock.\n");
goto put_sata_ref_clk;
}
@@ -104,11 +104,11 @@ static int imx_sata_init(struct device *dev, void __iomem *addr)
return 0;
release_sata_ref_clk:
- clk_disable(sata_ref_clk);
+ clk_disable_unprepare(sata_ref_clk);
put_sata_ref_clk:
clk_put(sata_ref_clk);
release_sata_clk:
- clk_disable(sata_clk);
+ clk_disable_unprepare(sata_clk);
put_sata_clk:
clk_put(sata_clk);
@@ -117,10 +117,10 @@ put_sata_clk:
static void imx_sata_exit(struct device *dev)
{
- clk_disable(sata_ref_clk);
+ clk_disable_unprepare(sata_ref_clk);
clk_put(sata_ref_clk);
- clk_disable(sata_clk);
+ clk_disable_unprepare(sata_clk);
clk_put(sata_clk);
}
--
1.7.5.4
^ permalink raw reply related [flat|nested] 22+ messages in thread* [PATCH V2 09/14] ARM: mx31moboard: add clk_prepare/clk_unprepare
[not found] ` <1320973829-4388-1-git-send-email-richard.zhao-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2011-11-11 1:10 ` [PATCH V2 01/14] clk: add helper functions clk_prepare_enable and clk_disable_unprepare Richard Zhao
2011-11-11 1:10 ` [PATCH V2 03/14] ARM: mxc: ahci: add clk_prepare/clk_unprepare Richard Zhao
@ 2011-11-11 1:10 ` Richard Zhao
2 siblings, 0 replies; 22+ messages in thread
From: Richard Zhao @ 2011-11-11 1:10 UTC (permalink / raw)
To: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
linux-i2c-u79uwXL29TY76Z2rM5mHXA,
linux-mmc-u79uwXL29TY76Z2rM5mHXA, netdev-u79uwXL29TY76Z2rM5mHXA,
linux-serial-u79uwXL29TY76Z2rM5mHXA
Cc: linux-lFZ/pmaqli7XmaaqVzeoHQ,
amit.kucheria-Z7WLFzj8eWMS+FvcfC7Uqw,
kernel-bIcnvbaLZ9MEGnE8C9+IrQ, ben-linux-elnMNo+KYs3YtjvyW6yDsg,
cjb-2X9k7bc8m7Mdnm+yROfE0A, alan-VuQAYsv1563Yd54FQh9/CA,
eric.miao-QSEj5FYQhm4dnm+yROfE0A, Richard Zhao
Signed-off-by: Richard Zhao <richard.zhao-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
---
arch/arm/mach-imx/mach-mx31moboard.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/arch/arm/mach-imx/mach-mx31moboard.c b/arch/arm/mach-imx/mach-mx31moboard.c
index 07034f4..d1a9337 100644
--- a/arch/arm/mach-imx/mach-mx31moboard.c
+++ b/arch/arm/mach-imx/mach-mx31moboard.c
@@ -505,7 +505,7 @@ static void mx31moboard_poweroff(void)
struct clk *clk = clk_get_sys("imx2-wdt.0", NULL);
if (!IS_ERR(clk))
- clk_enable(clk);
+ clk_prepare_enable(clk);
mxc_iomux_mode(MX31_PIN_WATCHDOG_RST__WATCHDOG_RST);
--
1.7.5.4
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH V2 04/14] ARM: mxc: pwm: add clk_prepare/clk_unprepare
2011-11-11 1:10 [PATCH V2 00/14] add clk_prepare/clk_unprepare to imx drivers Richard Zhao
2011-11-11 1:10 ` [PATCH V2 02/14] ARM: mxc: time: add clk_prepare/clk_unprepare Richard Zhao
[not found] ` <1320973829-4388-1-git-send-email-richard.zhao-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
@ 2011-11-11 1:10 ` Richard Zhao
2011-11-11 1:10 ` [PATCH V2 05/14] ARM: mxc: epit: " Richard Zhao
` (8 subsequent siblings)
11 siblings, 0 replies; 22+ messages in thread
From: Richard Zhao @ 2011-11-11 1:10 UTC (permalink / raw)
To: linux-arm-kernel, linux-i2c, linux-mmc, netdev, linux-serial
Cc: amit.kucheria, linux, kernel, eric.miao, ben-linux, cjb,
Richard Zhao, alan
Signed-off-by: Richard Zhao <richard.zhao@linaro.org>
---
arch/arm/plat-mxc/pwm.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/arm/plat-mxc/pwm.c b/arch/arm/plat-mxc/pwm.c
index 42d74ea..68c7199b 100644
--- a/arch/arm/plat-mxc/pwm.c
+++ b/arch/arm/plat-mxc/pwm.c
@@ -118,7 +118,7 @@ int pwm_enable(struct pwm_device *pwm)
int rc = 0;
if (!pwm->clk_enabled) {
- rc = clk_enable(pwm->clk);
+ rc = clk_prepare_enable(pwm->clk);
if (!rc)
pwm->clk_enabled = 1;
}
@@ -131,7 +131,7 @@ void pwm_disable(struct pwm_device *pwm)
writel(0, pwm->mmio_base + MX3_PWMCR);
if (pwm->clk_enabled) {
- clk_disable(pwm->clk);
+ clk_disable_unprepare(pwm->clk);
pwm->clk_enabled = 0;
}
}
--
1.7.5.4
^ permalink raw reply related [flat|nested] 22+ messages in thread* [PATCH V2 05/14] ARM: mxc: epit: add clk_prepare/clk_unprepare
2011-11-11 1:10 [PATCH V2 00/14] add clk_prepare/clk_unprepare to imx drivers Richard Zhao
` (2 preceding siblings ...)
2011-11-11 1:10 ` [PATCH V2 04/14] ARM: mxc: pwm: " Richard Zhao
@ 2011-11-11 1:10 ` Richard Zhao
2011-11-11 1:10 ` [PATCH V2 06/14] ARM: mxc: arch_reset: " Richard Zhao
` (7 subsequent siblings)
11 siblings, 0 replies; 22+ messages in thread
From: Richard Zhao @ 2011-11-11 1:10 UTC (permalink / raw)
To: linux-arm-kernel, linux-i2c, linux-mmc, netdev, linux-serial
Cc: linux, amit.kucheria, kernel, ben-linux, cjb, alan, eric.miao,
Richard Zhao
Signed-off-by: Richard Zhao <richard.zhao@linaro.org>
---
arch/arm/plat-mxc/epit.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/arch/arm/plat-mxc/epit.c b/arch/arm/plat-mxc/epit.c
index d3467f8..9129c9e 100644
--- a/arch/arm/plat-mxc/epit.c
+++ b/arch/arm/plat-mxc/epit.c
@@ -203,7 +203,7 @@ static int __init epit_clockevent_init(struct clk *timer_clk)
void __init epit_timer_init(struct clk *timer_clk, void __iomem *base, int irq)
{
- clk_enable(timer_clk);
+ clk_prepare_enable(timer_clk);
timer_base = base;
--
1.7.5.4
^ permalink raw reply related [flat|nested] 22+ messages in thread* [PATCH V2 06/14] ARM: mxc: arch_reset: add clk_prepare/clk_unprepare
2011-11-11 1:10 [PATCH V2 00/14] add clk_prepare/clk_unprepare to imx drivers Richard Zhao
` (3 preceding siblings ...)
2011-11-11 1:10 ` [PATCH V2 05/14] ARM: mxc: epit: " Richard Zhao
@ 2011-11-11 1:10 ` Richard Zhao
2011-11-11 1:10 ` [PATCH V2 07/14] ARM: mxc: audmux-v2: " Richard Zhao
` (6 subsequent siblings)
11 siblings, 0 replies; 22+ messages in thread
From: Richard Zhao @ 2011-11-11 1:10 UTC (permalink / raw)
To: linux-arm-kernel, linux-i2c, linux-mmc, netdev, linux-serial
Cc: linux, amit.kucheria, kernel, ben-linux, cjb, alan, eric.miao,
Richard Zhao
Signed-off-by: Richard Zhao <richard.zhao@linaro.org>
---
arch/arm/plat-mxc/system.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/arch/arm/plat-mxc/system.c b/arch/arm/plat-mxc/system.c
index 9dad8dc..a667adc 100644
--- a/arch/arm/plat-mxc/system.c
+++ b/arch/arm/plat-mxc/system.c
@@ -54,7 +54,7 @@ void arch_reset(char mode, const char *cmd)
clk = clk_get_sys("imx2-wdt.0", NULL);
if (!IS_ERR(clk))
- clk_enable(clk);
+ clk_prepare_enable(clk);
wcr_enable = (1 << 2);
}
--
1.7.5.4
^ permalink raw reply related [flat|nested] 22+ messages in thread* [PATCH V2 07/14] ARM: mxc: audmux-v2: add clk_prepare/clk_unprepare
2011-11-11 1:10 [PATCH V2 00/14] add clk_prepare/clk_unprepare to imx drivers Richard Zhao
` (4 preceding siblings ...)
2011-11-11 1:10 ` [PATCH V2 06/14] ARM: mxc: arch_reset: " Richard Zhao
@ 2011-11-11 1:10 ` Richard Zhao
2011-11-11 1:10 ` [PATCH V2 08/14] ARM: pm-imx5: " Richard Zhao
` (5 subsequent siblings)
11 siblings, 0 replies; 22+ messages in thread
From: Richard Zhao @ 2011-11-11 1:10 UTC (permalink / raw)
To: linux-arm-kernel, linux-i2c, linux-mmc, netdev, linux-serial
Cc: linux, amit.kucheria, kernel, ben-linux, cjb, alan, eric.miao,
Richard Zhao
Signed-off-by: Richard Zhao <richard.zhao@linaro.org>
---
arch/arm/plat-mxc/audmux-v2.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/arch/arm/plat-mxc/audmux-v2.c b/arch/arm/plat-mxc/audmux-v2.c
index 8cced35..0e51fc3 100644
--- a/arch/arm/plat-mxc/audmux-v2.c
+++ b/arch/arm/plat-mxc/audmux-v2.c
@@ -73,13 +73,13 @@ static ssize_t audmux_read_file(struct file *file, char __user *user_buf,
return -ENOMEM;
if (audmux_clk)
- clk_enable(audmux_clk);
+ clk_prepare_enable(audmux_clk);
ptcr = readl(audmux_base + MXC_AUDMUX_V2_PTCR(port));
pdcr = readl(audmux_base + MXC_AUDMUX_V2_PDCR(port));
if (audmux_clk)
- clk_disable(audmux_clk);
+ clk_disable_unprepare(audmux_clk);
ret = snprintf(buf, PAGE_SIZE, "PDCR: %08x\nPTCR: %08x\n",
pdcr, ptcr);
@@ -172,13 +172,13 @@ int mxc_audmux_v2_configure_port(unsigned int port, unsigned int ptcr,
return -ENOSYS;
if (audmux_clk)
- clk_enable(audmux_clk);
+ clk_prepare_enable(audmux_clk);
writel(ptcr, audmux_base + MXC_AUDMUX_V2_PTCR(port));
writel(pdcr, audmux_base + MXC_AUDMUX_V2_PDCR(port));
if (audmux_clk)
- clk_disable(audmux_clk);
+ clk_disable_unprepare(audmux_clk);
return 0;
}
--
1.7.5.4
^ permalink raw reply related [flat|nested] 22+ messages in thread* [PATCH V2 08/14] ARM: pm-imx5: add clk_prepare/clk_unprepare
2011-11-11 1:10 [PATCH V2 00/14] add clk_prepare/clk_unprepare to imx drivers Richard Zhao
` (5 preceding siblings ...)
2011-11-11 1:10 ` [PATCH V2 07/14] ARM: mxc: audmux-v2: " Richard Zhao
@ 2011-11-11 1:10 ` Richard Zhao
2011-11-11 1:10 ` [PATCH V2 10/14] ARM: mxs: " Richard Zhao
` (4 subsequent siblings)
11 siblings, 0 replies; 22+ messages in thread
From: Richard Zhao @ 2011-11-11 1:10 UTC (permalink / raw)
To: linux-arm-kernel, linux-i2c, linux-mmc, netdev, linux-serial
Cc: amit.kucheria, linux, kernel, eric.miao, ben-linux, cjb,
Richard Zhao, alan
Signed-off-by: Richard Zhao <richard.zhao@linaro.org>
---
arch/arm/mach-mx5/pm-imx5.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/arm/mach-mx5/pm-imx5.c b/arch/arm/mach-mx5/pm-imx5.c
index 98052fc..2bdc85f 100644
--- a/arch/arm/mach-mx5/pm-imx5.c
+++ b/arch/arm/mach-mx5/pm-imx5.c
@@ -22,7 +22,7 @@ static struct clk *gpc_dvfs_clk;
static int mx5_suspend_prepare(void)
{
- return clk_enable(gpc_dvfs_clk);
+ return clk_prepare_enable(gpc_dvfs_clk);
}
static int mx5_suspend_enter(suspend_state_t state)
@@ -52,7 +52,7 @@ static int mx5_suspend_enter(suspend_state_t state)
static void mx5_suspend_finish(void)
{
- clk_disable(gpc_dvfs_clk);
+ clk_disable_unprepare(gpc_dvfs_clk);
}
static int mx5_pm_valid(suspend_state_t state)
--
1.7.5.4
^ permalink raw reply related [flat|nested] 22+ messages in thread* [PATCH V2 10/14] ARM: mxs: add clk_prepare/clk_unprepare
2011-11-11 1:10 [PATCH V2 00/14] add clk_prepare/clk_unprepare to imx drivers Richard Zhao
` (6 preceding siblings ...)
2011-11-11 1:10 ` [PATCH V2 08/14] ARM: pm-imx5: " Richard Zhao
@ 2011-11-11 1:10 ` Richard Zhao
2011-11-11 1:10 ` [PATCH V2 11/14] serial: imx: " Richard Zhao
` (3 subsequent siblings)
11 siblings, 0 replies; 22+ messages in thread
From: Richard Zhao @ 2011-11-11 1:10 UTC (permalink / raw)
To: linux-arm-kernel, linux-i2c, linux-mmc, netdev, linux-serial
Cc: linux, amit.kucheria, kernel, ben-linux, cjb, alan, eric.miao,
Richard Zhao
Signed-off-by: Richard Zhao <richard.zhao@linaro.org>
---
arch/arm/mach-mxs/system.c | 2 +-
arch/arm/mach-mxs/timer.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/arm/mach-mxs/system.c b/arch/arm/mach-mxs/system.c
index 20ec3bd..9760a12 100644
--- a/arch/arm/mach-mxs/system.c
+++ b/arch/arm/mach-mxs/system.c
@@ -66,7 +66,7 @@ static int __init mxs_arch_reset_init(void)
clk = clk_get_sys("rtc", NULL);
if (!IS_ERR(clk))
- clk_enable(clk);
+ clk_prepare_enable(clk);
return 0;
}
diff --git a/arch/arm/mach-mxs/timer.c b/arch/arm/mach-mxs/timer.c
index cace0d2..564a632 100644
--- a/arch/arm/mach-mxs/timer.c
+++ b/arch/arm/mach-mxs/timer.c
@@ -245,7 +245,7 @@ static int __init mxs_clocksource_init(struct clk *timer_clk)
void __init mxs_timer_init(struct clk *timer_clk, int irq)
{
- clk_enable(timer_clk);
+ clk_prepare_enable(timer_clk);
/*
* Initialize timers to a known state
--
1.7.5.4
^ permalink raw reply related [flat|nested] 22+ messages in thread* [PATCH V2 11/14] serial: imx: add clk_prepare/clk_unprepare
2011-11-11 1:10 [PATCH V2 00/14] add clk_prepare/clk_unprepare to imx drivers Richard Zhao
` (7 preceding siblings ...)
2011-11-11 1:10 ` [PATCH V2 10/14] ARM: mxs: " Richard Zhao
@ 2011-11-11 1:10 ` Richard Zhao
2011-11-11 1:10 ` [PATCH V2 12/14] net: fec: " Richard Zhao
` (2 subsequent siblings)
11 siblings, 0 replies; 22+ messages in thread
From: Richard Zhao @ 2011-11-11 1:10 UTC (permalink / raw)
To: linux-arm-kernel, linux-i2c, linux-mmc, netdev, linux-serial
Cc: linux, amit.kucheria, kernel, ben-linux, cjb, alan, eric.miao,
Richard Zhao
Signed-off-by: Richard Zhao <richard.zhao@linaro.org>
---
drivers/tty/serial/imx.c | 7 +++----
1 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
index 163fc90..8f3709f 100644
--- a/drivers/tty/serial/imx.c
+++ b/drivers/tty/serial/imx.c
@@ -1390,7 +1390,7 @@ static int serial_imx_probe(struct platform_device *pdev)
ret = PTR_ERR(sport->clk);
goto unmap;
}
- clk_enable(sport->clk);
+ clk_prepare_enable(sport->clk);
sport->port.uartclk = clk_get_rate(sport->clk);
@@ -1413,8 +1413,8 @@ deinit:
if (pdata && pdata->exit)
pdata->exit(pdev);
clkput:
+ clk_disable_unprepare(sport->clk);
clk_put(sport->clk);
- clk_disable(sport->clk);
unmap:
iounmap(sport->port.membase);
free:
@@ -1434,11 +1434,10 @@ static int serial_imx_remove(struct platform_device *pdev)
if (sport) {
uart_remove_one_port(&imx_reg, &sport->port);
+ clk_disable_unprepare(sport->clk);
clk_put(sport->clk);
}
- clk_disable(sport->clk);
-
if (pdata && pdata->exit)
pdata->exit(pdev);
--
1.7.5.4
^ permalink raw reply related [flat|nested] 22+ messages in thread* [PATCH V2 12/14] net: fec: add clk_prepare/clk_unprepare
2011-11-11 1:10 [PATCH V2 00/14] add clk_prepare/clk_unprepare to imx drivers Richard Zhao
` (8 preceding siblings ...)
2011-11-11 1:10 ` [PATCH V2 11/14] serial: imx: " Richard Zhao
@ 2011-11-11 1:10 ` Richard Zhao
2011-11-11 1:10 ` [PATCH V2 13/14] i2c: imx: " Richard Zhao
2011-11-11 1:10 ` [PATCH V2 14/14] mmc: sdhci-esdhc-imx: " Richard Zhao
11 siblings, 0 replies; 22+ messages in thread
From: Richard Zhao @ 2011-11-11 1:10 UTC (permalink / raw)
To: linux-arm-kernel, linux-i2c, linux-mmc, netdev, linux-serial
Cc: linux, amit.kucheria, kernel, ben-linux, cjb, alan, eric.miao,
Richard Zhao
Signed-off-by: Richard Zhao <richard.zhao@linaro.org>
---
drivers/net/ethernet/freescale/fec.c | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/net/ethernet/freescale/fec.c b/drivers/net/ethernet/freescale/fec.c
index 1124ce0..e96fa44 100644
--- a/drivers/net/ethernet/freescale/fec.c
+++ b/drivers/net/ethernet/freescale/fec.c
@@ -1588,7 +1588,7 @@ fec_probe(struct platform_device *pdev)
ret = PTR_ERR(fep->clk);
goto failed_clk;
}
- clk_enable(fep->clk);
+ clk_prepare_enable(fep->clk);
ret = fec_enet_init(ndev);
if (ret)
@@ -1611,7 +1611,7 @@ failed_register:
fec_enet_mii_remove(fep);
failed_mii_init:
failed_init:
- clk_disable(fep->clk);
+ clk_disable_unprepare(fep->clk);
clk_put(fep->clk);
failed_clk:
for (i = 0; i < FEC_IRQ_NUM; i++) {
@@ -1638,7 +1638,7 @@ fec_drv_remove(struct platform_device *pdev)
fec_stop(ndev);
fec_enet_mii_remove(fep);
- clk_disable(fep->clk);
+ clk_disable_unprepare(fep->clk);
clk_put(fep->clk);
iounmap(fep->hwp);
unregister_netdev(ndev);
@@ -1664,7 +1664,7 @@ fec_suspend(struct device *dev)
fec_stop(ndev);
netif_device_detach(ndev);
}
- clk_disable(fep->clk);
+ clk_disable_unprepare(fep->clk);
return 0;
}
@@ -1675,7 +1675,7 @@ fec_resume(struct device *dev)
struct net_device *ndev = dev_get_drvdata(dev);
struct fec_enet_private *fep = netdev_priv(ndev);
- clk_enable(fep->clk);
+ clk_prepare_enable(fep->clk);
if (netif_running(ndev)) {
fec_restart(ndev, fep->full_duplex);
netif_device_attach(ndev);
--
1.7.5.4
^ permalink raw reply related [flat|nested] 22+ messages in thread* [PATCH V2 13/14] i2c: imx: add clk_prepare/clk_unprepare
2011-11-11 1:10 [PATCH V2 00/14] add clk_prepare/clk_unprepare to imx drivers Richard Zhao
` (9 preceding siblings ...)
2011-11-11 1:10 ` [PATCH V2 12/14] net: fec: " Richard Zhao
@ 2011-11-11 1:10 ` Richard Zhao
2011-11-11 1:10 ` [PATCH V2 14/14] mmc: sdhci-esdhc-imx: " Richard Zhao
11 siblings, 0 replies; 22+ messages in thread
From: Richard Zhao @ 2011-11-11 1:10 UTC (permalink / raw)
To: linux-arm-kernel, linux-i2c, linux-mmc, netdev, linux-serial
Cc: amit.kucheria, linux, kernel, eric.miao, ben-linux, cjb,
Richard Zhao, alan
Signed-off-by: Richard Zhao <richard.zhao@linaro.org>
---
drivers/i2c/busses/i2c-imx.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c
index 58832e5..8d1ab6f 100644
--- a/drivers/i2c/busses/i2c-imx.c
+++ b/drivers/i2c/busses/i2c-imx.c
@@ -196,7 +196,7 @@ static int i2c_imx_start(struct imx_i2c_struct *i2c_imx)
dev_dbg(&i2c_imx->adapter.dev, "<%s>\n", __func__);
- clk_enable(i2c_imx->clk);
+ clk_prepare_enable(i2c_imx->clk);
writeb(i2c_imx->ifdr, i2c_imx->base + IMX_I2C_IFDR);
/* Enable I2C controller */
writeb(0, i2c_imx->base + IMX_I2C_I2SR);
@@ -245,7 +245,7 @@ static void i2c_imx_stop(struct imx_i2c_struct *i2c_imx)
/* Disable I2C controller */
writeb(0, i2c_imx->base + IMX_I2C_I2CR);
- clk_disable(i2c_imx->clk);
+ clk_disable_unprepare(i2c_imx->clk);
}
static void __init i2c_imx_set_clk(struct imx_i2c_struct *i2c_imx,
--
1.7.5.4
^ permalink raw reply related [flat|nested] 22+ messages in thread* [PATCH V2 14/14] mmc: sdhci-esdhc-imx: add clk_prepare/clk_unprepare
2011-11-11 1:10 [PATCH V2 00/14] add clk_prepare/clk_unprepare to imx drivers Richard Zhao
` (10 preceding siblings ...)
2011-11-11 1:10 ` [PATCH V2 13/14] i2c: imx: " Richard Zhao
@ 2011-11-11 1:10 ` Richard Zhao
11 siblings, 0 replies; 22+ messages in thread
From: Richard Zhao @ 2011-11-11 1:10 UTC (permalink / raw)
To: linux-arm-kernel, linux-i2c, linux-mmc, netdev, linux-serial
Cc: amit.kucheria, linux, kernel, eric.miao, ben-linux, cjb,
Richard Zhao, alan
Signed-off-by: Richard Zhao <richard.zhao@linaro.org>
---
drivers/mmc/host/sdhci-esdhc-imx.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c
index ae57769..f1ae37e 100644
--- a/drivers/mmc/host/sdhci-esdhc-imx.c
+++ b/drivers/mmc/host/sdhci-esdhc-imx.c
@@ -462,7 +462,7 @@ static int __devinit sdhci_esdhc_imx_probe(struct platform_device *pdev)
err = PTR_ERR(clk);
goto err_clk_get;
}
- clk_enable(clk);
+ clk_prepare_enable(clk);
pltfm_host->clk = clk;
if (!is_imx25_esdhc(imx_data))
@@ -550,7 +550,7 @@ no_card_detect_irq:
gpio_free(boarddata->wp_gpio);
no_card_detect_pin:
no_board_data:
- clk_disable(pltfm_host->clk);
+ clk_disable_unprepare(pltfm_host->clk);
clk_put(pltfm_host->clk);
err_clk_get:
kfree(imx_data);
@@ -577,7 +577,7 @@ static int __devexit sdhci_esdhc_imx_remove(struct platform_device *pdev)
gpio_free(boarddata->cd_gpio);
}
- clk_disable(pltfm_host->clk);
+ clk_disable_unprepare(pltfm_host->clk);
clk_put(pltfm_host->clk);
kfree(imx_data);
--
1.7.5.4
^ permalink raw reply related [flat|nested] 22+ messages in thread