kernel: bgmac: make it send and receive some packages on BCM4708
[oweals/openwrt.git] / target / linux / generic / patches-3.10 / 772-bgmac-add-supprot-for-BCM4707.patch
index 5b8901c170bbd5cb211e152449c12077581cad9d..a4e51774d5ffae79230a6e43c4fb8d0d5d27359b 100644 (file)
@@ -4,7 +4,7 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
 
 --- a/drivers/net/ethernet/broadcom/bgmac.c
 +++ b/drivers/net/ethernet/broadcom/bgmac.c
-@@ -864,6 +864,8 @@ static void bgmac_speed(struct bgmac *bg
+@@ -887,6 +887,8 @@ static void bgmac_speed(struct bgmac *bg
                set |= BGMAC_CMDCFG_ES_100;
        if (speed & BGMAC_SPEED_1000)
                set |= BGMAC_CMDCFG_ES_1000;
@@ -13,7 +13,7 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
        if (!bgmac->full_duplex)
                set |= BGMAC_CMDCFG_HD;
        bgmac_cmdcfg_maskset(bgmac, mask, set, true);
-@@ -871,13 +873,28 @@ static void bgmac_speed(struct bgmac *bg
+@@ -894,13 +896,28 @@ static void bgmac_speed(struct bgmac *bg
  
  static void bgmac_miiconfig(struct bgmac *bgmac)
  {
@@ -26,8 +26,8 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
 +      struct bcma_device *core = bgmac->core;
 +      struct bcma_chipinfo *ci = &core->bus->chipinfo;
 +
-+      if (ci->id != BCMA_CHIP_ID_BCM4707 &&
-+          ci->id != BCMA_CHIP_ID_BCM53018) {
++      if (ci->id == BCMA_CHIP_ID_BCM4707 ||
++          ci->id == BCMA_CHIP_ID_BCM53018) {
 +              if (bgmac->autoneg) {
 +                      bcma_awrite32(core, BCMA_IOCTL,
 +                                    bcma_aread32(core, BCMA_IOCTL) | 0x44);
@@ -48,7 +48,7 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
        }
  }
  
-@@ -923,7 +940,8 @@ static void bgmac_chip_reset(struct bgma
+@@ -946,7 +963,8 @@ static void bgmac_chip_reset(struct bgma
  
        bcma_core_enable(core, flags);
  
@@ -58,7 +58,7 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
                bgmac_set(bgmac, BCMA_CLKCTLST, 1 << 8);
                bgmac_wait_value(bgmac->core, BCMA_CLKCTLST, 1 << 24, 1 << 24,
                                 1000);
-@@ -944,10 +962,13 @@ static void bgmac_chip_reset(struct bgma
+@@ -967,10 +985,13 @@ static void bgmac_chip_reset(struct bgma
                        et_swtype &= 0x0f;
                        et_swtype <<= 4;
                        sw_type = et_swtype;
@@ -75,7 +75,7 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
                        sw_type = BGMAC_CHIPCTL_1_IF_TYPE_RGMII |
                                  BGMAC_CHIPCTL_1_SW_TYPE_RGMII;
                }
-@@ -1054,12 +1075,15 @@ static void bgmac_enable(struct bgmac *b
+@@ -1077,12 +1098,15 @@ static void bgmac_enable(struct bgmac *b
                break;
        }
  
@@ -97,6 +97,32 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
  }
  
  /* http://bcm-v4.sipsolutions.net/mac-gbit/gmac/chipinit */
+@@ -1488,6 +1512,25 @@ static int bgmac_probe(struct bcma_devic
+               goto err_netdev_free;
+       }
++      /* Northstar, take all GMAC cores out of reset */
++      if (core->id.id == BCMA_CHIP_ID_BCM4707 ||
++          core->id.id == BCMA_CHIP_ID_BCM53018) {
++              struct bcma_device *ns_core;
++              int ns_gmac;
++
++              for (ns_gmac = 0; ns_gmac < 4; ns_gmac++) {
++                      /* As northstar requirement, we have to reset all GAMCs before
++                       * accessing them. et_probe() call pci_enable_device() for etx
++                       * and do si_core_reset for GAMCx only.  Then the other three
++                       * GAMCs didn't reset.  We do it here.
++                       */
++                      ns_core = bcma_find_core_unit(core->bus, BCMA_CORE_MAC_GBIT, ns_gmac);
++                      if (!bcma_core_is_enabled(ns_core)) {
++                              bcma_core_enable(ns_core, 0);
++                      }
++              }
++      }
++
+       bgmac_chip_reset(bgmac);
+       err = bgmac_dma_alloc(bgmac);
 --- a/drivers/net/ethernet/broadcom/bgmac.h
 +++ b/drivers/net/ethernet/broadcom/bgmac.h
 @@ -185,6 +185,7 @@