Subject: Re: 100baseTX-FDX on HME and the generic MII code
To: Jason R Thorpe <thorpej@wasabisystems.com>
From: john heasley <heas@shrubbery.net>
List: tech-net
Date: 05/06/2002 11:13:15
Sun, May 05, 2002 at 03:11:33PM -0700, john heasley:
> Sat, May 04, 2002 at 08:21:24PM -0700, Jason R Thorpe:
> > So, after fixing a bug in hme_init() (it wasn't telling the MII code
> > to bring up the link), I needed to make one more hack to mii_set_media()
> > to make the HME negotiate 100baseTX-FDX.
> > 
> > Basically, the firmware on my CP1500 seems to disable full-duplex in
> > the ANAR, and then enables AUTONEG.  Thus, we get a 100baseTX link.
> > 
> > Now, as it stands now, mii_set_media() sees that AUTONEG is already set,
> > and thus skips starting the Nway cycle again.  This, however, isn't what
> > we want.  We want to make sure the ANAR gets the new media bits.
> > 
> > This is pretty easy to do -- just remove the test for AUTONEG from
> > mii_set_media().  Unfortunately, this means a busy-loop delay of
> > several milliseconds every time an MII-using Ethernet interface's
> > "init" routine is called (hackish patch attached).
> 
> this seems to work well on my ultra 2's built-in hme.  havent tried it
> on my pci ultra yet, but i havent been able to build a kernel where the
> hme works for more than 2 months.

got around to booting the pci box mentioned above and, besides that
the on-board and pci cards are now reversed (hme1 and hme0 respectively,
though its really the pci busses that are reversed), this patch fixes
the problems i had with these interfaces.  they actually work now,
instead of being "stuck" in auto-selection mode.  whoo-hoo.  thanks
jason.

hme0: flags=8822<BROADCAST,NOTRAILERS,SIMPLEX,MULTICAST> mtu 1500
        address: 08:00:20:c6:27:01
        media: Ethernet autoselect
        supported Ethernet media:
                media none
                media 10baseT
                media 10baseT mediaopt full-duplex
                media 100baseTX
                media 100baseTX mediaopt full-duplex
                media autoselect
hme1: flags=8a63<UP,BROADCAST,NOTRAILERS,RUNNING,ALLMULTI,SIMPLEX,MULTICAST> mtu 1500
        address: 08:00:20:c6:27:01
        media: Ethernet autoselect (100baseTX full-duplex)
        status: active
        supported Ethernet media:
                media none
                media 10baseT
                media 10baseT mediaopt full-duplex
                media 100baseTX
                media 100baseTX mediaopt full-duplex
                media autoselect
        inet 198.58.5.2 netmask 0xffffffe0 broadcast 198.58.5.31

NetBSD 1.5ZC (sky) #0: Mon May  6 03:15:40 GMT 2002
    root@maple:/home/src/sys/arch/sparc64/compile/sky
total memory = 384 MB
avail memory = 348 MB
using 2470 buffers containing 19760 KB of memory
bootpath: /pci@1f,0/pci@1,0/scsi@1,0/disk@0,0
mainbus0 (root): SUNW,UltraSPARC-IIi-Engine
cpu0 at mainbus0: SUNW,UltraSPARC-IIi @ 440.127 MHz, version 0 FPU
cpu0: physical 32K instruction (32 b/l), 16K data (32 b/l), 2048K external (64 b/l)

Sun Microsystems PCIO Ebus2 (miscellaneous bridge, revision 0x01) at pci1 dev 2 function 0 (intrswiz 0x2, intrpin 0x3, i/o off, mem on, no quirks) not configured
hme0 at pci1 dev 2 function 1: PCI configuration registers:

Sun Microsystems PCIO Happy Meal Ethernet (ethernet network, revision 0x01) at ? dev 2 function 1 (intrswiz 0x2, intrpin 0x4, i/o off, mem on, no quirks): Sun Happy Meal Ethernet, rev. 1
hme0: interrupting at ivec 3001
hme0: Ethernet address 08:00:20:c6:27:01
nsphy0 at hme0 phy 1: DP83840 10/100 media interface, rev. 1
nsphy0: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto
ppb1 at pci0 dev 1 function 1: PCI configuration registers:

Sun Microsystems Simba PCI bridge (PCI bridge, revision 0x13) at ? dev 1 function 1 (intrswiz 0, intrpin 0, i/o on, mem on, no quirks): Sun Microsystems Simba PCI bridge (rev. 0x13)
pci2 at ppb1 bus 1
pci2: i/o space, memory space enabled
ebus0 at pci2 dev 1 function 0: PCI configuration registers:

hme1 at pci2 dev 1 function 1: PCI configuration registers:
	...
Sun Microsystems PCIO Happy Meal Ethernet (ethernet network, revision 0x01) at ? dev 1 function 1 (intrswiz 0x1, intrpin 0, i/o off, mem on, no quirks): Sun Happy Meal Ethernet, rev. 1
hme1: interrupting at ivec 3021
hme1: Ethernet address 08:00:20:c6:27:01
nsphy1 at hme1 phy 1: DP83840 10/100 media interface, rev. 1
nsphy1: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto