static void sscom_attach(struct device *parent, struct device *self, void *aux) { struct sscom_softc *sc = (struct sscom_softc *)self; struct s3c2xx0_attach_args *sa = aux; int unit = sa->sa_index; bus_addr_t iobase = s3c2410_uart_config[unit].iobase; printf( ": UART%d addr=%lx", sa->sa_index, iobase ); sc->sc_iot = s3c2xx0_softc->sc_iot; sc->sc_unit = unit; sc->sc_frequency = s3c2xx0_softc->sc_pclk; sc->sc_rx_irqno = s3c2410_uart_config[sa->sa_index].rx_int; sc->sc_tx_irqno = s3c2410_uart_config[sa->sa_index].tx_int; if (bus_space_map(sc->sc_iot, iobase, SSCOM_SIZE, 0, &sc->sc_ioh)) { printf( ": failed to map registers\n" ); return; } printf("\n"); s3c24x0_intr_establish(s3c2410_uart_config[unit].tx_int, IPL_SERIAL, IST_LEVEL, sscomtxintr, sc); s3c24x0_intr_establish(s3c2410_uart_config[unit].rx_int, IPL_SERIAL, IST_LEVEL, sscomrxintr, sc); s3c24x0_intr_establish(s3c2410_uart_config[unit].err_int, IPL_SERIAL, IST_LEVEL, sscomrxintr, sc); sscom_disable_txrxint(sc); sscom_attach_subr(sc); }
void sstouch_attach(device_t parent, device_t self, void *aux) { struct sstouch_softc *sc = device_private(self); struct s3c2xx0_attach_args *sa = aux; struct wsmousedev_attach_args mas; sc->dev = self; sc->iot = sa->sa_iot; if (bus_space_map(sc->iot, S3C2440_ADC_BASE, S3C2440_ADC_SIZE, 0, &sc->ioh)) { aprint_error(": failed to map registers"); return; } sc->next_stylus_intr = STYLUS_DOWN; /* XXX: Is IPL correct? */ s3c24x0_intr_establish(S3C2440_INT_TC, IPL_BIO, IST_EDGE_RISING, sstouch_tc_intr, sc); s3c24x0_intr_establish(S3C2440_INT_ADC, IPL_BIO, IST_EDGE_RISING, sstouch_adc_intr, sc); aprint_normal("\n"); mas.accessops = &sstouch_accessops; mas.accesscookie = sc; sc->wsmousedev = config_found_ia(self, "wsmousedev", &mas, wsmousedevprint); tpcalib_init(&sc->tpcalib); tpcalib_ioctl(&sc->tpcalib, WSMOUSEIO_SCALIBCOORDS, (void*)&default_calib, 0, 0); sc->sample_count = 0; /* Add CALLOUT_MPSAFE to avoid holding the global kernel lock */ callout_init(&sc->callout, 0); callout_setfunc(&sc->callout, sstouch_callout, sc); /* Actual initialization is performed by sstouch_initialize(), which is called by sstouch_enable() */ }
static void sscom_attach(device_t parent, device_t self, void *aux) { struct sscom_softc *sc = device_private(self); struct s3c2xx0_attach_args *sa = aux; int unit; bus_addr_t iobase; found = 1; unit = (sa->sa_index == SSIOCF_INDEX_DEFAULT) ? 0 : sa->sa_index; iobase = s3c2440_uart_config[unit].iobase; sc->sc_dev = self; sc->sc_iot = s3c2xx0_softc->sc_iot; sc->sc_unit = unit; sc->sc_frequency = s3c2xx0_softc->sc_pclk; sc->sc_change_txrx_interrupts = s3c2440_change_txrx_interrupts; sc->sc_rx_irqno = s3c2440_uart_config[unit].rx_int; sc->sc_tx_irqno = s3c2440_uart_config[unit].tx_int; if (bus_space_map(sc->sc_iot, iobase, SSCOM_SIZE, 0, &sc->sc_ioh)) { printf( ": failed to map registers\n" ); return; } printf("\n"); s3c24x0_intr_establish(s3c2440_uart_config[unit].tx_int, IPL_SERIAL, IST_LEVEL, sscomtxintr, sc); s3c24x0_intr_establish(s3c2440_uart_config[unit].rx_int, IPL_SERIAL, IST_LEVEL, sscomrxintr, sc); s3c24x0_intr_establish(s3c2440_uart_config[unit].err_int, IPL_SERIAL, IST_LEVEL, sscomrxintr, sc); sscom_disable_txrxint(sc); sscom_attach_subr(sc); }
void s3c24x0_lcd_attach_sub(struct s3c24x0_lcd_softc *sc, struct s3c2xx0_attach_args *sa, const struct s3c24x0_lcd_panel_info *panel_info) { bus_space_tag_t iot = sa->sa_iot; bus_space_handle_t ioh; int error; sc->n_screens = 0; LIST_INIT(&sc->screens); /* map controller registers */ error = bus_space_map(iot, sa->sa_addr, S3C24X0_LCDC_SIZE, 0, &ioh); if (error) { printf(": failed to map registers %d", error); return; } sc->iot = iot; sc->ioh = ioh; sc->dma_tag = sa->sa_dmat; #ifdef notyet sc->ih = s3c24x0_intr_establish(sa->sa_intr, IPL_BIO, lcdintr, sc); if (sc->ih == NULL) printf("%s: unable to establish interrupt at irq %d", sc->dev.dv_xname, sa->sa_intr); #endif /* mask LCD interrupts */ bus_space_write_4(iot, ioh, LCDC_LCDINTMSK, LCDINT_FICNT|LCDINT_FRSYN); /* Initialize controller registers based on panel geometry*/ s3c24x0_set_lcd_panel_info(sc, panel_info); /* XXX: enable clock to LCD controller */ }