Skip to contentSkip to conversation

ep93xx: move clock initialization earlier

PATCH Superseded Mika Westerberg 3 participants 3 messages Sep 1, 2010 – Sep 2, 2010

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ep93xx: move clock initialization earlier

Commit 7cfe24947 ("ARM: AMBA: Add pclk support to AMBA bus infrastructure") changed AMBA bus to handle the PCLK automatically. However, in EP93xx clock initialization is arch_initcall() which is done later than AMBA device identification. This causes amba_get_enable_pclk() to fail resulting device where UARTs are not functional.

So move clock initialization code before any AMBA device registration.

---
Note that I'm not sure whether ep93xx_map_io() is the best place for calling clock init code. Alternative would be to put it in ep93xx_init_devices() just before calls to amba_device_register().

Tested on ep9302 (ts-7260) and on ep9307 (Sim.One).

 arch/arm/mach-ep93xx/clock.c                 |    4 +---
 arch/arm/mach-ep93xx/core.c                  |    1 +
 arch/arm/mach-ep93xx/include/mach/platform.h |    1 +
 3 files changed, 3 insertions(+), 3 deletions(-)
arch/arm/mach-ep93xx/clock.c +1 -3
index 8bf3cec..119e614 100644
@@ -514,7 +514,7 @@ static void __init ep93xx_dma_clock_init(void)
 	clk_m2m1.rate = clk_h.rate;
 }
 
-static int __init ep93xx_clock_init(void)
+void __init ep93xx_clock_init(void)
 {
 	u32 value;
 
@@ -558,6 +558,4 @@ static int __init ep93xx_clock_init(void)
 		clk_p.rate / 1000000);
 
 	clkdev_add_table(clocks, ARRAY_SIZE(clocks));
-	return 0;
 }
-arch_initcall(ep93xx_clock_init);
arch/arm/mach-ep93xx/core.c +1 -0
index 4cb55d3..04e1b25 100644
@@ -65,6 +65,7 @@ static struct map_desc ep93xx_io_desc[] __initdata = {
 void __init ep93xx_map_io(void)
 {
 	iotable_init(ep93xx_io_desc, ARRAY_SIZE(ep93xx_io_desc));
+	ep93xx_clock_init();
 }
 
 
arch/arm/mach-ep93xx/include/mach/platform.h +1 -0
index 3330b36..9b732b1 100644
@@ -20,6 +20,7 @@ struct ep93xx_eth_data
 
 void ep93xx_map_io(void);
 void ep93xx_init_irq(void);
+void ep93xx_clock_init(void);
 
 /* EP93xx System Controller software locked register write */
 void ep93xx_syscon_swlocked_write(unsigned int val, void __iomem *reg);
Signature · 1 line
1.5.6.5
#1 lore raw

PATCH 1/1 ep93xx: move clock initialization earlier

Quoted 6 lines · Mika Westerberg

Commit 7cfe24947 ("ARM: AMBA: Add pclk support to AMBA bus infrastructure") changed AMBA bus to handle the PCLK automatically. However, in EP93xx clock initialization is arch_initcall() which is done later than AMBA device identification. This causes amba_get_enable_pclk() to fail resulting device where UARTs are not functional.

Quoted 7 lines

So move clock initialization code before any AMBA device registration.

---
Note that I'm not sure whether ep93xx_map_io() is the best place for calling clock init code. Alternative would be to put it in ep93xx_init_devices() just before calls to amba_device_register().

Thanks Mika,

I'm guessing none of the initcalls are early enough to solve this problem? I think that calling from either ep93xx_map_io or ep93xx_init_devices is fine, especially since this is a regression fix.

If nobody has a better solution:

Quoted 51 lines

Tested on ep9302 (ts-7260) and on ep9307 (Sim.One).

 arch/arm/mach-ep93xx/clock.c                 |    4 +---
 arch/arm/mach-ep93xx/core.c                  |    1 +
 arch/arm/mach-ep93xx/include/mach/platform.h |    1 +
 3 files changed, 3 insertions(+), 3 deletions(-)
arch/arm/mach-ep93xx/clock.c +1 -3
index 8bf3cec..119e614 100644
@@ -514,7 +514,7 @@ static void __init ep93xx_dma_clock_init(void)
 	clk_m2m1.rate = clk_h.rate;
 }
 
-static int __init ep93xx_clock_init(void)
+void __init ep93xx_clock_init(void)
 {
 	u32 value;
 
@@ -558,6 +558,4 @@ static int __init ep93xx_clock_init(void)
 		clk_p.rate / 1000000);
 
 	clkdev_add_table(clocks, ARRAY_SIZE(clocks));
-	return 0;
 }
-arch_initcall(ep93xx_clock_init);
arch/arm/mach-ep93xx/core.c +1 -0
index 4cb55d3..04e1b25 100644
@@ -65,6 +65,7 @@ static struct map_desc ep93xx_io_desc[] __initdata = {
 void __init ep93xx_map_io(void)
 {
 	iotable_init(ep93xx_io_desc, ARRAY_SIZE(ep93xx_io_desc));
+	ep93xx_clock_init();
 }
 
 
arch/arm/mach-ep93xx/include/mach/platform.h +1 -0
index 3330b36..9b732b1 100644
@@ -20,6 +20,7 @@ struct ep93xx_eth_data
 
 void ep93xx_map_io(void);
 void ep93xx_init_irq(void);
+void ep93xx_clock_init(void);
 
 /* EP93xx System Controller software locked register write */
 void ep93xx_syscon_swlocked_write(unsigned int val, void __iomem *reg);
Signature · 7 lines
Bluewater Systems Ltd - ARM Technology Solution Centre

Ryan Mallon         		5 Amuri Park, 404 Barbadoes St
ryan at bluewatersys.com         	PO Box 13 889, Christchurch 8013
http://www.bluewatersys.com	New Zealand
Phone: +64 3 3779127		Freecall: Australia 1800 148 751
Fax:   +64 3 3779135			  USA 1800 261 2934
#2 lore raw

PATCH 1/1 ep93xx: move clock initialization earlier

In reply to Mika Westerberg
Quoted 6 lines · Mika Westerberg

Commit 7cfe24947 ("ARM: AMBA: Add pclk support to AMBA bus infrastructure") changed AMBA bus to handle the PCLK automatically. However, in EP93xx clock initialization is arch_initcall() which is done later than AMBA device identification. This causes amba_get_enable_pclk() to fail resulting device where UARTs are not functional.

Quoted 7 lines

So move clock initialization code before any AMBA device registration.

---
Note that I'm not sure whether ep93xx_map_io() is the best place for calling clock init code. Alternative would be to put it in ep93xx_init_devices() just before calls to amba_device_register().

Use core_initcall() or postcore_initcall() instead.