]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
ARM: pxa: change clocks init sequence
authorRobert Jarzmik <robert.jarzmik@free.fr>
Sat, 27 Dec 2014 13:55:25 +0000 (14:55 +0100)
committerRobert Jarzmik <robert.jarzmik@free.fr>
Tue, 12 May 2015 21:26:25 +0000 (23:26 +0200)
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>
arch/arm/mach-pxa/generic.c
arch/arm/mach-pxa/generic.h
drivers/clk/pxa/clk-pxa27x.c

index 04b013fbc98f46a02ae227fe86c631fa26985caa..d988c531408975d1853cbbf56639378202666cef 100644 (file)
@@ -63,6 +63,10 @@ EXPORT_SYMBOL(get_clock_tick_rate);
  */
 void __init pxa_timer_init(void)
 {
+       if (cpu_is_pxa25x())
+               pxa25x_clocks_init();
+       if (cpu_is_pxa27x())
+               pxa27x_clocks_init();
        pxa_timer_nodt_init(IRQ_OST0, io_p2v(0x40a00000),
                            get_clock_tick_rate());
 }
index 7a9fa1aa4e41838d05ae1a72354572e12fb8581c..149087c7302a4b40a01067c1a5c525f65a20dc5e 100644 (file)
@@ -26,11 +26,13 @@ extern void pxa_timer_init(void);
 #define ARRAY_AND_SIZE(x)      (x), ARRAY_SIZE(x)
 
 #define pxa25x_handle_irq icip_handle_irq
+extern int __init pxa25x_clocks_init(void);
 extern void __init pxa25x_init_irq(void);
 extern void __init pxa25x_map_io(void);
 extern void __init pxa26x_init_irq(void);
 
 #define pxa27x_handle_irq ichp_handle_irq
+extern int __init pxa27x_clocks_init(void);
 extern void __init pxa27x_dt_init_irq(void);
 extern unsigned        pxa27x_get_clk_frequency_khz(int);
 extern void __init pxa27x_init_irq(void);
index 5f9b54b024b9e1607b724c8ceb5dcfba7b58c992..2b8343af6026fef9d6236f90811cc6a904a56259 100644 (file)
@@ -362,12 +362,11 @@ static void __init pxa27x_base_clocks_init(void)
        clk_register_clk_pxa27x_lcd_base();
 }
 
-static int __init pxa27x_clocks_init(void)
+int __init pxa27x_clocks_init(void)
 {
        pxa27x_base_clocks_init();
        return clk_pxa_cken_init(pxa27x_clocks, ARRAY_SIZE(pxa27x_clocks));
 }
-postcore_initcall(pxa27x_clocks_init);
 
 static void __init pxa27x_dt_clocks_init(struct device_node *np)
 {