All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] OMAP clock and clockdomain fixes for 2.6.29-rc5
@ 2009-10-14 22:31 ` Paul Walmsley
  0 siblings, 0 replies; 8+ messages in thread
From: Paul Walmsley @ 2009-10-14 22:31 UTC (permalink / raw)
  To: linux-omap; +Cc: linux-arm-kernel

Hello,

This series contains:

- one OMAP2 clock fix that allows N800 to boot further (there are unrelated
  problems with both the current linux-omap head and omap-fixes branch that
  cause booting to fail due to other reasons), and

- one OMAP2/3 clockdomain fix that can cause clockdomain transitions to be
  missed by the clockdomain code -- this mostly affects OMAP3 OFF mode.

These patches are also available as a git branch (based on Tony's omap-fixes
branch) from

  git://git.pwsan.com/linux-2.6 2_6_32rc4_fixes


- Paul

---

Kalle Jokiniemi (1):
      OMAP: Fix race condition with autodeps

Paul Walmsley (1):
      OMAP2xxx clock: set up clockdomain pointer in struct clk


 arch/arm/mach-omap2/clock24xx.c   |    1 +
 arch/arm/mach-omap2/clockdomain.c |   74 ++++++++++++++++++++++---------------
 2 files changed, 45 insertions(+), 30 deletions(-)

size:
   text	   data	    bss	    dec	    hex	filename
3588474	 198624	 105152	3892250	 3b641a	vmlinux.omap3beagle.orig
3588562	 198624	 105152	3892338	 3b6472	vmlinux.omap3beagle.patched


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

* [PATCH 0/2] OMAP clock and clockdomain fixes for 2.6.29-rc5
@ 2009-10-14 22:31 ` Paul Walmsley
  0 siblings, 0 replies; 8+ messages in thread
From: Paul Walmsley @ 2009-10-14 22:31 UTC (permalink / raw)
  To: linux-arm-kernel

(resending due to old l-a-k host address)

Hello,

This series contains:

- one OMAP2 clock fix that allows N800 to boot further (there are unrelated
  problems with both the current linux-omap head and omap-fixes branch that
  cause booting to fail due to other reasons), and

- one OMAP2/3 clockdomain fix that can cause clockdomain transitions to be
  missed by the clockdomain code -- this mostly affects OMAP3 OFF mode.

These patches are also available as a git branch (based on Linus'
v2.6.32-rc4 tag) from

  git://git.pwsan.com/linux-2.6 2_6_32rc4_fixes


- Paul

---

Kalle Jokiniemi (1):
      OMAP: Fix race condition with autodeps

Paul Walmsley (1):
      OMAP2xxx clock: set up clockdomain pointer in struct clk


 arch/arm/mach-omap2/clock24xx.c   |    1 +
 arch/arm/mach-omap2/clockdomain.c |   74 ++++++++++++++++++++++---------------
 2 files changed, 45 insertions(+), 30 deletions(-)

size:
   text	   data	    bss	    dec	    hex	filename
3588474	 198624	 105152	3892250	 3b641a	vmlinux.omap3beagle.orig
3588562	 198624	 105152	3892338	 3b6472	vmlinux.omap3beagle.patched

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

* [PATCH 1/2] OMAP: Fix race condition with autodeps
  2009-10-14 22:31 ` Paul Walmsley
  (?)
@ 2009-10-14 22:31 ` Paul Walmsley
  -1 siblings, 0 replies; 8+ messages in thread
From: Paul Walmsley @ 2009-10-14 22:31 UTC (permalink / raw)
  To: linux-arm-kernel

From: Kalle Jokiniemi <kalle.jokiniemi@digia.com>

There is a possible race condition in clockdomain
code handling hw supported idle transitions.

When multiple autodeps dependencies are being added
or removed, a transition of still remaining dependent
powerdomain can result in false readings of the
state counter. This is especially fatal for off mode
state counter, as it could result in a driver not
noticing a context loss.

Fixed by disabling hw supported state transitions
when autodeps are being changed.

Signed-off-by: Kalle Jokiniemi <kalle.jokiniemi@digia.com>
Signed-off-by: Paul Walmsley <paul@pwsan.com>
---
 arch/arm/mach-omap2/clockdomain.c |   74 ++++++++++++++++++++++---------------
 1 files changed, 44 insertions(+), 30 deletions(-)

