diff options
Diffstat (limited to 'drivers/clocksource')
| -rw-r--r-- | drivers/clocksource/sun4i_timer.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/clocksource/sun4i_timer.c b/drivers/clocksource/sun4i_timer.c index 8ead0258740a..46008f9f49ad 100644 --- a/drivers/clocksource/sun4i_timer.c +++ b/drivers/clocksource/sun4i_timer.c | |||
| @@ -37,6 +37,8 @@ | |||
| 37 | #define TIMER_INTVAL_REG(val) (0x10 * (val) + 0x14) | 37 | #define TIMER_INTVAL_REG(val) (0x10 * (val) + 0x14) |
| 38 | #define TIMER_CNTVAL_REG(val) (0x10 * (val) + 0x18) | 38 | #define TIMER_CNTVAL_REG(val) (0x10 * (val) + 0x18) |
| 39 | 39 | ||
| 40 | #define TIMER_SYNC_TICKS 3 | ||
| 41 | |||
| 40 | static void __iomem *timer_base; | 42 | static void __iomem *timer_base; |
| 41 | static u32 ticks_per_jiffy; | 43 | static u32 ticks_per_jiffy; |
| 42 | 44 | ||
| @@ -50,7 +52,7 @@ static void sun4i_clkevt_sync(void) | |||
| 50 | { | 52 | { |
| 51 | u32 old = readl(timer_base + TIMER_CNTVAL_REG(1)); | 53 | u32 old = readl(timer_base + TIMER_CNTVAL_REG(1)); |
| 52 | 54 | ||
| 53 | while ((old - readl(timer_base + TIMER_CNTVAL_REG(1))) < 3) | 55 | while ((old - readl(timer_base + TIMER_CNTVAL_REG(1))) < TIMER_SYNC_TICKS) |
| 54 | cpu_relax(); | 56 | cpu_relax(); |
| 55 | } | 57 | } |
| 56 | 58 | ||
| @@ -104,7 +106,7 @@ static int sun4i_clkevt_next_event(unsigned long evt, | |||
| 104 | struct clock_event_device *unused) | 106 | struct clock_event_device *unused) |
| 105 | { | 107 | { |
| 106 | sun4i_clkevt_time_stop(0); | 108 | sun4i_clkevt_time_stop(0); |
| 107 | sun4i_clkevt_time_setup(0, evt); | 109 | sun4i_clkevt_time_setup(0, evt - TIMER_SYNC_TICKS); |
| 108 | sun4i_clkevt_time_start(0, false); | 110 | sun4i_clkevt_time_start(0, false); |
| 109 | 111 | ||
| 110 | return 0; | 112 | return 0; |
| @@ -187,8 +189,8 @@ static void __init sun4i_timer_init(struct device_node *node) | |||
| 187 | 189 | ||
| 188 | sun4i_clockevent.cpumask = cpumask_of(0); | 190 | sun4i_clockevent.cpumask = cpumask_of(0); |
| 189 | 191 | ||
| 190 | clockevents_config_and_register(&sun4i_clockevent, rate, 0x1, | 192 | clockevents_config_and_register(&sun4i_clockevent, rate, |
| 191 | 0xffffffff); | 193 | TIMER_SYNC_TICKS, 0xffffffff); |
| 192 | } | 194 | } |
| 193 | CLOCKSOURCE_OF_DECLARE(sun4i, "allwinner,sun4i-timer", | 195 | CLOCKSOURCE_OF_DECLARE(sun4i, "allwinner,sun4i-timer", |
| 194 | sun4i_timer_init); | 196 | sun4i_timer_init); |
