Subject: kern/8333: patch to support 3COM 3CCFEM556B 10/100 Ether + Modem
To: None <gnats-bugs@gnats.netbsd.org>
From: None <r-katoh@mxp.mesh.ne.jp>
List: netbsd-bugs
Date: 09/06/1999 08:54:01
>Number: 8333
>Category: kern
>Synopsis: patch to support 3COM 3CCFEM556B 10/100 Ether + Modem
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: kern-bug-people (Kernel Bug People)
>State: open
>Class: support
>Submitter-Id: net
>Arrival-Date: Mon Sep 6 08:50:03 1999
>Last-Modified:
>Originator: Ryoji KATO
>Organization:
>Release: NetBSD 1.4
>Environment:
System: NetBSD vaio 1.4 NetBSD 1.4 (VAIO) #6: Fri Sep 3 09:38:12 GMT 1999 nrjryka@latitude.nrj.ericsson.se:/usr/src/netbsd14/compile/VAIO i386
>Description:
NetBSD 1.4 doesn't identify 3Com 3CCFEM556B pc-card and can't make
use of it.
>How-To-Repeat:
Insert 3CCFEM556B card into pc-card slot, reboot, note result of
device probe.
>Fix:
Apply the following patch to NetBSD 1.4.
Index: dev/ic/elink3.c
===================================================================
RCS file: /usr/src/CVSROOT/netbsd.sys/dev/ic/elink3.c,v
retrieving revision 1.1.1.1
diff -c -r1.1.1.1 elink3.c
*** elink3.c 1999/08/27 10:14:17 1.1.1.1
--- elink3.c 1999/08/31 09:06:33
***************
*** 232,237 ****
--- 232,239 ----
void ep_mii_sync __P((struct ep_softc *));
void ep_mii_sendbits __P((struct ep_softc *, u_int32_t, int));
+ void ep_roadrunner_mii_enable __P((struct ep_softc *));
+
static int epbusyeeprom __P((struct ep_softc *));
static inline void ep_reset_cmd __P((struct ep_softc *sc,
u_int cmd, u_int arg));
***************
*** 360,366 ****
if (epbusyeeprom(sc))
return; /* XXX why is eeprom busy? */
bus_space_write_2(iot, ioh, ELINK_W0_EEPROM_COMMAND,
! READ_EEPROM | i);
if (epbusyeeprom(sc))
return; /* XXX why is eeprom busy? */
x = bus_space_read_2(iot, ioh, ELINK_W0_EEPROM_DATA);
--- 362,369 ----
if (epbusyeeprom(sc))
return; /* XXX why is eeprom busy? */
bus_space_write_2(iot, ioh, ELINK_W0_EEPROM_COMMAND,
! (sc->ep_chipset == ELINK_CHIPSET_ROADRUNNER ?
! (READ_EEPROM << 2) : READ_EEPROM) | i);
if (epbusyeeprom(sc))
return; /* XXX why is eeprom busy? */
x = bus_space_read_2(iot, ioh, ELINK_W0_EEPROM_DATA);
***************
*** 459,466 ****
* Now, determine which media we have.
*/
switch (sc->ep_chipset) {
- case ELINK_CHIPSET_BOOMERANG:
case ELINK_CHIPSET_ROADRUNNER:
/*
* If the device has MII, probe it. We won't be using
* any `native' media in this case, only PHYs. If
--- 462,475 ----
* Now, determine which media we have.
*/
switch (sc->ep_chipset) {
case ELINK_CHIPSET_ROADRUNNER:
+ if (sc->ep_flags & ELINK_FLAGS_MII) {
+ ep_roadrunner_mii_enable(sc);
+ GO_WINDOW(0);
+ }
+ /* FALLTHROUGH */
+
+ case ELINK_CHIPSET_BOOMERANG:
/*
* If the device has MII, probe it. We won't be using
* any `native' media in this case, only PHYs. If
***************
*** 798,803 ****
--- 807,818 ----
bus_space_write_2(iot, ioh, ELINK_W1_RUNNER_RDCTL, 0);
}
+ if ((sc->ep_chipset == ELINK_CHIPSET_ROADRUNNER) &&
+ (sc->ep_flags & ELINK_FLAGS_MII)) {
+ ep_roadrunner_mii_enable(sc);
+ GO_WINDOW(1);
+ }
+
/* Enable interrupts. */
bus_space_write_2(iot, ioh, ELINK_COMMAND, SET_RD_0_MASK | S_CARD_FAILURE |
S_RX_COMPLETE | S_TX_COMPLETE | S_TX_AVAIL);
***************
*** 1312,1318 ****
if (sc->sc_ethercom.ec_if.if_flags & IFF_DEBUG)
printf("%s: jabber (%x)\n",
sc->sc_dev.dv_xname, i);
! epreset(sc);
} else if (i & TXS_UNDERRUN) {
++sc->sc_ethercom.ec_if.if_oerrors;
if (sc->sc_ethercom.ec_if.if_flags & IFF_DEBUG)
--- 1327,1336 ----
if (sc->sc_ethercom.ec_if.if_flags & IFF_DEBUG)
printf("%s: jabber (%x)\n",
sc->sc_dev.dv_xname, i);
! if (sc->ep_chipset == ELINK_CHIPSET_ROADRUNNER)
! ep_reset_cmd(sc, ELINK_COMMAND, TX_RESET);
! else
! epreset(sc);
} else if (i & TXS_UNDERRUN) {
++sc->sc_ethercom.ec_if.if_oerrors;
if (sc->sc_ethercom.ec_if.if_flags & IFF_DEBUG)
***************
*** 1323,1329 ****
sc->tx_start_thresh = min(ETHER_MAX_LEN,
sc->tx_start_thresh + 20);
sc->tx_succ_ok = 0;
! epreset(sc);
} else if (i & TXS_MAX_COLLISION) {
++sc->sc_ethercom.ec_if.if_collisions;
bus_space_write_2(iot, ioh, ELINK_COMMAND, TX_ENABLE);
--- 1341,1350 ----
sc->tx_start_thresh = min(ETHER_MAX_LEN,
sc->tx_start_thresh + 20);
sc->tx_succ_ok = 0;
! if (sc->ep_chipset == ELINK_CHIPSET_ROADRUNNER)
! ep_reset_cmd(sc, ELINK_COMMAND, TX_RESET);
! else
! epreset(sc);
} else if (i & TXS_MAX_COLLISION) {
++sc->sc_ethercom.ec_if.if_collisions;
bus_space_write_2(iot, ioh, ELINK_COMMAND, TX_ENABLE);
***************
*** 1404,1410 ****
if (status & S_CARD_FAILURE) {
printf("%s: adapter failure (%x)\n",
sc->sc_dev.dv_xname, status);
! epreset(sc);
return (1);
}
if (status & S_TX_COMPLETE) {
--- 1425,1434 ----
if (status & S_CARD_FAILURE) {
printf("%s: adapter failure (%x)\n",
sc->sc_dev.dv_xname, status);
! if (sc->ep_chipset == ELINK_CHIPSET_ROADRUNNER)
! epinit(sc);
! else
! epreset(sc);
return (1);
}
if (status & S_TX_COMPLETE) {
***************
*** 2221,2224 ****
--- 2245,2266 ----
mctl &= ~MAC_CONTROL_FDX;
bus_space_write_2(iot, ioh, ELINK_W3_MAC_CONTROL, mctl);
GO_WINDOW(1); /* back to operating window */
+ }
+
+ void
+ ep_roadrunner_mii_enable(sc)
+ struct ep_softc *sc;
+ {
+ bus_space_tag_t iot = sc->sc_iot;
+ bus_space_handle_t ioh = sc->sc_ioh;
+
+ /* Roadrunner only: Turn on the MII transceiver */
+ GO_WINDOW(3);
+ bus_space_write_2(iot, ioh, ELINK_W3_RESET_OPTIONS, 0x8040);
+ delay(1000);
+ bus_space_write_2(iot, ioh, ELINK_W3_RESET_OPTIONS, 0xc040);
+ ep_reset_cmd(sc, ELINK_COMMAND, TX_RESET);
+ ep_reset_cmd(sc, ELINK_COMMAND, RX_RESET);
+ delay(1000);
+ bus_space_write_2(iot, ioh, ELINK_W3_RESET_OPTIONS, 0x8040);
}
Index: dev/ic/elink3var.h
===================================================================
RCS file: /usr/src/CVSROOT/netbsd.sys/dev/ic/elink3var.h,v
retrieving revision 1.1.1.1
retrieving revision 1.1.1.1.2.2
diff -c -r1.1.1.1 -r1.1.1.1.2.2
Index: dev/mii/exphy.c
===================================================================
RCS file: /usr/src/CVSROOT/netbsd.sys/dev/mii/exphy.c,v
retrieving revision 1.1.1.1
retrieving revision 1.1.1.1.2.2
diff -c -r1.1.1.1 -r1.1.1.1.2.2
*** exphy.c 1999/08/27 10:14:39 1.1.1.1
--- exphy.c 1999/08/30 14:43:48 1.1.1.1.2.2
***************
*** 102,107 ****
--- 102,111 ----
{
struct mii_attach_args *ma = aux;
+ if (MII_OUI(ma->mii_id1, ma->mii_id2) == MII_OUI_3COM &&
+ MII_MODEL(ma->mii_id2) == MII_MODEL_3COM_UNKNOWN)
+ return(10);
+
/*
* Argh, 3Com PHY reports oui == 0 model == 0!
*/
Index: dev/mii/miidevs
===================================================================
RCS file: /usr/src/CVSROOT/netbsd.sys/dev/mii/miidevs,v
retrieving revision 1.1.1.1
retrieving revision 1.1.1.1.2.1
diff -c -r1.1.1.1 -r1.1.1.1.2.1
*** miidevs 1999/08/27 10:14:40 1.1.1.1
--- miidevs 1999/08/30 12:56:43 1.1.1.1.2.1
***************
*** 51,56 ****
--- 51,57 ----
oui SEEQ 0x0005be Seeq
oui SIS 0x000760 Silicon Integrated Systems
oui TI 0x100014 Texas Instruments
+ oui 3COM 0x00c039 3Com
/*
* List of known models. Grouped by oui.
***************
*** 88,90 ****
--- 89,94 ----
/* Texas Instruments PHYs */
model TI TLAN10T 0x0001 ThunderLAN 10baseT media interface
model TI 100VGPMI 0x0002 ThunderLAN 100VG-AnyLan media interface
+
+ /* 3Com */
+ model 3COM UNKNOWN 0x0014 3Com 10/100 media interface
Index: dev/mii/miidevs.h
===================================================================
RCS file: /usr/src/CVSROOT/netbsd.sys/dev/mii/miidevs.h,v
retrieving revision 1.1.1.1
retrieving revision 1.1.1.1.2.1
diff -c -r1.1.1.1 -r1.1.1.1.2.1
*** miidevs.h 1999/08/27 10:14:40 1.1.1.1
--- miidevs.h 1999/08/30 12:56:43 1.1.1.1.2.1
***************
*** 1,4 ****
! /* $NetBSD: miidevs.h,v 1.5 1999/03/24 21:07:26 thorpej Exp $ */
/*
* THIS FILE AUTOMATICALLY GENERATED. DO NOT EDIT.
--- 1,4 ----
! /* $NetBSD$ */
/*
* THIS FILE AUTOMATICALLY GENERATED. DO NOT EDIT.
***************
*** 58,63 ****
--- 58,64 ----
#define MII_OUI_SEEQ 0x0005be /* Seeq */
#define MII_OUI_SIS 0x000760 /* Silicon Integrated Systems */
#define MII_OUI_TI 0x100014 /* Texas Instruments */
+ #define MII_OUI_3COM 0x00c039 /* 3Com */
/*
* List of known models. Grouped by oui.
***************
*** 108,110 ****
--- 109,115 ----
#define MII_STR_TI_TLAN10T "ThunderLAN 10baseT media interface"
#define MII_MODEL_TI_100VGPMI 0x0002
#define MII_STR_TI_100VGPMI "ThunderLAN 100VG-AnyLan media interface"
+
+ /* 3Com */
+ #define MII_MODEL_3COM_UNKNOWN 0x0014
+ #define MII_STR_3COM_UNKNOWN "3Com 10/100 media interface"
Index: dev/pcmcia/if_ep_pcmcia.c
===================================================================
RCS file: /usr/src/CVSROOT/netbsd.sys/dev/pcmcia/if_ep_pcmcia.c,v
retrieving revision 1.1.1.1
retrieving revision 1.1.1.1.2.1
diff -c -r1.1.1.1 -r1.1.1.1.2.1
*** if_ep_pcmcia.c 1999/08/27 10:14:49 1.1.1.1
--- if_ep_pcmcia.c 1999/08/30 12:56:46 1.1.1.1.2.1
***************
*** 163,168 ****
--- 163,172 ----
ELINK_FLAGS_MII, 0,
PCMCIA_STR_3COM_3C574 },
+ { PCMCIA_PRODUCT_3COM_3CCFEM556BI, ELINK_CHIPSET_ROADRUNNER,
+ ELINK_FLAGS_MII, 0,
+ PCMCIA_STR_3COM_3CCFEM556BI },
+
{ 0, 0,
0, 0,
NULL },
***************
*** 341,346 ****
--- 345,351 ----
*/
/* FALLTHROUGH */
case PCMCIA_PRODUCT_3COM_3C574:
+ case PCMCIA_PRODUCT_3COM_3CCFEM556BI:
/*
* Apparently, some 3c574s do it this way, as well.
*/
***************
*** 359,364 ****
--- 364,371 ----
sc->enable = ep_pcmcia_enable;
sc->disable = ep_pcmcia_disable;
+
+ sc->ep_flags = epp->epp_flags;
epconfig(sc, epp->epp_chipset, enaddr);
Index: dev/pcmcia/pcmcia_cis_quirks.c
===================================================================
RCS file: /usr/src/CVSROOT/netbsd.sys/dev/pcmcia/pcmcia_cis_quirks.c,v
retrieving revision 1.1.1.1
retrieving revision 1.1.1.1.2.1
diff -c -r1.1.1.1 -r1.1.1.1.2.1
*** pcmcia_cis_quirks.c 1999/08/27 10:14:49 1.1.1.1
--- pcmcia_cis_quirks.c 1999/08/30 12:56:47 1.1.1.1.2.1
***************
*** 90,95 ****
--- 90,137 ----
0, /* maxtwins */
};
+ struct pcmcia_function pcmcia_3ccfem556bi_func0 = {
+ 0, /* function number */
+ PCMCIA_FUNCTION_NETWORK,
+ 0x07, /* last cfe number */
+ 0x1000, /* ccr_base */
+ 0x267, /* ccr_mask */
+ };
+
+ struct pcmcia_config_entry pcmcia_3ccfem556bi_func0_cfe0 = {
+ 0x07, /* cfe number */
+ PCMCIA_CFE_IO8 | PCMCIA_CFE_IO16 | PCMCIA_CFE_IRQLEVEL,
+ PCMCIA_IFTYPE_IO,
+ 1, /* num_iospace */
+ 5, /* iomask */
+ { { 0x0020, 0 } }, /* iospace */
+ 0xffff, /* irqmask */
+ 0, /* num_memspace */
+ { }, /* memspace */
+ 0, /* maxtwins */
+ };
+
+ static struct pcmcia_function pcmcia_3ccfem556bi_func1 = {
+ 1, /* function number */
+ PCMCIA_FUNCTION_SERIAL,
+ 0x27, /* last cfe number */
+ 0x1100, /* ccr_base */
+ 0x277, /* ccr_mask */
+ };
+
+ static struct pcmcia_config_entry pcmcia_3ccfem556bi_func1_cfe0 = {
+ 0x27, /* cfe number */
+ PCMCIA_CFE_IO8 | PCMCIA_CFE_IRQLEVEL,
+ PCMCIA_IFTYPE_IO,
+ 1, /* num_iospace */
+ 3, /* iomask */
+ { { 0x0008, 0 } }, /* iospace */
+ 0xffff, /* irqmask */
+ 0, /* num_memspace */
+ { }, /* memspace */
+ 0, /* maxtwins */
+ };
+
static struct pcmcia_function pcmcia_sveclancard_func0 = {
0, /* function number */
PCMCIA_FUNCTION_NETWORK,
***************
*** 117,122 ****
--- 159,170 ----
&pcmcia_3cxem556_func0, &pcmcia_3cxem556_func0_cfe0 },
{ PCMCIA_VENDOR_3COM, PCMCIA_PRODUCT_3COM_3CXEM556, PCMCIA_CIS_INVALID,
&pcmcia_3cxem556_func1, &pcmcia_3cxem556_func1_cfe0 },
+ { PCMCIA_VENDOR_3COM, PCMCIA_PRODUCT_3COM_3CCFEM556BI,
+ PCMCIA_CIS_INVALID,
+ &pcmcia_3ccfem556bi_func0, &pcmcia_3ccfem556bi_func0_cfe0 },
+ { PCMCIA_VENDOR_3COM, PCMCIA_PRODUCT_3COM_3CCFEM556BI,
+ PCMCIA_CIS_INVALID,
+ &pcmcia_3ccfem556bi_func1, &pcmcia_3ccfem556bi_func1_cfe0 },
{ PCMCIA_VENDOR_INVALID, PCMCIA_PRODUCT_INVALID, PCMCIA_CIS_SVEC_LANCARD,
&pcmcia_sveclancard_func0, &pcmcia_sveclancard_func0_cfe0 },
};
Index: dev/pcmcia/pcmciadevs
===================================================================
RCS file: /usr/src/CVSROOT/netbsd.sys/dev/pcmcia/pcmciadevs,v
retrieving revision 1.1.1.1
retrieving revision 1.1.1.1.2.1
diff -c -r1.1.1.1 -r1.1.1.1.2.1
*** pcmciadevs 1999/08/27 10:14:49 1.1.1.1
--- pcmciadevs 1999/08/30 12:56:47 1.1.1.1.2.1
***************
*** 73,78 ****
--- 73,79 ----
product 3COM 3C589 0x0589 3Com 3c589 10Mbps Ethernet
product 3COM 3C574 0x0574 3Com 3c574-TX 10/100Mbps Ethernet
product 3COM 3CXEM556 0x0035 3Com/Megahertz 3CXEM556 Ethernet/Modem
+ product 3COM 3CCFEM556BI 0x0556 3Com/Megahertz 3CCFEM556BI Ethernet/Modem
/* Compex Products */
product COMPEX LINKPORT_ENET_B 0x0100 Compex Linkport ENET-B Ethernet
Index: dev/pcmcia/pcmciadevs.h
===================================================================
RCS file: /usr/src/CVSROOT/netbsd.sys/dev/pcmcia/pcmciadevs.h,v
retrieving revision 1.1.1.1
retrieving revision 1.1.1.1.2.1
diff -c -r1.1.1.1 -r1.1.1.1.2.1
*** pcmciadevs.h 1999/08/27 10:14:49 1.1.1.1
--- pcmciadevs.h 1999/08/30 12:56:47 1.1.1.1.2.1
***************
*** 92,97 ****
--- 92,100 ----
#define PCMCIA_CIS_3COM_3CXEM556 { NULL, NULL, NULL, NULL }
#define PCMCIA_PRODUCT_3COM_3CXEM556 0x0035
#define PCMCIA_STR_3COM_3CXEM556 "3Com/Megahertz 3CXEM556 Ethernet/Modem"
+ #define PCMCIA_CIS_3COM_3CCFEM556BI { NULL, NULL, NULL, NULL }
+ #define PCMCIA_PRODUCT_3COM_3CCFEM556BI 0x0556
+ #define PCMCIA_STR_3COM_3CCFEM556BI "3Com/Megahertz 3CCFEM556BI Ethernet/Modem"
/* Compex Products */
#define PCMCIA_CIS_COMPEX_LINKPORT_ENET_B { NULL, NULL, NULL, NULL }
Index: dev/pcmcia/pcmciadevs_data.h
===================================================================
RCS file: /usr/src/CVSROOT/netbsd.sys/dev/pcmcia/pcmciadevs_data.h,v
retrieving revision 1.1.1.1
retrieving revision 1.1.1.1.2.1
diff -c -r1.1.1.1 -r1.1.1.1.2.1
*** pcmciadevs_data.h 1999/08/27 10:14:49 1.1.1.1
--- pcmciadevs_data.h 1999/08/30 12:56:47 1.1.1.1.2.1
***************
*** 87,92 ****
--- 87,170 ----
"3Com/Megahertz 3CXEM556 Ethernet/Modem" },
},
{
+ PCMCIA_VENDOR_3COM, PCMCIA_PRODUCT_3COM_3CCFEM556BI,
+ PCMCIA_CIS_3COM_3CCFEM556BI,
+ 0,
+ "3Com Corporation",
+ "3Com/Megahertz 3CCFEM556BI Ethernet/Modem" },
+ },
+ {
+ PCMCIA_VENDOR_3COM, PCMCIA_PRODUCT_3COM_3CXEM556,
+ PCMCIA_CIS_3COM_3CXEM556,
+ 0,
+ "3Com Corporation",
+ "3Com/Megahertz 3CXEM556 Ethernet/Modem" },
+ },
+ {
+ PCMCIA_VENDOR_COMPEX, PCMCIA_PRODUCT_COMPEX_LINKPORT_ENET_B,
+ PCMCIA_CIS_COMPEX_LINKPORT_ENET_B,
+ 0,
+ "Compex Corporation",
+ "Compex Linkport ENET-B Ethernet" },
+ },
+ {
+ PCMCIA_VENDOR_DAYNA, PCMCIA_PRODUCT_DAYNA_COMMUNICARD_E_1,
+ PCMCIA_CIS_DAYNA_COMMUNICARD_E_1,
+ 0,
+ "Dayna Corporation",
+ "Dayna CommuniCard E" },
+ },
+ {
+ PCMCIA_VENDOR_DAYNA, PCMCIA_PRODUCT_DAYNA_COMMUNICARD_E_2,
+ PCMCIA_CIS_DAYNA_COMMUNICARD_E_2,
+ 0,
+ "Dayna Corporation",
+ "Dayna CommuniCard E" },
+ },
+ {
+ PCMCIA_VENDOR_DIGITAL, PCMCIA_PRODUCT_DIGITAL_MOBILE_MEDIA_CDROM,
+ PCMCIA_CIS_DIGITAL_MOBILE_MEDIA_CDROM,
+ 0,
+ "Digital Equipment Corporation",
+ "Digital Mobile Media CD-ROM" },
+ },
+ {
+ PCMCIA_VENDOR_FUJITSU, PCMCIA_PRODUCT_FUJITSU_SCSI600,
+ PCMCIA_CIS_FUJITSU_SCSI600,
+ 0,
+ "Fujitsu Corporation",
+ "Fujitsu SCSI 600 Interface" },
+ },
+ {
+ PCMCIA_VENDOR_MOTOROLA, PCMCIA_PRODUCT_MOTOROLA_POWER144,
+ PCMCIA_CIS_MOTOROLA_POWER144,
+ 0,
+ "Motorola Corporation",
+ "Motorola Power 14.4 Modem" },
+ },
+ {
+ PCMCIA_VENDOR_MOTOROLA, PCMCIA_PRODUCT_MOTOROLA_PM100C,
+ PCMCIA_CIS_MOTOROLA_PM100C,
+ 0,
+ "Motorola Corporation",
+ "Motorola Personal Messenger 100C CDPD Modem" },
+ },
+ {
+ PCMCIA_VENDOR_FUJITSU, PCMCIA_PRODUCT_FUJITSU_LA501,
+ PCMCIA_CIS_FUJITSU_LA501,
+ 0,
+ "Fujitsu Corporation",
+ "Fujitsu Towa LA501 Ethernet" },
+ },
+ {
+ PCMCIA_VENDOR_IBM, PCMCIA_PRODUCT_IBM_INFOMOVER,
+ PCMCIA_CIS_IBM_INFOMOVER,
+ 0,
+ "IBM Corporation",
+ "National Semiconductor InfoMover" },
+ },
+ {
+ {
PCMCIA_VENDOR_COMPEX, PCMCIA_PRODUCT_COMPEX_LINKPORT_ENET_B,
PCMCIA_CIS_COMPEX_LINKPORT_ENET_B,
0,
>Audit-Trail:
>Unformatted: