Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 5 Jan 2006 04:01:11 GMT
From:      Warner Losh <imp@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 89193 for review
Message-ID:  <200601050401.k0541BuF060240@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
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))



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200601050401.k0541BuF060240>