diff options
Diffstat (limited to 'arch/arm/mach-at91/at91rm9200_time.c')
| -rw-r--r-- | arch/arm/mach-at91/at91rm9200_time.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/arch/arm/mach-at91/at91rm9200_time.c b/arch/arm/mach-at91/at91rm9200_time.c index 1dd69c85dfe..a028cdf8f97 100644 --- a/arch/arm/mach-at91/at91rm9200_time.c +++ b/arch/arm/mach-at91/at91rm9200_time.c | |||
| @@ -32,6 +32,8 @@ static unsigned long last_crtr; | |||
| 32 | static u32 irqmask; | 32 | static u32 irqmask; |
| 33 | static struct clock_event_device clkevt; | 33 | static struct clock_event_device clkevt; |
| 34 | 34 | ||
| 35 | #define RM9200_TIMER_LATCH ((AT91_SLOW_CLOCK + HZ/2) / HZ) | ||
| 36 | |||
| 35 | /* | 37 | /* |
| 36 | * The ST_CRTR is updated asynchronously to the master clock ... but | 38 | * The ST_CRTR is updated asynchronously to the master clock ... but |
| 37 | * the updates as seen by the CPU don't seem to be strictly monotonic. | 39 | * the updates as seen by the CPU don't seem to be strictly monotonic. |
| @@ -74,8 +76,8 @@ static irqreturn_t at91rm9200_timer_interrupt(int irq, void *dev_id) | |||
| 74 | if (sr & AT91_ST_PITS) { | 76 | if (sr & AT91_ST_PITS) { |
| 75 | u32 crtr = read_CRTR(); | 77 | u32 crtr = read_CRTR(); |
| 76 | 78 | ||
| 77 | while (((crtr - last_crtr) & AT91_ST_CRTV) >= LATCH) { | 79 | while (((crtr - last_crtr) & AT91_ST_CRTV) >= RM9200_TIMER_LATCH) { |
| 78 | last_crtr += LATCH; | 80 | last_crtr += RM9200_TIMER_LATCH; |
| 79 | clkevt.event_handler(&clkevt); | 81 | clkevt.event_handler(&clkevt); |
| 80 | } | 82 | } |
| 81 | return IRQ_HANDLED; | 83 | return IRQ_HANDLED; |
| @@ -116,7 +118,7 @@ clkevt32k_mode(enum clock_event_mode mode, struct clock_event_device *dev) | |||
| 116 | case CLOCK_EVT_MODE_PERIODIC: | 118 | case CLOCK_EVT_MODE_PERIODIC: |
| 117 | /* PIT for periodic irqs; fixed rate of 1/HZ */ | 119 | /* PIT for periodic irqs; fixed rate of 1/HZ */ |
| 118 | irqmask = AT91_ST_PITS; | 120 | irqmask = AT91_ST_PITS; |
| 119 | at91_sys_write(AT91_ST_PIMR, LATCH); | 121 | at91_sys_write(AT91_ST_PIMR, RM9200_TIMER_LATCH); |
| 120 | break; | 122 | break; |
| 121 | case CLOCK_EVT_MODE_ONESHOT: | 123 | case CLOCK_EVT_MODE_ONESHOT: |
| 122 | /* ALM for oneshot irqs, set by next_event() | 124 | /* ALM for oneshot irqs, set by next_event() |
