1 /* $NetBSD: cy_isa.c,v 1.22 2007/10/19 12:00:15 ad Exp $ */
6 * Driver for Cyclades Cyclom-8/16/32 multiport serial cards
7 * (currently not tested with Cyclom-32 cards)
12 #include <sys/cdefs.h>
13 __KERNEL_RCSID(0, "$NetBSD: cy_isa.c,v 1.22 2007/10/19 12:00:15 ad Exp $");
15 #include <sys/param.h>
16 #include <sys/systm.h>
17 #include <sys/device.h>
22 #include <dev/isa/isavar.h>
23 #include <dev/isa/isareg.h>
25 #include <dev/ic/cd1400reg.h>
26 #include <dev/ic/cyreg.h>
27 #include <dev/ic/cyvar.h>
29 int cy_isa_probe(device_t
, cfdata_t
, void *);
30 void cy_isa_attach(device_t
, device_t
, void *);
32 CFATTACH_DECL_NEW(cy_isa
, sizeof(struct cy_softc
),
33 cy_isa_probe
, cy_isa_attach
, NULL
, NULL
);
36 cy_isa_probe(device_t parent
, cfdata_t match
, void *aux
)
38 struct isa_attach_args
*ia
= aux
;
42 if (ia
->ia_niomem
< 1)
47 sc
.sc_memt
= ia
->ia_memt
;
48 sc
.sc_bustype
= CY_BUSTYPE_ISA
;
50 /* Disallow wildcarded memory address. */
51 if (ia
->ia_iomem
[0].ir_addr
== ISA_UNKNOWN_IOMEM
)
53 if (ia
->ia_irq
[0].ir_irq
== ISA_UNKNOWN_IRQ
)
56 if (bus_space_map(ia
->ia_memt
, ia
->ia_iomem
[0].ir_addr
, CY_MEMSIZE
, 0,
62 bus_space_unmap(ia
->ia_memt
, sc
.sc_bsh
, CY_MEMSIZE
);
66 ia
->ia_iomem
[0].ir_size
= CY_MEMSIZE
;
77 cy_isa_attach(device_t parent
, device_t self
, void *aux
)
79 struct cy_softc
*sc
= device_private(self
);
80 struct isa_attach_args
*ia
= aux
;
83 sc
->sc_memt
= ia
->ia_memt
;
84 sc
->sc_bustype
= CY_BUSTYPE_ISA
;
86 printf(": Cyclades-Y multiport serial\n");
88 if (bus_space_map(ia
->ia_memt
, ia
->ia_iomem
[0].ir_addr
, CY_MEMSIZE
, 0,
90 aprint_error_dev(sc
->sc_dev
,
91 "unable to map device registers\n");
95 if (cy_find(sc
) == 0) {
96 aprint_error_dev(sc
->sc_dev
, "unable to find CD1400s\n");
102 sc
->sc_ih
= isa_intr_establish(ia
->ia_ic
, ia
->ia_irq
[0].ir_irq
,
103 IST_EDGE
, IPL_TTY
, cy_intr
, sc
);
104 if (sc
->sc_ih
== NULL
)
105 aprint_error_dev(sc
->sc_dev
, "unable to establish interrupt\n");