Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/mii Add some code from FreeBSD to make the E1147* wo...



details:   https://anonhg.NetBSD.org/src/rev/8b3f5027669b
branches:  trunk
changeset: 329172:8b3f5027669b
user:      christos <christos%NetBSD.org@localhost>
date:      Tue May 13 02:11:26 2014 +0000

description:
Add some code from FreeBSD to make the E1147* work. Still does not autoneg
to GiGE for some reason but it autonegs to 100BaseTX full-duplex.

diffstat:

 sys/dev/mii/makphy.c |  37 ++++++++++++++++++++++++++++++++-----
 1 files changed, 32 insertions(+), 5 deletions(-)

diffs (74 lines):

diff -r 3e41a64d07d0 -r 8b3f5027669b sys/dev/mii/makphy.c
--- a/sys/dev/mii/makphy.c      Tue May 13 02:10:05 2014 +0000
+++ b/sys/dev/mii/makphy.c      Tue May 13 02:11:26 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: makphy.c,v 1.38 2013/12/21 15:20:39 kiyohara Exp $     */
+/*     $NetBSD: makphy.c,v 1.39 2014/05/13 02:11:26 christos Exp $     */
 
 /*-
  * Copyright (c) 1998, 1999, 2000, 2001 The NetBSD Foundation, Inc.
@@ -59,7 +59,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: makphy.c,v 1.38 2013/12/21 15:20:39 kiyohara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: makphy.c,v 1.39 2014/05/13 02:11:26 christos Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -101,11 +101,12 @@
        { MII_OUI_xxMARVELL,            MII_MODEL_xxMARVELL_E1011,
          MII_STR_xxMARVELL_E1011 },
 
-#if 0
-/* doesn't work on eg. HP XW9400 */
+       /* XXX: reported not to work on eg. HP XW9400 */
        { MII_OUI_xxMARVELL,            MII_MODEL_xxMARVELL_E1149,
          MII_STR_xxMARVELL_E1149 },
-#endif
+
+       { MII_OUI_xxMARVELL,            MII_MODEL_xxMARVELL_E1149R,
+         MII_STR_xxMARVELL_E1149R },
 
        { MII_OUI_xxMARVELL,            MII_MODEL_xxMARVELL_E1111,
          MII_STR_xxMARVELL_E1111 },
@@ -153,6 +154,7 @@
        aprint_normal(": %s, rev. %d\n", mpd->mpd_name, MII_REV(ma->mii_id2));
 
        sc->mii_dev = self;
+       sc->mii_mpd_model = MII_MODEL(ma->mii_id2);
        sc->mii_inst = mii->mii_instance;
        sc->mii_phy = ma->mii_phyno;
        sc->mii_funcs = &makphy_funcs;
@@ -160,6 +162,31 @@
        sc->mii_flags = ma->mii_flags;
        sc->mii_anegticks = MII_ANEGTICKS;
 
+       switch (sc->mii_mpd_model) {
+       case MII_MODEL_xxMARVELL_E1011:
+       case MII_MODEL_xxMARVELL_E1112:
+               if (PHY_READ(sc, MII_MAKPHY_ESSR) & ESSR_FIBER_LINK)
+                       sc->mii_flags |= MIIF_HAVEFIBER;
+                break;
+       case MII_MODEL_xxMARVELL_E1149:
+       case MII_MODEL_xxMARVELL_E1149R:
+               /*
+                * Some 88E1149 PHY's page select is initialized to
+                * point to other bank instead of copper/fiber bank
+                * which in turn resulted in wrong registers were
+                * accessed during PHY operation. It is believed that
+                * page 0 should be used for copper PHY so reinitialize
+                * MII_MAKPHY_EADR to select default copper PHY. If parent
+                * device know the type of PHY(either copper or fiber),
+                * that information should be used to select default
+                * type of PHY.
+                */
+               PHY_WRITE(sc, MII_MAKPHY_EADR, 0);
+               break;
+       default:
+               break;
+       }
+
        PHY_RESET(sc);
 
        sc->mii_capabilities =



Home | Main Index | Thread Index | Old Index