From owner-p4-projects@FreeBSD.ORG Tue Jun 20 21:30:34 2006 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id E567616A47C; Tue, 20 Jun 2006 21:30:33 +0000 (UTC) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id C11E616A474 for ; Tue, 20 Jun 2006 21:30:33 +0000 (UTC) (envelope-from imp@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4584543D6D for ; Tue, 20 Jun 2006 21:30:33 +0000 (GMT) (envelope-from imp@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.6/8.13.6) with ESMTP id k5KLUXYa075181 for ; Tue, 20 Jun 2006 21:30:33 GMT (envelope-from imp@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.6/8.13.4/Submit) id k5KLUWQh075178 for perforce@freebsd.org; Tue, 20 Jun 2006 21:30:32 GMT (envelope-from imp@freebsd.org) Date: Tue, 20 Jun 2006 21:30:32 GMT Message-Id: <200606202130.k5KLUWQh075178@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to imp@freebsd.org using -f From: Warner Losh To: Perforce Change Reviews Cc: Subject: PERFORCE change 99700 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Jun 2006 21:30:34 -0000 http://perforce.freebsd.org/chv.cgi?CH=99700 Change 99700 by imp@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);