diff options
author | Arnd Bergmann <arnd@arndb.de> | 2012-03-13 07:52:58 -0400 |
---|---|---|
committer | Arnd Bergmann <arnd@arndb.de> | 2012-03-13 07:52:58 -0400 |
commit | 69adb983ce0639d02c87aa9947663d5ad50116d0 (patch) | |
tree | 5c5193d230f43236fa2a1f24221c96dc5d413a06 /arch/arm | |
parent | b01543dfe67bb1d191998e90d20534dc354de059 (diff) | |
parent | 0ee411aebe9c14aedb3aef54164b941471177b1c (diff) |
Merge branch 'ux500/timers' into next/timer
* ux500/timers:
ARM: plat-nomadik: modernize MTU timer
ARM: plat-nomadik: handle clocking properly
ARM: plat-nomadik: get rid of global mtu base pointer
Diffstat (limited to 'arch/arm')
-rw-r--r-- | arch/arm/mach-nomadik/board-nhk8815.c | 7 | ||||
-rw-r--r-- | arch/arm/mach-nomadik/include/mach/setup.h | 19 | ||||
-rw-r--r-- | arch/arm/mach-ux500/include/mach/setup.h | 3 | ||||
-rw-r--r-- | arch/arm/mach-ux500/timer.c | 7 | ||||
-rw-r--r-- | arch/arm/plat-nomadik/include/plat/mtu.h | 4 | ||||
-rw-r--r-- | arch/arm/plat-nomadik/timer.c | 33 |
6 files changed, 15 insertions, 58 deletions
diff --git a/arch/arm/mach-nomadik/board-nhk8815.c b/arch/arm/mach-nomadik/board-nhk8815.c index 7c878bf00340..b77cb8465d31 100644 --- a/arch/arm/mach-nomadik/board-nhk8815.c +++ b/arch/arm/mach-nomadik/board-nhk8815.c | |||
@@ -27,11 +27,11 @@ | |||
27 | #include <asm/mach/arch.h> | 27 | #include <asm/mach/arch.h> |
28 | #include <asm/mach/irq.h> | 28 | #include <asm/mach/irq.h> |
29 | #include <asm/mach/flash.h> | 29 | #include <asm/mach/flash.h> |
30 | #include <asm/mach/time.h> | ||
30 | 31 | ||
31 | #include <plat/gpio-nomadik.h> | 32 | #include <plat/gpio-nomadik.h> |
32 | #include <plat/mtu.h> | 33 | #include <plat/mtu.h> |
33 | 34 | ||
34 | #include <mach/setup.h> | ||
35 | #include <mach/nand.h> | 35 | #include <mach/nand.h> |
36 | #include <mach/fsmc.h> | 36 | #include <mach/fsmc.h> |
37 | 37 | ||
@@ -255,10 +255,7 @@ static void __init nomadik_timer_init(void) | |||
255 | src_cr |= SRC_CR_INIT_VAL; | 255 | src_cr |= SRC_CR_INIT_VAL; |
256 | writel(src_cr, io_p2v(NOMADIK_SRC_BASE)); | 256 | writel(src_cr, io_p2v(NOMADIK_SRC_BASE)); |
257 | 257 | ||
258 | /* Save global pointer to mtu, used by platform timer code */ | 258 | nmdk_timer_init(io_p2v(NOMADIK_MTU0_BASE)); |
259 | mtu_base = io_p2v(NOMADIK_MTU0_BASE); | ||
260 | |||
261 | nmdk_timer_init(); | ||
262 | } | 259 | } |
263 | 260 | ||
264 | static struct sys_timer nomadik_timer = { | 261 | static struct sys_timer nomadik_timer = { |
diff --git a/arch/arm/mach-nomadik/include/mach/setup.h b/arch/arm/mach-nomadik/include/mach/setup.h deleted file mode 100644 index bcaeaf41c053..000000000000 --- a/arch/arm/mach-nomadik/include/mach/setup.h +++ /dev/null | |||
@@ -1,19 +0,0 @@ | |||
1 | |||
2 | /* | ||
3 | * These symbols are needed for board-specific files to call their | ||
4 | * own cpu-specific files | ||
5 | */ | ||
6 | |||
7 | #ifndef __ASM_ARCH_SETUP_H | ||
8 | #define __ASM_ARCH_SETUP_H | ||
9 | |||
10 | #include <asm/mach/time.h> | ||
11 | #include <linux/init.h> | ||
12 | |||
13 | #ifdef CONFIG_NOMADIK_8815 | ||
14 | |||
15 | extern void nmdk_timer_init(void); | ||
16 | |||
17 | #endif /* NOMADIK_8815 */ | ||
18 | |||
19 | #endif /* __ASM_ARCH_SETUP_H */ | ||
diff --git a/arch/arm/mach-ux500/include/mach/setup.h b/arch/arm/mach-ux500/include/mach/setup.h index a7d363fdb4cd..93d403955eaa 100644 --- a/arch/arm/mach-ux500/include/mach/setup.h +++ b/arch/arm/mach-ux500/include/mach/setup.h | |||
@@ -27,9 +27,6 @@ extern void __init u5500_sdi_init(void); | |||
27 | 27 | ||
28 | extern void __init db5500_dma_init(void); | 28 | extern void __init db5500_dma_init(void); |
29 | 29 | ||
30 | /* We re-use nomadik_timer for this platform */ | ||
31 | extern void nmdk_timer_init(void); | ||
32 | |||
33 | struct amba_device; | 30 | struct amba_device; |
34 | extern void __init amba_add_devices(struct amba_device *devs[], int num); | 31 | extern void __init amba_add_devices(struct amba_device *devs[], int num); |
35 | 32 | ||
diff --git a/arch/arm/mach-ux500/timer.c b/arch/arm/mach-ux500/timer.c index aea467d04ff7..fd0002431122 100644 --- a/arch/arm/mach-ux500/timer.c +++ b/arch/arm/mach-ux500/timer.c | |||
@@ -17,19 +17,20 @@ | |||
17 | 17 | ||
18 | static void __init ux500_timer_init(void) | 18 | static void __init ux500_timer_init(void) |
19 | { | 19 | { |
20 | void __iomem *mtu_timer_base; | ||
20 | void __iomem *prcmu_timer_base; | 21 | void __iomem *prcmu_timer_base; |
21 | 22 | ||
22 | if (cpu_is_u5500()) { | 23 | if (cpu_is_u5500()) { |
23 | #ifdef CONFIG_LOCAL_TIMERS | 24 | #ifdef CONFIG_LOCAL_TIMERS |
24 | twd_base = __io_address(U5500_TWD_BASE); | 25 | twd_base = __io_address(U5500_TWD_BASE); |
25 | #endif | 26 | #endif |
26 | mtu_base = __io_address(U5500_MTU0_BASE); | 27 | mtu_timer_base = __io_address(U5500_MTU0_BASE); |
27 | prcmu_timer_base = __io_address(U5500_PRCMU_TIMER_3_BASE); | 28 | prcmu_timer_base = __io_address(U5500_PRCMU_TIMER_3_BASE); |
28 | } else if (cpu_is_u8500()) { | 29 | } else if (cpu_is_u8500()) { |
29 | #ifdef CONFIG_LOCAL_TIMERS | 30 | #ifdef CONFIG_LOCAL_TIMERS |
30 | twd_base = __io_address(U8500_TWD_BASE); | 31 | twd_base = __io_address(U8500_TWD_BASE); |
31 | #endif | 32 | #endif |
32 | mtu_base = __io_address(U8500_MTU0_BASE); | 33 | mtu_timer_base = __io_address(U8500_MTU0_BASE); |
33 | prcmu_timer_base = __io_address(U8500_PRCMU_TIMER_4_BASE); | 34 | prcmu_timer_base = __io_address(U8500_PRCMU_TIMER_4_BASE); |
34 | } else { | 35 | } else { |
35 | ux500_unknown_soc(); | 36 | ux500_unknown_soc(); |
@@ -52,7 +53,7 @@ static void __init ux500_timer_init(void) | |||
52 | * | 53 | * |
53 | */ | 54 | */ |
54 | 55 | ||
55 | nmdk_timer_init(); | 56 | nmdk_timer_init(mtu_timer_base); |
56 | clksrc_dbx500_prcmu_init(prcmu_timer_base); | 57 | clksrc_dbx500_prcmu_init(prcmu_timer_base); |
57 | } | 58 | } |
58 | 59 | ||
diff --git a/arch/arm/plat-nomadik/include/plat/mtu.h b/arch/arm/plat-nomadik/include/plat/mtu.h index 6508e7694a4b..582641f3dc01 100644 --- a/arch/arm/plat-nomadik/include/plat/mtu.h +++ b/arch/arm/plat-nomadik/include/plat/mtu.h | |||
@@ -1,9 +1,7 @@ | |||
1 | #ifndef __PLAT_MTU_H | 1 | #ifndef __PLAT_MTU_H |
2 | #define __PLAT_MTU_H | 2 | #define __PLAT_MTU_H |
3 | 3 | ||
4 | /* should be set by the platform code */ | 4 | void nmdk_timer_init(void __iomem *base); |
5 | extern void __iomem *mtu_base; | ||
6 | |||
7 | void nmdk_clkevt_reset(void); | 5 | void nmdk_clkevt_reset(void); |
8 | void nmdk_clksrc_reset(void); | 6 | void nmdk_clksrc_reset(void); |
9 | 7 | ||
diff --git a/arch/arm/plat-nomadik/timer.c b/arch/arm/plat-nomadik/timer.c index ad1b45b605a4..9222e5522a43 100644 --- a/arch/arm/plat-nomadik/timer.c +++ b/arch/arm/plat-nomadik/timer.c | |||
@@ -21,12 +21,6 @@ | |||
21 | #include <asm/sched_clock.h> | 21 | #include <asm/sched_clock.h> |
22 | 22 | ||
23 | /* | 23 | /* |
24 | * Guaranteed runtime conversion range in seconds for | ||
25 | * the clocksource and clockevent. | ||
26 | */ | ||
27 | #define MTU_MIN_RANGE 4 | ||
28 | |||
29 | /* | ||
30 | * The MTU device hosts four different counters, with 4 set of | 24 | * The MTU device hosts four different counters, with 4 set of |
31 | * registers. These are register names. | 25 | * registers. These are register names. |
32 | */ | 26 | */ |
@@ -66,12 +60,11 @@ | |||
66 | #define MTU_PCELL2 0xff8 | 60 | #define MTU_PCELL2 0xff8 |
67 | #define MTU_PCELL3 0xffC | 61 | #define MTU_PCELL3 0xffC |
68 | 62 | ||
63 | static void __iomem *mtu_base; | ||
69 | static bool clkevt_periodic; | 64 | static bool clkevt_periodic; |
70 | static u32 clk_prescale; | 65 | static u32 clk_prescale; |
71 | static u32 nmdk_cycle; /* write-once */ | 66 | static u32 nmdk_cycle; /* write-once */ |
72 | 67 | ||
73 | void __iomem *mtu_base; /* Assigned by machine code */ | ||
74 | |||
75 | #ifdef CONFIG_NOMADIK_MTU_SCHED_CLOCK | 68 | #ifdef CONFIG_NOMADIK_MTU_SCHED_CLOCK |
76 | /* | 69 | /* |
77 | * Override the global weak sched_clock symbol with this | 70 | * Override the global weak sched_clock symbol with this |
@@ -103,7 +96,6 @@ static int nmdk_clkevt_next(unsigned long evt, struct clock_event_device *ev) | |||
103 | void nmdk_clkevt_reset(void) | 96 | void nmdk_clkevt_reset(void) |
104 | { | 97 | { |
105 | if (clkevt_periodic) { | 98 | if (clkevt_periodic) { |
106 | |||
107 | /* Timer: configure load and background-load, and fire it up */ | 99 | /* Timer: configure load and background-load, and fire it up */ |
108 | writel(nmdk_cycle, mtu_base + MTU_LR(1)); | 100 | writel(nmdk_cycle, mtu_base + MTU_LR(1)); |
109 | writel(nmdk_cycle, mtu_base + MTU_BGLR(1)); | 101 | writel(nmdk_cycle, mtu_base + MTU_BGLR(1)); |
@@ -121,7 +113,6 @@ void nmdk_clkevt_reset(void) | |||
121 | static void nmdk_clkevt_mode(enum clock_event_mode mode, | 113 | static void nmdk_clkevt_mode(enum clock_event_mode mode, |
122 | struct clock_event_device *dev) | 114 | struct clock_event_device *dev) |
123 | { | 115 | { |
124 | |||
125 | switch (mode) { | 116 | switch (mode) { |
126 | case CLOCK_EVT_MODE_PERIODIC: | 117 | case CLOCK_EVT_MODE_PERIODIC: |
127 | clkevt_periodic = true; | 118 | clkevt_periodic = true; |
@@ -183,15 +174,16 @@ void nmdk_clksrc_reset(void) | |||
183 | mtu_base + MTU_CR(0)); | 174 | mtu_base + MTU_CR(0)); |
184 | } | 175 | } |
185 | 176 | ||
186 | void __init nmdk_timer_init(void) | 177 | void __init nmdk_timer_init(void __iomem *base) |
187 | { | 178 | { |
188 | unsigned long rate; | 179 | unsigned long rate; |
189 | struct clk *clk0; | 180 | struct clk *clk0; |
190 | 181 | ||
182 | mtu_base = base; | ||
191 | clk0 = clk_get_sys("mtu0", NULL); | 183 | clk0 = clk_get_sys("mtu0", NULL); |
192 | BUG_ON(IS_ERR(clk0)); | 184 | BUG_ON(IS_ERR(clk0)); |
193 | 185 | BUG_ON(clk_prepare(clk0) < 0); | |
194 | clk_enable(clk0); | 186 | BUG_ON(clk_enable(clk0) < 0); |
195 | 187 | ||
196 | /* | 188 | /* |
197 | * Tick rate is 2.4MHz for Nomadik and 2.4Mhz, 100MHz or 133 MHz | 189 | * Tick rate is 2.4MHz for Nomadik and 2.4Mhz, 100MHz or 133 MHz |
@@ -224,17 +216,8 @@ void __init nmdk_timer_init(void) | |||
224 | setup_sched_clock(nomadik_read_sched_clock, 32, rate); | 216 | setup_sched_clock(nomadik_read_sched_clock, 32, rate); |
225 | #endif | 217 | #endif |
226 | 218 | ||
227 | /* Timer 1 is used for events */ | 219 | /* Timer 1 is used for events, register irq and clockevents */ |
228 | |||
229 | clockevents_calc_mult_shift(&nmdk_clkevt, rate, MTU_MIN_RANGE); | ||
230 | |||
231 | nmdk_clkevt.max_delta_ns = | ||
232 | clockevent_delta2ns(0xffffffff, &nmdk_clkevt); | ||
233 | nmdk_clkevt.min_delta_ns = | ||
234 | clockevent_delta2ns(0x00000002, &nmdk_clkevt); | ||
235 | nmdk_clkevt.cpumask = cpumask_of(0); | ||
236 | |||
237 | /* Register irq and clockevents */ | ||
238 | setup_irq(IRQ_MTU0, &nmdk_timer_irq); | 220 | setup_irq(IRQ_MTU0, &nmdk_timer_irq); |
239 | clockevents_register_device(&nmdk_clkevt); | 221 | nmdk_clkevt.cpumask = cpumask_of(0); |
222 | clockevents_config_and_register(&nmdk_clkevt, rate, 2, 0xffffffffU); | ||
240 | } | 223 | } |