コード例 #1
0
ファイル: sscom_s3c2410.c プロジェクト: lacombar/netbsd-alc
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);
}
コード例 #2
0
static void
sscom_attach(device_t parent, device_t self, void *aux)
{
	struct sscom_softc *sc = device_private(self);
	struct exyo_attach_args *exyo = aux;
	int unit = exyo->exyo_loc.loc_port;

	/* debug */
//	bus_addr_t iobase = exyo->exyo_loc.loc_offset;
//	aprint_normal( ": UART%d addr=%lx", unit, iobase );

	sc->sc_dev = self;
	sc->sc_iot = exyo->exyo_core_bst;
	sc->sc_unit = unit;
	sc->sc_frequency = EXYNOS_UART_FREQ;

	sc->sc_change_txrx_interrupts = exynos_change_txrx_interrupts;
	sc->sc_clear_interrupts = exynos_clear_interrupts;

	/* not used here, but do initialise */
	sc->sc_rx_irqno = 0;
	sc->sc_tx_irqno = 0;

	if (!sscom_is_console(sc->sc_iot, unit, &sc->sc_ioh)
	    && bus_space_subregion(sc->sc_iot, exyo->exyo_core_bsh,
		    exyo->exyo_loc.loc_offset, SSCOM_SIZE, &sc->sc_ioh)) {
		printf( ": failed to map registers\n" );
		return;
	}

	printf("\n");

	void *ih = intr_establish(exyo->exyo_loc.loc_intr, IPL_SCHED,
	    IST_LEVEL, sscomintr, sc);
	if (ih != NULL) {
		aprint_normal_dev(self, "interrupting at irq %d\n",
		    exyo->exyo_loc.loc_intr);
	}
	sscom_attach_subr(sc);
}
コード例 #3
0
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);
}