Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/ic 8168H model didn't link up well. some models seem...



details:   https://anonhg.NetBSD.org/src/rev/e95efbc3b96d
branches:  trunk
changeset: 454601:e95efbc3b96d
user:      ryo <ryo%NetBSD.org@localhost>
date:      Sun Sep 22 16:41:19 2019 +0000

description:
8168H model didn't link up well. some models seems to require to enable TX/RX after configuration.
RTKQ_TXRXEN_LATER quirk flag added. it may be able to unify with RTKQ_RXDV_GATED flag?

diffstat:

 sys/dev/ic/rtl8169.c    |  19 +++++++++++++++----
 sys/dev/ic/rtl81x9var.h |   3 ++-
 2 files changed, 17 insertions(+), 5 deletions(-)

diffs (76 lines):

diff -r fa811eecdc24 -r e95efbc3b96d sys/dev/ic/rtl8169.c
--- a/sys/dev/ic/rtl8169.c      Sun Sep 22 13:57:55 2019 +0000
+++ b/sys/dev/ic/rtl8169.c      Sun Sep 22 16:41:19 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rtl8169.c,v 1.159 2019/05/30 02:32:18 msaitoh Exp $    */
+/*     $NetBSD: rtl8169.c,v 1.160 2019/09/22 16:41:19 ryo Exp $        */
 
 /*
  * Copyright (c) 1997, 1998-2003
@@ -33,7 +33,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rtl8169.c,v 1.159 2019/05/30 02:32:18 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rtl8169.c,v 1.160 2019/09/22 16:41:19 ryo Exp $");
 /* $FreeBSD: /repoman/r/ncvs/src/sys/dev/re/if_re.c,v 1.20 2004/04/11 20:34:08 ru Exp $ */
 
 /*
@@ -607,12 +607,16 @@
                        sc->sc_quirk |= RTKQ_NOJUMBO;
                        break;
                case RTK_HWREV_8168E:
-               case RTK_HWREV_8168H:
                case RTK_HWREV_8168H_SPIN1:
                        sc->sc_quirk |= RTKQ_DESCV2 | RTKQ_NOEECMD |
                            RTKQ_MACSTAT | RTKQ_CMDSTOP | RTKQ_PHYWAKE_PM |
                            RTKQ_NOJUMBO;
                        break;
+               case RTK_HWREV_8168H:
+                       sc->sc_quirk |= RTKQ_DESCV2 | RTKQ_NOEECMD |
+                           RTKQ_MACSTAT | RTKQ_CMDSTOP | RTKQ_PHYWAKE_PM |
+                           RTKQ_NOJUMBO | RTKQ_RXDV_GATED | RTKQ_TXRXEN_LATER;
+                       break;
                case RTK_HWREV_8168E_VL:
                case RTK_HWREV_8168F:
                        sc->sc_quirk |= RTKQ_DESCV2 | RTKQ_NOEECMD |
@@ -1873,7 +1877,8 @@
        /*
         * Enable transmit and receive.
         */
-       CSR_WRITE_1(sc, RTK_COMMAND, RTK_CMD_TX_ENB | RTK_CMD_RX_ENB);
+       if ((sc->sc_quirk & RTKQ_TXRXEN_LATER) == 0)
+               CSR_WRITE_1(sc, RTK_COMMAND, RTK_CMD_TX_ENB | RTK_CMD_RX_ENB);
 
        /*
         * Set the initial TX and RX configuration.
@@ -1915,6 +1920,12 @@
        rtk_setmulti(sc);
 
        /*
+        * some chips require to enable TX/RX *AFTER* TX/RX configuration
+        */
+       if ((sc->sc_quirk & RTKQ_TXRXEN_LATER) != 0)
+               CSR_WRITE_1(sc, RTK_COMMAND, RTK_CMD_TX_ENB | RTK_CMD_RX_ENB);
+
+       /*
         * Enable interrupts.
         */
        if (sc->re_testmode)
diff -r fa811eecdc24 -r e95efbc3b96d sys/dev/ic/rtl81x9var.h
--- a/sys/dev/ic/rtl81x9var.h   Sun Sep 22 13:57:55 2019 +0000
+++ b/sys/dev/ic/rtl81x9var.h   Sun Sep 22 16:41:19 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rtl81x9var.h,v 1.56 2017/04/19 00:20:02 jmcneill Exp $ */
+/*     $NetBSD: rtl81x9var.h,v 1.57 2019/09/22 16:41:19 ryo Exp $      */
 
 /*
  * Copyright (c) 1997, 1998
@@ -194,6 +194,7 @@
 #define RTKQ_PHYWAKE_PM                0x00000400      /* wake PHY from power down */
 #define RTKQ_RXDV_GATED                0x00000800
 #define RTKQ_IM_HW             0x00001000      /* HW interrupt mitigation */
+#define RTKQ_TXRXEN_LATER      0x00002000      /* TX/RX enable timing */
 
        bus_dma_tag_t           sc_dmat;
 



Home | Main Index | Thread Index | Old Index