ref: debb786fea3d6ea8018c3d83cdedfdbff0703441
parent: f113e2d6d54ff2b2de6330fdf9f72bbb622e27f4
author: aiju <devnull@localhost>
date: Sat Feb 10 08:15:57 EST 2018
aijuboard bootloader: fix 10BASE-T / 100BASE-TX support
--- a/sys/src/boot/zynq/net.c
+++ b/sys/src/boot/zynq/net.c
@@ -168,6 +168,7 @@
while((mdread(r, MDSTATUS) & LINK) == 0)
;
}
+ *(u32int*)(SLCR_BASE + SLCR_UNLOCK) = UNLOCK_KEY;
v = mdread(r, MDPHYCTRL);
if((v & 0x40) != 0){
puts("1000BASE-T");
@@ -174,14 +175,18 @@
while((mdread(r, MDGSTATUS) & RECVOK) != RECVOK)
;
r[NET_CFG] |= GIGE_EN;
+ *(u32int*)(SLCR_BASE + GEM0_CLK_CTRL) = 1 << 20 | 8 << 8 | 1;
}else if((v & 0x20) != 0){
puts("100BASE-TX");
- r[NET_CFG] = NET_CFG & ~GIGE_EN | SPEED;
+ r[NET_CFG] = r[NET_CFG] & ~GIGE_EN | SPEED;
+ *(u32int*)(SLCR_BASE + GEM0_CLK_CTRL) = 5 << 20 | 8 << 8 | 1;
}else if((v & 0x10) != 0){
puts("10BASE-T");
- r[NET_CFG] = NET_CFG & ~(GIGE_EN | SPEED);
+ r[NET_CFG] = r[NET_CFG] & ~(GIGE_EN | SPEED);
+ *(u32int*)(SLCR_BASE + GEM0_CLK_CTRL) = 20 << 20 | 20 << 8 | 1;
}else
puts("???");
+ *(u32int*)(SLCR_BASE + SLCR_UNLOCK) = LOCK_KEY;
if((v & 0x08) != 0)
puts(" Full Duplex\n");
else{