Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/amiga Add preliminary support for Individual Comput...
details: https://anonhg.NetBSD.org/src/rev/04bd46b2a69c
branches: trunk
changeset: 789145:04bd46b2a69c
user: rkujawa <rkujawa%NetBSD.org@localhost>
date: Thu Aug 08 21:23:51 2013 +0000
description:
Add preliminary support for Individual Computers new X-Surf 100 network card.
diffstat:
sys/arch/amiga/conf/files.amiga | 11 ++-
sys/arch/amiga/dev/if_ne_xsh.c | 141 ++++++++++++++++++++++++++++++++++++++++
sys/arch/amiga/dev/xsh.c | 107 ++++++++++++++++++++++++++++++
sys/arch/amiga/dev/xshvar.h | 42 +++++++++++
4 files changed, 300 insertions(+), 1 deletions(-)
diffs (truncated from 327 to 300 lines):
diff -r cc806e7f0a88 -r 04bd46b2a69c sys/arch/amiga/conf/files.amiga
--- a/sys/arch/amiga/conf/files.amiga Thu Aug 08 21:09:49 2013 +0000
+++ b/sys/arch/amiga/conf/files.amiga Thu Aug 08 21:23:51 2013 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: files.amiga,v 1.170 2013/04/27 22:27:33 rkujawa Exp $
+# $NetBSD: files.amiga,v 1.171 2013/08/08 21:23:51 rkujawa Exp $
# maxpartitions must be first item in files.${ARCH}.newconf
maxpartitions 16 # NOTE THAT AMIGA IS SPECIAL!
@@ -235,6 +235,15 @@
attach wdc at xsurfbus with wdc_xsurf
file arch/amiga/dev/wdc_xsurf.c wdc_xsurf & xsurf
+define xshbus {}
+
+device xsh: xshbus
+attach xsh at zbus
+file arch/amiga/dev/xsh.c xsh needs-flag
+
+attach ne at xshbus with ne_xsh: dp8390nic
+file arch/amiga/dev/if_ne_xsh.c ne_xsh needs-flag
+
# Hydra ethernet card
device ed: ifnet, ether, arp
attach ed at zbus with ed_zbus: dp8390nic
diff -r cc806e7f0a88 -r 04bd46b2a69c sys/arch/amiga/dev/if_ne_xsh.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/amiga/dev/if_ne_xsh.c Thu Aug 08 21:23:51 2013 +0000
@@ -0,0 +1,141 @@
+/* $NetBSD: if_ne_xsh.c,v 1.1 2013/08/08 21:23:52 rkujawa Exp $ */
+
+/*-
+ * Copyright (c) 2013 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Radoslaw Kujawa.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+
+/*
+ * X-Surf 100 driver, ne(4) attachment.
+ */
+
+#include <sys/param.h>
+#include <sys/device.h>
+#include <sys/malloc.h>
+#include <sys/mbuf.h>
+#include <sys/socket.h>
+#include <sys/syslog.h>
+#include <sys/systm.h>
+#include <sys/bus.h>
+
+#include <net/if.h>
+#include <net/if_media.h>
+#include <net/if_ether.h>
+
+#include <dev/ic/dp8390reg.h>
+#include <dev/ic/dp8390var.h>
+
+#include <dev/ic/ne2000reg.h>
+#include <dev/ic/ne2000var.h>
+
+#include <amiga/amiga/device.h>
+#include <amiga/amiga/isr.h>
+
+#include <amiga/dev/xshvar.h>
+#include <amiga/dev/zbusvar.h>
+
+int ne_xsh_match(device_t, cfdata_t , void *);
+void ne_xsh_attach(device_t, device_t, void *);
+
+struct ne_xsh_softc {
+ struct ne2000_softc sc_ne2000;
+ struct bus_space_tag sc_bst;
+ struct isr sc_isr;
+};
+
+CFATTACH_DECL_NEW(ne_xsh, sizeof(struct ne_xsh_softc),
+ ne_xsh_match, ne_xsh_attach, NULL, NULL);
+
+int
+ne_xsh_match(device_t parent, cfdata_t cf, void *aux)
+{
+ struct xshbus_attach_args *xap = aux;
+
+ if (strcmp(xap->xaa_name, "ne_xsh") != 0)
+ return 0;
+
+ return 1;
+}
+
+void
+ne_xsh_attach(device_t parent, device_t self, void *aux)
+{
+ struct ne_xsh_softc *zsc = device_private(self);
+ struct ne2000_softc *nsc = &zsc->sc_ne2000;
+ struct dp8390_softc *dsc = &nsc->sc_dp8390;
+
+ struct xshbus_attach_args *xap = aux;
+
+ bus_space_tag_t nict = &zsc->sc_bst;
+ bus_space_tag_t asict = nict;
+ bus_space_handle_t nich;
+ bus_space_handle_t asich;
+
+ dsc->sc_dev = self;
+
+ zsc->sc_bst.base = xap->xaa_base;
+ zsc->sc_bst.absm = &amiga_bus_stride_4;
+
+ aprint_normal("\n");
+
+ /* Map i/o space. */
+ if (bus_space_map(nict, NE2000_NIC_OFFSET, NE2000_NPORTS, 0, &nich)) {
+ aprint_error_dev(self, "can't map nic i/o space\n");
+ return;
+ }
+
+ if (bus_space_subregion(nict, nich, NE2000_ASIC_OFFSET,
+ NE2000_ASIC_NPORTS, &asich)) {
+ aprint_error_dev(self, "can't map asic i/o space\n");
+ return;
+ }
+
+ dsc->sc_regt = nict;
+ dsc->sc_regh = nich;
+
+ nsc->sc_asict = asict;
+ nsc->sc_asich = asich;
+
+ /* This interface is always enabled. */
+ dsc->sc_enabled = 1;
+
+ nsc->sc_type = NE2000_TYPE_AX88790;
+ dsc->sc_flags = DP8390_NO_REMOTE_DMA_COMPLETE;
+
+ /*
+ * Do generic NE2000 attach. This will read the station address
+ * from the EEPROM.
+ */
+ ne2000_attach(nsc, NULL);
+
+ zsc->sc_isr.isr_intr = dp8390_intr;
+ zsc->sc_isr.isr_arg = dsc;
+ zsc->sc_isr.isr_ipl = 2;
+ add_isr(&zsc->sc_isr);
+}
diff -r cc806e7f0a88 -r 04bd46b2a69c sys/arch/amiga/dev/xsh.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/amiga/dev/xsh.c Thu Aug 08 21:23:51 2013 +0000
@@ -0,0 +1,107 @@
+/* $NetBSD: xsh.c,v 1.1 2013/08/08 21:23:52 rkujawa Exp $ */
+
+/*-
+ * Copyright (c) 2013 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Radoslaw Kujawa.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD: xsh.c,v 1.1 2013/08/08 21:23:52 rkujawa Exp $");
+
+/*
+ * X-Surf 100 driver.
+ */
+
+#include <sys/param.h>
+#include <sys/device.h>
+#include <sys/malloc.h>
+#include <sys/socket.h>
+#include <sys/systm.h>
+#include <sys/bus.h>
+
+#include <amiga/amiga/device.h>
+#include <amiga/amiga/isr.h>
+
+#include <amiga/dev/zbusvar.h>
+#include <amiga/dev/xshvar.h>
+
+int xsh_match(device_t, cfdata_t , void *);
+void xsh_attach(device_t, device_t, void *);
+static int xsh_print(void *aux, const char *w);
+
+struct xsh_softc {
+ device_t sc_dev;
+};
+
+CFATTACH_DECL_NEW(xsh, sizeof(struct xsh_softc),
+ xsh_match, xsh_attach, NULL, NULL);
+
+#define XSURF100_NE_OFFSET 0x0800
+
+int
+xsh_match(device_t parent, cfdata_t cf, void *aux)
+{
+ struct zbus_args *zap = aux;
+
+ /* X-surf ethernet card */
+ if (zap->manid == 4626 && zap->prodid == 100) {
+ return (1);
+ }
+
+ return (0);
+}
+
+void
+xsh_attach(device_t parent, device_t self, void *aux)
+{
+ struct xsh_softc *sc;
+ struct xshbus_attach_args xaa_ne;
+
+ struct zbus_args *zap = aux;
+
+ sc = device_private(self);
+ sc->sc_dev = self;
+
+ aprint_normal(": Individual Computers X-Surf 100\n");
+
+ /* Add ne(4). */
+ xaa_ne.xaa_base = (bus_addr_t)zap->va + XSURF100_NE_OFFSET;
+ strcpy(xaa_ne.xaa_name, "ne_xsh");
+ config_found_ia(sc->sc_dev, "xshbus", &xaa_ne, xsh_print);
+
+ /* TODO: add USB module... */
+}
+
+static int
+xsh_print(void *aux, const char *w)
+{
+ if (w == NULL)
+ return 0;
+
+ return 0;
+}
+
diff -r cc806e7f0a88 -r 04bd46b2a69c sys/arch/amiga/dev/xshvar.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/amiga/dev/xshvar.h Thu Aug 08 21:23:51 2013 +0000
@@ -0,0 +1,42 @@
+/* $NetBSD: xshvar.h,v 1.1 2013/08/08 21:23:52 rkujawa Exp $ */
+
+/*-
+ * Copyright (c) 2013 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Radoslaw Kujawa.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
Home |
Main Index |
Thread Index |
Old Index