diff options
-rw-r--r-- | arch/arm/mach-ux500/Makefile | 2 | ||||
-rw-r--r-- | arch/arm/mach-ux500/cpu.c | 36 | ||||
-rw-r--r-- | arch/arm/mach-ux500/timer.c | 58 |
3 files changed, 59 insertions, 37 deletions
diff --git a/arch/arm/mach-ux500/Makefile b/arch/arm/mach-ux500/Makefile index 1694916e6822..be915a1ac404 100644 --- a/arch/arm/mach-ux500/Makefile +++ b/arch/arm/mach-ux500/Makefile | |||
@@ -3,7 +3,7 @@ | |||
3 | # | 3 | # |
4 | 4 | ||
5 | obj-y := clock.o cpu.o devices.o devices-common.o \ | 5 | obj-y := clock.o cpu.o devices.o devices-common.o \ |
6 | id.o usb.o | 6 | id.o usb.o timer.o |
7 | obj-$(CONFIG_UX500_SOC_DB5500) += cpu-db5500.o dma-db5500.o | 7 | obj-$(CONFIG_UX500_SOC_DB5500) += cpu-db5500.o dma-db5500.o |
8 | obj-$(CONFIG_UX500_SOC_DB8500) += cpu-db8500.o devices-db8500.o | 8 | obj-$(CONFIG_UX500_SOC_DB8500) += cpu-db8500.o devices-db8500.o |
9 | obj-$(CONFIG_MACH_U8500) += board-mop500.o board-mop500-sdi.o \ | 9 | obj-$(CONFIG_MACH_U8500) += board-mop500.o board-mop500-sdi.o \ |
diff --git a/arch/arm/mach-ux500/cpu.c b/arch/arm/mach-ux500/cpu.c index c0e4593f7719..797f3642fc30 100644 --- a/arch/arm/mach-ux500/cpu.c +++ b/arch/arm/mach-ux500/cpu.c | |||
@@ -18,7 +18,6 @@ | |||
18 | #include <asm/mach/map.h> | 18 | #include <asm/mach/map.h> |
19 | #include <asm/localtimer.h> | 19 | #include <asm/localtimer.h> |
20 | 20 | ||
21 | #include <plat/mtu.h> | ||
22 | #include <mach/hardware.h> | 21 | #include <mach/hardware.h> |
23 | #include <mach/setup.h> | 22 | #include <mach/setup.h> |
24 | #include <mach/devices.h> | 23 | #include <mach/devices.h> |
@@ -120,38 +119,3 @@ static int ux500_l2x0_init(void) | |||
120 | } | 119 | } |
121 | early_initcall(ux500_l2x0_init); | 120 | early_initcall(ux500_l2x0_init); |
122 | #endif | 121 | #endif |
123 | |||
124 | static void __init ux500_timer_init(void) | ||
125 | { | ||
126 | #ifdef CONFIG_LOCAL_TIMERS | ||
127 | /* Setup the local timer base */ | ||
128 | if (cpu_is_u5500()) | ||
129 | twd_base = __io_address(U5500_TWD_BASE); | ||
130 | else if (cpu_is_u8500()) | ||
131 | twd_base = __io_address(U8500_TWD_BASE); | ||
132 | else | ||
133 | ux500_unknown_soc(); | ||
134 | #endif | ||
135 | if (cpu_is_u5500()) | ||
136 | mtu_base = __io_address(U5500_MTU0_BASE); | ||
137 | else if (cpu_is_u8500ed()) | ||
138 | mtu_base = __io_address(U8500_MTU0_BASE_ED); | ||
139 | else if (cpu_is_u8500()) | ||
140 | mtu_base = __io_address(U8500_MTU0_BASE); | ||
141 | else | ||
142 | ux500_unknown_soc(); | ||
143 | |||
144 | if (cpu_is_u8500()) | ||
145 | clksrc_dbx500_timer_base = __io_address(U8500_PRCMU_TIMER_4_BASE); | ||
146 | else if (cpu_is_u5500()) | ||
147 | clksrc_dbx500_timer_base = __io_address(U5500_PRCMU_TIMER_3_BASE); | ||
148 | else | ||
149 | ux500_unknown_soc(); | ||
150 | |||
151 | nmdk_timer_init(); | ||
152 | clksrc_dbx500_prcmu_init(); | ||
153 | } | ||
154 | |||
155 | struct sys_timer ux500_timer = { | ||
156 | .init = ux500_timer_init, | ||
157 | }; | ||
diff --git a/arch/arm/mach-ux500/timer.c b/arch/arm/mach-ux500/timer.c new file mode 100644 index 000000000000..36a82bf57d55 --- /dev/null +++ b/arch/arm/mach-ux500/timer.c | |||
@@ -0,0 +1,58 @@ | |||
1 | /* | ||
2 | * Copyright (C) ST-Ericsson SA 2011 | ||
3 | * | ||
4 | * License Terms: GNU General Public License v2 | ||
5 | * Author: Mattias Wallin <mattias.wallin@stericsson.com> for ST-Ericsson | ||
6 | */ | ||
7 | #include <linux/io.h> | ||
8 | #include <linux/clksrc-dbx500-prcmu.h> | ||
9 | |||
10 | #include <asm/localtimer.h> | ||
11 | |||
12 | #include <plat/mtu.h> | ||
13 | |||
14 | #include <mach/setup.h> | ||
15 | #include <mach/hardware.h> | ||
16 | |||
17 | static void __init ux500_timer_init(void) | ||
18 | { | ||
19 | if (cpu_is_u5500()) { | ||
20 | #ifdef CONFIG_LOCAL_TIMERS | ||
21 | twd_base = __io_address(U5500_TWD_BASE); | ||
22 | #endif | ||
23 | mtu_base = __io_address(U5500_MTU0_BASE); | ||
24 | clksrc_dbx500_timer_base = __io_address(U5500_PRCMU_TIMER_3_BASE); | ||
25 | } else if (cpu_is_u8500()) { | ||
26 | #ifdef CONFIG_LOCAL_TIMERS | ||
27 | twd_base = __io_address(U8500_TWD_BASE); | ||
28 | #endif | ||
29 | mtu_base = __io_address(U8500_MTU0_BASE); | ||
30 | clksrc_dbx500_timer_base = __io_address(U8500_PRCMU_TIMER_4_BASE); | ||
31 | } else { | ||
32 | ux500_unknown_soc(); | ||
33 | } | ||
34 | |||
35 | /* | ||
36 | * Here we register the timerblocks active in the system. | ||
37 | * Localtimers (twd) is started when both cpu is up and running. | ||
38 | * MTU register a clocksource, clockevent and sched_clock. | ||
39 | * Since the MTU is located in the VAPE power domain | ||
40 | * it will be cleared in sleep which makes it unsuitable. | ||
41 | * We however need it as a timer tick (clockevent) | ||
42 | * during boot to calibrate delay until twd is started. | ||
43 | * RTC-RTT have problems as timer tick during boot since it is | ||
44 | * depending on delay which is not yet calibrated. RTC-RTT is in the | ||
45 | * always-on powerdomain and is used as clockevent instead of twd when | ||
46 | * sleeping. | ||
47 | * The PRCMU timer 4(3 for DB5500) register a clocksource and | ||
48 | * sched_clock with higher rating then MTU since is always-on. | ||
49 | * | ||
50 | */ | ||
51 | |||
52 | nmdk_timer_init(); | ||
53 | clksrc_dbx500_prcmu_init(); | ||
54 | } | ||
55 | |||
56 | struct sys_timer ux500_timer = { | ||
57 | .init = ux500_timer_init, | ||
58 | }; | ||