Commit 5e1d01285140a8cd90676ba15c06c8ec700fd618

Authored by Robert Jarzmik
1 parent b787f68c36

ARM: pxa: change clocks init sequence

Since pxa clocks were ported to the clock framework, an ordering issue
appears between clocks and clocksource initialization. As a consequence,
the pxa timer clock cannot be acquired in pxa_timer, and is disabled by
clock framework because it is "unused".

The ordering issue is that in the kernel boot sequence :
  start_kernel()
    ...
    time_init()
      -> pxa_timer()
        -> here the clocksource is initialized
    ...
    rest_init()
      kernel_init()
	initcalls
	  -> here the clocks are initialized

In the current sequence, the clocks are initialized way after pxa_timer,
which cannot acquire the OSTIMER0 clock.

To solve this issue, the clocks initialization is moved to pxa_timer(),
so that clocks are initialized before clocksource for non device-tree.
For device-tree, the standard arm time_init() will take care of the
ordering.

Reviewed-by: Michael Turquette <mturquette@linaro.org>
Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>

Showing 3 changed files with 7 additions and 2 deletions Side-by-side Diff

arch/arm/mach-pxa/generic.c
... ... @@ -63,6 +63,10 @@
63 63 */
64 64 void __init pxa_timer_init(void)
65 65 {
  66 + if (cpu_is_pxa25x())
  67 + pxa25x_clocks_init();
  68 + if (cpu_is_pxa27x())
  69 + pxa27x_clocks_init();
66 70 pxa_timer_nodt_init(IRQ_OST0, io_p2v(0x40a00000),
67 71 get_clock_tick_rate());
68 72 }
arch/arm/mach-pxa/generic.h
... ... @@ -26,11 +26,13 @@
26 26 #define ARRAY_AND_SIZE(x) (x), ARRAY_SIZE(x)
27 27  
28 28 #define pxa25x_handle_irq icip_handle_irq
  29 +extern int __init pxa25x_clocks_init(void);
29 30 extern void __init pxa25x_init_irq(void);
30 31 extern void __init pxa25x_map_io(void);
31 32 extern void __init pxa26x_init_irq(void);
32 33  
33 34 #define pxa27x_handle_irq ichp_handle_irq
  35 +extern int __init pxa27x_clocks_init(void);
34 36 extern void __init pxa27x_dt_init_irq(void);
35 37 extern unsigned pxa27x_get_clk_frequency_khz(int);
36 38 extern void __init pxa27x_init_irq(void);
drivers/clk/pxa/clk-pxa27x.c
... ... @@ -362,12 +362,11 @@
362 362 clk_register_clk_pxa27x_lcd_base();
363 363 }
364 364  
365   -static int __init pxa27x_clocks_init(void)
  365 +int __init pxa27x_clocks_init(void)
366 366 {
367 367 pxa27x_base_clocks_init();
368 368 return clk_pxa_cken_init(pxa27x_clocks, ARRAY_SIZE(pxa27x_clocks));
369 369 }
370   -postcore_initcall(pxa27x_clocks_init);
371 370  
372 371 static void __init pxa27x_dt_clocks_init(struct device_node *np)
373 372 {