diff --git a/arch/arm/mach-omap2/clockdomain.c b/arch/arm/mach-omap2/clockdomain.c
index 4ef7b4f..58aff84 100644
--- a/arch/arm/mach-omap2/clockdomain.c
+++ b/arch/arm/mach-omap2/clockdomain.c
@@ -137,6 +137,36 @@ static void _clkdm_del_autodeps(struct clockdomain *clkdm)
 	}
 }
 
+/*
+ * _omap2_clkdm_set_hwsup - set the hwsup idle transition bit
+ * @clkdm: struct clockdomain *
+ * @enable: int 0 to disable, 1 to enable
+ *
+ * Internal helper for actually switching the bit that controls hwsup
+ * idle transitions for clkdm.
+ */
+static void _omap2_clkdm_set_hwsup(struct clockdomain *clkdm, int enable)
+{
+	u32 v;
+
+	if (cpu_is_omap24xx()) {
+		if (enable)
+			v = OMAP24XX_CLKSTCTRL_ENABLE_AUTO;
+		else
+			v = OMAP24XX_CLKSTCTRL_DISABLE_AUTO;
+	} else if (cpu_is_omap34xx()) {
+		if (enable)
+			v = OMAP34XX_CLKSTCTRL_ENABLE_AUTO;
+		else
+			v = OMAP34XX_CLKSTCTRL_DISABLE_AUTO;
+	} else {
+		BUG();
+	}
+
+	cm_rmw_mod_reg_bits(clkdm->clktrctrl_mask,
+			    v << __ffs(clkdm->clktrctrl_mask),
+			    clkdm->pwrdm.ptr->prcm_offs, CM_CLKSTCTRL);
+}
 
 static struct clockdomain *_clkdm_lookup(const char *name)
 {
@@ -456,8 +486,6 @@ int omap2_clkdm_wakeup(struct clockdomain *clkdm)
  */
 void omap2_clkdm_allow_idle(struct clockdomain *clkdm)
 {
-	u32 v;
-
 	if (!clkdm)
 		return;
 
@@ -473,18 +501,7 @@ void omap2_clkdm_allow_idle(struct clockdomain *clkdm)
 	if (atomic_read(&clkdm->usecount) > 0)
 		_clkdm_add_autodeps(clkdm);
 
-	if (cpu_is_omap24xx())
-		v = OMAP24XX_CLKSTCTRL_ENABLE_AUTO;
-	else if (cpu_is_omap34xx())
-		v = OMAP34XX_CLKSTCTRL_ENABLE_AUTO;
-	else
-		BUG();
-
-
-	cm_rmw_mod_reg_bits(clkdm->clktrctrl_mask,
-			    v << __ffs(clkdm->clktrctrl_mask),
-			    clkdm->pwrdm.ptr->prcm_offs,
-			    CM_CLKSTCTRL);
+	_omap2_clkdm_set_hwsup(clkdm, 1);
 
 	pwrdm_clkdm_state_switch(clkdm);
 }
@@ -500,8 +517,6 @@ void omap2_clkdm_allow_idle(struct clockdomain *clkdm)
  */
 void omap2_clkdm_deny_idle(struct clockdomain *clkdm)
 {
-	u32 v;
-
 	if (!clkdm)
 		return;
 
@@ -514,16 +529,7 @@ void omap2_clkdm_deny_idle(struct clockdomain *clkdm)
 	pr_debug("clockdomain: disabling automatic idle transitions for %s\n",
 		 clkdm->name);
 
-	if (cpu_is_omap24xx())
-		v = OMAP24XX_CLKSTCTRL_DISABLE_AUTO;
-	else if (cpu_is_omap34xx())
-		v = OMAP34XX_CLKSTCTRL_DISABLE_AUTO;
-	else
-		BUG();
-
-	cm_rmw_mod_reg_bits(clkdm->clktrctrl_mask,
-			    v << __ffs(clkdm->clktrctrl_mask),
-			    clkdm->pwrdm.ptr->prcm_offs, CM_CLKSTCTRL);
+	_omap2_clkdm_set_hwsup(clkdm, 0);
 
 	if (atomic_read(&clkdm->usecount) > 0)
 		_clkdm_del_autodeps(clkdm);
@@ -569,10 +575,14 @@ int omap2_clkdm_clk_enable(struct clockdomain *clkdm, struct clk *clk)
 	v = omap2_clkdm_clktrctrl_read(clkdm);
 
 	if ((cpu_is_omap34xx() && v == OMAP34XX_CLKSTCTRL_ENABLE_AUTO) ||
-	    (cpu_is_omap24xx() && v == OMAP24XX_CLKSTCTRL_ENABLE_AUTO))
+	    (cpu_is_omap24xx() && v == OMAP24XX_CLKSTCTRL_ENABLE_AUTO)) {
+		/* Disable HW transitions when we are changing deps */
+		_omap2_clkdm_set_hwsup(clkdm, 0);
 		_clkdm_add_autodeps(clkdm);
-	else
+		_omap2_clkdm_set_hwsup(clkdm, 1);
+	} else {
 		omap2_clkdm_wakeup(clkdm);
+	}
 
 	pwrdm_wait_transition(clkdm->pwrdm.ptr);
 	pwrdm_clkdm_state_switch(clkdm);
@@ -623,10 +633,14 @@ int omap2_clkdm_clk_disable(struct clockdomain *clkdm, struct clk *clk)
 	v = omap2_clkdm_clktrctrl_read(clkdm);
 
 	if ((cpu_is_omap34xx() && v == OMAP34XX_CLKSTCTRL_ENABLE_AUTO) ||
-	    (cpu_is_omap24xx() && v == OMAP24XX_CLKSTCTRL_ENABLE_AUTO))
+	    (cpu_is_omap24xx() && v == OMAP24XX_CLKSTCTRL_ENABLE_AUTO)) {
+		/* Disable HW transitions when we are changing deps */
+		_omap2_clkdm_set_hwsup(clkdm, 0);
 		_clkdm_del_autodeps(clkdm);
-	else
+		_omap2_clkdm_set_hwsup(clkdm, 1);
+	} else {
 		omap2_clkdm_sleep(clkdm);
+	}
 
 	pwrdm_clkdm_state_switch(clkdm);
 

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

