Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/mii when resetting RTL8211F, make sure to disable ma...



details:   https://anonhg.NetBSD.org/src/rev/beee3d52ab21
branches:  trunk
changeset: 807207:beee3d52ab21
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Tue Mar 31 21:01:02 2015 +0000

description:
when resetting RTL8211F, make sure to disable manual MDI mode

diffstat:

 sys/dev/mii/rgephy.c    |  13 ++++++++++---
 sys/dev/mii/rgephyreg.h |   5 ++++-
 2 files changed, 14 insertions(+), 4 deletions(-)

diffs (60 lines):

diff -r e74ec80f1e90 -r beee3d52ab21 sys/dev/mii/rgephy.c
--- a/sys/dev/mii/rgephy.c      Tue Mar 31 20:50:29 2015 +0000
+++ b/sys/dev/mii/rgephy.c      Tue Mar 31 21:01:02 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rgephy.c,v 1.38 2015/03/04 18:21:00 jmcneill Exp $     */
+/*     $NetBSD: rgephy.c,v 1.39 2015/03/31 21:01:02 jmcneill Exp $     */
 
 /*
  * Copyright (c) 2003
@@ -33,7 +33,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rgephy.c,v 1.38 2015/03/04 18:21:00 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rgephy.c,v 1.39 2015/03/31 21:01:02 jmcneill Exp $");
 
 
 /*
@@ -619,7 +619,7 @@
 static void
 rgephy_reset(struct mii_softc *sc)
 {
-       uint16_t ssr;
+       uint16_t ssr, phycr1;
 
        mii_phy_reset(sc);
        DELAY(1000);
@@ -634,6 +634,13 @@
                        ssr &= ~RGEPHY_SSR_ALDPS;
                        PHY_WRITE(sc, RGEPHY_MII_SSR, ssr);
                }
+       } else if (sc->mii_mpd_rev == 6) {
+               /* RTL8211F */
+               phycr1 = PHY_READ(sc, RGEPHY_MII_PHYCR1);
+               if ((phycr1 & RGEPHY_PHYCR1_MDI_MMCE) != 0) {
+                       phycr1 &= ~RGEPHY_PHYCR1_MDI_MMCE;
+                       PHY_WRITE(sc, RGEPHY_MII_PHYCR1, phycr1);
+               }
        } else {
                PHY_WRITE(sc, 0x1F, 0x0000);
                PHY_WRITE(sc, 0x0e, 0x0000);
diff -r e74ec80f1e90 -r beee3d52ab21 sys/dev/mii/rgephyreg.h
--- a/sys/dev/mii/rgephyreg.h   Tue Mar 31 20:50:29 2015 +0000
+++ b/sys/dev/mii/rgephyreg.h   Tue Mar 31 21:01:02 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rgephyreg.h,v 1.7 2015/03/04 18:21:00 jmcneill Exp $   */
+/*     $NetBSD: rgephyreg.h,v 1.8 2015/03/31 21:01:02 jmcneill Exp $   */
 
 /*
  * Copyright (c) 2003
@@ -56,6 +56,9 @@
 #define        RGEPHY_SSR_JABBER       0x0001  /* Jabber */
 
 /* RTL8211F */
+#define RGEPHY_MII_PHYCR1      0x18    /* PHY Specific control register 1 */
+#define RGEPHY_PHYCR1_MDI_MMCE __BIT(9)
+
 #define RGEPHY_MII_PHYSR       0x1a    /* PHY Specific status register */
 #define RGEPHY_PHYSR_ALDPS     __BIT(14)
 #define RGEPHY_PHYSR_MDI_PLUG  __BIT(13)



Home | Main Index | Thread Index | Old Index