diff options
Diffstat (limited to 'arch/arm/plat-nomadik/timer.c')
-rw-r--r-- | arch/arm/plat-nomadik/timer.c | 50 |
1 files changed, 47 insertions, 3 deletions
diff --git a/arch/arm/plat-nomadik/timer.c b/arch/arm/plat-nomadik/timer.c index a04b5215b6d8..30b6433d910d 100644 --- a/arch/arm/plat-nomadik/timer.c +++ b/arch/arm/plat-nomadik/timer.c | |||
@@ -21,7 +21,51 @@ | |||
21 | #include <asm/mach/time.h> | 21 | #include <asm/mach/time.h> |
22 | #include <asm/sched_clock.h> | 22 | #include <asm/sched_clock.h> |
23 | 23 | ||
24 | #include <plat/mtu.h> | 24 | /* |
25 | * Guaranteed runtime conversion range in seconds for | ||
26 | * the clocksource and clockevent. | ||
27 | */ | ||
28 | #define MTU_MIN_RANGE 4 | ||
29 | |||
30 | /* | ||
31 | * The MTU device hosts four different counters, with 4 set of | ||
32 | * registers. These are register names. | ||
33 | */ | ||
34 | |||
35 | #define MTU_IMSC 0x00 /* Interrupt mask set/clear */ | ||
36 | #define MTU_RIS 0x04 /* Raw interrupt status */ | ||
37 | #define MTU_MIS 0x08 /* Masked interrupt status */ | ||
38 | #define MTU_ICR 0x0C /* Interrupt clear register */ | ||
39 | |||
40 | /* per-timer registers take 0..3 as argument */ | ||
41 | #define MTU_LR(x) (0x10 + 0x10 * (x) + 0x00) /* Load value */ | ||
42 | #define MTU_VAL(x) (0x10 + 0x10 * (x) + 0x04) /* Current value */ | ||
43 | #define MTU_CR(x) (0x10 + 0x10 * (x) + 0x08) /* Control reg */ | ||
44 | #define MTU_BGLR(x) (0x10 + 0x10 * (x) + 0x0c) /* At next overflow */ | ||
45 | |||
46 | /* bits for the control register */ | ||
47 | #define MTU_CRn_ENA 0x80 | ||
48 | #define MTU_CRn_PERIODIC 0x40 /* if 0 = free-running */ | ||
49 | #define MTU_CRn_PRESCALE_MASK 0x0c | ||
50 | #define MTU_CRn_PRESCALE_1 0x00 | ||
51 | #define MTU_CRn_PRESCALE_16 0x04 | ||
52 | #define MTU_CRn_PRESCALE_256 0x08 | ||
53 | #define MTU_CRn_32BITS 0x02 | ||
54 | #define MTU_CRn_ONESHOT 0x01 /* if 0 = wraps reloading from BGLR*/ | ||
55 | |||
56 | /* Other registers are usual amba/primecell registers, currently not used */ | ||
57 | #define MTU_ITCR 0xff0 | ||
58 | #define MTU_ITOP 0xff4 | ||
59 | |||
60 | #define MTU_PERIPH_ID0 0xfe0 | ||
61 | #define MTU_PERIPH_ID1 0xfe4 | ||
62 | #define MTU_PERIPH_ID2 0xfe8 | ||
63 | #define MTU_PERIPH_ID3 0xfeC | ||
64 | |||
65 | #define MTU_PCELL0 0xff0 | ||
66 | #define MTU_PCELL1 0xff4 | ||
67 | #define MTU_PCELL2 0xff8 | ||
68 | #define MTU_PCELL3 0xffC | ||
25 | 69 | ||
26 | static bool clkevt_periodic; | 70 | static bool clkevt_periodic; |
27 | static u32 clk_prescale; | 71 | static u32 clk_prescale; |
@@ -68,7 +112,7 @@ static int nmdk_clkevt_next(unsigned long evt, struct clock_event_device *ev) | |||
68 | return 0; | 112 | return 0; |
69 | } | 113 | } |
70 | 114 | ||
71 | static void nmdk_clkevt_reset(void) | 115 | void nmdk_clkevt_reset(void) |
72 | { | 116 | { |
73 | if (clkevt_periodic) { | 117 | if (clkevt_periodic) { |
74 | 118 | ||
@@ -138,7 +182,7 @@ static struct irqaction nmdk_timer_irq = { | |||
138 | .dev_id = &nmdk_clkevt, | 182 | .dev_id = &nmdk_clkevt, |
139 | }; | 183 | }; |
140 | 184 | ||
141 | static void nmdk_clksrc_reset(void) | 185 | void nmdk_clksrc_reset(void) |
142 | { | 186 | { |
143 | /* Disable */ | 187 | /* Disable */ |
144 | writel(0, mtu_base + MTU_CR(0)); | 188 | writel(0, mtu_base + MTU_CR(0)); |