void
cpu_initclocks(void)
{
	struct saost_softc *sc = saost_sc;

	stathz = STATHZ;
	profhz = stathz;
#if defined(CPU_XSCALE_PXA270) && defined(CPU_XSCALE_PXA250)
	TIMER_FREQUENCY = (CPU_IS_PXA250) ? 3686400 : 3250000;
#endif
	sc->sc_statclock_step = TIMER_FREQUENCY / stathz;

	aprint_normal("clock: hz=%d stathz=%d\n", hz, stathz);

	/* Use the channels 0 and 1 for hardclock and statclock, respectively */
	sc->sc_clock_count = TIMER_FREQUENCY / hz;
	sc->sc_statclock_count = TIMER_FREQUENCY / stathz;

	sa11x0_intr_establish(0, 26, 1, IPL_CLOCK, clockintr, 0);
	sa11x0_intr_establish(0, 27, 1, IPL_CLOCK, statintr, 0);

	bus_space_write_4(sc->sc_iot, sc->sc_ioh, SAOST_SR, 0xf);
	bus_space_write_4(sc->sc_iot, sc->sc_ioh, SAOST_IR, 3);
	bus_space_write_4(sc->sc_iot, sc->sc_ioh, SAOST_MR0,
			  sc->sc_clock_count);
	bus_space_write_4(sc->sc_iot, sc->sc_ioh, SAOST_MR1,
			  sc->sc_statclock_count);

	/* Zero the counter value */
	bus_space_write_4(sc->sc_iot, sc->sc_ioh, SAOST_CR, 0);

	saost_tc_init();
}
Пример #2
0
int
j720kbd_enable(void *v, int on)
{
	struct j720ssp_softc *sc = v;

	if (! sc->sc_enabled) {
		sc->sc_enabled = 1;

		sa11x0_intr_establish(0, 0, 1, IPL_BIO, j720kbd_intr, sc);
	}
	/* XXX */
	return (0);
}
Пример #3
0
void
sacom_attach(struct device *parent, struct device *self, void *aux)
{
    struct sacom_softc *sc = (struct sacom_softc*)self;
    struct sa11x0_attach_args *sa = aux;

#ifdef hpcarm
    struct platid_data *p;
    void (*mdinit)(struct device *, struct sacom_softc *);
#endif

    printf("\n");

    sc->sc_iot = sa->sa_iot;
    sc->sc_baseaddr = sa->sa_addr;

    if (bus_space_map(sa->sa_iot, sa->sa_addr, sa->sa_size, 0,
                      &sc->sc_ioh)) {
        printf("%s: unable to map registers\n", sc->sc_dev.dv_xname);
        return;
    }

    printf("%s: ", sc->sc_dev.dv_xname);
    switch (sc->sc_baseaddr) {
    case SACOM1_BASE:
        printf("SA-11x0 UART1\n");
        break;
    case SACOM2_BASE:
        printf("SA-11x0 UART2 (IRDA)\n");
        break;
    case SACOM3_BASE:
        printf("SA-11x0 UART3\n");
        break;
    default:
        printf("unknown SA-11x0 UART\n");
        break;
    }

    sacom_attach_subr(sc);

#ifdef hpcarm
    /* Do hpcarm specific initialization, if any */
    if ((p = platid_search_data(&platid, sacom_platid_table)) != NULL) {
        mdinit = p->data;
        (mdinit)(parent, sc);
    }
#endif

    sa11x0_intr_establish(0, sa->sa_intr, 1, IPL_SERIAL, sacomintr, sc);
}