Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/pci Disable LPLU (Low Power Link Up) on D0 state on ...



details:   https://anonhg.NetBSD.org/src/rev/dea7af787654
branches:  trunk
changeset: 811443:dea7af787654
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Fri Oct 30 07:44:52 2015 +0000

description:
Disable LPLU (Low Power Link Up) on D0 state on 82574, 82583 and ICH* too.

diffstat:

 sys/dev/pci/if_wm.c |  55 ++++++++++++++++++++++++++++++++++++----------------
 1 files changed, 38 insertions(+), 17 deletions(-)

diffs (114 lines):

diff -r a89da09d04b8 -r dea7af787654 sys/dev/pci/if_wm.c
--- a/sys/dev/pci/if_wm.c       Fri Oct 30 07:35:30 2015 +0000
+++ b/sys/dev/pci/if_wm.c       Fri Oct 30 07:44:52 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_wm.c,v 1.376 2015/10/30 07:35:30 msaitoh Exp $      */
+/*     $NetBSD: if_wm.c,v 1.377 2015/10/30 07:44:52 msaitoh Exp $      */
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -73,7 +73,7 @@
  * TODO (in order of importance):
  *
  *     - Check XXX'ed comments
- *     - LPLU other than PCH*
+ *     - Disable D0 LPLU on 8257[12356], 82580 and I350.
  *     - TX Multi queue
  *     - EEE (Energy Efficiency Ethernet)
  *     - Virtual Function
@@ -83,7 +83,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.376 2015/10/30 07:35:30 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.377 2015/10/30 07:44:52 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -738,6 +738,9 @@
 static void    wm_igp3_phy_powerdown_workaround_ich8lan(struct wm_softc *);
 static void    wm_enable_wakeup(struct wm_softc *);
 #endif
+/* LPLU (Low Power Link Up) */
+static void    wm_lplu_d0_disable(struct wm_softc *);
+static void    wm_lplu_d0_disable_pch(struct wm_softc *);
 /* EEE */
 static void    wm_set_eee_i350(struct wm_softc *);
 
@@ -7763,7 +7766,6 @@
        case WM_T_82571:
        case WM_T_82572:
        case WM_T_82573:
-       case WM_T_82574:
        case WM_T_82575:
        case WM_T_82576:
        case WM_T_82580:
@@ -7771,10 +7773,13 @@
        case WM_T_I354:
        case WM_T_I210:
        case WM_T_I211:
-       case WM_T_82583:
        case WM_T_80003:
                /* null */
                break;
+       case WM_T_82574:
+       case WM_T_82583:
+               wm_lplu_d0_disable(sc);
+               break;
        case WM_T_82541:
        case WM_T_82547:
                /* XXX Configure actively LED after PHY reset */
@@ -7807,18 +7812,11 @@
                 * in NVM
                 */
 
-               /* Configure the LCD with the OEM bits in NVM */
-               if ((sc->sc_type == WM_T_PCH) || (sc->sc_type == WM_T_PCH2)
-                   || (sc->sc_type == WM_T_PCH_LPT)) {
-                       /*
-                        * Disable LPLU.
-                        * XXX It seems that 82567 has LPLU, too.
-                        */
-                       reg = wm_gmii_hv_readreg(sc->sc_dev, 1, HV_OEM_BITS);
-                       reg &= ~(HV_OEM_BITS_A1KDIS| HV_OEM_BITS_LPLU);
-                       reg |= HV_OEM_BITS_ANEGNOW;
-                       wm_gmii_hv_writereg(sc->sc_dev, 1, HV_OEM_BITS, reg);
-               }
+               /* Disable D0 LPLU. */
+               if (sc->sc_type >= WM_T_PCH)    /* PCH* */
+                       wm_lplu_d0_disable_pch(sc);
+               else
+                       wm_lplu_d0_disable(sc); /* ICH* */
                break;
        default:
                panic("%s: unknown type\n", __func__);
@@ -11401,6 +11399,29 @@
 }
 #endif /* WM_WOL */
 
+/* LPLU */
+
+static void
+wm_lplu_d0_disable(struct wm_softc *sc)
+{
+       uint32_t reg;
+
+       reg = CSR_READ(sc, WMREG_PHY_CTRL);
+       reg &= ~PHY_CTRL_D0A_LPLU;
+       CSR_WRITE(sc, WMREG_PHY_CTRL, reg);
+}
+
+static void
+wm_lplu_d0_disable_pch(struct wm_softc *sc)
+{
+       uint32_t reg;
+
+       reg = wm_gmii_hv_readreg(sc->sc_dev, 1, HV_OEM_BITS);
+       reg &= ~(HV_OEM_BITS_A1KDIS| HV_OEM_BITS_LPLU);
+       reg |= HV_OEM_BITS_ANEGNOW;
+       wm_gmii_hv_writereg(sc->sc_dev, 1, HV_OEM_BITS, reg);
+}
+
 /* EEE */
 
 static void



Home | Main Index | Thread Index | Old Index