kernel: bgmac: use upstream accepted patches
authorRafał Miłecki <rafal@milecki.pl>
Mon, 22 Aug 2016 07:47:34 +0000 (09:47 +0200)
committerRafał Miłecki <rafal@milecki.pl>
Mon, 22 Aug 2016 08:01:04 +0000 (10:01 +0200)
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
target/linux/generic/patches-4.4/076-0004-net-bgmac-fix-reversed-check-for-MII-registration-er.patch [new file with mode: 0644]
target/linux/generic/patches-4.4/077-0001-net-bgmac-support-Ethernet-core-on-BCM53573-SoCs.patch [new file with mode: 0644]
target/linux/generic/patches-4.4/077-0002-net-bgmac-make-it-clear-when-setting-interface-type-.patch [new file with mode: 0644]
target/linux/generic/patches-4.4/170-net-bgmac-fix-reversed-check-for-MII-registration-er.patch [deleted file]
target/linux/generic/patches-4.4/171-net-bgmac-support-Ethernet-core-on-BCM53573-SoCs.patch [deleted file]
target/linux/generic/patches-4.4/773-bgmac-add-srab-switch.patch

diff --git a/target/linux/generic/patches-4.4/076-0004-net-bgmac-fix-reversed-check-for-MII-registration-er.patch b/target/linux/generic/patches-4.4/076-0004-net-bgmac-fix-reversed-check-for-MII-registration-er.patch
new file mode 100644 (file)
index 0000000..945546d
--- /dev/null
@@ -0,0 +1,28 @@
+From b9f63ae7ba2de2ba19137c5757c0607ce40f3ed5 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
+Date: Wed, 17 Aug 2016 15:37:14 +0200
+Subject: [PATCH] net: bgmac: fix reversed check for MII registration error
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+It was failing on successful registration returning meaningless errors.
+
+Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
+Fixes: 55954f3bfdac ("net: ethernet: bgmac: move BCMA MDIO Phy code into a separate file")
+Signed-off-by: David S. Miller <davem@davemloft.net>
+---
+ drivers/net/ethernet/broadcom/bgmac-bcma.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/net/ethernet/broadcom/bgmac-bcma.c
++++ b/drivers/net/ethernet/broadcom/bgmac-bcma.c
+@@ -159,7 +159,7 @@ static int bgmac_probe(struct bcma_devic
+       if (!bgmac_is_bcm4707_family(core)) {
+               mii_bus = bcma_mdio_mii_register(core, bgmac->phyaddr);
+-              if (!IS_ERR(mii_bus)) {
++              if (IS_ERR(mii_bus)) {
+                       err = PTR_ERR(mii_bus);
+                       goto err;
+               }
diff --git a/target/linux/generic/patches-4.4/077-0001-net-bgmac-support-Ethernet-core-on-BCM53573-SoCs.patch b/target/linux/generic/patches-4.4/077-0001-net-bgmac-support-Ethernet-core-on-BCM53573-SoCs.patch
new file mode 100644 (file)
index 0000000..c47aab7
--- /dev/null
@@ -0,0 +1,161 @@
+From 1cb94db3d1bfe0075bde78fb2989f17e0a8a3936 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
+Date: Wed, 17 Aug 2016 23:00:30 +0200
+Subject: [PATCH] net: bgmac: support Ethernet core on BCM53573 SoCs
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+BCM53573 is a new series of Broadcom's SoCs. It's based on ARM and can
+be found in two packages (versions): BCM53573 and BCM47189. It shares
+some code with the Northstar family, but also requires some new quirks.
+
+First of all there can be up to 2 Ethernet cores on this SoC. If that is
+the case, they are connected to two different switch ports allowing some
+more complex/optimized setups. It seems the second unit doesn't come
+fully configured and requires some IRQ quirk.
+
+Other than that only the first core is connected to the PHY. For the
+second one we have to register fixed PHY (similarly to the Northstar),
+otherwise generic PHY driver would get some invalid info.
+
+This has been successfully tested on Tenda AC9 (BCM47189B0).
+
+Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+---
+ drivers/net/ethernet/broadcom/bgmac-bcma.c | 19 ++++++++++++++++++-
+ drivers/net/ethernet/broadcom/bgmac.c      | 25 +++++++++++++++++++++++++
+ drivers/net/ethernet/broadcom/bgmac.h      | 19 +++++++++++++++++++
+ include/linux/bcma/bcma.h                  |  3 +++
+ include/linux/bcma/bcma_regs.h             |  1 +
+ 5 files changed, 66 insertions(+), 1 deletion(-)
+
+--- a/drivers/net/ethernet/broadcom/bgmac-bcma.c
++++ b/drivers/net/ethernet/broadcom/bgmac-bcma.c
+@@ -92,6 +92,7 @@ MODULE_DEVICE_TABLE(bcma, bgmac_bcma_tbl
+ /* 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 ssb_sprom *sprom = &core->bus->sprom;
+       struct mii_bus *mii_bus;
+       struct bgmac *bgmac;
+@@ -157,7 +158,8 @@ static int bgmac_probe(struct bcma_devic
+       dev_info(bgmac->dev, "Found PHY addr: %d%s\n", bgmac->phyaddr,
+                bgmac->phyaddr == BGMAC_PHY_NOREGS ? " (NOREGS)" : "");
+-      if (!bgmac_is_bcm4707_family(core)) {
++      if (!bgmac_is_bcm4707_family(core) &&
++          !(ci->id == BCMA_CHIP_ID_BCM53573 && core->core_unit == 1)) {
+               mii_bus = bcma_mdio_mii_register(core, bgmac->phyaddr);
+               if (IS_ERR(mii_bus)) {
+                       err = PTR_ERR(mii_bus);
+@@ -230,6 +232,21 @@ static int bgmac_probe(struct bcma_devic
+               bgmac->feature_flags |= BGMAC_FEAT_NO_RESET;
+               bgmac->feature_flags |= BGMAC_FEAT_FORCE_SPEED_2500;
+               break;
++      case BCMA_CHIP_ID_BCM53573:
++              bgmac->feature_flags |= BGMAC_FEAT_CLKCTLST;
++              bgmac->feature_flags |= BGMAC_FEAT_SET_RXQ_CLK;
++              if (ci->pkg == BCMA_PKG_ID_BCM47189)
++                      bgmac->feature_flags |= BGMAC_FEAT_IOST_ATTACHED;
++              if (core->core_unit == 0) {
++                      bgmac->feature_flags |= BGMAC_FEAT_CC4_IF_SW_TYPE;
++                      if (ci->pkg == BCMA_PKG_ID_BCM47189)
++                              bgmac->feature_flags |=
++                                      BGMAC_FEAT_CC4_IF_SW_TYPE_RGMII;
++              } else if (core->core_unit == 1) {
++                      bgmac->feature_flags |= BGMAC_FEAT_IRQ_ID_OOB_6;
++                      bgmac->feature_flags |= BGMAC_FEAT_CC7_IF_TYPE_RGMII;
++              }
++              break;
+       default:
+               bgmac->feature_flags |= BGMAC_FEAT_CLKCTLST;
+               bgmac->feature_flags |= BGMAC_FEAT_SET_RXQ_CLK;
+--- a/drivers/net/ethernet/broadcom/bgmac.c
++++ b/drivers/net/ethernet/broadcom/bgmac.c
+@@ -940,6 +940,27 @@ static void bgmac_chip_reset(struct bgma
+               bgmac_cco_ctl_maskset(bgmac, 1, ~(BGMAC_CHIPCTL_1_IF_TYPE_MASK |
+                                                 BGMAC_CHIPCTL_1_SW_TYPE_MASK),
+                                     sw_type);
++      } else if (bgmac->feature_flags & BGMAC_FEAT_CC4_IF_SW_TYPE) {
++              u32 sw_type = BGMAC_CHIPCTL_4_IF_TYPE_MII |
++                            BGMAC_CHIPCTL_4_SW_TYPE_EPHY;
++              u8 et_swtype = 0;
++              char buf[4];
++
++              if (bcm47xx_nvram_getenv("et_swtype", buf, sizeof(buf)) > 0) {
++                      if (kstrtou8(buf, 0, &et_swtype))
++                              dev_err(bgmac->dev, "Failed to parse et_swtype (%s)\n",
++                                      buf);
++                      sw_type = (et_swtype & 0x0f) << 12;
++              } else if (bgmac->feature_flags & BGMAC_FEAT_CC4_IF_SW_TYPE_RGMII) {
++                      sw_type = BGMAC_CHIPCTL_4_IF_TYPE_RGMII |
++                                BGMAC_CHIPCTL_4_SW_TYPE_RGMII;
++              }
++              bgmac_cco_ctl_maskset(bgmac, 4, ~(BGMAC_CHIPCTL_4_IF_TYPE_MASK |
++                                                BGMAC_CHIPCTL_4_SW_TYPE_MASK),
++                                    sw_type);
++      } else if (bgmac->feature_flags & BGMAC_FEAT_CC7_IF_TYPE_RGMII) {
++              bgmac_cco_ctl_maskset(bgmac, 7, ~BGMAC_CHIPCTL_7_IF_TYPE_MASK,
++                                    BGMAC_CHIPCTL_7_IF_TYPE_RGMII);
+       }
+       if (iost & BGMAC_BCMA_IOST_ATTACHED && !bgmac->has_robosw)
+@@ -1483,6 +1504,10 @@ int bgmac_enet_probe(struct bgmac *info)
+        */
+       bgmac_clk_enable(bgmac, 0);
++      /* This seems to be fixing IRQ by assigning OOB #6 to the core */
++      if (bgmac->feature_flags & BGMAC_FEAT_IRQ_ID_OOB_6)
++              bgmac_idm_write(bgmac, BCMA_OOB_SEL_OUT_A30, 0x86);
++
+       bgmac_chip_reset(bgmac);
+       err = bgmac_dma_alloc(bgmac);
+--- a/drivers/net/ethernet/broadcom/bgmac.h
++++ b/drivers/net/ethernet/broadcom/bgmac.h
+@@ -369,6 +369,21 @@
+ #define BGMAC_CHIPCTL_1_SW_TYPE_RGMII         0x000000C0
+ #define BGMAC_CHIPCTL_1_RXC_DLL_BYPASS                0x00010000
++#define BGMAC_CHIPCTL_4_IF_TYPE_MASK          0x00003000
++#define BGMAC_CHIPCTL_4_IF_TYPE_RMII          0x00000000
++#define BGMAC_CHIPCTL_4_IF_TYPE_MII           0x00001000
++#define BGMAC_CHIPCTL_4_IF_TYPE_RGMII         0x00002000
++#define BGMAC_CHIPCTL_4_SW_TYPE_MASK          0x0000C000
++#define BGMAC_CHIPCTL_4_SW_TYPE_EPHY          0x00000000
++#define BGMAC_CHIPCTL_4_SW_TYPE_EPHYMII               0x00004000
++#define BGMAC_CHIPCTL_4_SW_TYPE_EPHYRMII      0x00008000
++#define BGMAC_CHIPCTL_4_SW_TYPE_RGMII         0x0000C000
++
++#define BGMAC_CHIPCTL_7_IF_TYPE_MASK          0x000000C0
++#define BGMAC_CHIPCTL_7_IF_TYPE_RMII          0x00000000
++#define BGMAC_CHIPCTL_7_IF_TYPE_MII           0x00000040
++#define BGMAC_CHIPCTL_7_IF_TYPE_RGMII         0x00000080
++
+ #define BGMAC_WEIGHT  64
+ #define ETHER_MAX_LEN   1518
+@@ -390,6 +405,10 @@
+ #define BGMAC_FEAT_NO_CLR_MIB         BIT(13)
+ #define BGMAC_FEAT_FORCE_SPEED_2500   BIT(14)
+ #define BGMAC_FEAT_CMDCFG_SR_REV4     BIT(15)
++#define BGMAC_FEAT_IRQ_ID_OOB_6               BIT(16)
++#define BGMAC_FEAT_CC4_IF_SW_TYPE     BIT(17)
++#define BGMAC_FEAT_CC4_IF_SW_TYPE_RGMII       BIT(18)
++#define BGMAC_FEAT_CC7_IF_TYPE_RGMII  BIT(19)
+ struct bgmac_slot_info {
+       union {
+--- a/include/linux/bcma/bcma_regs.h
++++ b/include/linux/bcma/bcma_regs.h
+@@ -23,6 +23,7 @@
+ #define  BCMA_CLKCTLST_4328A0_HAVEALP 0x00020000 /* 4328a0 has reversed bits */
+ /* Agent registers (common for every core) */
++#define BCMA_OOB_SEL_OUT_A30          0x0100
+ #define BCMA_IOCTL                    0x0408 /* IO control */
+ #define  BCMA_IOCTL_CLK                       0x0001
+ #define  BCMA_IOCTL_FGC                       0x0002
diff --git a/target/linux/generic/patches-4.4/077-0002-net-bgmac-make-it-clear-when-setting-interface-type-.patch b/target/linux/generic/patches-4.4/077-0002-net-bgmac-make-it-clear-when-setting-interface-type-.patch
new file mode 100644 (file)
index 0000000..5f60a32
--- /dev/null
@@ -0,0 +1,31 @@
+From e2d8f646c79f26e094bfaf9b21be614d1e148a67 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
+Date: Wed, 17 Aug 2016 23:11:52 +0200
+Subject: [PATCH] net: bgmac: make it clear when setting interface type to RMII
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+It doesn't really change anything as BGMAC_CHIPCTL_1_IF_TYPE_RMII is
+equal to 0. It make code a bit clener, so far when reading it one could
+think we forgot to set a proper mode. It also keeps this mode code in
+sync with other ones.
+
+Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+---
+ drivers/net/ethernet/broadcom/bgmac.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+--- a/drivers/net/ethernet/broadcom/bgmac.c
++++ b/drivers/net/ethernet/broadcom/bgmac.c
+@@ -932,7 +932,8 @@ static void bgmac_chip_reset(struct bgma
+                       et_swtype <<= 4;
+                       sw_type = et_swtype;
+               } else if (bgmac->feature_flags & BGMAC_FEAT_SW_TYPE_EPHYRMII) {
+-                      sw_type = BGMAC_CHIPCTL_1_SW_TYPE_EPHYRMII;
++                      sw_type = BGMAC_CHIPCTL_1_IF_TYPE_RMII |
++                                BGMAC_CHIPCTL_1_SW_TYPE_EPHYRMII;
+               } else if (bgmac->feature_flags & BGMAC_FEAT_SW_TYPE_RGMII) {
+                       sw_type = BGMAC_CHIPCTL_1_IF_TYPE_RGMII |
+                                 BGMAC_CHIPCTL_1_SW_TYPE_RGMII;
diff --git a/target/linux/generic/patches-4.4/170-net-bgmac-fix-reversed-check-for-MII-registration-er.patch b/target/linux/generic/patches-4.4/170-net-bgmac-fix-reversed-check-for-MII-registration-er.patch
deleted file mode 100644 (file)
index eafbbb6..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-From 031d3de673a8bc0b7b4183ba3898a0abd803920a Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
-Date: Wed, 17 Aug 2016 15:31:59 +0200
-Subject: [PATCH net] net: bgmac: fix reversed check for MII registration error
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-It was failing on successful registration returning meaningless errors.
-
-Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
-Fixes: 55954f3bfdac ("net: ethernet: bgmac: move BCMA MDIO Phy code into a separate file")
----
-This fix is intendent for net repository (4.8 release).
----
- drivers/net/ethernet/broadcom/bgmac-bcma.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
---- a/drivers/net/ethernet/broadcom/bgmac-bcma.c
-+++ b/drivers/net/ethernet/broadcom/bgmac-bcma.c
-@@ -159,7 +159,7 @@ static int bgmac_probe(struct bcma_devic
-       if (!bgmac_is_bcm4707_family(core)) {
-               mii_bus = bcma_mdio_mii_register(core, bgmac->phyaddr);
--              if (!IS_ERR(mii_bus)) {
-+              if (IS_ERR(mii_bus)) {
-                       err = PTR_ERR(mii_bus);
-                       goto err;
-               }
diff --git a/target/linux/generic/patches-4.4/171-net-bgmac-support-Ethernet-core-on-BCM53573-SoCs.patch b/target/linux/generic/patches-4.4/171-net-bgmac-support-Ethernet-core-on-BCM53573-SoCs.patch
deleted file mode 100644 (file)
index 51e7623..0000000
+++ /dev/null
@@ -1,160 +0,0 @@
-From 7d9acff816e15f7d8a51f912bc663373f1d31e7b Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
-Date: Wed, 17 Aug 2016 22:47:22 +0200
-Subject: [PATCH net-next] net: bgmac: support Ethernet core on BCM53573 SoCs
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-BCM53573 is a new series of Broadcom's SoCs. It's based on ARM and can
-be found in two packages (versions): BCM53573 and BCM47189. It shares
-some code with the Northstar family, but also requires some new quirks.
-
-First of all there can be up to 2 Ethernet cores on this SoC. If that is
-the case, they are connected to two different switch ports allowing some
-more complex/optimized setups. It seems the second unit doesn't come
-fully configured and requires some IRQ quirk.
-
-Other than that only the first core is connected to the PHY. For the
-second one we have to register fixed PHY (similarly to the Northstar),
-otherwise generic PHY driver would get some invalid info.
-
-This has been successfully tested on Tenda AC9 (BCM47189B0).
-
-Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
----
- drivers/net/ethernet/broadcom/bgmac-bcma.c | 19 ++++++++++++++++++-
- drivers/net/ethernet/broadcom/bgmac.c      | 25 +++++++++++++++++++++++++
- drivers/net/ethernet/broadcom/bgmac.h      | 19 +++++++++++++++++++
- include/linux/bcma/bcma.h                  |  3 +++
- include/linux/bcma/bcma_regs.h             |  1 +
- 5 files changed, 66 insertions(+), 1 deletion(-)
-
---- a/drivers/net/ethernet/broadcom/bgmac-bcma.c
-+++ b/drivers/net/ethernet/broadcom/bgmac-bcma.c
-@@ -92,6 +92,7 @@ MODULE_DEVICE_TABLE(bcma, bgmac_bcma_tbl
- /* 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 ssb_sprom *sprom = &core->bus->sprom;
-       struct mii_bus *mii_bus;
-       struct bgmac *bgmac;
-@@ -157,7 +158,8 @@ static int bgmac_probe(struct bcma_devic
-       dev_info(bgmac->dev, "Found PHY addr: %d%s\n", bgmac->phyaddr,
-                bgmac->phyaddr == BGMAC_PHY_NOREGS ? " (NOREGS)" : "");
--      if (!bgmac_is_bcm4707_family(core)) {
-+      if (!bgmac_is_bcm4707_family(core) &&
-+          !(ci->id == BCMA_CHIP_ID_BCM53573 && core->core_unit == 1)) {
-               mii_bus = bcma_mdio_mii_register(core, bgmac->phyaddr);
-               if (IS_ERR(mii_bus)) {
-                       err = PTR_ERR(mii_bus);
-@@ -230,6 +232,21 @@ static int bgmac_probe(struct bcma_devic
-               bgmac->feature_flags |= BGMAC_FEAT_NO_RESET;
-               bgmac->feature_flags |= BGMAC_FEAT_FORCE_SPEED_2500;
-               break;
-+      case BCMA_CHIP_ID_BCM53573:
-+              bgmac->feature_flags |= BGMAC_FEAT_CLKCTLST;
-+              bgmac->feature_flags |= BGMAC_FEAT_SET_RXQ_CLK;
-+              if (ci->pkg == BCMA_PKG_ID_BCM47189)
-+                      bgmac->feature_flags |= BGMAC_FEAT_IOST_ATTACHED;
-+              if (core->core_unit == 0) {
-+                      bgmac->feature_flags |= BGMAC_FEAT_CC4_IF_SW_TYPE;
-+                      if (ci->pkg == BCMA_PKG_ID_BCM47189)
-+                              bgmac->feature_flags |=
-+                                      BGMAC_FEAT_CC4_IF_SW_TYPE_RGMII;
-+              } else if (core->core_unit == 1) {
-+                      bgmac->feature_flags |= BGMAC_FEAT_IRQ_ID_OOB_6;
-+                      bgmac->feature_flags |= BGMAC_FEAT_CC7_IF_TYPE_RGMII;
-+              }
-+              break;
-       default:
-               bgmac->feature_flags |= BGMAC_FEAT_CLKCTLST;
-               bgmac->feature_flags |= BGMAC_FEAT_SET_RXQ_CLK;
---- a/drivers/net/ethernet/broadcom/bgmac.c
-+++ b/drivers/net/ethernet/broadcom/bgmac.c
-@@ -940,6 +940,27 @@ static void bgmac_chip_reset(struct bgma
-               bgmac_cco_ctl_maskset(bgmac, 1, ~(BGMAC_CHIPCTL_1_IF_TYPE_MASK |
-                                                 BGMAC_CHIPCTL_1_SW_TYPE_MASK),
-                                     sw_type);
-+      } else if (bgmac->feature_flags & BGMAC_FEAT_CC4_IF_SW_TYPE) {
-+              u32 sw_type = BGMAC_CHIPCTL_4_IF_TYPE_MII |
-+                            BGMAC_CHIPCTL_4_SW_TYPE_EPHY;
-+              u8 et_swtype = 0;
-+              char buf[4];
-+
-+              if (bcm47xx_nvram_getenv("et_swtype", buf, sizeof(buf)) > 0) {
-+                      if (kstrtou8(buf, 0, &et_swtype))
-+                              dev_err(bgmac->dev, "Failed to parse et_swtype (%s)\n",
-+                                      buf);
-+                      sw_type = (et_swtype & 0x0f) << 12;
-+              } else if (bgmac->feature_flags & BGMAC_FEAT_CC4_IF_SW_TYPE_RGMII) {
-+                      sw_type = BGMAC_CHIPCTL_4_IF_TYPE_RGMII |
-+                                BGMAC_CHIPCTL_4_SW_TYPE_RGMII;
-+              }
-+              bgmac_cco_ctl_maskset(bgmac, 4, ~(BGMAC_CHIPCTL_4_IF_TYPE_MASK |
-+                                                BGMAC_CHIPCTL_4_SW_TYPE_MASK),
-+                                    sw_type);
-+      } else if (bgmac->feature_flags & BGMAC_FEAT_CC7_IF_TYPE_RGMII) {
-+              bgmac_cco_ctl_maskset(bgmac, 7, ~BGMAC_CHIPCTL_7_IF_TYPE_MASK,
-+                                    BGMAC_CHIPCTL_7_IF_TYPE_RGMII);
-       }
-       if (iost & BGMAC_BCMA_IOST_ATTACHED && !bgmac->has_robosw)
-@@ -1483,6 +1504,10 @@ int bgmac_enet_probe(struct bgmac *info)
-        */
-       bgmac_clk_enable(bgmac, 0);
-+      /* This seems to be fixing IRQ by assigning OOB #6 to the core */
-+      if (bgmac->feature_flags & BGMAC_FEAT_IRQ_ID_OOB_6)
-+              bgmac_idm_write(bgmac, BCMA_OOB_SEL_OUT_A30, 0x86);
-+
-       bgmac_chip_reset(bgmac);
-       err = bgmac_dma_alloc(bgmac);
---- a/drivers/net/ethernet/broadcom/bgmac.h
-+++ b/drivers/net/ethernet/broadcom/bgmac.h
-@@ -369,6 +369,21 @@
- #define BGMAC_CHIPCTL_1_SW_TYPE_RGMII         0x000000C0
- #define BGMAC_CHIPCTL_1_RXC_DLL_BYPASS                0x00010000
-+#define BGMAC_CHIPCTL_4_IF_TYPE_MASK          0x00003000
-+#define BGMAC_CHIPCTL_4_IF_TYPE_RMII          0x00000000
-+#define BGMAC_CHIPCTL_4_IF_TYPE_MII           0x00001000
-+#define BGMAC_CHIPCTL_4_IF_TYPE_RGMII         0x00002000
-+#define BGMAC_CHIPCTL_4_SW_TYPE_MASK          0x0000C000
-+#define BGMAC_CHIPCTL_4_SW_TYPE_EPHY          0x00000000
-+#define BGMAC_CHIPCTL_4_SW_TYPE_EPHYMII               0x00004000
-+#define BGMAC_CHIPCTL_4_SW_TYPE_EPHYRMII      0x00008000
-+#define BGMAC_CHIPCTL_4_SW_TYPE_RGMII         0x0000C000
-+
-+#define BGMAC_CHIPCTL_7_IF_TYPE_MASK          0x000000C0
-+#define BGMAC_CHIPCTL_7_IF_TYPE_RMII          0x00000000
-+#define BGMAC_CHIPCTL_7_IF_TYPE_MII           0x00000040
-+#define BGMAC_CHIPCTL_7_IF_TYPE_RGMII         0x00000080
-+
- #define BGMAC_WEIGHT  64
- #define ETHER_MAX_LEN   1518
-@@ -390,6 +405,10 @@
- #define BGMAC_FEAT_NO_CLR_MIB         BIT(13)
- #define BGMAC_FEAT_FORCE_SPEED_2500   BIT(14)
- #define BGMAC_FEAT_CMDCFG_SR_REV4     BIT(15)
-+#define BGMAC_FEAT_IRQ_ID_OOB_6               BIT(16)
-+#define BGMAC_FEAT_CC4_IF_SW_TYPE     BIT(17)
-+#define BGMAC_FEAT_CC4_IF_SW_TYPE_RGMII       BIT(18)
-+#define BGMAC_FEAT_CC7_IF_TYPE_RGMII  BIT(19)
- struct bgmac_slot_info {
-       union {
---- a/include/linux/bcma/bcma_regs.h
-+++ b/include/linux/bcma/bcma_regs.h
-@@ -23,6 +23,7 @@
- #define  BCMA_CLKCTLST_4328A0_HAVEALP 0x00020000 /* 4328a0 has reversed bits */
- /* Agent registers (common for every core) */
-+#define BCMA_OOB_SEL_OUT_A30          0x0100
- #define BCMA_IOCTL                    0x0408 /* IO control */
- #define  BCMA_IOCTL_CLK                       0x0001
- #define  BCMA_IOCTL_FGC                       0x0002
index e5c0a63..49c0dca 100644 (file)
@@ -12,7 +12,7 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
  #include <linux/bcm47xx_nvram.h>
  #include "bgmac.h"
  
-@@ -1399,6 +1400,17 @@ static const struct ethtool_ops bgmac_et
+@@ -1400,6 +1401,17 @@ static const struct ethtool_ops bgmac_et
        .get_drvinfo            = bgmac_get_drvinfo,
  };
  
@@ -30,7 +30,7 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
  /**************************************************
   * MII
   **************************************************/
-@@ -1535,6 +1547,14 @@ int bgmac_enet_probe(struct bgmac *info)
+@@ -1536,6 +1548,14 @@ int bgmac_enet_probe(struct bgmac *info)
        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) {
                dev_err(bgmac->dev, "Cannot register net device\n");
-@@ -1558,6 +1578,10 @@ EXPORT_SYMBOL_GPL(bgmac_enet_probe);
+@@ -1559,6 +1579,10 @@ EXPORT_SYMBOL_GPL(bgmac_enet_probe);
  
  void bgmac_enet_remove(struct bgmac *bgmac)
  {