static void __init alchemy_setup_c0timer(void) { /* * MIPS kernel assigns 'au1k_wait' to 'cpu_wait' before this * function is called. Because the Alchemy counters are unusable * the C0 timekeeping code is installed and use of the 'wait' * instruction must be prohibited, which is done most easily by * assigning NULL to cpu_wait. */ cpu_wait = NULL; r4k_clockevent_init(); init_r4k_clocksource(); }
void __init plat_time_init(void) { struct clock_event_device *cd = &au1x_rtcmatch2_clockdev; unsigned long t; /* Check if firmware (YAMON, ...) has enabled 32kHz and clock * has been detected. If so install the rtcmatch2 clocksource, * otherwise don't bother. Note that both bits being set is by * no means a definite guarantee that the counters actually work * (the 32S bit seems to be stuck set to 1 once a single clock- * edge is detected, hence the timeouts). */ if (CNTR_OK != (au_readl(SYS_COUNTER_CNTRL) & CNTR_OK)) goto cntr_err; /* * setup counter 1 (RTC) to tick at full speed */ t = 0xffffff; while ((au_readl(SYS_COUNTER_CNTRL) & SYS_CNTRL_T1S) && --t) asm volatile ("nop"); if (!t) goto cntr_err; au_writel(0, SYS_RTCTRIM); /* 32.768 kHz */ au_sync(); t = 0xffffff; while ((au_readl(SYS_COUNTER_CNTRL) & SYS_CNTRL_C1S) && --t) asm volatile ("nop"); if (!t) goto cntr_err; au_writel(0, SYS_RTCWRITE); au_sync(); t = 0xffffff; while ((au_readl(SYS_COUNTER_CNTRL) & SYS_CNTRL_C1S) && --t) asm volatile ("nop"); if (!t) goto cntr_err; /* register counter1 clocksource and event device */ clocksource_set_clock(&au1x_counter1_clocksource, 32768); clocksource_register(&au1x_counter1_clocksource); cd->shift = 32; cd->mult = div_sc(32768, NSEC_PER_SEC, cd->shift); cd->max_delta_ns = clockevent_delta2ns(0xffffffff, cd); cd->min_delta_ns = clockevent_delta2ns(8, cd); /* ~0.25ms */ clockevents_register_device(cd); setup_irq(AU1000_RTC_MATCH2_INT, &au1x_rtcmatch2_irqaction); printk(KERN_INFO "Alchemy clocksource installed\n"); /* can now use 'wait' */ allow_au1k_wait = 1; return; cntr_err: /* counters unusable, use C0 counter */ r4k_clockevent_init(); init_r4k_clocksource(); allow_au1k_wait = 0; }
void __init plat_time_init(void) { powertv_clocksource_init(); r4k_clockevent_init(); }