All of lore.kernel.org
 help / color / mirror / Atom feed
* 3.2-rc1 boot broken on OMAP1 / Amstrad E3
@ 2011-11-09 22:55 ` Aaro Koskinen
  0 siblings, 0 replies; 30+ messages in thread
From: Aaro Koskinen @ 2011-11-09 22:55 UTC (permalink / raw)
  To: linux-omap; +Cc: linux-arm-kernel

Hi,

Has anyone managed to boot 3.2-rc1 on OMAP1?

On Amstrad E3 it seems to hang at very early on the boot (below  
output is
with earlyprintk enabled):

Uncompressing Linux... done, booting the kernel.
[    0.000000] Initializing cgroup subsys cpu
[    0.000000] Linux version 3.2.0-rc1-e3 (aaro@dell) (gcc version  
4.6.1 (GCC) ) #1 PREEMPT Thu Nov 10 00:23:15 EET 2011
[    0.000000] CPU: ARM925T [54029252] revision 2 (ARMv4T), cr=0000317f
[    0.000000] CPU: VIVT data cache, VIVT instruction cache
[    0.000000] Machine: Amstrad E3 (Delta)
[    0.000000] bootconsole [earlycon0] enabled
[    0.000000] Memory policy: ECC disabled, Data cache writethrough
[    0.000000] OMAP1510
[    0.000000]  revision 2 handled as 15xx id: bc058c9b93111a16

Then it prints just some random garbage and hangs.

A.


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

* 3.2-rc1 boot broken on OMAP1 / Amstrad E3
@ 2011-11-09 22:55 ` Aaro Koskinen
  0 siblings, 0 replies; 30+ messages in thread
From: Aaro Koskinen @ 2011-11-09 22:55 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

Has anyone managed to boot 3.2-rc1 on OMAP1?

On Amstrad E3 it seems to hang at very early on the boot (below  
output is
with earlyprintk enabled):

Uncompressing Linux... done, booting the kernel.
[    0.000000] Initializing cgroup subsys cpu
[    0.000000] Linux version 3.2.0-rc1-e3 (aaro at dell) (gcc version  
4.6.1 (GCC) ) #1 PREEMPT Thu Nov 10 00:23:15 EET 2011
[    0.000000] CPU: ARM925T [54029252] revision 2 (ARMv4T), cr=0000317f
[    0.000000] CPU: VIVT data cache, VIVT instruction cache
[    0.000000] Machine: Amstrad E3 (Delta)
[    0.000000] bootconsole [earlycon0] enabled
[    0.000000] Memory policy: ECC disabled, Data cache writethrough
[    0.000000] OMAP1510
[    0.000000]  revision 2 handled as 15xx id: bc058c9b93111a16

Then it prints just some random garbage and hangs.

A.

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

* Re: 3.2-rc1 boot broken on OMAP1 / Amstrad E3
  2011-11-09 22:55 ` Aaro Koskinen
@ 2011-11-09 23:19   ` Tony Lindgren
  -1 siblings, 0 replies; 30+ messages in thread
From: Tony Lindgren @ 2011-11-09 23:19 UTC (permalink / raw)
  To: Aaro Koskinen; +Cc: linux-omap, linux-arm-kernel

* Aaro Koskinen <aaro.koskinen@iki.fi> [111109 14:19]:
> Hi,
> 
> Has anyone managed to boot 3.2-rc1 on OMAP1?
> 
> On Amstrad E3 it seems to hang at very early on the boot (below
> output is
> with earlyprintk enabled):
> 
> Uncompressing Linux... done, booting the kernel.
> [    0.000000] Initializing cgroup subsys cpu
> [    0.000000] Linux version 3.2.0-rc1-e3 (aaro@dell) (gcc version
> 4.6.1 (GCC) ) #1 PREEMPT Thu Nov 10 00:23:15 EET 2011
> [    0.000000] CPU: ARM925T [54029252] revision 2 (ARMv4T), cr=0000317f
> [    0.000000] CPU: VIVT data cache, VIVT instruction cache
> [    0.000000] Machine: Amstrad E3 (Delta)
> [    0.000000] bootconsole [earlycon0] enabled
> [    0.000000] Memory policy: ECC disabled, Data cache writethrough
> [    0.000000] OMAP1510
> [    0.000000]  revision 2 handled as 15xx id: bc058c9b93111a16
> 
> Then it prints just some random garbage and hangs.

Hmm looks like it needs a custom map_io, posting a patch just
a sec..

Tony

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

* 3.2-rc1 boot broken on OMAP1 / Amstrad E3
@ 2011-11-09 23:19   ` Tony Lindgren
  0 siblings, 0 replies; 30+ messages in thread
From: Tony Lindgren @ 2011-11-09 23:19 UTC (permalink / raw)
  To: linux-arm-kernel

* Aaro Koskinen <aaro.koskinen@iki.fi> [111109 14:19]:
> Hi,
> 
> Has anyone managed to boot 3.2-rc1 on OMAP1?
> 
> On Amstrad E3 it seems to hang at very early on the boot (below
> output is
> with earlyprintk enabled):
> 
> Uncompressing Linux... done, booting the kernel.
> [    0.000000] Initializing cgroup subsys cpu
> [    0.000000] Linux version 3.2.0-rc1-e3 (aaro at dell) (gcc version
> 4.6.1 (GCC) ) #1 PREEMPT Thu Nov 10 00:23:15 EET 2011
> [    0.000000] CPU: ARM925T [54029252] revision 2 (ARMv4T), cr=0000317f
> [    0.000000] CPU: VIVT data cache, VIVT instruction cache
> [    0.000000] Machine: Amstrad E3 (Delta)
> [    0.000000] bootconsole [earlycon0] enabled
> [    0.000000] Memory policy: ECC disabled, Data cache writethrough
> [    0.000000] OMAP1510
> [    0.000000]  revision 2 handled as 15xx id: bc058c9b93111a16
> 
> Then it prints just some random garbage and hangs.

Hmm looks like it needs a custom map_io, posting a patch just
a sec..

Tony

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

* [PATCH] ARM: OMAP: Fix map_io for Amstrad E3
  2011-11-09 23:19   ` Tony Lindgren
@ 2011-11-09 23:25     ` Tony Lindgren
  -1 siblings, 0 replies; 30+ messages in thread
From: Tony Lindgren @ 2011-11-09 23:25 UTC (permalink / raw)
  To: Aaro Koskinen; +Cc: linux-omap, linux-arm-kernel

Commit 7b88e62f5d219a86d81bdf4388012c97dc42e8f8 (ARM: OMAP1: Use generic
map_io, init_early and init_irq) changed omap1 to use generic map_io.

Looks like I missed one board though. Fix this by adding a custom
map_io for Amstrad E3.

Reported-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Tony Lindgren <tony@atomide.com>

---
Untested, does this help?
--- a/arch/arm/mach-omap1/board-ams-delta.c
+++ b/arch/arm/mach-omap1/board-ams-delta.c
@@ -302,8 +302,6 @@ static void __init ams_delta_init(void)
 	omap_cfg_reg(J19_1610_CAM_D6);
 	omap_cfg_reg(J18_1610_CAM_D7);
 
-	iotable_init(ams_delta_io_desc, ARRAY_SIZE(ams_delta_io_desc));
-
 	omap_board_config = ams_delta_config;
 	omap_board_config_size = ARRAY_SIZE(ams_delta_config);
 	omap_serial_init();
@@ -373,10 +371,16 @@ static int __init ams_delta_modem_init(void)
 }
 arch_initcall(ams_delta_modem_init);
 
+static void __init ams_delta_map_io(void)
+{
+	omap15xx_map_io();
+	iotable_init(ams_delta_io_desc, ARRAY_SIZE(ams_delta_io_desc));
+}
+
 MACHINE_START(AMS_DELTA, "Amstrad E3 (Delta)")
 	/* Maintainer: Jonathan McDowell <noodles@earth.li> */
 	.atag_offset	= 0x100,
-	.map_io		= omap15xx_map_io,
+	.map_io		= ams_delta_map_io,
 	.init_early	= omap1_init_early,
 	.reserve	= omap_reserve,
 	.init_irq	= omap1_init_irq,

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

* [PATCH] ARM: OMAP: Fix map_io for Amstrad E3
@ 2011-11-09 23:25     ` Tony Lindgren
  0 siblings, 0 replies; 30+ messages in thread
From: Tony Lindgren @ 2011-11-09 23:25 UTC (permalink / raw)
  To: linux-arm-kernel

Commit 7b88e62f5d219a86d81bdf4388012c97dc42e8f8 (ARM: OMAP1: Use generic
map_io, init_early and init_irq) changed omap1 to use generic map_io.

Looks like I missed one board though. Fix this by adding a custom
map_io for Amstrad E3.

Reported-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Tony Lindgren <tony@atomide.com>

---
Untested, does this help?
--- a/arch/arm/mach-omap1/board-ams-delta.c
+++ b/arch/arm/mach-omap1/board-ams-delta.c
@@ -302,8 +302,6 @@ static void __init ams_delta_init(void)
 	omap_cfg_reg(J19_1610_CAM_D6);
 	omap_cfg_reg(J18_1610_CAM_D7);
 
-	iotable_init(ams_delta_io_desc, ARRAY_SIZE(ams_delta_io_desc));
-
 	omap_board_config = ams_delta_config;
 	omap_board_config_size = ARRAY_SIZE(ams_delta_config);
 	omap_serial_init();
@@ -373,10 +371,16 @@ static int __init ams_delta_modem_init(void)
 }
 arch_initcall(ams_delta_modem_init);
 
+static void __init ams_delta_map_io(void)
+{
+	omap15xx_map_io();
+	iotable_init(ams_delta_io_desc, ARRAY_SIZE(ams_delta_io_desc));
+}
+
 MACHINE_START(AMS_DELTA, "Amstrad E3 (Delta)")
 	/* Maintainer: Jonathan McDowell <noodles@earth.li> */
 	.atag_offset	= 0x100,
-	.map_io		= omap15xx_map_io,
+	.map_io		= ams_delta_map_io,
 	.init_early	= omap1_init_early,
 	.reserve	= omap_reserve,
 	.init_irq	= omap1_init_irq,

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

* Re: [PATCH] ARM: OMAP: Fix map_io for Amstrad E3
  2011-11-09 23:25     ` Tony Lindgren
@ 2011-11-09 23:39       ` Russell King - ARM Linux
  -1 siblings, 0 replies; 30+ messages in thread
From: Russell King - ARM Linux @ 2011-11-09 23:39 UTC (permalink / raw)
  To: Tony Lindgren; +Cc: Aaro Koskinen, linux-omap, linux-arm-kernel

On Wed, Nov 09, 2011 at 03:25:25PM -0800, Tony Lindgren wrote:
> Commit 7b88e62f5d219a86d81bdf4388012c97dc42e8f8 (ARM: OMAP1: Use generic
> map_io, init_early and init_irq) changed omap1 to use generic map_io.
> 
> Looks like I missed one board though. Fix this by adding a custom
> map_io for Amstrad E3.
> 
> Reported-by: Aaro Koskinen <aaro.koskinen@iki.fi>
> Signed-off-by: Tony Lindgren <tony@atomide.com>
> 
> ---
> Untested, does this help?
> --- a/arch/arm/mach-omap1/board-ams-delta.c
> +++ b/arch/arm/mach-omap1/board-ams-delta.c
> @@ -302,8 +302,6 @@ static void __init ams_delta_init(void)
>  	omap_cfg_reg(J19_1610_CAM_D6);
>  	omap_cfg_reg(J18_1610_CAM_D7);
>  
> -	iotable_init(ams_delta_io_desc, ARRAY_SIZE(ams_delta_io_desc));
> -

This is definitely wrong.  Using iotable_init() after map_io has returned
has (and remains) a serious bug - doing so may _appear_ to work but as it
doesn't obtain its memory from the standard kernel memory allocators, it
will lead to duplicate usage of that memory.

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

* [PATCH] ARM: OMAP: Fix map_io for Amstrad E3
@ 2011-11-09 23:39       ` Russell King - ARM Linux
  0 siblings, 0 replies; 30+ messages in thread
From: Russell King - ARM Linux @ 2011-11-09 23:39 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Nov 09, 2011 at 03:25:25PM -0800, Tony Lindgren wrote:
> Commit 7b88e62f5d219a86d81bdf4388012c97dc42e8f8 (ARM: OMAP1: Use generic
> map_io, init_early and init_irq) changed omap1 to use generic map_io.
> 
> Looks like I missed one board though. Fix this by adding a custom
> map_io for Amstrad E3.
> 
> Reported-by: Aaro Koskinen <aaro.koskinen@iki.fi>
> Signed-off-by: Tony Lindgren <tony@atomide.com>
> 
> ---
> Untested, does this help?
> --- a/arch/arm/mach-omap1/board-ams-delta.c
> +++ b/arch/arm/mach-omap1/board-ams-delta.c
> @@ -302,8 +302,6 @@ static void __init ams_delta_init(void)
>  	omap_cfg_reg(J19_1610_CAM_D6);
>  	omap_cfg_reg(J18_1610_CAM_D7);
>  
> -	iotable_init(ams_delta_io_desc, ARRAY_SIZE(ams_delta_io_desc));
> -

This is definitely wrong.  Using iotable_init() after map_io has returned
has (and remains) a serious bug - doing so may _appear_ to work but as it
doesn't obtain its memory from the standard kernel memory allocators, it
will lead to duplicate usage of that memory.

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

* Re: [PATCH] ARM: OMAP: Fix map_io for Amstrad E3
  2011-11-09 23:39       ` Russell King - ARM Linux
@ 2011-11-10  0:00         ` Aaro Koskinen
  -1 siblings, 0 replies; 30+ messages in thread
From: Aaro Koskinen @ 2011-11-10  0:00 UTC (permalink / raw)
  To: Russell King - ARM Linux, Tony Lindgren; +Cc: linux-omap, linux-arm-kernel

Hi,

On 10.11.2011, at 1.39, Russell King - ARM Linux wrote:
> On Wed, Nov 09, 2011 at 03:25:25PM -0800, Tony Lindgren wrote:
>> Commit 7b88e62f5d219a86d81bdf4388012c97dc42e8f8 (ARM: OMAP1: Use  
>> generic
>> map_io, init_early and init_irq) changed omap1 to use generic map_io.
>>
>> Looks like I missed one board though. Fix this by adding a custom
>> map_io for Amstrad E3.
>>
>> Reported-by: Aaro Koskinen <aaro.koskinen@iki.fi>
>> Signed-off-by: Tony Lindgren <tony@atomide.com>
>>
>> ---
>> Untested, does this help?
>> --- a/arch/arm/mach-omap1/board-ams-delta.c
>> +++ b/arch/arm/mach-omap1/board-ams-delta.c
>> @@ -302,8 +302,6 @@ static void __init ams_delta_init(void)
>>  	omap_cfg_reg(J19_1610_CAM_D6);
>>  	omap_cfg_reg(J18_1610_CAM_D7);
>>
>> -	iotable_init(ams_delta_io_desc, ARRAY_SIZE(ams_delta_io_desc));
>> -
>
> This is definitely wrong.  Using iotable_init() after map_io has  
> returned
> has (and remains) a serious bug - doing so may _appear_ to work but  
> as it
> doesn't obtain its memory from the standard kernel memory  
> allocators, it
> will lead to duplicate usage of that memory.

Also, the patch did not help. It still hangs like before.

A.


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

* [PATCH] ARM: OMAP: Fix map_io for Amstrad E3
@ 2011-11-10  0:00         ` Aaro Koskinen
  0 siblings, 0 replies; 30+ messages in thread
From: Aaro Koskinen @ 2011-11-10  0:00 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

