[PATCH] net/gianfar: fix RMII mode detection

Matthew L. Creech mlcreech at gmail.com
Fri Apr 3 07:02:55 EST 2009


On MPC8313, the TSEC flags ECNTRL_REDUCED_MODE (for RGMII) and
ECNTRL_REDUCED_MII_MODE (for RMII) are mutually exclusive (15-32 of
the 8313 reference manual).  The current gianfar driver only checks
for RMII when RGMII is enabled, so plain RMII is never detected.  This
patch makes the flags independent.

Signed-off-by: Matthew Creech <mlcreech at gmail.com>
---
 gianfar.c |   25 ++++++++++++-------------
 1 file changed, 12 insertions(+), 13 deletions(-)

diff -purN orig/drivers/net/gianfar.c linux-2.6.29/drivers/net/gianfar.c
--- orig/drivers/net/gianfar.c	2009-04-02 15:36:16.000000000 -0400
+++ linux-2.6.29/drivers/net/gianfar.c	2009-04-02 15:38:18.000000000 -0400
@@ -628,21 +628,20 @@ static phy_interface_t gfar_get_interfac
 			return PHY_INTERFACE_MODE_TBI;
 	}

+	if (ecntrl & ECNTRL_REDUCED_MII_MODE)
+		return PHY_INTERFACE_MODE_RMII;
+
 	if (ecntrl & ECNTRL_REDUCED_MODE) {
-		if (ecntrl & ECNTRL_REDUCED_MII_MODE)
-			return PHY_INTERFACE_MODE_RMII;
-		else {
-			phy_interface_t interface = priv->interface;
-
-			/*
-			 * This isn't autodetected right now, so it must
-			 * be set by the device tree or platform code.
-			 */
-			if (interface == PHY_INTERFACE_MODE_RGMII_ID)
-				return PHY_INTERFACE_MODE_RGMII_ID;
+		phy_interface_t interface = priv->interface;

-			return PHY_INTERFACE_MODE_RGMII;
-		}
+		/*
+		 * This isn't autodetected right now, so it must
+		 * be set by the device tree or platform code.
+		 */
+		if (interface == PHY_INTERFACE_MODE_RGMII_ID)
+			return PHY_INTERFACE_MODE_RGMII_ID;
+
+		return PHY_INTERFACE_MODE_RGMII;
 	}

 	if (priv->device_flags & FSL_GIANFAR_DEV_HAS_GIGABIT)

-- 
Matthew L. Creech



More information about the Linuxppc-dev mailing list