static void bfin_timer_set_mode(enum clock_event_mode mode, struct clock_event_device *evt) { switch (mode) { case CLOCK_EVT_MODE_PERIODIC: { unsigned long tcount = ((get_cclk() / (HZ * TIME_SCALE)) - 1); bfin_write_TCNTL(TMPWR); CSYNC(); bfin_write_TSCALE(TIME_SCALE - 1); bfin_write_TPERIOD(tcount); bfin_write_TCOUNT(tcount); CSYNC(); bfin_write_TCNTL(TMPWR | TMREN | TAUTORLD); break; } case CLOCK_EVT_MODE_ONESHOT: bfin_write_TCNTL(TMPWR); CSYNC(); bfin_write_TSCALE(TIME_SCALE - 1); bfin_write_TPERIOD(0); bfin_write_TCOUNT(0); break; case CLOCK_EVT_MODE_UNUSED: case CLOCK_EVT_MODE_SHUTDOWN: bfin_write_TCNTL(0); CSYNC(); break; case CLOCK_EVT_MODE_RESUME: break; } }
static void time_sched_init(irq_handler_t timer_routine) { u32 tcount; /* power up the timer, but don't enable it just yet */ bfin_write_TCNTL(1); CSYNC(); /* * the TSCALE prescaler counter. */ bfin_write_TSCALE((TIME_SCALE - 1)); tcount = ((get_cclk() / (HZ * TIME_SCALE)) - 1); bfin_write_TPERIOD(tcount); bfin_write_TCOUNT(tcount); /* now enable the timer */ CSYNC(); bfin_write_TCNTL(7); bfin_timer_irq.handler = (irq_handler_t)timer_routine; /* call setup_irq instead of request_irq because request_irq calls * kmalloc which has not been initialized yet */ setup_irq(IRQ_CORETMR, &bfin_timer_irq); }
static int bfin_timer_set_next_event(unsigned long cycles, struct clock_event_device *evt) { bfin_write_TCOUNT(cycles); CSYNC(); return 0; }
static void __init bfin_timer_init(void) { /* power up the timer, but don't enable it just yet */ bfin_write_TCNTL(TMPWR); CSYNC(); /* * the TSCALE prescaler counter. */ bfin_write_TSCALE(TIME_SCALE - 1); bfin_write_TPERIOD(0); bfin_write_TCOUNT(0); CSYNC(); }
void __init setup_core_timer(void) { u32 tcount; /* power up the timer, but don't enable it just yet */ bfin_write_TCNTL(1); CSYNC(); /* the TSCALE prescaler counter */ bfin_write_TSCALE(TIME_SCALE - 1); tcount = ((get_cclk() / (HZ * TIME_SCALE)) - 1); bfin_write_TPERIOD(tcount); bfin_write_TCOUNT(tcount); /* now enable the timer */ CSYNC(); bfin_write_TCNTL(7); }