On 10.11.2011, at 1.39, Russell King - ARM Linux wrote:
> On Wed, Nov 09, 2011 at 03:25:25PM -0800, Tony Lindgren wrote:
>> Commit 7b88e62f5d219a86d81bdf4388012c97dc42e8f8 (ARM: OMAP1: Use  
>> generic
>> map_io, init_early and init_irq) changed omap1 to use generic map_io.
>>
>> Looks like I missed one board though. Fix this by adding a custom
>> map_io for Amstrad E3.
>>
>> Reported-by: Aaro Koskinen <aaro.koskinen@iki.fi>
>> Signed-off-by: Tony Lindgren <tony@atomide.com>
>>
>> ---
>> Untested, does this help?
>> --- a/arch/arm/mach-omap1/board-ams-delta.c
>> +++ b/arch/arm/mach-omap1/board-ams-delta.c
>> @@ -302,8 +302,6 @@ static void __init ams_delta_init(void)
>>  	omap_cfg_reg(J19_1610_CAM_D6);
>>  	omap_cfg_reg(J18_1610_CAM_D7);
>>
>> -	iotable_init(ams_delta_io_desc, ARRAY_SIZE(ams_delta_io_desc));
>> -
>
> This is definitely wrong.  Using iotable_init() after map_io has  
> returned
> has (and remains) a serious bug - doing so may _appear_ to work but  
> as it
> doesn't obtain its memory from the standard kernel memory  
> allocators, it
> will lead to duplicate usage of that memory.

Also, the patch did not help. It still hangs like before.

A.

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

* Re: [PATCH] ARM: OMAP: Fix map_io for Amstrad E3
  2011-11-10  0:00         ` Aaro Koskinen
@ 2011-11-10  0:04           ` Tony Lindgren
  -1 siblings, 0 replies; 30+ messages in thread
From: Tony Lindgren @ 2011-11-10  0:04 UTC (permalink / raw)
  To: Aaro Koskinen; +Cc: Russell King - ARM Linux, linux-omap, linux-arm-kernel

* Aaro Koskinen <aaro.koskinen@iki.fi> [111109 15:25]:
> Hi,
> 
> On 10.11.2011, at 1.39, Russell King - ARM Linux wrote:
> >On Wed, Nov 09, 2011 at 03:25:25PM -0800, Tony Lindgren wrote:
> >>Commit 7b88e62f5d219a86d81bdf4388012c97dc42e8f8 (ARM: OMAP1: Use
> >>generic
> >>map_io, init_early and init_irq) changed omap1 to use generic map_io.
> >>
> >>Looks like I missed one board though. Fix this by adding a custom
> >>map_io for Amstrad E3.
> >>
> >>Reported-by: Aaro Koskinen <aaro.koskinen@iki.fi>
> >>Signed-off-by: Tony Lindgren <tony@atomide.com>
> >>
> >>---
> >>Untested, does this help?
> >>--- a/arch/arm/mach-omap1/board-ams-delta.c
> >>+++ b/arch/arm/mach-omap1/board-ams-delta.c
> >>@@ -302,8 +302,6 @@ static void __init ams_delta_init(void)
> >> 	omap_cfg_reg(J19_1610_CAM_D6);
> >> 	omap_cfg_reg(J18_1610_CAM_D7);
> >>
> >>-	iotable_init(ams_delta_io_desc, ARRAY_SIZE(ams_delta_io_desc));
> >>-
> >
> >This is definitely wrong.  Using iotable_init() after map_io has
> >returned
> >has (and remains) a serious bug - doing so may _appear_ to work
> >but as it
> >doesn't obtain its memory from the standard kernel memory
> >allocators, it
> >will lead to duplicate usage of that memory.
> 
> Also, the patch did not help. It still hangs like before.

Hmm that patch is needed for sure but sounds like there's also
something else wrong.. Can you try to git bisect it?

Tony

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

* [PATCH] ARM: OMAP: Fix map_io for Amstrad E3
@ 2011-11-10  0:04           ` Tony Lindgren
  0 siblings, 0 replies; 30+ messages in thread
From: Tony Lindgren @ 2011-11-10  0:04 UTC (permalink / raw)
  To: linux-arm-kernel

* Aaro Koskinen <aaro.koskinen@iki.fi> [111109 15:25]:
> Hi,
> 
> On 10.11.2011, at 1.39, Russell King - ARM Linux wrote:
> >On Wed, Nov 09, 2011 at 03:25:25PM -0800, Tony Lindgren wrote:
> >>Commit 7b88e62f5d219a86d81bdf4388012c97dc42e8f8 (ARM: OMAP1: Use
> >>generic
> >>map_io, init_early and init_irq) changed omap1 to use generic map_io.
> >>
> >>Looks like I missed one board though. Fix this by adding a custom
> >>map_io for Amstrad E3.
> >>
> >>Reported-by: Aaro Koskinen <aaro.koskinen@iki.fi>
> >>Signed-off-by: Tony Lindgren <tony@atomide.com>
> >>
> >>---
> >>Untested, does this help?
> >>--- a/arch/arm/mach-omap1/board-ams-delta.c
> >>+++ b/arch/arm/mach-omap1/board-ams-delta.c
> >>@@ -302,8 +302,6 @@ static void __init ams_delta_init(void)
> >> 	omap_cfg_reg(J19_1610_CAM_D6);
> >> 	omap_cfg_reg(J18_1610_CAM_D7);
> >>
> >>-	iotable_init(ams_delta_io_desc, ARRAY_SIZE(ams_delta_io_desc));
> >>-
> >
> >This is definitely wrong.  Using iotable_init() after map_io has
> >returned
> >has (and remains) a serious bug - doing so may _appear_ to work
> >but as it
> >doesn't obtain its memory from the standard kernel memory
> >allocators, it
> >will lead to duplicate usage of that memory.
> 
> Also, the patch did not help. It still hangs like before.

Hmm that patch is needed for sure but sounds like there's also
something else wrong.. Can you try to git bisect it?

Tony

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

* Re: [PATCH] ARM: OMAP: Fix map_io for Amstrad E3
  2011-11-10  0:04           ` Tony Lindgren
@ 2011-11-10  0:28             ` Aaro Koskinen
  -1 siblings, 0 replies; 30+ messages in thread
From: Aaro Koskinen @ 2011-11-10  0:28 UTC (permalink / raw)
  To: Tony Lindgren; +Cc: Russell King - ARM Linux, linux-omap, linux-arm-kernel

Hi,

On 10.11.2011, at 2.04, Tony Lindgren wrote:
> * Aaro Koskinen <aaro.koskinen@iki.fi> [111109 15:25]:
>> On 10.11.2011, at 1.39, Russell King - ARM Linux wrote:
>>> On Wed, Nov 09, 2011 at 03:25:25PM -0800, Tony Lindgren wrote:
>>>> Commit 7b88e62f5d219a86d81bdf4388012c97dc42e8f8 (ARM: OMAP1: Use
>>>> generic
>>>> map_io, init_early and init_irq) changed omap1 to use generic  
>>>> map_io.
>>>>
>>>> Looks like I missed one board though. Fix this by adding a custom
>>>> map_io for Amstrad E3.
>>>>
>>>> Reported-by: Aaro Koskinen <aaro.koskinen@iki.fi>
>>>> Signed-off-by: Tony Lindgren <tony@atomide.com>
>>>>
>>>> ---
>>>> Untested, does this help?
>>>> --- a/arch/arm/mach-omap1/board-ams-delta.c
>>>> +++ b/arch/arm/mach-omap1/board-ams-delta.c
>>>> @@ -302,8 +302,6 @@ static void __init ams_delta_init(void)
>>>> 	omap_cfg_reg(J19_1610_CAM_D6);
>>>> 	omap_cfg_reg(J18_1610_CAM_D7);
>>>>
>>>> -	iotable_init(ams_delta_io_desc, ARRAY_SIZE(ams_delta_io_desc));
>>>> -
>>>
>>> This is definitely wrong.  Using iotable_init() after map_io has
>>> returned
>>> has (and remains) a serious bug - doing so may _appear_ to work
>>> but as it
>>> doesn't obtain its memory from the standard kernel memory
>>> allocators, it
>>> will lead to duplicate usage of that memory.
>>
>> Also, the patch did not help. It still hangs like before.
>
> Hmm that patch is needed for sure but sounds like there's also
> something else wrong.. Can you try to git bisect it?

Ok, I'll try bisecting tomorrow.

A.


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

* [PATCH] ARM: OMAP: Fix map_io for Amstrad E3
@ 2011-11-10  0:28             ` Aaro Koskinen
  0 siblings, 0 replies; 30+ messages in thread
From: Aaro Koskinen @ 2011-11-10  0:28 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

On 10.11.2011, at 2.04, Tony Lindgren wrote:
> * Aaro Koskinen <aaro.koskinen@iki.fi> [111109 15:25]:
>> On 10.11.2011, at 1.39, Russell King - ARM Linux wrote:
>>> On Wed, Nov 09, 2011 at 03:25:25PM -0800, Tony Lindgren wrote:
>>>> Commit 7b88e62f5d219a86d81bdf4388012c97dc42e8f8 (ARM: OMAP1: Use
>>>> generic
>>>> map_io, init_early and init_irq) changed omap1 to use generic  
>>>> map_io.
>>>>
>>>> Looks like I missed one board though. Fix this by adding a custom
>>>> map_io for Amstrad E3.
>>>>
>>>> Reported-by: Aaro Koskinen <aaro.koskinen@iki.fi>
>>>> Signed-off-by: Tony Lindgren <tony@atomide.com>
>>>>
>>>> ---
>>>> Untested, does this help?
>>>> --- a/arch/arm/mach-omap1/board-ams-delta.c
>>>> +++ b/arch/arm/mach-omap1/board-ams-delta.c
>>>> @@ -302,8 +302,6 @@ static void __init ams_delta_init(void)
>>>> 	omap_cfg_reg(J19_1610_CAM_D6);
>>>> 	omap_cfg_reg(J18_1610_CAM_D7);
>>>>
>>>> -	iotable_init(ams_delta_io_desc, ARRAY_SIZE(ams_delta_io_desc));
>>>> -
>>>
>>> This is definitely wrong.  Using iotable_init() after map_io has
>>> returned
>>> has (and remains) a serious bug - doing so may _appear_ to work
>>> but as it
>>> doesn't obtain its memory from the standard kernel memory
>>> allocators, it
>>> will lead to duplicate usage of that memory.
>>
>> Also, the patch did not help. It still hangs like before.
>
> Hmm that patch is needed for sure but sounds like there's also
> something else wrong.. Can you try to git bisect it?

Ok, I'll try bisecting tomorrow.

A.

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

* Re: [PATCH] ARM: OMAP: Fix map_io for Amstrad E3
  2011-11-10  0:04           ` Tony Lindgren
@ 2011-11-10 22:06             ` Aaro Koskinen
  -1 siblings, 0 replies; 30+ messages in thread
From: Aaro Koskinen @ 2011-11-10 22:06 UTC (permalink / raw)
  To: Tony Lindgren; +Cc: Russell King - ARM Linux, linux-omap, linux-arm-kernel

Hi,

On Wed, 9 Nov 2011, Tony Lindgren wrote:
> * Aaro Koskinen <aaro.koskinen@iki.fi> [111109 15:25]:
>> On 10.11.2011, at 1.39, Russell King - ARM Linux wrote:
>>> On Wed, Nov 09, 2011 at 03:25:25PM -0800, Tony Lindgren wrote:
>>>> Commit 7b88e62f5d219a86d81bdf4388012c97dc42e8f8 (ARM: OMAP1: Use
>>>> generic
>>>> map_io, init_early and init_irq) changed omap1 to use generic map_io.
>>>>
>>>> Looks like I missed one board though. Fix this by adding a custom
>>>> map_io for Amstrad E3.
>>>>
>>>> Reported-by: Aaro Koskinen <aaro.koskinen@iki.fi>
>>>> Signed-off-by: Tony Lindgren <tony@atomide.com>
>>>>
>>>> ---
>>>> Untested, does this help?
>>>> --- a/arch/arm/mach-omap1/board-ams-delta.c
>>>> +++ b/arch/arm/mach-omap1/board-ams-delta.c
>>>> @@ -302,8 +302,6 @@ static void __init ams_delta_init(void)
>>>> 	omap_cfg_reg(J19_1610_CAM_D6);
>>>> 	omap_cfg_reg(J18_1610_CAM_D7);
>>>>
>>>> -	iotable_init(ams_delta_io_desc, ARRAY_SIZE(ams_delta_io_desc));
>>>> -
>>>
>>> This is definitely wrong.  Using iotable_init() after map_io has
>>> returned
>>> has (and remains) a serious bug - doing so may _appear_ to work
>>> but as it
>>> doesn't obtain its memory from the standard kernel memory
>>> allocators, it
>>> will lead to duplicate usage of that memory.
>>
>> Also, the patch did not help. It still hangs like before.
>
> Hmm that patch is needed for sure but sounds like there's also
> something else wrong.. Can you try to git bisect it?

I found it impossible to bisect, but there are two issues I found:

1) earlyconsole turns into garbage in omap1_clk_init() unless I do
the following:

diff --git a/arch/arm/mach-omap1/clock_data.c b/arch/arm/mach-omap1/clock_data.c
index 92400b9..b9ce2ad 100644
--- a/arch/arm/mach-omap1/clock_data.c
+++ b/arch/arm/mach-omap1/clock_data.c
@@ -774,14 +774,6 @@ int __init omap1_clk_init(void)
  	int crystal_type = 0; /* Default 12 MHz */
  	u32 reg, cpu_mask;

-#ifdef CONFIG_DEBUG_LL
-	/*
-	 * Resets some clocks that may be left on from bootloader,
-	 * but leaves serial clocks on.
-	 */
-	omap_writel(0x3 << 29, MOD_CONF_CTRL_0);
-#endif
-
  	/* USB_REQ_EN will be disabled later if necessary (usb_dc_ck) */
  	reg = omap_readw(SOFT_REQ_REG) & (1 << 4);
  	omap_writew(reg, SOFT_REQ_REG);

2) By using the above hack, I could see the actual crash:

