svn commit: r215404 - stable/7/sys/dev/re

Pyun YongHyeon yongari at FreeBSD.org
Tue Nov 16 20:27:02 UTC 2010


Author: yongari
Date: Tue Nov 16 20:27:01 2010
New Revision: 215404
URL: http://svn.freebsd.org/changeset/base/215404

Log:
  MFC r214992:
    Reduce spin wait time consumed in GMII register access routine.
    There were a couple of attempts in the past to reduce it since it
    took more than 1ms. Because mii_tick() periodically polls link
    status, waiting more than 1ms for each GMII register access was
    overkill. Unfortunately all previous attempts were failed with
    various ways on different controllers.
    This time, add additional 20us dealy at the end of GMII register
    access which seems to requirement of all RealTek controllers to
    issue next GMII register access request. This is the same way what
    Linux does.

Modified:
  stable/7/sys/dev/re/if_re.c
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/cddl/contrib/opensolaris/   (props changed)
  stable/7/sys/contrib/dev/acpica/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/dev/re/if_re.c
==============================================================================
--- stable/7/sys/dev/re/if_re.c	Tue Nov 16 20:21:53 2010	(r215403)
+++ stable/7/sys/dev/re/if_re.c	Tue Nov 16 20:27:01 2010	(r215404)
@@ -424,13 +424,12 @@ re_gmii_readreg(device_t dev, int phy, i
 	}
 
 	CSR_WRITE_4(sc, RL_PHYAR, reg << 16);
-	DELAY(1000);
 
 	for (i = 0; i < RL_PHY_TIMEOUT; i++) {
 		rval = CSR_READ_4(sc, RL_PHYAR);
 		if (rval & RL_PHYAR_BUSY)
 			break;
-		DELAY(100);
+		DELAY(25);
 	}
 
 	if (i == RL_PHY_TIMEOUT) {
@@ -438,6 +437,11 @@ re_gmii_readreg(device_t dev, int phy, i
 		return (0);
 	}
 
+	/*
+	 * Controller requires a 20us delay to process next MDIO request.
+	 */
+	DELAY(20);
+
 	return (rval & RL_PHYAR_PHYDATA);
 }
 
@@ -452,13 +456,12 @@ re_gmii_writereg(device_t dev, int phy, 
 
 	CSR_WRITE_4(sc, RL_PHYAR, (reg << 16) |
 	    (data & RL_PHYAR_PHYDATA) | RL_PHYAR_BUSY);
-	DELAY(1000);
 
 	for (i = 0; i < RL_PHY_TIMEOUT; i++) {
 		rval = CSR_READ_4(sc, RL_PHYAR);
 		if (!(rval & RL_PHYAR_BUSY))
 			break;
-		DELAY(100);
+		DELAY(25);
 	}
 
 	if (i == RL_PHY_TIMEOUT) {
@@ -466,6 +469,11 @@ re_gmii_writereg(device_t dev, int phy, 
 		return (0);
 	}
 
+	/*
+	 * Controller requires a 20us delay to process next MDIO request.
+	 */
+	DELAY(20);
+
 	return (0);
 }
 


More information about the svn-src-all mailing list