[tulip] Tulip media types 5 and 6 ? (Allied Telesyn AT-2800TX Cardbus)

Matti Aarnio matti.aarnio@zmailer.org
Wed, 3 Jan 2001 12:09:28 +0200


  (This is a story of how AT-2800TX got to work at my IBM ThinkPad T20,
   plus things to ponder/patch at various instances of the driver.)

Hi,

  I have strange media types 5 and 6 at an Allied Telesyn AT-2800TX
CardBus network card, and I tried lots of things before (somehow) realized
that "tulip-diag -ee" spoke of "reset sequence" on them both.  Then I made
following change to Linux 2.4.0-prerelease code, and now using 240prerel
builtin cardbus code, and tulip driver (plus small pcmcia config file),
it is working just fine.

The Scyld driver has type 5 supported, and somehow I thought that 6 is
just a variant of that.


Below you find:
  - relevant bit of dmesg during pcmcia and tulip module load
  - "tulip-diag -ee" output
  - /etc/pcmcia/at2800tx.conf  file
  - patch for 2.4.0-prerelease (included in post-prerelease diff)

Hmm.. I thought I used PCMCIA-CS 3.1.23 code, perhaps it labels itself wrong ?

Linux PCMCIA Card Services 3.1.22
  options:  [pci] [cardbus] [pm]
PCI: Found IRQ 9 for device 00:02.0
PCI: The same IRQ used for device 00:05.0
PCI: The same IRQ used for device 01:00.0
PCI: Found IRQ 10 for device 00:02.1
Yenta IRQ list 0098, PCI irq9
Socket status: 30000006
Yenta IRQ list 0098, PCI irq10
Socket status: 30000006
cs: IO port probe 0x0c00-0x0cff: clean.
cs: IO port probe 0x0800-0x08ff: clean.
cs: IO port probe 0x0100-0x04ff: excluding 0x170-0x177 0x370-0x377 0x4d0-0x4d7
cs: IO port probe 0x0a00-0x0aff: clean.

	inserting the card:

cs: cb_alloc(bus 2): vendor 0x1011, device 0x0019
  got res[1400:147f] for resource 0 of PCI device 1011:0019
  got res[10400000:104003ff] for resource 1 of PCI device 1011:0019
  got res[10000000:1003ffff] for resource 6 of PCI device 1011:0019
PCI: Enabling device 02:00.0 (0000 -> 0003)
Linux Tulip driver version 0.9.12 (December 17, 2000)
divert: allocating divert_blk for eth0
PCI: Setting latency timer of device 02:00.0 to 64
eth0: Digital DS21143 Tulip rev 65 at 0x1400, 00:A0:D2:AF:0C:96, IRQ 9.
eth0:  EEPROM default media type Autosense.
eth0:  Index #0 - Media MII (#11) described by a 21142 MII PHY (3) block.
eth0:  Index #1 - Media 100baseTx (#3) described by a 21143 reset method (5) block.
eth0:  Index #2 - Media MII 100baseT4 (#15) described by a UNKNOWN (6) block.
eth0:  MII transceiver #1 config 3000 status 7809 advertising 00a1.
eth0:  Advertising 01e1 on PHY 1, previously advertising 00a1.
eth0:  Advertising 01e1 (to advertise is 01e1).
eth0: Setting full-duplex based on MII#1 link partner capability of 41e1.


-------  tulip-diag -ee   output ------------
tulip-diag.c:v2.04 9/26/2000 Donald Becker (becker@scyld.com)
 http://www.scyld.com/diag/index.html
Index #1: Found a Digital DS21143 Tulip adapter at 0x1400.
 Port selection is MII, full-duplex.
 Transmit stopped, Receive stopped, full-duplex.
  The Rx process state is 'Stopped'.
  The Tx process state is 'Stopped'.
  The transmit threshold is 128.
  The NWay status register is 000000c6.
EEPROM size is 8.
PCI Subsystem IDs, vendor 1259, device 2802.
CardBus Information Structure at offset 00005002.
Ethernet MAC Station Address 00:A0:D2:AF:0C:96.
EEPROM transceiver/media description for the Digital DS21143 Tulip chip.
Leaf node at offset 30, default media type 0800 (Autosense).
 3 transceiver description blocks:
  Media MII, block type 3, length 19.
   MII interface PHY 0 (media type 11).
   21143 MII initialization sequence is 0 words:.
   21143 MII reset sequence is 3 words: 0807 0000 0002.
    Media capabilities are 7800, advertising 01e1.
    Full-duplex map 5000, Threshold map 1800.
    No MII interrupt.
  Media MII, block type 5, length 8.
   Adapter Reset Sequence, sequence length 3: 0807 0000 0002.
  Media MII 100baseT4, block type 6, length 11.
   Adapter Reset Sequence, sequence length 15: 0704 0008 0000 0200 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 4000.
EEPROM contents:
  1259 2802 5002 0000 0000 0000 0000 0200
  d8fd 0104 a000 afd2 960c 1e00 0000 0800
  9303 0003 0300 0807 0000 0002 7800 01e0
  5000 1800 8800 0305 0807 0000 0002 068b
  040f 0807 0000 0000 0002 0000 0000 0000
  0000 0000 0000 0000 0000 0000 0000 a240
  0000 0000 0000 0000 0000 0000 0000 0000
  0000 0000 0000 0000 0000 0000 0000 0000
 ID block CRC 0xfd (vs. 0xfd).
  Full contents CRC 0x070a (read as 0x0000).
 MII PHY found at address 1, status 0x782d.
  Internal autonegotiation state is 'Autonegotiation disabled'.
---------------------------------------------


--- /etc/pcmcia/at2800tx.conf ---
device "tulip"
  class "network" module "tulip"

card "Allied Telesyn AT-2800TX"
  version "Allied Telesis K.K.", "CentreCOM LA100-CardBus-T V2"
#  manfid  0x0101, 0x0001
  bind "tulip"
---------------------------------



diff -u --recursive --new-file v2.4.0-prerelease/linux/drivers/net/tulip/media.c linux/drivers/net/tulip/media.c
--- v2.4.0-prerelease/linux/drivers/net/tulip/media.c	Mon Jun 19 13:42:39 2000
+++ linux/drivers/net/tulip/media.c	Mon Jan  1 09:54:07 2001
@@ -263,6 +263,24 @@
 			tulip_mdio_write(dev, tp->phys[phy_num], 4, to_advertise);
 			break;
 		}
+		case 5: case 6: {
+			u16 setup[5];
+			u32 csr13val, csr14val, csr15dir, csr15val;
+			for (i = 0; i < 5; i++)
+				setup[i] = get_u16(&p[i*2 + 1]);
+
+			if (startup && mtable->has_reset) {
+				struct medialeaf *rleaf = &mtable->mleaf[mtable->has_reset];
+				unsigned char *rst = rleaf->leafdata;
+				if (tulip_debug > 1)
+					printk(KERN_DEBUG "%s: Resetting the transceiver.\n",
+						   dev->name);
+				for (i = 0; i < rst[0]; i++)
+					outl(get_u16(rst + 1 + (i<<1)) << 16, ioaddr + CSR15);
+			}
+
+			break;
+		}
 		default:
 			printk(KERN_DEBUG "%s:  Invalid media table selection %d.\n",
 					   dev->name, mleaf->type);