Uncompressing Linux... done, booting the kernel.
[    0.000000] Initializing cgroup subsys cpu
[    0.000000] Linux version 3.2.0-rc1-e3 (aaro@dell) (gcc version 4.6.1 (GCC) ) #9 PREEMPT Thu Nov 10 23:48:23 EET 2011
[    0.000000] CPU: ARM925T [54029252] revision 2 (ARMv4T), cr=0000317f
[    0.000000] CPU: VIVT data cache, VIVT instruction cache
[    0.000000] Machine: Amstrad E3 (Delta)
[    0.000000] bootconsole [earlycon0] enabled
[    0.000000] Memory policy: ECC disabled, Data cache writethrough
[    0.000000] OMAP1510
[    0.000000]  revision 2 handled as 15xx id: bc058c9b93111a16
[    0.000000] Clocks: ARM_SYSST: 0x1000 DPLL_CTL: 0x2cb3 ARM_CKCTL: 0x250e
[    0.000000] ------------[ cut here ]------------
[    0.000000] kernel BUG at arch/arm/plat-omap/sram.c:226!
[    0.000000] Internal error: Oops - undefined instruction: 0 [#1] PREEMPT
[    0.000000] Modules linked in:
[    0.000000] CPU: 0    Not tainted  (3.2.0-rc1-e3 #9)
[    0.000000] PC is at omap_sram_reprogram_clock+0x28/0x30
[    0.000000] LR is at omap1_select_table_rate+0x88/0xb4
[    0.000000] pc : [<c001b0c4>]    lr : [<c0019f54>]    psr: 600000d3
[    0.000000] sp : c035bf10  ip : c035bf20  fp : c035bf1c
[    0.000000] r10: c035bfd4  r9 : 54029252  r8 : c03f8120
[    0.000000] r7 : c0362b50  r6 : 00b71b00  r5 : c03873cc  r4 : c0362b40
[    0.000000] r3 : 00000000  r2 : c0362b40  r1 : 0000010a  r0 : 00002cb0
[    0.000000] Flags: nZCv  IRQs off  FIQs off  Mode SVC_32  ISA ARM  Segment kernel
[    0.000000] Control: 0000317f  Table: 10004000  DAC: 00000017
[    0.000000] Process swapper (pid: 0, stack limit = 0xc035a270)
[    0.000000] Stack: (0xc035bf10 to 0xc035c000)
[    0.000000] bf00:                                     c035bf3c c035bf20 c0019f54 c001b0ac
[    0.000000] bf20: 00001000 00002cb3 00000004 c035ed4c c035bf74 c035bf40 c033ea24 c0019edc
[    0.000000] bf40: c02f526c 00000002 00000015 bc058c9b 93111a16 c035335c 02000000 c035ed4c
[    0.000000] bf60: c035ed4c c03f8120 c035bf84 c035bf78 c00194c4 c033e8ec c035bfc4 c035bf88
[    0.000000] bf80: c033bc24 c00194a0 c035bf90 c035bf98 00000000 00000000 00000000 00000000
[    0.000000] bfa0: 00000001 00000000 c0354678 c035ece4 10004000 103532f4 c035bff4 c035bfc8
[    0.000000] bfc0: c0338574 c033b598 00000000 00000000 00000000 c035467c 0000317d c035c03c
[    0.000000] bfe0: c0354678 c035ece4 00000000 c035bff8 10008040 c0338508 00000000 00000000
[    0.000000] Backtrace:
[    0.000000] [<c001b09c>] (omap_sram_reprogram_clock+0x0/0x30) from [<c0019f54>] (omap1_select_table_rate+0x88/0xb4)
[    0.000000] [<c0019ecc>] (omap1_select_table_rate+0x0/0xb4) from [<c033ea24>] (omap1_clk_init+0x148/0x334)
[    0.000000]  r7:c035ed4c r6:00000004 r5:00002cb3 r4:00001000
[    0.000000] [<c033e8dc>] (omap1_clk_init+0x0/0x334) from [<c00194c4>] (omap1_init_early+0x34/0x48)
[    0.000000]  r8:c03f8120 r7:c035ed4c r6:c035ed4c r5:02000000 r4:c035335c
[    0.000000] [<c0019490>] (omap1_init_early+0x0/0x48) from [<c033bc24>] (setup_arch+0x69c/0x79c)
[    0.000000] [<c033b588>] (setup_arch+0x0/0x79c) from [<c0338574>] (start_kernel+0x7c/0x2f4)
[    0.000000] [<c03384f8>] (start_kernel+0x0/0x2f4) from [<10008040>] (0x10008040)
[    0.000000]  r7:c035ece4 r6:c0354678 r5:c035c03c r4:0000317d
[    0.000000] Code: 0a000002 e1a0e00f e12fff13 e89da800 (e7f001f2)
[    0.000000] ---[ end trace 1b75b31a2719ed1c ]---

The BUG_ON() in omap_sram_reprogram_clock() triggers, because
it's called before omap_sram_init(). If I comment out the code in
omap_sram_reprogram_clock(), the board boots up.

A.

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

* [PATCH] ARM: OMAP: Fix map_io for Amstrad E3
@ 2011-11-10 22:06             ` Aaro Koskinen
  0 siblings, 0 replies; 30+ messages in thread
From: Aaro Koskinen @ 2011-11-10 22:06 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

On Wed, 9 Nov 2011, Tony Lindgren wrote:
> * Aaro Koskinen <aaro.koskinen@iki.fi> [111109 15:25]:
>> On 10.11.2011, at 1.39, Russell King - ARM Linux wrote:
>>> On Wed, Nov 09, 2011 at 03:25:25PM -0800, Tony Lindgren wrote:
>>>> Commit 7b88e62f5d219a86d81bdf4388012c97dc42e8f8 (ARM: OMAP1: Use
>>>> generic
>>>> map_io, init_early and init_irq) changed omap1 to use generic map_io.
>>>>
>>>> Looks like I missed one board though. Fix this by adding a custom
>>>> map_io for Amstrad E3.
>>>>
>>>> Reported-by: Aaro Koskinen <aaro.koskinen@iki.fi>
>>>> Signed-off-by: Tony Lindgren <tony@atomide.com>
>>>>
>>>> ---
>>>> Untested, does this help?
>>>> --- a/arch/arm/mach-omap1/board-ams-delta.c
>>>> +++ b/arch/arm/mach-omap1/board-ams-delta.c
>>>> @@ -302,8 +302,6 @@ static void __init ams_delta_init(void)
>>>> 	omap_cfg_reg(J19_1610_CAM_D6);
>>>> 	omap_cfg_reg(J18_1610_CAM_D7);
>>>>
>>>> -	iotable_init(ams_delta_io_desc, ARRAY_SIZE(ams_delta_io_desc));
>>>> -
>>>
>>> This is definitely wrong.  Using iotable_init() after map_io has
>>> returned
>>> has (and remains) a serious bug - doing so may _appear_ to work
>>> but as it
>>> doesn't obtain its memory from the standard kernel memory
>>> allocators, it
>>> will lead to duplicate usage of that memory.
>>
>> Also, the patch did not help. It still hangs like before.
>
> Hmm that patch is needed for sure but sounds like there's also
> something else wrong.. Can you try to git bisect it?

I found it impossible to bisect, but there are two issues I found:

1) earlyconsole turns into garbage in omap1_clk_init() unless I do
the following:

diff --git a/arch/arm/mach-omap1/clock_data.c b/arch/arm/mach-omap1/clock_data.c
index 92400b9..b9ce2ad 100644
--- a/arch/arm/mach-omap1/clock_data.c
+++ b/arch/arm/mach-omap1/clock_data.c
@@ -774,14 +774,6 @@ int __init omap1_clk_init(void)
  	int crystal_type = 0; /* Default 12 MHz */
  	u32 reg, cpu_mask;

-#ifdef CONFIG_DEBUG_LL
-	/*
-	 * Resets some clocks that may be left on from bootloader,
-	 * but leaves serial clocks on.
-	 */
-	omap_writel(0x3 << 29, MOD_CONF_CTRL_0);
-#endif
-
  	/* USB_REQ_EN will be disabled later if necessary (usb_dc_ck) */
  	reg = omap_readw(SOFT_REQ_REG) & (1 << 4);
  	omap_writew(reg, SOFT_REQ_REG);

2) By using the above hack, I could see the actual crash:

Uncompressing Linux... done, booting the kernel.
[    0.000000] Initializing cgroup subsys cpu
[    0.000000] Linux version 3.2.0-rc1-e3 (aaro at dell) (gcc version 4.6.1 (GCC) ) #9 PREEMPT Thu Nov 10 23:48:23 EET 2011
[    0.000000] CPU: ARM925T [54029252] revision 2 (ARMv4T), cr=0000317f
[    0.000000] CPU: VIVT data cache, VIVT instruction cache
[    0.000000] Machine: Amstrad E3 (Delta)
[    0.000000] bootconsole [earlycon0] enabled
[    0.000000] Memory policy: ECC disabled, Data cache writethrough
[    0.000000] OMAP1510
[    0.000000]  revision 2 handled as 15xx id: bc058c9b93111a16
[    0.000000] Clocks: ARM_SYSST: 0x1000 DPLL_CTL: 0x2cb3 ARM_CKCTL: 0x250e
[    0.000000] ------------[ cut here ]------------
[    0.000000] kernel BUG at arch/arm/plat-omap/sram.c:226!
[    0.000000] Internal error: Oops - undefined instruction: 0 [#1] PREEMPT
[    0.000000] Modules linked in:
[    0.000000] CPU: 0    Not tainted  (3.2.0-rc1-e3 #9)
[    0.000000] PC is at omap_sram_reprogram_clock+0x28/0x30
[    0.000000] LR is@omap1_select_table_rate+0x88/0xb4
[    0.000000] pc : [<c001b0c4>]    lr : [<c0019f54>]    psr: 600000d3
[    0.000000] sp : c035bf10  ip : c035bf20  fp : c035bf1c
[    0.000000] r10: c035bfd4  r9 : 54029252  r8 : c03f8120
[    0.000000] r7 : c0362b50  r6 : 00b71b00  r5 : c03873cc  r4 : c0362b40
[    0.000000] r3 : 00000000  r2 : c0362b40  r1 : 0000010a  r0 : 00002cb0
[    0.000000] Flags: nZCv  IRQs off  FIQs off  Mode SVC_32  ISA ARM  Segment kernel
[    0.000000] Control: 0000317f  Table: 10004000  DAC: 00000017
[    0.000000] Process swapper (pid: 0, stack limit = 0xc035a270)
[    0.000000] Stack: (0xc035bf10 to 0xc035c000)
[    0.000000] bf00:                                     c035bf3c c035bf20 c0019f54 c001b0ac
[    0.000000] bf20: 00001000 00002cb3 00000004 c035ed4c c035bf74 c035bf40 c033ea24 c0019edc
[    0.000000] bf40: c02f526c 00000002 00000015 bc058c9b 93111a16 c035335c 02000000 c035ed4c
[    0.000000] bf60: c035ed4c c03f8120 c035bf84 c035bf78 c00194c4 c033e8ec c035bfc4 c035bf88
[    0.000000] bf80: c033bc24 c00194a0 c035bf90 c035bf98 00000000 00000000 00000000 00000000
[    0.000000] bfa0: 00000001 00000000 c0354678 c035ece4 10004000 103532f4 c035bff4 c035bfc8
[    0.000000] bfc0: c0338574 c033b598 00000000 00000000 00000000 c035467c 0000317d c035c03c
[    0.000000] bfe0: c0354678 c035ece4 00000000 c035bff8 10008040 c0338508 00000000 00000000
[    0.000000] Backtrace:
[    0.000000] [<c001b09c>] (omap_sram_reprogram_clock+0x0/0x30) from [<c0019f54>] (omap1_select_table_rate+0x88/0xb4)
[    0.000000] [<c0019ecc>] (omap1_select_table_rate+0x0/0xb4) from [<c033ea24>] (omap1_clk_init+0x148/0x334)
[    0.000000]  r7:c035ed4c r6:00000004 r5:00002cb3 r4:00001000
[    0.000000] [<c033e8dc>] (omap1_clk_init+0x0/0x334) from [<c00194c4>] (omap1_init_early+0x34/0x48)
[    0.000000]  r8:c03f8120 r7:c035ed4c r6:c035ed4c r5:02000000 r4:c035335c
[    0.000000] [<c0019490>] (omap1_init_early+0x0/0x48) from [<c033bc24>] (setup_arch+0x69c/0x79c)
[    0.000000] [<c033b588>] (setup_arch+0x0/0x79c) from [<c0338574>] (start_kernel+0x7c/0x2f4)
[    0.000000] [<c03384f8>] (start_kernel+0x0/0x2f4) from [<10008040>] (0x10008040)
[    0.000000]  r7:c035ece4 r6:c0354678 r5:c035c03c r4:0000317d
[    0.000000] Code: 0a000002 e1a0e00f e12fff13 e89da800 (e7f001f2)
[    0.000000] ---[ end trace 1b75b31a2719ed1c ]---

The BUG_ON() in omap_sram_reprogram_clock() triggers, because
it's called before omap_sram_init(). If I comment out the code in
omap_sram_reprogram_clock(), the board boots up.

A.

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

* Re: [PATCH] ARM: OMAP: Fix map_io for Amstrad E3
  2011-11-10 22:06             ` Aaro Koskinen
@ 2011-11-10 23:23               ` Tony Lindgren
  -1 siblings, 0 replies; 30+ messages in thread
From: Tony Lindgren @ 2011-11-10 23:23 UTC (permalink / raw)
  To: Aaro Koskinen; +Cc: Russell King - ARM Linux, linux-omap, linux-arm-kernel

* Aaro Koskinen <aaro.koskinen@iki.fi> [111110 13:31]:
> --- a/arch/arm/mach-omap1/clock_data.c
> +++ b/arch/arm/mach-omap1/clock_data.c
> @@ -774,14 +774,6 @@ int __init omap1_clk_init(void)
>  	int crystal_type = 0; /* Default 12 MHz */
>  	u32 reg, cpu_mask;
> 
> -#ifdef CONFIG_DEBUG_LL
> -	/*
> -	 * Resets some clocks that may be left on from bootloader,
> -	 * but leaves serial clocks on.
> -	 */
> -	omap_writel(0x3 << 29, MOD_CONF_CTRL_0);
> -#endif
> -
>  	/* USB_REQ_EN will be disabled later if necessary (usb_dc_ck) */
>  	reg = omap_readw(SOFT_REQ_REG) & (1 << 4);
>  	omap_writew(reg, SOFT_REQ_REG);

Hmm that should keep the serial clocks on. What other bit(s) need to
be on in MOD_CONF_CTRL_0 for you in addition to the serial bits?
 
> 2) By using the above hack, I could see the actual crash:
> 
> Uncompressing Linux... done, booting the kernel.
> [    0.000000] Initializing cgroup subsys cpu
> [    0.000000] Linux version 3.2.0-rc1-e3 (aaro@dell) (gcc version 4.6.1 (GCC) ) #9 PREEMPT Thu Nov 10 23:48:23 EET 2011
> [    0.000000] CPU: ARM925T [54029252] revision 2 (ARMv4T), cr=0000317f
> [    0.000000] CPU: VIVT data cache, VIVT instruction cache
> [    0.000000] Machine: Amstrad E3 (Delta)
> [    0.000000] bootconsole [earlycon0] enabled
> [    0.000000] Memory policy: ECC disabled, Data cache writethrough
> [    0.000000] OMAP1510
> [    0.000000]  revision 2 handled as 15xx id: bc058c9b93111a16
> [    0.000000] Clocks: ARM_SYSST: 0x1000 DPLL_CTL: 0x2cb3 ARM_CKCTL: 0x250e
> [    0.000000] ------------[ cut here ]------------
> [    0.000000] kernel BUG at arch/arm/plat-omap/sram.c:226!
> [    0.000000] Internal error: Oops - undefined instruction: 0 [#1] PREEMPT
> [    0.000000] Modules linked in:
> [    0.000000] CPU: 0    Not tainted  (3.2.0-rc1-e3 #9)
> [    0.000000] PC is at omap_sram_reprogram_clock+0x28/0x30
> [    0.000000] LR is at omap1_select_table_rate+0x88/0xb4
> [    0.000000] pc : [<c001b0c4>]    lr : [<c0019f54>]    psr: 600000d3
> [    0.000000] sp : c035bf10  ip : c035bf20  fp : c035bf1c
> [    0.000000] r10: c035bfd4  r9 : 54029252  r8 : c03f8120
> [    0.000000] r7 : c0362b50  r6 : 00b71b00  r5 : c03873cc  r4 : c0362b40
> [    0.000000] r3 : 00000000  r2 : c0362b40  r1 : 0000010a  r0 : 00002cb0
> [    0.000000] Flags: nZCv  IRQs off  FIQs off  Mode SVC_32  ISA ARM  Segment kernel
> [    0.000000] Control: 0000317f  Table: 10004000  DAC: 00000017
> [    0.000000] Process swapper (pid: 0, stack limit = 0xc035a270)
> [    0.000000] Stack: (0xc035bf10 to 0xc035c000)
> [    0.000000] bf00:                                     c035bf3c c035bf20 c0019f54 c001b0ac
> [    0.000000] bf20: 00001000 00002cb3 00000004 c035ed4c c035bf74 c035bf40 c033ea24 c0019edc
> [    0.000000] bf40: c02f526c 00000002 00000015 bc058c9b 93111a16 c035335c 02000000 c035ed4c
> [    0.000000] bf60: c035ed4c c03f8120 c035bf84 c035bf78 c00194c4 c033e8ec c035bfc4 c035bf88
> [    0.000000] bf80: c033bc24 c00194a0 c035bf90 c035bf98 00000000 00000000 00000000 00000000
> [    0.000000] bfa0: 00000001 00000000 c0354678 c035ece4 10004000 103532f4 c035bff4 c035bfc8
> [    0.000000] bfc0: c0338574 c033b598 00000000 00000000 00000000 c035467c 0000317d c035c03c
> [    0.000000] bfe0: c0354678 c035ece4 00000000 c035bff8 10008040 c0338508 00000000 00000000
> [    0.000000] Backtrace:
> [    0.000000] [<c001b09c>] (omap_sram_reprogram_clock+0x0/0x30) from [<c0019f54>] (omap1_select_table_rate+0x88/0xb4)
> [    0.000000] [<c0019ecc>] (omap1_select_table_rate+0x0/0xb4) from [<c033ea24>] (omap1_clk_init+0x148/0x334)
> [    0.000000]  r7:c035ed4c r6:00000004 r5:00002cb3 r4:00001000
> [    0.000000] [<c033e8dc>] (omap1_clk_init+0x0/0x334) from [<c00194c4>] (omap1_init_early+0x34/0x48)
> [    0.000000]  r8:c03f8120 r7:c035ed4c r6:c035ed4c r5:02000000 r4:c035335c
> [    0.000000] [<c0019490>] (omap1_init_early+0x0/0x48) from [<c033bc24>] (setup_arch+0x69c/0x79c)
> [    0.000000] [<c033b588>] (setup_arch+0x0/0x79c) from [<c0338574>] (start_kernel+0x7c/0x2f4)
> [    0.000000] [<c03384f8>] (start_kernel+0x0/0x2f4) from [<10008040>] (0x10008040)
> [    0.000000]  r7:c035ece4 r6:c0354678 r5:c035c03c r4:0000317d
> [    0.000000] Code: 0a000002 e1a0e00f e12fff13 e89da800 (e7f001f2)
> [    0.000000] ---[ end trace 1b75b31a2719ed1c ]---
> 
> The BUG_ON() in omap_sram_reprogram_clock() triggers, because
> it's called before omap_sram_init(). If I comment out the code in
> omap_sram_reprogram_clock(), the board boots up.

Ouch. I guess I have not seen that as omap1_defconfig has by default
CONFIG_OMAP_CLOCKS_SET_BY_BOOTLOADER=y. To fix the issue you're seeing
we should move some of omap1_clk_init into an arch_initcall that calls
omap1_select_table_rate later on, and then does propagate_rate(&ck_ref).
This way sram is configured when omap_sram_reprogram_clock gets called.

Regards,

Tony

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

* [PATCH] ARM: OMAP: Fix map_io for Amstrad E3
@ 2011-11-10 23:23               ` Tony Lindgren
  0 siblings, 0 replies; 30+ messages in thread
From: Tony Lindgren @ 2011-11-10 23:23 UTC (permalink / raw)
  To: linux-arm-kernel

* Aaro Koskinen <aaro.koskinen@iki.fi> [111110 13:31]:
> --- a/arch/arm/mach-omap1/clock_data.c
> +++ b/arch/arm/mach-omap1/clock_data.c
> @@ -774,14 +774,6 @@ int __init omap1_clk_init(void)
>  	int crystal_type = 0; /* Default 12 MHz */
>  	u32 reg, cpu_mask;
> 
> -#ifdef CONFIG_DEBUG_LL
> -	/*
> -	 * Resets some clocks that may be left on from bootloader,
> -	 * but leaves serial clocks on.
> -	 */
> -	omap_writel(0x3 << 29, MOD_CONF_CTRL_0);
> -#endif
> -
>  	/* USB_REQ_EN will be disabled later if necessary (usb_dc_ck) */
>  	reg = omap_readw(SOFT_REQ_REG) & (1 << 4);
>  	omap_writew(reg, SOFT_REQ_REG);

Hmm that should keep the serial clocks on. What other bit(s) need to
be on in MOD_CONF_CTRL_0 for you in addition to the serial bits?
 
> 2) By using the above hack, I could see the actual crash:
> 
> Uncompressing Linux... done, booting the kernel.
> [    0.000000] Initializing cgroup subsys cpu
> [    0.000000] Linux version 3.2.0-rc1-e3 (aaro at dell) (gcc version 4.6.1 (GCC) ) #9 PREEMPT Thu Nov 10 23:48:23 EET 2011
> [    0.000000] CPU: ARM925T [54029252] revision 2 (ARMv4T), cr=0000317f
> [    0.000000] CPU: VIVT data cache, VIVT instruction cache
> [    0.000000] Machine: Amstrad E3 (Delta)
> [    0.000000] bootconsole [earlycon0] enabled
> [    0.000000] Memory policy: ECC disabled, Data cache writethrough
> [    0.000000] OMAP1510
> [    0.000000]  revision 2 handled as 15xx id: bc058c9b93111a16
> [    0.000000] Clocks: ARM_SYSST: 0x1000 DPLL_CTL: 0x2cb3 ARM_CKCTL: 0x250e
> [    0.000000] ------------[ cut here ]------------
> [    0.000000] kernel BUG at arch/arm/plat-omap/sram.c:226!
> [    0.000000] Internal error: Oops - undefined instruction: 0 [#1] PREEMPT
> [    0.000000] Modules linked in:
> [    0.000000] CPU: 0    Not tainted  (3.2.0-rc1-e3 #9)
> [    0.000000] PC is at omap_sram_reprogram_clock+0x28/0x30
> [    0.000000] LR is at omap1_select_table_rate+0x88/0xb4
> [    0.000000] pc : [<c001b0c4>]    lr : [<c0019f54>]    psr: 600000d3
> [    0.000000] sp : c035bf10  ip : c035bf20  fp : c035bf1c
> [    0.000000] r10: c035bfd4  r9 : 54029252  r8 : c03f8120
> [    0.000000] r7 : c0362b50  r6 : 00b71b00  r5 : c03873cc  r4 : c0362b40
> [    0.000000] r3 : 00000000  r2 : c0362b40  r1 : 0000010a  r0 : 00002cb0
> [    0.000000] Flags: nZCv  IRQs off  FIQs off  Mode SVC_32  ISA ARM  Segment kernel
> [    0.000000] Control: 0000317f  Table: 10004000  DAC: 00000017
> [    0.000000] Process swapper (pid: 0, stack limit = 0xc035a270)
> [    0.000000] Stack: (0xc035bf10 to 0xc035c000)
> [    0.000000] bf00:                                     c035bf3c c035bf20 c0019f54 c001b0ac
> [    0.000000] bf20: 00001000 00002cb3 00000004 c035ed4c c035bf74 c035bf40 c033ea24 c0019edc
> [    0.000000] bf40: c02f526c 00000002 00000015 bc058c9b 93111a16 c035335c 02000000 c035ed4c
> [    0.000000] bf60: c035ed4c c03f8120 c035bf84 c035bf78 c00194c4 c033e8ec c035bfc4 c035bf88
> [    0.000000] bf80: c033bc24 c00194a0 c035bf90 c035bf98 00000000 00000000 00000000 00000000
> [    0.000000] bfa0: 00000001 00000000 c0354678 c035ece4 10004000 103532f4 c035bff4 c035bfc8
> [    0.000000] bfc0: c0338574 c033b598 00000000 00000000 00000000 c035467c 0000317d c035c03c
> [    0.000000] bfe0: c0354678 c035ece4 00000000 c035bff8 10008040 c0338508 00000000 00000000
> [    0.000000] Backtrace:
> [    0.000000] [<c001b09c>] (omap_sram_reprogram_clock+0x0/0x30) from [<c0019f54>] (omap1_select_table_rate+0x88/0xb4)
> [    0.000000] [<c0019ecc>] (omap1_select_table_rate+0x0/0xb4) from [<c033ea24>] (omap1_clk_init+0x148/0x334)
> [    0.000000]  r7:c035ed4c r6:00000004 r5:00002cb3 r4:00001000
> [    0.000000] [<c033e8dc>] (omap1_clk_init+0x0/0x334) from [<c00194c4>] (omap1_init_early+0x34/0x48)
> [    0.000000]  r8:c03f8120 r7:c035ed4c r6:c035ed4c r5:02000000 r4:c035335c
> [    0.000000] [<c0019490>] (omap1_init_early+0x0/0x48) from [<c033bc24>] (setup_arch+0x69c/0x79c)
> [    0.000000] [<c033b588>] (setup_arch+0x0/0x79c) from [<c0338574>] (start_kernel+0x7c/0x2f4)
> [    0.000000] [<c03384f8>] (start_kernel+0x0/0x2f4) from [<10008040>] (0x10008040)
> [    0.000000]  r7:c035ece4 r6:c0354678 r5:c035c03c r4:0000317d
> [    0.000000] Code: 0a000002 e1a0e00f e12fff13 e89da800 (e7f001f2)
> [    0.000000] ---[ end trace 1b75b31a2719ed1c ]---
> 
> The BUG_ON() in omap_sram_reprogram_clock() triggers, because
> it's called before omap_sram_init(). If I comment out the code in
> omap_sram_reprogram_clock(), the board boots up.

Ouch. I guess I have not seen that as omap1_defconfig has by default
CONFIG_OMAP_CLOCKS_SET_BY_BOOTLOADER=y. To fix the issue you're seeing
we should move some of omap1_clk_init into an arch_initcall that calls
omap1_select_table_rate later on, and then does propagate_rate(&ck_ref).
This way sram is configured when omap_sram_reprogram_clock gets called.

Regards,

Tony

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

* Re: [PATCH] ARM: OMAP: Fix map_io for Amstrad E3
  2011-11-10  0:28             ` Aaro Koskinen
@ 2011-11-10 23:33               ` Janusz Krzysztofik
  -1 siblings, 0 replies; 30+ messages in thread
From: Janusz Krzysztofik @ 2011-11-10 23:33 UTC (permalink / raw)
  To: Aaro Koskinen
  Cc: Tony Lindgren, Russell King - ARM Linux, linux-omap, linux-arm-kernel

On Thursday 10 of November 2011 at 01:28:58, Aaro Koskinen wrote:
> Hi,
> 
> On 10.11.2011, at 2.04, Tony Lindgren wrote:
> > * Aaro Koskinen <aaro.koskinen@iki.fi> [111109 15:25]:
> >> On 10.11.2011, at 1.39, Russell King - ARM Linux wrote:
> >>> On Wed, Nov 09, 2011 at 03:25:25PM -0800, Tony Lindgren wrote:
> >>>> Commit 7b88e62f5d219a86d81bdf4388012c97dc42e8f8 (ARM: OMAP1: Use
> >>>> generic
> >>>> map_io, init_early and init_irq) changed omap1 to use generic  
> >>>> map_io.
> >>>>
> >>>> Looks like I missed one board though. Fix this by adding a custom
> >>>> map_io for Amstrad E3.
> >>>>
> >>>> Reported-by: Aaro Koskinen <aaro.koskinen@iki.fi>
> >>>> Signed-off-by: Tony Lindgren <tony@atomide.com>
> >>>>
> >>>> ---
> >>>> Untested, does this help?
> >>>> --- a/arch/arm/mach-omap1/board-ams-delta.c
> >>>> +++ b/arch/arm/mach-omap1/board-ams-delta.c
> >>>> @@ -302,8 +302,6 @@ static void __init ams_delta_init(void)
> >>>> 	omap_cfg_reg(J19_1610_CAM_D6);
> >>>> 	omap_cfg_reg(J18_1610_CAM_D7);
> >>>>
> >>>> -	iotable_init(ams_delta_io_desc, ARRAY_SIZE(ams_delta_io_desc));
> >>>> -
> >>>
> >>> This is definitely wrong.  Using iotable_init() after map_io has
> >>> returned
> >>> has (and remains) a serious bug - doing so may _appear_ to work
> >>> but as it
> >>> doesn't obtain its memory from the standard kernel memory
> >>> allocators, it
> >>> will lead to duplicate usage of that memory.
> >>
> >> Also, the patch did not help. It still hangs like before.
> >
> > Hmm that patch is needed for sure but sounds like there's also
> > something else wrong.. Can you try to git bisect it?
> 
> Ok, I'll try bisecting tomorrow.

Hi Aaro,
Please let me know if you think I could help, or I'll wait for your
findings, to avoid duplicating efforts.

Thanks,
Janusz

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

* [PATCH] ARM: OMAP: Fix map_io for Amstrad E3
@ 2011-11-10 23:33               ` Janusz Krzysztofik
  0 siblings, 0 replies; 30+ messages in thread
From: Janusz Krzysztofik @ 2011-11-10 23:33 UTC (permalink / raw)
  To: linux-arm-kernel

On Thursday 10 of November 2011 at 01:28:58, Aaro Koskinen wrote:
> Hi,
> 
> On 10.11.2011, at 2.04, Tony Lindgren wrote:
> > * Aaro Koskinen <aaro.koskinen@iki.fi> [111109 15:25]:
> >> On 10.11.2011, at 1.39, Russell King - ARM Linux wrote:
> >>> On Wed, Nov 09, 2011 at 03:25:25PM -0800, Tony Lindgren wrote:
> >>>> Commit 7b88e62f5d219a86d81bdf4388012c97dc42e8f8 (ARM: OMAP1: Use
> >>>> generic
> >>>> map_io, init_early and init_irq) changed omap1 to use generic  
> >>>> map_io.
> >>>>
> >>>> Looks like I missed one board though. Fix this by adding a custom
> >>>> map_io for Amstrad E3.
> >>>>
> >>>> Reported-by: Aaro Koskinen <aaro.koskinen@iki.fi>
> >>>> Signed-off-by: Tony Lindgren <tony@atomide.com>
> >>>>
> >>>> ---
> >>>> Untested, does this help?
> >>>> --- a/arch/arm/mach-omap1/board-ams-delta.c
> >>>> +++ b/arch/arm/mach-omap1/board-ams-delta.c
> >>>> @@ -302,8 +302,6 @@ static void __init ams_delta_init(void)
> >>>> 	omap_cfg_reg(J19_1610_CAM_D6);
> >>>> 	omap_cfg_reg(J18_1610_CAM_D7);
> >>>>
> >>>> -	iotable_init(ams_delta_io_desc, ARRAY_SIZE(ams_delta_io_desc));
> >>>> -
> >>>
> >>> This is definitely wrong.  Using iotable_init() after map_io has
> >>> returned
> >>> has (and remains) a serious bug - doing so may _appear_ to work
> >>> but as it
> >>> doesn't obtain its memory from the standard kernel memory
> >>> allocators, it
> >>> will lead to duplicate usage of that memory.
> >>
> >> Also, the patch did not help. It still hangs like before.
> >
> > Hmm that patch is needed for sure but sounds like there's also
> > something else wrong.. Can you try to git bisect it?
> 
> Ok, I'll try bisecting tomorrow.

Hi Aaro,
Please let me know if you think I could help, or I'll wait for your
findings, to avoid duplicating efforts.

Thanks,
Janusz

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

* [PATCH] ARM: OMAP: Fix reprogramming of dpll1 rate
  2011-11-10 23:23               ` Tony Lindgren
@ 2011-11-11 19:16                 ` Tony Lindgren
  -1 siblings, 0 replies; 30+ messages in thread
From: Tony Lindgren @ 2011-11-11 19:16 UTC (permalink / raw)
  To: Aaro Koskinen; +Cc: Russell King - ARM Linux, linux-omap, linux-arm-kernel

Commit a66cb3454f220f49f900646ebdc76cb943319eb7 (ARM: OMAP: Map SRAM
later on with ioremap_exec()) moved the SRAM init to happen later
to remove a dependency to early SoC detection for map_io.

This broke booting on some boards not using Kconfig option for
OMAP_CLOCKS_SET_BY_BOOTLOADER as the dpll1 reprogramming would
cause the following error:

kernel BUG at arch/arm/plat-omap/sram.c:226!
Internal error: Oops - undefined instruction: 0 [#1] PREEMPT
Modules linked in:

CPU: 0    Not tainted  (3.2.0-rc1-e3 #9)
PC is at omap_sram_reprogram_clock+0x28/0x30
LR is at omap1_select_table_rate+0x88/0xb4
pc : [<c001b0c4>]    lr : [<c0019f54>]    psr: 600000d3
sp : c035bf10  ip : c035bf20  fp : c035bf1c
r10: c035bfd4  r9 : 54029252  r8 : c03f8120
r7 : c0362b50  r6 : 00b71b00  r5 : c03873cc  r4 : c0362b40
r3 : 00000000  r2 : c0362b40  r1 : 0000010a  r0 : 00002cb0
Flags: nZCv  IRQs off  FIQs off  Mode SVC_32  ISA ARM  Segment kernel
Control: 0000317f  Table: 10004000  DAC: 00000017
Process swapper (pid: 0, stack limit = 0xc035a270)
Stack: (0xc035bf10 to 0xc035c000)
bf00:                                     c035bf3c c035bf20 c0019f54 c001b0ac
bf20: 00001000 00002cb3 00000004 c035ed4c c035bf74 c035bf40 c033ea24 c0019edc
bf40: c02f526c 00000002 00000015 bc058c9b 93111a16 c035335c 02000000 c035ed4c
bf60: c035ed4c c03f8120 c035bf84 c035bf78 c00194c4 c033e8ec c035bfc4 c035bf88
bf80: c033bc24 c00194a0 c035bf90 c035bf98 00000000 00000000 00000000 00000000
bfa0: 00000001 00000000 c0354678 c035ece4 10004000 103532f4 c035bff4 c035bfc8
bfc0: c0338574 c033b598 00000000 00000000 00000000 c035467c 0000317d c035c03c
bfe0: c0354678 c035ece4 00000000 c035bff8 10008040 c0338508 00000000 00000000
Backtrace:
[<c001b09c>] (omap_sram_reprogram_clock+0x0/0x30) from [<c0019f54>] (omap1_select_table_rate+0x88/0xb4)
[<c0019ecc>] (omap1_select_table_rate+0x0/0xb4) from [<c033ea24>] (omap1_clk_init+0x148/0x334)
 r7:c035ed4c r6:00000004 r5:00002cb3 r4:00001000
[<c033e8dc>] (omap1_clk_init+0x0/0x334) from [<c00194c4>] (omap1_init_early+0x34/0x48)
 r8:c03f8120 r7:c035ed4c r6:c035ed4c r5:02000000 r4:c035335c
[<c0019490>] (omap1_init_early+0x0/0x48) from [<c033bc24>] (setup_arch+0x69c/0x79c)
[<c033b588>] (setup_arch+0x0/0x79c) from [<c0338574>] (start_kernel+0x7c/0x2f4)
[<c03384f8>] (start_kernel+0x0/0x2f4) from [<10008040>] (0x10008040)
 r7:c035ece4 r6:c0354678 r5:c035c03c r4:0000317d
Code: 0a000002 e1a0e00f e12fff13 e89da800 (e7f001f2)

Fix this by adding omap1_clk_late_init() that only reprograms dpll1
if the bootloader rate is less than 60MHz. This also allows removing
of the OMAP_CLOCKS_SET_BY_BOOTLOADER option.

Reported-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Tony Lindgren <tony@atomide.com>

---
This seems to work when forced on OSK5912 at least. Moving the dpll1
reprogramming to happen later should not mess up drivers as it's still
before driver inits. Also the system timer should not change as the
source is ck_ref.
---
diff --git a/arch/arm/configs/omap1_defconfig b/arch/arm/configs/omap1_defconfig
index 7b63462..a7e7775 100644
--- a/arch/arm/configs/omap1_defconfig
+++ b/arch/arm/configs/omap1_defconfig
@@ -48,7 +48,6 @@ CONFIG_MACH_SX1=y
 CONFIG_MACH_NOKIA770=y
 CONFIG_MACH_AMS_DELTA=y
 CONFIG_MACH_OMAP_GENERIC=y
-CONFIG_OMAP_CLOCKS_SET_BY_BOOTLOADER=y
 CONFIG_OMAP_ARM_216MHZ=y
 CONFIG_OMAP_ARM_195MHZ=y
 CONFIG_OMAP_ARM_192MHZ=y
diff --git a/arch/arm/mach-omap1/Kconfig b/arch/arm/mach-omap1/Kconfig
index e0a0281..73f287d 100644
--- a/arch/arm/mach-omap1/Kconfig
+++ b/arch/arm/mach-omap1/Kconfig
@@ -171,14 +171,6 @@ config MACH_OMAP_GENERIC
 comment "OMAP CPU Speed"
 	depends on ARCH_OMAP1
 
-config OMAP_CLOCKS_SET_BY_BOOTLOADER
-	bool "OMAP clocks set by bootloader"
-	depends on ARCH_OMAP1
-	help
-	  Enable this option to prevent the kernel from overriding the clock
-	  frequencies programmed by bootloader for MPU, DSP, MMUs, TC,
-	  internal LCD controller and MPU peripherals.
-
 config OMAP_ARM_216MHZ
 	bool "OMAP ARM 216 MHz CPU (1710 only)"
         depends on ARCH_OMAP1 && ARCH_OMAP16XX
diff --git a/arch/arm/mach-omap1/clock.h b/arch/arm/mach-omap1/clock.h
index eaf09ef..16b1423 100644
--- a/arch/arm/mach-omap1/clock.h
+++ b/arch/arm/mach-omap1/clock.h
@@ -17,7 +17,8 @@
 
 #include <plat/clock.h>
 
-extern int __init omap1_clk_init(void);
+int omap1_clk_init(void);
+void omap1_clk_late_init(void);
 extern int omap1_clk_enable(struct clk *clk);
 extern void omap1_clk_disable(struct clk *clk);
 extern long omap1_clk_round_rate(struct clk *clk, unsigned long rate);
diff --git a/arch/arm/mach-omap1/clock_data.c b/arch/arm/mach-omap1/clock_data.c
index 92400b9..1297bb5 100644
--- a/arch/arm/mach-omap1/clock_data.c
+++ b/arch/arm/mach-omap1/clock_data.c
@@ -767,6 +767,15 @@ static struct clk_functions omap1_clk_functions = {
 	.clk_disable_unused	= omap1_clk_disable_unused,
 };
 
+static void __init omap1_show_rates(void)
+{
+	pr_notice("Clocking rate (xtal/DPLL1/MPU): "
+			"%ld.%01ld/%ld.%01ld/%ld.%01ld MHz\n",
+		ck_ref.rate / 1000000, (ck_ref.rate / 100000) % 10,
+		ck_dpll1.rate / 1000000, (ck_dpll1.rate / 100000) % 10,
+		arm_ck.rate / 1000000, (arm_ck.rate / 100000) % 10);
+}
+
 int __init omap1_clk_init(void)
 {
 	struct omap_clk *c;
@@ -835,9 +844,12 @@ int __init omap1_clk_init(void)
 	/* We want to be in syncronous scalable mode */
 	omap_writew(0x1000, ARM_SYSST);
 
-#ifdef CONFIG_OMAP_CLOCKS_SET_BY_BOOTLOADER
-	/* Use values set by bootloader. Determine PLL rate and recalculate
-	 * dependent clocks as if kernel had changed PLL or divisors.
+
+	/*
+	 * Initially use the values set by bootloader. Determine PLL rate and
+	 * recalculate dependent clocks as if kernel had changed PLL or
+	 * divisors. See also omap1_clk_late_init() that can reprogram dpll1
+	 * after the SRAM is initialized.
 	 */
 	{
 		unsigned pll_ctl_val = omap_readw(DPLL_CTL);
@@ -862,25 +874,10 @@ int __init omap1_clk_init(void)
 			}
 		}
 	}
-#else
-	/* Find the highest supported frequency and enable it */
-	if (omap1_select_table_rate(&virtual_ck_mpu, ~0)) {
-		printk(KERN_ERR "System frequencies not set. Check your config.\n");
-		/* Guess sane values (60MHz) */
-		omap_writew(0x2290, DPLL_CTL);
-		omap_writew(cpu_is_omap7xx() ? 0x3005 : 0x1005, ARM_CKCTL);
-		ck_dpll1.rate = 60000000;
-	}
-#endif
 	propagate_rate(&ck_dpll1);
 	/* Cache rates for clocks connected to ck_ref (not dpll1) */
 	propagate_rate(&ck_ref);
-	printk(KERN_INFO "Clocking rate (xtal/DPLL1/MPU): "
-		"%ld.%01ld/%ld.%01ld/%ld.%01ld MHz\n",
-	       ck_ref.rate / 1000000, (ck_ref.rate / 100000) % 10,
-	       ck_dpll1.rate / 1000000, (ck_dpll1.rate / 100000) % 10,
-	       arm_ck.rate / 1000000, (arm_ck.rate / 100000) % 10);
-
+	omap1_show_rates();
 	if (machine_is_omap_perseus2() || machine_is_omap_fsample()) {
 		/* Select slicer output as OMAP input clock */
 		omap_writew(omap_readw(OMAP7XX_PCC_UPLD_CTRL) & ~0x1,
@@ -925,3 +922,21 @@ int __init omap1_clk_init(void)
 
 	return 0;
 }
+
+#define OMAP1_DPLL1_SANE_VALUE	60000000
+
+void __init omap1_clk_late_init(void)
+{
+	if (ck_dpll1.rate >= OMAP1_DPLL1_SANE_VALUE)
+		return;
+
+	/* Find the highest supported frequency and enable it */
+	if (omap1_select_table_rate(&virtual_ck_mpu, ~0)) {
+		pr_err("System frequencies not set, using default. Check your config.\n");
+		omap_writew(0x2290, DPLL_CTL);
+		omap_writew(cpu_is_omap7xx() ? 0x3005 : 0x1005, ARM_CKCTL);
+		ck_dpll1.rate = OMAP1_DPLL1_SANE_VALUE;
+	}
+	propagate_rate(&ck_dpll1);
+	omap1_show_rates();
+}
diff --git a/arch/arm/mach-omap1/devices.c b/arch/arm/mach-omap1/devices.c
index 48ef988..475cb2f 100644
--- a/arch/arm/mach-omap1/devices.c
+++ b/arch/arm/mach-omap1/devices.c
@@ -30,6 +30,8 @@
 #include <plat/omap7xx.h>
 #include <plat/mcbsp.h>
 
+#include "clock.h"
+
 /*-------------------------------------------------------------------------*/
 
 #if defined(CONFIG_RTC_DRV_OMAP) || defined(CONFIG_RTC_DRV_OMAP_MODULE)
@@ -293,6 +295,7 @@ static int __init omap1_init_devices(void)
 		return -ENODEV;
 
 	omap_sram_init();
+	omap1_clk_late_init();
 
 	/* please keep these calls, and their implementations above,
 	 * in alphabetical order so they're easier to sort through.

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

* [PATCH] ARM: OMAP: Fix reprogramming of dpll1 rate
@ 2011-11-11 19:16                 ` Tony Lindgren
  0 siblings, 0 replies; 30+ messages in thread
From: Tony Lindgren @ 2011-11-11 19:16 UTC (permalink / raw)
  To: linux-arm-kernel

Commit a66cb3454f220f49f900646ebdc76cb943319eb7 (ARM: OMAP: Map SRAM
later on with ioremap_exec()) moved the SRAM init to happen later
to remove a dependency to early SoC detection for map_io.

This broke booting on some boards not using Kconfig option for
OMAP_CLOCKS_SET_BY_BOOTLOADER as the dpll1 reprogramming would
cause the following error:

kernel BUG at arch/arm/plat-omap/sram.c:226!
Internal error: Oops - undefined instruction: 0 [#1] PREEMPT
Modules linked in:

CPU: 0    Not tainted  (3.2.0-rc1-e3 #9)
PC is at omap_sram_reprogram_clock+0x28/0x30
LR is at omap1_select_table_rate+0x88/0xb4
pc : [<c001b0c4>]    lr : [<c0019f54>]    psr: 600000d3
sp : c035bf10  ip : c035bf20  fp : c035bf1c
r10: c035bfd4  r9 : 54029252  r8 : c03f8120
r7 : c0362b50  r6 : 00b71b00  r5 : c03873cc  r4 : c0362b40
r3 : 00000000  r2 : c0362b40  r1 : 0000010a  r0 : 00002cb0
Flags: nZCv  IRQs off  FIQs off  Mode SVC_32  ISA ARM  Segment kernel
Control: 0000317f  Table: 10004000  DAC: 00000017
Process swapper (pid: 0, stack limit = 0xc035a270)
Stack: (0xc035bf10 to 0xc035c000)
bf00:                                     c035bf3c c035bf20 c0019f54 c001b0ac
bf20: 00001000 00002cb3 00000004 c035ed4c c035bf74 c035bf40 c033ea24 c0019edc
bf40: c02f526c 00000002 00000015 bc058c9b 93111a16 c035335c 02000000 c035ed4c
bf60: c035ed4c c03f8120 c035bf84 c035bf78 c00194c4 c033e8ec c035bfc4 c035bf88
bf80: c033bc24 c00194a0 c035bf90 c035bf98 00000000 00000000 00000000 00000000
bfa0: 00000001 00000000 c0354678 c035ece4 10004000 103532f4 c035bff4 c035bfc8
bfc0: c0338574 c033b598 00000000 00000000 00000000 c035467c 0000317d c035c03c
bfe0: c0354678 c035ece4 00000000 c035bff8 10008040 c0338508 00000000 00000000
Backtrace:
[<c001b09c>] (omap_sram_reprogram_clock+0x0/0x30) from [<c0019f54>] (omap1_select_table_rate+0x88/0xb4)
[<c0019ecc>] (omap1_select_table_rate+0x0/0xb4) from [<c033ea24>] (omap1_clk_init+0x148/0x334)
 r7:c035ed4c r6:00000004 r5:00002cb3 r4:00001000
[<c033e8dc>] (omap1_clk_init+0x0/0x334) from [<c00194c4>] (omap1_init_early+0x34/0x48)
 r8:c03f8120 r7:c035ed4c r6:c035ed4c r5:02000000 r4:c035335c
[<c0019490>] (omap1_init_early+0x0/0x48) from [<c033bc24>] (setup_arch+0x69c/0x79c)
[<c033b588>] (setup_arch+0x0/0x79c) from [<c0338574>] (start_kernel+0x7c/0x2f4)
[<c03384f8>] (start_kernel+0x0/0x2f4) from [<10008040>] (0x10008040)
 r7:c035ece4 r6:c0354678 r5:c035c03c r4:0000317d
Code: 0a000002 e1a0e00f e12fff13 e89da800 (e7f001f2)

Fix this by adding omap1_clk_late_init() that only reprograms dpll1
if the bootloader rate is less than 60MHz. This also allows removing
of the OMAP_CLOCKS_SET_BY_BOOTLOADER option.

Reported-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Tony Lindgren <tony@atomide.com>

---
This seems to work when forced on OSK5912 at least. Moving the dpll1
reprogramming to happen later should not mess up drivers as it's still
before driver inits. Also the system timer should not change as the
source is ck_ref.
---
diff --git a/arch/arm/configs/omap1_defconfig b/arch/arm/configs/omap1_defconfig
index 7b63462..a7e7775 100644
--- a/arch/arm/configs/omap1_defconfig
+++ b/arch/arm/configs/omap1_defconfig
@@ -48,7 +48,6 @@ CONFIG_MACH_SX1=y
 CONFIG_MACH_NOKIA770=y
 CONFIG_MACH_AMS_DELTA=y
 CONFIG_MACH_OMAP_GENERIC=y
-CONFIG_OMAP_CLOCKS_SET_BY_BOOTLOADER=y
 CONFIG_OMAP_ARM_216MHZ=y
 CONFIG_OMAP_ARM_195MHZ=y
 CONFIG_OMAP_ARM_192MHZ=y
diff --git a/arch/arm/mach-omap1/Kconfig b/arch/arm/mach-omap1/Kconfig
index e0a0281..73f287d 100644
--- a/arch/arm/mach-omap1/Kconfig
+++ b/arch/arm/mach-omap1/Kconfig
@@ -171,14 +171,6 @@ config MACH_OMAP_GENERIC
 comment "OMAP CPU Speed"
 	depends on ARCH_OMAP1
 
-config OMAP_CLOCKS_SET_BY_BOOTLOADER
-	bool "OMAP clocks set by bootloader"
-	depends on ARCH_OMAP1
-	help
-	  Enable this option to prevent the kernel from overriding the clock
-	  frequencies programmed by bootloader for MPU, DSP, MMUs, TC,
-	  internal LCD controller and MPU peripherals.
-
 config OMAP_ARM_216MHZ
 	bool "OMAP ARM 216 MHz CPU (1710 only)"
         depends on ARCH_OMAP1 && ARCH_OMAP16XX
diff --git a/arch/arm/mach-omap1/clock.h b/arch/arm/mach-omap1/clock.h
index eaf09ef..16b1423 100644
--- a/arch/arm/mach-omap1/clock.h
+++ b/arch/arm/mach-omap1/clock.h
@@ -17,7 +17,8 @@
 
 #include <plat/clock.h>
 
-extern int __init omap1_clk_init(void);
+int omap1_clk_init(void);
+void omap1_clk_late_init(void);
 extern int omap1_clk_enable(struct clk *clk);
 extern void omap1_clk_disable(struct clk *clk);
 extern long omap1_clk_round_rate(struct clk *clk, unsigned long rate);
diff --git a/arch/arm/mach-omap1/clock_data.c b/arch/arm/mach-omap1/clock_data.c
index 92400b9..1297bb5 100644
--- a/arch/arm/mach-omap1/clock_data.c
+++ b/arch/arm/mach-omap1/clock_data.c
@@ -767,6 +767,15 @@ static struct clk_functions omap1_clk_functions = {
 	.clk_disable_unused	= omap1_clk_disable_unused,
 };
 
+static void __init omap1_show_rates(void)
+{
+	pr_notice("Clocking rate (xtal/DPLL1/MPU): "
+			"%ld.%01ld/%ld.%01ld/%ld.%01ld MHz\n",
+		ck_ref.rate / 1000000, (ck_ref.rate / 100000) % 10,
+		ck_dpll1.rate / 1000000, (ck_dpll1.rate / 100000) % 10,
+		arm_ck.rate / 1000000, (arm_ck.rate / 100000) % 10);
+}
+
 int __init omap1_clk_init(void)
 {
 	struct omap_clk *c;
@@ -835,9 +844,12 @@ int __init omap1_clk_init(void)
 	/* We want to be in syncronous scalable mode */
 	omap_writew(0x1000, ARM_SYSST);
 
-#ifdef CONFIG_OMAP_CLOCKS_SET_BY_BOOTLOADER
-	/* Use values set by bootloader. Determine PLL rate and recalculate
-	 * dependent clocks as if kernel had changed PLL or divisors.
+
+	/*
+	 * Initially use the values set by bootloader. Determine PLL rate and
+	 * recalculate dependent clocks as if kernel had changed PLL or
+	 * divisors. See also omap1_clk_late_init() that can reprogram dpll1
+	 * after the SRAM is initialized.
 	 */
 	{
 		unsigned pll_ctl_val = omap_readw(DPLL_CTL);
@@ -862,25 +874,10 @@ int __init omap1_clk_init(void)
 			}
 		}
 	}
-#else
-	/* Find the highest supported frequency and enable it */
-	if (omap1_select_table_rate(&virtual_ck_mpu, ~0)) {
-		printk(KERN_ERR "System frequencies not set. Check your config.\n");
-		/* Guess sane values (60MHz) */
-		omap_writew(0x2290, DPLL_CTL);
-		omap_writew(cpu_is_omap7xx() ? 0x3005 : 0x1005, ARM_CKCTL);
-		ck_dpll1.rate = 60000000;
-	}
-#endif
 	propagate_rate(&ck_dpll1);
 	/* Cache rates for clocks connected to ck_ref (not dpll1) */
 	propagate_rate(&ck_ref);
-	printk(KERN_INFO "Clocking rate (xtal/DPLL1/MPU): "
-		"%ld.%01ld/%ld.%01ld/%ld.%01ld MHz\n",
-	       ck_ref.rate / 1000000, (ck_ref.rate / 100000) % 10,
-	       ck_dpll1.rate / 1000000, (ck_dpll1.rate / 100000) % 10,
-	       arm_ck.rate / 1000000, (arm_ck.rate / 100000) % 10);
-
+	omap1_show_rates();
 	if (machine_is_omap_perseus2() || machine_is_omap_fsample()) {
 		/* Select slicer output as OMAP input clock */
 		omap_writew(omap_readw(OMAP7XX_PCC_UPLD_CTRL) & ~0x1,
@@ -925,3 +922,21 @@ int __init omap1_clk_init(void)
 
 	return 0;
 }
+
+#define OMAP1_DPLL1_SANE_VALUE	60000000
+
+void __init omap1_clk_late_init(void)
+{
+	if (ck_dpll1.rate >= OMAP1_DPLL1_SANE_VALUE)
+		return;
+
+	/* Find the highest supported frequency and enable it */
+	if (omap1_select_table_rate(&virtual_ck_mpu, ~0)) {
+		pr_err("System frequencies not set, using default. Check your config.\n");
+		omap_writew(0x2290, DPLL_CTL);
+		omap_writew(cpu_is_omap7xx() ? 0x3005 : 0x1005, ARM_CKCTL);
+		ck_dpll1.rate = OMAP1_DPLL1_SANE_VALUE;
+	}
+	propagate_rate(&ck_dpll1);
+	omap1_show_rates();
+}
diff --git a/arch/arm/mach-omap1/devices.c b/arch/arm/mach-omap1/devices.c
index 48ef988..475cb2f 100644
--- a/arch/arm/mach-omap1/devices.c
+++ b/arch/arm/mach-omap1/devices.c
@@ -30,6 +30,8 @@
 #include <plat/omap7xx.h>
 #include <plat/mcbsp.h>
 
+#include "clock.h"
+
 /*-------------------------------------------------------------------------*/
 
 #if defined(CONFIG_RTC_DRV_OMAP) || defined(CONFIG_RTC_DRV_OMAP_MODULE)
@@ -293,6 +295,7 @@ static int __init omap1_init_devices(void)
 		return -ENODEV;
 
 	omap_sram_init();
+	omap1_clk_late_init();
 
 	/* please keep these calls, and their implementations above,
 	 * in alphabetical order so they're easier to sort through.

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

* Re: [PATCH] ARM: OMAP: Fix reprogramming of dpll1 rate
  2011-11-11 19:16                 ` Tony Lindgren
@ 2011-11-11 23:22                   ` Aaro Koskinen
  -1 siblings, 0 replies; 30+ messages in thread
From: Aaro Koskinen @ 2011-11-11 23:22 UTC (permalink / raw)
  To: Tony Lindgren; +Cc: Russell King - ARM Linux, linux-omap, linux-arm-kernel

Hi,

On 11.11.2011, at 21.16, Tony Lindgren wrote:
> Commit a66cb3454f220f49f900646ebdc76cb943319eb7 (ARM: OMAP: Map SRAM
> later on with ioremap_exec()) moved the SRAM init to happen later
> to remove a dependency to early SoC detection for map_io.
>
> This broke booting on some boards not using Kconfig option for
> OMAP_CLOCKS_SET_BY_BOOTLOADER as the dpll1 reprogramming would
> cause the following error:
>
> kernel BUG at arch/arm/plat-omap/sram.c:226!
> Internal error: Oops - undefined instruction: 0 [#1] PREEMPT
> Modules linked in:
>
> CPU: 0    Not tainted  (3.2.0-rc1-e3 #9)
> PC is at omap_sram_reprogram_clock+0x28/0x30
> LR is at omap1_select_table_rate+0x88/0xb4
> pc : [<c001b0c4>]    lr : [<c0019f54>]    psr: 600000d3
> sp : c035bf10  ip : c035bf20  fp : c035bf1c
> r10: c035bfd4  r9 : 54029252  r8 : c03f8120
> r7 : c0362b50  r6 : 00b71b00  r5 : c03873cc  r4 : c0362b40
> r3 : 00000000  r2 : c0362b40  r1 : 0000010a  r0 : 00002cb0
> Flags: nZCv  IRQs off  FIQs off  Mode SVC_32  ISA ARM  Segment kernel
> Control: 0000317f  Table: 10004000  DAC: 00000017
> Process swapper (pid: 0, stack limit = 0xc035a270)
> Stack: (0xc035bf10 to 0xc035c000)
> bf00:                                     c035bf3c c035bf20  
> c0019f54 c001b0ac
> bf20: 00001000 00002cb3 00000004 c035ed4c c035bf74 c035bf40  
> c033ea24 c0019edc
> bf40: c02f526c 00000002 00000015 bc058c9b 93111a16 c035335c  
> 02000000 c035ed4c
> bf60: c035ed4c c03f8120 c035bf84 c035bf78 c00194c4 c033e8ec  
> c035bfc4 c035bf88
> bf80: c033bc24 c00194a0 c035bf90 c035bf98 00000000 00000000  
> 00000000 00000000
> bfa0: 00000001 00000000 c0354678 c035ece4 10004000 103532f4  
> c035bff4 c035bfc8
> bfc0: c0338574 c033b598 00000000 00000000 00000000 c035467c  
> 0000317d c035c03c
> bfe0: c0354678 c035ece4 00000000 c035bff8 10008040 c0338508  
> 00000000 00000000
> Backtrace:
> [<c001b09c>] (omap_sram_reprogram_clock+0x0/0x30) from [<c0019f54>]  
> (omap1_select_table_rate+0x88/0xb4)
> [<c0019ecc>] (omap1_select_table_rate+0x0/0xb4) from [<c033ea24>]  
> (omap1_clk_init+0x148/0x334)
>  r7:c035ed4c r6:00000004 r5:00002cb3 r4:00001000
> [<c033e8dc>] (omap1_clk_init+0x0/0x334) from [<c00194c4>]  
> (omap1_init_early+0x34/0x48)
>  r8:c03f8120 r7:c035ed4c r6:c035ed4c r5:02000000 r4:c035335c
> [<c0019490>] (omap1_init_early+0x0/0x48) from [<c033bc24>]  
> (setup_arch+0x69c/0x79c)
> [<c033b588>] (setup_arch+0x0/0x79c) from [<c0338574>] (start_kernel 
> +0x7c/0x2f4)
> [<c03384f8>] (start_kernel+0x0/0x2f4) from [<10008040>] (0x10008040)
>  r7:c035ece4 r6:c0354678 r5:c035c03c r4:0000317d
> Code: 0a000002 e1a0e00f e12fff13 e89da800 (e7f001f2)
>
> Fix this by adding omap1_clk_late_init() that only reprograms dpll1
> if the bootloader rate is less than 60MHz. This also allows removing
> of the OMAP_CLOCKS_SET_BY_BOOTLOADER option.
>
> Reported-by: Aaro Koskinen <aaro.koskinen@iki.fi>
> Signed-off-by: Tony Lindgren <tony@atomide.com>
>
> ---
> This seems to work when forced on OSK5912 at least. Moving the dpll1
> reprogramming to happen later should not mess up drivers as it's still
> before driver inits. Also the system timer should not change as the
> source is ck_ref.

Cheers mate, this fixes the 3.2-rc1 boot issue on Amstrad E3.

Tested-by: Aaro Koskinen <aaro.koskinen@iki.fi>

A.

> ---
> diff --git a/arch/arm/configs/omap1_defconfig b/arch/arm/configs/ 
> omap1_defconfig
> index 7b63462..a7e7775 100644
> --- a/arch/arm/configs/omap1_defconfig
> +++ b/arch/arm/configs/omap1_defconfig
> @@ -48,7 +48,6 @@ CONFIG_MACH_SX1=y
>  CONFIG_MACH_NOKIA770=y
>  CONFIG_MACH_AMS_DELTA=y
>  CONFIG_MACH_OMAP_GENERIC=y
> -CONFIG_OMAP_CLOCKS_SET_BY_BOOTLOADER=y
>  CONFIG_OMAP_ARM_216MHZ=y
>  CONFIG_OMAP_ARM_195MHZ=y
>  CONFIG_OMAP_ARM_192MHZ=y
> diff --git a/arch/arm/mach-omap1/Kconfig b/arch/arm/mach-omap1/Kconfig
> index e0a0281..73f287d 100644
> --- a/arch/arm/mach-omap1/Kconfig
> +++ b/arch/arm/mach-omap1/Kconfig
> @@ -171,14 +171,6 @@ config MACH_OMAP_GENERIC
>  comment "OMAP CPU Speed"
>  	depends on ARCH_OMAP1
>
> -config OMAP_CLOCKS_SET_BY_BOOTLOADER
> -	bool "OMAP clocks set by bootloader"
> -	depends on ARCH_OMAP1
> -	help
> -	  Enable this option to prevent the kernel from overriding the clock
> -	  frequencies programmed by bootloader for MPU, DSP, MMUs, TC,
> -	  internal LCD controller and MPU peripherals.
> -
>  config OMAP_ARM_216MHZ
>  	bool "OMAP ARM 216 MHz CPU (1710 only)"
>          depends on ARCH_OMAP1 && ARCH_OMAP16XX
> diff --git a/arch/arm/mach-omap1/clock.h b/arch/arm/mach-omap1/clock.h
> index eaf09ef..16b1423 100644
> --- a/arch/arm/mach-omap1/clock.h
> +++ b/arch/arm/mach-omap1/clock.h
> @@ -17,7 +17,8 @@
>
>  #include <plat/clock.h>
>
> -extern int __init omap1_clk_init(void);
> +int omap1_clk_init(void);
> +void omap1_clk_late_init(void);
>  extern int omap1_clk_enable(struct clk *clk);
>  extern void omap1_clk_disable(struct clk *clk);
>  extern long omap1_clk_round_rate(struct clk *clk, unsigned long  
> rate);
> diff --git a/arch/arm/mach-omap1/clock_data.c b/arch/arm/mach-omap1/ 
> clock_data.c
> index 92400b9..1297bb5 100644
> --- a/arch/arm/mach-omap1/clock_data.c
> +++ b/arch/arm/mach-omap1/clock_data.c
> @@ -767,6 +767,15 @@ static struct clk_functions  
> omap1_clk_functions = {
>  	.clk_disable_unused	= omap1_clk_disable_unused,
>  };
>
> +static void __init omap1_show_rates(void)
> +{
> +	pr_notice("Clocking rate (xtal/DPLL1/MPU): "
> +			"%ld.%01ld/%ld.%01ld/%ld.%01ld MHz\n",
> +		ck_ref.rate / 1000000, (ck_ref.rate / 100000) % 10,
> +		ck_dpll1.rate / 1000000, (ck_dpll1.rate / 100000) % 10,
> +		arm_ck.rate / 1000000, (arm_ck.rate / 100000) % 10);
> +}
> +
>  int __init omap1_clk_init(void)
>  {
>  	struct omap_clk *c;
> @@ -835,9 +844,12 @@ int __init omap1_clk_init(void)
>  	/* We want to be in syncronous scalable mode */
>  	omap_writew(0x1000, ARM_SYSST);
>
> -#ifdef CONFIG_OMAP_CLOCKS_SET_BY_BOOTLOADER
> -	/* Use values set by bootloader. Determine PLL rate and recalculate
> -	 * dependent clocks as if kernel had changed PLL or divisors.
> +
> +	/*
> +	 * Initially use the values set by bootloader. Determine PLL rate  
> and
> +	 * recalculate dependent clocks as if kernel had changed PLL or
> +	 * divisors. See also omap1_clk_late_init() that can reprogram dpll1
> +	 * after the SRAM is initialized.
>  	 */
>  	{
>  		unsigned pll_ctl_val = omap_readw(DPLL_CTL);
> @@ -862,25 +874,10 @@ int __init omap1_clk_init(void)
>  			}
>  		}
>  	}
> -#else
> -	/* Find the highest supported frequency and enable it */
> -	if (omap1_select_table_rate(&virtual_ck_mpu, ~0)) {
> -		printk(KERN_ERR "System frequencies not set. Check your config. 
> \n");
> -		/* Guess sane values (60MHz) */
> -		omap_writew(0x2290, DPLL_CTL);
> -		omap_writew(cpu_is_omap7xx() ? 0x3005 : 0x1005, ARM_CKCTL);
> -		ck_dpll1.rate = 60000000;
> -	}
> -#endif
>  	propagate_rate(&ck_dpll1);
>  	/* Cache rates for clocks connected to ck_ref (not dpll1) */
>  	propagate_rate(&ck_ref);
> -	printk(KERN_INFO "Clocking rate (xtal/DPLL1/MPU): "
> -		"%ld.%01ld/%ld.%01ld/%ld.%01ld MHz\n",
> -	       ck_ref.rate / 1000000, (ck_ref.rate / 100000) % 10,
> -	       ck_dpll1.rate / 1000000, (ck_dpll1.rate / 100000) % 10,
> -	       arm_ck.rate / 1000000, (arm_ck.rate / 100000) % 10);
> -
> +	omap1_show_rates();
>  	if (machine_is_omap_perseus2() || machine_is_omap_fsample()) {
>  		/* Select slicer output as OMAP input clock */
>  		omap_writew(omap_readw(OMAP7XX_PCC_UPLD_CTRL) & ~0x1,
> @@ -925,3 +922,21 @@ int __init omap1_clk_init(void)
>
>  	return 0;
>  }
> +
> +#define OMAP1_DPLL1_SANE_VALUE	60000000
> +
> +void __init omap1_clk_late_init(void)
> +{
> +	if (ck_dpll1.rate >= OMAP1_DPLL1_SANE_VALUE)
> +		return;
> +
> +	/* Find the highest supported frequency and enable it */
> +	if (omap1_select_table_rate(&virtual_ck_mpu, ~0)) {
> +		pr_err("System frequencies not set, using default. Check your  
> config.\n");
> +		omap_writew(0x2290, DPLL_CTL);
> +		omap_writew(cpu_is_omap7xx() ? 0x3005 : 0x1005, ARM_CKCTL);
> +		ck_dpll1.rate = OMAP1_DPLL1_SANE_VALUE;
> +	}
> +	propagate_rate(&ck_dpll1);
> +	omap1_show_rates();
> +}
> diff --git a/arch/arm/mach-omap1/devices.c b/arch/arm/mach-omap1/ 
> devices.c
> index 48ef988..475cb2f 100644
> --- a/arch/arm/mach-omap1/devices.c
> +++ b/arch/arm/mach-omap1/devices.c
> @@ -30,6 +30,8 @@
>  #include <plat/omap7xx.h>
>  #include <plat/mcbsp.h>
>
> +#include "clock.h"
> +
>  / 
> *--------------------------------------------------------------------- 
> ----*/
>
>  #if defined(CONFIG_RTC_DRV_OMAP) || defined 
> (CONFIG_RTC_DRV_OMAP_MODULE)
> @@ -293,6 +295,7 @@ static int __init omap1_init_devices(void)
>  		return -ENODEV;
>
>  	omap_sram_init();
> +	omap1_clk_late_init();
>
>  	/* please keep these calls, and their implementations above,
>  	 * in alphabetical order so they're easier to sort through.


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

* [PATCH] ARM: OMAP: Fix reprogramming of dpll1 rate
@ 2011-11-11 23:22                   ` Aaro Koskinen
  0 siblings, 0 replies; 30+ messages in thread
From: Aaro Koskinen @ 2011-11-11 23:22 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

On 11.11.2011, at 21.16, Tony Lindgren wrote:
> Commit a66cb3454f220f49f900646ebdc76cb943319eb7 (ARM: OMAP: Map SRAM
> later on with ioremap_exec()) moved the SRAM init to happen later
> to remove a dependency to early SoC detection for map_io.
>
> This broke booting on some boards not using Kconfig option for
> OMAP_CLOCKS_SET_BY_BOOTLOADER as the dpll1 reprogramming would
> cause the following error:
>
> kernel BUG at arch/arm/plat-omap/sram.c:226!
> Internal error: Oops - undefined instruction: 0 [#1] PREEMPT
> Modules linked in:
>
> CPU: 0    Not tainted  (3.2.0-rc1-e3 #9)
> PC is at omap_sram_reprogram_clock+0x28/0x30
> LR is at omap1_select_table_rate+0x88/0xb4
> pc : [<c001b0c4>]    lr : [<c0019f54>]    psr: 600000d3
> sp : c035bf10  ip : c035bf20  fp : c035bf1c
> r10: c035bfd4  r9 : 54029252  r8 : c03f8120
> r7 : c0362b50  r6 : 00b71b00  r5 : c03873cc  r4 : c0362b40
> r3 : 00000000  r2 : c0362b40  r1 : 0000010a  r0 : 00002cb0
> Flags: nZCv  IRQs off  FIQs off  Mode SVC_32  ISA ARM  Segment kernel
> Control: 0000317f  Table: 10004000  DAC: 00000017
> Process swapper (pid: 0, stack limit = 0xc035a270)
> Stack: (0xc035bf10 to 0xc035c000)
> bf00:                                     c035bf3c c035bf20  
> c0019f54 c001b0ac
> bf20: 00001000 00002cb3 00000004 c035ed4c c035bf74 c035bf40  
> c033ea24 c0019edc
> bf40: c02f526c 00000002 00000015 bc058c9b 93111a16 c035335c  
> 02000000 c035ed4c
> bf60: c035ed4c c03f8120 c035bf84 c035bf78 c00194c4 c033e8ec  
> c035bfc4 c035bf88
> bf80: c033bc24 c00194a0 c035bf90 c035bf98 00000000 00000000  
> 00000000 00000000
> bfa0: 00000001 00000000 c0354678 c035ece4 10004000 103532f4  
> c035bff4 c035bfc8
> bfc0: c0338574 c033b598 00000000 00000000 00000000 c035467c  
> 0000317d c035c03c
> bfe0: c0354678 c035ece4 00000000 c035bff8 10008040 c0338508  
> 00000000 00000000
> Backtrace:
> [<c001b09c>] (omap_sram_reprogram_clock+0x0/0x30) from [<c0019f54>]  
> (omap1_select_table_rate+0x88/0xb4)
> [<c0019ecc>] (omap1_select_table_rate+0x0/0xb4) from [<c033ea24>]  
> (omap1_clk_init+0x148/0x334)
>  r7:c035ed4c r6:00000004 r5:00002cb3 r4:00001000
> [<c033e8dc>] (omap1_clk_init+0x0/0x334) from [<c00194c4>]  
> (omap1_init_early+0x34/0x48)
>  r8:c03f8120 r7:c035ed4c r6:c035ed4c r5:02000000 r4:c035335c
> [<c0019490>] (omap1_init_early+0x0/0x48) from [<c033bc24>]  
> (setup_arch+0x69c/0x79c)
> [<c033b588>] (setup_arch+0x0/0x79c) from [<c0338574>] (start_kernel 
> +0x7c/0x2f4)
> [<c03384f8>] (start_kernel+0x0/0x2f4) from [<10008040>] (0x10008040)
>  r7:c035ece4 r6:c0354678 r5:c035c03c r4:0000317d
> Code: 0a000002 e1a0e00f e12fff13 e89da800 (e7f001f2)
>
> Fix this by adding omap1_clk_late_init() that only reprograms dpll1
> if the bootloader rate is less than 60MHz. This also allows removing
> of the OMAP_CLOCKS_SET_BY_BOOTLOADER option.
>
> Reported-by: Aaro Koskinen <aaro.koskinen@iki.fi>
> Signed-off-by: Tony Lindgren <tony@atomide.com>
>
> ---
> This seems to work when forced on OSK5912 at least. Moving the dpll1
> reprogramming to happen later should not mess up drivers as it's still
> before driver inits. Also the system timer should not change as the
> source is ck_ref.

Cheers mate, this fixes the 3.2-rc1 boot issue on Amstrad E3.

Tested-by: Aaro Koskinen <aaro.koskinen@iki.fi>

A.

> ---
> diff --git a/arch/arm/configs/omap1_defconfig b/arch/arm/configs/ 
> omap1_defconfig
> index 7b63462..a7e7775 100644
> --- a/arch/arm/configs/omap1_defconfig
> +++ b/arch/arm/configs/omap1_defconfig
> @@ -48,7 +48,6 @@ CONFIG_MACH_SX1=y
>  CONFIG_MACH_NOKIA770=y
>  CONFIG_MACH_AMS_DELTA=y
>  CONFIG_MACH_OMAP_GENERIC=y
> -CONFIG_OMAP_CLOCKS_SET_BY_BOOTLOADER=y
>  CONFIG_OMAP_ARM_216MHZ=y
>  CONFIG_OMAP_ARM_195MHZ=y
>  CONFIG_OMAP_ARM_192MHZ=y
> diff --git a/arch/arm/mach-omap1/Kconfig b/arch/arm/mach-omap1/Kconfig
> index e0a0281..73f287d 100644
> --- a/arch/arm/mach-omap1/Kconfig
> +++ b/arch/arm/mach-omap1/Kconfig
> @@ -171,14 +171,6 @@ config MACH_OMAP_GENERIC
>  comment "OMAP CPU Speed"
>  	depends on ARCH_OMAP1
>
> -config OMAP_CLOCKS_SET_BY_BOOTLOADER
> -	bool "OMAP clocks set by bootloader"
> -	depends on ARCH_OMAP1
> -	help
> -	  Enable this option to prevent the kernel from overriding the clock
> -	  frequencies programmed by bootloader for MPU, DSP, MMUs, TC,
> -	  internal LCD controller and MPU peripherals.
> -
>  config OMAP_ARM_216MHZ
>  	bool "OMAP ARM 216 MHz CPU (1710 only)"
>          depends on ARCH_OMAP1 && ARCH_OMAP16XX
> diff --git a/arch/arm/mach-omap1/clock.h b/arch/arm/mach-omap1/clock.h
> index eaf09ef..16b1423 100644
> --- a/arch/arm/mach-omap1/clock.h
> +++ b/arch/arm/mach-omap1/clock.h
> @@ -17,7 +17,8 @@
>
>  #include <plat/clock.h>
>
> -extern int __init omap1_clk_init(void);
> +int omap1_clk_init(void);
> +void omap1_clk_late_init(void);
>  extern int omap1_clk_enable(struct clk *clk);
>  extern void omap1_clk_disable(struct clk *clk);
>  extern long omap1_clk_round_rate(struct clk *clk, unsigned long  
> rate);
> diff --git a/arch/arm/mach-omap1/clock_data.c b/arch/arm/mach-omap1/ 
> clock_data.c
> index 92400b9..1297bb5 100644
> --- a/arch/arm/mach-omap1/clock_data.c
> +++ b/arch/arm/mach-omap1/clock_data.c
> @@ -767,6 +767,15 @@ static struct clk_functions  
> omap1_clk_functions = {
>  	.clk_disable_unused	= omap1_clk_disable_unused,
>  };
>
> +static void __init omap1_show_rates(void)
> +{
> +	pr_notice("Clocking rate (xtal/DPLL1/MPU): "
> +			"%ld.%01ld/%ld.%01ld/%ld.%01ld MHz\n",
> +		ck_ref.rate / 1000000, (ck_ref.rate / 100000) % 10,
> +		ck_dpll1.rate / 1000000, (ck_dpll1.rate / 100000) % 10,
> +		arm_ck.rate / 1000000, (arm_ck.rate / 100000) % 10);
> +}
> +
>  int __init omap1_clk_init(void)
>  {
>  	struct omap_clk *c;
> @@ -835,9 +844,12 @@ int __init omap1_clk_init(void)
>  	/* We want to be in syncronous scalable mode */
>  	omap_writew(0x1000, ARM_SYSST);
>
> -#ifdef CONFIG_OMAP_CLOCKS_SET_BY_BOOTLOADER
> -	/* Use values set by bootloader. Determine PLL rate and recalculate
> -	 * dependent clocks as if kernel had changed PLL or divisors.
> +
> +	/*
> +	 * Initially use the values set by bootloader. Determine PLL rate  
> and
> +	 * recalculate dependent clocks as if kernel had changed PLL or
> +	 * divisors. See also omap1_clk_late_init() that can reprogram dpll1
> +	 * after the SRAM is initialized.
>  	 */
>  	{
>  		unsigned pll_ctl_val = omap_readw(DPLL_CTL);
> @@ -862,25 +874,10 @@ int __init omap1_clk_init(void)
>  			}
>  		}
>  	}
> -#else
> -	/* Find the highest supported frequency and enable it */
> -	if (omap1_select_table_rate(&virtual_ck_mpu, ~0)) {
> -		printk(KERN_ERR "System frequencies not set. Check your config. 
> \n");
> -		/* Guess sane values (60MHz) */
> -		omap_writew(0x2290, DPLL_CTL);
> -		omap_writew(cpu_is_omap7xx() ? 0x3005 : 0x1005, ARM_CKCTL);
> -		ck_dpll1.rate = 60000000;
> -	}
> -#endif
>  	propagate_rate(&ck_dpll1);
>  	/* Cache rates for clocks connected to ck_ref (not dpll1) */
>  	propagate_rate(&ck_ref);
> -	printk(KERN_INFO "Clocking rate (xtal/DPLL1/MPU): "
> -		"%ld.%01ld/%ld.%01ld/%ld.%01ld MHz\n",
> -	       ck_ref.rate / 1000000, (ck_ref.rate / 100000) % 10,
> -	       ck_dpll1.rate / 1000000, (ck_dpll1.rate / 100000) % 10,
> -	       arm_ck.rate / 1000000, (arm_ck.rate / 100000) % 10);
> -
> +	omap1_show_rates();
>  	if (machine_is_omap_perseus2() || machine_is_omap_fsample()) {
>  		/* Select slicer output as OMAP input clock */
>  		omap_writew(omap_readw(OMAP7XX_PCC_UPLD_CTRL) & ~0x1,
> @@ -925,3 +922,21 @@ int __init omap1_clk_init(void)
>
>  	return 0;
>  }
> +
> +#define OMAP1_DPLL1_SANE_VALUE	60000000
> +
> +void __init omap1_clk_late_init(void)
> +{
> +	if (ck_dpll1.rate >= OMAP1_DPLL1_SANE_VALUE)
> +		return;
> +
> +	/* Find the highest supported frequency and enable it */
> +	if (omap1_select_table_rate(&virtual_ck_mpu, ~0)) {
> +		pr_err("System frequencies not set, using default. Check your  
> config.\n");
> +		omap_writew(0x2290, DPLL_CTL);
> +		omap_writew(cpu_is_omap7xx() ? 0x3005 : 0x1005, ARM_CKCTL);
> +		ck_dpll1.rate = OMAP1_DPLL1_SANE_VALUE;
> +	}
> +	propagate_rate(&ck_dpll1);
> +	omap1_show_rates();
> +}
> diff --git a/arch/arm/mach-omap1/devices.c b/arch/arm/mach-omap1/ 
> devices.c
> index 48ef988..475cb2f 100644
> --- a/arch/arm/mach-omap1/devices.c
> +++ b/arch/arm/mach-omap1/devices.c
> @@ -30,6 +30,8 @@
>  #include <plat/omap7xx.h>
>  #include <plat/mcbsp.h>
>
> +#include "clock.h"
> +
>  / 
> *--------------------------------------------------------------------- 
> ----*/
>
>  #if defined(CONFIG_RTC_DRV_OMAP) || defined 
> (CONFIG_RTC_DRV_OMAP_MODULE)
> @@ -293,6 +295,7 @@ static int __init omap1_init_devices(void)
>  		return -ENODEV;
>
>  	omap_sram_init();
> +	omap1_clk_late_init();
>
>  	/* please keep these calls, and their implementations above,
>  	 * in alphabetical order so they're easier to sort through.

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

* DEBUG_LL on OMAP1 (was Re: [PATCH] ARM: OMAP: Fix map_io for Amstrad E3)
  2011-11-10 23:23               ` Tony Lindgren
@ 2011-11-12 12:16                 ` Aaro Koskinen
  -1 siblings, 0 replies; 30+ messages in thread
From: Aaro Koskinen @ 2011-11-12 12:16 UTC (permalink / raw)
  To: Tony Lindgren; +Cc: linux-omap, linux-arm-kernel

Hi,

On Thu, 10 Nov 2011, Tony Lindgren wrote:
> * Aaro Koskinen <aaro.koskinen@iki.fi> [111110 13:31]:
>> --- a/arch/arm/mach-omap1/clock_data.c
>> +++ b/arch/arm/mach-omap1/clock_data.c
>> @@ -774,14 +774,6 @@ int __init omap1_clk_init(void)
>>  	int crystal_type = 0; /* Default 12 MHz */
>>  	u32 reg, cpu_mask;
>>
>> -#ifdef CONFIG_DEBUG_LL
>> -	/*
>> -	 * Resets some clocks that may be left on from bootloader,
>> -	 * but leaves serial clocks on.
>> -	 */
>> -	omap_writel(0x3 << 29, MOD_CONF_CTRL_0);
>> -#endif
>> -
>>  	/* USB_REQ_EN will be disabled later if necessary (usb_dc_ck) */
>>  	reg = omap_readw(SOFT_REQ_REG) & (1 << 4);
>>  	omap_writew(reg, SOFT_REQ_REG);
>
> Hmm that should keep the serial clocks on. What other bit(s) need to
> be on in MOD_CONF_CTRL_0 for you in addition to the serial bits?

On my board those serial bits are zero during the early boot (and the
serial works). By setting those bits the clock will switch from 12 ->
48 MHz and I guess the baud rate will change and that's why the output
turns into garbage.

So I think the code should reset the other bits, and leave serial bits
untouched:

diff --git a/arch/arm/mach-omap1/clock_data.c b/arch/arm/mach-omap1/clock_data.c
index 1297bb5..b3b69d8 100644
--- a/arch/arm/mach-omap1/clock_data.c
+++ b/arch/arm/mach-omap1/clock_data.c
@@ -788,7 +788,11 @@ int __init omap1_clk_init(void)
  	 * Resets some clocks that may be left on from bootloader,
  	 * but leaves serial clocks on.
  	 */
-	omap_writel(0x3 << 29, MOD_CONF_CTRL_0);
+	reg = omap_readl(MOD_CONF_CTRL_0) &
+		((1 << CONF_MOD_UART1_CLK_MODE_R) |
+		 (1 << CONF_MOD_UART2_CLK_MODE_R) |
+		 (1 << CONF_MOD_UART3_CLK_MODE_R));
+	omap_writel(reg, MOD_CONF_CTRL_0);
  #endif

  	/* USB_REQ_EN will be disabled later if necessary (usb_dc_ck) */

A.

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

* DEBUG_LL on OMAP1 (was Re: [PATCH] ARM: OMAP: Fix map_io for Amstrad E3)
@ 2011-11-12 12:16                 ` Aaro Koskinen
  0 siblings, 0 replies; 30+ messages in thread
From: Aaro Koskinen @ 2011-11-12 12:16 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

On Thu, 10 Nov 2011, Tony Lindgren wrote:
> * Aaro Koskinen <aaro.koskinen@iki.fi> [111110 13:31]:
>> --- a/arch/arm/mach-omap1/clock_data.c
>> +++ b/arch/arm/mach-omap1/clock_data.c
>> @@ -774,14 +774,6 @@ int __init omap1_clk_init(void)
>>  	int crystal_type = 0; /* Default 12 MHz */
>>  	u32 reg, cpu_mask;
>>
>> -#ifdef CONFIG_DEBUG_LL
>> -	/*
>> -	 * Resets some clocks that may be left on from bootloader,
>> -	 * but leaves serial clocks on.
>> -	 */
>> -	omap_writel(0x3 << 29, MOD_CONF_CTRL_0);
>> -#endif
>> -
>>  	/* USB_REQ_EN will be disabled later if necessary (usb_dc_ck) */
>>  	reg = omap_readw(SOFT_REQ_REG) & (1 << 4);
>>  	omap_writew(reg, SOFT_REQ_REG);
>
> Hmm that should keep the serial clocks on. What other bit(s) need to
> be on in MOD_CONF_CTRL_0 for you in addition to the serial bits?

On my board those serial bits are zero during the early boot (and the
serial works). By setting those bits the clock will switch from 12 ->
48 MHz and I guess the baud rate will change and that's why the output
turns into garbage.

So I think the code should reset the other bits, and leave serial bits
untouched:

diff --git a/arch/arm/mach-omap1/clock_data.c b/arch/arm/mach-omap1/clock_data.c
index 1297bb5..b3b69d8 100644
--- a/arch/arm/mach-omap1/clock_data.c
+++ b/arch/arm/mach-omap1/clock_data.c
@@ -788,7 +788,11 @@ int __init omap1_clk_init(void)
  	 * Resets some clocks that may be left on from bootloader,
  	 * but leaves serial clocks on.
  	 */
-	omap_writel(0x3 << 29, MOD_CONF_CTRL_0);
+	reg = omap_readl(MOD_CONF_CTRL_0) &
+		((1 << CONF_MOD_UART1_CLK_MODE_R) |
+		 (1 << CONF_MOD_UART2_CLK_MODE_R) |
+		 (1 << CONF_MOD_UART3_CLK_MODE_R));
+	omap_writel(reg, MOD_CONF_CTRL_0);
  #endif

  	/* USB_REQ_EN will be disabled later if necessary (usb_dc_ck) */

A.

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

* Re: [PATCH] ARM: OMAP: Fix reprogramming of dpll1 rate
  2011-11-11 23:22                   ` Aaro Koskinen
@ 2011-11-14 17:44                     ` Tony Lindgren
  -1 siblings, 0 replies; 30+ messages in thread
From: Tony Lindgren @ 2011-11-14 17:44 UTC (permalink / raw)
  To: Aaro Koskinen; +Cc: Russell King - ARM Linux, linux-omap, linux-arm-kernel

* Aaro Koskinen <aaro.koskinen@iki.fi> [111111 14:46]:
> 
> Cheers mate, this fixes the 3.2-rc1 boot issue on Amstrad E3.
> 
> Tested-by: Aaro Koskinen <aaro.koskinen@iki.fi>

OK thanks good to hear.

Tony

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

* [PATCH] ARM: OMAP: Fix reprogramming of dpll1 rate
@ 2011-11-14 17:44                     ` Tony Lindgren
  0 siblings, 0 replies; 30+ messages in thread
From: Tony Lindgren @ 2011-11-14 17:44 UTC (permalink / raw)
  To: linux-arm-kernel

* Aaro Koskinen <aaro.koskinen@iki.fi> [111111 14:46]:
> 
> Cheers mate, this fixes the 3.2-rc1 boot issue on Amstrad E3.
> 
> Tested-by: Aaro Koskinen <aaro.koskinen@iki.fi>

OK thanks good to hear.

Tony

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

* Re: DEBUG_LL on OMAP1 (was Re: [PATCH] ARM: OMAP: Fix map_io for Amstrad E3)
  2011-11-12 12:16                 ` Aaro Koskinen
@ 2011-11-14 18:24                   ` Tony Lindgren
  -1 siblings, 0 replies; 30+ messages in thread
From: Tony Lindgren @ 2011-11-14 18:24 UTC (permalink / raw)
  To: Aaro Koskinen; +Cc: linux-omap, linux-arm-kernel

* Aaro Koskinen <aaro.koskinen@iki.fi> [111112 03:42]:
> Hi,
> 
> On Thu, 10 Nov 2011, Tony Lindgren wrote:
> >* Aaro Koskinen <aaro.koskinen@iki.fi> [111110 13:31]:
> >>--- a/arch/arm/mach-omap1/clock_data.c
> >>+++ b/arch/arm/mach-omap1/clock_data.c
> >>@@ -774,14 +774,6 @@ int __init omap1_clk_init(void)
> >> 	int crystal_type = 0; /* Default 12 MHz */
> >> 	u32 reg, cpu_mask;
> >>
> >>-#ifdef CONFIG_DEBUG_LL
> >>-	/*
> >>-	 * Resets some clocks that may be left on from bootloader,
> >>-	 * but leaves serial clocks on.
> >>-	 */
> >>-	omap_writel(0x3 << 29, MOD_CONF_CTRL_0);
> >>-#endif
> >>-
> >> 	/* USB_REQ_EN will be disabled later if necessary (usb_dc_ck) */
> >> 	reg = omap_readw(SOFT_REQ_REG) & (1 << 4);
> >> 	omap_writew(reg, SOFT_REQ_REG);
> >
> >Hmm that should keep the serial clocks on. What other bit(s) need to
> >be on in MOD_CONF_CTRL_0 for you in addition to the serial bits?
> 
> On my board those serial bits are zero during the early boot (and the
> serial works). By setting those bits the clock will switch from 12 ->
> 48 MHz and I guess the baud rate will change and that's why the output
> turns into garbage.

OK, looks like on OSK5912 the uart1 serial bit is zero and must be set..
 
> So I think the code should reset the other bits, and leave serial bits
> untouched:

Sounds like we need SoC specific init_early for omap1 too. That way we
can also get rid of the CONFIG_OMAP_ARM_XXXMHZ Kconfig options that
are needed to make omap1_defconfig more usable.

Regards,

Tony
 
> diff --git a/arch/arm/mach-omap1/clock_data.c b/arch/arm/mach-omap1/clock_data.c
> index 1297bb5..b3b69d8 100644
> --- a/arch/arm/mach-omap1/clock_data.c
> +++ b/arch/arm/mach-omap1/clock_data.c
> @@ -788,7 +788,11 @@ int __init omap1_clk_init(void)
>  	 * Resets some clocks that may be left on from bootloader,
>  	 * but leaves serial clocks on.
>  	 */
> -	omap_writel(0x3 << 29, MOD_CONF_CTRL_0);
> +	reg = omap_readl(MOD_CONF_CTRL_0) &
> +		((1 << CONF_MOD_UART1_CLK_MODE_R) |
> +		 (1 << CONF_MOD_UART2_CLK_MODE_R) |
> +		 (1 << CONF_MOD_UART3_CLK_MODE_R));
> +	omap_writel(reg, MOD_CONF_CTRL_0);
>  #endif
> 
>  	/* USB_REQ_EN will be disabled later if necessary (usb_dc_ck) */
> 



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

* DEBUG_LL on OMAP1 (was Re: [PATCH] ARM: OMAP: Fix map_io for Amstrad E3)
@ 2011-11-14 18:24                   ` Tony Lindgren
  0 siblings, 0 replies; 30+ messages in thread
From: Tony Lindgren @ 2011-11-14 18:24 UTC (permalink / raw)
  To: linux-arm-kernel

* Aaro Koskinen <aaro.koskinen@iki.fi> [111112 03:42]:
> Hi,
> 
> On Thu, 10 Nov 2011, Tony Lindgren wrote:
> >* Aaro Koskinen <aaro.koskinen@iki.fi> [111110 13:31]:
> >>--- a/arch/arm/mach-omap1/clock_data.c
> >>+++ b/arch/arm/mach-omap1/clock_data.c
> >>@@ -774,14 +774,6 @@ int __init omap1_clk_init(void)
> >> 	int crystal_type = 0; /* Default 12 MHz */
> >> 	u32 reg, cpu_mask;
> >>
> >>-#ifdef CONFIG_DEBUG_LL
> >>-	/*
> >>-	 * Resets some clocks that may be left on from bootloader,
> >>-	 * but leaves serial clocks on.
> >>-	 */
> >>-	omap_writel(0x3 << 29, MOD_CONF_CTRL_0);
> >>-#endif
> >>-
> >> 	/* USB_REQ_EN will be disabled later if necessary (usb_dc_ck) */
> >> 	reg = omap_readw(SOFT_REQ_REG) & (1 << 4);
> >> 	omap_writew(reg, SOFT_REQ_REG);
> >
> >Hmm that should keep the serial clocks on. What other bit(s) need to
> >be on in MOD_CONF_CTRL_0 for you in addition to the serial bits?
> 
> On my board those serial bits are zero during the early boot (and the
> serial works). By setting those bits the clock will switch from 12 ->
> 48 MHz and I guess the baud rate will change and that's why the output
> turns into garbage.

OK, looks like on OSK5912 the uart1 serial bit is zero and must be set..
 
> So I think the code should reset the other bits, and leave serial bits
> untouched:

Sounds like we need SoC specific init_early for omap1 too. That way we
can also get rid of the CONFIG_OMAP_ARM_XXXMHZ Kconfig options that
are needed to make omap1_defconfig more usable.

Regards,

Tony
 
> diff --git a/arch/arm/mach-omap1/clock_data.c b/arch/arm/mach-omap1/clock_data.c
> index 1297bb5..b3b69d8 100644
> --- a/arch/arm/mach-omap1/clock_data.c
> +++ b/arch/arm/mach-omap1/clock_data.c
> @@ -788,7 +788,11 @@ int __init omap1_clk_init(void)
>  	 * Resets some clocks that may be left on from bootloader,
>  	 * but leaves serial clocks on.
>  	 */
> -	omap_writel(0x3 << 29, MOD_CONF_CTRL_0);
> +	reg = omap_readl(MOD_CONF_CTRL_0) &
> +		((1 << CONF_MOD_UART1_CLK_MODE_R) |
> +		 (1 << CONF_MOD_UART2_CLK_MODE_R) |
> +		 (1 << CONF_MOD_UART3_CLK_MODE_R));
> +	omap_writel(reg, MOD_CONF_CTRL_0);
>  #endif
> 
>  	/* USB_REQ_EN will be disabled later if necessary (usb_dc_ck) */
> 

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

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

Thread overview: 30+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-11-09 22:55 3.2-rc1 boot broken on OMAP1 / Amstrad E3 Aaro Koskinen
2011-11-09 22:55 ` Aaro Koskinen
2011-11-09 23:19 ` Tony Lindgren
2011-11-09 23:19   ` Tony Lindgren
2011-11-09 23:25   ` [PATCH] ARM: OMAP: Fix map_io for " Tony Lindgren
2011-11-09 23:25     ` Tony Lindgren
2011-11-09 23:39     ` Russell King - ARM Linux
2011-11-09 23:39       ` Russell King - ARM Linux
2011-11-10  0:00       ` Aaro Koskinen
2011-11-10  0:00         ` Aaro Koskinen
2011-11-10  0:04         ` Tony Lindgren
2011-11-10  0:04           ` Tony Lindgren
2011-11-10  0:28           ` Aaro Koskinen
2011-11-10  0:28             ` Aaro Koskinen
2011-11-10 23:33             ` Janusz Krzysztofik
2011-11-10 23:33               ` Janusz Krzysztofik
2011-11-10 22:06           ` Aaro Koskinen
2011-11-10 22:06             ` Aaro Koskinen
2011-11-10 23:23             ` Tony Lindgren
2011-11-10 23:23               ` Tony Lindgren
2011-11-11 19:16               ` [PATCH] ARM: OMAP: Fix reprogramming of dpll1 rate Tony Lindgren
2011-11-11 19:16                 ` Tony Lindgren
2011-11-11 23:22                 ` Aaro Koskinen
2011-11-11 23:22                   ` Aaro Koskinen
2011-11-14 17:44                   ` Tony Lindgren
2011-11-14 17:44                     ` Tony Lindgren
2011-11-12 12:16               ` DEBUG_LL on OMAP1 (was Re: [PATCH] ARM: OMAP: Fix map_io for Amstrad E3) Aaro Koskinen
2011-11-12 12:16                 ` Aaro Koskinen
2011-11-14 18:24                 ` Tony Lindgren
2011-11-14 18: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.