diff options
author | Jonas Aaberg <jonas.aberg@stericsson.com> | 2011-09-14 09:10:54 +0200 |
---|---|---|
committer | Robert Marklund <robert.marklund@stericsson.com> | 2011-10-05 12:59:46 +0200 |
commit | 9b3f25ae50c6b7bd31ea2fbf9ababf26061c88a5 (patch) | |
tree | 677df232948896ecd3b22ae9ccc72794454b8ffb /arch | |
parent | a54d0f7b6f687c64880925e2d8c482f8dcfb7354 (diff) |
ARM: ux500: Move timer code to separate file
Change-Id: I6feb51cc17ba83bb6b49bec9576bfef70d7af7b7
Signed-off-by: Jonas Aaberg <jonas.aberg@stericsson.com>
Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/32054
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/mach-ux500/Makefile | 2 | ||||
-rw-r--r-- | arch/arm/mach-ux500/cpu.c | 34 | ||||
-rw-r--r-- | arch/arm/mach-ux500/timer.c | 58 |
3 files changed, 59 insertions, 35 deletions
diff --git a/arch/arm/mach-ux500/Makefile b/arch/arm/mach-ux500/Makefile index 3a33f666251..165bd7fbd63 100644 --- a/arch/arm/mach-ux500/Makefile +++ b/arch/arm/mach-ux500/Makefile @@ -4,7 +4,7 @@ obj-y := clock.o cpu.o devices.o dcache.o \ devices-common.o id.o pins.o \ - usb.o reboot_reasons.o + usb.o reboot_reasons.o timer.o obj-y += pm/ obj-$(CONFIG_REGULATOR) += regulator-ux500.o diff --git a/arch/arm/mach-ux500/cpu.c b/arch/arm/mach-ux500/cpu.c index 4f5d72f4ea8..76d8d095189 100644 --- a/arch/arm/mach-ux500/cpu.c +++ b/arch/arm/mach-ux500/cpu.c @@ -17,7 +17,6 @@ #include <asm/mach/map.h> #include <asm/localtimer.h> -#include <plat/mtu.h> #include <mach/hardware.h> #include <mach/setup.h> #include <mach/devices.h> @@ -32,39 +31,6 @@ void __iomem *_PRCMU_BASE; static void __iomem *l2x0_base; #endif -static void __init ux500_timer_init(void) -{ -#ifdef CONFIG_LOCAL_TIMERS - /* Setup the local timer base */ - if (cpu_is_u5500()) - twd_base = __io_address(U5500_TWD_BASE); - else if (cpu_is_u8500()) - twd_base = __io_address(U8500_TWD_BASE); - else - ux500_unknown_soc(); -#endif - if (cpu_is_u5500()) - mtu_base = __io_address(U5500_MTU0_BASE); - else if (cpu_is_u8500()) - mtu_base = __io_address(U8500_MTU0_BASE); - else - ux500_unknown_soc(); - - if (cpu_is_u8500()) - clksrc_dbx500_timer_base = __io_address(U8500_PRCMU_TIMER_4_BASE); - else if (cpu_is_u5500()) - clksrc_dbx500_timer_base = __io_address(U5500_PRCMU_TIMER_3_BASE); - else - ux500_unknown_soc(); - - nmdk_timer_init(); - clksrc_dbx500_prcmu_init(); -} - -struct sys_timer ux500_timer = { - .init = ux500_timer_init, -}; - void __init ux500_init_devices(void) { #ifdef CONFIG_CACHE_L2X0 diff --git a/arch/arm/mach-ux500/timer.c b/arch/arm/mach-ux500/timer.c new file mode 100644 index 00000000000..36a82bf57d5 --- /dev/null +++ b/arch/arm/mach-ux500/timer.c @@ -0,0 +1,58 @@ +/* + * Copyright (C) ST-Ericsson SA 2011 + * + * License Terms: GNU General Public License v2 + * Author: Mattias Wallin <mattias.wallin@stericsson.com> for ST-Ericsson + */ +#include <linux/io.h> +#include <linux/clksrc-dbx500-prcmu.h> + +#include <asm/localtimer.h> + +#include <plat/mtu.h> + +#include <mach/setup.h> +#include <mach/hardware.h> + +static void __init ux500_timer_init(void) +{ + if (cpu_is_u5500()) { +#ifdef CONFIG_LOCAL_TIMERS + twd_base = __io_address(U5500_TWD_BASE); +#endif + mtu_base = __io_address(U5500_MTU0_BASE); + clksrc_dbx500_timer_base = __io_address(U5500_PRCMU_TIMER_3_BASE); + } else if (cpu_is_u8500()) { +#ifdef CONFIG_LOCAL_TIMERS + twd_base = __io_address(U8500_TWD_BASE); +#endif + mtu_base = __io_address(U8500_MTU0_BASE); + clksrc_dbx500_timer_base = __io_address(U8500_PRCMU_TIMER_4_BASE); + } else { + ux500_unknown_soc(); + } + + /* + * Here we register the timerblocks active in the system. + * Localtimers (twd) is started when both cpu is up and running. + * MTU register a clocksource, clockevent and sched_clock. + * Since the MTU is located in the VAPE power domain + * it will be cleared in sleep which makes it unsuitable. + * We however need it as a timer tick (clockevent) + * during boot to calibrate delay until twd is started. + * RTC-RTT have problems as timer tick during boot since it is + * depending on delay which is not yet calibrated. RTC-RTT is in the + * always-on powerdomain and is used as clockevent instead of twd when + * sleeping. + * The PRCMU timer 4(3 for DB5500) register a clocksource and + * sched_clock with higher rating then MTU since is always-on. + * + */ + + nmdk_timer_init(); + clksrc_dbx500_prcmu_init(); +} + +struct sys_timer ux500_timer = { + .init = ux500_timer_init, +}; |