Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/pci - Read chip ID correctly on BCM57782 and BCM57786.



details:   https://anonhg.NetBSD.org/src/rev/ab6ac57d938e
branches:  trunk
changeset: 352866:ab6ac57d938e
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Thu Apr 13 04:27:46 2017 +0000

description:
- Read chip ID correctly on BCM57782 and BCM57786.
- Add BXCM57766 A0 string.
- Add comment for BCM5776[56]'s workaround.

diffstat:

 sys/dev/pci/if_bge.c    |  20 +++++++++++++++++---
 sys/dev/pci/if_bgereg.h |   3 ++-
 2 files changed, 19 insertions(+), 4 deletions(-)

diffs (87 lines):

diff -r 44a0f4503eb6 -r ab6ac57d938e sys/dev/pci/if_bge.c
--- a/sys/dev/pci/if_bge.c      Thu Apr 13 04:04:39 2017 +0000
+++ b/sys/dev/pci/if_bge.c      Thu Apr 13 04:27:46 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_bge.c,v 1.304 2017/04/12 06:22:16 msaitoh Exp $     */
+/*     $NetBSD: if_bge.c,v 1.305 2017/04/13 04:27:46 msaitoh Exp $     */
 
 /*
  * Copyright (c) 2001 Wind River Systems
@@ -79,7 +79,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_bge.c,v 1.304 2017/04/12 06:22:16 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_bge.c,v 1.305 2017/04/13 04:27:46 msaitoh Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -743,6 +743,7 @@
        { BGE_CHIPID_BCM5906_A2, "BCM5906 A2" },
        { BGE_CHIPID_BCM57765_A0, "BCM57765 A0" },
        { BGE_CHIPID_BCM57765_B0, "BCM57765 B0" },
+       { BGE_CHIPID_BCM57766_A0, "BCM57766 A0" },
        { BGE_CHIPID_BCM57780_A0, "BCM57780 A0" },
        { BGE_CHIPID_BCM57780_A1, "BCM57780 A1" },
 
@@ -2319,6 +2320,11 @@
                        CSR_WRITE_4(sc, BGE_MODE_CTL, mode_ctl);
                }
                if (BGE_CHIPREV(sc->bge_chipid) != BGE_CHIPREV_57765_AX) {
+                       /*
+                        * For the 57766 and non Ax versions of 57765, bootcode
+                        * needs to setup the PCIE Fast Training Sequence (FTS)
+                        * value to prevent transmit hangs.
+                        */
                        reg = CSR_READ_4(sc, BGE_CPMU_PADRNG_CTL);
                        CSR_WRITE_4(sc, BGE_CPMU_PADRNG_CTL,
                            reg | BGE_CPMU_PADRNG_CTL_RDIV2);
@@ -3266,7 +3272,9 @@
                case PCI_PRODUCT_BROADCOM_BCM57765:
                case PCI_PRODUCT_BROADCOM_BCM57766:
                case PCI_PRODUCT_BROADCOM_BCM57781:
+               case PCI_PRODUCT_BROADCOM_BCM57782:
                case PCI_PRODUCT_BROADCOM_BCM57785:
+               case PCI_PRODUCT_BROADCOM_BCM57786:
                case PCI_PRODUCT_BROADCOM_BCM57791:
                case PCI_PRODUCT_BROADCOM_BCM57795:
                        id = pci_conf_read(pa->pa_pc, pa->pa_tag,
@@ -5518,6 +5526,8 @@
        }
 
        if (BGE_ASICREV(sc->bge_chipid) == BGE_ASICREV_BCM57780) {
+               pcireg_t aercap;
+
                reg = CSR_READ_4(sc, BGE_PCIE_PWRMNG_THRESH);
                reg = (reg & ~BGE_PCIE_PWRMNG_L1THRESH_MASK)
                    | BGE_PCIE_PWRMNG_L1THRESH_4MS
@@ -5529,7 +5539,11 @@
                    | BGE_PCIE_EIDLE_DELAY_13CLK;
                CSR_WRITE_4(sc, BGE_PCIE_EIDLE_DELAY, reg);
 
-               /* XXX clear correctable error count */
+               /* Clear correctable error */
+               if (pci_get_ext_capability(sc->sc_pc, sc->sc_pcitag,
+                   PCI_EXTCAP_AER, &aercap, NULL) != 0)
+                       pci_conf_write(sc->sc_pc, sc->sc_pcitag,
+                           aercap + PCI_AER_COR_STATUS, 0xffffffff);
 
                reg = CSR_READ_4(sc, BGE_PCIE_LINKCTL);
                reg = (reg & ~BGE_PCIE_LINKCTL_L1_PLL_PDEN)
diff -r 44a0f4503eb6 -r ab6ac57d938e sys/dev/pci/if_bgereg.h
--- a/sys/dev/pci/if_bgereg.h   Thu Apr 13 04:04:39 2017 +0000
+++ b/sys/dev/pci/if_bgereg.h   Thu Apr 13 04:27:46 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_bgereg.h,v 1.92 2017/04/12 06:22:16 msaitoh Exp $   */
+/*     $NetBSD: if_bgereg.h,v 1.93 2017/04/13 04:27:46 msaitoh Exp $   */
 /*
  * Copyright (c) 2001 Wind River Systems
  * Copyright (c) 1997, 1998, 1999, 2001
@@ -349,6 +349,7 @@
 #define        BGE_CHIPID_BCM5720_A0           0x05720000
 #define        BGE_CHIPID_BCM57765_A0          0x57785000
 #define        BGE_CHIPID_BCM57765_B0          0x57785100
+#define        BGE_CHIPID_BCM57766_A0          0x57766000
 
 /* shorthand one */
 #define BGE_ASICREV(x)                 ((x) >> 12)



Home | Main Index | Thread Index | Old Index