kernel: use backported versions of bgmac patches
authorRafał Miłecki <zajec5@gmail.com>
Sun, 8 May 2016 21:09:18 +0000 (21:09 +0000)
committerLuka Perkov <luka@openwrt.org>
Sun, 19 Jun 2016 17:56:13 +0000 (19:56 +0200)
Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
git-svn-id: svn://svn.openwrt.org/openwrt/branches/chaos_calmer@49298 3c298f89-4303-0410-b956-a3cf2f4a3e73

target/linux/bcm53xx/patches-3.18/700-bgmac-add-support-for-the-3rd-bus-core-device.patch [deleted file]
target/linux/generic/patches-3.18/077-13-bgmac-fix-MAC-soft-reset-bit-for-corerev-4.patch [deleted file]
target/linux/generic/patches-3.18/077-14-bgmac-reset-all-4-GMAC-cores-on-init.patch [deleted file]
target/linux/generic/patches-3.18/078-01-bgmac-support-up-to-3-cores-devices-on-a-bus.patch [new file with mode: 0644]
target/linux/generic/patches-3.18/078-02-bgmac-add-helper-checking-for-BCM4707-BCM53018-chip-.patch [new file with mode: 0644]
target/linux/generic/patches-3.18/078-03-bgmac-support-Ethernet-device-on-BCM47094-SoC.patch [new file with mode: 0644]
target/linux/generic/patches-3.18/078-04-bgmac-reset-enable-Ethernet-core-before-using-it.patch [new file with mode: 0644]
target/linux/generic/patches-3.18/078-05-bgmac-fix-MAC-soft-reset-bit-for-corerev-4.patch [new file with mode: 0644]
target/linux/generic/patches-3.18/078-bgmac-add-helper-checking-for-BCM4707-BCM53018-chip-.patch [deleted file]
target/linux/generic/patches-3.18/079-bgmac-support-Ethernet-device-on-BCM47094-SoC.patch [deleted file]
target/linux/generic/patches-3.18/773-bgmac-add-srab-switch.patch

