Source-Changes-HG archive

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

[src/trunk]: src/sys/dev - Rename PHY related flags for the consistency. It's...



details:   https://anonhg.NetBSD.org/src/rev/5a90d8868db9
branches:  trunk
changeset: 785545:5a90d8868db9
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Tue Mar 19 04:10:12 2013 +0000

description:
- Rename PHY related flags for the consistency. It's the same as FreeBSD.
- Remove BGE_10_100_ONLY flag because this was not used.
  For 10/100 devices, when calling mii_attach(), mask BMSR_EXTSTAT flag to
  not to check Gigabit flags. It's the same as FreeBSD.

diffstat:

 sys/dev/mii/brgphy.c    |   8 +++---
 sys/dev/pci/if_bge.c    |  51 ++++++++++++++++++++++++++++++++----------------
 sys/dev/pci/if_bgereg.h |   6 ++--
 3 files changed, 41 insertions(+), 24 deletions(-)

diffs (185 lines):

diff -r 132ca04d9583 -r 5a90d8868db9 sys/dev/mii/brgphy.c
--- a/sys/dev/mii/brgphy.c      Tue Mar 19 03:40:16 2013 +0000
+++ b/sys/dev/mii/brgphy.c      Tue Mar 19 04:10:12 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: brgphy.c,v 1.61 2013/03/15 06:18:13 msaitoh Exp $      */
+/*     $NetBSD: brgphy.c,v 1.62 2013/03/19 04:10:12 msaitoh Exp $      */
 
 /*-
  * Copyright (c) 1998, 1999, 2000, 2001 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: brgphy.c,v 1.61 2013/03/15 06:18:13 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: brgphy.c,v 1.62 2013/03/19 04:10:12 msaitoh Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -709,12 +709,12 @@
                                PHY_WRITE(sc, BRGPHY_MII_EPHY_PTEST, 0x12);
 
                        /* Enable Ethernet@Wirespeed */
-                       if (!(bsc->sc_phyflags & BGE_NO_ETH_WIRE_SPEED))
+                       if (!(bsc->sc_phyflags & BGE_PHY_NO_WIRESPEED))
                                brgphy_eth_wirespeed(sc);
 
 #if 0
                        /* Enable Link LED on Dell boxes */
-                       if (bsc->sc_phyflags & BGE_NO_3LED) {
+                       if (bsc->sc_phyflags & BGE_PHY_NO_3LED) {
                                PHY_WRITE(sc, BRGPHY_MII_PHY_EXTCTL, 
                                PHY_READ(sc, BRGPHY_MII_PHY_EXTCTL)
                                        & ~BRGPHY_PHY_EXTCTL_3_LED);
diff -r 132ca04d9583 -r 5a90d8868db9 sys/dev/pci/if_bge.c
--- a/sys/dev/pci/if_bge.c      Tue Mar 19 03:40:16 2013 +0000
+++ b/sys/dev/pci/if_bge.c      Tue Mar 19 04:10:12 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_bge.c,v 1.219 2013/03/19 03:40:16 msaitoh Exp $     */
+/*     $NetBSD: if_bge.c,v 1.220 2013/03/19 04:10:13 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.219 2013/03/19 03:40:16 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_bge.c,v 1.220 2013/03/19 04:10:13 msaitoh Exp $");
 
 #include "vlan.h"
 
@@ -3164,6 +3164,7 @@
        bus_size_t              memsize, apesize;
        uint32_t                pm_ctl;
        bool                    no_seeprom;
+       int                     capmask;
 
        bp = bge_lookup(pa);
        KASSERT(bp != NULL);
@@ -3368,11 +3369,6 @@
        if (BGE_IS_5700_FAMILY(sc))
                sc->bge_flags |= BGE_JUMBO_CAPABLE;
 
-       if ((BGE_ASICREV(sc->bge_chipid) == BGE_ASICREV_BCM5700 ||
-           BGE_ASICREV(sc->bge_chipid) == BGE_ASICREV_BCM5701) &&
-           PCI_VENDOR(subid) == PCI_VENDOR_DELL)
-               sc->bge_flags |= BGE_NO_3LED;
-
        misccfg = CSR_READ_4(sc, BGE_MISC_CFG);
        misccfg &= BGE_MISCCFG_BOARD_ID_MASK;
 
@@ -3403,6 +3399,7 @@
                        sc->bge_flags |= BGE_TSO;
        }
 
+       capmask = 0xffffffff; /* XXX BMSR_DEFCAPMASK */
        if ((BGE_ASICREV(sc->bge_chipid) == BGE_ASICREV_BCM5703 &&
             (misccfg == 0x4000 || misccfg == 0x8000)) ||
            (BGE_ASICREV(sc->bge_chipid) == BGE_ASICREV_BCM5705 &&
@@ -3417,16 +3414,18 @@
            PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_BROADCOM_BCM57790 ||
            PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_BROADCOM_BCM57791 ||
            PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_BROADCOM_BCM57795 ||
-           BGE_ASICREV(sc->bge_chipid) == BGE_ASICREV_BCM5906)
-               sc->bge_flags |= BGE_10_100_ONLY;
+           BGE_ASICREV(sc->bge_chipid) == BGE_ASICREV_BCM5906) {
+               capmask &= ~BMSR_EXTSTAT;
+               sc->bge_flags |= BGE_PHY_NO_WIRESPEED;
+       }
 
        if (BGE_ASICREV(sc->bge_chipid) == BGE_ASICREV_BCM5700 ||
            (BGE_ASICREV(sc->bge_chipid) == BGE_ASICREV_BCM5705 &&
             (sc->bge_chipid != BGE_CHIPID_BCM5705_A0 &&
-             sc->bge_chipid != BGE_CHIPID_BCM5705_A1)) ||
-           BGE_ASICREV(sc->bge_chipid) == BGE_ASICREV_BCM5906)
-               sc->bge_flags |= BGE_NO_ETH_WIRE_SPEED;
-
+                sc->bge_chipid != BGE_CHIPID_BCM5705_A1)))
+               sc->bge_flags |= BGE_PHY_NO_WIRESPEED;
+
+       /* Set various PHY bug flags. */
        if (sc->bge_chipid == BGE_CHIPID_BCM5701_A0 ||
            sc->bge_chipid == BGE_CHIPID_BCM5701_B0)
                sc->bge_flags |= BGE_PHY_CRC_BUG;
