Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/mii rlphy fails to work without autonegotiation.



details:   https://anonhg.NetBSD.org/src/rev/2c8b36231917
branches:  trunk
changeset: 758733:2c8b36231917
user:      mlelstv <mlelstv%NetBSD.org@localhost>
date:      Sun Nov 14 13:40:36 2010 +0000

description:
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.

diffstat:

 sys/dev/mii/rlphy.c |  26 +++-----------------------
 1 files changed, 3 insertions(+), 23 deletions(-)

diffs (47 lines):

diff -r 6a9e8157f5ee -r 2c8b36231917 sys/dev/mii/rlphy.c
--- a/sys/dev/mii/rlphy.c       Sun Nov 14 13:40:31 2010 +0000
+++ b/sys/dev/mii/rlphy.c       Sun Nov 14 13:40:36 2010 +0000
@@ -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:



Home | Main Index | Thread Index | Old Index