Skip to content

Commit 6d3b63b

Browse files
committed
Plan 9 from Bell Labs 2014-05-03
1 parent cc3493d commit 6d3b63b

File tree

1 file changed

+7
-13
lines changed

1 file changed

+7
-13
lines changed

sys/src/9/pc/ethervt6105m.c

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
/*
22
* VIA VT6105M Fast Ethernet Controller (Rhine III).
33
* To do:
4-
* cache-line size alignments - done
5-
* reduce tx interrupts - done
64
* reorganise initialisation/shutdown/reset
75
* adjust Tx FIFO threshold on underflow - untested
86
* why does the link status never cause an interrupt?
97
* use the lproc as a periodic timer for stalls, etc.
10-
* checksum offload - done
118
* take non-HW stuff out of descriptor for 64-bit
129
* cleanliness
1310
* why does the receive buffer alloc have a +3?
@@ -286,11 +283,10 @@ enum {
286283
Crcsz = 4,
287284
Bslop = 48,
288285
Rdbsz = ETHERMAXTU+Crcsz+Bslop,
286+
Maxus = 1000000, /* Soekris 5501s take a while to reset */
289287

290288
Nrxstats = 8,
291289
Ntxstats = 9,
292-
293-
Txcopy = 128,
294290
};
295291

296292
typedef struct Ctlr Ctlr;
@@ -978,12 +974,12 @@ vt6105Mmiimicmd(Mii* mii, int pa, int ra, int cmd, int data)
978974
csr16w(ctlr, Miidata, data);
979975
csr8w(ctlr, Miicr, cmd);
980976

981-
for(timeo = 0; timeo < 10000; timeo++){
977+
for(timeo = 0; timeo < Maxus; timeo++){
982978
if(!(csr8r(ctlr, Miicr) & cmd))
983979
break;
984980
microdelay(1);
985981
}
986-
if(timeo >= 10000)
982+
if(timeo >= Maxus)
987983
return -1;
988984

989985
if(cmd == Wcmd)
@@ -1029,13 +1025,12 @@ vt6105Mdetach(Ctlr* ctlr)
10291025
*/
10301026
csr16w(ctlr, Cr, Stop);
10311027
csr16w(ctlr, Cr, Stop|Sfrst);
1032-
/* limit used to be 10000, but that wasn't enough for our Soekris 5501s */
1033-
for(timeo = 0; timeo < 100000; timeo++){
1028+
for(timeo = 0; timeo < Maxus; timeo++){
10341029
if(!(csr16r(ctlr, Cr) & Sfrst))
10351030
break;
10361031
microdelay(1);
10371032
}
1038-
if(timeo >= 1000)
1033+
if(timeo >= Maxus)
10391034
return -1;
10401035

10411036
return 0;
@@ -1064,13 +1059,12 @@ vt6105Mreset(Ctlr* ctlr)
10641059
*/
10651060
r = csr8r(ctlr, Eecsr);
10661061
csr8w(ctlr, Eecsr, Autold|r);
1067-
/* limit used to be 100, but that wasn't enough for our Soekris 5501s */
1068-
for(timeo = 0; timeo < 1000000; timeo++){
1062+
for(timeo = 0; timeo < Maxus; timeo++){
10691063
if(!(csr8r(ctlr, Cr) & Autold))
10701064
break;
10711065
microdelay(1);
10721066
}
1073-
if(timeo >= 1000000)
1067+
if(timeo >= Maxus)
10741068
return -1;
10751069

10761070
for(i = 0; i < Eaddrlen; i++)

0 commit comments

Comments
 (0)