@@ -3435,7 +3434,10 @@
                sc->bge_flags |= BGE_PHY_ADC_BUG;
        if (sc->bge_chipid == BGE_CHIPID_BCM5704_A0)
                sc->bge_flags |= BGE_PHY_5704_A0_BUG;
-
+       if ((BGE_ASICREV(sc->bge_chipid) == BGE_ASICREV_BCM5700 ||
+           BGE_ASICREV(sc->bge_chipid) == BGE_ASICREV_BCM5701) &&
+           PCI_VENDOR(subid) == PCI_VENDOR_DELL)
+               sc->bge_flags |= BGE_PHY_NO_3LED;
        if (BGE_IS_5705_PLUS(sc) &&
            BGE_ASICREV(sc->bge_chipid) != BGE_ASICREV_BCM5906 &&
            BGE_ASICREV(sc->bge_chipid) != BGE_ASICREV_BCM5785 &&
@@ -3686,7 +3688,7 @@
 
                ifmedia_init(&sc->bge_mii.mii_media, 0, bge_ifmedia_upd,
                             bge_ifmedia_sts);
-               mii_attach(sc->bge_dev, &sc->bge_mii, 0xffffffff,
+               mii_attach(sc->bge_dev, &sc->bge_mii, capmask,
                           sc->bge_phy_addr, MII_OFFSET_ANY,
                           MIIF_DOPAUSE);
 
@@ -5673,8 +5675,6 @@
                printf(" - PCI-X Bus\n");
        if (sc->bge_flags & BGE_PCIE)
                printf(" - PCI Express Bus\n");
-       if (sc->bge_flags & BGE_NO_3LED)
-               printf(" - No 3 LEDs\n");
        if (sc->bge_flags & BGE_RX_ALIGNBUG)
                printf(" - RX Alignment Bug\n");
        if (sc->bge_flags & BGE_APE)
@@ -5683,6 +5683,23 @@
                printf(" - CPMU\n");
        if (sc->bge_flags & BGE_TSO)
                printf(" - TSO\n");
+
+       if (sc->bge_flags & BGE_PHY_NO_3LED)
+               printf(" - No 3 LEDs\n");
+       if (sc->bge_flags & BGE_PHY_CRC_BUG)
+               printf(" - CRC bug\n");
+       if (sc->bge_flags & BGE_PHY_ADC_BUG)
+               printf(" - ADC bug\n");
+       if (sc->bge_flags & BGE_PHY_5704_A0_BUG)
+               printf(" - 5704 A0 bug\n");
+       if (sc->bge_flags & BGE_PHY_JITTER_BUG)
+               printf(" - jitter bug\n");
+       if (sc->bge_flags & BGE_PHY_BER_BGU)
+               printf(" - BER bug\n");
+       if (sc->bge_flags & BGE_PHY_ADJUST_TRIM)
+               printf(" - adjust trim\n");
+       if (sc->bge_flags & BGE_PHY_NO_WIRESPEED)
+               printf(" - no wirespeed\n");
 }
 #endif /* BGE_DEBUG */
 
diff -r 132ca04d9583 -r 5a90d8868db9 sys/dev/pci/if_bgereg.h
--- a/sys/dev/pci/if_bgereg.h   Tue Mar 19 03:40:16 2013 +0000
+++ b/sys/dev/pci/if_bgereg.h   Tue Mar 19 04:10:12 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_bgereg.h,v 1.65 2013/03/19 03:40:16 msaitoh Exp $   */
+/*     $NetBSD: if_bgereg.h,v 1.66 2013/03/19 04:10:13 msaitoh Exp $   */
 /*
  * Copyright (c) 2001 Wind River Systems
  * Copyright (c) 1997, 1998, 1999, 2001
@@ -2601,7 +2601,7 @@
 #define BGE_RXRING_VALID       0x00000002
 #define BGE_JUMBO_RXRING_VALID 0x00000004
 #define BGE_RX_ALIGNBUG                0x00000008
-#define BGE_NO_3LED            0x00000010
+#define BGE_PHY_NO_3LED                0x00000010
 #define BGE_PCIX               0x00000020
 #define BGE_PCIE               0x00000040
 #define BGE_NO_EEPROM          0x00000100
@@ -2615,7 +2615,7 @@
 #define BGE_PHY_JITTER_BUG     0x00010000
 #define BGE_PHY_BER_BUG                0x00020000
 #define BGE_PHY_ADJUST_TRIM    0x00040000
-#define BGE_NO_ETH_WIRE_SPEED  0x00080000
+#define BGE_PHY_NO_WIRESPEED   0x00080000
 #define BGE_IS_5788            0x00100000
 #define BGE_5705_PLUS          0x00200000
 #define BGE_575X_PLUS          0x00400000



Home | Main Index | Thread Index | Old Index