Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch Move on-chip 405GP devices to powerpc/ibm4xx/dev.
details: https://anonhg.NetBSD.org/src/rev/b0c42cf87f91
branches: trunk
changeset: 511664:b0c42cf87f91
user: simonb <simonb%NetBSD.org@localhost>
date: Sun Jun 24 02:13:37 2001 +0000
description:
Move on-chip 405GP devices to powerpc/ibm4xx/dev.
diffstat:
sys/arch/powerpc/ibm4xx/dev/com_mainbus.c | 100 ++++++++++++++++++++++
sys/arch/powerpc/ibm4xx/dev/if_emac.c | 132 ++++++++++++++++++++++++++++++
sys/arch/powerpc/ibm4xx/dev/if_emacreg.h | 73 ++++++++++++++++
sys/arch/walnut/conf/files.walnut | 97 ++++++++++++---------
sys/arch/walnut/dev/com_mainbus.c | 100 ----------------------
sys/arch/walnut/dev/if_emac.c | 132 ------------------------------
sys/arch/walnut/dev/if_emacreg.h | 73 ----------------
7 files changed, 361 insertions(+), 346 deletions(-)
diffs (truncated from 762 to 300 lines):
diff -r 8cdf56e986de -r b0c42cf87f91 sys/arch/powerpc/ibm4xx/dev/com_mainbus.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/powerpc/ibm4xx/dev/com_mainbus.c Sun Jun 24 02:13:37 2001 +0000
@@ -0,0 +1,100 @@
+/* $NetBSD: com_mainbus.c,v 1.1 2001/06/24 02:13:37 simonb Exp $ */
+
+/*
+ * Copyright 2001 Wasabi Systems, Inc.
+ * All rights reserved.
+ *
+ * Written by Eduardo Horvath and Simon Burge for Wasabi Systems, Inc.
+ *
+ * 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.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed for the NetBSD Project by
+ * Wasabi Systems, Inc.
+ * 4. The name of Wasabi Systems, Inc. may not be used to endorse
+ * or promote products derived from this software without specific prior
+ * written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``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 WASABI SYSTEMS, INC
+ * 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/param.h>
+#include <sys/device.h>
+#include <sys/tty.h>
+
+#include <machine/autoconf.h>
+#include <machine/bus.h>
+
+#include <dev/ic/comreg.h>
+#include <dev/ic/comvar.h>
+
+struct com_mainbus_softc {
+ struct com_softc sc_com;
+ void *sc_ih;
+};
+
+static int com_mainbus_probe(struct device *, struct cfdata *, void *);
+static void com_mainbus_attach(struct device *, struct device *, void *);
+
+struct cfattach com_mainbus_ca = {
+ sizeof(struct com_mainbus_softc), com_mainbus_probe, com_mainbus_attach
+};
+
+int comfound = 0;
+
+int
+com_mainbus_probe(struct device *parent, struct cfdata *cf, void *aux)
+{
+ union mainbus_attach_args *maa = aux;
+
+ /* match only com devices */
+ if (strcmp(maa->mba_rmb.rmb_name, cf->cf_driver->cd_name) != 0)
+ return 0;
+
+ return (comfound < 2);
+}
+
+struct com_softc *com0; /* XXX */
+
+void
+com_mainbus_attach(struct device *parent, struct device *self, void *aux)
+{
+ struct com_mainbus_softc *msc = (void *)self;
+ struct com_softc *sc = &msc->sc_com;
+ union mainbus_attach_args *maa = aux;
+ int addr = maa->mba_rmb.rmb_addr;
+ int irq = maa->mba_rmb.rmb_irq;
+
+ sc->sc_iot = galaxy_make_bus_space_tag(0, 0);
+ sc->sc_iobase = sc->sc_ioh = addr;
+ /* UART is clocked externally @ 11.0592MHz == COM_FREQ*6 */
+ sc->sc_frequency = COM_FREQ * 6;
+
+ comfound ++;
+
+ /* XXX console check */
+ /* XXX map */
+
+ com_attach_subr(sc);
+
+ intr_establish(irq, IST_LEVEL, IPL_SERIAL, comintr, sc);
+
+ return;
+}
diff -r 8cdf56e986de -r b0c42cf87f91 sys/arch/powerpc/ibm4xx/dev/if_emac.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/powerpc/ibm4xx/dev/if_emac.c Sun Jun 24 02:13:37 2001 +0000
@@ -0,0 +1,132 @@
+/* $NetBSD: if_emac.c,v 1.1 2001/06/24 02:13:37 simonb Exp $ */
+
+/*
+ * Copyright 2001 Wasabi Systems, Inc.
+ * All rights reserved.
+ *
+ * Written by Simon Burge and Eduardo Horvath for Wasabi Systems, Inc.
+ *
+ * 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.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed for the NetBSD Project by
+ * Wasabi Systems, Inc.
+ * 4. The name of Wasabi Systems, Inc. may not be used to endorse
+ * or promote products derived from this software without specific prior
+ * written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``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 WASABI SYSTEMS, INC
+ * 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 "rnd.h"
+#include "bpfilter.h"
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/callout.h>
+#include <sys/mbuf.h>
+#include <sys/malloc.h>
+#include <sys/kernel.h>
+#include <sys/socket.h>
+#include <sys/ioctl.h>
+#include <sys/errno.h>
+#include <sys/device.h>
+#include <sys/queue.h>
+
+#if NRND > 0
+#include <sys/rnd.h>
+#endif
+
+#include <net/if.h>
+#include <net/if_dl.h>
+#include <net/if_media.h>
+#include <net/if_ether.h>
+
+#if NBPFILTER > 0
+#include <net/bpf.h>
+#endif
+
+#include <machine/autoconf.h>
+#include <machine/bus.h>
+#include <machine/walnut.h> /* XXX - this file shouldn't depend on board-data */
+
+#include <dev/mii/mii.h>
+#include <dev/mii/miivar.h>
+
+struct emac_softc {
+ struct device sc_dev; /* generic device information */
+ bus_space_tag_t sc_st; /* bus space tag */
+ bus_space_handle_t sc_sh; /* bus space handle */
+ bus_dma_tag_t sc_dmat; /* bus DMA tag */
+ struct ethercom sc_ethercom; /* ethernet common data */
+ void *sc_sdhook; /* shutdown hook */
+};
+
+static int emac_match(struct device *, struct cfdata *, void *);
+static void emac_attach(struct device *, struct device *, void *);
+static int emac_intr(void *);
+
+struct cfattach emac_ca = {
+ sizeof(struct emac_softc), emac_match, emac_attach
+};
+
+static int probe_done = 0;
+
+static int
+emac_match(struct device *parent, struct cfdata *cf, void *aux)
+{
+
+ /*
+ * XXX probe!
+ * This won't work on some of the NP family processors that have
+ * multiple EMACs
+ */
+
+ if (probe_done)
+ return 0;
+
+ probe_done = 1;
+ return 1;
+}
+
+static void
+emac_attach(struct device *parent, struct device *self, void *aux)
+{
+ union mainbus_attach_args *maa = aux;
+ struct emac_softc *sc = (struct emac_softc *)self;
+
+ sc->sc_st = galaxy_make_bus_space_tag(0, 0);
+ sc->sc_sh = maa->mba_rmb.rmb_addr;
+
+ printf(": 405GP EMAC\n");
+ printf("%s: Ethernet address %s\n", sc->sc_dev.dv_xname,
+ ether_sprintf(board_data.mac_address_local));
+
+ intr_establish(maa->mba_rmb.rmb_irq, IST_LEVEL, IPL_NET, emac_intr, sc);
+ printf("%s: interrupting at irq %d\n", sc->sc_dev.dv_xname, maa->mba_rmb.rmb_irq);
+}
+
+static int
+emac_intr(void *arg)
+{
+
+ printf("emac_intr: arg = %p\n", arg); /* XXX */
+ return 0;
+}
diff -r 8cdf56e986de -r b0c42cf87f91 sys/arch/powerpc/ibm4xx/dev/if_emacreg.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/powerpc/ibm4xx/dev/if_emacreg.h Sun Jun 24 02:13:37 2001 +0000
@@ -0,0 +1,73 @@
+/* $NetBSD: if_emacreg.h,v 1.1 2001/06/24 02:13:37 simonb Exp $ */
+
+/*
+ * Copyright 2001 Wasabi Systems, Inc.
+ * All rights reserved.
+ *
+ * Written by Simon Burge and Eduardo Horvath for Wasabi Systems, Inc.
+ *
+ * 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.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed for the NetBSD Project by
+ * Wasabi Systems, Inc.
+ * 4. The name of Wasabi Systems, Inc. may not be used to endorse
+ * or promote products derived from this software without specific prior
+ * written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``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 WASABI SYSTEMS, INC
+ * 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.
+ */
+
+/*
+ * MAL buffer descriptor control/status bit definitions, in the
+ * md_stat_ctrl field of the MAL descriptor <machine/mal.h>.
+ */
+
+/* EMAC transmit control definitions */
+#define EMAC_TXC_GFCS 0x0200 /* Generate FCS */
+#define EMAC_TXC_GPAD 0x0100 /* Generate padding */
+#define EMAC_TXC_ISA 0x0080 /* Insert Source Address */
+#define EMAC_TXC_RSA 0x0040 /* Replace Source Address */
+#define EMAC_TXC_IVT 0x0020 /* Insert VLAN Tag */
+#define EMAC_TXC_RVT 0x0010 /* Replace VLAN Tag */
+
+/* EMAC transmit status definitions */
+#define EMAC_TXS_BFCS 0x0200 /* Bad FCS */
+#define EMAC_TXS_BPP 0x0100 /* Bad previous packet */
+#define EMAC_TXS_LCS 0x0080 /* Loss of carrier sense */
+#define EMAC_TXS_ED 0x0040 /* Excessive deferral */
+#define EMAC_TXS_EC 0x0020 /* Excessive collisions */
Home |
Main Index |
Thread Index |
Old Index