linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/9] ARM: mxc: time: convert to clk_prepare/clk_unprepare
@ 2011-11-10  4:54 Richard Zhao
  2011-11-10  4:54 ` [PATCH 2/9] ARM: mxc: ahci: " Richard Zhao
                   ` (8 more replies)
  0 siblings, 9 replies; 11+ messages in thread
From: Richard Zhao @ 2011-11-10  4:54 UTC (permalink / raw)
  To: linux-arm-kernel

Signed-off-by: Richard Zhao <richard.zhao@linaro.org>
---
 arch/arm/plat-mxc/time.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/arch/arm/plat-mxc/time.c b/arch/arm/plat-mxc/time.c
index 4b0fe28..5fa0cc4 100644
--- a/arch/arm/plat-mxc/time.c
+++ b/arch/arm/plat-mxc/time.c
@@ -292,6 +292,7 @@ void __init mxc_timer_init(struct clk *timer_clk, void __iomem *base, int irq)
 {
 	uint32_t tctl_val;
 
+	clk_prepare(timer_clk);
 	clk_enable(timer_clk);
 
 	timer_base = base;
-- 
1.7.5.4

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

* [PATCH 2/9] ARM: mxc: ahci: convert to clk_prepare/clk_unprepare
  2011-11-10  4:54 [PATCH 1/9] ARM: mxc: time: convert to clk_prepare/clk_unprepare Richard Zhao
@ 2011-11-10  4:54 ` Richard Zhao
  2011-11-10  4:54 ` [PATCH 3/9] ARM: mxc: pwm: " Richard Zhao
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 11+ messages in thread
From: Richard Zhao @ 2011-11-10  4:54 UTC (permalink / raw)
  To: linux-arm-kernel

Signed-off-by: Richard Zhao <richard.zhao@linaro.org>
---
 arch/arm/plat-mxc/devices/platform-ahci-imx.c |   20 ++++++++++++++++++--
 1 files changed, 18 insertions(+), 2 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..7bf3360 100644
--- a/arch/arm/plat-mxc/devices/platform-ahci-imx.c
+++ b/arch/arm/plat-mxc/devices/platform-ahci-imx.c
@@ -60,10 +60,15 @@ 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_prepare(sata_clk);
+	if (ret) {
+		dev_err(dev, "can't prepare sata clock.\n");
+		goto put_sata_clk;
+	}
 	ret = clk_enable(sata_clk);
 	if (ret) {
 		dev_err(dev, "can't enable sata clock.\n");
-		goto put_sata_clk;
+		goto unprepare_sata_clk;
 	}
 
 	/* Get the AHCI SATA PHY CLK */
@@ -73,10 +78,15 @@ static int imx_sata_init(struct device *dev, void __iomem *addr)
 		ret = PTR_ERR(sata_ref_clk);
 		goto release_sata_clk;
 	}
+	ret = clk_prepare(sata_ref_clk);
+	if (ret) {
+		dev_err(dev, "can't prepare sata ref clock.\n");
+		goto put_sata_ref_clk;
+	}
 	ret = clk_enable(sata_ref_clk);
 	if (ret) {
 		dev_err(dev, "can't enable sata ref clock.\n");
-		goto put_sata_ref_clk;
+		goto unprepare_sata_ref_clk;
 	}
 
 	/* Get the AHB clock rate, and configure the TIMER1MS reg later */
@@ -105,10 +115,14 @@ static int imx_sata_init(struct device *dev, void __iomem *addr)
 
 release_sata_ref_clk:
 	clk_disable(sata_ref_clk);
+unprepare_sata_ref_clk:
+	clk_unprepare(sata_ref_clk);
 put_sata_ref_clk:
 	clk_put(sata_ref_clk);
 release_sata_clk:
 	clk_disable(sata_clk);
+unprepare_sata_clk:
+	clk_unprepare(sata_clk);
 put_sata_clk:
 	clk_put(sata_clk);
 
@@ -118,9 +132,11 @@ put_sata_clk:
 static void imx_sata_exit(struct device *dev)
 {
 	clk_disable(sata_ref_clk);
+	clk_unprepare(sata_ref_clk);
 	clk_put(sata_ref_clk);
 
 	clk_disable(sata_clk);
+	clk_unprepare(sata_clk);
 	clk_put(sata_clk);
 
 }
