Ejemplo n.º 1
0
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;
	}
}
Ejemplo n.º 2
0
Archivo: time.c Proyecto: 274914765/C
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);
}
Ejemplo n.º 3
0
static int bfin_timer_set_next_event(unsigned long cycles,
				struct clock_event_device *evt)
{
	bfin_write_TCNTL(TMPWR);
	CSYNC();
	bfin_write_TCOUNT(cycles);
	CSYNC();
	bfin_write_TCNTL(TMPWR | TMREN);
	return 0;
}
Ejemplo n.º 4
0
void platform_cpu_die(void)
{
	unsigned long iwr;

	hotplug_coreb = 1;

	/*
	 * When CoreB wakes up, the code in _coreb_trampoline_start cannot
	 * turn off the data cache. This causes the CoreB failed to boot.
	 * As a workaround, we invalidate all the data cache before sleep.
	 */
	blackfin_invalidate_entire_dcache();

	/* disable core timer */
	bfin_write_TCNTL(0);

	/* clear ipi interrupt IRQ_SUPPLE_0 of CoreB */
	bfin_write_SICB_SYSCR(bfin_read_SICB_SYSCR() | (1 << (10 + 1)));
	SSYNC();

	/* set CoreB wakeup by ipi0, iwr will be discarded */
	bfin_iwr_set_sup0(&iwr, &iwr, &iwr);
	SSYNC();

	coreb_die();
}
Ejemplo n.º 5
0
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);
}
Ejemplo n.º 6
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();
}
Ejemplo n.º 7
0
void __init setup_system_timer0(void)
{
	/* Power down the core timer, just to play safe. */
	bfin_write_TCNTL(0);

	disable_gptimers(TIMER0bit);
	set_gptimer_status(0, TIMER_STATUS_TRUN0);
	while (get_gptimer_status(0) & TIMER_STATUS_TRUN0)
		udelay(10);

	set_gptimer_config(0, 0x59); /* IRQ enable, periodic, PWM_OUT, SCLKed, OUT PAD disabled */
	set_gptimer_period(TIMER0_id, get_sclk() / HZ);
	set_gptimer_pwidth(TIMER0_id, 1);
	SSYNC();
	enable_gptimers(TIMER0bit);
}