* [PATCH 2/2] OMAP2xxx clock: set up clockdomain pointer in struct clk
  2009-10-14 22:31 ` Paul Walmsley
@ 2009-10-14 22:31   ` Paul Walmsley
  -1 siblings, 0 replies; 8+ messages in thread
From: Paul Walmsley @ 2009-10-14 22:31 UTC (permalink / raw)
  To: linux-omap
  Cc: Tony Lindgren, Stefano Panella, Carlos Aguiar, linux-arm-kernel

clock24xx.c is missing a omap2_init_clk_clkdm() in its
omap2_clk_init() function.  Among other bad effects, this causes the
OMAP hwmod layer to oops on boot.

Thanks to Carlos Aguiar <carlos.aguiar@indt.org.br> and Stefano
Panella <Stefano.Panella@csr.com> for reporting this bug.  Thanks to Tony
Lindgren <tony@atomide.com> for N800 booting advice.

Signed-off-by: Paul Walmsley <paul@pwsan.com>
Cc: Carlos Aguiar <carlos.aguiar@indt.org.br>
Cc: Stefano Panella <Stefano.Panella@csr.com>
Cc: Tony Lindgren <tony@atomide.com>
---
 arch/arm/mach-omap2/clock24xx.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/clock24xx.c b/arch/arm/mach-omap2/clock24xx.c
index bc5d3ac..e2dbedd 100644
--- a/arch/arm/mach-omap2/clock24xx.c
+++ b/arch/arm/mach-omap2/clock24xx.c
@@ -769,6 +769,7 @@ int __init omap2_clk_init(void)
 		if (c->cpu & cpu_mask) {
 			clkdev_add(&c->lk);
 			clk_register(c->lk.clk);
+			omap2_init_clk_clkdm(c->lk.clk);
 		}
 
 	/* Check the MPU rate set by bootloader */



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

* [PATCH 2/2] OMAP2xxx clock: set up clockdomain pointer in struct clk
@ 2009-10-14 22:31   ` Paul Walmsley
  0 siblings, 0 replies; 8+ messages in thread
From: Paul Walmsley @ 2009-10-14 22:31 UTC (permalink / raw)
  To: linux-arm-kernel

clock24xx.c is missing a omap2_init_clk_clkdm() in its
omap2_clk_init() function.  Among other bad effects, this causes the
OMAP hwmod layer to oops on boot.

Thanks to Carlos Aguiar <carlos.aguiar@indt.org.br> and Stefano
Panella <Stefano.Panella@csr.com> for reporting this bug.  Thanks to Tony
Lindgren <tony@atomide.com> for N800 booting advice.

Signed-off-by: Paul Walmsley <paul@pwsan.com>
Cc: Carlos Aguiar <carlos.aguiar@indt.org.br>
Cc: Stefano Panella <Stefano.Panella@csr.com>
Cc: Tony Lindgren <tony@atomide.com>
---
 arch/arm/mach-omap2/clock24xx.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/clock24xx.c b/arch/arm/mach-omap2/clock24xx.c
index bc5d3ac..e2dbedd 100644
--- a/arch/arm/mach-omap2/clock24xx.c
+++ b/arch/arm/mach-omap2/clock24xx.c
@@ -769,6 +769,7 @@ int __init omap2_clk_init(void)
 		if (c->cpu & cpu_mask) {
 			clkdev_add(&c->lk);
 			clk_register(c->lk.clk);
+			omap2_init_clk_clkdm(c->lk.clk);
 		}
 
 	/* Check the MPU rate set by bootloader */

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

* Re: [PATCH 0/2] OMAP clock and clockdomain fixes for 2.6.29-rc5
  2009-10-14 22:31 ` Paul Walmsley
