diff options
author | Aaron Campbell <aaron@cvs.openbsd.org> | 2000-09-16 21:42:18 +0000 |
---|---|---|
committer | Aaron Campbell <aaron@cvs.openbsd.org> | 2000-09-16 21:42:18 +0000 |
commit | fca520c1cec86189f29e49b06cc98d4e7638c34d (patch) | |
tree | f853582f111152ad926fd13946971bfae4e5449b /sys/dev/ic | |
parent | 02350e93099c65d76824cb19e4150ebb699653a3 (diff) |
Add support for 3C556[B] MiniPCI Ethernet adapters, found on some laptops
(i.e., HP OmniBooks). I have sent these changes to a tester but I haven't
heard back yet. Assume for now the changes are OK since all of the other
variants I have still work.
Diffstat (limited to 'sys/dev/ic')
-rw-r--r-- | sys/dev/ic/xl.c | 49 | ||||
-rw-r--r-- | sys/dev/ic/xlreg.h | 16 |
2 files changed, 49 insertions, 16 deletions
diff --git a/sys/dev/ic/xl.c b/sys/dev/ic/xl.c index 8ef84f3d7d9..e8f840e716a 100644 --- a/sys/dev/ic/xl.c +++ b/sys/dev/ic/xl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: xl.c,v 1.6 2000/09/05 18:18:49 aaron Exp $ */ +/* $OpenBSD: xl.c,v 1.7 2000/09/16 21:42:16 aaron Exp $ */ /* * Copyright (c) 1997, 1998, 1999 @@ -31,7 +31,7 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. * - * $FreeBSD: if_xl.c,v 1.72 2000/01/09 21:12:59 wpaul Exp $ + * $FreeBSD: if_xl.c,v 1.77 2000/08/28 20:40:03 wpaul Exp $ */ /* @@ -54,6 +54,8 @@ * 3Com 3c900-FL/FX 10/100Mbps/Fiber-optic * 3Com 3c905C-TX 10/100Mbps/RJ-45 (Tornado ASIC) * 3Com 3c450-TX 10/100Mbps/RJ-45 (Tornado ASIC) + * 3Com 3c556 10/100Mbps/RJ-45 (MiniPCI, Hurricane ASIC) + * 3Com 3c556B 10/100Mbps/RJ-45 (MiniPCI, Hurricane ASIC) * 3Com 3c980-TX 10/100Mbps server adapter (Hurricane ASIC) * 3Com 3c980C-TX 10/100Mbps server adapter (Tornado ASIC) * 3Com 3C575TX 10/100Mbps LAN CardBus PC Card @@ -443,7 +445,8 @@ xl_miibus_readreg(self, phy, reg) struct xl_softc *sc = (struct xl_softc *)self; struct xl_mii_frame frame; - if (sc->xl_bustype != XL_BUS_CARDBUS && phy != 24) + if (!(sc->xl_flags & XL_FLAG_PHYOK) && + sc->xl_bustype != XL_BUS_CARDBUS && phy != 24) return (0); bzero((char *)&frame, sizeof(frame)); @@ -463,7 +466,8 @@ xl_miibus_writereg(self, phy, reg, data) struct xl_softc *sc = (struct xl_softc *)self; struct xl_mii_frame frame; - if (sc->xl_bustype != XL_BUS_CARDBUS && phy != 24) + if (!(sc->xl_flags & XL_FLAG_PHYOK) && + sc->xl_bustype != XL_BUS_CARDBUS && phy != 24) return; bzero((char *)&frame, sizeof(frame)); @@ -528,21 +532,25 @@ int xl_read_eeprom(sc, dest, off, cnt, swap) { int err = 0, i; u_int16_t word = 0, *ptr; - +#define EEPROM_5BIT_OFFSET(A) ((((A) << 2) & 0x7F00) | ((A) & 0x003F)) + /* WARNING! DANGER! + * It's easy to accidentally overwrite the rom content! + * Note: the 3c575 uses 8bit EEPROM offsets. + */ XL_SEL_WIN(0); if (xl_eeprom_wait(sc)) return(1); + if (sc->xl_flags & XL_FLAG_EEPROM_OFFSET_30) + off += 0x30; + for (i = 0; i < cnt; i++) { - switch (sc->xl_bustype) { - case XL_BUS_PCI: - CSR_WRITE_2(sc, XL_W0_EE_CMD, XL_EE_READ | (off + i)); - break; - case XL_BUS_CARDBUS: - CSR_WRITE_2(sc, XL_W0_EE_CMD, 0x230 + (off + i)); - break; - } + if (sc->xl_flags & XL_FLAG_8BITROM) + CSR_WRITE_2(sc, XL_W0_EE_CMD, (2<<8) | (off + i )); + else + CSR_WRITE_2(sc, XL_W0_EE_CMD, + XL_EE_READ | EEPROM_5BIT_OFFSET(off + i)); err = xl_eeprom_wait(sc); if (err) break; @@ -840,7 +848,8 @@ void xl_reset(sc, hard) XL_SEL_WIN(0); if (hard) - CSR_WRITE_2(sc, XL_COMMAND, XL_CMD_RESET); + CSR_WRITE_2(sc, XL_COMMAND, XL_CMD_RESET | + ((sc->xl_flags & XL_FLAG_WEIRDRESET)?0xFF:0)); else CSR_WRITE_2(sc, XL_COMMAND, XL_CMD_RESET | 0x0010); xl_wait(sc); @@ -859,6 +868,12 @@ void xl_reset(sc, hard) CSR_WRITE_2(sc, XL_COMMAND, XL_CMD_TX_RESET); xl_wait(sc); + if (sc->xl_flags & XL_FLAG_WEIRDRESET) { + XL_SEL_WIN(2); + CSR_WRITE_2(sc, XL_W2_RESET_OPTIONS, CSR_READ_2(sc, + XL_W2_RESET_OPTIONS) | 0x4010); + } + /* Wait a little while for the chip to get its brains in order. */ DELAY(100000); return; @@ -956,6 +971,8 @@ void xl_choose_xcvr(sc, verbose) printf("xl%d: guessing 10baseFL\n", sc->xl_unit); break; case TC_DEVICEID_BOOMERANG_10_100BT: /* 3c905-TX */ + case TC_DEVICEID_HURRICANE_556: /* 3c556 */ + case TC_DEVICEID_HURRICANE_556B: /* 3c556B */ sc->xl_media = XL_MEDIAOPT_MII; sc->xl_xcvr = XL_XCVR_MII; if (verbose) @@ -2028,6 +2045,8 @@ void xl_init(xsc) CSR_WRITE_2(sc, XL_COMMAND, XL_CMD_STAT_ENB|XL_INTRS); CSR_WRITE_2(sc, XL_COMMAND, XL_CMD_INTR_ENB|XL_INTRS); + if (sc->xl_flags & XL_FLAG_FUNCREG) + bus_space_write_4(sc->xl_ftag, sc->xl_fhandle, 4, 0x8000); /* Set the RX early threshold */ CSR_WRITE_2(sc, XL_COMMAND, XL_CMD_RX_SET_THRESH|(XL_PACKET_SIZE >>2)); @@ -2354,6 +2373,8 @@ void xl_stop(sc) CSR_WRITE_2(sc, XL_COMMAND, XL_CMD_INTR_ACK|XL_STAT_INTLATCH); CSR_WRITE_2(sc, XL_COMMAND, XL_CMD_STAT_ENB|0); CSR_WRITE_2(sc, XL_COMMAND, XL_CMD_INTR_ENB|0); + if (sc->xl_flags & XL_FLAG_FUNCREG) + bus_space_write_4(sc->xl_ftag, sc->xl_fhandle, 4, 0x8000); if (sc->xl_bustype == XL_BUS_CARDBUS) bus_space_write_4(sc->xl_funct, sc->xl_funch, XL_CARDBUS_INTR, diff --git a/sys/dev/ic/xlreg.h b/sys/dev/ic/xlreg.h index b10a7b6ad21..39dcc0bdbbb 100644 --- a/sys/dev/ic/xlreg.h +++ b/sys/dev/ic/xlreg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: xlreg.h,v 1.4 2000/09/05 18:18:50 aaron Exp $ */ +/* $OpenBSD: xlreg.h,v 1.5 2000/09/16 21:42:16 aaron Exp $ */ /* * Copyright (c) 1997, 1998 @@ -31,7 +31,7 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. * - * $FreeBSD: if_xlreg.h,v 1.17 1999/05/30 18:09:17 wpaul Exp $ + * $FreeBSD: if_xlreg.h,v 1.26 2000/08/28 20:40:03 wpaul Exp $ */ #define XL_BUS_PCI 0x01 @@ -553,6 +553,12 @@ struct xl_mii_frame { #define XL_TYPE_905B 1 #define XL_TYPE_90X 2 +#define XL_FLAG_FUNCREG 0x0001 +#define XL_FLAG_PHYOK 0x0002 +#define XL_FLAG_EEPROM_OFFSET_30 0x0004 +#define XL_FLAG_WEIRDRESET 0x0008 +#define XL_FLAG_8BITROM 0x0010 + struct xl_softc { struct device sc_dev; /* generic device structure */ void * xl_intrhand; /* interrupt handler cookie */ @@ -578,6 +584,9 @@ struct xl_softc { caddr_t xl_ldata_ptr; struct xl_list_data *xl_ldata; struct xl_chain_data xl_cdata; + int xl_flags; + bus_space_handle_t xl_fhandle; + bus_space_tag_t xl_ftag; void (*intr_ack) __P((struct xl_softc *)); void * sc_sdhook; }; @@ -636,6 +645,8 @@ struct xl_stats { * 3Com PCI chip device IDs. */ #define TC_DEVICEID_TORNADO_HOMECONNECT 0x4500 +#define TC_DEVICEID_HURRICANE_556 0x6055 +#define TC_DEVICEID_HURRICANE_556B 0x6056 #define TC_DEVICEID_BOOMERANG_10BT 0x9000 #define TC_DEVICEID_BOOMERANG_10BT_COMBO 0x9001 #define TC_DEVICEID_BOOMERANG_10_100BT 0x9050 @@ -688,6 +699,7 @@ struct xl_stats { #define XL_PCI_HEADER_TYPE 0x0E #define XL_PCI_LOIO 0x10 #define XL_PCI_LOMEM 0x14 +#define XL_PCI_FUNCMEM 0x18 #define XL_PCI_BIOSROM 0x30 #define XL_PCI_INTLINE 0x3C #define XL_PCI_INTPIN 0x3D |