PERFORCE change 99700 for review
Warner Losh
imp at FreeBSD.org
Tue Jun 20 21:30:34 UTC 2006
http://perforce.freebsd.org/chv.cgi?CH=99700
Change 99700 by imp at imp_lighthouse on 2006/06/20 21:29:46
p4 edit is your friend... Trust your friend...
Re-implement the workaround for the MII problem that we seem to
be having... Wait up to 10seconds for link, and reset the MII
if we don't get link in that time and try again...
Affected files ...
.. //depot/projects/arm/src/sys/boot/arm/at91/libat91/emac.c#19 edit
Differences ...
==== //depot/projects/arm/src/sys/boot/arm/at91/libat91/emac.c#19 (text+ko) ====
@@ -391,20 +391,6 @@
unsigned sec;
int i;
#endif
-#if 0
-
-// AT91F_MII_WritePhy(pEmac, 20, 0x70);
- AT91F_MII_WritePhy(pEmac, 0x0, 0x3300);
- while (AT91F_MII_ReadPhy(pEmac, 0x0) & (1 << 9));
- sec = GetSeconds();
- while (1) {
- for (i = 0; i <= 0x18; i++)
- printf("%x ", AT91F_MII_ReadPhy(pEmac, i));
- printf("\r\n");
- while (GetSeconds() <= sec + 2) continue;
- sec = GetSeconds();
- }
-#endif
#ifdef BOOT_KB9202
stat2 = AT91F_MII_ReadPhy(pEmac, MII_STS2_REG);
if (!(stat2 & MII_STS2_LINK))
@@ -416,21 +402,20 @@
update |= AT91C_EMAC_FD;
#endif
#ifdef BOOT_TSC
-again:;
- stat2 = AT91F_MII_ReadPhy(pEmac, MII_STS_REG);
- stat2 = AT91F_MII_ReadPhy(pEmac, MII_STS_REG);
- if (!(stat2 & MII_STS_LINK_STAT)) {
- sec = GetSeconds();
- printf("emac: missing link status 0x%x\r\n", stat2);
- for (i = 0; i <= 0x18; i++)
- printf("%x ", AT91F_MII_ReadPhy(pEmac, i));
- printf("\r\n");
- while (GetSeconds() <= sec + 2) continue;
- sec = GetSeconds();
- AT91F_MII_WritePhy(pEmac, 0x0, 0x3300);
- while (AT91F_MII_ReadPhy(pEmac, 0x0) & (1 << 9));
- goto again;
- return;
+ while (1) {
+ for (i = 0; i < 10; i++) {
+ stat2 = AT91F_MII_ReadPhy(pEmac, MII_STS_REG);
+ if (stat2 & MII_STS_LINK_STAT)
+ break;
+ printf(".");
+ sec = GetSeconds();
+ while (GetSeconds() <= sec) continue;
+ }
+ if (stat2 & MII_STS_LINK_STAT)
+ break;
+ printf("Resetting MII...");
+ AT91F_MII_WritePhy(pEmac, 0x0, 0x8000);
+ while (AT91F_MII_ReadPhy(pEmac, 0x0) & 0x8000) continue;
}
printf("emac: link");
stat2 = AT91F_MII_ReadPhy(pEmac, MII_SPEC_STS_REG);
More information about the p4-projects
mailing list