Module Name:    src
Committed By:   mlelstv
Date:           Sun Nov 14 13:40:36 UTC 2010

Modified Files:
        src/sys/dev/mii: rlphy.c

Log Message:
rlphy fails to work without autonegotiation.

Reason is that ifm_data does not store BMCR data but a media index
that gets poked into the BMCR register.

Setting the BMCR and ANAR registers is correctly handled by the
generic function mii_phy_setmedia.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sys/dev/mii/rlphy.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/mii/rlphy.c
diff -u src/sys/dev/mii/rlphy.c:1.25 src/sys/dev/mii/rlphy.c:1.26
--- src/sys/dev/mii/rlphy.c:1.25	Mon Feb 16 08:00:42 2009
+++ src/sys/dev/mii/rlphy.c	Sun Nov 14 13:40:36 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: rlphy.c,v 1.25 2009/02/16 08:00:42 cegger Exp $	*/
+/*	$NetBSD: rlphy.c,v 1.26 2010/11/14 13:40:36 mlelstv Exp $	*/
 /*	$OpenBSD: rlphy.c,v 1.20 2005/07/31 05:27:30 pvalchev Exp $	*/
 
 /*
@@ -38,7 +38,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rlphy.c,v 1.25 2009/02/16 08:00:42 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rlphy.c,v 1.26 2010/11/14 13:40:36 mlelstv Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -165,27 +165,7 @@
 		if ((mii->mii_ifp->if_flags & IFF_UP) == 0)
 			break;
 
-		switch (IFM_SUBTYPE(ife->ifm_media)) {
-		case IFM_AUTO:
-			/*
-			 * If we're already in auto mode, just return.
-			 */
-			if (PHY_READ(sc, MII_BMCR) & BMCR_AUTOEN)
-				return (0);
-			(void) mii_phy_auto(sc, 0);
-			break;
-		case IFM_100_T4:
-			/*
-			 * XXX Not supported as a manual setting right now.
-			 */
-			return (EINVAL);
-		default:
-			/*
-			 * BMCR data is stored in the ifmedia entry.
-			 */
-			PHY_WRITE(sc, MII_ANAR, mii_anar(ife->ifm_media));
-			PHY_WRITE(sc, MII_BMCR, ife->ifm_data);
-		}
+		mii_phy_setmedia(sc);
 		break;
 
 	case MII_TICK:

Reply via email to