diff options
author | yongari <yongari@FreeBSD.org> | 2007-08-14 02:00:04 +0000 |
---|---|---|
committer | yongari <yongari@FreeBSD.org> | 2007-08-14 02:00:04 +0000 |
commit | 04d2779b5cbe7185f3e841545ae4cb51bffc5acb (patch) | |
tree | 51f3cd4a6679004b7b42c41941b2c33a884e0672 /sys | |
parent | 8d074382c8e722d1563c515d0859fbfe6d6182f6 (diff) | |
download | FreeBSD-src-04d2779b5cbe7185f3e841545ae4cb51bffc5acb.zip FreeBSD-src-04d2779b5cbe7185f3e841545ae4cb51bffc5acb.tar.gz |
Make sure to take PHY out of power down mode in device attach.
Without this the PHY wouldn't work as expected. This should fix
dual-boot Windows XP machine where RealTek Windows drivers put the
PHY in power down mode during shutdown. The magic PHY register
accesses come from RealTek driver. No datasheets mention the magic
PHY registers.
In general, the PHY wakeup code should go into PHY driver. However it
seems that it only apply to RTL8169S single chip and it would be
another hack if we have rgephy(4) check what parent driver/chip model
is attached.
Reported by: lofi, Laurens Timmermans ( laurens AT timkapel DOT nl )
Tested by: lofi
Obtained from: RealTek FreeBSD driver
Approved by: re (Ken Smith)
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/re/if_re.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/sys/dev/re/if_re.c b/sys/dev/re/if_re.c index 4f6a9da..4360014 100644 --- a/sys/dev/re/if_re.c +++ b/sys/dev/re/if_re.c @@ -1301,6 +1301,28 @@ re_attach(dev) goto fail; } + /* Take PHY out of power down mode. */ + if (sc->rl_type == RL_8169) { + uint32_t rev; + + rev = CSR_READ_4(sc, RL_TXCFG); + /* HWVERID 0, 1 and 2 : bit26-30, bit23 */ + rev &= 0x7c800000; + if (rev != 0) { + /* RTL8169S single chip */ + switch (rev) { + case RL_HWREV_8169_8110SB: + case RL_HWREV_8169_8110SC: + case RL_HWREV_8168_SPIN2: + re_gmii_writereg(dev, 1, 0x1f, 0); + re_gmii_writereg(dev, 1, 0x0e, 0); + break; + default: + break; + } + } + } + ifp->if_softc = sc; if_initname(ifp, device_get_name(dev), device_get_unit(dev)); ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; |