* State of LDP3430 platform
[not found] ` <20110115233744.GA18159@n2100.arm.linux.org.uk>
@ 2011-01-16 4:32 ` Paul Walmsley
2011-01-16 15:08 ` Thomas Weber
2011-01-18 1:25 ` Tony Lindgren
0 siblings, 2 replies; 11+ messages in thread
From: Paul Walmsley @ 2011-01-16 4:32 UTC (permalink / raw)
To: linux-arm-kernel
On Sat, 15 Jan 2011, Russell King - ARM Linux wrote:
> On Sat, Jan 15, 2011 at 12:38:46PM -0700, Paul Walmsley wrote:
> > On Fri, 14 Jan 2011, Tony Lindgren wrote:
> >
> > > * Paul Walmsley <paul@pwsan.com> [101207 19:30]:
> > > > On Tue, 7 Dec 2010, Paul Walmsley wrote:
> > > >
> > > > Regarding the watchdog problem, unfortunately, I can't reproduce on the
> > > > BeagleBoard with v2.6.37-rc5 with either omap2plus_defconfig or
> > > > omap2plus_defconfig without CONFIG_WATCHDOG. If you send along your
> > > > .config, one of us can try to reproduce the problem with it. Do the
> > > > 2.6.38 hwmod and wdt patchsets fix the problem for .38, at least?
> > >
> > > I've been seeing this on my omap4 panda. While debugging it, I left
> > > u-boot console only running for a few minutes to see if that stays up.
> > > It did.. And after doing that somehow now my panda boots all the way
> > > and stays up. Weird.
> >
> > Hmmm, do you think the watchdog is what's killing it? I don't think
> > leaving u-boot running would affect that?
>
> Right, well, the LDP3430 (and probably all OMAP) is broken by my
> init_sched_clock() changes because I gave up with testing on OMAP
> platforms.
>
> Why does OMAP initialize its clock sources soo late, outside of
> the timer initialization? This means you have no counter in place
> (except for the jiffies counter) during early boot.
>
> Is there a reason why OMAP uniquely does this?
I don't think so.
Patch attached.
- Paul
[PATCH] OMAP: counter_32k: init clocksource as part of machine timer init
Linus's master branch, currently at commit
1b59be2a6cdcb5a12e18d8315c07c94a624de48f ("Merge branch 'slab/urgent'
of git://git.kernel.org/pub/scm/linux/kernel/git/penberg/slab-2.6"),
crashes during boot on OMAP4430 ES2.0 Panda:
[ 0.000000] OMAP clockevent source: GPTIMER1 at 32768 Hz
[ 0.000000] Unable to handle kernel NULL pointer dereference at virtual address 00000000
[ 0.000000] pgd = c0004000
[ 0.000000] [00000000] *pgd=00000000
[ 0.000000] Internal error: Oops: 80000005 [#1] SMP
[ 0.000000] last sysfs file:
[ 0.000000] Modules linked in:
[ 0.000000] CPU: 0 Tainted: G W (2.6.37-07734-g2467802 #7)
[ 0.000000] PC is at 0x0
[ 0.000000] LR is at sched_clock_poll+0x2c/0x3c
[ 0.000000] pc : [<00000000>] lr : [<c0060b74>] psr: 600001d3
[ 0.000000] sp : c058bfd0 ip : c058a000 fp : 00000000
[ 0.000000] r10: 00000000 r9 : 411fc092 r8 : 800330c8
[ 0.000000] r7 : c05a08e0 r6 : c0034c48 r5 : c05ffc40 r4 : c0034c4c
[ 0.000000] r3 : c05ffe6c r2 : c05a0bc0 r1 : c059f098 r0 : 00000000
[ 0.000000] Flags: nZCv IRQs off FIQs off Mode SVC_32 ISA ARM Segment kernel
[ 0.000000] Control: 10c53c7f Table: 8000404a DAC: 00000017
This is due to the recent ARM init_sched_clock() changes and the late
initialization of the counter_32k clock source:
http://marc.info/?l=linux-omap&m=129513468605208&w=2
Fix by initializing the counter_32k clocksource during the machine timer
initialization.
Reported-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Paul Walmsley <paul@pwsan.com>
---
arch/arm/mach-omap1/time.c | 7 +++++++
arch/arm/mach-omap2/timer-gp.c | 10 ++++++++--
arch/arm/plat-omap/counter_32k.c | 3 +--
arch/arm/plat-omap/include/plat/common.h | 1 +
4 files changed, 17 insertions(+), 4 deletions(-)
diff --git a/arch/arm/mach-omap1/time.c b/arch/arm/mach-omap1/time.c
index ed7a61f..6ec65e5 100644
--- a/arch/arm/mach-omap1/time.c
+++ b/arch/arm/mach-omap1/time.c
@@ -244,6 +244,13 @@ static void __init omap_timer_init(void)
omap_init_mpu_timer(rate);
omap_init_clocksource(rate);
+ /*
+ * XXX Since this file seems to deal mostly with the MPU timer,
+ * this doesn't seem like the correct place for the sync timer
+ * clocksource init.
+ */
+ if (!cpu_is_omap7xx() && !cpu_is_omap15xx())
+ omap_init_clocksource_32k();
}
struct sys_timer omap_timer = {
diff --git a/arch/arm/mach-omap2/timer-gp.c b/arch/arm/mach-omap2/timer-gp.c
index 4e48e78..57d53e0 100644
--- a/arch/arm/mach-omap2/timer-gp.c
+++ b/arch/arm/mach-omap2/timer-gp.c
@@ -42,6 +42,8 @@
#include "timer-gp.h"
+#include <plat/common.h>
+
/* MAX_GPTIMER_ID: number of GPTIMERs on the chip */
#define MAX_GPTIMER_ID 12
@@ -176,10 +178,14 @@ static void __init omap2_gp_clockevent_init(void)
/*
* When 32k-timer is enabled, don't use GPTimer for clocksource
* instead, just leave default clocksource which uses the 32k
- * sync counter. See clocksource setup in see plat-omap/common.c.
+ * sync counter. See clocksource setup in plat-omap/timer-32k.c
*/
-static inline void __init omap2_gp_clocksource_init(void) {}
+static void __init omap2_gp_clocksource_init(void)
+{
+ omap_init_clocksource_32k();
+}
+
#else
/*
* clocksource
diff --git a/arch/arm/plat-omap/counter_32k.c b/arch/arm/plat-omap/counter_32k.c
index ea46440..0367998 100644
--- a/arch/arm/plat-omap/counter_32k.c
+++ b/arch/arm/plat-omap/counter_32k.c
@@ -160,7 +160,7 @@ void read_persistent_clock(struct timespec *ts)
*ts = *tsp;
}
-static int __init omap_init_clocksource_32k(void)
+int __init omap_init_clocksource_32k(void)
{
static char err[] __initdata = KERN_ERR
"%s: can't register clocksource!\n";
@@ -195,7 +195,6 @@ static int __init omap_init_clocksource_32k(void)
}
return 0;
}
-arch_initcall(omap_init_clocksource_32k);
#endif /* !(defined(CONFIG_ARCH_OMAP730) || defined(CONFIG_ARCH_OMAP15XX)) */
diff --git a/arch/arm/plat-omap/include/plat/common.h b/arch/arm/plat-omap/include/plat/common.h
index 6b8088e..84c707f 100644
--- a/arch/arm/plat-omap/include/plat/common.h
+++ b/arch/arm/plat-omap/include/plat/common.h
@@ -35,6 +35,7 @@ struct sys_timer;
extern void omap_map_common_io(void);
extern struct sys_timer omap_timer;
+extern int __init omap_init_clocksource_32k(void);
extern void omap_reserve(void);
--
1.7.2.3
^ permalink raw reply related [flat|nested] 11+ messages in thread
* State of LDP3430 platform
2011-01-16 4:32 ` State of LDP3430 platform Paul Walmsley
@ 2011-01-16 15:08 ` Thomas Weber
2011-01-18 19:36 ` Paul Walmsley
2011-01-18 1:25 ` Tony Lindgren
1 sibling, 1 reply; 11+ messages in thread
From: Thomas Weber @ 2011-01-16 15:08 UTC (permalink / raw)
To: linux-arm-kernel
Am 16.01.2011 05:32, schrieb Paul Walmsley:
> On Sat, 15 Jan 2011, Russell King - ARM Linux wrote:
>
>> On Sat, Jan 15, 2011 at 12:38:46PM -0700, Paul Walmsley wrote:
>>> On Fri, 14 Jan 2011, Tony Lindgren wrote:
>>>
>>>> * Paul Walmsley <paul@pwsan.com> [101207 19:30]:
>>>>> On Tue, 7 Dec 2010, Paul Walmsley wrote:
>>>>>
>>>>> Regarding the watchdog problem, unfortunately, I can't reproduce on the
>>>>> BeagleBoard with v2.6.37-rc5 with either omap2plus_defconfig or
>>>>> omap2plus_defconfig without CONFIG_WATCHDOG. If you send along your
>>>>> .config, one of us can try to reproduce the problem with it. Do the
>>>>> 2.6.38 hwmod and wdt patchsets fix the problem for .38, at least?
>>>> I've been seeing this on my omap4 panda. While debugging it, I left
>>>> u-boot console only running for a few minutes to see if that stays up.
>>>> It did.. And after doing that somehow now my panda boots all the way
>>>> and stays up. Weird.
>>> Hmmm, do you think the watchdog is what's killing it? I don't think
>>> leaving u-boot running would affect that?
>> Right, well, the LDP3430 (and probably all OMAP) is broken by my
>> init_sched_clock() changes because I gave up with testing on OMAP
>> platforms.
>>
>> Why does OMAP initialize its clock sources soo late, outside of
>> the timer initialization? This means you have no counter in place
>> (except for the jiffies counter) during early boot.
>>
>> Is there a reason why OMAP uniquely does this?
> I don't think so.
>
> Patch attached.
>
>
> - Paul
>
>
> [PATCH] OMAP: counter_32k: init clocksource as part of machine timer init
>
> Linus's master branch, currently at commit
> 1b59be2a6cdcb5a12e18d8315c07c94a624de48f ("Merge branch 'slab/urgent'
> of git://git.kernel.org/pub/scm/linux/kernel/git/penberg/slab-2.6"),
> crashes during boot on OMAP4430 ES2.0 Panda:
>
> [ 0.000000] OMAP clockevent source: GPTIMER1 at 32768 Hz
> [ 0.000000] Unable to handle kernel NULL pointer dereference at virtual address 00000000
> [ 0.000000] pgd = c0004000
> [ 0.000000] [00000000] *pgd=00000000
> [ 0.000000] Internal error: Oops: 80000005 [#1] SMP
> [ 0.000000] last sysfs file:
> [ 0.000000] Modules linked in:
> [ 0.000000] CPU: 0 Tainted: G W (2.6.37-07734-g2467802 #7)
> [ 0.000000] PC is at 0x0
> [ 0.000000] LR is at sched_clock_poll+0x2c/0x3c
> [ 0.000000] pc : [<00000000>] lr : [<c0060b74>] psr: 600001d3
> [ 0.000000] sp : c058bfd0 ip : c058a000 fp : 00000000
> [ 0.000000] r10: 00000000 r9 : 411fc092 r8 : 800330c8
> [ 0.000000] r7 : c05a08e0 r6 : c0034c48 r5 : c05ffc40 r4 : c0034c4c
> [ 0.000000] r3 : c05ffe6c r2 : c05a0bc0 r1 : c059f098 r0 : 00000000
> [ 0.000000] Flags: nZCv IRQs off FIQs off Mode SVC_32 ISA ARM Segment kernel
> [ 0.000000] Control: 10c53c7f Table: 8000404a DAC: 00000017
>
> This is due to the recent ARM init_sched_clock() changes and the late
> initialization of the counter_32k clock source:
>
> http://marc.info/?l=linux-omap&m=129513468605208&w=2
>
> Fix by initializing the counter_32k clocksource during the machine timer
> initialization.
>
> Reported-by: Russell King <rmk+kernel@arm.linux.org.uk>
> Signed-off-by: Paul Walmsley <paul@pwsan.com>
>
> ---
> arch/arm/mach-omap1/time.c | 7 +++++++
> arch/arm/mach-omap2/timer-gp.c | 10 ++++++++--
> arch/arm/plat-omap/counter_32k.c | 3 +--
> arch/arm/plat-omap/include/plat/common.h | 1 +
> 4 files changed, 17 insertions(+), 4 deletions(-)
>
> diff --git a/arch/arm/mach-omap1/time.c b/arch/arm/mach-omap1/time.c
> index ed7a61f..6ec65e5 100644
> --- a/arch/arm/mach-omap1/time.c
> +++ b/arch/arm/mach-omap1/time.c
> @@ -244,6 +244,13 @@ static void __init omap_timer_init(void)
>
> omap_init_mpu_timer(rate);
> omap_init_clocksource(rate);
> + /*
> + * XXX Since this file seems to deal mostly with the MPU timer,
> + * this doesn't seem like the correct place for the sync timer
> + * clocksource init.
> + */
> + if (!cpu_is_omap7xx() && !cpu_is_omap15xx())
> + omap_init_clocksource_32k();
> }
>
> struct sys_timer omap_timer = {
> diff --git a/arch/arm/mach-omap2/timer-gp.c b/arch/arm/mach-omap2/timer-gp.c
> index 4e48e78..57d53e0 100644
> --- a/arch/arm/mach-omap2/timer-gp.c
> +++ b/arch/arm/mach-omap2/timer-gp.c
> @@ -42,6 +42,8 @@
>
> #include "timer-gp.h"
>
> +#include <plat/common.h>
> +
> /* MAX_GPTIMER_ID: number of GPTIMERs on the chip */
> #define MAX_GPTIMER_ID 12
>
> @@ -176,10 +178,14 @@ static void __init omap2_gp_clockevent_init(void)
> /*
> * When 32k-timer is enabled, don't use GPTimer for clocksource
> * instead, just leave default clocksource which uses the 32k
> - * sync counter. See clocksource setup in see plat-omap/common.c.
> + * sync counter. See clocksource setup in plat-omap/timer-32k.c
> */
>
> -static inline void __init omap2_gp_clocksource_init(void) {}
> +static void __init omap2_gp_clocksource_init(void)
> +{
> + omap_init_clocksource_32k();
> +}
> +
> #else
> /*
> * clocksource
> diff --git a/arch/arm/plat-omap/counter_32k.c b/arch/arm/plat-omap/counter_32k.c
> index ea46440..0367998 100644
> --- a/arch/arm/plat-omap/counter_32k.c
> +++ b/arch/arm/plat-omap/counter_32k.c
> @@ -160,7 +160,7 @@ void read_persistent_clock(struct timespec *ts)
> *ts = *tsp;
> }
>
> -static int __init omap_init_clocksource_32k(void)
> +int __init omap_init_clocksource_32k(void)
> {
> static char err[] __initdata = KERN_ERR
> "%s: can't register clocksource!\n";
> @@ -195,7 +195,6 @@ static int __init omap_init_clocksource_32k(void)
> }
> return 0;
> }
> -arch_initcall(omap_init_clocksource_32k);
>
> #endif /* !(defined(CONFIG_ARCH_OMAP730) || defined(CONFIG_ARCH_OMAP15XX)) */
>
> diff --git a/arch/arm/plat-omap/include/plat/common.h b/arch/arm/plat-omap/include/plat/common.h
> index 6b8088e..84c707f 100644
> --- a/arch/arm/plat-omap/include/plat/common.h
> +++ b/arch/arm/plat-omap/include/plat/common.h
> @@ -35,6 +35,7 @@ struct sys_timer;
>
> extern void omap_map_common_io(void);
> extern struct sys_timer omap_timer;
> +extern int __init omap_init_clocksource_32k(void);
>
> extern void omap_reserve(void);
>
This patch works on Devkit8000. Thanks.
Tested-by: Thomas Weber <weber@corscience.de>
^ permalink raw reply [flat|nested] 11+ messages in thread
* State of LDP3430 platform
2011-01-16 4:32 ` State of LDP3430 platform Paul Walmsley
2011-01-16 15:08 ` Thomas Weber
@ 2011-01-18 1:25 ` Tony Lindgren
2011-01-18 19:24 ` Paul Walmsley
1 sibling, 1 reply; 11+ messages in thread
From: Tony Lindgren @ 2011-01-18 1:25 UTC (permalink / raw)
To: linux-arm-kernel
Hi,
* Paul Walmsley <paul@pwsan.com> [110115 20:31]:
> --- a/arch/arm/mach-omap1/time.c
> +++ b/arch/arm/mach-omap1/time.c
> @@ -244,6 +244,13 @@ static void __init omap_timer_init(void)
>
> omap_init_mpu_timer(rate);
> omap_init_clocksource(rate);
> + /*
> + * XXX Since this file seems to deal mostly with the MPU timer,
> + * this doesn't seem like the correct place for the sync timer
> + * clocksource init.
> + */
> + if (!cpu_is_omap7xx() && !cpu_is_omap15xx())
> + omap_init_clocksource_32k();
> }
>
> struct sys_timer omap_timer = {
To me it looks like the omap_init_clocksource_32k() call should be
in arch/arm/mach-omap1/timer32k.c instead.
Regards,
Tony
^ permalink raw reply [flat|nested] 11+ messages in thread
* State of LDP3430 platform
2011-01-18 1:25 ` Tony Lindgren
@ 2011-01-18 19:24 ` Paul Walmsley
0 siblings, 0 replies; 11+ messages in thread
From: Paul Walmsley @ 2011-01-18 19:24 UTC (permalink / raw)
To: linux-arm-kernel
On Mon, 17 Jan 2011, Tony Lindgren wrote:
> * Paul Walmsley <paul@pwsan.com> [110115 20:31]:
> > --- a/arch/arm/mach-omap1/time.c
> > +++ b/arch/arm/mach-omap1/time.c
> > @@ -244,6 +244,13 @@ static void __init omap_timer_init(void)
> >
> > omap_init_mpu_timer(rate);
> > omap_init_clocksource(rate);
> > + /*
> > + * XXX Since this file seems to deal mostly with the MPU timer,
> > + * this doesn't seem like the correct place for the sync timer
> > + * clocksource init.
> > + */
> > + if (!cpu_is_omap7xx() && !cpu_is_omap15xx())
> > + omap_init_clocksource_32k();
> > }
> >
> > struct sys_timer omap_timer = {
>
> To me it looks like the omap_init_clocksource_32k() call should be
> in arch/arm/mach-omap1/timer32k.c instead.
Just FYI for the lists; Tony and I talked about this off-list; he'll deal
with this in a subsequent patch to avoid changing the OMAP1 clocksource
behavior during this patch.
- Paul
^ permalink raw reply [flat|nested] 11+ messages in thread
* State of LDP3430 platform
2011-01-16 15:08 ` Thomas Weber
@ 2011-01-18 19:36 ` Paul Walmsley
2011-01-18 22:26 ` [PATCH] omap1: Fix sched_clock for the MPU timer (Re: State of LDP3430 platform) Tony Lindgren
2011-01-19 13:43 ` State of LDP3430 platform Jarkko Nikula
0 siblings, 2 replies; 11+ messages in thread
From: Paul Walmsley @ 2011-01-18 19:36 UTC (permalink / raw)
To: linux-arm-kernel
Here's a slightly updated version of this patch, fixing a bug in one of
the comments, and revising the commit message. There's no functional
difference between this and the previous version of this patch.
- Paul
[PATCH] OMAP: counter_32k: init clocksource as part of machine timer init
After commit dc548fbbd2ecd0fc3b02301d551e5f8e19ae58fd ("ARM: omap: convert
sched_clock() to use new infrastructure"), OMAPs that use the 32KiHz
"synchronization timer" as their clocksource crash during boot:
[ 0.000000] OMAP clockevent source: GPTIMER1 at 32768 Hz
[ 0.000000] Unable to handle kernel NULL pointer dereference at virtual address 00000000
[ 0.000000] pgd = c0004000
[ 0.000000] [00000000] *pgd=00000000
[ 0.000000] Internal error: Oops: 80000005 [#1] SMP
[ 0.000000] last sysfs file:
[ 0.000000] Modules linked in:
[ 0.000000] CPU: 0 Tainted: G W (2.6.37-07734-g2467802 #7)
[ 0.000000] PC is at 0x0
[ 0.000000] LR is at sched_clock_poll+0x2c/0x3c
[ 0.000000] pc : [<00000000>] lr : [<c0060b74>] psr: 600001d3
[ 0.000000] sp : c058bfd0 ip : c058a000 fp : 00000000
[ 0.000000] r10: 00000000 r9 : 411fc092 r8 : 800330c8
[ 0.000000] r7 : c05a08e0 r6 : c0034c48 r5 : c05ffc40 r4 : c0034c4c
[ 0.000000] r3 : c05ffe6c r2 : c05a0bc0 r1 : c059f098 r0 : 00000000
[ 0.000000] Flags: nZCv IRQs off FIQs off Mode SVC_32 ISA ARM Segment kernel
[ 0.000000] Control: 10c53c7f Table: 8000404a DAC: 00000017
This is due to the recent ARM init_sched_clock() changes and the late
initialization of the counter_32k clock source. More information here:
http://marc.info/?l=linux-omap&m=129513468605208&w=2
Fix by initializing the counter_32k clocksource during the machine timer
initialization.
Reported-by: Russell King <rmk+kernel@arm.linux.org.uk>
Tested-by: Thomas Weber <weber@corscience.de>
Signed-off-by: Paul Walmsley <paul@pwsan.com>
---
arch/arm/mach-omap1/time.c | 7 +++++++
arch/arm/mach-omap2/timer-gp.c | 10 ++++++++--
arch/arm/plat-omap/counter_32k.c | 3 +--
arch/arm/plat-omap/include/plat/common.h | 1 +
4 files changed, 17 insertions(+), 4 deletions(-)
diff --git a/arch/arm/mach-omap1/time.c b/arch/arm/mach-omap1/time.c
index ed7a61f..6ec65e5 100644
--- a/arch/arm/mach-omap1/time.c
+++ b/arch/arm/mach-omap1/time.c
@@ -244,6 +244,13 @@ static void __init omap_timer_init(void)
omap_init_mpu_timer(rate);
omap_init_clocksource(rate);
+ /*
+ * XXX Since this file seems to deal mostly with the MPU timer,
+ * this doesn't seem like the correct place for the sync timer
+ * clocksource init.
+ */
+ if (!cpu_is_omap7xx() && !cpu_is_omap15xx())
+ omap_init_clocksource_32k();
}
struct sys_timer omap_timer = {
diff --git a/arch/arm/mach-omap2/timer-gp.c b/arch/arm/mach-omap2/timer-gp.c
index 4e48e78..7b7c268 100644
--- a/arch/arm/mach-omap2/timer-gp.c
+++ b/arch/arm/mach-omap2/timer-gp.c
@@ -42,6 +42,8 @@
#include "timer-gp.h"
+#include <plat/common.h>
+
/* MAX_GPTIMER_ID: number of GPTIMERs on the chip */
#define MAX_GPTIMER_ID 12
@@ -176,10 +178,14 @@ static void __init omap2_gp_clockevent_init(void)
/*
* When 32k-timer is enabled, don't use GPTimer for clocksource
* instead, just leave default clocksource which uses the 32k
- * sync counter. See clocksource setup in see plat-omap/common.c.
+ * sync counter. See clocksource setup in plat-omap/counter_32k.c
*/
-static inline void __init omap2_gp_clocksource_init(void) {}
+static void __init omap2_gp_clocksource_init(void)
+{
+ omap_init_clocksource_32k();
+}
+
#else
/*
* clocksource
diff --git a/arch/arm/plat-omap/counter_32k.c b/arch/arm/plat-omap/counter_32k.c
index ea46440..0367998 100644
--- a/arch/arm/plat-omap/counter_32k.c
+++ b/arch/arm/plat-omap/counter_32k.c
@@ -160,7 +160,7 @@ void read_persistent_clock(struct timespec *ts)
*ts = *tsp;
}
-static int __init omap_init_clocksource_32k(void)
+int __init omap_init_clocksource_32k(void)
{
static char err[] __initdata = KERN_ERR
"%s: can't register clocksource!\n";
@@ -195,7 +195,6 @@ static int __init omap_init_clocksource_32k(void)
}
return 0;
}
-arch_initcall(omap_init_clocksource_32k);
#endif /* !(defined(CONFIG_ARCH_OMAP730) || defined(CONFIG_ARCH_OMAP15XX)) */
diff --git a/arch/arm/plat-omap/include/plat/common.h b/arch/arm/plat-omap/include/plat/common.h
index 6b8088e..84c707f 100644
--- a/arch/arm/plat-omap/include/plat/common.h
+++ b/arch/arm/plat-omap/include/plat/common.h
@@ -35,6 +35,7 @@ struct sys_timer;
extern void omap_map_common_io(void);
extern struct sys_timer omap_timer;
+extern int __init omap_init_clocksource_32k(void);
extern void omap_reserve(void);
--
1.7.2.3
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH] omap1: Fix sched_clock for the MPU timer (Re: State of LDP3430 platform)
2011-01-18 19:36 ` Paul Walmsley
@ 2011-01-18 22:26 ` Tony Lindgren
2011-01-18 22:35 ` [PATCH] omap1: Fix booting for 15xx and 730 with omap1_defconfig " Tony Lindgren
2011-01-19 18:44 ` [PATCH] omap1: Fix sched_clock for the MPU timer " Tony Lindgren
2011-01-19 13:43 ` State of LDP3430 platform Jarkko Nikula
1 sibling, 2 replies; 11+ messages in thread
From: Tony Lindgren @ 2011-01-18 22:26 UTC (permalink / raw)
To: linux-arm-kernel
* Paul Walmsley <paul@pwsan.com> [110118 11:35]:
>
> Here's a slightly updated version of this patch, fixing a bug in one of
> the comments, and revising the commit message. There's no functional
> difference between this and the previous version of this patch.
Thanks, here are two patches to fix the MPU timer, and then allow
compiling in both the MPU timer and the 32KiHz timer.
Tony
From: Tony Lindgren <tony@atomide.com>
Date: Tue, 18 Jan 2011 13:25:39 -0800
Subject: [PATCH] omap1: Fix sched_clock for the MPU timer
Otherwise systems using the MPU timer will hang.
Signed-off-by: Tony Lindgren <tony@atomide.com>
--- a/arch/arm/mach-omap1/time.c
+++ b/arch/arm/mach-omap1/time.c
@@ -44,11 +44,14 @@
#include <linux/clocksource.h>
#include <linux/clockchips.h>
#include <linux/io.h>
+#include <linux/sched.h>
#include <asm/system.h>
#include <mach/hardware.h>
#include <asm/leds.h>
#include <asm/irq.h>
+#include <asm/sched_clock.h>
+
#include <asm/mach/irq.h>
#include <asm/mach/time.h>
@@ -67,7 +70,7 @@ typedef struct {
((volatile omap_mpu_timer_regs_t*)OMAP1_IO_ADDRESS(OMAP_MPU_TIMER_BASE + \
(n)*OMAP_MPU_TIMER_OFFSET))
-static inline unsigned long omap_mpu_timer_read(int nr)
+static inline unsigned long notrace omap_mpu_timer_read(int nr)
{
volatile omap_mpu_timer_regs_t* timer = omap_mpu_timer_base(nr);
return timer->read_tim;
@@ -212,11 +215,21 @@ static struct clocksource clocksource_mpu = {
.flags = CLOCK_SOURCE_IS_CONTINUOUS,
};
+static DEFINE_CLOCK_DATA(cd);
+
+static void notrace mpu_update_sched_clock(void)
+{
+ u32 cyc = mpu_read(&clocksource_mpu);
+ update_sched_clock(&cd, cyc, (u32)~0);
+}
+
static void __init omap_init_clocksource(unsigned long rate)
{
static char err[] __initdata = KERN_ERR
"%s: can't register clocksource!\n";
+ init_sched_clock(&cd, mpu_update_sched_clock, 32, rate);
+
setup_irq(INT_TIMER2, &omap_mpu_timer2_irq);
omap_mpu_timer_start(1, ~0, 1);
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH] omap1: Fix booting for 15xx and 730 with omap1_defconfig (Re: State of LDP3430 platform)
2011-01-18 22:26 ` [PATCH] omap1: Fix sched_clock for the MPU timer (Re: State of LDP3430 platform) Tony Lindgren
@ 2011-01-18 22:35 ` Tony Lindgren
2011-01-18 23:21 ` Tony Lindgren
2011-01-19 18:44 ` [PATCH] omap1: Fix sched_clock for the MPU timer " Tony Lindgren
1 sibling, 1 reply; 11+ messages in thread
From: Tony Lindgren @ 2011-01-18 22:35 UTC (permalink / raw)
To: linux-arm-kernel
For omap15xx and 730 we need to use the MPU timer
as the 32K timer is not available. For omap16xx
we want to use the 32K timer because of PM. Fix this
by allowing to build in both timers.
Signed-off-by: Tony Lindgren <tony@atomide.com>
--- a/arch/arm/mach-omap1/Kconfig
+++ b/arch/arm/mach-omap1/Kconfig
@@ -9,6 +9,7 @@ config ARCH_OMAP730
depends on ARCH_OMAP1
bool "OMAP730 Based System"
select CPU_ARM926T
+ select OMAP_MPU_TIMER
select ARCH_OMAP_OTG
config ARCH_OMAP850
@@ -22,6 +23,7 @@ config ARCH_OMAP15XX
default y
bool "OMAP15xx Based System"
select CPU_ARM925T
+ select OMAP_MPU_TIMER
config ARCH_OMAP16XX
depends on ARCH_OMAP1
--- a/arch/arm/mach-omap1/Makefile
+++ b/arch/arm/mach-omap1/Makefile
@@ -3,12 +3,11 @@
#
# Common support
-obj-y := io.o id.o sram.o irq.o mux.o flash.o serial.o devices.o dma.o
+obj-y := io.o id.o sram.o time.o irq.o mux.o flash.o serial.o devices.o dma.o
obj-y += clock.o clock_data.o opp_data.o
obj-$(CONFIG_OMAP_MCBSP) += mcbsp.o
-obj-$(CONFIG_OMAP_MPU_TIMER) += time.o
obj-$(CONFIG_OMAP_32K_TIMER) += timer32k.o
# Power Management
--- a/arch/arm/mach-omap1/time.c
+++ b/arch/arm/mach-omap1/time.c
@@ -57,6 +57,8 @@
#include <plat/common.h>
+#ifdef CONFIG_OMAP_MPU_TIMER
+
#define OMAP_MPU_TIMER_BASE OMAP_MPU_TIMER1_BASE
#define OMAP_MPU_TIMER_OFFSET 0x100
@@ -237,12 +239,7 @@ static void __init omap_init_clocksource(unsigned long rate)
printk(err, clocksource_mpu.name);
}
-/*
- * ---------------------------------------------------------------------------
- * Timer initialization
- * ---------------------------------------------------------------------------
- */
-static void __init omap_timer_init(void)
+static void __init omap_mpu_timer_init(void)
{
struct clk *ck_ref = clk_get(NULL, "ck_ref");
unsigned long rate;
@@ -257,13 +254,38 @@ static void __init omap_timer_init(void)
omap_init_mpu_timer(rate);
omap_init_clocksource(rate);
- /*
- * XXX Since this file seems to deal mostly with the MPU timer,
- * this doesn't seem like the correct place for the sync timer
- * clocksource init.
- */
- if (!cpu_is_omap7xx() && !cpu_is_omap15xx())
- omap_init_clocksource_32k();
+}
+
+#else
+static inline void omap_mpu_timer_init(void)
+{
+ pr_err("Bogus timer, should not happen\n");
+}
+#endif /* CONFIG_OMAP_MPU_TIMER */
+
+static inline int omap_32k_timer_usable(void)
+{
+ int res = false;
+
+ if (cpu_is_omap730() || cpu_is_omap15xx())
+ return res;
+
+#ifdef CONFIG_OMAP_32K_TIMER
+ res = omap_32k_timer_init();
+#endif
+
+ return res;
+}
+
+/*
+ * ---------------------------------------------------------------------------
+ * Timer initialization
+ * ---------------------------------------------------------------------------
+ */
+static void __init omap_timer_init(void)
+{
+ if (!omap_32k_timer_usable())
+ omap_mpu_timer_init();
}
struct sys_timer omap_timer = {
--- a/arch/arm/mach-omap1/timer32k.c
+++ b/arch/arm/mach-omap1/timer32k.c
@@ -52,10 +52,9 @@
#include <asm/irq.h>
#include <asm/mach/irq.h>
#include <asm/mach/time.h>
+#include <plat/common.h>
#include <plat/dmtimer.h>
-struct sys_timer omap_timer;
-
/*
* ---------------------------------------------------------------------------
* 32KHz OS timer
@@ -181,14 +180,14 @@ static __init void omap_init_32k_timer(void)
* Timer initialization
* ---------------------------------------------------------------------------
*/
-static void __init omap_timer_init(void)
+bool __init omap_32k_timer_init(void)
{
+ omap_init_clocksource_32k();
+
#ifdef CONFIG_OMAP_DM_TIMER
omap_dm_timer_init();
#endif
omap_init_32k_timer();
-}
-struct sys_timer omap_timer = {
- .init = omap_timer_init,
-};
+ return true;
+}
--- a/arch/arm/plat-omap/Kconfig
+++ b/arch/arm/plat-omap/Kconfig
@@ -144,12 +144,9 @@ config OMAP_IOMMU_DEBUG
config OMAP_IOMMU_IVA2
bool
-choice
- prompt "System timer"
- default OMAP_32K_TIMER if !ARCH_OMAP15XX
-
config OMAP_MPU_TIMER
bool "Use mpu timer"
+ depends on ARCH_OMAP1
help
Select this option if you want to use the OMAP mpu timer. This
timer provides more intra-tick resolution than the 32KHz timer,
@@ -158,6 +155,7 @@ config OMAP_MPU_TIMER
config OMAP_32K_TIMER
bool "Use 32KHz timer"
depends on ARCH_OMAP16XX || ARCH_OMAP2PLUS
+ default y if (ARCH_OMAP16XX || ARCH_OMAP2PLUS)
help
Select this option if you want to enable the OMAP 32KHz timer.
This timer saves power compared to the OMAP_MPU_TIMER, and has
@@ -165,8 +163,6 @@ config OMAP_32K_TIMER
intra-tick resolution than OMAP_MPU_TIMER. The 32KHz timer is
currently only available for OMAP16XX, 24XX, 34XX and OMAP4.
-endchoice
-
config OMAP3_L2_AUX_SECURE_SAVE_RESTORE
bool "OMAP3 HS/EMU save and restore for L2 AUX control register"
depends on ARCH_OMAP3 && PM
--- a/arch/arm/plat-omap/counter_32k.c
+++ b/arch/arm/plat-omap/counter_32k.c
@@ -36,8 +36,6 @@
#define OMAP16XX_TIMER_32K_SYNCHRONIZED 0xfffbc410
-#if !(defined(CONFIG_ARCH_OMAP730) || defined(CONFIG_ARCH_OMAP15XX))
-
#include <linux/clocksource.h>
/*
@@ -195,6 +193,3 @@ int __init omap_init_clocksource_32k(void)
}
return 0;
}
-
-#endif /* !(defined(CONFIG_ARCH_OMAP730) || defined(CONFIG_ARCH_OMAP15XX)) */
-
--- a/arch/arm/plat-omap/include/plat/common.h
+++ b/arch/arm/plat-omap/include/plat/common.h
@@ -35,6 +35,7 @@ struct sys_timer;
extern void omap_map_common_io(void);
extern struct sys_timer omap_timer;
+extern bool omap_32k_timer_init(void);
extern int __init omap_init_clocksource_32k(void);
extern void omap_reserve(void);
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH] omap1: Fix booting for 15xx and 730 with omap1_defconfig (Re: State of LDP3430 platform)
2011-01-18 22:35 ` [PATCH] omap1: Fix booting for 15xx and 730 with omap1_defconfig " Tony Lindgren
@ 2011-01-18 23:21 ` Tony Lindgren
2011-01-19 18:43 ` [PATCH] omap1: Fix sched_clock implementation when both MPU timer and 32K timer are used " Tony Lindgren
0 siblings, 1 reply; 11+ messages in thread
From: Tony Lindgren @ 2011-01-18 23:21 UTC (permalink / raw)
To: linux-arm-kernel
* Tony Lindgren <tony@atomide.com> [110118 14:34]:
> For omap15xx and 730 we need to use the MPU timer
> as the 32K timer is not available. For omap16xx
> we want to use the 32K timer because of PM. Fix this
> by allowing to build in both timers.
This still needs one more patch to deal with the
sched_clock for MPU timer..
Tony
^ permalink raw reply [flat|nested] 11+ messages in thread
* State of LDP3430 platform
2011-01-18 19:36 ` Paul Walmsley
2011-01-18 22:26 ` [PATCH] omap1: Fix sched_clock for the MPU timer (Re: State of LDP3430 platform) Tony Lindgren
@ 2011-01-19 13:43 ` Jarkko Nikula
1 sibling, 0 replies; 11+ messages in thread
From: Jarkko Nikula @ 2011-01-19 13:43 UTC (permalink / raw)
To: linux-arm-kernel
On Tue, 18 Jan 2011 12:36:26 -0700 (MST)
Paul Walmsley <paul@pwsan.com> wrote:
> This is due to the recent ARM init_sched_clock() changes and the late
> initialization of the counter_32k clock source. More information here:
>
> http://marc.info/?l=linux-omap&m=129513468605208&w=2
>
> Fix by initializing the counter_32k clocksource during the machine timer
> initialization.
>
> Reported-by: Russell King <rmk+kernel@arm.linux.org.uk>
> Tested-by: Thomas Weber <weber@corscience.de>
> Signed-off-by: Paul Walmsley <paul@pwsan.com>
> ---
Thanks Paul. My tested-by is late as this in already in your pull
request but wanted to comment that this makes the mainline working on
omap3 after commit 211baa7
"ARM: sched_clock: allow init_sched_clock() to be called early"
--
Jarkko
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH] omap1: Fix sched_clock implementation when both MPU timer and 32K timer are used (Re: State of LDP3430 platform)
2011-01-18 23:21 ` Tony Lindgren
@ 2011-01-19 18:43 ` Tony Lindgren
0 siblings, 0 replies; 11+ messages in thread
From: Tony Lindgren @ 2011-01-19 18:43 UTC (permalink / raw)
To: linux-arm-kernel
* Tony Lindgren <tony@atomide.com> [110118 15:20]:
> * Tony Lindgren <tony@atomide.com> [110118 14:34]:
> > For omap15xx and 730 we need to use the MPU timer
> > as the 32K timer is not available. For omap16xx
> > we want to use the 32K timer because of PM. Fix this
> > by allowing to build in both timers.
>
> This still needs one more patch to deal with the
> sched_clock for MPU timer..
And here's that patch to make sched_clock work with both
timers.
Tony
From: Tony Lindgren <tony@atomide.com>
Date: Tue, 18 Jan 2011 17:00:00 -0800
Subject: [PATCH] omap1: Fix sched_clock implementation when both MPU timer and 32K timer are used
Earlier patches select HAVE_SCHED_CLOCK for omaps. To have working sched_clock
also for MPU timer, we need to implement it in a way where the right one gets
selected during the runtime.
Signed-off-by: Tony Lindgren <tony@atomide.com>
--- a/arch/arm/mach-omap1/time.c
+++ b/arch/arm/mach-omap1/time.c
@@ -219,6 +219,24 @@ static struct clocksource clocksource_mpu = {
static DEFINE_CLOCK_DATA(cd);
+static inline unsigned long long notrace _omap_mpu_sched_clock(void)
+{
+ u32 cyc = mpu_read(&clocksource_mpu);
+ return cyc_to_sched_clock(&cd, cyc, (u32)~0);
+}
+
+#ifndef CONFIG_OMAP_32K_TIMER
+unsigned long long notrace sched_clock(void)
+{
+ return _omap_mpu_sched_clock();
+}
+#else
+static unsigned long long notrace omap_mpu_sched_clock(void)
+{
+ return _omap_mpu_sched_clock();
+}
+#endif
+
static void notrace mpu_update_sched_clock(void)
{
u32 cyc = mpu_read(&clocksource_mpu);
@@ -262,6 +280,30 @@ static inline void omap_mpu_timer_init(void)
}
#endif /* CONFIG_OMAP_MPU_TIMER */
+#if defined(CONFIG_OMAP_MPU_TIMER) && defined(CONFIG_OMAP_32K_TIMER)
+static unsigned long long (*preferred_sched_clock)(void);
+
+unsigned long long notrace sched_clock(void)
+{
+ if (!preferred_sched_clock)
+ return 0;
+
+ return preferred_sched_clock();
+}
+
+static inline void preferred_sched_clock_init(bool use_32k_sched_clock)
+{
+ if (use_32k_sched_clock)
+ preferred_sched_clock = omap_32k_sched_clock;
+ else
+ preferred_sched_clock = omap_mpu_sched_clock;
+}
+#else
+static inline void preferred_sched_clock_init(bool use_32k_sched_clcok)
+{
+}
+#endif
+
static inline int omap_32k_timer_usable(void)
{
int res = false;
@@ -283,8 +325,12 @@ static inline int omap_32k_timer_usable(void)
*/
static void __init omap_timer_init(void)
{
- if (!omap_32k_timer_usable())
+ if (omap_32k_timer_usable()) {
+ preferred_sched_clock_init(1);
+ } else {
omap_mpu_timer_init();
+ preferred_sched_clock_init(0);
+ }
}
struct sys_timer omap_timer = {
--- a/arch/arm/plat-omap/counter_32k.c
+++ b/arch/arm/plat-omap/counter_32k.c
@@ -120,12 +120,24 @@ static DEFINE_CLOCK_DATA(cd);
#define SC_MULT 4000000000u
#define SC_SHIFT 17
-unsigned long long notrace sched_clock(void)
+static inline unsigned long long notrace _omap_32k_sched_clock(void)
{
u32 cyc = clocksource_32k.read(&clocksource_32k);
return cyc_to_fixed_sched_clock(&cd, cyc, (u32)~0, SC_MULT, SC_SHIFT);
}
+#ifndef CONFIG_OMAP_MPU_TIMER
+unsigned long long notrace sched_clock(void)
+{
+ return _omap_32k_sched_clock();
+}
+#else
+unsigned long long notrace omap_32k_sched_clock(void)
+{
+ return _omap_32k_sched_clock();
+}
+#endif
+
static void notrace omap_update_sched_clock(void)
{
u32 cyc = clocksource_32k.read(&clocksource_32k);
--- a/arch/arm/plat-omap/include/plat/common.h
+++ b/arch/arm/plat-omap/include/plat/common.h
@@ -37,6 +37,7 @@ extern void omap_map_common_io(void);
extern struct sys_timer omap_timer;
extern bool omap_32k_timer_init(void);
extern int __init omap_init_clocksource_32k(void);
+extern unsigned long long notrace omap_32k_sched_clock(void);
extern void omap_reserve(void);
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH] omap1: Fix sched_clock for the MPU timer (Re: State of LDP3430 platform)
2011-01-18 22:26 ` [PATCH] omap1: Fix sched_clock for the MPU timer (Re: State of LDP3430 platform) Tony Lindgren
2011-01-18 22:35 ` [PATCH] omap1: Fix booting for 15xx and 730 with omap1_defconfig " Tony Lindgren
@ 2011-01-19 18:44 ` Tony Lindgren
1 sibling, 0 replies; 11+ messages in thread
From: Tony Lindgren @ 2011-01-19 18:44 UTC (permalink / raw)
To: linux-arm-kernel
* Tony Lindgren <tony@atomide.com> [110118 14:25]:
> * Paul Walmsley <paul@pwsan.com> [110118 11:35]:
> >
> > Here's a slightly updated version of this patch, fixing a bug in one of
> > the comments, and revising the commit message. There's no functional
> > difference between this and the previous version of this patch.
>
> Thanks, here are two patches to fix the MPU timer, and then allow
> compiling in both the MPU timer and the 32KiHz timer.
I've updated this patch with the following fix to reset the timer
first to get correct PRINTK_TIME timestamps.
Regards,
Tony
--- a/arch/arm/mach-omap1/time.c
+++ b/arch/arm/mach-omap1/time.c
@@ -228,10 +228,9 @@ static void __init omap_init_clocksource(unsigned long rate)
static char err[] __initdata = KERN_ERR
"%s: can't register clocksource!\n";
- init_sched_clock(&cd, mpu_update_sched_clock, 32, rate);
-
setup_irq(INT_TIMER2, &omap_mpu_timer2_irq);
omap_mpu_timer_start(1, ~0, 1);
+ init_sched_clock(&cd, mpu_update_sched_clock, 32, rate);
if (clocksource_register_hz(&clocksource_mpu, rate))
printk(err, clocksource_mpu.name);
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2011-01-19 18:44 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20101206125526.GC31777@n2100.arm.linux.org.uk>
[not found] ` <20101206181913.GH8345@atomide.com>
[not found] ` <alpine.DEB.2.00.1012061125400.13430@utopia.booyaka.com>
[not found] ` <20101207083720.GB18336@n2100.arm.linux.org.uk>
[not found] ` <alpine.DEB.2.00.1012071745120.13430@utopia.booyaka.com>
[not found] ` <alpine.DEB.2.00.1012072012000.13430@utopia.booyaka.com>
[not found] ` <20110115000301.GT4957@atomide.com>
[not found] ` <alpine.DEB.2.00.1101151237240.32245@utopia.booyaka.com>
[not found] ` <20110115233744.GA18159@n2100.arm.linux.org.uk>
2011-01-16 4:32 ` State of LDP3430 platform Paul Walmsley
2011-01-16 15:08 ` Thomas Weber
2011-01-18 19:36 ` Paul Walmsley
2011-01-18 22:26 ` [PATCH] omap1: Fix sched_clock for the MPU timer (Re: State of LDP3430 platform) Tony Lindgren
2011-01-18 22:35 ` [PATCH] omap1: Fix booting for 15xx and 730 with omap1_defconfig " Tony Lindgren
2011-01-18 23:21 ` Tony Lindgren
2011-01-19 18:43 ` [PATCH] omap1: Fix sched_clock implementation when both MPU timer and 32K timer are used " Tony Lindgren
2011-01-19 18:44 ` [PATCH] omap1: Fix sched_clock for the MPU timer " Tony Lindgren
2011-01-19 13:43 ` State of LDP3430 platform Jarkko Nikula
2011-01-18 1:25 ` Tony Lindgren
2011-01-18 19:24 ` Paul Walmsley
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).