PERFORCE change 89193 for review

Warner Losh imp at FreeBSD.org
Wed Jan 4 20:01:13 PST 2006


http://perforce.freebsd.org/chv.cgi?CH=89193

Change 89193 by imp at 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))


More information about the p4-projects mailing list