diff options
Diffstat (limited to 'arch/blackfin/kernel/time.c')
| -rw-r--r-- | arch/blackfin/kernel/time.c | 53 |
1 files changed, 19 insertions, 34 deletions
diff --git a/arch/blackfin/kernel/time.c b/arch/blackfin/kernel/time.c index 1bbacfbd4c5d..adb54aa7d7c8 100644 --- a/arch/blackfin/kernel/time.c +++ b/arch/blackfin/kernel/time.c | |||
| @@ -24,14 +24,10 @@ | |||
| 24 | 24 | ||
| 25 | static struct irqaction bfin_timer_irq = { | 25 | static struct irqaction bfin_timer_irq = { |
| 26 | .name = "Blackfin Timer Tick", | 26 | .name = "Blackfin Timer Tick", |
| 27 | #ifdef CONFIG_IRQ_PER_CPU | ||
| 28 | .flags = IRQF_DISABLED | IRQF_PERCPU, | ||
| 29 | #else | ||
| 30 | .flags = IRQF_DISABLED | 27 | .flags = IRQF_DISABLED |
| 31 | #endif | ||
| 32 | }; | 28 | }; |
| 33 | 29 | ||
| 34 | #if defined(CONFIG_TICK_SOURCE_SYSTMR0) || defined(CONFIG_IPIPE) | 30 | #if defined(CONFIG_IPIPE) |
| 35 | void __init setup_system_timer0(void) | 31 | void __init setup_system_timer0(void) |
| 36 | { | 32 | { |
| 37 | /* Power down the core timer, just to play safe. */ | 33 | /* Power down the core timer, just to play safe. */ |
| @@ -74,7 +70,7 @@ void __init setup_core_timer(void) | |||
| 74 | static void __init | 70 | static void __init |
| 75 | time_sched_init(irqreturn_t(*timer_routine) (int, void *)) | 71 | time_sched_init(irqreturn_t(*timer_routine) (int, void *)) |
| 76 | { | 72 | { |
| 77 | #if defined(CONFIG_TICK_SOURCE_SYSTMR0) || defined(CONFIG_IPIPE) | 73 | #if defined(CONFIG_IPIPE) |
| 78 | setup_system_timer0(); | 74 | setup_system_timer0(); |
| 79 | bfin_timer_irq.handler = timer_routine; | 75 | bfin_timer_irq.handler = timer_routine; |
| 80 | setup_irq(IRQ_TIMER0, &bfin_timer_irq); | 76 | setup_irq(IRQ_TIMER0, &bfin_timer_irq); |
| @@ -94,7 +90,7 @@ static unsigned long gettimeoffset(void) | |||
| 94 | unsigned long offset; | 90 | unsigned long offset; |
| 95 | unsigned long clocks_per_jiffy; | 91 | unsigned long clocks_per_jiffy; |
| 96 | 92 | ||
| 97 | #if defined(CONFIG_TICK_SOURCE_SYSTMR0) || defined(CONFIG_IPIPE) | 93 | #if defined(CONFIG_IPIPE) |
| 98 | clocks_per_jiffy = bfin_read_TIMER0_PERIOD(); | 94 | clocks_per_jiffy = bfin_read_TIMER0_PERIOD(); |
| 99 | offset = bfin_read_TIMER0_COUNTER() / \ | 95 | offset = bfin_read_TIMER0_COUNTER() / \ |
| 100 | (((clocks_per_jiffy + 1) * HZ) / USEC_PER_SEC); | 96 | (((clocks_per_jiffy + 1) * HZ) / USEC_PER_SEC); |
| @@ -133,36 +129,25 @@ irqreturn_t timer_interrupt(int irq, void *dummy) | |||
| 133 | static long last_rtc_update; | 129 | static long last_rtc_update; |
| 134 | 130 | ||
| 135 | write_seqlock(&xtime_lock); | 131 | write_seqlock(&xtime_lock); |
| 136 | #if defined(CONFIG_TICK_SOURCE_SYSTMR0) && !defined(CONFIG_IPIPE) | 132 | do_timer(1); |
| 133 | |||
| 137 | /* | 134 | /* |
| 138 | * TIMIL0 is latched in __ipipe_grab_irq() when the I-Pipe is | 135 | * If we have an externally synchronized Linux clock, then update |
| 139 | * enabled. | 136 | * CMOS clock accordingly every ~11 minutes. Set_rtc_mmss() has to be |
| 137 | * called as close as possible to 500 ms before the new second starts. | ||
| 140 | */ | 138 | */ |
| 141 | if (get_gptimer_status(0) & TIMER_STATUS_TIMIL0) { | 139 | if (ntp_synced() && |
| 142 | #endif | 140 | xtime.tv_sec > last_rtc_update + 660 && |
| 143 | do_timer(1); | 141 | (xtime.tv_nsec / NSEC_PER_USEC) >= |
| 144 | 142 | 500000 - ((unsigned)TICK_SIZE) / 2 | |
| 145 | /* | 143 | && (xtime.tv_nsec / NSEC_PER_USEC) <= |
| 146 | * If we have an externally synchronized Linux clock, then update | 144 | 500000 + ((unsigned)TICK_SIZE) / 2) { |
| 147 | * CMOS clock accordingly every ~11 minutes. Set_rtc_mmss() has to be | 145 | if (set_rtc_mmss(xtime.tv_sec) == 0) |
| 148 | * called as close as possible to 500 ms before the new second starts. | 146 | last_rtc_update = xtime.tv_sec; |
| 149 | */ | 147 | else |
| 150 | if (ntp_synced() && | 148 | /* Do it again in 60s. */ |
| 151 | xtime.tv_sec > last_rtc_update + 660 && | 149 | last_rtc_update = xtime.tv_sec - 600; |
| 152 | (xtime.tv_nsec / NSEC_PER_USEC) >= | ||
| 153 | 500000 - ((unsigned)TICK_SIZE) / 2 | ||
| 154 | && (xtime.tv_nsec / NSEC_PER_USEC) <= | ||
| 155 | 500000 + ((unsigned)TICK_SIZE) / 2) { | ||
| 156 | if (set_rtc_mmss(xtime.tv_sec) == 0) | ||
| 157 | last_rtc_update = xtime.tv_sec; | ||
| 158 | else | ||
| 159 | /* Do it again in 60s. */ | ||
| 160 | last_rtc_update = xtime.tv_sec - 600; | ||
| 161 | } | ||
| 162 | #if defined(CONFIG_TICK_SOURCE_SYSTMR0) && !defined(CONFIG_IPIPE) | ||
| 163 | set_gptimer_status(0, TIMER_STATUS_TIMIL0); | ||
| 164 | } | 150 | } |
| 165 | #endif | ||
| 166 | write_sequnlock(&xtime_lock); | 151 | write_sequnlock(&xtime_lock); |
| 167 | 152 | ||
| 168 | #ifdef CONFIG_IPIPE | 153 | #ifdef CONFIG_IPIPE |
