xref: /openbsd/sys/dev/isa/cy_isa.c (revision d485f761)
1 /*	$OpenBSD: cy_isa.c,v 1.6 2001/08/20 04:41:39 smart Exp $	*/
2 
3 /*
4  * cy_isa.c
5  *
6  * Driver for Cyclades Cyclom-8/16/32 multiport serial cards
7  * (currently not tested with Cyclom-32 cards)
8  *
9  * Timo Rossi, 1996
10  */
11 
12 #include <sys/param.h>
13 #include <sys/systm.h>
14 #include <sys/device.h>
15 
16 #include <machine/bus.h>
17 
18 #include <dev/isa/isavar.h>
19 #include <dev/isa/isareg.h>
20 
21 #include <dev/ic/cd1400reg.h>
22 #include <dev/ic/cyreg.h>
23 
24 static int cy_isa_probe __P((struct device *, void *, void *));
25 void cy_isa_attach __P((struct device *, struct device *, void *));
26 
27 struct cfattach cy_isa_ca = {
28 	sizeof(struct cy_softc), cy_isa_probe, cy_isa_attach
29 };
30 
31 int
32 cy_isa_probe(parent, match, aux)
33 	struct device *parent;
34 	void *match, *aux;
35 {
36 	int card = ((struct device *)match)->dv_unit;
37 	struct isa_attach_args *ia = aux;
38 	bus_space_tag_t memt;
39 	bus_space_handle_t memh;
40 
41 	if (ia->ia_irq == IRQUNK) {
42 		printf("cy%d error: interrupt not defined\n", card);
43 		return (0);
44 	}
45 
46 	memt = ia->ia_memt;
47 	if (bus_space_map(memt, ia->ia_maddr, 0x2000, 0, &memh) != 0)
48 		return (0);
49 
50 	if (cy_probe_common(card, memt, memh, CY_BUSTYPE_ISA) == 0) {
51 		bus_space_unmap(memt, memh, 0x2000);
52 		return (0);
53 	}
54 
55 	ia->ia_iosize = 0;
56 	ia->ia_msize = 0x2000;
57 	return (1);
58 }
59 
60 void
61 cy_isa_attach(parent, self, aux)
62         struct device *parent, *self;
63         void *aux;
64 {
65 	cy_attach(parent, self, aux);
66 }
67