summaryrefslogtreecommitdiff
path: root/sys/src/9/pc/ether8169.c
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@gmx.de>2013-05-12 02:58:02 +0200
committercinap_lenrek <cinap_lenrek@gmx.de>2013-05-12 02:58:02 +0200
commit29ece7fda4a8e4eea62eabcfbd8fd04bef613742 (patch)
treea8adf7919344a05090ede22295b3d6c183c09249 /sys/src/9/pc/ether8169.c
parent25bc4e84e9ef8df694937b107111160e707e0299 (diff)
ether8169: and phy wakeup and reset phy before enabling auto negotiation
this brings up the 8198B on BurnZeZ's ASRock Z68 Professional Gen3 board.
Diffstat (limited to 'sys/src/9/pc/ether8169.c')
-rw-r--r--sys/src/9/pc/ether8169.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/sys/src/9/pc/ether8169.c b/sys/src/9/pc/ether8169.c
index 6c9a610ec..51377f454 100644
--- a/sys/src/9/pc/ether8169.c
+++ b/sys/src/9/pc/ether8169.c
@@ -50,6 +50,8 @@ enum { /* registers */
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 @@ rtl8169mii(Ctlr* ctlr)
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 */
}
@@ -405,6 +414,10 @@ rtl8169mii(Ctlr* ctlr)
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);
return 0;