Date: Wed, 14 Jun 2006 02:48:01 GMT From: Warner Losh <imp@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 99193 for review Message-ID: <200606140248.k5E2m1Hd026740@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=99193 Change 99193 by imp@imp_Speedy on 2006/06/14 02:47:25 Some debugging stuff. Affected files ... .. //depot/projects/arm/src/sys/boot/arm/at91/libat91/emac.c#15 edit .. //depot/projects/arm/src/sys/boot/arm/at91/libat91/emac.h#4 edit Differences ... ==== //depot/projects/arm/src/sys/boot/arm/at91/libat91/emac.c#15 (text+ko) ==== @@ -256,7 +256,7 @@ process = i; - pFrameType = (unsigned short *) ((p_rxBD[i].address & 0xFFFFFFFC) + 12); + pFrameType = (unsigned short *)((p_rxBD[i].address & 0xFFFFFFFC) + 12); pData = (char *)(p_rxBD[i].address & 0xFFFFFFFC); switch (*pFrameType) { @@ -355,7 +355,6 @@ return (pEmac->EMAC_MAN & 0x0000ffff); } -#if 0 /* * .KB_C_FN_DEFINITION_START * unsigned short AT91F_MII_ReadPhy (AT91PS_EMAC pEmac, unsigned char addr) @@ -373,7 +372,6 @@ pEmac->EMAC_CTL &= ~AT91C_EMAC_MPE; return (pEmac->EMAC_MAN & 0x0000ffff); } -#endif /* * .KB_C_FN_DEFINITION_START @@ -392,7 +390,7 @@ // AT91F_MII_WritePhy(pEmac, 20, 0x70); AT91F_MII_WritePhy(pEmac, 0x0, 0x3300); -// while (AT91F_MII_ReadPhy(pEmac, 0x0) & (1 << 9)); + while (AT91F_MII_ReadPhy(pEmac, 0x0) & (1 << 9)); sec = GetSeconds(); while (1) { for (i = 0; i <= 0x18; i++) @@ -402,14 +400,41 @@ sec = GetSeconds(); } #endif +#ifdef BOOT_KB9202 stat2 = AT91F_MII_ReadPhy(pEmac, MII_STS2_REG); - if (!(stat2 & 0x400)) + if (!(stat2 & MII_STS2_LINK)) return ; update = pEmac->EMAC_CFG & ~(AT91C_EMAC_SPD | AT91C_EMAC_FD); - if (stat2 & 0x4000) + if (stat2 & MII_STS2_100TX) + update |= AT91C_EMAC_SPD; + if (stat2 & MII_STS2_FDX) + 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)) { + printf("emac: missing link status 0x%x\r\n", stat2); + printf("%x\r\n", AT91F_MII_ReadPhy(pEmac, MII_SPEC_STS_REG)); + AT91F_MII_WritePhy(pEmac, 0x0, 0x3300); + while (AT91F_MII_ReadPhy(pEmac, 0x0) & (1 << 9)); + goto again; + return; + } + printf("emac: link"); + stat2 = AT91F_MII_ReadPhy(pEmac, MII_SPEC_STS_REG); + update = pEmac->EMAC_CFG & ~(AT91C_EMAC_SPD | AT91C_EMAC_FD); + if (stat2 & (MII_SSTS_100FDX | MII_SSTS_100HDX)) { + printf(" 100TX"); update |= AT91C_EMAC_SPD; - if (stat2 & 0x200) + } + if (stat2 & (MII_SSTS_100FDX | MII_SSTS_10FDX)) { + printf(" FDX"); update |= AT91C_EMAC_FD; + } + printf("\r\n"); +#endif pEmac->EMAC_CFG = update; } ==== //depot/projects/arm/src/sys/boot/arm/at91/libat91/emac.h#4 (text+ko) ==== @@ -117,6 +117,18 @@ /* MII registers definition */ #define MII_STS_REG 0x01 +#define MII_STS_LINK_STAT 0x04 +#ifdef BOOT_KB9202 #define MII_STS2_REG 0x11 +#define MII_STS2_LINK 0x400 +#define MII_STS2_100TX 0x4000 +#define MII_STS2_FDX 0x200 +#else +#define MII_SPEC_STS_REG 0x11 +#define MII_SSTS_100FDX 0x8000 +#define MII_SSTS_100HDX 0x4000 +#define MII_SSTS_10FDX 0x2000 +#define MII_SSTS_10HDX 0x1000 +#endif #endif /* _EMAC_H_ */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200606140248.k5E2m1Hd026740>