ref: 076944557b298e805250172360c7ad77ed636d33
parent: f7e6c1741380af9459055c58350a7dc5c60be51f
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Sun Aug 27 20:39:53 EDT 2023
ether82563: clear force speed/duplex bits in link-up (thanks taw) we should not bring the link up in detach(), this makes no sense. bring the link up in attach(), but make sure prior link-speed force bits are clear, so that the information is properly taken from the phy as it negotiates the link speed. tested with i82574 and i82579, and fixes link not working with anything but 1000baseT. thanks taw for your patence!
--- a/sys/src/9/pc/ether82563.c
+++ b/sys/src/9/pc/ether82563.c
@@ -113,6 +113,8 @@
enum { /* Ctrl */
Lrst = 1<<3, /* link reset */
Slu = 1<<6, /* Set Link Up */
+ Frcspd = 1<<11, /* Force Speed */
+ Frcdplx = 1<<12, /* Force Duplex */
Devrst = 1<<26, /* Device Reset */
Rfce = 1<<27, /* Receive Flow Control Enable */
Tfce = 1<<28, /* Transmit Flow Control Enable */
@@ -1347,6 +1349,7 @@
{
char name[KNAMELEN];
Ctlr *ctlr;
+ uint r;
ctlr = edev->ctlr;
qlock(&ctlr->alock);
@@ -1384,6 +1387,11 @@
nexterror();
}
+ /* set link up */
+ r = csr32r(ctlr, Ctrl);
+ r &= ~(Frcspd|Frcdplx); /* dont force */
+ csr32w(ctlr, Ctrl, Slu|r);
+
snprint(name, sizeof name, "#l%dl", edev->ctlrno);
if(csr32r(ctlr, Status) & Tbimode)
kproc(name, serdeslproc, edev); /* mac based serdes */
@@ -1488,9 +1496,6 @@
return -1;
delay(1);
}
-
- r = csr32r(ctlr, Ctrl);
- csr32w(ctlr, Ctrl, Slu|r);
r = csr32r(ctlr, Ctrlext);
csr32w(ctlr, Ctrlext, r|Eerst);
--
⑨