From f87baec1d0369764b761e8ca26a910e982123453 Mon Sep 17 00:00:00 2001 From: cinap_lenrek Date: Fri, 1 Nov 2013 23:39:41 +0100 Subject: [PATCH] make auto negotiation work on 82562et (thanks mischief!) the diver used to skip auto negotiation when auto-negotiation enable (bit 12 in command register) was clear. setting the bit now, which makes auto negotiation work. we skip auto negotiation only when it was already enabled and status regiser indicates completion (bit 9). --- sys/src/9/pc/ether82557.c | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/sys/src/9/pc/ether82557.c b/sys/src/9/pc/ether82557.c index c16d05beb..be7971d67 100644 --- a/sys/src/9/pc/ether82557.c +++ b/sys/src/9/pc/ether82557.c @@ -1212,26 +1212,26 @@ reset(Ether* ether) */ miir(ctlr, phyaddr, 0x01); bmsr = miir(ctlr, phyaddr, 0x01); - if((miir(ctlr, phyaddr, 0) & 0x1000) && !(bmsr & 0x0020)){ - miiw(ctlr, phyaddr, 0x1A, 0x2010); - x = miir(ctlr, phyaddr, 0); - miiw(ctlr, phyaddr, 0, 0x0200|x); - for(i = 0; i < 3000; i++){ - delay(1); - if(miir(ctlr, phyaddr, 0x01) & 0x0020) - break; - } - miiw(ctlr, phyaddr, 0x1A, 0x2000); - - anar = miir(ctlr, phyaddr, 0x04); - anlpar = miir(ctlr, phyaddr, 0x05) & 0x03E0; - anar &= anlpar; - bmcr = 0; - if(anar & 0x380) - bmcr = 0x2000; - if(anar & 0x0140) - bmcr |= 0x0100; + if((miir(ctlr, phyaddr, 0) & 0x1000) && (bmsr & 0x0020)) + break; + miiw(ctlr, phyaddr, 0x1A, 0x2010); + x = miir(ctlr, phyaddr, 0); + miiw(ctlr, phyaddr, 0, 0x1200|x); + for(i = 0; i < 3000; i++){ + delay(1); + if(miir(ctlr, phyaddr, 0x01) & 0x0020) + break; } + miiw(ctlr, phyaddr, 0x1A, 0x2000); + + anar = miir(ctlr, phyaddr, 0x04); + anlpar = miir(ctlr, phyaddr, 0x05) & 0x03E0; + anar &= anlpar; + bmcr = 0; + if(anar & 0x380) + bmcr = 0x2000; + if(anar & 0x0140) + bmcr |= 0x0100; break; }