Subject: kern/10869: tlp doesn't handle Corega CB-TXL
To: None <gnats-bugs@gnats.netbsd.org>
From: DHOYASHIKI Shinichi <clare@znet.or.jp>
List: netbsd-bugs
Date: 08/21/2000 02:06:15
>Number:         10869
>Category:       kern
>Synopsis:       tlp doesn't handle Corega CB-TXL
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Mon Aug 21 02:07:00 PDT 2000
>Closed-Date:
>Last-Modified:
>Originator:     DHOYASHIKI Shinichi
>Release:        NetBSD-current as of 2000-08-01
>Organization:
>Environment:
System: NetBSD minako 1.5C NetBSD 1.5C (MINAKO) #0: Wed Aug 2 21:56:13 JST 2000 clare@minako:/export/tnf-work/sys.skel/arch/i386/compile/MINAKO i386

(with NetBSD 1.5_ALPHA userland and Toshiba Libretto ff 1100CT laptop PC)

>Description:
	The cardbus ethernet card FEther CB-TXL by Corega K.K. is not
	configured because there are no entry and code something needed
	for this card in the tlp driver.

	This card seemed to be ADMtek AN985 based.

	Please note, the kernel applied patch below may (or may not)
	generate tons of "tlp0: receive error: CRC error" messages
	under load condition like getting a large file via FTP.
	I don't know how to fix this problem.

>How-To-Repeat:
	Get a Corega CB-TXL ethernet card and plug into a cardbus slot of
	NetBSD box.

>Fix:
	Apply following patch.

--- src/sys/dev/ic/tulip.c	Tue Jul  4 13:18:17 2000
+++ sys/dev/ic/tulip.c	Wed Aug  2 23:12:38 2000
@@ -247,6 +247,8 @@
 		sc->sc_filter_setup = tlp_al981_filter_setup;
 		break;
 
+        case TULIP_CHIP_AN983:
+        case TULIP_CHIP_AN985:
 	default:
 		sc->sc_filter_setup = tlp_filter_setup;
 		break;
@@ -1870,6 +1872,8 @@
 	    }
 
 	case TULIP_CHIP_AL981:
+        case TULIP_CHIP_AN983:
+        case TULIP_CHIP_AN985:
 	    {
 		u_int32_t reg;
 		u_int8_t *enaddr = LLADDR(ifp->if_sadl);
--- src/sys/dev/ic/tulipvar.h	Sat May 27 01:38:14 2000
+++ sys/dev/ic/tulipvar.h	Wed Aug  2 20:38:20 2000
@@ -142,9 +142,11 @@
 	TULIP_CHIP_DM9102    = 17,	/* Davicom DM9102 */
 	TULIP_CHIP_DM9102A   = 18,	/* Davicom DM9102A */
 	TULIP_CHIP_AL981     = 19,	/* ADMtek AL981 */
-	TULIP_CHIP_AX88140   = 20,	/* ASIX AX88140 */
-	TULIP_CHIP_AX88141   = 21,	/* ASIX AX88141 */
-	TULIP_CHIP_X3201_3   = 22,	/* Xircom X3201-3 */
+        TULIP_CHIP_AN983     = 20,      /* ADMtek AN983 */
+        TULIP_CHIP_AN985     = 21,      /* ADMtek AN985 */
+        TULIP_CHIP_AX88140   = 22,      /* ASIX AX88140 */
+        TULIP_CHIP_AX88141   = 23,      /* ASIX AX88141 */
+        TULIP_CHIP_X3201_3   = 24,      /* Xircom X3201-3 */
 } tulip_chip_t;
 
 #define	TULIP_CHIP_NAMES						\
@@ -169,6 +171,8 @@
 	"Davicom DM9102",						\
 	"Davicom DM9102A",						\
 	"ADMtek AL981",							\
+        "ADMtek AN983",                                                 \
+        "ADMtek AN985",                                                 \
 	"ASIX AX88140",							\
 	"ASIX AX88141",							\
 	"Xircom X3201-3",						\
--- src/sys/dev/cardbus/cardbusdevs	Wed Jun  7 02:21:42 2000
+++ sys/dev/cardbus/cardbusdevs	Wed Aug  2 20:31:32 2000
@@ -66,6 +66,7 @@
 
 /* Accton products */
 product ACCTON MPX5030  0x1211  MPX 5030/5038 Ethernet
+product ACCTON AN985    0x1216  ADMtek AN985 compatible
 
 /* DEC products */
 product DEC 21142	0x0019	DECchip 21142/3
--- src/sys/dev/cardbus/if_tlp_cardbus.c	Wed Apr  5 04:33:21 2000
+++ sys/dev/cardbus/if_tlp_cardbus.c	Thu Aug  3 21:00:59 2000
@@ -90,6 +90,7 @@
 #include <dev/pci/pcireg.h>
 #include <dev/pci/pcidevs.h>
 