@ 2009-10-14 23:30   ` Paul Walmsley
  -1 siblings, 0 replies; 8+ messages in thread
From: Paul Walmsley @ 2009-10-14 23:30 UTC (permalink / raw)
  To: linux-omap; +Cc: linux-arm-kernel


Time for a subject line correction of my own: Kevin kindly pointed out 
that the subject should read "2.6.32-rc5"


- Paul

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

* [PATCH 0/2] OMAP clock and clockdomain fixes for 2.6.29-rc5
@ 2009-10-14 23:30   ` Paul Walmsley
  0 siblings, 0 replies; 8+ messages in thread
From: Paul Walmsley @ 2009-10-14 23:30 UTC (permalink / raw)
  To: linux-arm-kernel


Time for a subject line correction of my own: Kevin kindly pointed out 
that the subject should read "2.6.32-rc5"


- Paul

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

* Re: [PATCH 0/2] OMAP clock and clockdomain fixes for 2.6.29-rc5
  2009-10-14 22:31 ` Paul Walmsley
                   ` (3 preceding siblings ...)
  (?)
@ 2009-10-15  0:24 ` Tony Lindgren
  -1 siblings, 0 replies; 8+ messages in thread
From: Tony Lindgren @ 2009-10-15  0:24 UTC (permalink / raw)
  To: Paul Walmsley; +Cc: linux-omap, linux-arm-kernel

* Paul Walmsley <paul@pwsan.com> [091014 15:36]:
> Hello,
> 
> This series contains:
> 
> - one OMAP2 clock fix that allows N800 to boot further (there are unrelated
>   problems with both the current linux-omap head and omap-fixes branch that
>   cause booting to fail due to other reasons), and
> 
> - one OMAP2/3 clockdomain fix that can cause clockdomain transitions to be
>   missed by the clockdomain code -- this mostly affects OMAP3 OFF mode.
> 
> These patches are also available as a git branch (based on Tony's omap-fixes
> branch) from
> 
>   git://git.pwsan.com/linux-2.6 2_6_32rc4_fixes

I've pulled these on top of the fixes I posted yesterday.

Regards,

Tony
 
> 
> - Paul
> 
> ---
> 
> Kalle Jokiniemi (1):
>       OMAP: Fix race condition with autodeps
> 
> Paul Walmsley (1):
>       OMAP2xxx clock: set up clockdomain pointer in struct clk
> 
> 
>  arch/arm/mach-omap2/clock24xx.c   |    1 +
>  arch/arm/mach-omap2/clockdomain.c |   74 ++++++++++++++++++++++---------------
>  2 files changed, 45 insertions(+), 30 deletions(-)
> 
> size:
>    text	   data	    bss	    dec	    hex	filename
> 3588474	 198624	 105152	3892250	 3b641a	vmlinux.omap3beagle.orig
> 3588562	 198624	 105152	3892338	 3b6472	vmlinux.omap3beagle.patched
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

end of thread, other threads:[~2009-10-15  0:25 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-10-14 22:31 [PATCH 0/2] OMAP clock and clockdomain fixes for 2.6.29-rc5 Paul Walmsley
2009-10-14 22:31 ` Paul Walmsley
2009-10-14 22:31 ` [PATCH 1/2] OMAP: Fix race condition with autodeps Paul Walmsley
2009-10-14 22:31 ` [PATCH 2/2] OMAP2xxx clock: set up clockdomain pointer in struct clk Paul Walmsley
2009-10-14 22:31   ` Paul Walmsley
2009-10-14 23:30 ` [PATCH 0/2] OMAP clock and clockdomain fixes for 2.6.29-rc5 Paul Walmsley
2009-10-14 23:30   ` Paul Walmsley
2009-10-15  0:24 ` Tony Lindgren

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.