Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/mca Add support for NeoTecH Single RS-232 Async. Ada...
details: https://anonhg.NetBSD.org/src/rev/1842507e1a83
branches: trunk
changeset: 508806:1842507e1a83
user: jdolecek <jdolecek%NetBSD.org@localhost>
date: Fri Apr 20 10:03:35 2001 +0000
description:
Add support for NeoTecH Single RS-232 Async. Adapter, SM110. Tested
with card provided by Hans Hubner <hans%huebner.org@localhost>.
Also pretty the autoconf attach messages a little.
diffstat:
sys/dev/mca/com_mca.c | 55 ++++++++++++++++++++++++++++++++++++++++++++------
sys/dev/mca/mcadevs | 4 +-
2 files changed, 50 insertions(+), 9 deletions(-)
diffs (115 lines):
diff -r 42d6c64e7c22 -r 1842507e1a83 sys/dev/mca/com_mca.c
--- a/sys/dev/mca/com_mca.c Fri Apr 20 09:57:40 2001 +0000
+++ b/sys/dev/mca/com_mca.c Fri Apr 20 10:03:35 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: com_mca.c,v 1.2 2001/03/31 09:50:14 jdolecek Exp $ */
+/* $NetBSD: com_mca.c,v 1.3 2001/04/20 10:03:35 jdolecek Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -108,7 +108,9 @@
int com_mca_probe __P((struct device *, struct cfdata *, void *));
void com_mca_attach __P((struct device *, struct device *, void *));
void com_mca_cleanup __P((void *));
+
static int ibm_modem_getcfg __P((struct mca_attach_args *, int *, int *));
+static int neocom1_getcfg __P((struct mca_attach_args *, int *, int *));
struct cfattach com_mca_ca = {
sizeof(struct com_mca_softc), com_mca_probe, com_mca_attach
@@ -121,6 +123,8 @@
/* get device i/o base and irq */
} com_mca_products[] = {
{ MCA_PRODUCT_IBM_MOD, "IBM Internal Modem", ibm_modem_getcfg },
+ { MCA_PRODUCT_NEOCOM1, "NeoTecH Single RS-232 Async. Adapter, SM110",
+ neocom1_getcfg },
{ 0, NULL, NULL },
};
@@ -172,12 +176,6 @@
return;
}
- printf(" slot %d i/o %#x-%#x irq %d: %s\n", ma->ma_slot + 1,
- iobase, iobase + COM_NPORTS - 1,
- irq, cpp->cp_name);
-
- printf("%s", sc->sc_dev.dv_xname);
-
if (bus_space_map(ma->ma_iot, iobase, COM_NPORTS, 0, &sc->sc_ioh)) {
printf(": can't map i/o space\n");
return;
@@ -187,8 +185,13 @@
sc->sc_iot = ma->ma_iot;
sc->sc_iobase = iobase;
+ printf(" slot %d i/o %#x-%#x irq %d", ma->ma_slot + 1,
+ iobase, iobase + COM_NPORTS - 1, irq);
+
com_attach_subr(sc);
+ printf("%s: %s\n", sc->sc_dev.dv_xname, cpp->cp_name);
+
isc->sc_ih = mca_intr_establish(ma->ma_mc, irq, IPL_SERIAL,
comintr, sc);
if (isc->sc_ih == NULL) {
@@ -260,3 +263,41 @@
return (0);
}
+
+/*
+ * Get configuration for NeoTecH Single RS-232 Async. Adapter, SM110.
+ */
+static int
+neocom1_getcfg(ma, iobasep, irqp)
+ struct mca_attach_args *ma;
+ int *iobasep, *irqp;
+{
+ int pos2, pos3, pos4;
+ static const int neotech_irq[] = { 12, 9, 4, 3 };
+
+ pos2 = mca_conf_read(ma->ma_mc, ma->ma_slot, 2);
+ pos3 = mca_conf_read(ma->ma_mc, ma->ma_slot, 3);
+ pos4 = mca_conf_read(ma->ma_mc, ma->ma_slot, 4);
+
+ /*
+ * POS register 2: (adf pos0)
+ * 7 6 5 4 3 2 1 0
+ * 1 \_/ \__ enable: 0=adapter disabled, 1=adapter enabled
+ * \____ IRQ: 11=3 10=4 01=9 00=12
+ *
+ * POS register 3: (adf pos1)
+ * 7 6 5 4 3 2 1 0
+ * \______/
+ * \_________ I/O Address: bits 7-3
+ *
+ * POS register 4: (adf pos2)
+ * 7 6 5 4 3 2 1 0
+ * \_____________/
+ * \__ I/O Address: bits 15-8
+ */
+
+ *iobasep = (pos4 << 8) | (pos3 & 0xf8);
+ *irqp = neotech_irq[(pos2 & 0x06) >> 1];
+
+ return (0);
+}
diff -r 42d6c64e7c22 -r 1842507e1a83 sys/dev/mca/mcadevs
--- a/sys/dev/mca/mcadevs Fri Apr 20 09:57:40 2001 +0000
+++ b/sys/dev/mca/mcadevs Fri Apr 20 10:03:35 2001 +0000
@@ -1,4 +1,4 @@
-$NetBSD: mcadevs,v 1.11 2001/04/20 07:37:42 jdolecek Exp $
+$NetBSD: mcadevs,v 1.12 2001/04/20 10:03:35 jdolecek Exp $
/*-
* Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -188,7 +188,7 @@
product 0x678C "NeoTecH S2M100 Dual RS-232 Async. Adapter" [6]
product 0x678D "NeoTecH MSP/4 4-Channel Serial/Parallel Adapter" [6]
product 0x678F "BBS GPIB-3000 IEEE-488 Adapter" [5]
-product 0x6781 "NeoTecH Single RS-232 Async. Adapter, SM110" [10]
+product 0x6791 NEOCOM1 "NeoTecH Single RS-232 Async. Adapter, SM110" [10]
product 0x6792 "NeoTecH SPM121/SPM321 Serial/Parallel Adapter" [6]
product 0x6795 "NeoTecH S1M200 Single RS-422/485 Async. Adapter" [6]
product 0x6796 "NeoTecH PM101 Single Bidirectional Parallel Adapter" [6]
Home |
Main Index |
Thread Index |
Old Index