diff --git a/target/linux/bcm53xx/patches-3.18/700-bgmac-add-support-for-the-3rd-bus-core-device.patch b/target/linux/bcm53xx/patches-3.18/700-bgmac-add-support-for-the-3rd-bus-core-device.patch
deleted file mode 100644 (file)
index 36894fe..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-From f5d5afc0b1402aae0f6a2350e43241603dbaff1e Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
-Date: Wed, 13 May 2015 10:46:47 +0200
-Subject: [PATCH] bgmac: add support for the 3rd bus core (device)
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-So far we were supporting up to 2 cores but recent devices (e.g. Netgear
-R8000) may use 3rd as well. Lower ones (1st, 2nd) are usually used for
-some offloading then.
-
-Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
----
- drivers/net/ethernet/broadcom/bgmac.c | 28 +++++++++++++++++++++++-----
- 1 file changed, 23 insertions(+), 5 deletions(-)
-
---- a/drivers/net/ethernet/broadcom/bgmac.c
-+++ b/drivers/net/ethernet/broadcom/bgmac.c
-@@ -1566,11 +1566,20 @@ static int bgmac_probe(struct bcma_devic
-       struct net_device *net_dev;
-       struct bgmac *bgmac;
-       struct ssb_sprom *sprom = &core->bus->sprom;
--      u8 *mac = core->core_unit ? sprom->et1mac : sprom->et0mac;
-+      u8 *mac;
-       int err;
--      /* We don't support 2nd, 3rd, ... units, SPROM has to be adjusted */
--      if (core->core_unit > 1) {
-+      switch (core->core_unit) {
-+      case 0:
-+              mac = sprom->et0mac;
-+              break;
-+      case 1:
-+              mac = sprom->et1mac;
-+              break;
-+      case 2:
-+              mac = sprom->et2mac;
-+              break;
-+      default:
-               pr_err("Unsupported core_unit %d\n", core->core_unit);
-               return -ENOTSUPP;
-       }
-@@ -1605,8 +1614,17 @@ static int bgmac_probe(struct bcma_devic
-       }
-       bgmac->cmn = core->bus->drv_gmac_cmn.core;
--      bgmac->phyaddr = core->core_unit ? sprom->et1phyaddr :
--                       sprom->et0phyaddr;
-+      switch (core->core_unit) {
-+      case 0:
-+              bgmac->phyaddr = sprom->et0phyaddr;
-+              break;
-+      case 1:
-+              bgmac->phyaddr = sprom->et1phyaddr;
-+              break;
-+      case 2:
-+              bgmac->phyaddr = sprom->et2phyaddr;
-+              break;
-+      }
-       bgmac->phyaddr &= BGMAC_PHY_MASK;
-       if (bgmac->phyaddr == BGMAC_PHY_MASK) {
-               bgmac_err(bgmac, "No PHY found\n");
diff --git a/target/linux/generic/patches-3.18/077-13-bgmac-fix-MAC-soft-reset-bit-for-corerev-4.patch b/target/linux/generic/patches-3.18/077-13-bgmac-fix-MAC-soft-reset-bit-for-corerev-4.patch
deleted file mode 100644 (file)
index a3d9fd6..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-From: Felix Fietkau <nbd@openwrt.org>
-Date: Mon, 13 Apr 2015 15:54:04 +0200
-Subject: [PATCH] bgmac: fix MAC soft-reset bit for corerev > 4
-
-Only core revisions older than 4 use BGMAC_CMDCFG_SR_REV0
-
-Signed-off-by: Felix Fietkau <nbd@openwrt.org>
----
-
---- a/drivers/net/ethernet/broadcom/bgmac.h
-+++ b/drivers/net/ethernet/broadcom/bgmac.h
-@@ -198,9 +198,9 @@
- #define  BGMAC_CMDCFG_TAI                     0x00000200
- #define  BGMAC_CMDCFG_HD                      0x00000400      /* Set if in half duplex mode */
- #define  BGMAC_CMDCFG_HD_SHIFT                        10
--#define  BGMAC_CMDCFG_SR_REV0                 0x00000800      /* Set to reset mode, for other revs */
--#define  BGMAC_CMDCFG_SR_REV4                 0x00002000      /* Set to reset mode, only for core rev 4 */
--#define  BGMAC_CMDCFG_SR(rev)  ((rev == 4) ? BGMAC_CMDCFG_SR_REV4 : BGMAC_CMDCFG_SR_REV0)
-+#define  BGMAC_CMDCFG_SR_REV0                 0x00000800      /* Set to reset mode, for core rev 0-3 */
-+#define  BGMAC_CMDCFG_SR_REV4                 0x00002000      /* Set to reset mode, for core rev >= 4 */
-+#define  BGMAC_CMDCFG_SR(rev)  ((rev >= 4) ? BGMAC_CMDCFG_SR_REV4 : BGMAC_CMDCFG_SR_REV0)
- #define  BGMAC_CMDCFG_ML                      0x00008000      /* Set to activate mac loopback mode */
- #define  BGMAC_CMDCFG_AE                      0x00400000
- #define  BGMAC_CMDCFG_CFE                     0x00800000
diff --git a/target/linux/generic/patches-3.18/077-14-bgmac-reset-all-4-GMAC-cores-on-init.patch b/target/linux/generic/patches-3.18/077-14-bgmac-reset-all-4-GMAC-cores-on-init.patch
deleted file mode 100644 (file)
index 2a913a6..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-From: Felix Fietkau <nbd@openwrt.org>
-Date: Mon, 13 Apr 2015 15:56:26 +0200
-Subject: [PATCH] bgmac: reset all 4 GMAC cores on init
-
-On a BCM4709 based device, I found that GMAC cores may be enabled at
-probe time, but only become usable after a full reset.
-Disable cores before re-enabling them to ensure that they are properly
-reset.
-
-Signed-off-by: Felix Fietkau <nbd@openwrt.org>
----
-
---- a/drivers/net/ethernet/broadcom/bgmac.c
-+++ b/drivers/net/ethernet/broadcom/bgmac.c
-@@ -1623,8 +1623,11 @@ static int bgmac_probe(struct bcma_devic
-                       ns_core = bcma_find_core_unit(core->bus,
-                                                     BCMA_CORE_MAC_GBIT,
-                                                     ns_gmac);
--                      if (ns_core && !bcma_core_is_enabled(ns_core))
--                              bcma_core_enable(ns_core, 0);
-+                      if (!ns_core)
-+                              continue;
-+
-+                      bcma_core_disable(ns_core, 0);
-+                      bcma_core_enable(ns_core, 0);
-               }
-       }
diff --git a/target/linux/generic/patches-3.18/078-01-bgmac-support-up-to-3-cores-devices-on-a-bus.patch b/target/linux/generic/patches-3.18/078-01-bgmac-support-up-to-3-cores-devices-on-a-bus.patch
new file mode 100644 (file)
index 0000000..d093e89
--- /dev/null
@@ -0,0 +1,66 @@
+From 538e4563198cd3d1a8e74c47fee3e49dc93e4a95 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
+Date: Wed, 26 Aug 2015 17:53:45 +0200
+Subject: [PATCH] bgmac: support up to 3 cores (devices) on a bus
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Broadcom buses may have more than 1 Ethernet device. This is used e.g.
+to have few interfaces connected to different switch ports. So far we
+saw chipsets with only 2 devices (e.g. BCM4706) but recent ones have
+up to 3 (e.g. Netgear R8000 uses 3rd interface for most of switch
+traffic, lower interfaces are for some kind of offloading).
+
+Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+---
+ drivers/net/ethernet/broadcom/bgmac.c | 28 +++++++++++++++++++++++-----
+ 1 file changed, 23 insertions(+), 5 deletions(-)
+
+--- a/drivers/net/ethernet/broadcom/bgmac.c
++++ b/drivers/net/ethernet/broadcom/bgmac.c
+@@ -1549,11 +1549,20 @@ static int bgmac_probe(struct bcma_devic
+       struct net_device *net_dev;
+       struct bgmac *bgmac;
+       struct ssb_sprom *sprom = &core->bus->sprom;
+-      u8 *mac = core->core_unit ? sprom->et1mac : sprom->et0mac;
++      u8 *mac;
+       int err;
+-      /* We don't support 2nd, 3rd, ... units, SPROM has to be adjusted */
+-      if (core->core_unit > 1) {
++      switch (core->core_unit) {
++      case 0:
++              mac = sprom->et0mac;
++              break;
++      case 1:
++              mac = sprom->et1mac;
++              break;
++      case 2:
++              mac = sprom->et2mac;
++              break;
++      default:
+               pr_err("Unsupported core_unit %d\n", core->core_unit);
+               return -ENOTSUPP;
+       }
+@@ -1588,8 +1597,17 @@ static int bgmac_probe(struct bcma_devic
+       }
+       bgmac->cmn = core->bus->drv_gmac_cmn.core;
+-      bgmac->phyaddr = core->core_unit ? sprom->et1phyaddr :
+-                       sprom->et0phyaddr;
++      switch (core->core_unit) {
++      case 0:
++              bgmac->phyaddr = sprom->et0phyaddr;
++              break;
++      case 1:
++              bgmac->phyaddr = sprom->et1phyaddr;
++              break;
++      case 2:
++              bgmac->phyaddr = sprom->et2phyaddr;
++              break;
++      }
+       bgmac->phyaddr &= BGMAC_PHY_MASK;
+       if (bgmac->phyaddr == BGMAC_PHY_MASK) {
+               bgmac_err(bgmac, "No PHY found\n");
diff --git a/target/linux/generic/patches-3.18/078-02-bgmac-add-helper-checking-for-BCM4707-BCM53018-chip-.patch b/target/linux/generic/patches-3.18/078-02-bgmac-add-helper-checking-for-BCM4707-BCM53018-chip-.patch
new file mode 100644 (file)
index 0000000..63010c1
--- /dev/null
@@ -0,0 +1,106 @@
+From 387b75f8b31437792e8334390fdf5cf060d1e3da Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
+Date: Tue, 2 Feb 2016 07:47:14 +0100
+Subject: [PATCH] bgmac: add helper checking for BCM4707 / BCM53018 chip id
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Chipsets with BCM4707 / BCM53018 ID require special handling at a few
+places in the code. It's likely there will be more IDs to check in the
+future. To simplify it add this trivial helper.
+
+Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+---
+ drivers/net/ethernet/broadcom/bgmac.c | 30 ++++++++++++++++--------------
+ 1 file changed, 16 insertions(+), 14 deletions(-)
+
+--- a/drivers/net/ethernet/broadcom/bgmac.c
++++ b/drivers/net/ethernet/broadcom/bgmac.c
+@@ -26,6 +26,17 @@ static const struct bcma_device_id bgmac
+ };
+ MODULE_DEVICE_TABLE(bcma, bgmac_bcma_tbl);
++static inline bool bgmac_is_bcm4707_family(struct bgmac *bgmac)
++{
++      switch (bgmac->core->bus->chipinfo.id) {
++      case BCMA_CHIP_ID_BCM4707:
++      case BCMA_CHIP_ID_BCM53018:
++              return true;
++      default:
++              return false;
++      }
++}
++
+ static bool bgmac_wait_value(struct bcma_device *core, u16 reg, u32 mask,
+                            u32 value, int timeout)
+ {
+@@ -982,11 +993,9 @@ static void bgmac_mac_speed(struct bgmac
+ static void bgmac_miiconfig(struct bgmac *bgmac)
+ {
+       struct bcma_device *core = bgmac->core;
+-      struct bcma_chipinfo *ci = &core->bus->chipinfo;
+       u8 imode;
+-      if (ci->id == BCMA_CHIP_ID_BCM4707 ||
+-          ci->id == BCMA_CHIP_ID_BCM53018) {
++      if (bgmac_is_bcm4707_family(bgmac)) {
+               bcma_awrite32(core, BCMA_IOCTL,
+                             bcma_aread32(core, BCMA_IOCTL) | 0x40 |
+                             BGMAC_BCMA_IOCTL_SW_CLKEN);
+@@ -1050,9 +1059,7 @@ static void bgmac_chip_reset(struct bgma
+       }
+       /* Request Misc PLL for corerev > 2 */
+-      if (core->id.rev > 2 &&
+-          ci->id != BCMA_CHIP_ID_BCM4707 &&
+-          ci->id != BCMA_CHIP_ID_BCM53018) {
++      if (core->id.rev > 2 && !bgmac_is_bcm4707_family(bgmac)) {
+               bgmac_set(bgmac, BCMA_CLKCTLST,
+                         BGMAC_BCMA_CLKCTLST_MISC_PLL_REQ);
+               bgmac_wait_value(bgmac->core, BCMA_CLKCTLST,
+@@ -1188,8 +1195,7 @@ static void bgmac_enable(struct bgmac *b
+               break;
+       }
+-      if (ci->id != BCMA_CHIP_ID_BCM4707 &&
+-          ci->id != BCMA_CHIP_ID_BCM53018) {
++      if (!bgmac_is_bcm4707_family(bgmac)) {
+               rxq_ctl = bgmac_read(bgmac, BGMAC_RXQ_CTL);
+               rxq_ctl &= ~BGMAC_RXQ_CTL_MDP_MASK;
+               bp_clk = bcma_pmu_get_bus_clock(&bgmac->core->bus->drv_cc) /
+@@ -1467,14 +1473,12 @@ static int bgmac_fixed_phy_register(stru
+ static int bgmac_mii_register(struct bgmac *bgmac)
+ {
+-      struct bcma_chipinfo *ci = &bgmac->core->bus->chipinfo;
+       struct mii_bus *mii_bus;
+       struct phy_device *phy_dev;
+       char bus_id[MII_BUS_ID_SIZE + 3];
+       int i, err = 0;
+-      if (ci->id == BCMA_CHIP_ID_BCM4707 ||
+-          ci->id == BCMA_CHIP_ID_BCM53018)
++      if (bgmac_is_bcm4707_family(bgmac))
+               return bgmac_fixed_phy_register(bgmac);
+       mii_bus = mdiobus_alloc();
+@@ -1545,7 +1549,6 @@ static void bgmac_mii_unregister(struct
+ /* http://bcm-v4.sipsolutions.net/mac-gbit/gmac/chipattach */
+ static int bgmac_probe(struct bcma_device *core)
+ {
+-      struct bcma_chipinfo *ci = &core->bus->chipinfo;
+       struct net_device *net_dev;
+       struct bgmac *bgmac;
+       struct ssb_sprom *sprom = &core->bus->sprom;
+@@ -1626,8 +1629,7 @@ static int bgmac_probe(struct bcma_devic
+       bgmac_chip_reset(bgmac);
+       /* For Northstar, we have to take all GMAC core out of reset */
+-      if (ci->id == BCMA_CHIP_ID_BCM4707 ||
+-          ci->id == BCMA_CHIP_ID_BCM53018) {
++      if (bgmac_is_bcm4707_family(bgmac)) {
+               struct bcma_device *ns_core;
+               int ns_gmac;
diff --git a/target/linux/generic/patches-3.18/078-03-bgmac-support-Ethernet-device-on-BCM47094-SoC.patch b/target/linux/generic/patches-3.18/078-03-bgmac-support-Ethernet-device-on-BCM47094-SoC.patch
new file mode 100644 (file)
index 0000000..88db7b2
--- /dev/null
@@ -0,0 +1,39 @@
+From 9e4e6206c67ae11d68fc96882256f37c237087d4 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
+Date: Mon, 22 Feb 2016 22:51:13 +0100
+Subject: [PATCH] bgmac: support Ethernet device on BCM47094 SoC
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+It needs very similar workarounds to the one on BCM4707. It was tested
+on D-Link DIR-885L home router.
+
+Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+---
+ drivers/net/ethernet/broadcom/bgmac.c | 6 ++++--
+ 1 file changed, 4 insertions(+), 2 deletions(-)
+
+--- a/drivers/net/ethernet/broadcom/bgmac.c
++++ b/drivers/net/ethernet/broadcom/bgmac.c
+@@ -30,6 +30,7 @@ static inline bool bgmac_is_bcm4707_fami
+ {
+       switch (bgmac->core->bus->chipinfo.id) {
+       case BCMA_CHIP_ID_BCM4707:
++      case BCMA_CHIP_ID_BCM47094:
+       case BCMA_CHIP_ID_BCM53018:
+               return true;
+       default:
+@@ -1047,8 +1048,9 @@ static void bgmac_chip_reset(struct bgma
+           (ci->id == BCMA_CHIP_ID_BCM53572 && ci->pkg == BCMA_PKG_ID_BCM47188))
+               iost &= ~BGMAC_BCMA_IOST_ATTACHED;
+-      /* 3GMAC: for BCM4707, only do core reset at bgmac_probe() */
+-      if (ci->id != BCMA_CHIP_ID_BCM4707) {
++      /* 3GMAC: for BCM4707 & BCM47094, only do core reset at bgmac_probe() */
++      if (ci->id != BCMA_CHIP_ID_BCM4707 &&
++          ci->id != BCMA_CHIP_ID_BCM47094) {
+               flags = 0;
+               if (iost & BGMAC_BCMA_IOST_ATTACHED) {
+                       flags = BGMAC_BCMA_IOCTL_SW_CLKEN;
diff --git a/target/linux/generic/patches-3.18/078-04-bgmac-reset-enable-Ethernet-core-before-using-it.patch b/target/linux/generic/patches-3.18/078-04-bgmac-reset-enable-Ethernet-core-before-using-it.patch
new file mode 100644 (file)
index 0000000..8dac985
--- /dev/null
@@ -0,0 +1,33 @@
+From b4dfd8e92956b396d3438212bc9a0be6267b8b34 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
+Date: Tue, 12 Apr 2016 13:30:45 +0200
+Subject: [PATCH] bgmac: reset & enable Ethernet core before using it
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+This fixes Ethernet on D-Link DIR-885L with BCM47094 SoC. Felix reported
+similar fix was needed for his BCM4709 device (Buffalo WXR-1900DHP?).
+I tested this for regressions on BCM4706, BCM4708A0 and BCM47081A0.
+
+Cc: Felix Fietkau <nbd@openwrt.org>
+Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+---
+ drivers/net/ethernet/broadcom/bgmac.c | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+--- a/drivers/net/ethernet/broadcom/bgmac.c
++++ b/drivers/net/ethernet/broadcom/bgmac.c
+@@ -1578,6 +1578,11 @@ static int bgmac_probe(struct bcma_devic
+               dev_warn(&core->dev, "Using random MAC: %pM\n", mac);
+       }
++      /* This (reset &) enable is not preset in specs or reference driver but
++       * Broadcom does it in arch PCI code when enabling fake PCI device.
++       */
++      bcma_core_enable(core, 0);
++
+       /* Allocation and references */
+       net_dev = alloc_etherdev(sizeof(*bgmac));
+       if (!net_dev)
diff --git a/target/linux/generic/patches-3.18/078-05-bgmac-fix-MAC-soft-reset-bit-for-corerev-4.patch b/target/linux/generic/patches-3.18/078-05-bgmac-fix-MAC-soft-reset-bit-for-corerev-4.patch
new file mode 100644 (file)
index 0000000..9e5a379
--- /dev/null
@@ -0,0 +1,36 @@
+From c02bc350f9dbce7d637c394a6e1c4d29dc5b28b2 Mon Sep 17 00:00:00 2001
+From: Felix Fietkau <nbd@openwrt.org>
+Date: Tue, 12 Apr 2016 18:27:29 +0200
+Subject: [PATCH] bgmac: fix MAC soft-reset bit for corerev > 4
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Only core revisions older than 4 use BGMAC_CMDCFG_SR_REV0. This mainly
+fixes support for BCM4708A0KF SoCs with Ethernet core rev 5 (it means
+only some devices as most of BCM4708A0KF-s got core rev 4).
+This was tested for regressions on BCM47094 which doesn't seem to care
+which bit gets used.
+
+Signed-off-by: Felix Fietkau <nbd@openwrt.org>
+Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+---
+ drivers/net/ethernet/broadcom/bgmac.h | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+--- a/drivers/net/ethernet/broadcom/bgmac.h
++++ b/drivers/net/ethernet/broadcom/bgmac.h
+@@ -198,9 +198,9 @@
+ #define  BGMAC_CMDCFG_TAI                     0x00000200
+ #define  BGMAC_CMDCFG_HD                      0x00000400      /* Set if in half duplex mode */
+ #define  BGMAC_CMDCFG_HD_SHIFT                        10
+-#define  BGMAC_CMDCFG_SR_REV0                 0x00000800      /* Set to reset mode, for other revs */
+-#define  BGMAC_CMDCFG_SR_REV4                 0x00002000      /* Set to reset mode, only for core rev 4 */
+-#define  BGMAC_CMDCFG_SR(rev)  ((rev == 4) ? BGMAC_CMDCFG_SR_REV4 : BGMAC_CMDCFG_SR_REV0)
++#define  BGMAC_CMDCFG_SR_REV0                 0x00000800      /* Set to reset mode, for core rev 0-3 */
++#define  BGMAC_CMDCFG_SR_REV4                 0x00002000      /* Set to reset mode, for core rev >= 4 */
++#define  BGMAC_CMDCFG_SR(rev)  ((rev >= 4) ? BGMAC_CMDCFG_SR_REV4 : BGMAC_CMDCFG_SR_REV0)
+ #define  BGMAC_CMDCFG_ML                      0x00008000      /* Set to activate mac loopback mode */
+ #define  BGMAC_CMDCFG_AE                      0x00400000
+ #define  BGMAC_CMDCFG_CFE                     0x00800000
diff --git a/target/linux/generic/patches-3.18/078-bgmac-add-helper-checking-for-BCM4707-BCM53018-chip-.patch b/target/linux/generic/patches-3.18/078-bgmac-add-helper-checking-for-BCM4707-BCM53018-chip-.patch
deleted file mode 100644 (file)
index 8e79418..0000000
+++ /dev/null
@@ -1,106 +0,0 @@
-From 387b75f8b31437792e8334390fdf5cf060d1e3da Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
-Date: Tue, 2 Feb 2016 07:47:14 +0100
-Subject: [PATCH] bgmac: add helper checking for BCM4707 / BCM53018 chip id
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-Chipsets with BCM4707 / BCM53018 ID require special handling at a few
-places in the code. It's likely there will be more IDs to check in the
-future. To simplify it add this trivial helper.
-
-Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
-Signed-off-by: David S. Miller <davem@davemloft.net>
----
- drivers/net/ethernet/broadcom/bgmac.c | 30 ++++++++++++++++--------------
- 1 file changed, 16 insertions(+), 14 deletions(-)
-
---- a/drivers/net/ethernet/broadcom/bgmac.c
-+++ b/drivers/net/ethernet/broadcom/bgmac.c
-@@ -26,6 +26,17 @@ static const struct bcma_device_id bgmac
- };
- MODULE_DEVICE_TABLE(bcma, bgmac_bcma_tbl);
-+static inline bool bgmac_is_bcm4707_family(struct bgmac *bgmac)
-+{
-+      switch (bgmac->core->bus->chipinfo.id) {
-+      case BCMA_CHIP_ID_BCM4707:
-+      case BCMA_CHIP_ID_BCM53018:
-+              return true;
-+      default:
-+              return false;
-+      }
-+}
-+
- static bool bgmac_wait_value(struct bcma_device *core, u16 reg, u32 mask,
-                            u32 value, int timeout)
- {
-@@ -982,11 +993,9 @@ static void bgmac_mac_speed(struct bgmac
- static void bgmac_miiconfig(struct bgmac *bgmac)
- {
-       struct bcma_device *core = bgmac->core;
--      struct bcma_chipinfo *ci = &core->bus->chipinfo;
-       u8 imode;
--      if (ci->id == BCMA_CHIP_ID_BCM4707 ||
--          ci->id == BCMA_CHIP_ID_BCM53018) {
-+      if (bgmac_is_bcm4707_family(bgmac)) {
-               bcma_awrite32(core, BCMA_IOCTL,
-                             bcma_aread32(core, BCMA_IOCTL) | 0x40 |
-                             BGMAC_BCMA_IOCTL_SW_CLKEN);
-@@ -1050,9 +1059,7 @@ static void bgmac_chip_reset(struct bgma
-       }
-       /* Request Misc PLL for corerev > 2 */
--      if (core->id.rev > 2 &&
--          ci->id != BCMA_CHIP_ID_BCM4707 &&
--          ci->id != BCMA_CHIP_ID_BCM53018) {
-+      if (core->id.rev > 2 && !bgmac_is_bcm4707_family(bgmac)) {
-               bgmac_set(bgmac, BCMA_CLKCTLST,
-                         BGMAC_BCMA_CLKCTLST_MISC_PLL_REQ);
-               bgmac_wait_value(bgmac->core, BCMA_CLKCTLST,
-@@ -1188,8 +1195,7 @@ static void bgmac_enable(struct bgmac *b
-               break;
-       }
--      if (ci->id != BCMA_CHIP_ID_BCM4707 &&
--          ci->id != BCMA_CHIP_ID_BCM53018) {
-+      if (!bgmac_is_bcm4707_family(bgmac)) {
-               rxq_ctl = bgmac_read(bgmac, BGMAC_RXQ_CTL);
-               rxq_ctl &= ~BGMAC_RXQ_CTL_MDP_MASK;
-               bp_clk = bcma_pmu_get_bus_clock(&bgmac->core->bus->drv_cc) /
-@@ -1467,14 +1473,12 @@ static int bgmac_fixed_phy_register(stru
- static int bgmac_mii_register(struct bgmac *bgmac)
- {
--      struct bcma_chipinfo *ci = &bgmac->core->bus->chipinfo;
-       struct mii_bus *mii_bus;
-       struct phy_device *phy_dev;
-       char bus_id[MII_BUS_ID_SIZE + 3];
-       int i, err = 0;
--      if (ci->id == BCMA_CHIP_ID_BCM4707 ||
--          ci->id == BCMA_CHIP_ID_BCM53018)
-+      if (bgmac_is_bcm4707_family(bgmac))
-               return bgmac_fixed_phy_register(bgmac);
-       mii_bus = mdiobus_alloc();
-@@ -1545,7 +1549,6 @@ static void bgmac_mii_unregister(struct
- /* http://bcm-v4.sipsolutions.net/mac-gbit/gmac/chipattach */
- static int bgmac_probe(struct bcma_device *core)
- {
--      struct bcma_chipinfo *ci = &core->bus->chipinfo;
-       struct net_device *net_dev;
-       struct bgmac *bgmac;
-       struct ssb_sprom *sprom = &core->bus->sprom;
-@@ -1608,8 +1611,7 @@ static int bgmac_probe(struct bcma_devic
-       bgmac_chip_reset(bgmac);
-       /* For Northstar, we have to take all GMAC core out of reset */
--      if (ci->id == BCMA_CHIP_ID_BCM4707 ||
--          ci->id == BCMA_CHIP_ID_BCM53018) {
-+      if (bgmac_is_bcm4707_family(bgmac)) {
-               struct bcma_device *ns_core;
-               int ns_gmac;
diff --git a/target/linux/generic/patches-3.18/079-bgmac-support-Ethernet-device-on-BCM47094-SoC.patch b/target/linux/generic/patches-3.18/079-bgmac-support-Ethernet-device-on-BCM47094-SoC.patch
deleted file mode 100644 (file)
index 88db7b2..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-From 9e4e6206c67ae11d68fc96882256f37c237087d4 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
-Date: Mon, 22 Feb 2016 22:51:13 +0100
-Subject: [PATCH] bgmac: support Ethernet device on BCM47094 SoC
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-It needs very similar workarounds to the one on BCM4707. It was tested
-on D-Link DIR-885L home router.
-
-Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
-Signed-off-by: David S. Miller <davem@davemloft.net>
----
- drivers/net/ethernet/broadcom/bgmac.c | 6 ++++--
- 1 file changed, 4 insertions(+), 2 deletions(-)
-
---- a/drivers/net/ethernet/broadcom/bgmac.c
-+++ b/drivers/net/ethernet/broadcom/bgmac.c
-@@ -30,6 +30,7 @@ static inline bool bgmac_is_bcm4707_fami
- {
-       switch (bgmac->core->bus->chipinfo.id) {
-       case BCMA_CHIP_ID_BCM4707:
-+      case BCMA_CHIP_ID_BCM47094:
-       case BCMA_CHIP_ID_BCM53018:
-               return true;
-       default:
-@@ -1047,8 +1048,9 @@ static void bgmac_chip_reset(struct bgma
-           (ci->id == BCMA_CHIP_ID_BCM53572 && ci->pkg == BCMA_PKG_ID_BCM47188))
-               iost &= ~BGMAC_BCMA_IOST_ATTACHED;
--      /* 3GMAC: for BCM4707, only do core reset at bgmac_probe() */
--      if (ci->id != BCMA_CHIP_ID_BCM4707) {
-+      /* 3GMAC: for BCM4707 & BCM47094, only do core reset at bgmac_probe() */
-+      if (ci->id != BCMA_CHIP_ID_BCM4707 &&
-+          ci->id != BCMA_CHIP_ID_BCM47094) {
-               flags = 0;
-               if (iost & BGMAC_BCMA_IOST_ATTACHED) {
-                       flags = BGMAC_BCMA_IOCTL_SW_CLKEN;
index 5597313..9f39c80 100644 (file)
@@ -30,7 +30,7 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
  /**************************************************
   * BCMA bus ops
   **************************************************/
-@@ -1668,6 +1680,14 @@ static int bgmac_probe(struct bcma_devic
+@@ -1688,6 +1700,14 @@ static int bgmac_probe(struct bcma_devic
        net_dev->hw_features = net_dev->features;
        net_dev->vlan_features = net_dev->features;
  
@@ -45,7 +45,7 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
        err = register_netdev(bgmac->net_dev);
        if (err) {
                bgmac_err(bgmac, "Cannot register net device\n");
-@@ -1694,6 +1714,10 @@ static void bgmac_remove(struct bcma_dev
+@@ -1714,6 +1734,10 @@ static void bgmac_remove(struct bcma_dev
  {
        struct bgmac *bgmac = bcma_get_drvdata(core);