bge/brgphy: Split PHY flags out of main flags
authorSepherosa Ziehau <sephe@dragonflybsd.org>
Mon, 2 Jul 2012 02:10:36 +0000 (10:10 +0800)
committerSepherosa Ziehau <sephe@dragonflybsd.org>
Mon, 2 Jul 2012 02:19:18 +0000 (10:19 +0800)
sys/dev/netif/bge/if_bge.c
sys/dev/netif/bge/if_bgereg.h
sys/dev/netif/mii_layer/brgphy.c

index 452e45f..da13920 100644 (file)
@@ -1820,7 +1820,7 @@ bge_probe(device_t dev)
        device_set_desc(dev, t->bge_name);
        if (pci_get_subvendor(dev) == PCI_VENDOR_DELL) {
                struct bge_softc *sc = device_get_softc(dev);
-               sc->bge_flags |= BGE_FLAG_NO_3LED;
+               sc->bge_phy_flags |= BGE_PHY_NO_3LED;
        }
        return(0);
 }
@@ -1925,24 +1925,24 @@ bge_attach(device_t dev)
         * Set various quirk flags.
         */
 
-       sc->bge_flags |= BGE_FLAG_ETH_WIRESPEED;
+       sc->bge_phy_flags |= BGE_PHY_WIRESPEED;
        if (sc->bge_asicrev == BGE_ASICREV_BCM5700 ||
            (sc->bge_asicrev == BGE_ASICREV_BCM5705 &&
             (sc->bge_chipid != BGE_CHIPID_BCM5705_A0 &&
              sc->bge_chipid != BGE_CHIPID_BCM5705_A1)) ||
            sc->bge_asicrev == BGE_ASICREV_BCM5906)
-               sc->bge_flags &= ~BGE_FLAG_ETH_WIRESPEED;
+               sc->bge_phy_flags &= ~BGE_PHY_WIRESPEED;
 
        if (sc->bge_chipid == BGE_CHIPID_BCM5701_A0 ||
            sc->bge_chipid == BGE_CHIPID_BCM5701_B0)
-               sc->bge_flags |= BGE_FLAG_CRC_BUG;
+               sc->bge_phy_flags |= BGE_PHY_CRC_BUG;
 
        if (sc->bge_chiprev == BGE_CHIPREV_5703_AX ||
            sc->bge_chiprev == BGE_CHIPREV_5704_AX)
-               sc->bge_flags |= BGE_FLAG_ADC_BUG;
+               sc->bge_phy_flags |= BGE_PHY_ADC_BUG;
 
        if (sc->bge_chipid == BGE_CHIPID_BCM5704_A0)
-               sc->bge_flags |= BGE_FLAG_5704_A0_BUG;
+               sc->bge_phy_flags |= BGE_PHY_5704_A0_BUG;
 
        if (BGE_IS_5705_PLUS(sc)) {
                if (sc->bge_asicrev == BGE_ASICREV_BCM5755 ||
@@ -1953,11 +1953,11 @@ bge_attach(device_t dev)
 
                        if (product != PCI_PRODUCT_BROADCOM_BCM5722 &&
                            product != PCI_PRODUCT_BROADCOM_BCM5756)
-                               sc->bge_flags |= BGE_FLAG_JITTER_BUG;
+                               sc->bge_phy_flags |= BGE_PHY_JITTER_BUG;
                        if (product == PCI_PRODUCT_BROADCOM_BCM5755M)
-                               sc->bge_flags |= BGE_FLAG_ADJUST_TRIM;
+                               sc->bge_phy_flags |= BGE_PHY_ADJUST_TRIM;
                } else if (sc->bge_asicrev != BGE_ASICREV_BCM5906) {
-                       sc->bge_flags |= BGE_FLAG_BER_BUG;
+                       sc->bge_phy_flags |= BGE_PHY_BER_BUG;
                }
        }
 
