diff options
author | Aaron Campbell <aaron@cvs.openbsd.org> | 2000-07-01 03:19:16 +0000 |
---|---|---|
committer | Aaron Campbell <aaron@cvs.openbsd.org> | 2000-07-01 03:19:16 +0000 |
commit | 55d7285dc37b52c197b83bd8c4a938c486012a9b (patch) | |
tree | bd04003d80381d5457daaedb47d4a717e9b63a64 /sys/dev/ic | |
parent | e43d235e99fc4d0e97286cd5e6042cead013b980 (diff) |
- Make the 3CCFE575BT work.
- Add support for the 3CCFEM656C.
- Lots of code cleanup.
Diffstat (limited to 'sys/dev/ic')
-rw-r--r-- | sys/dev/ic/xl.c | 39 | ||||
-rw-r--r-- | sys/dev/ic/xlreg.h | 34 |
2 files changed, 49 insertions, 24 deletions
diff --git a/sys/dev/ic/xl.c b/sys/dev/ic/xl.c index a6b273f477a..f34c7783a46 100644 --- a/sys/dev/ic/xl.c +++ b/sys/dev/ic/xl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: xl.c,v 1.4 2000/06/29 14:07:03 jason Exp $ */ +/* $OpenBSD: xl.c,v 1.5 2000/07/01 03:19:14 aaron Exp $ */ /* * Copyright (c) 1997, 1998, 1999 @@ -57,8 +57,11 @@ * 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 - * 3Com 3C575BTX 10/100Mbps LAN CardBus PC Card + * 3Com 3CCFE575BT 10/100Mbps LAN CardBus PC Card * 3Com 3CCFE575CT 10/100Mbps LAN CardBus PC Card + * 3Com 3CCFEM656 10/100Mbps LAN+56k Modem CardBus PC Card + * 3Com 3CCFEM656B 10/100Mbps LAN+56k Modem CardBus PC Card + * 3Com 3CCFEM656C 10/100Mbps LAN+56k Global Modem CardBus PC Card * 3Com 3cSOHO100-TX 10/100Mbps/RJ-45 (Hurricane ASIC) * Dell Optiplex GX1 on-board 3c918 10/100Mbps/RJ-45 * Dell on-board 3c920 10/100Mbps/RJ-45 @@ -983,9 +986,12 @@ void xl_choose_xcvr(sc, verbose) printf("xl%d: guessing 10/100 plus BNC/AUI\n", sc->xl_unit); break; - case TC_DEVICEID_3CCFE575_CARDBUS: + case TC_DEVICEID_3C575_CARDBUS: case TC_DEVICEID_3CCFE575BT_CARDBUS: case TC_DEVICEID_3CCFE575CT_CARDBUS: + case TC_DEVICEID_3CCFEM656_CARDBUS: + case TC_DEVICEID_3CCFEM656B_CARDBUS: + case TC_DEVICEID_3CCFEM656C_CARDBUS: sc->xl_media = XL_MEDIAOPT_MII; sc->xl_xcvr = XL_XCVR_MII; break; @@ -1435,7 +1441,8 @@ int xl_intr(arg) XL_CMD_INTR_ACK|(status & XL_INTRS)); if (sc->xl_bustype == XL_BUS_CARDBUS) - bus_space_write_4(sc->xl_funct,sc->xl_funch, 4, 0x8000); + bus_space_write_4(sc->xl_funct,sc->xl_funch, + XL_CARDBUS_INTR, XL_CARDBUS_INTR_ACK); if (status & XL_STAT_UP_COMPLETE) { int curpkts; @@ -2015,7 +2022,8 @@ void xl_init(xsc) CSR_WRITE_2(sc, XL_COMMAND, XL_CMD_INTR_ACK|0xFF); if (sc->xl_bustype == XL_BUS_CARDBUS) - bus_space_write_4(sc->xl_funct, sc->xl_funch, 4, 0x8000); + bus_space_write_4(sc->xl_funct, sc->xl_funch, XL_CARDBUS_INTR, + XL_CARDBUS_INTR_ACK); CSR_WRITE_2(sc, XL_COMMAND, XL_CMD_STAT_ENB|XL_INTRS); CSR_WRITE_2(sc, XL_COMMAND, XL_CMD_INTR_ENB|XL_INTRS); @@ -2318,7 +2326,8 @@ void xl_stop(sc) CSR_WRITE_2(sc, XL_COMMAND, XL_CMD_INTR_ENB|0); if (sc->xl_bustype == XL_BUS_CARDBUS) - bus_space_write_4(sc->xl_funct, sc->xl_funch, 4, 0x8000); + bus_space_write_4(sc->xl_funct, sc->xl_funch, XL_CARDBUS_INTR, + XL_CARDBUS_INTR_ACK); /* Stop the stats updater. */ untimeout(xl_stats_update, sc); @@ -2378,16 +2387,15 @@ xl_attach(sc) printf(" address %s\n", ether_sprintf(sc->arpcom.ac_enaddr)); if (sc->xl_bustype == XL_BUS_CARDBUS) { - u_int16_t devid; u_int16_t n; XL_SEL_WIN(2); n = CSR_READ_2(sc, 12); - xl_read_eeprom(sc, (caddr_t)&devid, XL_EE_PRODID, 1, 0); - if (devid != 0x5257) + if (sc->xl_cb_flags & XL_CARDBUS_INVERT_LED_PWR) n |= 0x0010; - if (devid == 0x5257 || devid == 0x6560 || devid == 0x6562) + + if (sc->xl_cb_flags & XL_CARDBUS_INVERT_MII_PWR) n |= 0x4000; CSR_WRITE_2(sc, 12, n); @@ -2449,18 +2457,17 @@ xl_attach(sc) sc->xl_xcvr &= XL_ICFG_CONNECTOR_MASK; sc->xl_xcvr >>= XL_ICFG_CONNECTOR_BITS; - if (sc->xl_bustype == XL_BUS_CARDBUS) { - XL_SEL_WIN(2); - CSR_WRITE_2(sc, 12, 0x4000 | CSR_READ_2(sc, 12)); - } DELAY(100000); xl_mediacheck(sc); if (sc->xl_bustype == XL_BUS_CARDBUS) { - XL_SEL_WIN(2); - CSR_WRITE_2(sc, 12, 0x4000 | CSR_READ_2(sc, 12)); + if (sc->xl_cb_flags & XL_CARDBUS_INVERT_MII_PWR) { + XL_SEL_WIN(2); + CSR_WRITE_2(sc, 12, 0x4000 | CSR_READ_2(sc, 12)); + } } + DELAY(100000); if (sc->xl_media & XL_MEDIAOPT_MII || sc->xl_media & XL_MEDIAOPT_BTX diff --git a/sys/dev/ic/xlreg.h b/sys/dev/ic/xlreg.h index e14e5913d63..708038260d2 100644 --- a/sys/dev/ic/xlreg.h +++ b/sys/dev/ic/xlreg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: xlreg.h,v 1.2 2000/04/18 14:32:49 aaron Exp $ */ +/* $OpenBSD: xlreg.h,v 1.3 2000/07/01 03:19:14 aaron Exp $ */ /* * Copyright (c) 1997, 1998 @@ -34,8 +34,8 @@ * $FreeBSD: if_xlreg.h,v 1.17 1999/05/30 18:09:17 wpaul Exp $ */ -#define XL_BUS_PCI 0x00 -#define XL_BUS_CARDBUS 0x01 +#define XL_BUS_PCI 0x01 +#define XL_BUS_CARDBUS 0x02 #define XL_EE_READ 0x0080 /* read, 5 bit address */ #define XL_EE_WRITE 0x0040 /* write, 5 bit address */ @@ -572,7 +572,8 @@ struct xl_softc { u_int16_t xl_caps; u_int8_t xl_stats_no_timeout; u_int16_t xl_tx_thresh; - u_int8_t xl_bustype; /* i.e., PCI or CardBus? */ + u_int8_t xl_bustype; /* PCI or CardBus? */ + int xl_cb_flags; /* CardBus flags */ int xl_if_flags; caddr_t xl_ldata_ptr; struct xl_list_data *xl_ldata; @@ -631,7 +632,7 @@ struct xl_stats { #define TC_VENDORID 0x10B7 /* - * 3Com chip device IDs. + * 3Com PCI chip device IDs. */ #define TC_DEVICEID_TORNADO_HOMECONNECT 0x4500 #define TC_DEVICEID_BOOMERANG_10BT 0x9000 @@ -650,9 +651,26 @@ struct xl_stats { #define TC_DEVICEID_HURRICANE_10_100BT_SERV 0x9800 #define TC_DEVICEID_TORNADO_10_100BT_SERV 0x9805 #define TC_DEVICEID_HURRICANE_SOHO100TX 0x7646 -#define TC_DEVICEID_3CCFE575_CARDBUS 0x5057 -#define TC_DEVICEID_3CCFE575BT_CARDBUS 0x5157 -#define TC_DEVICEID_3CCFE575CT_CARDBUS 0x5257 + +/* + * 3Com CardBus chip device IDs. + * + * The third character of the model number indicates either a dongle ('C') + * or X-Jack ('X') connector. Presumably, "FE" means "Fast Ethernet", and + * the 'M' indicates a NIC/modem combo card. + */ +#define TC_DEVICEID_3C575_CARDBUS 0x5057 +#define TC_DEVICEID_3CCFE575BT_CARDBUS 0x5157 /* also 3CXFE575BT */ +#define TC_DEVICEID_3CCFE575CT_CARDBUS 0x5257 /* also 3CXFE575CT */ +#define TC_DEVICEID_3CCFEM656_CARDBUS 0x6560 /* also 3CXFEM656 */ +#define TC_DEVICEID_3CCFEM656B_CARDBUS 0x6562 +#define TC_DEVICEID_3CCFEM656C_CARDBUS 0x6564 /* also 3CXFEM656C */ + +#define XL_CARDBUS_INTR 0x0004 +#define XL_CARDBUS_INTR_ACK 0x8000 + +#define XL_CARDBUS_INVERT_LED_PWR 0x0001 +#define XL_CARDBUS_INVERT_MII_PWR 0x0002 /* * PCI low memory base and low I/O base register, and |