ref: ffd9c39d1c019c9592b8b8981a463afa040c7f98
parent: 9ab87f6241ef1b3bb6b179b109b016a383eed6a8
author: aiju <devnull@localhost>
date: Fri Jan 10 15:43:24 EST 2020
dont spin on MDIO
--- a/sys/src/9/cycv/ethercycv.c
+++ b/sys/src/9/cycv/ethercycv.c
@@ -87,18 +87,22 @@
static void
mdwrite(Ctlr *c, int r, u16int v)
{
- while((c->r[GMII_ADDRESS] & 1<<0) != 0);
+ while((c->r[GMII_ADDRESS] & 1<<0) != 0)
+ tsleep(&up->sleep, return0, nil, 1);
c->r[GMII_DATA] = v;
c->r[GMII_ADDRESS] = 1<<11 | (r&31)<<6 | 1<<1 | 1<<0;
- while((c->r[GMII_ADDRESS] & 1<<0) != 0);
+ while((c->r[GMII_ADDRESS] & 1<<0) != 0)
+ tsleep(&up->sleep, return0, nil, 1);
}
static u16int
mdread(Ctlr *c, int r)
{
- while((c->r[GMII_ADDRESS] & 1<<0) != 0);
+ while((c->r[GMII_ADDRESS] & 1<<0) != 0)
+ tsleep(&up->sleep, return0, nil, 1);
c->r[GMII_ADDRESS] = 1<<11 | (r&31)<<6 | 1<<0;
- while((c->r[GMII_ADDRESS] & 1<<0) != 0);
+ while((c->r[GMII_ADDRESS] & 1<<0) != 0)
+ tsleep(&up->sleep, return0, nil, 1);
return c->r[GMII_DATA];
}