#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ixpcom_ixm.c,v 1.12 2023/12/20 13:55:18 thorpej Exp $");
#include <sys/types.h>
#include <sys/device.h>
#include <sys/systm.h>
#include <sys/param.h>
#include <sys/termios.h>
#include <machine/intr.h>
#include <sys/bus.h>
#include <arm/ixp12x0/ixp12x0_comreg.h>
#include <arm/ixp12x0/ixp12x0_comvar.h>
#include <arm/ixp12x0/ixp12x0reg.h>
#include <arm/ixp12x0/ixp12x0var.h>
#include <arm/ixp12x0/ixpsipvar.h>
#include <evbarm/ixm1200/ixpcom_ixmvar.h>
static int ixpcom_ixm_match(device_t, cfdata_t, void *);
static void ixpcom_ixm_attach(device_t, device_t, void *);
CFATTACH_DECL_NEW(ixpcom_ixm, sizeof(struct ixpcom_softc),
ixpcom_ixm_match, ixpcom_ixm_attach, NULL, NULL);
static int
ixpcom_ixm_match(device_t parent, cfdata_t match, void *aux)
{
if (strcmp(match->cf_name, "ixpcom") == 0)
return 1;
return 0;
}
static void
ixpcom_ixm_attach(device_t parent, device_t self, void *aux)
{
struct ixpcom_ixm_softc *isc = device_private(self);
struct ixpcom_softc *sc = &isc->sc_ixpcom;
struct ixpsip_attach_args *sa = aux;
sc->sc_dev = self;
isc->sc_iot = sa->sa_iot;
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)) {
aprint_error(": unable to map device\n");
return;
}
aprint_normal(": IXP12x0 UART\n");
ixpcom_attach_subr(sc);
#ifdef POLLING_COM
{ void* d; d = d = ixpcomintr; }
#else
ixp12x0_intr_establish(IXP12X0_INTR_UART, IPL_SERIAL, ixpcomintr, sc);
#endif
}