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: port-sparc64
Date: 05/05/2002 15:11:33
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.
any idea why media options do not appear for the sbus SUNW/fas (FAS366/HME)?
at least it doesnt work on my ss20; thus it usually ends up with 100/hdx
and with this patch it appears to always end up with 10hdx.
maggie [1] ifconfig -m hme0
hme0: flags=8a63<UP,BROADCAST,NOTRAILERS,RUNNING,ALLMULTI,SIMPLEX,MULTICAST> mtu 1500
address: 08:00:20:22:c4:25
media: Ethernet manual (none)
supported Ethernet media:
media manual
> However, it does work:
>
> cp1500-1:thorpej 1$ ifconfig -a
> hme0: flags=8a63<UP,BROADCAST,NOTRAILERS,RUNNING,ALLMULTI,SIMPLEX,MULTICAST> mtu 1500
> address: 08:00:20:9f:1c:9a
> media: Ethernet autoselect (100baseTX full-duplex)
> status: active
> inet 192.168.2.3 netmask 0xffffff00 broadcast 192.168.2.255
> inet6 fe80::a00:20ff:fe9f:1c9a%hme0 prefixlen 64 scopeid 0x1
> inet6 3ffe:507:183:3::3 prefixlen 64
> inet6 3ffe:507:183:3:a00:20ff:fe9f:1c9a prefixlen 64
> lo0: flags=8009<UP,LOOPBACK,MULTICAST> mtu 33184
> inet 127.0.0.1 netmask 0xff000000
> inet6 fe80::1%lo0 prefixlen 64 scopeid 0x2
> inet6 ::1 prefixlen 128
> cp1500-1:thorpej 2$
>
> So, should I go ahead and commit this (well, a cleaned up version,
> anyway :-)? Any discussion to be had here?
>
> --
> -- Jason R. Thorpe <thorpej@wasabisystems.com>
> Index: mii_physubr.c
> ===================================================================
> RCS file: /cvsroot/syssrc/sys/dev/mii/mii_physubr.c,v
> retrieving revision 1.30
> diff -u -r1.30 mii_physubr.c
> --- mii_physubr.c 2001/11/13 07:41:37 1.30
> +++ mii_physubr.c 2002/05/05 03:19:02
> @@ -114,7 +114,7 @@
> int bmcr, anar, gtcr;
>
> if (IFM_SUBTYPE(ife->ifm_media) == IFM_AUTO) {
> - if ((PHY_READ(sc, MII_BMCR) & BMCR_AUTOEN) == 0)
> +// if ((PHY_READ(sc, MII_BMCR) & BMCR_AUTOEN) == 0)
> (void) mii_phy_auto(sc, 1);
> return;
> }