[vortex] The mysteries of on-chip MII.

Donald Becker becker@scyld.com
Tue Mar 26 16:50:00 2002


On 26 Mar 2002, Bill Cattey wrote:
> On Mon, 2002-03-25 at 10:58, Bogdan Costescu wrote:
> > I'm a bit surprised that the 3c90x driver (if it's the 3Com one) does this
> > as it was supposed to only support Cyclone and later chips where "use MII"
> > (=6) doesn't make sense, the right value for external MII transceivers is
> > 9 (if it makes sense at all to use this as default media...)
>
> The driver that is doing this heinous thing is the 3c90x driver included
> in the Etherboot distribution
> 	http://etherboot.berlios.de/distribution.html
> Looking at the latest production release (5.0.5) we learn from
> 3c90x.txt:
...
>     The 3c905B cards have a significant 'bug' that relates to the flash
>     prom: unless the card is set internally to the MII transceiver, it
>     will onlyread the first 8k of the PROM image.

OK, I know about this bug.  In the vortex-diag.c program I handle it
thus:
	/* First, work around a chip buglet: the media must be set to EXT MII
	   to read the flash on one Hurricane rev. */
	/* Turn on the MII transceiver for some cards. */
	{
		if (pcidev_tbl[part_idx].flags & HAS_FLASH_BUG) {
			EL3WINDOW(3);
			outl((internal_config & ~0x00f00000)|0x00600000,
				 ioaddr + Wn3_Config);
		}
	...
		if (pcidev_tbl[part_idx].flags & HAS_FLASH_BUG) {
			EL3WINDOW(3);
			outl(internal_config, ioaddr + Wn3_Config);
		}
	}


>     Don't ask why -- it
>     seems really obscure, but it has to do with the way they mux'd the
>     address lines from the PCI bus to the ROM.

The bug is how 3Com overloaded the pin functions so that a few pins both
drive the ROM address bits and transceiver output.

>     So, the solution that I've used is to internally set the card's
>     nvram configuration to use MII when it boots.  The 3c905b driver

Bogus.
The better solution to do what vortex-diag.c is doing: if the part has
the flash addressing bug, save the value of internal_config, temporarily
set MII while copying out the code, and then restore internal_config.

>     does this automatically.  This way, the 16k prom image can be loaded
>     into memory, and then the 3c905b driver can set the temporary
>     configuration of the card to an appropriate value, either
>     configurable by the user or chosen by the driver.

The etherboot code sets the internal_config register, but it should be
using the saved value, not a new value.

>     To enable the 3c905B bugfix, which is necessary for these cards when
>     booting from the Flash ROM, define -DCFG_3C90X_BOOTROM_FIX when
>     building, create a floppy image and boot it once.

This can be done based on the PCI ID rather than hard-wired when
building the ROM.


-- 
Donald Becker				becker@scyld.com
Scyld Computing Corporation		http://www.scyld.com
410 Severn Ave. Suite 210		Second Generation Beowulf Clusters
Annapolis MD 21403			410-990-9993