This driver has been replaced with a podulebus attachment to the MI
NE2000 driver.
This commit is contained in:
parent
5241ea94ce
commit
6aad6c26fd
File diff suppressed because it is too large
Load Diff
|
@ -1,152 +0,0 @@
|
|||
/* $NetBSD: if_ehreg.h,v 1.3 1996/10/14 23:57:11 mark Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1995 Melvin Tang-Richardson.
|
||||
* All rights reserved.
|
||||
*
|
||||
* 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 by RiscBSD.
|
||||
* 4. The name of the company nor the name of the author may be used to
|
||||
* endorse or promote products derived from this software without specific
|
||||
* prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY RISCBSD ``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 RISCBSD 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.
|
||||
*
|
||||
* if_ehreg.h
|
||||
*
|
||||
* Ether H register definitions.
|
||||
*/
|
||||
|
||||
#define EH_RESET (0x18<<2)
|
||||
|
||||
#define EH_DATA_PORT (0x10<<2)
|
||||
|
||||
/* Special registers */
|
||||
|
||||
#define EH_CONFIGA (0x0a<<2)
|
||||
#define EH_CONFIGB (0x0b<<2)
|
||||
|
||||
/* Page 0 read registers */
|
||||
|
||||
#define EH_COMMAND (0x00<<2)
|
||||
#define EH_CLAD0 (0x01<<2)
|
||||
#define EH_CLDA1 (0x02<<2)
|
||||
#define EH_BNRY (0x03<<2)
|
||||
#define EH_TSR (0x04<<2)
|
||||
#define EH_NCR (0x05<<2)
|
||||
#define EH_FIFO (0x06<<2)
|
||||
#define EH_ISR (0x07<<2)
|
||||
#define EH_CRDA0 (0x08<<2)
|
||||
#define EH_CRDA1 (0x09<<2)
|
||||
#define EH_RSR (0x0c<<2)
|
||||
|
||||
/* Page 0 write registers */
|
||||
|
||||
#define EH_PSTART (0x01<<2)
|
||||
#define EH_PSTOP (0x02<<2)
|
||||
#define EH_TPSR (0x04<<2)
|
||||
#define EH_TBCR0 (0x05<<2)
|
||||
#define EH_TBCR1 (0x06<<2)
|
||||
#define EH_RSAR0 (0x08<<2)
|
||||
#define EH_RSAR1 (0x09<<2)
|
||||
#define EH_RBCR0 (0x0a<<2)
|
||||
#define EH_RBCR1 (0x0b<<2)
|
||||
#define EH_RCR (0x0c<<2)
|
||||
#define EH_TCR (0x0d<<2)
|
||||
#define EH_DCR (0x0e<<2)
|
||||
#define EH_IMR (0x0f<<2)
|
||||
|
||||
/* Page 1 write registers */
|
||||
|
||||
#define EH_CURR (0x07<<2)
|
||||
|
||||
/* Command bits */
|
||||
|
||||
#define COM_STP (0x01)
|
||||
#define COM_STA (0x02)
|
||||
#define COM_TXP (0x04)
|
||||
#define COM_MASK_PAGE (0x3f)
|
||||
#define COM_READ (0x08)
|
||||
#define COM_WRITE (0x10)
|
||||
#define COM_SEND (0x18)
|
||||
#define COM_ABORT (0x20)
|
||||
#define COM_MASK_DMA (0xc7)
|
||||
#define COM_DMA_MASK (0x38)
|
||||
|
||||
/* DCR bits */
|
||||
|
||||
#define DCR_WTS (0x01)
|
||||
#define DCR_BOS (0x02)
|
||||
#define DCR_LAS (0x04)
|
||||
#define DCR_LS (0x08)
|
||||
#define DCR_ARM (0x10)
|
||||
|
||||
/* TSR bits */
|
||||
|
||||
#define TSR_PTX (0x01)
|
||||
#define TSR_COL (0x04)
|
||||
#define TSR_ABT (0x08)
|
||||
#define TSR_CRS (0x10)
|
||||
#define TSR_FU (0x20)
|
||||
#define TSR_CDH (0x40)
|
||||
#define TSR_OWC (0x80)
|
||||
#define TSR_DONE ((TSR_PTX)|(TSR_ABT))
|
||||
|
||||
/* TCR bits */
|
||||
|
||||
#define TCR_CRC (0x01)
|
||||
#define TCR_NORMALLOOP (0x00)
|
||||
#define TCR_NICMOD (0x02)
|
||||
#define TCR_ENDECMOD (0x04)
|
||||
#define TCR_EXTLOOP (0x06)
|
||||
#define TCR_ATD (0x08)
|
||||
#define TCR_OFST (0x10)
|
||||
|
||||
/* ISR bits */
|
||||
|
||||
#define ISR_PRX (0x01)
|
||||
#define ISR_PTX (0x02)
|
||||
#define ISR_RXE (0x04)
|
||||
#define ISR_TXE (0x08)
|
||||
#define ISR_OVW (0x10)
|
||||
#define ISR_CNT (0x20)
|
||||
#define ISR_RDC (0x40)
|
||||
#define ISR_RST (0x80)
|
||||
|
||||
/* RSR bits */
|
||||
|
||||
#define RSR_PRX (0x01)
|
||||
#define RSR_CRC (0x02)
|
||||
#define RSR_FAE (0x04)
|
||||
#define RSR_FO (0x08)
|
||||
#define RSR_MPA (0x10)
|
||||
#define RSR_PHY (0x20)
|
||||
#define RSR_DIS (0x40)
|
||||
#define RSR_DFR (0x80)
|
||||
|
||||
struct eh_rxhdr {
|
||||
char rx_status;
|
||||
char rx_nxtpkt;
|
||||
char rx_rbc0;
|
||||
char rx_rbc1;
|
||||
};
|
||||
|
|
@ -1,254 +0,0 @@
|
|||
/* $NetBSD: if_em.c,v 1.4 1998/01/18 04:09:49 mark Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 1997 Mark Brinicombe
|
||||
* All rights reserved.
|
||||
*
|
||||
* 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 by Mark Brinicombe for
|
||||
* the NetBSD Project.
|
||||
* 4. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* This driver uses the generic dp8390 IC driver
|
||||
*
|
||||
* Currently supports:
|
||||
* ANT EtherM
|
||||
*/
|
||||
/*#define NEW
|
||||
#define DP8390_DEBUG*/
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/device.h>
|
||||
#include <sys/errno.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/syslog.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/mbuf.h>
|
||||
|
||||
#include <net/if.h>
|
||||
#include <net/if_ether.h>
|
||||
|
||||
#include <machine/bus.h>
|
||||
#include <machine/irqhandler.h>
|
||||
#include <machine/io.h>
|
||||
#include <machine/bootconfig.h>
|
||||
#include <machine/katelib.h>
|
||||
|
||||
#include <dev/ic/dp8390reg.h>
|
||||
/*#include <dev/ic/dp8390var.h>*/ /* Temporary till we merge */
|
||||
#include <arch/arm32/dev/dp8390var.h>
|
||||
#include <arch/arm32/dev/dp8390_pio.h>
|
||||
#include <arch/arm32/podulebus/podulebus.h>
|
||||
#include <arch/arm32/podulebus/podules.h>
|
||||
#include <arch/arm32/podulebus/if_emreg.h>
|
||||
|
||||
/*
|
||||
* em_softc: per line info and status
|
||||
*/
|
||||
struct em_softc {
|
||||
struct dp8390_softc sc_dp8390;
|
||||
int sc_podule_number;
|
||||
podule_t *sc_podule;
|
||||
bus_space_tag_t sc_iot;
|
||||
bus_space_handle_t sc_ioh;
|
||||
struct bus_space sc_tag;
|
||||
};
|
||||
|
||||
#ifdef DP8390_DEBUG
|
||||
#define DPRINTF(x) printf x
|
||||
#else
|
||||
#define DPRINTF(x)
|
||||
#endif
|
||||
|
||||
static int emprobe __P((struct device *, struct cfdata *, void *));
|
||||
static void emattach __P((struct device *, struct device *, void *));
|
||||
|
||||
struct cfattach em_ca = {
|
||||
sizeof(struct em_softc), emprobe, emattach
|
||||
};
|
||||
|
||||
/*
|
||||
* Determine if the device is present.
|
||||
*/
|
||||
static int
|
||||
emprobe(parent, cf, aux)
|
||||
struct device *parent;
|
||||
struct cfdata *cf;
|
||||
void *aux;
|
||||
{
|
||||
struct podule_attach_args *pa = (void *) aux;
|
||||
|
||||
/* Look for a network slot interface */
|
||||
if (matchpodule(pa, MANUFACTURER_ANT, PODULE_ANT_ETHERM, -1) == 0)
|
||||
return(0);
|
||||
|
||||
return(1);
|
||||
}
|
||||
|
||||
/*
|
||||
* Install interface into kernel networking data structures.
|
||||
*/
|
||||
static void
|
||||
emattach(parent, self, aux)
|
||||
struct device *parent, *self;
|
||||
void *aux;
|
||||
{
|
||||
struct podule_attach_args *pa = (void *)aux;
|
||||
struct em_softc *emsc = (void *)self;
|
||||
struct dp8390_softc *sc = &emsc->sc_dp8390;
|
||||
int dsr;
|
||||
int loop;
|
||||
|
||||
/* Check a few things about the attach args */
|
||||
|
||||
if (pa->pa_podule_number == -1)
|
||||
panic("Podule has disappeared !");
|
||||
|
||||
emsc->sc_podule_number = pa->pa_podule_number;
|
||||
emsc->sc_podule = pa->pa_podule;
|
||||
podules[emsc->sc_podule_number].attached = 1; /* XXX */
|
||||
|
||||
/*
|
||||
* Ok we need our own bus tag as the register spacing
|
||||
* is not the default.
|
||||
*
|
||||
* For the podulebus the bus tag cookie is the shift
|
||||
* to apply to registers
|
||||
* So duplicate the bus space tag and change the
|
||||
* cookie.
|
||||
*/
|
||||
|
||||
emsc->sc_tag = *pa->pa_iot;
|
||||
emsc->sc_tag.bs_cookie = (void *) 5;
|
||||
emsc->sc_iot = &emsc->sc_tag;
|
||||
|
||||
/* Map all the EtherM I/O space */
|
||||
if (bus_space_map(emsc->sc_iot, emsc->sc_podule->fast_base + EM_IO_OFFSET,
|
||||
EM_IO_SIZE, 0, &emsc->sc_ioh))
|
||||
panic("%s: Cannot map IO space\n", self->dv_xname);
|
||||
|
||||
/* Inherit flags from the config */
|
||||
sc->sc_flags = self->dv_cfdata->cf_flags;
|
||||
sc->sc_flags |= DP8390_FORCE_PIO | DP8390_FORCE_16BIT_MODE;
|
||||
|
||||
/* Set up various softc defaults */
|
||||
sc->is790 = 0;
|
||||
|
||||
/* Map register offsets */
|
||||
for (loop = 0; loop < 16; loop++)
|
||||
sc->sc_reg_map[loop] = loop;
|
||||
|
||||
sc->dcr_reg = (ED_DCR_FT1 | ED_DCR_WTS | ED_DCR_LS);
|
||||
|
||||
/* Map the NIC registers */
|
||||
sc->sc_regt = emsc->sc_iot;
|
||||
if (bus_space_subregion(emsc->sc_iot, emsc->sc_ioh,
|
||||
EM_NIC_OFFSET, EM_NIC_SIZE, &sc->sc_regh)) {
|
||||
panic(" failed to map register space\n");
|
||||
}
|
||||
|
||||
/* Set up the packet buffer memory */
|
||||
sc->page_offset = 0x40;
|
||||
sc->mem_start = 0x4000;
|
||||
sc->mem_size = 0x4000;
|
||||
|
||||
/* Map the PIO data register for the buffer memory */
|
||||
sc->sc_buft = emsc->sc_iot;
|
||||
if (bus_space_subregion(emsc->sc_iot, emsc->sc_ioh,
|
||||
EM_DATA_OFFSET, sc->mem_size, &sc->sc_bufh)) {
|
||||
panic(" failed to map register space\n");
|
||||
}
|
||||
|
||||
/* Build station address from machine ID */
|
||||
sc->sc_enaddr[0] = 0x00;
|
||||
sc->sc_enaddr[1] = 0x00;
|
||||
sc->sc_enaddr[2] = 0xa4;
|
||||
sc->sc_enaddr[3] = bootconfig.machine_id[2] + 0x10;
|
||||
sc->sc_enaddr[4] = bootconfig.machine_id[1];
|
||||
sc->sc_enaddr[5] = bootconfig.machine_id[0];
|
||||
|
||||
/*
|
||||
* Override test_mem, write_mbuf,ring_copy and read_hdr functions;
|
||||
* other defaults already work properly.
|
||||
*/
|
||||
sc->test_mem = dp8390_pio_test_mem;
|
||||
sc->write_mbuf = dp8390_pio_write_mbuf;
|
||||
sc->ring_copy = dp8390_pio_ring_copy;
|
||||
sc->read_hdr= dp8390_pio_read_hdr;
|
||||
|
||||
printf("\n");
|
||||
|
||||
if (dp8390_config(sc)) {
|
||||
bus_space_unmap(emsc->sc_iot, emsc->sc_ioh, EM_IO_SIZE);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Report packet buffer memory size */
|
||||
printf("%s: %dKB buffer memory", self->dv_xname, sc->mem_size / 1024);
|
||||
|
||||
/* Get the Diagnostic Status Register */
|
||||
dsr = bus_space_read_1(emsc->sc_iot, emsc->sc_ioh, EM_DSR_REG);
|
||||
|
||||
/* Check for bits that indicate a fault */
|
||||
if (!(dsr & EM_DSR_20M))
|
||||
printf(", VCO faulty");
|
||||
if (!(dsr & EM_DSR_TCOK))
|
||||
printf(", TxClk faulty");
|
||||
|
||||
/* Report status of card */
|
||||
if (dsr & EM_DSR_POL)
|
||||
printf(", UTP reverse polarity");
|
||||
if (dsr & EM_DSR_JAB)
|
||||
printf(", jabber");
|
||||
if (dsr & EM_DSR_LNK)
|
||||
printf(", link OK");
|
||||
if (dsr & EM_DSR_LBK)
|
||||
printf(", loopback");
|
||||
if (dsr & EM_DSR_UTP)
|
||||
printf(", UTP");
|
||||
printf("\n");
|
||||
|
||||
/* Install an interrupt handler */
|
||||
sc->sc_ih = intr_claim(IRQ_NETSLOT, IPL_NET, "net: em", dp8390_intr, sc);
|
||||
if (sc->sc_ih == NULL)
|
||||
panic("%s: Cannot install IRQ handler", self->dv_xname);
|
||||
}
|
||||
|
||||
|
||||
#if 0
|
||||
static int
|
||||
em_intr(arg)
|
||||
void *arg;
|
||||
{
|
||||
struct dp8390_softc *sc = arg;
|
||||
|
||||
if (dp8390_intr(sc, 0))
|
||||
return(1);
|
||||
return(0);
|
||||
}
|
||||
#endif
|
|
@ -1,58 +0,0 @@
|
|||
/* $NetBSD: if_emreg.h,v 1.1 1997/10/15 00:29:29 mark Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997 Mark Brinicombe
|
||||
* All rights reserved.
|
||||
*
|
||||
* 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 by Mark Brinicombe
|
||||
* 4. The name of the company nor the name of the author may be used to
|
||||
* endorse or promote products derived from this software without specific
|
||||
* prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
|
||||
*
|
||||
* if_emreg.h
|
||||
*
|
||||
* Ether M register definitions.
|
||||
*/
|
||||
|
||||
#define EM_IO_OFFSET 0x800 /* Byte offset of IO space from podule base */
|
||||
#define EM_IO_SIZE 0x400 /* Size of IO space */
|
||||
|
||||
#define EM_NIC_OFFSET 0 /* Offset of NIC in IO space */
|
||||
#define EM_NIC_SIZE 16 /* size in words */
|
||||
#define EM_DATA_OFFSET 16 /* Offset for data reg in IO sapce */
|
||||
#define EM_DATA_SIZE 1 /* size is words */
|
||||
|
||||
#define EM_RESET_REG 0x1c /* Offset from IO base */
|
||||
#define EM_RESET2_REG 0x1f /* Offset from IO base */
|
||||
#define EM_DSR_REG 0x1d /* Offset from IO base */
|
||||
|
||||
/* Diagnostic status register */
|
||||
#define EM_DSR_20M (1 << 1) /* 20MHz VCO functioning */
|
||||
#define EM_DSR_TCOK (1 << 2) /* Transmit clock functioning */
|
||||
#define EM_DSR_POL (1 << 3) /* Polarity of UTP link */
|
||||
#define EM_DSR_JAB (1 << 4) /* Jabber state */
|
||||
#define EM_DSR_LNK (1 << 5) /* Link state */
|
||||
#define EM_DSR_LBK (1 << 6) /* Lookback mode */
|
||||
#define EM_DSR_UTP (1 << 7) /* Twisted pair selected */
|
Loading…
Reference in New Issue