ref: 9303342faaaa780bbd19a9eb5cb8d449c5cd7add
parent: 3db2f66b3a8e21862db42a2f78b6601c06cfba14
author: cinap_lenrek <cinap_lenrek@gmx.de>
date: Sat May 11 22:58:02 EDT 2013
ether8169: and phy wakeup and reset phy before enabling auto negotiation this brings up the 8198B on BurnZeZ's ASRock Z68 Professional Gen3 board.
--- a/sys/src/9/pc/ether8169.c
+++ b/sys/src/9/pc/ether8169.c
@@ -50,6 +50,8 @@
Tbianar = 0x68, /* TBI Auto-Negotiation Advertisment */
Tbilpar = 0x6A, /* TBI Auto-Negotiation Link Partner */
Phystatus = 0x6C, /* PHY Status */
+ Pmch = 0x6F, /* power management */
+ Ldps = 0x82, /* link down power saving */
Rms = 0xDA, /* Receive Packet Maximum Size */
Cplusc = 0xE0, /* C+ Command */
@@ -388,12 +390,19 @@
ctlr->mii->ctlr = ctlr;
/*
+ * PHY wakeup
+ */
+ csr8w(ctlr, Pmch, csr8r(ctlr, Pmch) | 0x80);
+ rtl8169miimiw(ctlr->mii, 1, 0x1f, 0);
+ rtl8169miimiw(ctlr->mii, 1, 0x0e, 0);
+
+ /*
* Get rev number out of Phyidr2 so can config properly.
* There's probably more special stuff for Macv0[234] needed here.
*/
ctlr->phyv = rtl8169miimir(ctlr->mii, 1, Phyidr2) & 0x0F;
if(ctlr->macv == Macv02){- csr8w(ctlr, 0x82, 1); /* magic */
+ csr8w(ctlr, Ldps, 1); /* magic */
rtl8169miimiw(ctlr->mii, 1, 0x0B, 0x0000); /* magic */
}
@@ -404,6 +413,10 @@
}
print("rtl8169: oui %#ux phyno %d, macv = %#8.8ux phyv = %#4.4ux\n",phy->oui, phy->phyno, ctlr->macv, ctlr->phyv);
+
+ miireset(ctlr->mii);
+
+ microdelay(100);
miiane(ctlr->mii, ~0, ~0, ~0);
--
⑨