-- 
1.7.5.4

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

* [PATCH 3/9] ARM: mxc: pwm: convert to clk_prepare/clk_unprepare
  2011-11-10  4:54 [PATCH 1/9] ARM: mxc: time: convert to clk_prepare/clk_unprepare Richard Zhao
  2011-11-10  4:54 ` [PATCH 2/9] ARM: mxc: ahci: " Richard Zhao
@ 2011-11-10  4:54 ` Richard Zhao
  2011-11-10  4:54 ` [PATCH 4/9] ARM: mxc: epit: " Richard Zhao
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 11+ messages in thread
From: Richard Zhao @ 2011-11-10  4:54 UTC (permalink / raw)
  To: linux-arm-kernel

Signed-off-by: Richard Zhao <richard.zhao@linaro.org>
---
 arch/arm/plat-mxc/pwm.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/arch/arm/plat-mxc/pwm.c b/arch/arm/plat-mxc/pwm.c
index 42d74ea..3371698 100644
--- a/arch/arm/plat-mxc/pwm.c
+++ b/arch/arm/plat-mxc/pwm.c
@@ -118,9 +118,13 @@ int pwm_enable(struct pwm_device *pwm)
 	int rc = 0;
 
 	if (!pwm->clk_enabled) {
-		rc = clk_enable(pwm->clk);
+		rc = clk_prepare(pwm->clk);
 		if (!rc)
+			rc = clk_enable(pwm->clk);
+		if (!rc) {
 			pwm->clk_enabled = 1;
+		} else
+			clk_unprepare(pwm->clk);
 	}
 	return rc;
 }
@@ -132,6 +136,7 @@ void pwm_disable(struct pwm_device *pwm)
 
 	if (pwm->clk_enabled) {
 		clk_disable(pwm->clk);
+		clk_unprepare(pwm->clk);
 		pwm->clk_enabled = 0;
 	}
 }
-- 
1.7.5.4

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

* [PATCH 4/9] ARM: mxc: epit: convert to clk_prepare/clk_unprepare
  2011-11-10  4:54 [PATCH 1/9] ARM: mxc: time: convert to clk_prepare/clk_unprepare Richard Zhao
  2011-11-10  4:54 ` [PATCH 2/9] ARM: mxc: ahci: " Richard Zhao
  2011-11-10  4:54 ` [PATCH 3/9] ARM: mxc: pwm: " Richard Zhao
@ 2011-11-10  4:54 ` Richard Zhao
  2011-11-10  4:54 ` [PATCH 5/9] ARM: mxc: arch_reset: " Richard Zhao
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 11+ messages in thread
From: Richard Zhao @ 2011-11-10  4:54 UTC (permalink / raw)
  To: linux-arm-kernel

Signed-off-by: Richard Zhao <richard.zhao@linaro.org>
---
 arch/arm/plat-mxc/epit.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/arch/arm/plat-mxc/epit.c b/arch/arm/plat-mxc/epit.c
index d3467f8..1520f38 100644
--- a/arch/arm/plat-mxc/epit.c
+++ b/arch/arm/plat-mxc/epit.c
@@ -203,6 +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_prepare(timer_clk);
 	clk_enable(timer_clk);
 
 	timer_base = base;
-- 
1.7.5.4

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

* [PATCH 5/9] ARM: mxc: arch_reset: convert to clk_prepare/clk_unprepare
  2011-11-10  4:54 [PATCH 1/9] ARM: mxc: time: convert to clk_prepare/clk_unprepare Richard Zhao
                   ` (2 preceding siblings ...)
  2011-11-10  4:54 ` [PATCH 4/9] ARM: mxc: epit: " Richard Zhao
@ 2011-11-10  4:54 ` Richard Zhao
  2011-11-10  4:54 ` [PATCH 6/9] ARM: mxc: audmux-v2: " Richard Zhao
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 11+ messages in thread
From: Richard Zhao @ 2011-11-10  4:54 UTC (permalink / raw)
  To: linux-arm-kernel

Signed-off-by: Richard Zhao <richard.zhao@linaro.org>
---
 arch/arm/plat-mxc/system.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/arch/arm/plat-mxc/system.c b/arch/arm/plat-mxc/system.c
index 9dad8dc..afbe038 100644
--- a/arch/arm/plat-mxc/system.c
+++ b/arch/arm/plat-mxc/system.c
@@ -53,8 +53,10 @@ void arch_reset(char mode, const char *cmd)
 		struct clk *clk;
 
 		clk = clk_get_sys("imx2-wdt.0", NULL);
-		if (!IS_ERR(clk))
+		if (!IS_ERR(clk)) {
+			clk_prepare(clk);
 			clk_enable(clk);
+		}
 		wcr_enable = (1 << 2);
 	}
 
-- 
1.7.5.4

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

* [PATCH 6/9] ARM: mxc: audmux-v2: convert to clk_prepare/clk_unprepare
  2011-11-10  4:54 [PATCH 1/9] ARM: mxc: time: convert to clk_prepare/clk_unprepare Richard Zhao
                   ` (3 preceding siblings ...)
  2011-11-10  4:54 ` [PATCH 5/9] ARM: mxc: arch_reset: " Richard Zhao
@ 2011-11-10  4:54 ` Richard Zhao
  2011-11-10  4:54 ` [PATCH 7/9] ARM: pm-imx5: " Richard Zhao
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 11+ messages in thread
From: Richard Zhao @ 2011-11-10  4:54 UTC (permalink / raw)
  To: linux-arm-kernel

Signed-off-by: Richard Zhao <richard.zhao@linaro.org>
---
 arch/arm/plat-mxc/audmux-v2.c |   16 ++++++++++++----
 1 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/arch/arm/plat-mxc/audmux-v2.c b/arch/arm/plat-mxc/audmux-v2.c
index 8cced35..865e564 100644
--- a/arch/arm/plat-mxc/audmux-v2.c
+++ b/arch/arm/plat-mxc/audmux-v2.c
@@ -72,14 +72,18 @@ static ssize_t audmux_read_file(struct file *file, char __user *user_buf,
 	if (!buf)
 		return -ENOMEM;
 
-	if (audmux_clk)
+	if (audmux_clk) {
+		clk_prepare(audmux_clk);
 		clk_enable(audmux_clk);
+	}
 
 	ptcr = readl(audmux_base + MXC_AUDMUX_V2_PTCR(port));
 	pdcr = readl(audmux_base + MXC_AUDMUX_V2_PDCR(port));
 
-	if (audmux_clk)
+	if (audmux_clk) {
 		clk_disable(audmux_clk);
+		clk_unprepare(audmux_clk);
+	}
 
 	ret = snprintf(buf, PAGE_SIZE, "PDCR: %08x\nPTCR: %08x\n",
 		       pdcr, ptcr);
@@ -171,14 +175,18 @@ int mxc_audmux_v2_configure_port(unsigned int port, unsigned int ptcr,
 	if (!audmux_base)
 		return -ENOSYS;
 
-	if (audmux_clk)
+	if (audmux_clk) {
+		clk_prepare(audmux_clk);
 		clk_enable(audmux_clk);
+	}
 
 	writel(ptcr, audmux_base + MXC_AUDMUX_V2_PTCR(port));
 	writel(pdcr, audmux_base + MXC_AUDMUX_V2_PDCR(port));
 
-	if (audmux_clk)
+	if (audmux_clk) {
 		clk_disable(audmux_clk);
+		clk_unprepare(audmux_clk);
+	}
 
 	return 0;
 }
-- 
1.7.5.4

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

* [PATCH 7/9] ARM: pm-imx5: convert to clk_prepare/clk_unprepare
  2011-11-10  4:54 [PATCH 1/9] ARM: mxc: time: convert to clk_prepare/clk_unprepare Richard Zhao
                   ` (4 preceding siblings ...)
  2011-11-10  4:54 ` [PATCH 6/9] ARM: mxc: audmux-v2: " Richard Zhao
@ 2011-11-10  4:54 ` Richard Zhao
  2011-11-10  4:54 ` [PATCH 8/9] ARM: mx31moboard: " Richard Zhao
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 11+ messages in thread
From: Richard Zhao @ 2011-11-10  4:54 UTC (permalink / raw)
  To: linux-arm-kernel

Signed-off-by: Richard Zhao <richard.zhao@linaro.org>
---
 arch/arm/mach-mx5/pm-imx5.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/arch/arm/mach-mx5/pm-imx5.c b/arch/arm/mach-mx5/pm-imx5.c
index 98052fc..9e8cfe5 100644
--- a/arch/arm/mach-mx5/pm-imx5.c
+++ b/arch/arm/mach-mx5/pm-imx5.c
@@ -22,7 +22,13 @@ static struct clk *gpc_dvfs_clk;
 
 static int mx5_suspend_prepare(void)
 {
-	return clk_enable(gpc_dvfs_clk);
+	int ret;
+	ret = clk_prepare(gpc_dvfs_clk);
+	if (!ret)
+		ret = clk_enable(gpc_dvfs_clk);
+	if (ret)
+		clk_unprepare(gpc_dvfs_clk);
+	return ret;
 }
 
 static int mx5_suspend_enter(suspend_state_t state)
@@ -53,6 +59,7 @@ static int mx5_suspend_enter(suspend_state_t state)
 static void mx5_suspend_finish(void)
 {
 	clk_disable(gpc_dvfs_clk);
+	clk_unprepare(gpc_dvfs_clk);
 }
 
 static int mx5_pm_valid(suspend_state_t state)
-- 
1.7.5.4

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

* [PATCH 8/9] ARM: mx31moboard: convert to clk_prepare/clk_unprepare
  2011-11-10  4:54 [PATCH 1/9] ARM: mxc: time: convert to clk_prepare/clk_unprepare Richard Zhao
                   ` (5 preceding siblings ...)
  2011-11-10  4:54 ` [PATCH 7/9] ARM: pm-imx5: " Richard Zhao
@ 2011-11-10  4:54 ` Richard Zhao
  2011-11-10  4:54 ` [PATCH 9/9] ARM: mxs: " Richard Zhao
  2011-11-10  8:03 ` [PATCH 1/9] ARM: mxc: time: " Sascha Hauer
  8 siblings, 0 replies; 11+ messages in thread
