Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/arm32/podulebus Add EtherN/EtherI card support + Et...
details: https://anonhg.NetBSD.org/src/rev/e1d6bd3b3e81
branches: trunk
changeset: 507804:e1d6bd3b3e81
user: chris <chris%NetBSD.org@localhost>
date: Sat Mar 31 15:32:46 2001 +0000
description:
Add EtherN/EtherI card support + EtherH media auto detection support.
Based on updated patch from Mike Pumford, originally submitted in
port-arm32/8765.
diffstat:
sys/arch/arm32/podulebus/if_ne_pbus.c | 358 ++++++++++++++++++++++++++----
sys/arch/arm32/podulebus/if_ne_pbusreg.h | 21 +-
2 files changed, 326 insertions(+), 53 deletions(-)
diffs (truncated from 562 to 300 lines):
diff -r 70c5f6bad6de -r e1d6bd3b3e81 sys/arch/arm32/podulebus/if_ne_pbus.c
--- a/sys/arch/arm32/podulebus/if_ne_pbus.c Sat Mar 31 14:19:51 2001 +0000
+++ b/sys/arch/arm32/podulebus/if_ne_pbus.c Sat Mar 31 15:32:46 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_ne_pbus.c,v 1.7 2001/03/18 16:58:56 bjh21 Exp $ */
+/* $NetBSD: if_ne_pbus.c,v 1.8 2001/03/31 15:32:46 chris Exp $ */
/*
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -8,6 +8,7 @@
* by Mark Brinicombe of Causality Limited.
*
* EtherH code Copyright (c) 1998 Mike Pumford
+ * EtherN/EtherI code Copyright (c) 1999 Mike Pumford
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -43,18 +44,16 @@
*
* Currently supports:
* ANT EtherM network slot cards
- * ICubed EtherH network slot cards
- */
-
-/*
- * TO DO List for this driver.
+ * ICubed Etherlan 600 (EtherH) network slot cards
+ * Irlam EtherN podules
+ * Acorn EtherI podules (identical hardware to EtherN)
*
- * EtherH - The driver currently relies on some part if the RISCOS driver
- * initialisation code to work correctly. This dependancy needs to be
- * removed.
+ * Thanks go to Stephen Borrill for providing the EtherN card
+ * and information to program it.
*
- * Needs to be converted to use media a'la if_ne_pci.c, not the home-grown
- * hack it currently uses.
+ * TO DO List for this Driver.
+ *
+ * EtherM - Needs proper media support.
*/
#include <sys/param.h>
@@ -71,7 +70,6 @@
#include <machine/bus.h>
#include <machine/irqhandler.h>
#include <machine/io.h>
-
#include <dev/ic/dp8390reg.h>
#include <dev/ic/dp8390var.h>
#include <dev/ic/ne2000reg.h>
@@ -90,12 +88,10 @@
int sc_podule_number;
podule_t *sc_podule;
struct bus_space sc_tag; /* Patched tag */
- void *sc_ih; /* Interrupt handler */
+ irqhandler_t *sc_ih; /* Interrupt handler */
struct evcnt sc_intrcnt; /* Interrupt count */
- int sc_mediatype; /* Media Info */
-#define NE_MEDIA_AUTO 0
-#define NE_MEDIA_10BASET 1
-#define NE_MEDIA_10BASE2 2
+ bus_space_handle_t sc_extrah; /* Bus handle for any
+ extra registers */
};
/*
@@ -113,10 +109,20 @@
*/
static u_int8_t *em_ea __P((struct ne_pbus_softc *sc, u_int8_t *buffer));
static void em_postattach __P((struct ne_pbus_softc *sc));
+static void eh600_postattach __P((struct ne_pbus_softc *sc));
static void eh600_preattach __P((struct ne_pbus_softc *sc));
-static void eh600_postattach __P((struct ne_pbus_softc *sc));
static u_int8_t *eh600_ea __P((struct ne_pbus_softc *sc, u_int8_t *buffer));
+int eh600_mediachange __P((struct dp8390_softc *));
+void eh600_mediastatus __P((struct dp8390_softc *, struct ifmediareq *));
+void eh600_init_card __P((struct dp8390_softc *));
+void eh600_init_media __P((struct dp8390_softc *));
+
+int en_mediachange __P((struct dp8390_softc *));
+void en_mediastatus __P((struct dp8390_softc *, struct ifmediareq *));
+void en_init_card __P((struct dp8390_softc *));
+void en_init_media __P((struct dp8390_softc *));
+
/*
* Define a structure to hold all the information required on an NE2000
* clone interface.
@@ -131,12 +137,15 @@
unsigned int nicsize; /* size of NIC (regs) */
unsigned int asicbase; /* byte offset of ASIC */
unsigned int asicsize; /* size of ASIC (regs) */
- unsigned char nicspace; /* fast or mod space ? */
- unsigned char asicspace; /* fast or mod space ? */
+ unsigned int extrabase; /* extra registers byte offset */
+ unsigned int extrasize; /* size of extra registers(regs) */
+ unsigned char nicspace; /* easi,fast or mod space ? */
+ unsigned char asicspace; /* easi,fast or mod space ? */
+ unsigned char extraspace; /* easi,fast or mod space ? */
#define NE_SPACE_FAST 0
#define NE_SPACE_MOD 1
+#define NE_SPACE_EASI 2
unsigned char reserved0; /* not used (padding) */
- unsigned char reserved1; /* not used (padding) */
const char *name; /* name */
u_int8_t * (*getea) /* do this to get the MAC */
__P((struct ne_pbus_softc *sc, u_int8_t *buffer));
@@ -144,27 +153,63 @@
__P((struct ne_pbus_softc *sc));
void (*postattach) /* do this after attach */
__P((struct ne_pbus_softc *sc));
+ int (*mediachange) /* media change */
+ __P((struct dp8390_softc *));
+ void (*mediastatus) /* media status */
+ __P((struct dp8390_softc *, struct ifmediareq *));
+ void (*init_card) /* media init card */
+ __P((struct dp8390_softc *));
+ void (*init_media) /* media init */
+ __P((struct dp8390_softc *));
} ne_clones[] = {
/* ANT EtherM netslot interface */
{
MANUFACTURER_ANT, PODULE_ANT_ETHERM, EM_REGSHIFT,
EM_NIC_OFFSET, EM_NIC_SIZE, EM_ASIC_OFFSET, EM_ASIC_SIZE,
- NE_SPACE_FAST, NE_SPACE_FAST, 0, 0,
- "EtherM", em_ea, NULL, em_postattach
+ 0,0, NE_SPACE_FAST,
+ NE_SPACE_FAST, NE_SPACE_FAST, 0,
+ "EtherM", em_ea, NULL, em_postattach,
+ NULL,NULL,NULL,NULL
},
/* ICubed EtherLan EtherH netslot interface */
{
MANUFACTURER_ICUBED, PODULE_ICUBED_ETHERLAN600, EH600_REGSHIFT,
EH600_NIC_OFFSET, EH600_NIC_SIZE, EH600_ASIC_OFFSET, EH600_ASIC_SIZE,
- NE_SPACE_FAST, NE_SPACE_FAST, 0, 0,
- "EtherLan 600", eh600_ea, eh600_preattach, eh600_postattach
+ EH600_CONTROL_OFFSET, EH600_CONTROL_SIZE, NE_SPACE_FAST,
+ NE_SPACE_FAST, NE_SPACE_FAST, 0,
+ "EtherLan 600", eh600_ea, eh600_preattach, eh600_postattach,
+ eh600_mediachange, eh600_mediastatus, eh600_init_card,
+ eh600_init_media
},
/* Acorn EtherLan EtherH netslot interface */
{
MANUFACTURER_ICUBED, PODULE_ICUBED_ETHERLAN600AEH, EH600_REGSHIFT,
EH600_NIC_OFFSET, EH600_NIC_SIZE, EH600_ASIC_OFFSET, EH600_ASIC_SIZE,
- NE_SPACE_FAST, NE_SPACE_FAST, 0, 0,
- "EtherLan 600A", eh600_ea , eh600_preattach, eh600_postattach
+ EH600_CONTROL_OFFSET, EH600_CONTROL_SIZE, NE_SPACE_FAST,
+ NE_SPACE_FAST, NE_SPACE_FAST, 0,
+ "EtherLan 600A", eh600_ea , eh600_preattach, eh600_postattach,
+ eh600_mediachange, eh600_mediastatus, eh600_init_card,
+ eh600_init_media
+ },
+ /* Irlam EtherN podule. (supplied with NC) */
+ {
+ MANUFACTURER_IRLAM ,PODULE_IRLAM_ETHERN ,EN_REGSHIFT,
+ EN_NIC_OFFSET, EN_NIC_SIZE, EN_ASIC_OFFSET, EN_ASIC_SIZE,
+ 0,0, NE_SPACE_EASI,
+ NE_SPACE_EASI, NE_SPACE_EASI, 0,
+ "EtherN", em_ea, NULL ,NULL,
+ en_mediachange, en_mediastatus, en_init_card,
+ en_init_media
+ },
+ /* Acorn EtherI podule. (supplied with NC) */
+ {
+ MANUFACTURER_ACORN ,PODULE_ACORN_ETHERI ,EN_REGSHIFT,
+ EN_NIC_OFFSET, EN_NIC_SIZE, EN_ASIC_OFFSET, EN_ASIC_SIZE,
+ 0,0, NE_SPACE_EASI,
+ NE_SPACE_EASI, NE_SPACE_EASI, 0,
+ "EtherI", em_ea, NULL ,NULL,
+ en_mediachange, en_mediastatus, en_init_card,
+ en_init_media
},
};
@@ -202,11 +247,15 @@
struct ne_pbus_softc *npsc = (void *)self;
struct ne2000_softc *nsc = &npsc->sc_ne2000;
struct dp8390_softc *dsc = &nsc->sc_dp8390;
+
+ int *media, nmedia, defmedia;
struct ne_clone *ne = NULL;
u_int8_t buffer[6];
u_int8_t *myea;
int loop;
+ media = NULL;
+ nmedia = defmedia = 0;
/* Check a few things about the attach args */
if (pa->pa_podule_number == -1)
@@ -234,6 +283,9 @@
/* Update the nic and asic base addresses appropriately */
switch (ne->nicspace) {
+ case NE_SPACE_EASI:
+ ne->nicbase += npsc->sc_podule->easi_base;
+ break;
case NE_SPACE_MOD:
ne->nicbase += npsc->sc_podule->mod_base;
break;
@@ -243,6 +295,9 @@
break;
}
switch (ne->asicspace) {
+ case NE_SPACE_EASI:
+ ne->asicbase += npsc->sc_podule->easi_base;
+ break;
case NE_SPACE_MOD:
ne->asicbase += npsc->sc_podule->mod_base;
break;
@@ -252,6 +307,19 @@
break;
}
+ switch (ne->extraspace) {
+ case NE_SPACE_EASI:
+ ne->extrabase += npsc->sc_podule->easi_base;
+ break;
+ case NE_SPACE_MOD:
+ ne->extrabase += npsc->sc_podule->mod_base;
+ break;
+ case NE_SPACE_FAST:
+ default:
+ ne->extrabase += npsc->sc_podule->fast_base;
+ break;
+ }
+
/* Report the interface name */
printf(": %s ethernet\n", ne->name);
@@ -283,10 +351,18 @@
printf("%s: cannot map i/o space\n", dsc->sc_dev.dv_xname);
return;
}
+ /* Map any extra register space required by the card */
+ if (ne->extrasize > 0) {
+ if (bus_space_map(&npsc->sc_tag, ne->extrabase, ne->extrasize,
+ 0, &npsc->sc_extrah)) {
+ printf("%s: cannot map extra space\n",
+ dsc->sc_dev.dv_xname);
+ return;
+ }
+ }
/* This interface is always enabled. */
dsc->sc_enabled = 1;
- npsc->sc_mediatype = NE_MEDIA_AUTO; /* Default */
/*
* Now get the ethernet address in an interface specific manner if
@@ -301,6 +377,15 @@
if (ne->preattach)
ne->preattach(npsc);
+ /* if the interface has media support initialise it */
+ if (ne->init_media) {
+ dsc->sc_mediachange = ne->mediachange;
+ dsc->sc_mediastatus = ne->mediastatus;
+ dsc->init_card = ne->init_card;
+ dsc->sc_media_init = ne->init_media;
+/* ne->init_media(dsc,&media,&nmedia,&defmedia); */
+ }
+
/*
* Do generic NE2000 attach. This will read the station address
* from the EEPROM.
@@ -319,6 +404,9 @@
if (npsc->sc_ih == NULL)
panic("%s: Cannot install interrupt handler",
dsc->sc_dev.dv_xname);
+ /* this feels wrong to do this here */
+ npsc->sc_ih->ih_maskaddr = npsc->sc_podule->irq_addr;
+ npsc->sc_ih->ih_maskbits = npsc->sc_podule->irq_mask;
}
/*
@@ -385,51 +473,217 @@
printf("\n");
}
+
/*
* eh600_preattach()
*
- * Detect whether the BNC or UTP media attachment is being used.
+ * pre-initialise the AT/Lantic chipset so that the card probes and
+ * detects properly.
*/
static void
eh600_preattach(sc)
struct ne_pbus_softc *sc;
{
- u_int8_t tmp;
- bus_space_tag_t nict = sc->sc_ne2000.sc_dp8390.sc_regt;
- bus_space_handle_t nich = sc->sc_ne2000.sc_dp8390.sc_regh;
Home |
Main Index |
Thread Index |
Old Index