arm: move timer init to late_timer_init
Subsystems (3)
RFC PATCH 1/1 arm: move timer init to late_timer_init
and add global early device init
this will init earlytimer and will try to probe 1 or 2 timers for clockevents and clocksource
This will also allow to share timer cross arch such as sh-mobile and sh
all arm timers will be update to early device step by step
tested on at91sam9263-ek, at91rm9200-ek and qemu versatilepb
--- arch/arm/kernel/time.c | 23 ++++++++++++++- arch/arm/mach-shmobile/Makefile | 2 +- arch/arm/mach-shmobile/board-ag5evm.c | 13 +-------- arch/arm/mach-shmobile/board-ap4evb.c | 18 +++--------- arch/arm/mach-shmobile/board-g3evm.c | 12 +------- arch/arm/mach-shmobile/board-g4evm.c | 12 +------- arch/arm/mach-shmobile/board-mackerel.c | 18 +++--------- arch/arm/mach-shmobile/timer.c | 46 ------------------------------- 8 files changed, 33 insertions(+), 111 deletions(-) delete mode 100644 arch/arm/mach-shmobile/timer.c
arch/arm/kernel/time.c +21 -2
@@ -13,6 +13,7 @@*/ #include <linux/module.h> #include <linux/kernel.h> +#include <linux/platform_device.h> #include <linux/interrupt.h> #include <linux/time.h> #include <linux/init.h>
@@ -158,12 +159,30 @@ static int __init timer_init_sysfs(void)device_initcall (timer_init_sysfs); -void __init time_init (void ) +static void arm_late_time_init (void ) { system_timer = machine_desc->timer; - system_timer->init (); +if (system_timer->init) + system_timer->init (); + +/* +* Make sure all compiled-in early timers register themselves. +* +* Run probe() for two "earlytimer" devices, these will be the +* clockevents and clocksource devices respectively. In the event +* that only a clockevents device is available, we -ENODEV on the +* clocksource and the jiffies clocksource is used transparently +* instead. No error handling is necessary here. +*/ +early_platform_driver_register_all ("earlytimer" ); +early_platform_driver_probe ("earlytimer" ,2 ,0 ); +#ifdef CONFIG_HAVE_SCHED_CLOCK sched_clock_postinit ();#endif } +void __init time_init (void ) +{ + late_time_init = arm_late_time_init; +}
arch/arm/mach-shmobile/Makefile +1 -1
@@ -3,7 +3,7 @@ # # Common objects -obj-y := map_io.o timer.o console.o clock.o pm_runtime.o +obj-y := map_io.o console.o clock.o pm_runtime.o # CPU objects obj-$(CONFIG_ARCH_SH7367) += setup-sh7367.o clock-sh7367.o intc-sh7367.o
arch/arm/mach-shmobile/board-ag5evm.c +1 -12
@@ -339,6 +339,7 @@ static void __init ag5evm_init_early(void)/* setup early devices and console here as well */ sh73a0_add_early_devices ();shmobile_setup_console (); +sh73a0_clock_init (); }#define PINTC_ADDR 0xe6900000
@@ -447,22 +448,10 @@ static void __init ag5evm_init(void)platform_add_devices (ag5evm_devices,ARRAY_SIZE (ag5evm_devices)); } -static void __init ag5evm_timer_init (void ) -{ -sh73a0_clock_init (); - shmobile_timer.init (); -return ; -} - -struct sys_timer ag5evm_timer = { - .init = ag5evm_timer_init, -}; -MACHINE_START (AG5EVM ,"ag5evm" ) .map_io = shmobile_map_io, .init_irq = ag5evm_init_irq, .handle_irq = shmobile_handle_irq_gic, .init_early = ag5evm_init_early, .init_machine = ag5evm_init, - .timer = &ag5evm_timer,MACHINE_END
arch/arm/mach-shmobile/board-ap4evb.c +4 -14
@@ -1096,6 +1096,10 @@ static void __init ap4evb_init_early(void)/* setup early devices and console here as well */ sh7372_add_early_devices ();shmobile_setup_console (); +sh7372_clock_init (); + +/* External clock source */ +clk_set_rate (&sh7372_dv_clki_clk,27000000 ); }#define GPIO_PORT9CR 0xE6051009
@@ -1330,24 +1334,10 @@ static void __init ap4evb_init(void)fsi_init_pm_clock (); } -static void __init ap4evb_timer_init (void ) -{ -sh7372_clock_init (); - shmobile_timer.init (); - -/* External clock source */ -clk_set_rate (&sh7372_dv_clki_clk,27000000 ); -} - -static struct sys_timer ap4evb_timer = { - .init = ap4evb_timer_init, -}; -MACHINE_START (AP4EVB ,"ap4evb" ) .map_io = shmobile_map_io, .init_irq = sh7372_init_irq, .handle_irq = shmobile_handle_irq_intc, .init_early = ap4evb_init_early, .init_machine = ap4evb_init, - .timer = &ap4evb_timer,MACHINE_END
arch/arm/mach-shmobile/board-g3evm.c +1 -11
@@ -249,6 +249,7 @@ static void __init g3evm_init_early(void)/* setup early devices and console here as well */ sh7367_add_early_devices ();shmobile_setup_console (); +sh7367_clock_init (); }static void __init g3evm_init (void )
@@ -338,21 +339,10 @@ static void __init g3evm_init(void)platform_add_devices (g3evm_devices,ARRAY_SIZE (g3evm_devices)); } -static void __init g3evm_timer_init (void ) -{ -sh7367_clock_init (); - shmobile_timer.init (); -} - -static struct sys_timer g3evm_timer = { - .init = g3evm_timer_init, -}; -MACHINE_START (G3EVM ,"g3evm" ) .map_io = shmobile_map_io, .init_irq = sh7367_init_irq, .handle_irq = shmobile_handle_irq_intc, .init_early = g3evm_init_early, .init_machine = g3evm_init, - .timer = &g3evm_timer,MACHINE_END
arch/arm/mach-shmobile/board-g4evm.c +1 -11
@@ -263,6 +263,7 @@ static void __init g4evm_init_early(void)/* setup early devices and console here as well */ sh7377_add_early_devices ();shmobile_setup_console (); +sh7377_clock_init (); }#define GPIO_SDHID0_D0 0xe60520fc
@@ -381,21 +382,10 @@ static void __init g4evm_init(void)platform_add_devices (g4evm_devices,ARRAY_SIZE (g4evm_devices)); } -static void __init g4evm_timer_init (void ) -{ -sh7377_clock_init (); - shmobile_timer.init (); -} - -static struct sys_timer g4evm_timer = { - .init = g4evm_timer_init, -}; -MACHINE_START (G4EVM ,"g4evm" ) .map_io = shmobile_map_io, .init_irq = sh7377_init_irq, .handle_irq = shmobile_handle_irq_intc, .init_early = g4evm_init_early, .init_machine = g4evm_init, - .timer = &g4evm_timer,MACHINE_END
arch/arm/mach-shmobile/board-mackerel.c +4 -14
@@ -1011,6 +1011,10 @@ static void __init mackerel_init_early(void)/* setup early devices and console here as well */ sh7372_add_early_devices ();shmobile_setup_console (); +sh7372_clock_init (); + +/* External clock source */ +clk_set_rate (&sh7372_dv_clki_clk,27000000 ); }#define GPIO_PORT9CR 0xE6051009
@@ -1203,24 +1207,10 @@ static void __init mackerel_init(void)hdmi_init_pm_clock (); } -static void __init mackerel_timer_init (void ) -{ -sh7372_clock_init (); - shmobile_timer.init (); - -/* External clock source */ -clk_set_rate (&sh7372_dv_clki_clk,27000000 ); -} - -static struct sys_timer mackerel_timer = { - .init = mackerel_timer_init, -}; -MACHINE_START (MACKEREL ,"mackerel" ) .map_io = shmobile_map_io, .init_irq = sh7372_init_irq, .handle_irq = shmobile_handle_irq_intc, .init_early = mackerel_init_early, .init_machine = mackerel_init, - .timer = &mackerel_timer,MACHINE_END
arch/arm/mach-shmobile/timer.c deleted +0 -46
46 lines not on this page · raw message
Signature · 1 line
1.7.4.1
RFC PATCH 1/1 arm: move timer init to late_timer_init
Quoted 3 lines · Jean-Christophe PLAGNIOL-VILLARD
and add global early device init
this will init earlytimer and will try to probe 1 or 2 timers for clockevents and clocksource
Why should this change the positioning of sched_clock initialization too?
You know, to spend time sorting out the sched_clock crap that platform people came up with, to get sched_clock working at the right point in the init sequence so that everything is happy, and then to have all that work undone one kernel version later... well, why did I even bother.
RFC PATCH 1/1 arm: move timer init to late_timer_init
Quoted 5 lines · Russell King - ARM Linux
Quoted 3 lines · Jean-Christophe PLAGNIOL-VILLARD
and add global early device init
this will init earlytimer and will try to probe 1 or 2 timers for clockevents and clocksource
Quoted 7 lines
Why should this change the positioning of
sched_clockinitialization too?You know, to spend time sorting out the
sched_clockcrap that platform people came up with, to getsched_clockworking at the right point in the init sequence so that everything is happy, and then to have all that work undone one kernel version later... well, why did I even bother.
so is it ok to put the early init in time_init for you?
this the key point here
remove the sys_timer struct and switch to early device
Best Regards,
J.
RFC PATCH 1/1 arm: add global early device init
this will init earlytimer and will try to probe 1 or 2 timers for clockevents and clocksource
This will also allow to share timer cross arch such as sh-mobile and sh
all arm timers will be update to early device step by step
tested on at91sam9263-ek, at91rm9200-ek and qemu versatilepb
--- arch/arm/kernel/time.c | 18 +++++++++++- arch/arm/mach-shmobile/Makefile | 2 +- arch/arm/mach-shmobile/board-ag5evm.c | 13 +-------- arch/arm/mach-shmobile/board-ap4evb.c | 18 +++--------- arch/arm/mach-shmobile/board-g3evm.c | 12 +------- arch/arm/mach-shmobile/board-g4evm.c | 12 +------- arch/arm/mach-shmobile/board-mackerel.c | 18 +++--------- arch/arm/mach-shmobile/timer.c | 46 ------------------------------- 8 files changed, 28 insertions(+), 111 deletions(-) delete mode 100644 arch/arm/mach-shmobile/timer.c
arch/arm/kernel/time.c +16 -2
@@ -13,6 +13,7 @@*/ #include <linux/module.h> #include <linux/kernel.h> +#include <linux/platform_device.h> #include <linux/interrupt.h> #include <linux/time.h> #include <linux/init.h>
@@ -161,9 +162,22 @@ device_initcall(timer_init_sysfs);void __init time_init (void ) { system_timer = machine_desc->timer; - system_timer->init (); +if (system_timer->init) + system_timer->init (); + +/* +* Make sure all compiled-in early timers register themselves. +* +* Run probe() for two "earlytimer" devices, these will be the +* clockevents and clocksource devices respectively. In the event +* that only a clockevents device is available, we -ENODEV on the +* clocksource and the jiffies clocksource is used transparently +* instead. No error handling is necessary here. +*/ +early_platform_driver_register_all ("earlytimer" ); +early_platform_driver_probe ("earlytimer" ,2 ,0 ); +#ifdef CONFIG_HAVE_SCHED_CLOCK sched_clock_postinit ();#endif } -
arch/arm/mach-shmobile/Makefile +1 -1
@@ -3,7 +3,7 @@ # # Common objects -obj-y := map_io.o timer.o console.o clock.o pm_runtime.o +obj-y := map_io.o console.o clock.o pm_runtime.o # CPU objects obj-$(CONFIG_ARCH_SH7367) += setup-sh7367.o clock-sh7367.o intc-sh7367.o
arch/arm/mach-shmobile/board-ag5evm.c +1 -12
@@ -339,6 +339,7 @@ static void __init ag5evm_init_early(void)/* setup early devices and console here as well */ sh73a0_add_early_devices ();shmobile_setup_console (); +sh73a0_clock_init (); }#define PINTC_ADDR 0xe6900000
@@ -447,22 +448,10 @@ static void __init ag5evm_init(void)platform_add_devices (ag5evm_devices,ARRAY_SIZE (ag5evm_devices)); } -static void __init ag5evm_timer_init (void ) -{ -sh73a0_clock_init (); - shmobile_timer.init (); -return ; -} - -struct sys_timer ag5evm_timer = { - .init = ag5evm_timer_init, -}; -MACHINE_START (AG5EVM ,"ag5evm" ) .map_io = shmobile_map_io, .init_irq = ag5evm_init_irq, .handle_irq = shmobile_handle_irq_gic, .init_early = ag5evm_init_early, .init_machine = ag5evm_init, - .timer = &ag5evm_timer,MACHINE_END
arch/arm/mach-shmobile/board-ap4evb.c +4 -14
@@ -1096,6 +1096,10 @@ static void __init ap4evb_init_early(void)/* setup early devices and console here as well */ sh7372_add_early_devices ();shmobile_setup_console (); +sh7372_clock_init (); + +/* External clock source */ +clk_set_rate (&sh7372_dv_clki_clk,27000000 ); }#define GPIO_PORT9CR 0xE6051009
@@ -1330,24 +1334,10 @@ static void __init ap4evb_init(void)fsi_init_pm_clock (); } -static void __init ap4evb_timer_init (void ) -{ -sh7372_clock_init (); - shmobile_timer.init (); - -/* External clock source */ -clk_set_rate (&sh7372_dv_clki_clk,27000000 ); -} - -static struct sys_timer ap4evb_timer = { - .init = ap4evb_timer_init, -}; -MACHINE_START (AP4EVB ,"ap4evb" ) .map_io = shmobile_map_io, .init_irq = sh7372_init_irq, .handle_irq = shmobile_handle_irq_intc, .init_early = ap4evb_init_early, .init_machine = ap4evb_init, - .timer = &ap4evb_timer,MACHINE_END
arch/arm/mach-shmobile/board-g3evm.c +1 -11
@@ -249,6 +249,7 @@ static void __init g3evm_init_early(void)/* setup early devices and console here as well */ sh7367_add_early_devices ();shmobile_setup_console (); +sh7367_clock_init (); }static void __init g3evm_init (void )
@@ -338,21 +339,10 @@ static void __init g3evm_init(void)platform_add_devices (g3evm_devices,ARRAY_SIZE (g3evm_devices)); } -static void __init g3evm_timer_init (void ) -{ -sh7367_clock_init (); - shmobile_timer.init (); -} - -static struct sys_timer g3evm_timer = { - .init = g3evm_timer_init, -}; -MACHINE_START (G3EVM ,"g3evm" ) .map_io = shmobile_map_io, .init_irq = sh7367_init_irq, .handle_irq = shmobile_handle_irq_intc, .init_early = g3evm_init_early, .init_machine = g3evm_init, - .timer = &g3evm_timer,MACHINE_END
arch/arm/mach-shmobile/board-g4evm.c +1 -11
@@ -263,6 +263,7 @@ static void __init g4evm_init_early(void)/* setup early devices and console here as well */ sh7377_add_early_devices ();shmobile_setup_console (); +sh7377_clock_init (); }#define GPIO_SDHID0_D0 0xe60520fc
@@ -381,21 +382,10 @@ static void __init g4evm_init(void)platform_add_devices (g4evm_devices,ARRAY_SIZE (g4evm_devices)); } -static void __init g4evm_timer_init (void ) -{ -sh7377_clock_init (); - shmobile_timer.init (); -} - -static struct sys_timer g4evm_timer = { - .init = g4evm_timer_init, -}; -MACHINE_START (G4EVM ,"g4evm" ) .map_io = shmobile_map_io, .init_irq = sh7377_init_irq, .handle_irq = shmobile_handle_irq_intc, .init_early = g4evm_init_early, .init_machine = g4evm_init, - .timer = &g4evm_timer,MACHINE_END
arch/arm/mach-shmobile/board-mackerel.c +4 -14
@@ -1011,6 +1011,10 @@ static void __init mackerel_init_early(void)/* setup early devices and console here as well */ sh7372_add_early_devices ();shmobile_setup_console (); +sh7372_clock_init (); + +/* External clock source */ +clk_set_rate (&sh7372_dv_clki_clk,27000000 ); }#define GPIO_PORT9CR 0xE6051009
@@ -1203,24 +1207,10 @@ static void __init mackerel_init(void)hdmi_init_pm_clock (); } -static void __init mackerel_timer_init (void ) -{ -sh7372_clock_init (); - shmobile_timer.init (); - -/* External clock source */ -clk_set_rate (&sh7372_dv_clki_clk,27000000 ); -} - -static struct sys_timer mackerel_timer = { - .init = mackerel_timer_init, -}; -MACHINE_START (MACKEREL ,"mackerel" ) .map_io = shmobile_map_io, .init_irq = sh7372_init_irq, .handle_irq = shmobile_handle_irq_intc, .init_early = mackerel_init_early, .init_machine = mackerel_init, - .timer = &mackerel_timer,MACHINE_END
arch/arm/mach-shmobile/timer.c deleted +0 -46
46 lines not on this page · raw message
Signature · 1 line
1.7.4.1
RFC PATCH 1/1 arm: move timer init to late_timer_init
In reply to Jean-Christophe PLAGNIOL-VILLARDQuoted 6 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 5 lines · Russell King - ARM Linux
Quoted 3 lines · Jean-Christophe PLAGNIOL-VILLARD
and add global early device init
this will init earlytimer and will try to probe 1 or 2 timers for clockevents and clocksource
Quoted 8 lines
Quoted 7 lines
Why should this change the positioning of
sched_clockinitialization too?You know, to spend time sorting out the
sched_clockcrap that platform people came up with, to getsched_clockworking at the right point in the init sequence so that everything is happy, and then to have all that work undone one kernel version later... well, why did I even bother.so is it ok to put the early init in
time_initfor you?
If it works there, then there's no problem. I'm just left wondering why you decided to try the late_time_init() thing in the first place. Was there a specific reason?
RFC PATCH 1/1 arm: move timer init to late_timer_init
Quoted 14 lines · Russell King - ARM Linux
Quoted 13 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 12 lines · Russell King - ARM Linux
Quoted 3 lines · Jean-Christophe PLAGNIOL-VILLARD
and add global early device init
this will init earlytimer and will try to probe 1 or 2 timers for clockevents and clocksourceWhy should this change the positioning of
sched_clockinitialization too?You know, to spend time sorting out the
sched_clockcrap that platform people came up with, to getsched_clockworking at the right point in the init sequence so that everything is happy, and then to have all that work undone one kernel version later... well, why did I even bother.
Quoted 5 lines
Quoted 1 line
so is it ok to put the early init in
time_initfor you?If it works there, then there's no problem. I'm just left wondering why you decided to try the
late_time_init()thing in the first place. Was there a specific reason?
sh-mobile and sh use it this way
Best Regards,
J.
RFC PATCH 1/1 arm: move timer init to late_timer_init
Quoted 15 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 14 lines · Russell King - ARM Linux
Quoted 13 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 12 lines · Russell King - ARM Linux
Quoted 3 lines · Jean-Christophe PLAGNIOL-VILLARD
and add global early device init
this will init earlytimer and will try to probe 1 or 2 timers for clockevents and clocksourceWhy should this change the positioning of
sched_clockinitialization too?You know, to spend time sorting out the
sched_clockcrap that platform people came up with, to getsched_clockworking at the right point in the init sequence so that everything is happy, and then to have all that work undone one kernel version later... well, why did I even bother.
Quoted 7 lines
Quoted 5 lines
Quoted 1 line
so is it ok to put the early init in
time_initfor you?If it works there, then there's no problem. I'm just left wondering why you decided to try the
late_time_init()thing in the first place. Was there a specific reason?sh-mobile and sh use it this way
Do we know why they do?
RFC PATCH 1/1 arm: move timer init to late_timer_init
Quoted 18 lines · Russell King - ARM Linux
Quoted 17 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 16 lines · Russell King - ARM Linux
Quoted 14 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 5 lines · Russell King - ARM Linux
Quoted 3 lines · Jean-Christophe PLAGNIOL-VILLARD
and add global early device init
this will init earlytimer and will try to probe 1 or 2 timers for clockevents and clocksourceQuoted 7 lines
Why should this change the positioning of
sched_clockinitialization too?You know, to spend time sorting out the
sched_clockcrap that platform people came up with, to getsched_clockworking at the right point in the init sequence so that everything is happy, and then to have all that work undone one kernel version later... well, why did I even bother.so is it ok to put the early init in
time_initfor you?
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
If it works there, then there's no problem. I'm just left wondering why you decided to try the
late_time_init()thing in the first place. Was there a specific reason?sh-mobile and sh use it this way
Do we know why they do?
Magnus or Paul will answer better than me
IIRC on sh it's was because the timer init the IRQ too early
but on sh-mobile not sure
I test it on at91 with pit and st timers and I get no issue
Best Regards,
J.
PATCH v3 1/1 arm: add global early device init
In reply to Jean-Christophe PLAGNIOL-VILLARDthis will init earlytimer and will try to probe 1 or 2 timers for clockevents and clocksource
This will also allow to share timer cross arch such as sh-mobile and sh
all arm timers will be update to early device step by step
on ARM sh-mobile we do not need to use the late_time_init as the irq are setup before the probe of the timers
tested on at91sam9263-ek, at91rm9200-ek
---
V3:
now we can do not specify the .timer at all and just realy on the early device
on ARM sh-mobile we do not need to use the late_time_init as the irq are setup before the probe of the timers
the only remaing question is is ok to move the clock_init in the .init_early on sh-mobile
this patch depends on [PATCH] shmobile: fix map_io init usage
Best Regards,
J.
arch/arm/kernel/time.c | 28 +++++++++++++++++-- arch/arm/mach-shmobile/Makefile | 2 +- arch/arm/mach-shmobile/board-ag5evm.c | 13 +-------- arch/arm/mach-shmobile/board-ap4evb.c | 18 +++--------- arch/arm/mach-shmobile/board-g3evm.c | 12 +------- arch/arm/mach-shmobile/board-g4evm.c | 12 +------- arch/arm/mach-shmobile/board-mackerel.c | 18 +++--------- arch/arm/mach-shmobile/timer.c | 46 ------------------------------- 8 files changed, 37 insertions(+), 112 deletions(-) delete mode 100644 arch/arm/mach-shmobile/timer.c
arch/arm/kernel/time.c +25 -3
@@ -13,6 +13,7 @@*/ #include <linux/module.h> #include <linux/kernel.h> +#include <linux/platform_device.h> #include <linux/interrupt.h> #include <linux/time.h> #include <linux/init.h>
@@ -77,6 +78,9 @@ EXPORT_SYMBOL(profile_pc);#ifdef CONFIG_ARCH_USES_GETTIMEOFFSET u32 arch_gettimeoffset (void ) { +if (!system_timer) +return 0 ; +if (system_timer->offset !=NULL )return system_timer->offset () *1000 ;
@@ -147,7 +151,12 @@ static struct sysdev_class timer_sysclass = {static int __init timer_init_sysfs (void ) { -int ret =sysdev_class_register (&timer_sysclass); +int ret; + +if (!system_timer) +return 0 ; + + ret =sysdev_class_register (&timer_sysclass);if (ret ==0 ) { system_timer->dev.cls = &timer_sysclass; ret =sysdev_register (&system_timer->dev);
@@ -161,9 +170,22 @@ device_initcall(timer_init_sysfs);void __init time_init (void ) { system_timer = machine_desc->timer; - system_timer->init (); +if (system_timer && system_timer->init) + system_timer->init (); + +/* +* Make sure all compiled-in early timers register themselves. +* +* Run probe() for two "earlytimer" devices, these will be the +* clockevents and clocksource devices respectively. In the event +* that only a clockevents device is available, we -ENODEV on the +* clocksource and the jiffies clocksource is used transparently +* instead. No error handling is necessary here. +*/ +early_platform_driver_register_all ("earlytimer" ); +early_platform_driver_probe ("earlytimer" ,2 ,0 ); +#ifdef CONFIG_HAVE_SCHED_CLOCK sched_clock_postinit ();#endif } -
arch/arm/mach-shmobile/Makefile +1 -1
@@ -3,7 +3,7 @@ # # Common objects -obj-y := map_io.o timer.o console.o clock.o pm_runtime.o +obj-y := map_io.o console.o clock.o pm_runtime.o # CPU objects obj-$(CONFIG_ARCH_SH7367) += setup-sh7367.o clock-sh7367.o intc-sh7367.o
arch/arm/mach-shmobile/board-ag5evm.c +1 -12
@@ -339,6 +339,7 @@ static void __init ag5evm_init_early(void)/* setup early devices and console here as well */ sh73a0_add_early_devices ();shmobile_setup_console (); +sh73a0_clock_init (); }#define PINTC_ADDR 0xe6900000
@@ -447,22 +448,10 @@ static void __init ag5evm_init(void)platform_add_devices (ag5evm_devices,ARRAY_SIZE (ag5evm_devices)); } -static void __init ag5evm_timer_init (void ) -{ -sh73a0_clock_init (); - shmobile_timer.init (); -return ; -} - -struct sys_timer ag5evm_timer = { - .init = ag5evm_timer_init, -}; -MACHINE_START (AG5EVM ,"ag5evm" ) .map_io = shmobile_map_io, .init_irq = ag5evm_init_irq, .handle_irq = shmobile_handle_irq_gic, .init_early = ag5evm_init_early, .init_machine = ag5evm_init, - .timer = &ag5evm_timer,MACHINE_END
arch/arm/mach-shmobile/board-ap4evb.c +4 -14
@@ -1096,6 +1096,10 @@ static void __init ap4evb_init_early(void)/* setup early devices and console here as well */ sh7372_add_early_devices ();shmobile_setup_console (); +sh7372_clock_init (); + +/* External clock source */ +clk_set_rate (&sh7372_dv_clki_clk,27000000 ); }#define GPIO_PORT9CR 0xE6051009
@@ -1330,24 +1334,10 @@ static void __init ap4evb_init(void)fsi_init_pm_clock (); } -static void __init ap4evb_timer_init (void ) -{ -sh7372_clock_init (); - shmobile_timer.init (); - -/* External clock source */ -clk_set_rate (&sh7372_dv_clki_clk,27000000 ); -} - -static struct sys_timer ap4evb_timer = { - .init = ap4evb_timer_init, -}; -MACHINE_START (AP4EVB ,"ap4evb" ) .map_io = shmobile_map_io, .init_irq = sh7372_init_irq, .handle_irq = shmobile_handle_irq_intc, .init_early = ap4evb_init_early, .init_machine = ap4evb_init, - .timer = &ap4evb_timer,MACHINE_END
arch/arm/mach-shmobile/board-g3evm.c +1 -11
@@ -249,6 +249,7 @@ static void __init g3evm_init_early(void)/* setup early devices and console here as well */ sh7367_add_early_devices ();shmobile_setup_console (); +sh7367_clock_init (); }static void __init g3evm_init (void )
@@ -338,21 +339,10 @@ static void __init g3evm_init(void)platform_add_devices (g3evm_devices,ARRAY_SIZE (g3evm_devices)); } -static void __init g3evm_timer_init (void ) -{ -sh7367_clock_init (); - shmobile_timer.init (); -} - -static struct sys_timer g3evm_timer = { - .init = g3evm_timer_init, -}; -MACHINE_START (G3EVM ,"g3evm" ) .map_io = shmobile_map_io, .init_irq = sh7367_init_irq, .handle_irq = shmobile_handle_irq_intc, .init_early = g3evm_init_early, .init_machine = g3evm_init, - .timer = &g3evm_timer,MACHINE_END
arch/arm/mach-shmobile/board-g4evm.c +1 -11
@@ -263,6 +263,7 @@ static void __init g4evm_init_early(void)/* setup early devices and console here as well */ sh7377_add_early_devices ();shmobile_setup_console (); +sh7377_clock_init (); }#define GPIO_SDHID0_D0 0xe60520fc
@@ -381,21 +382,10 @@ static void __init g4evm_init(void)platform_add_devices (g4evm_devices,ARRAY_SIZE (g4evm_devices)); } -static void __init g4evm_timer_init (void ) -{ -sh7377_clock_init (); - shmobile_timer.init (); -} - -static struct sys_timer g4evm_timer = { - .init = g4evm_timer_init, -}; -MACHINE_START (G4EVM ,"g4evm" ) .map_io = shmobile_map_io, .init_irq = sh7377_init_irq, .handle_irq = shmobile_handle_irq_intc, .init_early = g4evm_init_early, .init_machine = g4evm_init, - .timer = &g4evm_timer,MACHINE_END
arch/arm/mach-shmobile/board-mackerel.c +4 -14
@@ -1011,6 +1011,10 @@ static void __init mackerel_init_early(void)/* setup early devices and console here as well */ sh7372_add_early_devices ();shmobile_setup_console (); +sh7372_clock_init (); + +/* External clock source */ +clk_set_rate (&sh7372_dv_clki_clk,27000000 ); }#define GPIO_PORT9CR 0xE6051009
@@ -1203,24 +1207,10 @@ static void __init mackerel_init(void)hdmi_init_pm_clock (); } -static void __init mackerel_timer_init (void ) -{ -sh7372_clock_init (); - shmobile_timer.init (); - -/* External clock source */ -clk_set_rate (&sh7372_dv_clki_clk,27000000 ); -} - -static struct sys_timer mackerel_timer = { - .init = mackerel_timer_init, -}; -MACHINE_START (MACKEREL ,"mackerel" ) .map_io = shmobile_map_io, .init_irq = sh7372_init_irq, .handle_irq = shmobile_handle_irq_intc, .init_early = mackerel_init_early, .init_machine = mackerel_init, - .timer = &mackerel_timer,MACHINE_END
arch/arm/mach-shmobile/timer.c deleted +0 -46
46 lines not on this page · raw message
Signature · 1 line
1.7.4.1
PATCH v3 1/1 arm: add global early device init
Hi,
Paul, Magnus any feed back?
Best Regards,
J.
Quoted 356 lines · Jean-Christophe PLAGNIOL-VILLARD
this will init earlytimer and will try to probe 1 or 2 timers for clockevents and clocksource
This will also allow to share timer cross arch such as sh-mobile and sh
all arm timers will be update to early device step by step
on ARM sh-mobile we do not need to use the
late_time_initas the irq are setup before the probe of the timerstested on at91sam9263-ek, at91rm9200-ek
Signed-off-by Jean-Christophe PLAGNIOL-VILLARD <[email protected]>Cc Russell King <[email protected]>Cc Paul Mundt <[email protected]>Cc Magnus Damm <[email protected]>Cc Nicolas Ferre <[email protected]>Cc Patrice Vilchez <[email protected]>---
V3:
now we can do not specify the .timer at all and just realy on the early deviceon ARM sh-mobile we do not need to use the
late_time_initas the irq are setup before the probe of the timersthe only remaing question is is ok to move the
clock_initin the .init_early on sh-mobilethis patch depends on [PATCH] shmobile: fix
map_ioinit usageBest Regards,
J.arch/arm/kernel/time.c | 28 +++++++++++++++++-- arch/arm/mach-shmobile/Makefile | 2 +- arch/arm/mach-shmobile/board-ag5evm.c | 13 +-------- arch/arm/mach-shmobile/board-ap4evb.c | 18 +++--------- arch/arm/mach-shmobile/board-g3evm.c | 12 +------- arch/arm/mach-shmobile/board-g4evm.c | 12 +------- arch/arm/mach-shmobile/board-mackerel.c | 18 +++--------- arch/arm/mach-shmobile/timer.c | 46 ------------------------------- 8 files changed, 37 insertions(+), 112 deletions(-) delete mode 100644 arch/arm/mach-shmobile/timer.carch/arm/kernel/time.c +25
-3@@ -13,6 +13,7 @@*/ #include <linux/module.h> #include <linux/kernel.h> +#include <linux/platform_device.h> #include <linux/interrupt.h> #include <linux/time.h> #include <linux/init.h> @@ -77,6 +78,9 @@ EXPORT_SYMBOL(profile_pc);#ifdef CONFIG_ARCH_USES_GETTIMEOFFSET u32 arch_gettimeoffset (void ) { +if (!system_timer) +return 0 ; +if (system_timer->offset !=NULL )return system_timer->offset () *1000 ;@@ -147,7 +151,12 @@ static struct sysdev_class timer_sysclass = {static int __init timer_init_sysfs (void ) { -int ret =sysdev_class_register (&timer_sysclass); +int ret; + +if (!system_timer) +return 0 ; + + ret =sysdev_class_register (&timer_sysclass);if (ret ==0 ) { system_timer->dev.cls = &timer_sysclass; ret =sysdev_register (&system_timer->dev);@@ -161,9 +170,22 @@ device_initcall(timer_init_sysfs);void __init time_init (void ) { system_timer = machine_desc->timer; - system_timer->init (); +if (system_timer && system_timer->init) + system_timer->init (); + +/* +* Make sure all compiled-in early timers register themselves. +* +* Run probe() for two "earlytimer" devices, these will be the +* clockevents and clocksource devices respectively. In the event +* that only a clockevents device is available, we -ENODEV on the +* clocksource and the jiffies clocksource is used transparently +* instead. No error handling is necessary here. +*/ +early_platform_driver_register_all ("earlytimer" ); +early_platform_driver_probe ("earlytimer" ,2 ,0 ); +#ifdef CONFIG_HAVE_SCHED_CLOCK sched_clock_postinit ();#endif } -arch/arm/mach-shmobile/Makefile +1
-1@@ -3,7 +3,7 @@ # # Common objects -obj-y := map_io.o timer.o console.o clock.o pm_runtime.o +obj-y := map_io.o console.o clock.o pm_runtime.o # CPU objects obj-$(CONFIG_ARCH_SH7367) += setup-sh7367.o clock-sh7367.o intc-sh7367.oarch/arm/mach-shmobile/board-ag5evm.c +1
-12@@ -339,6 +339,7 @@ static void __init ag5evm_init_early(void)/* setup early devices and console here as well */ sh73a0_add_early_devices ();shmobile_setup_console (); +sh73a0_clock_init (); }#define PINTC_ADDR 0xe6900000@@ -447,22 +448,10 @@ static void __init ag5evm_init(void)platform_add_devices (ag5evm_devices,ARRAY_SIZE (ag5evm_devices)); } -static void __init ag5evm_timer_init (void ) -{ -sh73a0_clock_init (); - shmobile_timer.init (); -return ; -} - -struct sys_timer ag5evm_timer = { - .init = ag5evm_timer_init, -}; -MACHINE_START (AG5EVM ,"ag5evm" ) .map_io = shmobile_map_io, .init_irq = ag5evm_init_irq, .handle_irq = shmobile_handle_irq_gic, .init_early = ag5evm_init_early, .init_machine = ag5evm_init, - .timer = &ag5evm_timer,MACHINE_END arch/arm/mach-shmobile/board-ap4evb.c +4
-14@@ -1096,6 +1096,10 @@ static void __init ap4evb_init_early(void)/* setup early devices and console here as well */ sh7372_add_early_devices ();shmobile_setup_console (); +sh7372_clock_init (); + +/* External clock source */ +clk_set_rate (&sh7372_dv_clki_clk,27000000 ); }#define GPIO_PORT9CR 0xE6051009@@ -1330,24 +1334,10 @@ static void __init ap4evb_init(void)fsi_init_pm_clock (); } -static void __init ap4evb_timer_init (void ) -{ -sh7372_clock_init (); - shmobile_timer.init (); - -/* External clock source */ -clk_set_rate (&sh7372_dv_clki_clk,27000000 ); -} - -static struct sys_timer ap4evb_timer = { - .init = ap4evb_timer_init, -}; -MACHINE_START (AP4EVB ,"ap4evb" ) .map_io = shmobile_map_io, .init_irq = sh7372_init_irq, .handle_irq = shmobile_handle_irq_intc, .init_early = ap4evb_init_early, .init_machine = ap4evb_init, - .timer = &ap4evb_timer,MACHINE_END arch/arm/mach-shmobile/board-g3evm.c +1
-11@@ -249,6 +249,7 @@ static void __init g3evm_init_early(void)/* setup early devices and console here as well */ sh7367_add_early_devices ();shmobile_setup_console (); +sh7367_clock_init (); }static void __init g3evm_init (void )@@ -338,21 +339,10 @@ static void __init g3evm_init(void)platform_add_devices (g3evm_devices,ARRAY_SIZE (g3evm_devices)); } -static void __init g3evm_timer_init (void ) -{ -sh7367_clock_init (); - shmobile_timer.init (); -} - -static struct sys_timer g3evm_timer = { - .init = g3evm_timer_init, -}; -MACHINE_START (G3EVM ,"g3evm" ) .map_io = shmobile_map_io, .init_irq = sh7367_init_irq, .handle_irq = shmobile_handle_irq_intc, .init_early = g3evm_init_early, .init_machine = g3evm_init, - .timer = &g3evm_timer,MACHINE_END arch/arm/mach-shmobile/board-g4evm.c +1
-11@@ -263,6 +263,7 @@ static void __init g4evm_init_early(void)/* setup early devices and console here as well */ sh7377_add_early_devices ();shmobile_setup_console (); +sh7377_clock_init (); }#define GPIO_SDHID0_D0 0xe60520fc@@ -381,21 +382,10 @@ static void __init g4evm_init(void)platform_add_devices (g4evm_devices,ARRAY_SIZE (g4evm_devices)); } -static void __init g4evm_timer_init (void ) -{ -sh7377_clock_init (); - shmobile_timer.init (); -} - -static struct sys_timer g4evm_timer = { - .init = g4evm_timer_init, -}; -MACHINE_START (G4EVM ,"g4evm" ) .map_io = shmobile_map_io, .init_irq = sh7377_init_irq, .handle_irq = shmobile_handle_irq_intc, .init_early = g4evm_init_early, .init_machine = g4evm_init, - .timer = &g4evm_timer,MACHINE_END arch/arm/mach-shmobile/board-mackerel.c +4
-14@@ -1011,6 +1011,10 @@ static void __init mackerel_init_early(void)/* setup early devices and console here as well */ sh7372_add_early_devices ();shmobile_setup_console (); +sh7372_clock_init (); + +/* External clock source */ +clk_set_rate (&sh7372_dv_clki_clk,27000000 ); }#define GPIO_PORT9CR 0xE6051009@@ -1203,24 +1207,10 @@ static void __init mackerel_init(void)hdmi_init_pm_clock (); } -static void __init mackerel_timer_init (void ) -{ -sh7372_clock_init (); - shmobile_timer.init (); - -/* External clock source */ -clk_set_rate (&sh7372_dv_clki_clk,27000000 ); -} - -static struct sys_timer mackerel_timer = { - .init = mackerel_timer_init, -}; -MACHINE_START (MACKEREL ,"mackerel" ) .map_io = shmobile_map_io, .init_irq = sh7372_init_irq, .handle_irq = shmobile_handle_irq_intc, .init_early = mackerel_init_early, .init_machine = mackerel_init, - .timer = &mackerel_timer,MACHINE_END arch/arm/mach-shmobile/timer.c deleted +0
-46@@ -1,46 +0,0 @@ -/* -* SH-Mobile Timer -* -* Copyright (C) 2010 Magnus Damm -* Copyright (C) 2002 - 2009 Paul Mundt -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; version 2 of the License. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program; if not, write to the Free Software -* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -* -*/ -#include <linux/platform_device.h> -#include <asm/mach/time.h> - -static void __init shmobile_late_time_init (void ) -{ -/* -* Make sure all compiled-in early timers register themselves. -* -* Run probe() for two "earlytimer" devices, these will be the -* clockevents and clocksource devices respectively. In the event -* that only a clockevents device is available, we -ENODEV on the -* clocksource and the jiffies clocksource is used transparently -* instead. No error handling is necessary here. -*/ -early_platform_driver_register_all ("earlytimer" ); -early_platform_driver_probe ("earlytimer" ,2 ,0 ); -} - -static void __init shmobile_timer_init (void ) -{ - late_time_init = shmobile_late_time_init; -} - -struct sys_timer shmobile_timer = { - .init = shmobile_timer_init, -};Signature · 1 line
1.7.4.1