From: Richard Zhao @ 2011-11-10  4:54 UTC (permalink / raw)
  To: linux-arm-kernel

Signed-off-by: Richard Zhao <richard.zhao@linaro.org>
---
 arch/arm/mach-imx/mach-mx31moboard.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/arch/arm/mach-imx/mach-mx31moboard.c b/arch/arm/mach-imx/mach-mx31moboard.c
index 07034f4..1e6e3db 100644
--- a/arch/arm/mach-imx/mach-mx31moboard.c
+++ b/arch/arm/mach-imx/mach-mx31moboard.c
@@ -504,8 +504,10 @@ static void mx31moboard_poweroff(void)
 {
 	struct clk *clk = clk_get_sys("imx2-wdt.0", NULL);
 
-	if (!IS_ERR(clk))
+	if (!IS_ERR(clk)) {
+		clk_prepare(clk);
 		clk_enable(clk);
+	}
 
 	mxc_iomux_mode(MX31_PIN_WATCHDOG_RST__WATCHDOG_RST);
 
-- 
1.7.5.4

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

* [PATCH 9/9] ARM: mxs: convert to clk_prepare/clk_unprepare
  2011-11-10  4:54 [PATCH 1/9] ARM: mxc: time: convert to clk_prepare/clk_unprepare Richard Zhao
                   ` (6 preceding siblings ...)
  2011-11-10  4:54 ` [PATCH 8/9] ARM: mx31moboard: " Richard Zhao
@ 2011-11-10  4:54 ` Richard Zhao
  2011-11-10  8:03 ` [PATCH 1/9] ARM: mxc: time: " Sascha Hauer
  8 siblings, 0 replies; 11+ messages in thread
From: Richard Zhao @ 2011-11-10  4:54 UTC (permalink / raw)
  To: linux-arm-kernel

Signed-off-by: Richard Zhao <richard.zhao@linaro.org>
---
 arch/arm/mach-mxs/system.c |    4 +++-
 arch/arm/mach-mxs/timer.c  |    1 +
 2 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/arch/arm/mach-mxs/system.c b/arch/arm/mach-mxs/system.c
index 20ec3bd..57ce7f7 100644
--- a/arch/arm/mach-mxs/system.c
+++ b/arch/arm/mach-mxs/system.c
@@ -65,8 +65,10 @@ static int __init mxs_arch_reset_init(void)
 						 MX28_CLKCTRL_RESET_OFFSET);
 
 	clk = clk_get_sys("rtc", NULL);