index ec4c5d2..6a91a08 100644 (file)
@@ -2459,12 +2459,10 @@ struct bge_softc {
        struct resource         *bge_res;
        struct ifmedia          bge_ifmedia;    /* TBI media info */
        int                     bge_pcixcap;
-       uint32_t                bge_flags;
+       uint32_t                bge_flags;      /* BGE_FLAG_ */
 #define BGE_FLAG_TBI           0x00000001
 #define BGE_FLAG_JUMBO         0x00000002
-#define BGE_FLAG_ETH_WIRESPEED 0x00000004
 #define BGE_FLAG_MII_SERDES    0x00000010
-#define BGE_FLAG_MSI           0x00000100      /* unused */
 #define BGE_FLAG_PCIX          0x00000200
 #define BGE_FLAG_PCIE          0x00000400
 #define BGE_FLAG_5700_FAMILY   0x00001000
@@ -2474,14 +2472,8 @@ struct bge_softc {
 #define BGE_FLAG_5755_PLUS     0x00010000
 #define BGE_FLAG_MAXADDR_40BIT 0x00020000
 #define BGE_FLAG_RX_ALIGNBUG   0x00100000
-#define BGE_FLAG_NO_3LED       0x00200000
-#define BGE_FLAG_ADC_BUG       0x00400000
-#define BGE_FLAG_5704_A0_BUG   0x00800000
-#define BGE_FLAG_JITTER_BUG    0x01000000
-#define BGE_FLAG_BER_BUG       0x02000000
-#define BGE_FLAG_ADJUST_TRIM   0x04000000
-#define BGE_FLAG_CRC_BUG       0x08000000
 #define BGE_FLAG_NO_EEPROM     0x10000000
+
        uint32_t                bge_chipid;
        uint32_t                bge_asicrev;
        uint32_t                bge_chiprev;
@@ -2512,6 +2504,16 @@ struct bge_softc {
        struct sysctl_ctx_list  bge_sysctl_ctx;
        struct sysctl_oid       *bge_sysctl_tree;
 
+       uint32_t                bge_phy_flags;
+#define BGE_PHY_NO_3LED                0x00200000
+#define BGE_PHY_ADC_BUG                0x00400000
+#define BGE_PHY_5704_A0_BUG    0x00800000
+#define BGE_PHY_JITTER_BUG     0x01000000
+#define BGE_PHY_BER_BUG                0x02000000
+#define BGE_PHY_ADJUST_TRIM    0x04000000
+#define BGE_PHY_CRC_BUG                0x08000000
+#define BGE_PHY_WIRESPEED      0x00000004
+
        int                     bge_phyno;
        uint32_t                bge_coal_chg;
 #define BGE_RX_COAL_TICKS_CHG  0x1
index e792a86..aca151e 100644 (file)
@@ -517,17 +517,17 @@ brgphy_reset(struct mii_softc *sc)
        if (strncmp(ifp->if_xname, "bge", 3) == 0) {
                struct bge_softc *bge_sc = ifp->if_softc;
 
-               if (bge_sc->bge_flags & BGE_FLAG_ADC_BUG)
+               if (bge_sc->bge_phy_flags & BGE_PHY_ADC_BUG)
                        brgphy_adc_bug(sc);
-               if (bge_sc->bge_flags & BGE_FLAG_5704_A0_BUG)
+               if (bge_sc->bge_phy_flags & BGE_PHY_5704_A0_BUG)
                        brgphy_5704_a0_bug(sc);
-               if (bge_sc->bge_flags & BGE_FLAG_BER_BUG) {
+               if (bge_sc->bge_phy_flags & BGE_PHY_BER_BUG) {
                        brgphy_ber_bug(sc);
-               } else if (bge_sc->bge_flags & BGE_FLAG_JITTER_BUG) {
+               } else if (bge_sc->bge_phy_flags & BGE_PHY_JITTER_BUG) {
                        PHY_WRITE(sc, BRGPHY_MII_AUXCTL, 0x0c00);
                        PHY_WRITE(sc, BRGPHY_MII_DSP_ADDR_REG, 0x000a);
 
-                       if (bge_sc->bge_flags & BGE_FLAG_ADJUST_TRIM) {
+                       if (bge_sc->bge_phy_flags & BGE_PHY_ADJUST_TRIM) {
                                PHY_WRITE(sc, BRGPHY_MII_DSP_RW_PORT, 0x110b);
                                PHY_WRITE(sc, BRGPHY_TEST1,
                                    BRGPHY_TEST1_TRIM_EN | 0x4);
@@ -537,7 +537,7 @@ brgphy_reset(struct mii_softc *sc)
 
                        PHY_WRITE(sc, BRGPHY_MII_AUXCTL, 0x0400);
                }
-               if (bge_sc->bge_flags & BGE_FLAG_CRC_BUG)
+               if (bge_sc->bge_phy_flags & BGE_PHY_CRC_BUG)
                        brgphy_crc_bug(sc);
 
                /* Set Jumbo frame settings in the PHY. */
@@ -548,11 +548,11 @@ brgphy_reset(struct mii_softc *sc)
                        PHY_WRITE(sc, BRGPHY_MII_EPHY_PTEST, 0x12);
 
                /* Enable Ethernet@Wirespeed */
-               if (bge_sc->bge_flags & BGE_FLAG_ETH_WIRESPEED)
+               if (bge_sc->bge_phy_flags & BGE_PHY_WIRESPEED)
                        brgphy_eth_wirespeed(sc);
 
                /* Enable Link LED on Dell boxes */
-               if (bge_sc->bge_flags & BGE_FLAG_NO_3LED) {
+               if (bge_sc->bge_phy_flags & BGE_PHY_NO_3LED) {
                        PHY_WRITE(sc, BRGPHY_MII_PHY_EXTCTL, 
                        PHY_READ(sc, BRGPHY_MII_PHY_EXTCTL)
                                & ~BRGPHY_PHY_EXTCTL_3_LED);