From owner-p4-projects@FreeBSD.ORG Thu Jan 5 04:01:12 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 2D1B316A422; Thu, 5 Jan 2006 04:01:12 +0000 (GMT) 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 E2EA116A41F for ; Thu, 5 Jan 2006 04:01:11 +0000 (GMT) (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 AD60C43D53 for ; Thu, 5 Jan 2006 04:01:11 +0000 (GMT) (envelope-from imp@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.1/8.13.1) with ESMTP id k0541BgY060243 for ; Thu, 5 Jan 2006 04:01:11 GMT (envelope-from imp@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.1/8.13.1/Submit) id k0541BuF060240 for perforce@freebsd.org; Thu, 5 Jan 2006 04:01:11 GMT (envelope-from imp@freebsd.org) Date: Thu, 5 Jan 2006 04:01:11 GMT Message-Id: <200601050401.k0541BuF060240@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 89193 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: Thu, 05 Jan 2006 04:01:13 -0000 http://perforce.freebsd.org/chv.cgi?CH=89193 Change 89193 by imp@imp_Speedy on 2006/01/05 04:00:20 MII READ and WRITE REG registers frobbing PHY found on miibus Affected files ... .. //depot/projects/arm/src/sys/arm/at91/if_ate.c#6 edit .. //depot/projects/arm/src/sys/arm/at91/if_atereg.h#2 edit Differences ... ==== //depot/projects/arm/src/sys/arm/at91/if_ate.c#6 (text+ko) ==== @@ -480,11 +480,20 @@ ate_miibus_readreg(device_t dev, int phy, int reg) { struct ate_softc *sc; + int val; + /* + * XXX if we implement agressive power savings, then we need + * XXX to make sure that the clock to the emac is on here + */ + sc = device_get_softc(dev); + WR4(sc, ETH_MAN, ETH_MAN_REG_RD(phy, reg)); + while ((RD4(sc, ETH_SR) & ETH_SR_IDLE) == 0) + continue; + val = RD4(sc, ETH_MAN) & ETH_MAN_VALUE; - - return (0); + return (val); } static void @@ -492,7 +501,16 @@ { struct ate_softc *sc; + /* + * XXX if we implement agressive power savings, then we need + * XXX to make sure that the clock to the emac is on here + */ + sc = device_get_softc(dev); + WR4(sc, ETH_MAN, ETH_MAN_REG_WR(phy, reg, data)); + while ((RD4(sc, ETH_SR) & ETH_SR_IDLE) == 0) + continue; + return; } static device_method_t ate_methods[] = { ==== //depot/projects/arm/src/sys/arm/at91/if_atereg.h#2 (text+ko) ==== @@ -147,9 +147,10 @@ #define ETH_MAN_WRITE (1U << 28) #define ETH_MAN_PHYA_BIT 23 #define ETH_MAN_REGA_BIT 18 +#define ETH_MAN_VALUE 0xffffU #define ETH_MAN_REG_WR(phy, reg, val) \ (ETH_MAN_BITS | ETH_MAN_WRITE | ((phy) << ETH_MAN_PHYA_BIT) | \ - ((reg) << ETH_MAN_REGA_BIT) | val) + ((reg) << ETH_MAN_REGA_BIT) | ((val) & ETH_MAN_VALUE)) #define ETH_MAN_REG_RD(phy, reg) \ (ETH_MAN_BITS | ETH_MAN_READ | ((phy) << ETH_MAN_PHYA_BIT) | \ ((reg) << ETH_MAN_REGA_BIT))