Commit d0b53c03 authored by Deepak Saxena's avatar Deepak Saxena Committed by Deepak Saxena

[ARM] Consolidate various ARM timer fns. into single timer_tick() call.

Signed-off-by: default avatarDeepak Saxena <dsaxena@plexity.net>
parent 9ab6f322
...@@ -52,15 +52,11 @@ EXPORT_SYMBOL(rtc_lock); ...@@ -52,15 +52,11 @@ EXPORT_SYMBOL(rtc_lock);
/* change this if you have some constant time drift */ /* change this if you have some constant time drift */
#define USECS_PER_JIFFY (1000000/HZ) #define USECS_PER_JIFFY (1000000/HZ)
static int dummy_set_rtc(void)
{
return 0;
}
/* /*
* hook for setting the RTC's idea of the current time. * hook for setting the RTC's idea of the current time.
*/ */
int (*set_rtc)(void) = dummy_set_rtc; int (*set_rtc)(void);
static unsigned long dummy_gettimeoffset(void) static unsigned long dummy_gettimeoffset(void)
{ {
...@@ -86,7 +82,7 @@ unsigned long long __attribute__((weak)) sched_clock(void) ...@@ -86,7 +82,7 @@ unsigned long long __attribute__((weak)) sched_clock(void)
/* /*
* Handle kernel profile stuff... * Handle kernel profile stuff...
*/ */
void do_profile(struct pt_regs *regs) static inline void do_profile(struct pt_regs *regs)
{ {
profile_hook(regs); profile_hook(regs);
...@@ -116,7 +112,7 @@ static unsigned long next_rtc_update; ...@@ -116,7 +112,7 @@ static unsigned long next_rtc_update;
* called as close as possible to 500 ms before the new second * called as close as possible to 500 ms before the new second
* starts. * starts.
*/ */
void do_set_rtc(void) static inline void do_set_rtc(void)
{ {
if (time_status & STA_UNSYNC || set_rtc == NULL) if (time_status & STA_UNSYNC || set_rtc == NULL)
return; return;
...@@ -240,7 +236,8 @@ device_initcall(leds_init); ...@@ -240,7 +236,8 @@ device_initcall(leds_init);
EXPORT_SYMBOL(leds_event); EXPORT_SYMBOL(leds_event);
#endif #endif
void do_leds(void) #ifdef CONFIG_LEDS_TIMER
static inline void do_leds(void)
{ {
static unsigned int count = 50; static unsigned int count = 50;
...@@ -249,6 +246,9 @@ void do_leds(void) ...@@ -249,6 +246,9 @@ void do_leds(void)
leds_event(led_timer); leds_event(led_timer);
} }
} }
#else
#define do_leds()
#endif
void do_gettimeofday(struct timeval *tv) void do_gettimeofday(struct timeval *tv)
{ {
...@@ -315,6 +315,14 @@ int do_settimeofday(struct timespec *tv) ...@@ -315,6 +315,14 @@ int do_settimeofday(struct timespec *tv)
EXPORT_SYMBOL(do_settimeofday); EXPORT_SYMBOL(do_settimeofday);
void timer_tick(struct pt_regs *regs)
{
do_profile(regs);
do_leds();
do_set_rtc();
do_timer(regs);
}
void (*init_arch_time)(void); void (*init_arch_time)(void);
void __init time_init(void) void __init time_init(void)
......
...@@ -49,9 +49,7 @@ static unsigned long clps711x_gettimeoffset(void) ...@@ -49,9 +49,7 @@ static unsigned long clps711x_gettimeoffset(void)
static irqreturn_t static irqreturn_t
p720t_timer_interrupt(int irq, void *dev_id, struct pt_regs *regs) p720t_timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
{ {
do_leds(); timer_tick(regs);
do_timer(regs);
do_profile(regs);
return IRQ_HANDLED; return IRQ_HANDLED;
} }
......
...@@ -271,10 +271,9 @@ extern void ioctime_init(void); ...@@ -271,10 +271,9 @@ extern void ioctime_init(void);
static irqreturn_t static irqreturn_t
clps7500_timer_interrupt(int irq, void *dev_id, struct pt_regs *regs) clps7500_timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
{ {
do_timer(regs); timer_tick(regs);
do_set_rtc();
do_profile(regs);
/* Why not using do_leds interface?? */
{ {
/* Twinkle the lights. */ /* Twinkle the lights. */
static int count, state = 0xff00; static int count, state = 0xff00;
......
...@@ -160,9 +160,7 @@ ebsa110_timer_interrupt(int irq, void *dev_id, struct pt_regs *regs) ...@@ -160,9 +160,7 @@ ebsa110_timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
__raw_writeb(count & 0xff, PIT_T1); __raw_writeb(count & 0xff, PIT_T1);
__raw_writeb(count >> 8, PIT_T1); __raw_writeb(count >> 8, PIT_T1);
do_leds(); timer_tick(regs);
do_timer(regs);
do_profile(regs);
return IRQ_HANDLED; return IRQ_HANDLED;
} }
......
...@@ -47,9 +47,7 @@ epxa10db_timer_interrupt(int irq, void *dev_id, struct pt_regs *regs) ...@@ -47,9 +47,7 @@ epxa10db_timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
// ...clear the interrupt // ...clear the interrupt
*TIMER0_CR(IO_ADDRESS(EXC_TIMER00_BASE))|=TIMER0_CR_CI_MSK; *TIMER0_CR(IO_ADDRESS(EXC_TIMER00_BASE))|=TIMER0_CR_CI_MSK;
do_leds(); timer_tick(regs);
do_timer(regs);
do_profile(regs);
return IRQ_HANDLED; return IRQ_HANDLED;
} }
......
...@@ -83,12 +83,7 @@ static unsigned long isa_gettimeoffset(void) ...@@ -83,12 +83,7 @@ static unsigned long isa_gettimeoffset(void)
static irqreturn_t static irqreturn_t
isa_timer_interrupt(int irq, void *dev_id, struct pt_regs *regs) isa_timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
{ {
if (machine_is_netwinder()) timer_tick(regs);
do_leds();
do_timer(regs);
do_set_rtc();
do_profile(regs);
return IRQ_HANDLED; return IRQ_HANDLED;
} }
...@@ -206,11 +201,7 @@ timer1_interrupt(int irq, void *dev_id, struct pt_regs *regs) ...@@ -206,11 +201,7 @@ timer1_interrupt(int irq, void *dev_id, struct pt_regs *regs)
{ {
*CSR_TIMER1_CLR = 0; *CSR_TIMER1_CLR = 0;
/* Do the LEDs things */ timer_tick(regs);
do_leds();
do_timer(regs);
do_set_rtc();
do_profile(regs);
return IRQ_HANDLED; return IRQ_HANDLED;
} }
......
...@@ -139,9 +139,7 @@ integrator_timer_interrupt(int irq, void *dev_id, struct pt_regs *regs) ...@@ -139,9 +139,7 @@ integrator_timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
// ...clear the interrupt // ...clear the interrupt
timer1->TimerClear = 1; timer1->TimerClear = 1;
do_leds(); timer_tick(regs);
do_timer(regs);
do_profile(regs);
return IRQ_HANDLED; return IRQ_HANDLED;
} }
......
...@@ -63,7 +63,7 @@ iop321_timer_interrupt(int irq, void *dev_id, struct pt_regs *regs) ...@@ -63,7 +63,7 @@ iop321_timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
asm volatile("mcr p6, 0, %0, c6, c1, 0" : : "r" (tisr)); asm volatile("mcr p6, 0, %0, c6, c1, 0" : : "r" (tisr));
do_timer(regs); timer_tick(regs);
return IRQ_HANDLED; return IRQ_HANDLED;
} }
......
...@@ -228,7 +228,7 @@ static irqreturn_t ixp4xx_timer_interrupt(int irq, void *dev_id, struct pt_regs ...@@ -228,7 +228,7 @@ static irqreturn_t ixp4xx_timer_interrupt(int irq, void *dev_id, struct pt_regs
* Catch up with the real idea of time * Catch up with the real idea of time
*/ */
do { do {
do_timer(regs); timer_tick(regs);
last_jiffy_time += LATCH; last_jiffy_time += LATCH;
} while((*IXP4XX_OSTS - last_jiffy_time) > LATCH); } while((*IXP4XX_OSTS - last_jiffy_time) > LATCH);
......
...@@ -41,10 +41,7 @@ static irqreturn_t ...@@ -41,10 +41,7 @@ static irqreturn_t
lh7a40x_timer_interrupt(int irq, void *dev_id, struct pt_regs *regs) lh7a40x_timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
{ {
TIMER_EOI = 0; TIMER_EOI = 0;
do_profile (regs); timer_tick(regs);
do_leds();
do_set_rtc();
do_timer (regs);
return IRQ_HANDLED; return IRQ_HANDLED;
} }
......
...@@ -183,9 +183,7 @@ omap_timer_interrupt(int irq, void *dev_id, struct pt_regs *regs) ...@@ -183,9 +183,7 @@ omap_timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
ilatency = MPUTICKS_PER_SEC / 100 - read_mputimer2(); ilatency = MPUTICKS_PER_SEC / 100 - read_mputimer2();
systimer_mark = now - ilatency; systimer_mark = now - ilatency;
do_leds(); timer_tick(regs);
do_timer(regs);
do_profile(regs);
return IRQ_HANDLED; return IRQ_HANDLED;
} }
......
...@@ -74,8 +74,6 @@ pxa_timer_interrupt(int irq, void *dev_id, struct pt_regs *regs) ...@@ -74,8 +74,6 @@ pxa_timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
{ {
int next_match; int next_match;
do_profile(regs);
/* Loop until we get ahead of the free running timer. /* Loop until we get ahead of the free running timer.
* This ensures an exact clock tick count and time accuracy. * This ensures an exact clock tick count and time accuracy.
* IRQs are disabled inside the loop to ensure coherence between * IRQs are disabled inside the loop to ensure coherence between
...@@ -92,9 +90,7 @@ pxa_timer_interrupt(int irq, void *dev_id, struct pt_regs *regs) ...@@ -92,9 +90,7 @@ pxa_timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
* exactly one tick period which should be a pretty rare event. * exactly one tick period which should be a pretty rare event.
*/ */
do { do {
do_leds(); timer_tick(regs);
do_set_rtc();
do_timer(regs);
OSSR = OSSR_M0; /* Clear match on timer 0 */ OSSR = OSSR_M0; /* Clear match on timer 0 */
next_match = (OSMR0 += LATCH); next_match = (OSMR0 += LATCH);
} while( (signed long)(next_match - OSCR) <= 8 ); } while( (signed long)(next_match - OSCR) <= 8 );
......
...@@ -88,9 +88,7 @@ void __init rpc_map_io(void) ...@@ -88,9 +88,7 @@ void __init rpc_map_io(void)
static irqreturn_t static irqreturn_t
rpc_timer_interrupt(int irq, void *dev_id, struct pt_regs *regs) rpc_timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
{ {
do_timer(regs); timer_tick(regs);
do_set_rtc();
do_profile(regs);
return IRQ_HANDLED; return IRQ_HANDLED;
} }
......
...@@ -74,12 +74,7 @@ static unsigned long s3c2410_gettimeoffset (void) ...@@ -74,12 +74,7 @@ static unsigned long s3c2410_gettimeoffset (void)
static irqreturn_t static irqreturn_t
s3c2410_timer_interrupt(int irq, void *dev_id, struct pt_regs *regs) s3c2410_timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
{ {
do_leds(); timer_tick(regs);
do_timer(regs);
do_set_rtc();
//s3c2410_rtc_check();
do_profile(regs);
return IRQ_HANDLED; return IRQ_HANDLED;
} }
......
...@@ -78,15 +78,11 @@ sa1100_timer_interrupt(int irq, void *dev_id, struct pt_regs *regs) ...@@ -78,15 +78,11 @@ sa1100_timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
unsigned int next_match; unsigned int next_match;
do { do {
do_leds(); timer_tick(regs);
do_timer(regs);
OSSR = OSSR_M0; /* Clear match on timer 0 */ OSSR = OSSR_M0; /* Clear match on timer 0 */
next_match = (OSMR0 += LATCH); next_match = (OSMR0 += LATCH);
do_set_rtc();
} while ((signed long)(next_match - OSCR) <= 0); } while ((signed long)(next_match - OSCR) <= 0);
do_profile(regs);
return IRQ_HANDLED; return IRQ_HANDLED;
} }
......
...@@ -35,9 +35,7 @@ static void __init shark_map_io(void) ...@@ -35,9 +35,7 @@ static void __init shark_map_io(void)
static irqreturn_t static irqreturn_t
shark_timer_interrupt(int irq, void *dev_id, struct pt_regs *regs) shark_timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
{ {
do_leds(); timer_tick(regs);
do_timer(regs);
do_profile(regs);
return IRQ_HANDLED; return IRQ_HANDLED;
} }
......
...@@ -606,9 +606,7 @@ static irqreturn_t versatile_timer_interrupt(int irq, void *dev_id, struct pt_re ...@@ -606,9 +606,7 @@ static irqreturn_t versatile_timer_interrupt(int irq, void *dev_id, struct pt_re
// ...clear the interrupt // ...clear the interrupt
timer0->TimerClear = 1; timer0->TimerClear = 1;
do_leds(); timer_tick(regs);
do_timer(regs);
do_profile(regs);
return IRQ_HANDLED; return IRQ_HANDLED;
} }
......
...@@ -12,13 +12,9 @@ ...@@ -12,13 +12,9 @@
extern void (*init_arch_time)(void); extern void (*init_arch_time)(void);
void do_set_rtc(void);
void do_profile(struct pt_regs *);
void do_leds(void);
extern int (*set_rtc)(void); extern int (*set_rtc)(void);
extern unsigned long(*gettimeoffset)(void); extern unsigned long(*gettimeoffset)(void);
void timer_tick(struct pt_regs *);
#endif #endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment