bgmac: replace some magic values with defines
authorRafał Miłecki <zajec5@gmail.com>
Wed, 11 Dec 2013 07:44:37 +0000 (08:44 +0100)
committerDavid S. Miller <davem@davemloft.net>
Wed, 11 Dec 2013 18:40:48 +0000 (13:40 -0500)
Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/broadcom/bgmac.c
drivers/net/ethernet/broadcom/bgmac.h

index 273b9f97da492c4fcd34e1f517c8589ffaa205eb..b665a6aa7e14f1c2e27b73c4ee43c1cdb0bb2fa6 100644 (file)
@@ -877,9 +877,9 @@ static void bgmac_chip_reset(struct bgmac *bgmac)
        }
 
        iost = bcma_aread32(core, BCMA_IOST);
-       if ((ci->id == BCMA_CHIP_ID_BCM5357 && ci->pkg == 10) ||
+       if ((ci->id == BCMA_CHIP_ID_BCM5357 && ci->pkg == BCMA_PKG_ID_BCM47186) ||
            (ci->id == BCMA_CHIP_ID_BCM4749 && ci->pkg == 10) ||
-           (ci->id == BCMA_CHIP_ID_BCM53572 && ci->pkg == 9))
+           (ci->id == BCMA_CHIP_ID_BCM53572 && ci->pkg == BCMA_PKG_ID_BCM47188))
                iost &= ~BGMAC_BCMA_IOST_ATTACHED;
 
        if (iost & BGMAC_BCMA_IOST_ATTACHED) {
@@ -891,12 +891,16 @@ static void bgmac_chip_reset(struct bgmac *bgmac)
        bcma_core_enable(core, flags);
 
        if (core->id.rev > 2) {
-               bgmac_set(bgmac, BCMA_CLKCTLST, 1 << 8);
-               bgmac_wait_value(bgmac->core, BCMA_CLKCTLST, 1 << 24, 1 << 24,
+               bgmac_set(bgmac, BCMA_CLKCTLST,
+                         BGMAC_BCMA_CLKCTLST_MISC_PLL_REQ);
+               bgmac_wait_value(bgmac->core, BCMA_CLKCTLST,
+                                BGMAC_BCMA_CLKCTLST_MISC_PLL_ST,
+                                BGMAC_BCMA_CLKCTLST_MISC_PLL_ST,
                                 1000);
        }
 
-       if (ci->id == BCMA_CHIP_ID_BCM5357 || ci->id == BCMA_CHIP_ID_BCM4749 ||
+       if (ci->id == BCMA_CHIP_ID_BCM5357 ||
+           ci->id == BCMA_CHIP_ID_BCM4749 ||
            ci->id == BCMA_CHIP_ID_BCM53572) {
                struct bcma_drv_cc *cc = &bgmac->core->bus->drv_cc;
                u8 et_swtype = 0;
@@ -911,10 +915,11 @@ static void bgmac_chip_reset(struct bgmac *bgmac)
                        et_swtype &= 0x0f;
                        et_swtype <<= 4;
                        sw_type = et_swtype;
-               } else if (ci->id == BCMA_CHIP_ID_BCM5357 && ci->pkg == 9) {
+               } else if (ci->id == BCMA_CHIP_ID_BCM5357 && ci->pkg == BCMA_PKG_ID_BCM5358) {
                        sw_type = BGMAC_CHIPCTL_1_SW_TYPE_EPHYRMII;
-               } else if ((ci->id != BCMA_CHIP_ID_BCM53572 && ci->pkg == 10) ||
-                          (ci->id == BCMA_CHIP_ID_BCM53572 && ci->pkg == 9)) {
+               } else if ((ci->id == BCMA_CHIP_ID_BCM5357 && ci->pkg == BCMA_PKG_ID_BCM47186) ||
+                          (ci->id == BCMA_CHIP_ID_BCM4749 && ci->pkg == 10) ||
+                          (ci->id == BCMA_CHIP_ID_BCM53572 && ci->pkg == BCMA_PKG_ID_BCM47188)) {
                        sw_type = BGMAC_CHIPCTL_1_IF_TYPE_RGMII |
                                  BGMAC_CHIPCTL_1_SW_TYPE_RGMII;
                }
index 550f2a8e85a9758920c8cf2aef7aa8a660f4036f..2d44119a764893bbdcf58bed93798f47779ef22d 100644 (file)
 #define  BGMAC_RXQ_CTL_MDP_SHIFT               24
 #define BGMAC_GPIO_SELECT                      0x194
 #define BGMAC_GPIO_OUTPUT_EN                   0x198
-/* For 0x1e0 see BCMA_CLKCTLST */
+
+/* For 0x1e0 see BCMA_CLKCTLST. Below are BGMAC specific bits */
+#define  BGMAC_BCMA_CLKCTLST_MISC_PLL_REQ      0x00000100
+#define  BGMAC_BCMA_CLKCTLST_MISC_PLL_ST       0x01000000
+
 #define BGMAC_HW_WAR                           0x1e4
 #define BGMAC_PWR_CTL                          0x1e8
 #define BGMAC_DMA_BASE0                                0x200           /* Tx and Rx controller */