+#include <dev/cardbus/cardbusdevs.h>
 #include <dev/cardbus/cardbusvar.h>
 
 /*
@@ -141,6 +142,9 @@
 	{ PCI_VENDOR_XIRCOM,		PCI_PRODUCT_XIRCOM_X3201_3_21143,
 	  TULIP_CHIP_X3201_3 },
 
+        { PCI_VENDOR_ACCTON,            PCI_PRODUCT_ACCTON_AN985,
+          TULIP_CHIP_AN985 },
+
 	{ 0,				0,
 	  TULIP_CHIP_INVALID },
 };
@@ -234,6 +238,38 @@
 			sc->sc_chip = TULIP_CHIP_21143;
 		break;
 
+#if 0
+        case TULIP_CHIP_AN983:
+        case TULIP_CHIP_AN985:
+            {
+                u_int32_t  reg;
+
+		/*
+		 * ADMtek AL981 and AN985 has special hardwired signature
+		 * register in offset 0x80 of Cardbus configuration registers.
+		 *
+		 * - AL981 and AN985 have 0x09811317
+		 * - AN983 has 0x09851317
+		 */
+                reg = cardbus_conf_read(ct->ct_cc, ct->ct_cf, csc->sc_tag,
+                    0x80);
+                switch (reg) {
+                case 0x09811317:
+                        sc->sc_chip = TULIP_CHIP_AN985;
+                        break;
+
+                case 0x09851317:
+                        sc->sc_chip = TULIP_CHIP_AN983;
+                        break;
+
+                default:
+                        /* nothing */
+                }
+                printf("%s: signature %x\n", sc->sc_dev.dv_xname, reg);
+                break;
+            }
+#endif
+
 	default:
 		/* Nothing. */
 	}
@@ -347,6 +383,22 @@
 		memcpy(enaddr, ca->ca_cis.funce.network.netid, sizeof(enaddr));
 		sc->sc_reset = tlp_cardbus_x3201_reset;
 		sc->sc_mediasw = &tlp_sio_mii_mediasw;
+                break;
+
+        case TULIP_CHIP_AL981:
+        case TULIP_CHIP_AN983:
+        case TULIP_CHIP_AN985:
+                /*
+		 * The ADMtek AL981's Ethernet address is located
+		 * at offset 8 of its EEPROM.
+		 */
+		memcpy(enaddr, &sc->sc_srom[8], ETHER_ADDR_LEN);
+
+		/*
+		 * ADMtek AL981 has a built-in PHY accessed through
+		 * special registers.
+		 */
+		sc->sc_mediasw = &tlp_al981_mediasw;
 		break;
 
 	default:
--- src/sys/dev/pci/pcidevs	Sun Jul 23 09:14:15 2000
+++ sys/dev/pci/pcidevs	Wed Aug  2 20:38:21 2000
@@ -608,6 +608,7 @@
 
 /* Accton products */
 product ACCTON MPX5030	0x1211	MPX 5030/5038 Ethernet
+product ACCTON AN985    0x1216  ADMtek AN985 compatible
 
 /* Acer products */
 product ACER M1435	0x1435	M1435 VL-PCI Bridge
@@ -660,6 +661,8 @@
 
 /* ADMtek products */
 product ADMTEK AL981	0x0981	ADMtek AL981 10/100 Ethernet
+product ADMTEK AN983    0x0985  ADMtek AN983 10/100 Ethernet
+product ADMTEK AN985    0x1985  ADMtek AN985 10/100 Ethernet
 
 /* Advanced System Products */
 product ADVSYS 1200A	0x1100
--- src/sys/dev/pci/if_tlp_pci.c	Tue Jul 18 03:12:00 2000
+++ sys/dev/pci/if_tlp_pci.c	Thu Aug  3 13:07:33 2000
@@ -182,6 +182,10 @@
 
 	{ PCI_VENDOR_ADMTEK,		PCI_PRODUCT_ADMTEK_AL981,
 	  TULIP_CHIP_AL981 },
+        { PCI_VENDOR_ADMTEK,            PCI_PRODUCT_ADMTEK_AN983,
+          TULIP_CHIP_AN983 },
+        { PCI_VENDOR_ADMTEK,            PCI_PRODUCT_ADMTEK_AN985,
+          TULIP_CHIP_AN985 },
 
 #if 0
 	{ PCI_VENDOR_ASIX,		PCI_PRODUCT_ASIX_AX88140A,
@@ -815,6 +819,8 @@
 		break;
 
 	case TULIP_CHIP_AL981:
+        case TULIP_CHIP_AN983:
+        case TULIP_CHIP_AN985:
 		/*
 		 * The ADMtek AL981's Ethernet address is located
 		 * at offset 8 of its EEPROM.
>Release-Note:
>Audit-Trail:
>Unformatted: