summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorchristos <christos@NetBSD.org>1996-09-24 17:45:14 +0000
committerchristos <christos@NetBSD.org>1996-09-24 17:45:14 +0000
commit5d34f1a62b0574c06b7c851ce76f43f5f1bf07ca (patch)
tree4aecd974e8fd7c2e94d8c4e401d7efeed8aa7070 /sys/dev
parent3f0fed8ce89098f7a29a64f26c7d4eb8b93e25bd (diff)
New cyclades driver from Timo Rossi
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/isa/cy_isa.c92
-rw-r--r--sys/dev/isa/files.isa10
2 files changed, 96 insertions, 6 deletions
diff --git a/sys/dev/isa/cy_isa.c b/sys/dev/isa/cy_isa.c
new file mode 100644
index 00000000000..5085e1f80fc
--- /dev/null
+++ b/sys/dev/isa/cy_isa.c
@@ -0,0 +1,92 @@
+/* $NetBSD: cy_isa.c,v 1.1 1996/09/24 17:45:54 christos Exp $ */
+
+/*
+ * cy.c
+ *
+ * Driver for Cyclades Cyclom-8/16/32 multiport serial cards
+ * (currently not tested with Cyclom-32 cards)
+ *
+ * Timo Rossi, 1996
+ *
+ */
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/device.h>
+
+#include <machine/bus.h>
+#include <machine/intr.h>
+
+#include <dev/isa/isavar.h>
+#include <dev/isa/isareg.h>
+
+#include <dev/ic/cd1400reg.h>
+#include <dev/ic/cyreg.h>
+#include <dev/ic/cyvar.h>
+
+static int cy_probe_isa __P((struct device *, void *, void *));
+static void cy_attach_isa __P((struct device *, struct device *, void *));
+
+struct cfattach cy_isa_ca = {
+ sizeof(struct cy_softc), cy_probe_isa, cy_attach_isa
+};
+
+static int
+cy_probe_isa(parent, match, aux)
+ struct device *parent;
+ void *match, *aux;
+{
+ struct isa_attach_args *ia = aux;
+ struct cy_softc sc;
+
+ memcpy(&sc.sc_dev, match, sizeof(struct device));
+
+ sc.sc_bc = ia->ia_bc;
+ sc.sc_bustype = CY_BUSTYPE_ISA;
+
+ if (ia->ia_irq == IRQUNK) {
+ printf("%s: interrupt not defined\n", sc.sc_dev.dv_xname);
+ return 0;
+ }
+
+ if (bus_mem_map(ia->ia_bc, ia->ia_maddr, CY_MEMSIZE, 0,
+ &sc.sc_memh) != 0)
+ return 0;
+
+ if (cy_find(&sc) == 0)
+ return 0;
+
+ bus_mem_unmap(ia->ia_bc, sc.sc_memh, CY_MEMSIZE);
+
+ ia->ia_iosize = 0;
+ ia->ia_msize = CY_MEMSIZE;
+
+ return 1;
+}
+
+static void
+cy_attach_isa(parent, self, aux)
+ struct device *parent, *self;
+ void *aux;
+{
+ struct cy_softc *sc = (void *) self;
+ struct isa_attach_args *ia = aux;
+
+ sc->sc_bc = ia->ia_bc;
+ sc->sc_bustype = CY_BUSTYPE_ISA;
+
+ if (bus_mem_map(ia->ia_bc, ia->ia_maddr, CY_MEMSIZE, 0,
+ &sc->sc_memh) != 0)
+ panic("%s: Cannot map memory", sc->sc_dev.dv_xname);
+
+ if (cy_find(sc) == 0)
+ panic("%s: Cannot find card", sc->sc_dev.dv_xname);
+
+ cy_attach(parent, self, aux);
+
+ sc->sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq,
+ IST_EDGE, IPL_TTY, cy_intr, sc);
+
+ if (sc->sc_ih == NULL)
+ printf("%s: couldn't establish interrupt", sc->sc_dev.dv_xname);
+}
diff --git a/sys/dev/isa/files.isa b/sys/dev/isa/files.isa
index e135b407b7e..17865614cbb 100644
--- a/sys/dev/isa/files.isa
+++ b/sys/dev/isa/files.isa
@@ -1,4 +1,4 @@
-# $NetBSD: files.isa,v 1.23 1996/09/07 12:12:20 mycroft Exp $
+# $NetBSD: files.isa,v 1.24 1996/09/24 17:45:14 christos Exp $
#
# Config.new file and device description for machine-independent ISA code.
# Included by ports that need it. Requires that the SCSI files be
@@ -49,11 +49,9 @@ attach com at isa with com_isa
attach com at commulti with com_commulti
file dev/isa/com.c com & (com_isa | com_commulti) needs-flag
-# Cyclades Cyclom multiport serial cards
-# XXX currently broken
-device cy: tty
-attach cy at isa
-file dev/isa/cy.c cy needs-count
+# Cyclades Cyclom-8/16/32
+attach cy at isa with cy_isa
+file dev/isa/cy_isa.c cy_isa
# PC parallel ports (XXX what chip?)
device lpt