aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/plat-mxc/time.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/plat-mxc/time.c')
-rw-r--r--arch/arm/plat-mxc/time.c46
1 files changed, 23 insertions, 23 deletions
diff --git a/arch/arm/plat-mxc/time.c b/arch/arm/plat-mxc/time.c
index c1ce51abdba6..f9a1b059a76c 100644
--- a/arch/arm/plat-mxc/time.c
+++ b/arch/arm/plat-mxc/time.c
@@ -54,14 +54,14 @@
54#define MX2_TSTAT_COMP (1 << 0) 54#define MX2_TSTAT_COMP (1 << 0)
55 55
56/* MX31, MX35, MX25, MXC91231, MX5 */ 56/* MX31, MX35, MX25, MXC91231, MX5 */
57#define MX3_TCTL_WAITEN (1 << 3) /* Wait enable mode */ 57#define V2_TCTL_WAITEN (1 << 3) /* Wait enable mode */
58#define MX3_TCTL_CLK_IPG (1 << 6) 58#define V2_TCTL_CLK_IPG (1 << 6)
59#define MX3_TCTL_FRR (1 << 9) 59#define V2_TCTL_FRR (1 << 9)
60#define MX3_IR 0x0c 60#define V2_IR 0x0c
61#define MX3_TSTAT 0x08 61#define V2_TSTAT 0x08
62#define MX3_TSTAT_OF1 (1 << 0) 62#define V2_TSTAT_OF1 (1 << 0)
63#define MX3_TCN 0x24 63#define V2_TCN 0x24
64#define MX3_TCMP 0x10 64#define V2_TCMP 0x10
65 65
66#define timer_is_v1() (cpu_is_mx1() || cpu_is_mx21() || cpu_is_mx27()) 66#define timer_is_v1() (cpu_is_mx1() || cpu_is_mx21() || cpu_is_mx27())
67#define timer_is_v2() (!timer_is_v1()) 67#define timer_is_v2() (!timer_is_v1())
@@ -76,7 +76,7 @@ static inline void gpt_irq_disable(void)
76 unsigned int tmp; 76 unsigned int tmp;
77 77
78 if (timer_is_v2()) 78 if (timer_is_v2())
79 __raw_writel(0, timer_base + MX3_IR); 79 __raw_writel(0, timer_base + V2_IR);
80 else { 80 else {
81 tmp = __raw_readl(timer_base + MXC_TCTL); 81 tmp = __raw_readl(timer_base + MXC_TCTL);
82 __raw_writel(tmp & ~MX1_2_TCTL_IRQEN, timer_base + MXC_TCTL); 82 __raw_writel(tmp & ~MX1_2_TCTL_IRQEN, timer_base + MXC_TCTL);
@@ -86,7 +86,7 @@ static inline void gpt_irq_disable(void)
86static inline void gpt_irq_enable(void) 86static inline void gpt_irq_enable(void)
87{ 87{
88 if (timer_is_v2()) 88 if (timer_is_v2())
89 __raw_writel(1<<0, timer_base + MX3_IR); 89 __raw_writel(1<<0, timer_base + V2_IR);
90 else { 90 else {
91 __raw_writel(__raw_readl(timer_base + MXC_TCTL) | MX1_2_TCTL_IRQEN, 91 __raw_writel(__raw_readl(timer_base + MXC_TCTL) | MX1_2_TCTL_IRQEN,
92 timer_base + MXC_TCTL); 92 timer_base + MXC_TCTL);
@@ -102,7 +102,7 @@ static void gpt_irq_acknowledge(void)
102 __raw_writel(MX2_TSTAT_CAPT | MX2_TSTAT_COMP, 102 __raw_writel(MX2_TSTAT_CAPT | MX2_TSTAT_COMP,
103 timer_base + MX1_2_TSTAT); 103 timer_base + MX1_2_TSTAT);
104 } else if (timer_is_v2()) 104 } else if (timer_is_v2())
105 __raw_writel(MX3_TSTAT_OF1, timer_base + MX3_TSTAT); 105 __raw_writel(V2_TSTAT_OF1, timer_base + V2_TSTAT);
106} 106}
107 107
108static cycle_t mx1_2_get_cycles(struct clocksource *cs) 108static cycle_t mx1_2_get_cycles(struct clocksource *cs)
@@ -110,9 +110,9 @@ static cycle_t mx1_2_get_cycles(struct clocksource *cs)
110 return __raw_readl(timer_base + MX1_2_TCN); 110 return __raw_readl(timer_base + MX1_2_TCN);
111} 111}
112 112
113static cycle_t mx3_get_cycles(struct clocksource *cs) 113static cycle_t v2_get_cycles(struct clocksource *cs)
114{ 114{
115 return __raw_readl(timer_base + MX3_TCN); 115 return __raw_readl(timer_base + V2_TCN);
116} 116}
117 117
118static struct clocksource clocksource_mxc = { 118static struct clocksource clocksource_mxc = {
@@ -129,7 +129,7 @@ static int __init mxc_clocksource_init(struct clk *timer_clk)
129 unsigned int c = clk_get_rate(timer_clk); 129 unsigned int c = clk_get_rate(timer_clk);
130 130
131 if (timer_is_v2()) 131 if (timer_is_v2())
132 clocksource_mxc.read = mx3_get_cycles; 132 clocksource_mxc.read = v2_get_cycles;
133 133
134 clocksource_mxc.mult = clocksource_hz2mult(c, 134 clocksource_mxc.mult = clocksource_hz2mult(c,
135 clocksource_mxc.shift); 135 clocksource_mxc.shift);
@@ -153,16 +153,16 @@ static int mx1_2_set_next_event(unsigned long evt,
153 -ETIME : 0; 153 -ETIME : 0;
154} 154}
155 155
156static int mx3_set_next_event(unsigned long evt, 156static int v2_set_next_event(unsigned long evt,
157 struct clock_event_device *unused) 157 struct clock_event_device *unused)
158{ 158{
159 unsigned long tcmp; 159 unsigned long tcmp;
160 160
161 tcmp = __raw_readl(timer_base + MX3_TCN) + evt; 161 tcmp = __raw_readl(timer_base + V2_TCN) + evt;
162 162
163 __raw_writel(tcmp, timer_base + MX3_TCMP); 163 __raw_writel(tcmp, timer_base + V2_TCMP);
164 164
165 return (int)(tcmp - __raw_readl(timer_base + MX3_TCN)) < 0 ? 165 return (int)(tcmp - __raw_readl(timer_base + V2_TCN)) < 0 ?
166 -ETIME : 0; 166 -ETIME : 0;
167} 167}
168 168
@@ -192,8 +192,8 @@ static void mxc_set_mode(enum clock_event_mode mode,
192 if (mode != clockevent_mode) { 192 if (mode != clockevent_mode) {
193 /* Set event time into far-far future */ 193 /* Set event time into far-far future */
194 if (timer_is_v2()) 194 if (timer_is_v2())
195 __raw_writel(__raw_readl(timer_base + MX3_TCN) - 3, 195 __raw_writel(__raw_readl(timer_base + V2_TCN) - 3,
196 timer_base + MX3_TCMP); 196 timer_base + V2_TCMP);
197 else 197 else
198 __raw_writel(__raw_readl(timer_base + MX1_2_TCN) - 3, 198 __raw_writel(__raw_readl(timer_base + MX1_2_TCN) - 3,
199 timer_base + MX1_2_TCMP); 199 timer_base + MX1_2_TCMP);
@@ -245,7 +245,7 @@ static irqreturn_t mxc_timer_interrupt(int irq, void *dev_id)
245 uint32_t tstat; 245 uint32_t tstat;
246 246
247 if (timer_is_v2()) 247 if (timer_is_v2())
248 tstat = __raw_readl(timer_base + MX3_TSTAT); 248 tstat = __raw_readl(timer_base + V2_TSTAT);
249 else 249 else
250 tstat = __raw_readl(timer_base + MX1_2_TSTAT); 250 tstat = __raw_readl(timer_base + MX1_2_TSTAT);
251 251
@@ -276,7 +276,7 @@ static int __init mxc_clockevent_init(struct clk *timer_clk)
276 unsigned int c = clk_get_rate(timer_clk); 276 unsigned int c = clk_get_rate(timer_clk);
277 277
278 if (timer_is_v2()) 278 if (timer_is_v2())
279 clockevent_mxc.set_next_event = mx3_set_next_event; 279 clockevent_mxc.set_next_event = v2_set_next_event;
280 280
281 clockevent_mxc.mult = div_sc(c, NSEC_PER_SEC, 281 clockevent_mxc.mult = div_sc(c, NSEC_PER_SEC,
282 clockevent_mxc.shift); 282 clockevent_mxc.shift);
@@ -308,7 +308,7 @@ void __init mxc_timer_init(struct clk *timer_clk, void __iomem *base, int irq)
308 __raw_writel(0, timer_base + MXC_TPRER); /* see datasheet note */ 308 __raw_writel(0, timer_base + MXC_TPRER); /* see datasheet note */
309 309
310 if (timer_is_v2()) 310 if (timer_is_v2())
311 tctl_val = MX3_TCTL_CLK_IPG | MX3_TCTL_FRR | MX3_TCTL_WAITEN | MXC_TCTL_TEN; 311 tctl_val = V2_TCTL_CLK_IPG | V2_TCTL_FRR | V2_TCTL_WAITEN | MXC_TCTL_TEN;
312 else 312 else
313 tctl_val = MX1_2_TCTL_FRR | MX1_2_TCTL_CLK_PCLK1 | MXC_TCTL_TEN; 313 tctl_val = MX1_2_TCTL_FRR | MX1_2_TCTL_CLK_PCLK1 | MXC_TCTL_TEN;
314 314