-	if (!IS_ERR(clk))
+	if (!IS_ERR(clk)) {
+		clk_prepare(clk);
 		clk_enable(clk);
+	}
 
 	return 0;
 }
diff --git a/arch/arm/mach-mxs/timer.c b/arch/arm/mach-mxs/timer.c
index cace0d2..ba87b30 100644
--- a/arch/arm/mach-mxs/timer.c
+++ b/arch/arm/mach-mxs/timer.c
@@ -245,6 +245,7 @@ static int __init mxs_clocksource_init(struct clk *timer_clk)
 
 void __init mxs_timer_init(struct clk *timer_clk, int irq)
 {
+	clk_prepare(timer_clk);
 	clk_enable(timer_clk);
 
 	/*
-- 
1.7.5.4

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

* [PATCH 1/9] ARM: mxc: time: convert to clk_prepare/clk_unprepare
  2011-11-10  4:54 [PATCH 1/9] ARM: mxc: time: convert to clk_prepare/clk_unprepare Richard Zhao
                   ` (7 preceding siblings ...)
  2011-11-10  4:54 ` [PATCH 9/9] ARM: mxs: " Richard Zhao
@ 2011-11-10  8:03 ` Sascha Hauer
  2011-11-10  8:18   ` Richard Zhao
  8 siblings, 1 reply; 11+ messages in thread
From: Sascha Hauer @ 2011-11-10  8:03 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Richard,

I think we should introduce two new helpers:

clk_prepare_enable()
clk_disable_unprepare()

This series could look much nicer with it.

Minor nitpick: I don't like the subject. 'convert' suggests that you are
replacing something, instead you are adding something.

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] 11+ messages in thread

* [PATCH 1/9] ARM: mxc: time: convert to clk_prepare/clk_unprepare
  2011-11-10  8:03 ` [PATCH 1/9] ARM: mxc: time: " Sascha Hauer
@ 2011-11-10  8:18   ` Richard Zhao
  0 siblings, 0 replies; 11+ messages in thread
From: Richard Zhao @ 2011-11-10  8:18 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Nov 10, 2011 at 09:03:31AM +0100, Sascha Hauer wrote:
> Hi Richard,
> 
> I think we should introduce two new helpers:
> 
> clk_prepare_enable()
> clk_disable_unprepare()
right. I will add two inline functions in include/linux/clk.h.
> 
> This series could look much nicer with it.
> 
> Minor nitpick: I don't like the subject. 'convert' suggests that you are
> replacing something, instead you are adding something.
It's copied from other commits doing the same thing. If you don't like it,
I can change it to "Add clk_prepare/clk_unprepare support".

For other driver patch doing the same thing, do you think you can handle it too, or let other
different driver maintainer handle it? If you can, I'll merge it into the same series.

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 at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
> 

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

end of thread, other threads:[~2011-11-10  8:18 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-10  4:54 [PATCH 1/9] ARM: mxc: time: convert to clk_prepare/clk_unprepare Richard Zhao
2011-11-10  4:54 ` [PATCH 2/9] ARM: mxc: ahci: " Richard Zhao
2011-11-10  4:54 ` [PATCH 3/9] ARM: mxc: pwm: " Richard Zhao
2011-11-10  4:54 ` [PATCH 4/9] ARM: mxc: epit: " Richard Zhao
2011-11-10  4:54 ` [PATCH 5/9] ARM: mxc: arch_reset: " Richard Zhao
2011-11-10  4:54 ` [PATCH 6/9] ARM: mxc: audmux-v2: " Richard Zhao
2011-11-10  4:54 ` [PATCH 7/9] ARM: pm-imx5: " Richard Zhao
2011-11-10  4:54 ` [PATCH 8/9] ARM: mx31moboard: " Richard Zhao
2011-11-10  4:54 ` [PATCH 9/9] ARM: mxs: " Richard Zhao
2011-11-10  8:03 ` [PATCH 1/9] ARM: mxc: time: " Sascha Hauer
2011-11-10  8:18   ` Richard Zhao

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).