linux: update b53 upstream driver
authorRafał Miłecki <rafal@milecki.pl>
Fri, 17 Sep 2021 08:07:22 +0000 (10:07 +0200)
committerRafał Miłecki <rafal@milecki.pl>
Fri, 17 Sep 2021 08:15:26 +0000 (10:15 +0200)
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
25 files changed:
target/linux/bmips/patches-5.10/045-v5.13-net-dsa-b53-spi-allow-device-tree-probing.patch [deleted file]
target/linux/bmips/patches-5.10/048-v5.13-net-dsa-b53-relax-is63xx-condition.patch [deleted file]
target/linux/bmips/patches-5.10/049-v5.13-net-dsa-tag_brcm-add-support-for-legacy-tags.patch [deleted file]
target/linux/bmips/patches-5.10/050-v5.13-net-dsa-b53-support-legacy-tags.patch [deleted file]
target/linux/bmips/patches-5.10/051-v5.13-net-dsa-b53-mmap-Add-device-tree-support.patch [deleted file]
target/linux/bmips/patches-5.10/510-net-dsa-b53-add-support-for-BCM63xx-RGMIIs.patch
target/linux/generic/backport-5.10/790-v5.13-0001-net-dsa-b53-Add-debug-prints-in-b53_vlan_enable.patch [new file with mode: 0644]
target/linux/generic/backport-5.10/790-v5.13-0002-net-dsa-b53-spi-allow-device-tree-probing.patch [new file with mode: 0644]
target/linux/generic/backport-5.10/790-v5.13-0003-net-dsa-b53-relax-is63xx-condition.patch [new file with mode: 0644]
target/linux/generic/backport-5.10/790-v5.13-0004-net-dsa-tag_brcm-add-support-for-legacy-tags.patch [new file with mode: 0644]
target/linux/generic/backport-5.10/790-v5.13-0005-net-dsa-b53-support-legacy-tags.patch [new file with mode: 0644]
target/linux/generic/backport-5.10/790-v5.13-0006-net-dsa-b53-mmap-Add-device-tree-support.patch [new file with mode: 0644]
target/linux/generic/backport-5.10/790-v5.13-0007-net-dsa-b53-spi-add-missing-MODULE_DEVICE_TABLE.patch [new file with mode: 0644]
target/linux/generic/backport-5.10/790-v5.15-0001-net-dsa-b53-Fix-calculating-number-of-switch-ports.patch [deleted file]
target/linux/generic/backport-5.10/790-v5.15-0002-net-dsa-b53-Set-correct-number-of-ports-in-the-DSA-s.patch [deleted file]
target/linux/generic/backport-5.10/791-v5.14-0001-net-dsa-b53-Do-not-force-CPU-to-be-always-tagged.patch [new file with mode: 0644]
target/linux/generic/backport-5.10/791-v5.14-0002-net-dsa-b53-remove-redundant-null-check-on-dev.patch [new file with mode: 0644]
target/linux/generic/backport-5.10/791-v5.14-0003-net-dsa-b53-Create-default-VLAN-entry-explicitly.patch [new file with mode: 0644]
target/linux/generic/backport-5.10/792-v5.15-0001-net-dsa-b53-Fix-calculating-number-of-switch-ports.patch [new file with mode: 0644]
target/linux/generic/backport-5.10/792-v5.15-0002-net-dsa-b53-Set-correct-number-of-ports-in-the-DSA-s.patch [new file with mode: 0644]
target/linux/generic/backport-5.10/792-v5.15-0003-net-dsa-b53-Fix-IMP-port-setup-on-BCM5301x.patch [new file with mode: 0644]
target/linux/generic/backport-5.10/793-v5.16-0001-net-dsa-b53-Include-all-ports-in-enabled_ports.patch [new file with mode: 0644]
target/linux/generic/backport-5.10/793-v5.16-0002-net-dsa-b53-Drop-BCM5301x-workaround-for-a-wrong-CPU.patch [new file with mode: 0644]
target/linux/generic/backport-5.10/793-v5.16-0003-net-dsa-b53-Improve-flow-control-setup-on-BCM5301x.patch [new file with mode: 0644]
target/linux/generic/backport-5.10/793-v5.16-0004-net-dsa-b53-Drop-unused-cpu_port-field.patch [new file with mode: 0644]

diff --git a/target/linux/bmips/patches-5.10/045-v5.13-net-dsa-b53-spi-allow-device-tree-probing.patch b/target/linux/bmips/patches-5.10/045-v5.13-net-dsa-b53-spi-allow-device-tree-probing.patch
deleted file mode 100644 (file)
index 56579b2..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-From 6d16eadab6db0c1d61e59fee7ed1ecc2d10269be Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= <noltari@gmail.com>
-Date: Mon, 15 Mar 2021 15:14:23 +0100
-Subject: [PATCH] net: dsa: b53: spi: allow device tree probing
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-Add missing of_match_table to allow device tree probing.
-
-Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
-Signed-off-by: David S. Miller <davem@davemloft.net>
----
- drivers/net/dsa/b53/b53_spi.c | 13 +++++++++++++
- 1 file changed, 13 insertions(+)
-
---- a/drivers/net/dsa/b53/b53_spi.c
-+++ b/drivers/net/dsa/b53/b53_spi.c
-@@ -324,9 +324,22 @@ static int b53_spi_remove(struct spi_dev
-       return 0;
- }
-+static const struct of_device_id b53_spi_of_match[] = {
-+      { .compatible = "brcm,bcm5325" },
-+      { .compatible = "brcm,bcm5365" },
-+      { .compatible = "brcm,bcm5395" },
-+      { .compatible = "brcm,bcm5397" },
-+      { .compatible = "brcm,bcm5398" },
-+      { .compatible = "brcm,bcm53115" },
-+      { .compatible = "brcm,bcm53125" },
-+      { .compatible = "brcm,bcm53128" },
-+      { /* sentinel */ }
-+};
-+
- static struct spi_driver b53_spi_driver = {
-       .driver = {
-               .name   = "b53-switch",
-+              .of_match_table = b53_spi_of_match,
-       },
-       .probe  = b53_spi_probe,
-       .remove = b53_spi_remove,
diff --git a/target/linux/bmips/patches-5.10/048-v5.13-net-dsa-b53-relax-is63xx-condition.patch b/target/linux/bmips/patches-5.10/048-v5.13-net-dsa-b53-relax-is63xx-condition.patch
deleted file mode 100644 (file)
index ef5522a..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-From ad426d7d966b525b73ed5a1842dd830312bbba71 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= <noltari@gmail.com>
-Date: Wed, 17 Mar 2021 09:42:01 +0100
-Subject: [PATCH] net: dsa: b53: relax is63xx() condition
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-BCM63xx switches are present on bcm63xx and bmips devices.
-
-Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
-Acked-by: Florian Fainelli <f.fainelli@gmail.com>
-Signed-off-by: David S. Miller <davem@davemloft.net>
----
- drivers/net/dsa/b53/b53_priv.h | 4 ----
- 1 file changed, 4 deletions(-)
-
---- a/drivers/net/dsa/b53/b53_priv.h
-+++ b/drivers/net/dsa/b53/b53_priv.h
-@@ -185,11 +185,7 @@ static inline int is531x5(struct b53_dev
- static inline int is63xx(struct b53_device *dev)
- {
--#ifdef CONFIG_BCM63XX
-       return dev->chip_id == BCM63XX_DEVICE_ID;
--#else
--      return 0;
--#endif
- }
- static inline int is5301x(struct b53_device *dev)
diff --git a/target/linux/bmips/patches-5.10/049-v5.13-net-dsa-tag_brcm-add-support-for-legacy-tags.patch b/target/linux/bmips/patches-5.10/049-v5.13-net-dsa-tag_brcm-add-support-for-legacy-tags.patch
deleted file mode 100644 (file)
index c689bc8..0000000
+++ /dev/null
@@ -1,180 +0,0 @@
-From 964dbf186eaa84d409c359ddf09c827a3fbe8228 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= <noltari@gmail.com>
-Date: Wed, 17 Mar 2021 11:29:26 +0100
-Subject: [PATCH 1/2] net: dsa: tag_brcm: add support for legacy tags
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-Add support for legacy Broadcom tags, which are similar to DSA_TAG_PROTO_BRCM.
-These tags are used on BCM5325, BCM5365 and BCM63xx switches.
-
-Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
-Signed-off-by: David S. Miller <davem@davemloft.net>
----
- include/net/dsa.h  |   2 +
- net/dsa/Kconfig    |   7 +++
- net/dsa/tag_brcm.c | 107 +++++++++++++++++++++++++++++++++++++++++++--
- 3 files changed, 113 insertions(+), 3 deletions(-)
-
---- a/include/net/dsa.h
-+++ b/include/net/dsa.h
-@@ -45,10 +45,12 @@ struct phylink_link_state;
- #define DSA_TAG_PROTO_OCELOT_VALUE            15
- #define DSA_TAG_PROTO_AR9331_VALUE            16
- #define DSA_TAG_PROTO_RTL4_A_VALUE            17
-+#define DSA_TAG_PROTO_BRCM_LEGACY_VALUE               22
- enum dsa_tag_protocol {
-       DSA_TAG_PROTO_NONE              = DSA_TAG_PROTO_NONE_VALUE,
-       DSA_TAG_PROTO_BRCM              = DSA_TAG_PROTO_BRCM_VALUE,
-+      DSA_TAG_PROTO_BRCM_LEGACY       = DSA_TAG_PROTO_BRCM_LEGACY_VALUE,
-       DSA_TAG_PROTO_BRCM_PREPEND      = DSA_TAG_PROTO_BRCM_PREPEND_VALUE,
-       DSA_TAG_PROTO_DSA               = DSA_TAG_PROTO_DSA_VALUE,
-       DSA_TAG_PROTO_EDSA              = DSA_TAG_PROTO_EDSA_VALUE,
---- a/net/dsa/Kconfig
-+++ b/net/dsa/Kconfig
-@@ -47,6 +47,13 @@ config NET_DSA_TAG_BRCM
-         Say Y if you want to enable support for tagging frames for the
-         Broadcom switches which place the tag after the MAC source address.
-+config NET_DSA_TAG_BRCM_LEGACY
-+      tristate "Tag driver for Broadcom legacy switches using in-frame headers"
-+      select NET_DSA_TAG_BRCM_COMMON
-+      help
-+        Say Y if you want to enable support for tagging frames for the
-+        Broadcom legacy switches which place the tag after the MAC source
-+        address.
- config NET_DSA_TAG_BRCM_PREPEND
-       tristate "Tag driver for Broadcom switches using prepended headers"
---- a/net/dsa/tag_brcm.c
-+++ b/net/dsa/tag_brcm.c
-@@ -11,9 +11,26 @@
- #include "dsa_priv.h"
--/* This tag length is 4 bytes, older ones were 6 bytes, we do not
-- * handle them
-- */
-+/* Legacy Broadcom tag (6 bytes) */
-+#define BRCM_LEG_TAG_LEN      6
-+
-+/* Type fields */
-+/* 1st byte in the tag */
-+#define BRCM_LEG_TYPE_HI      0x88
-+/* 2nd byte in the tag */
-+#define BRCM_LEG_TYPE_LO      0x74
-+
-+/* Tag fields */
-+/* 3rd byte in the tag */
-+#define BRCM_LEG_UNICAST      (0 << 5)
-+#define BRCM_LEG_MULTICAST    (1 << 5)
-+#define BRCM_LEG_EGRESS               (2 << 5)
-+#define BRCM_LEG_INGRESS      (3 << 5)
-+
-+/* 6th byte in the tag */
-+#define BRCM_LEG_PORT_ID      (0xf)
-+
-+/* Newer Broadcom tag (4 bytes) */
- #define BRCM_TAG_LEN  4
- /* Tag is constructed and desconstructed using byte by byte access
-@@ -194,6 +211,87 @@ DSA_TAG_DRIVER(brcm_netdev_ops);
- MODULE_ALIAS_DSA_TAG_DRIVER(DSA_TAG_PROTO_BRCM);
- #endif
-+#if IS_ENABLED(CONFIG_NET_DSA_TAG_BRCM_LEGACY)
-+static struct sk_buff *brcm_leg_tag_xmit(struct sk_buff *skb,
-+                                       struct net_device *dev)
-+{
-+      struct dsa_port *dp = dsa_slave_to_port(dev);
-+      u8 *brcm_tag;
-+
-+      /* The Ethernet switch we are interfaced with needs packets to be at
-+       * least 64 bytes (including FCS) otherwise they will be discarded when
-+       * they enter the switch port logic. When Broadcom tags are enabled, we
-+       * need to make sure that packets are at least 70 bytes
-+       * (including FCS and tag) because the length verification is done after
-+       * the Broadcom tag is stripped off the ingress packet.
-+       *
-+       * Let dsa_slave_xmit() free the SKB
-+       */
-+      if (__skb_put_padto(skb, ETH_ZLEN + BRCM_LEG_TAG_LEN, false))
-+              return NULL;
-+
-+      skb_push(skb, BRCM_LEG_TAG_LEN);
-+
-+      memmove(skb->data, skb->data + BRCM_LEG_TAG_LEN, 2 * ETH_ALEN);
-+
-+      brcm_tag = skb->data + 2 * ETH_ALEN;
-+
-+      /* Broadcom tag type */
-+      brcm_tag[0] = BRCM_LEG_TYPE_HI;
-+      brcm_tag[1] = BRCM_LEG_TYPE_LO;
-+
-+      /* Broadcom tag value */
-+      brcm_tag[2] = BRCM_LEG_EGRESS;
-+      brcm_tag[3] = 0;
-+      brcm_tag[4] = 0;
-+      brcm_tag[5] = dp->index & BRCM_LEG_PORT_ID;
-+
-+      return skb;
-+}
-+
-+static struct sk_buff *brcm_leg_tag_rcv(struct sk_buff *skb,
-+                                      struct net_device *dev,
-+                                      struct packet_type *pt)
-+{
-+      int source_port;
-+      u8 *brcm_tag;
-+
-+      if (unlikely(!pskb_may_pull(skb, BRCM_LEG_PORT_ID)))
-+              return NULL;
-+
-+      brcm_tag = skb->data - 2;
-+
-+      source_port = brcm_tag[5] & BRCM_LEG_PORT_ID;
-+
-+      skb->dev = dsa_master_find_slave(dev, 0, source_port);
-+      if (!skb->dev)
-+              return NULL;
-+
-+      /* Remove Broadcom tag and update checksum */
-+      skb_pull_rcsum(skb, BRCM_LEG_TAG_LEN);
-+
-+      skb->offload_fwd_mark = 1;
-+
-+      /* Move the Ethernet DA and SA */
-+      memmove(skb->data - ETH_HLEN,
-+              skb->data - ETH_HLEN - BRCM_LEG_TAG_LEN,
-+              2 * ETH_ALEN);
-+
-+      return skb;
-+}
-+
-+static const struct dsa_device_ops brcm_legacy_netdev_ops = {
-+      .name = "brcm-legacy",
-+      .proto = DSA_TAG_PROTO_BRCM_LEGACY,
-+      .xmit = brcm_leg_tag_xmit,
-+      .rcv = brcm_leg_tag_rcv,
-+      .overhead = BRCM_LEG_TAG_LEN,
-+};
-+
-+DSA_TAG_DRIVER(brcm_legacy_netdev_ops);
-+MODULE_ALIAS_DSA_TAG_DRIVER(DSA_TAG_PROTO_BRCM_LEGACY);
-+#endif /* CONFIG_NET_DSA_TAG_BRCM_LEGACY */
-+
- #if IS_ENABLED(CONFIG_NET_DSA_TAG_BRCM_PREPEND)
- static struct sk_buff *brcm_tag_xmit_prepend(struct sk_buff *skb,
-                                            struct net_device *dev)
-@@ -226,6 +324,9 @@ static struct dsa_tag_driver *dsa_tag_dr
- #if IS_ENABLED(CONFIG_NET_DSA_TAG_BRCM)
-       &DSA_TAG_DRIVER_NAME(brcm_netdev_ops),
- #endif
-+#if IS_ENABLED(CONFIG_NET_DSA_TAG_BRCM_LEGACY)
-+      &DSA_TAG_DRIVER_NAME(brcm_legacy_netdev_ops),
-+#endif
- #if IS_ENABLED(CONFIG_NET_DSA_TAG_BRCM_PREPEND)
-       &DSA_TAG_DRIVER_NAME(brcm_prepend_netdev_ops),
- #endif
diff --git a/target/linux/bmips/patches-5.10/050-v5.13-net-dsa-b53-support-legacy-tags.patch b/target/linux/bmips/patches-5.10/050-v5.13-net-dsa-b53-support-legacy-tags.patch
deleted file mode 100644 (file)
index 18cd09f..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-From 46c5176c586c81306bf9e7024c13b95da775490f Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= <noltari@gmail.com>
-Date: Wed, 17 Mar 2021 11:29:27 +0100
-Subject: [PATCH 2/2] net: dsa: b53: support legacy tags
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-These tags are used on BCM5325, BCM5365 and BCM63xx switches.
-
-Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
-Acked-by: Florian Fainelli <f.fainelli@gmail.com>
-Signed-off-by: David S. Miller <davem@davemloft.net>
----
- drivers/net/dsa/b53/Kconfig      |  1 +
- drivers/net/dsa/b53/b53_common.c | 12 +++++++-----
- 2 files changed, 8 insertions(+), 5 deletions(-)
-
---- a/drivers/net/dsa/b53/Kconfig
-+++ b/drivers/net/dsa/b53/Kconfig
-@@ -3,6 +3,7 @@ menuconfig B53
-       tristate "Broadcom BCM53xx managed switch support"
-       depends on NET_DSA
-       select NET_DSA_TAG_BRCM
-+      select NET_DSA_TAG_BRCM_LEGACY
-       select NET_DSA_TAG_BRCM_PREPEND
-       help
-         This driver adds support for Broadcom managed switch chips. It supports
---- a/drivers/net/dsa/b53/b53_common.c
-+++ b/drivers/net/dsa/b53/b53_common.c
-@@ -2021,15 +2021,17 @@ enum dsa_tag_protocol b53_get_tag_protoc
- {
-       struct b53_device *dev = ds->priv;
--      /* Older models (5325, 5365) support a different tag format that we do
--       * not support in net/dsa/tag_brcm.c yet.
--       */
--      if (is5325(dev) || is5365(dev) ||
--          !b53_can_enable_brcm_tags(ds, port, mprot)) {
-+      if (!b53_can_enable_brcm_tags(ds, port, mprot)) {
-               dev->tag_protocol = DSA_TAG_PROTO_NONE;
-               goto out;
-       }
-+      /* Older models require a different 6 byte tag */
-+      if (is5325(dev) || is5365(dev) || is63xx(dev)) {
-+              dev->tag_protocol = DSA_TAG_PROTO_BRCM_LEGACY;
-+              goto out;
-+      }
-+
-       /* Broadcom BCM58xx chips have a flow accelerator on Port 8
-        * which requires us to use the prepended Broadcom tag type
-        */
diff --git a/target/linux/bmips/patches-5.10/051-v5.13-net-dsa-b53-mmap-Add-device-tree-support.patch b/target/linux/bmips/patches-5.10/051-v5.13-net-dsa-b53-mmap-Add-device-tree-support.patch
deleted file mode 100644 (file)
index c1014b2..0000000
+++ /dev/null
@@ -1,92 +0,0 @@
-From a5538a777b73b35750ed1ffff8c1ef539e861624 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= <noltari@gmail.com>
-Date: Wed, 17 Mar 2021 10:23:17 +0100
-Subject: [PATCH] net: dsa: b53: mmap: Add device tree support
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-Add device tree support to b53_mmap.c while keeping platform devices support.
-
-Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
-Signed-off-by: David S. Miller <davem@davemloft.net>
----
- drivers/net/dsa/b53/b53_mmap.c | 55 ++++++++++++++++++++++++++++++++++
- 1 file changed, 55 insertions(+)
-
---- a/drivers/net/dsa/b53/b53_mmap.c
-+++ b/drivers/net/dsa/b53/b53_mmap.c
-@@ -16,6 +16,7 @@
-  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-  */
-+#include <linux/bits.h>
- #include <linux/kernel.h>
- #include <linux/module.h>
- #include <linux/io.h>
-@@ -228,11 +229,65 @@ static const struct b53_io_ops b53_mmap_
-       .write64 = b53_mmap_write64,
- };
-+static int b53_mmap_probe_of(struct platform_device *pdev,
-+                           struct b53_platform_data **ppdata)
-+{
-+      struct device_node *np = pdev->dev.of_node;
-+      struct device_node *of_ports, *of_port;
-+      struct device *dev = &pdev->dev;
-+      struct b53_platform_data *pdata;
-+      void __iomem *mem;
-+
-+      mem = devm_platform_ioremap_resource(pdev, 0);
-+      if (IS_ERR(mem))
-+              return PTR_ERR(mem);
-+
-+      pdata = devm_kzalloc(dev, sizeof(struct b53_platform_data),
-+                           GFP_KERNEL);
-+      if (!pdata)
-+              return -ENOMEM;
-+
-+      pdata->regs = mem;
-+      pdata->chip_id = BCM63XX_DEVICE_ID;
-+      pdata->big_endian = of_property_read_bool(np, "big-endian");
-+
-+      of_ports = of_get_child_by_name(np, "ports");
-+      if (!of_ports) {
-+              dev_err(dev, "no ports child node found\n");
-+              return -EINVAL;
-+      }
-+
-+      for_each_available_child_of_node(of_ports, of_port) {
-+              u32 reg;
-+
-+              if (of_property_read_u32(of_port, "reg", &reg))
-+                      continue;
-+
-+              if (reg < B53_CPU_PORT)
-+                      pdata->enabled_ports |= BIT(reg);
-+      }
-+
-+      of_node_put(of_ports);
-+      *ppdata = pdata;
-+
-+      return 0;
-+}
-+
- static int b53_mmap_probe(struct platform_device *pdev)
- {
-+      struct device_node *np = pdev->dev.of_node;
-       struct b53_platform_data *pdata = pdev->dev.platform_data;
-       struct b53_mmap_priv *priv;
-       struct b53_device *dev;
-+      int ret;
-+
-+      if (!pdata && np) {
-+              ret = b53_mmap_probe_of(pdev, &pdata);
-+              if (ret) {
-+                      dev_err(&pdev->dev, "OF probe error\n");
-+                      return ret;
-+              }
-+      }
-       if (!pdata)
-               return -EINVAL;
index 41655231fa476a2fa59ae46c76c0c11403f95a29..c636e3a907b76b5bb08e50542f082624428db5f3 100644 (file)
@@ -13,7 +13,7 @@ Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
 
 --- a/drivers/net/dsa/b53/b53_common.c
 +++ b/drivers/net/dsa/b53/b53_common.c
-@@ -1148,6 +1148,36 @@ static void b53_force_port_config(struct
+@@ -1174,6 +1174,36 @@ static void b53_force_port_config(struct
        b53_write8(dev, B53_CTRL_PAGE, off, reg);
  }
  
@@ -50,7 +50,7 @@ Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
  static void b53_adjust_link(struct dsa_switch *ds, int port,
                            struct phy_device *phydev)
  {
-@@ -1174,6 +1204,9 @@ static void b53_adjust_link(struct dsa_s
+@@ -1200,6 +1230,9 @@ static void b53_adjust_link(struct dsa_s
                              tx_pause, rx_pause);
        b53_force_link(dev, port, phydev->link);
  
@@ -58,9 +58,9 @@ Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
 +              b53_adjust_63xx_rgmii(ds, port, phydev->interface);
 +
        if (is531x5(dev) && phy_interface_is_rgmii(phydev)) {
-               if (port == 8)
+               if (port == dev->imp_port)
                        off = B53_RGMII_CTRL_IMP;
-@@ -1366,6 +1399,9 @@ void b53_phylink_mac_link_up(struct dsa_
+@@ -1386,6 +1419,9 @@ void b53_phylink_mac_link_up(struct dsa_
  {
        struct b53_device *dev = ds->priv;
  
diff --git a/target/linux/generic/backport-5.10/790-v5.13-0001-net-dsa-b53-Add-debug-prints-in-b53_vlan_enable.patch b/target/linux/generic/backport-5.10/790-v5.13-0001-net-dsa-b53-Add-debug-prints-in-b53_vlan_enable.patch
new file mode 100644 (file)
index 0000000..91cf55b
--- /dev/null
@@ -0,0 +1,65 @@
+From ee47ed08d75e8f16b3cf882061ee19c2ea19dd6c Mon Sep 17 00:00:00 2001
+From: Florian Fainelli <f.fainelli@gmail.com>
+Date: Wed, 10 Mar 2021 10:52:26 -0800
+Subject: [PATCH] net: dsa: b53: Add debug prints in b53_vlan_enable()
+
+Having dynamic debug prints in b53_vlan_enable() has been helpful to
+uncover a recent but update the function to indicate the port being
+configured (or -1 for initial setup) and include the global VLAN enabled
+and VLAN filtering enable status.
+
+Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
+Reviewed-by: Andrew Lunn <andrew@lunn.ch>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+---
+ drivers/net/dsa/b53/b53_common.c | 11 +++++++----
+ 1 file changed, 7 insertions(+), 4 deletions(-)
+
+--- a/drivers/net/dsa/b53/b53_common.c
++++ b/drivers/net/dsa/b53/b53_common.c
+@@ -349,7 +349,7 @@ static void b53_set_forwarding(struct b5
+       b53_write8(dev, B53_CTRL_PAGE, B53_IP_MULTICAST_CTRL, mgmt);
+ }
+-static void b53_enable_vlan(struct b53_device *dev, bool enable,
++static void b53_enable_vlan(struct b53_device *dev, int port, bool enable,
+                           bool enable_filtering)
+ {
+       u8 mgmt, vc0, vc1, vc4 = 0, vc5;
+@@ -431,6 +431,9 @@ static void b53_enable_vlan(struct b53_d
+       b53_write8(dev, B53_CTRL_PAGE, B53_SWITCH_MODE, mgmt);
+       dev->vlan_enabled = enable;
++
++      dev_dbg(dev->dev, "Port %d VLAN enabled: %d, filtering: %d\n",
++              port, enable, enable_filtering);
+ }
+ static int b53_set_jumbo(struct b53_device *dev, bool enable, bool allow_10_100)
+@@ -708,7 +711,7 @@ int b53_configure_vlan(struct dsa_switch
+               b53_do_vlan_op(dev, VTA_CMD_CLEAR);
+       }
+-      b53_enable_vlan(dev, dev->vlan_enabled, ds->vlan_filtering);
++      b53_enable_vlan(dev, -1, dev->vlan_enabled, ds->vlan_filtering);
+       b53_for_each_port(dev, i)
+               b53_write16(dev, B53_VLAN_PAGE,
+@@ -1390,7 +1393,7 @@ int b53_vlan_filtering(struct dsa_switch
+       if (switchdev_trans_ph_prepare(trans))
+               return 0;
+-      b53_enable_vlan(dev, dev->vlan_enabled, vlan_filtering);
++      b53_enable_vlan(dev, port, dev->vlan_enabled, vlan_filtering);
+       return 0;
+ }
+@@ -1415,7 +1418,7 @@ int b53_vlan_prepare(struct dsa_switch *
+       if (vlan->vid_end >= dev->num_vlans)
+               return -ERANGE;
+-      b53_enable_vlan(dev, true, ds->vlan_filtering);
++      b53_enable_vlan(dev, port, true, ds->vlan_filtering);
+       return 0;
+ }
diff --git a/target/linux/generic/backport-5.10/790-v5.13-0002-net-dsa-b53-spi-allow-device-tree-probing.patch b/target/linux/generic/backport-5.10/790-v5.13-0002-net-dsa-b53-spi-allow-device-tree-probing.patch
new file mode 100644 (file)
index 0000000..56579b2
--- /dev/null
@@ -0,0 +1,41 @@
+From 6d16eadab6db0c1d61e59fee7ed1ecc2d10269be Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= <noltari@gmail.com>
+Date: Mon, 15 Mar 2021 15:14:23 +0100
+Subject: [PATCH] net: dsa: b53: spi: allow device tree probing
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Add missing of_match_table to allow device tree probing.
+
+Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+---
+ drivers/net/dsa/b53/b53_spi.c | 13 +++++++++++++
+ 1 file changed, 13 insertions(+)
+
+--- a/drivers/net/dsa/b53/b53_spi.c
++++ b/drivers/net/dsa/b53/b53_spi.c
+@@ -324,9 +324,22 @@ static int b53_spi_remove(struct spi_dev
+       return 0;
+ }
++static const struct of_device_id b53_spi_of_match[] = {
++      { .compatible = "brcm,bcm5325" },
++      { .compatible = "brcm,bcm5365" },
++      { .compatible = "brcm,bcm5395" },
++      { .compatible = "brcm,bcm5397" },
++      { .compatible = "brcm,bcm5398" },
++      { .compatible = "brcm,bcm53115" },
++      { .compatible = "brcm,bcm53125" },
++      { .compatible = "brcm,bcm53128" },
++      { /* sentinel */ }
++};
++
+ static struct spi_driver b53_spi_driver = {
+       .driver = {
+               .name   = "b53-switch",
++              .of_match_table = b53_spi_of_match,
+       },
+       .probe  = b53_spi_probe,
+       .remove = b53_spi_remove,
diff --git a/target/linux/generic/backport-5.10/790-v5.13-0003-net-dsa-b53-relax-is63xx-condition.patch b/target/linux/generic/backport-5.10/790-v5.13-0003-net-dsa-b53-relax-is63xx-condition.patch
new file mode 100644 (file)
index 0000000..ef5522a
--- /dev/null
@@ -0,0 +1,31 @@
+From ad426d7d966b525b73ed5a1842dd830312bbba71 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= <noltari@gmail.com>
+Date: Wed, 17 Mar 2021 09:42:01 +0100
+Subject: [PATCH] net: dsa: b53: relax is63xx() condition
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+BCM63xx switches are present on bcm63xx and bmips devices.
+
+Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
+Acked-by: Florian Fainelli <f.fainelli@gmail.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+---
+ drivers/net/dsa/b53/b53_priv.h | 4 ----
+ 1 file changed, 4 deletions(-)
+
+--- a/drivers/net/dsa/b53/b53_priv.h
++++ b/drivers/net/dsa/b53/b53_priv.h
+@@ -185,11 +185,7 @@ static inline int is531x5(struct b53_dev
+ static inline int is63xx(struct b53_device *dev)
+ {
+-#ifdef CONFIG_BCM63XX
+       return dev->chip_id == BCM63XX_DEVICE_ID;
+-#else
+-      return 0;
+-#endif
+ }
+ static inline int is5301x(struct b53_device *dev)
diff --git a/target/linux/generic/backport-5.10/790-v5.13-0004-net-dsa-tag_brcm-add-support-for-legacy-tags.patch b/target/linux/generic/backport-5.10/790-v5.13-0004-net-dsa-tag_brcm-add-support-for-legacy-tags.patch
new file mode 100644 (file)
index 0000000..3b7d8f3
--- /dev/null
@@ -0,0 +1,180 @@
+From 964dbf186eaa84d409c359ddf09c827a3fbe8228 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= <noltari@gmail.com>
+Date: Wed, 17 Mar 2021 11:29:26 +0100
+Subject: [PATCH] net: dsa: tag_brcm: add support for legacy tags
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Add support for legacy Broadcom tags, which are similar to DSA_TAG_PROTO_BRCM.
+These tags are used on BCM5325, BCM5365 and BCM63xx switches.
+
+Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+---
+ include/net/dsa.h  |   2 +
+ net/dsa/Kconfig    |   7 +++
+ net/dsa/tag_brcm.c | 107 +++++++++++++++++++++++++++++++++++++++++++--
+ 3 files changed, 113 insertions(+), 3 deletions(-)
+
+--- a/include/net/dsa.h
++++ b/include/net/dsa.h
+@@ -45,10 +45,12 @@ struct phylink_link_state;
+ #define DSA_TAG_PROTO_OCELOT_VALUE            15
+ #define DSA_TAG_PROTO_AR9331_VALUE            16
+ #define DSA_TAG_PROTO_RTL4_A_VALUE            17
++#define DSA_TAG_PROTO_BRCM_LEGACY_VALUE               22
+ enum dsa_tag_protocol {
+       DSA_TAG_PROTO_NONE              = DSA_TAG_PROTO_NONE_VALUE,
+       DSA_TAG_PROTO_BRCM              = DSA_TAG_PROTO_BRCM_VALUE,
++      DSA_TAG_PROTO_BRCM_LEGACY       = DSA_TAG_PROTO_BRCM_LEGACY_VALUE,
+       DSA_TAG_PROTO_BRCM_PREPEND      = DSA_TAG_PROTO_BRCM_PREPEND_VALUE,
+       DSA_TAG_PROTO_DSA               = DSA_TAG_PROTO_DSA_VALUE,
+       DSA_TAG_PROTO_EDSA              = DSA_TAG_PROTO_EDSA_VALUE,
+--- a/net/dsa/Kconfig
++++ b/net/dsa/Kconfig
+@@ -47,6 +47,13 @@ config NET_DSA_TAG_BRCM
+         Say Y if you want to enable support for tagging frames for the
+         Broadcom switches which place the tag after the MAC source address.
++config NET_DSA_TAG_BRCM_LEGACY
++      tristate "Tag driver for Broadcom legacy switches using in-frame headers"
++      select NET_DSA_TAG_BRCM_COMMON
++      help
++        Say Y if you want to enable support for tagging frames for the
++        Broadcom legacy switches which place the tag after the MAC source
++        address.
+ config NET_DSA_TAG_BRCM_PREPEND
+       tristate "Tag driver for Broadcom switches using prepended headers"
+--- a/net/dsa/tag_brcm.c
++++ b/net/dsa/tag_brcm.c
+@@ -11,9 +11,26 @@
+ #include "dsa_priv.h"
+-/* This tag length is 4 bytes, older ones were 6 bytes, we do not
+- * handle them
+- */
++/* Legacy Broadcom tag (6 bytes) */
++#define BRCM_LEG_TAG_LEN      6
++
++/* Type fields */
++/* 1st byte in the tag */
++#define BRCM_LEG_TYPE_HI      0x88
++/* 2nd byte in the tag */
++#define BRCM_LEG_TYPE_LO      0x74
++
++/* Tag fields */
++/* 3rd byte in the tag */
++#define BRCM_LEG_UNICAST      (0 << 5)
++#define BRCM_LEG_MULTICAST    (1 << 5)
++#define BRCM_LEG_EGRESS               (2 << 5)
++#define BRCM_LEG_INGRESS      (3 << 5)
++
++/* 6th byte in the tag */
++#define BRCM_LEG_PORT_ID      (0xf)
++
++/* Newer Broadcom tag (4 bytes) */
+ #define BRCM_TAG_LEN  4
+ /* Tag is constructed and desconstructed using byte by byte access
+@@ -194,6 +211,87 @@ DSA_TAG_DRIVER(brcm_netdev_ops);
+ MODULE_ALIAS_DSA_TAG_DRIVER(DSA_TAG_PROTO_BRCM);
+ #endif
++#if IS_ENABLED(CONFIG_NET_DSA_TAG_BRCM_LEGACY)
++static struct sk_buff *brcm_leg_tag_xmit(struct sk_buff *skb,
++                                       struct net_device *dev)
++{
++      struct dsa_port *dp = dsa_slave_to_port(dev);
++      u8 *brcm_tag;
++
++      /* The Ethernet switch we are interfaced with needs packets to be at
++       * least 64 bytes (including FCS) otherwise they will be discarded when
++       * they enter the switch port logic. When Broadcom tags are enabled, we
++       * need to make sure that packets are at least 70 bytes
++       * (including FCS and tag) because the length verification is done after
++       * the Broadcom tag is stripped off the ingress packet.
++       *
++       * Let dsa_slave_xmit() free the SKB
++       */
++      if (__skb_put_padto(skb, ETH_ZLEN + BRCM_LEG_TAG_LEN, false))
++              return NULL;
++
++      skb_push(skb, BRCM_LEG_TAG_LEN);
++
++      memmove(skb->data, skb->data + BRCM_LEG_TAG_LEN, 2 * ETH_ALEN);
++
++      brcm_tag = skb->data + 2 * ETH_ALEN;
++
++      /* Broadcom tag type */
++      brcm_tag[0] = BRCM_LEG_TYPE_HI;
++      brcm_tag[1] = BRCM_LEG_TYPE_LO;
++
++      /* Broadcom tag value */
++      brcm_tag[2] = BRCM_LEG_EGRESS;
++      brcm_tag[3] = 0;
++      brcm_tag[4] = 0;
++      brcm_tag[5] = dp->index & BRCM_LEG_PORT_ID;
++
++      return skb;
++}
++
++static struct sk_buff *brcm_leg_tag_rcv(struct sk_buff *skb,
++                                      struct net_device *dev,
++                                      struct packet_type *pt)
++{
++      int source_port;
++      u8 *brcm_tag;
++
++      if (unlikely(!pskb_may_pull(skb, BRCM_LEG_PORT_ID)))
++              return NULL;
++
++      brcm_tag = skb->data - 2;
++
++      source_port = brcm_tag[5] & BRCM_LEG_PORT_ID;
++
++      skb->dev = dsa_master_find_slave(dev, 0, source_port);
++      if (!skb->dev)
++              return NULL;
++
++      /* Remove Broadcom tag and update checksum */
++      skb_pull_rcsum(skb, BRCM_LEG_TAG_LEN);
++
++      skb->offload_fwd_mark = 1;
++
++      /* Move the Ethernet DA and SA */
++      memmove(skb->data - ETH_HLEN,
++              skb->data - ETH_HLEN - BRCM_LEG_TAG_LEN,
++              2 * ETH_ALEN);
++
++      return skb;
++}
++
++static const struct dsa_device_ops brcm_legacy_netdev_ops = {
++      .name = "brcm-legacy",
++      .proto = DSA_TAG_PROTO_BRCM_LEGACY,
++      .xmit = brcm_leg_tag_xmit,
++      .rcv = brcm_leg_tag_rcv,
++      .overhead = BRCM_LEG_TAG_LEN,
++};
++
++DSA_TAG_DRIVER(brcm_legacy_netdev_ops);
++MODULE_ALIAS_DSA_TAG_DRIVER(DSA_TAG_PROTO_BRCM_LEGACY);
++#endif /* CONFIG_NET_DSA_TAG_BRCM_LEGACY */
++
+ #if IS_ENABLED(CONFIG_NET_DSA_TAG_BRCM_PREPEND)
+ static struct sk_buff *brcm_tag_xmit_prepend(struct sk_buff *skb,
+                                            struct net_device *dev)
+@@ -226,6 +324,9 @@ static struct dsa_tag_driver *dsa_tag_dr
+ #if IS_ENABLED(CONFIG_NET_DSA_TAG_BRCM)
+       &DSA_TAG_DRIVER_NAME(brcm_netdev_ops),
+ #endif
++#if IS_ENABLED(CONFIG_NET_DSA_TAG_BRCM_LEGACY)
++      &DSA_TAG_DRIVER_NAME(brcm_legacy_netdev_ops),
++#endif
+ #if IS_ENABLED(CONFIG_NET_DSA_TAG_BRCM_PREPEND)
+       &DSA_TAG_DRIVER_NAME(brcm_prepend_netdev_ops),
+ #endif
diff --git a/target/linux/generic/backport-5.10/790-v5.13-0005-net-dsa-b53-support-legacy-tags.patch b/target/linux/generic/backport-5.10/790-v5.13-0005-net-dsa-b53-support-legacy-tags.patch
new file mode 100644 (file)
index 0000000..838e78a
--- /dev/null
@@ -0,0 +1,53 @@
+From 46c5176c586c81306bf9e7024c13b95da775490f Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= <noltari@gmail.com>
+Date: Wed, 17 Mar 2021 11:29:27 +0100
+Subject: [PATCH] net: dsa: b53: support legacy tags
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+These tags are used on BCM5325, BCM5365 and BCM63xx switches.
+
+Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
+Acked-by: Florian Fainelli <f.fainelli@gmail.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+---
+ drivers/net/dsa/b53/Kconfig      |  1 +
+ drivers/net/dsa/b53/b53_common.c | 12 +++++++-----
+ 2 files changed, 8 insertions(+), 5 deletions(-)
+
+--- a/drivers/net/dsa/b53/Kconfig
++++ b/drivers/net/dsa/b53/Kconfig
+@@ -3,6 +3,7 @@ menuconfig B53
+       tristate "Broadcom BCM53xx managed switch support"
+       depends on NET_DSA
+       select NET_DSA_TAG_BRCM
++      select NET_DSA_TAG_BRCM_LEGACY
+       select NET_DSA_TAG_BRCM_PREPEND
+       help
+         This driver adds support for Broadcom managed switch chips. It supports
+--- a/drivers/net/dsa/b53/b53_common.c
++++ b/drivers/net/dsa/b53/b53_common.c
+@@ -2024,15 +2024,17 @@ enum dsa_tag_protocol b53_get_tag_protoc
+ {
+       struct b53_device *dev = ds->priv;
+-      /* Older models (5325, 5365) support a different tag format that we do
+-       * not support in net/dsa/tag_brcm.c yet.
+-       */
+-      if (is5325(dev) || is5365(dev) ||
+-          !b53_can_enable_brcm_tags(ds, port, mprot)) {
++      if (!b53_can_enable_brcm_tags(ds, port, mprot)) {
+               dev->tag_protocol = DSA_TAG_PROTO_NONE;
+               goto out;
+       }
++      /* Older models require a different 6 byte tag */
++      if (is5325(dev) || is5365(dev) || is63xx(dev)) {
++              dev->tag_protocol = DSA_TAG_PROTO_BRCM_LEGACY;
++              goto out;
++      }
++
+       /* Broadcom BCM58xx chips have a flow accelerator on Port 8
+        * which requires us to use the prepended Broadcom tag type
+        */
diff --git a/target/linux/generic/backport-5.10/790-v5.13-0006-net-dsa-b53-mmap-Add-device-tree-support.patch b/target/linux/generic/backport-5.10/790-v5.13-0006-net-dsa-b53-mmap-Add-device-tree-support.patch
new file mode 100644 (file)
index 0000000..c1014b2
--- /dev/null
@@ -0,0 +1,92 @@
+From a5538a777b73b35750ed1ffff8c1ef539e861624 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= <noltari@gmail.com>
+Date: Wed, 17 Mar 2021 10:23:17 +0100
+Subject: [PATCH] net: dsa: b53: mmap: Add device tree support
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Add device tree support to b53_mmap.c while keeping platform devices support.
+
+Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+---
+ drivers/net/dsa/b53/b53_mmap.c | 55 ++++++++++++++++++++++++++++++++++
+ 1 file changed, 55 insertions(+)
+
+--- a/drivers/net/dsa/b53/b53_mmap.c
++++ b/drivers/net/dsa/b53/b53_mmap.c
+@@ -16,6 +16,7 @@
+  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+  */
++#include <linux/bits.h>
+ #include <linux/kernel.h>
+ #include <linux/module.h>
+ #include <linux/io.h>
+@@ -228,11 +229,65 @@ static const struct b53_io_ops b53_mmap_
+       .write64 = b53_mmap_write64,
+ };
++static int b53_mmap_probe_of(struct platform_device *pdev,
++                           struct b53_platform_data **ppdata)
++{
++      struct device_node *np = pdev->dev.of_node;
++      struct device_node *of_ports, *of_port;
++      struct device *dev = &pdev->dev;
++      struct b53_platform_data *pdata;
++      void __iomem *mem;
++
++      mem = devm_platform_ioremap_resource(pdev, 0);
++      if (IS_ERR(mem))
++              return PTR_ERR(mem);
++
++      pdata = devm_kzalloc(dev, sizeof(struct b53_platform_data),
++                           GFP_KERNEL);
++      if (!pdata)
++              return -ENOMEM;
++
++      pdata->regs = mem;
++      pdata->chip_id = BCM63XX_DEVICE_ID;
++      pdata->big_endian = of_property_read_bool(np, "big-endian");
++
++      of_ports = of_get_child_by_name(np, "ports");
++      if (!of_ports) {
++              dev_err(dev, "no ports child node found\n");
++              return -EINVAL;
++      }
++
++      for_each_available_child_of_node(of_ports, of_port) {
++              u32 reg;
++
++              if (of_property_read_u32(of_port, "reg", &reg))
++                      continue;
++
++              if (reg < B53_CPU_PORT)
++                      pdata->enabled_ports |= BIT(reg);
++      }
++
++      of_node_put(of_ports);
++      *ppdata = pdata;
++
++      return 0;
++}
++
+ static int b53_mmap_probe(struct platform_device *pdev)
+ {
++      struct device_node *np = pdev->dev.of_node;
+       struct b53_platform_data *pdata = pdev->dev.platform_data;
+       struct b53_mmap_priv *priv;
+       struct b53_device *dev;
++      int ret;
++
++      if (!pdata && np) {
++              ret = b53_mmap_probe_of(pdev, &pdata);
++              if (ret) {
++                      dev_err(&pdev->dev, "OF probe error\n");
++                      return ret;
++              }
++      }
+       if (!pdata)
+               return -EINVAL;
diff --git a/target/linux/generic/backport-5.10/790-v5.13-0007-net-dsa-b53-spi-add-missing-MODULE_DEVICE_TABLE.patch b/target/linux/generic/backport-5.10/790-v5.13-0007-net-dsa-b53-spi-add-missing-MODULE_DEVICE_TABLE.patch
new file mode 100644 (file)
index 0000000..ea36755
--- /dev/null
@@ -0,0 +1,27 @@
+From 866f1577ba69bde2b9f36c300f603596c7d84a62 Mon Sep 17 00:00:00 2001
+From: Qinglang Miao <miaoqinglang@huawei.com>
+Date: Thu, 25 Mar 2021 17:19:54 +0800
+Subject: [PATCH] net: dsa: b53: spi: add missing MODULE_DEVICE_TABLE
+
+This patch adds missing MODULE_DEVICE_TABLE definition which generates
+correct modalias for automatic loading of this driver when it is built
+as an external module.
+
+Reported-by: Hulk Robot <hulkci@huawei.com>
+Signed-off-by: Qinglang Miao <miaoqinglang@huawei.com>
+Acked-by: Florian Fainelli <f.fainelli@gmail.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+---
+ drivers/net/dsa/b53/b53_spi.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/drivers/net/dsa/b53/b53_spi.c
++++ b/drivers/net/dsa/b53/b53_spi.c
+@@ -335,6 +335,7 @@ static const struct of_device_id b53_spi
+       { .compatible = "brcm,bcm53128" },
+       { /* sentinel */ }
+ };
++MODULE_DEVICE_TABLE(of, b53_spi_of_match);
+ static struct spi_driver b53_spi_driver = {
+       .driver = {
diff --git a/target/linux/generic/backport-5.10/790-v5.15-0001-net-dsa-b53-Fix-calculating-number-of-switch-ports.patch b/target/linux/generic/backport-5.10/790-v5.15-0001-net-dsa-b53-Fix-calculating-number-of-switch-ports.patch
deleted file mode 100644 (file)
index f1bef25..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-From cdb067d31c0fe4cce98b9d15f1f2ef525acaa094 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
-Date: Thu, 2 Sep 2021 10:30:50 +0200
-Subject: [PATCH] net: dsa: b53: Fix calculating number of switch ports
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-It isn't true that CPU port is always the last one. Switches BCM5301x
-have 9 ports (port 6 being inactive) and they use port 5 as CPU by
-default (depending on design some other may be CPU ports too).
-
-A more reliable way of determining number of ports is to check for the
-last set bit in the "enabled_ports" bitfield.
-
-This fixes b53 internal state, it will allow providing accurate info to
-the DSA and is required to fix BCM5301x support.
-
-Fixes: 967dd82ffc52 ("net: dsa: b53: Add support for Broadcom RoboSwitch")
-Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
-Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
-Signed-off-by: David S. Miller <davem@davemloft.net>
----
- drivers/net/dsa/b53/b53_common.c | 3 +--
- 1 file changed, 1 insertion(+), 2 deletions(-)
-
---- a/drivers/net/dsa/b53/b53_common.c
-+++ b/drivers/net/dsa/b53/b53_common.c
-@@ -2556,9 +2556,8 @@ static int b53_switch_init(struct b53_de
-                       dev->cpu_port = 5;
-       }
--      /* cpu port is always last */
--      dev->num_ports = dev->cpu_port + 1;
-       dev->enabled_ports |= BIT(dev->cpu_port);
-+      dev->num_ports = fls(dev->enabled_ports);
-       /* Include non standard CPU port built-in PHYs to be probed */
-       if (is539x(dev) || is531x5(dev)) {
diff --git a/target/linux/generic/backport-5.10/790-v5.15-0002-net-dsa-b53-Set-correct-number-of-ports-in-the-DSA-s.patch b/target/linux/generic/backport-5.10/790-v5.15-0002-net-dsa-b53-Set-correct-number-of-ports-in-the-DSA-s.patch
deleted file mode 100644 (file)
index 404389d..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-From d12e1c4649883e8ca5e8ff341e1948b3b6313259 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
-Date: Thu, 2 Sep 2021 10:30:51 +0200
-Subject: [PATCH] net: dsa: b53: Set correct number of ports in the DSA struct
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-Setting DSA_MAX_PORTS caused DSA to call b53 callbacks (e.g.
-b53_disable_port() during dsa_register_switch()) for invalid
-(non-existent) ports. That made b53 modify unrelated registers and is
-one of reasons for a broken BCM5301x support.
-
-This problem exists for years but DSA_MAX_PORTS usage has changed few
-times. It seems the most accurate to reference commit dropping
-dsa_switch_alloc() in the Fixes tag.
-
-Fixes: 7e99e3470172 ("net: dsa: remove dsa_switch_alloc helper")
-Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
-Signed-off-by: David S. Miller <davem@davemloft.net>
----
- drivers/net/dsa/b53/b53_common.c | 3 ++-
- 1 file changed, 2 insertions(+), 1 deletion(-)
-
---- a/drivers/net/dsa/b53/b53_common.c
-+++ b/drivers/net/dsa/b53/b53_common.c
-@@ -2559,6 +2559,8 @@ static int b53_switch_init(struct b53_de
-       dev->enabled_ports |= BIT(dev->cpu_port);
-       dev->num_ports = fls(dev->enabled_ports);
-+      dev->ds->num_ports = min_t(unsigned int, dev->num_ports, DSA_MAX_PORTS);
-+
-       /* Include non standard CPU port built-in PHYs to be probed */
-       if (is539x(dev) || is531x5(dev)) {
-               for (i = 0; i < dev->num_ports; i++) {
-@@ -2603,7 +2605,6 @@ struct b53_device *b53_switch_alloc(stru
-               return NULL;
-       ds->dev = base;
--      ds->num_ports = DSA_MAX_PORTS;
-       dev = devm_kzalloc(base, sizeof(*dev), GFP_KERNEL);
-       if (!dev)
diff --git a/target/linux/generic/backport-5.10/791-v5.14-0001-net-dsa-b53-Do-not-force-CPU-to-be-always-tagged.patch b/target/linux/generic/backport-5.10/791-v5.14-0001-net-dsa-b53-Do-not-force-CPU-to-be-always-tagged.patch
new file mode 100644 (file)
index 0000000..420e3ae
--- /dev/null
@@ -0,0 +1,86 @@
+From 2c32a3d3c233b855943677609fe388f82b1f0975 Mon Sep 17 00:00:00 2001
+From: Florian Fainelli <f.fainelli@gmail.com>
+Date: Tue, 8 Jun 2021 14:22:04 -0700
+Subject: [PATCH] net: dsa: b53: Do not force CPU to be always tagged
+
+Commit ca8931948344 ("net: dsa: b53: Keep CPU port as tagged in all
+VLANs") forced the CPU port to be always tagged in any VLAN membership.
+This was necessary back then because we did not support Broadcom tags
+for all configurations so the only way to differentiate tagged and
+untagged traffic while DSA_TAG_PROTO_NONE was used was to force the CPU
+port into being always tagged.
+
+With most configurations enabling Broadcom tags, especially after
+8fab459e69ab ("net: dsa: b53: Enable Broadcom tags for 531x5/539x
+families") we do not need to apply this unconditional force tagging of
+the CPU port in all VLANs.
+
+A helper function is introduced to faciliate the encapsulation of the
+specific condition requiring the CPU port to be tagged in all VLANs and
+the dsa_switch_ops::untag_bridge_pvid boolean is moved to when
+dsa_switch_ops::setup is called when we have already determined the
+tagging protocol we will be using.
+
+Reported-by: Matthew Hagan <mnhagan88@gmail.com>
+Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
+Reviewed-by: Vladimir Oltean <olteanv@gmail.com>
+Tested-by: Matthew Hagan <mnhagan88@gmail.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+---
+ drivers/net/dsa/b53/b53_common.c | 17 ++++++++++++++---
+ 1 file changed, 14 insertions(+), 3 deletions(-)
+
+--- a/drivers/net/dsa/b53/b53_common.c
++++ b/drivers/net/dsa/b53/b53_common.c
+@@ -1049,6 +1049,11 @@ static int b53_setup(struct dsa_switch *
+       unsigned int port;
+       int ret;
++      /* Request bridge PVID untagged when DSA_TAG_PROTO_NONE is set
++       * which forces the CPU port to be tagged in all VLANs.
++       */
++      ds->untag_bridge_pvid = dev->tag_protocol == DSA_TAG_PROTO_NONE;
++
+       ret = b53_reset_switch(dev);
+       if (ret) {
+               dev_err(ds->dev, "failed to reset switch\n");
+@@ -1423,6 +1428,13 @@ int b53_vlan_prepare(struct dsa_switch *
+       return 0;
+ }
+ EXPORT_SYMBOL(b53_vlan_prepare);
++ 
++static bool b53_vlan_port_needs_forced_tagged(struct dsa_switch *ds, int port)
++{
++      struct b53_device *dev = ds->priv;
++
++      return dev->tag_protocol == DSA_TAG_PROTO_NONE && dsa_is_cpu_port(ds, port);
++}
+ void b53_vlan_add(struct dsa_switch *ds, int port,
+                 const struct switchdev_obj_port_vlan *vlan)
+@@ -1442,7 +1454,7 @@ void b53_vlan_add(struct dsa_switch *ds,
+                       untagged = true;
+               vl->members |= BIT(port);
+-              if (untagged && !dsa_is_cpu_port(ds, port))
++              if (untagged && !b53_vlan_port_needs_forced_tagged(ds, port))
+                       vl->untag |= BIT(port);
+               else
+                       vl->untag &= ~BIT(port);
+@@ -1480,7 +1492,7 @@ int b53_vlan_del(struct dsa_switch *ds,
+               if (pvid == vid)
+                       pvid = b53_default_pvid(dev);
+-              if (untagged && !dsa_is_cpu_port(ds, port))
++              if (untagged && !b53_vlan_port_needs_forced_tagged(ds, port))
+                       vl->untag &= ~(BIT(port));
+               b53_set_vlan_entry(dev, vid, vl);
+@@ -2623,7 +2635,6 @@ struct b53_device *b53_switch_alloc(stru
+       dev->ops = ops;
+       ds->ops = &b53_switch_ops;
+       ds->configure_vlan_while_not_filtering = true;
+-      ds->untag_bridge_pvid = true;
+       dev->vlan_enabled = ds->configure_vlan_while_not_filtering;
+       /* Let DSA handle the case were multiple bridges span the same switch
+        * device and different VLAN awareness settings are requested, which
diff --git a/target/linux/generic/backport-5.10/791-v5.14-0002-net-dsa-b53-remove-redundant-null-check-on-dev.patch b/target/linux/generic/backport-5.10/791-v5.14-0002-net-dsa-b53-remove-redundant-null-check-on-dev.patch
new file mode 100644 (file)
index 0000000..ee3a71f
--- /dev/null
@@ -0,0 +1,30 @@
+From 11b57faf951cd3a570e3d9e463fc7c41023bc8c6 Mon Sep 17 00:00:00 2001
+From: Colin Ian King <colin.king@canonical.com>
+Date: Tue, 15 Jun 2021 10:05:16 +0100
+Subject: [PATCH] net: dsa: b53: remove redundant null check on dev
+
+The pointer dev can never be null, the null check is redundant
+and can be removed. Cleans up a static analysis warning that
+pointer priv is dereferencing dev before dev is being null
+checked.
+
+Addresses-Coverity: ("Dereference before null check")
+Signed-off-by: Colin Ian King <colin.king@canonical.com>
+Acked-by: Florian Fainelli <f.fainelli@gmail.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+---
+ drivers/net/dsa/b53/b53_srab.c | 3 +--
+ 1 file changed, 1 insertion(+), 2 deletions(-)
+
+--- a/drivers/net/dsa/b53/b53_srab.c
++++ b/drivers/net/dsa/b53/b53_srab.c
+@@ -632,8 +632,7 @@ static int b53_srab_remove(struct platfo
+       struct b53_srab_priv *priv = dev->priv;
+       b53_srab_intr_set(priv, false);
+-      if (dev)
+-              b53_switch_remove(dev);
++      b53_switch_remove(dev);
+       return 0;
+ }
diff --git a/target/linux/generic/backport-5.10/791-v5.14-0003-net-dsa-b53-Create-default-VLAN-entry-explicitly.patch b/target/linux/generic/backport-5.10/791-v5.14-0003-net-dsa-b53-Create-default-VLAN-entry-explicitly.patch
new file mode 100644 (file)
index 0000000..df891d6
--- /dev/null
@@ -0,0 +1,71 @@
+From 64a81b24487f0d2fba0f033029eec2abc7d82cee Mon Sep 17 00:00:00 2001
+From: Florian Fainelli <f.fainelli@gmail.com>
+Date: Mon, 21 Jun 2021 15:10:55 -0700
+Subject: [PATCH] net: dsa: b53: Create default VLAN entry explicitly
+
+In case CONFIG_VLAN_8021Q is not set, there will be no call down to the
+b53 driver to ensure that the default PVID VLAN entry will be configured
+with the appropriate untagged attribute towards the CPU port. We were
+implicitly relying on dsa_slave_vlan_rx_add_vid() to do that for us,
+instead make it explicit.
+
+Reported-by: Vladimir Oltean <olteanv@gmail.com>
+Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
+Reviewed-by: Vladimir Oltean <olteanv@gmail.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+---
+ drivers/net/dsa/b53/b53_common.c | 27 +++++++++++++++++++--------
+ 1 file changed, 19 insertions(+), 8 deletions(-)
+
+--- a/drivers/net/dsa/b53/b53_common.c
++++ b/drivers/net/dsa/b53/b53_common.c
+@@ -693,6 +693,13 @@ static u16 b53_default_pvid(struct b53_d
+               return 0;
+ }
++static bool b53_vlan_port_needs_forced_tagged(struct dsa_switch *ds, int port)
++{
++      struct b53_device *dev = ds->priv;
++
++      return dev->tag_protocol == DSA_TAG_PROTO_NONE && dsa_is_cpu_port(ds, port);
++}
++
+ int b53_configure_vlan(struct dsa_switch *ds)
+ {
+       struct b53_device *dev = ds->priv;
+@@ -713,9 +720,20 @@ int b53_configure_vlan(struct dsa_switch
+       b53_enable_vlan(dev, -1, dev->vlan_enabled, ds->vlan_filtering);
+-      b53_for_each_port(dev, i)
++      /* Create an untagged VLAN entry for the default PVID in case
++       * CONFIG_VLAN_8021Q is disabled and there are no calls to
++       * dsa_slave_vlan_rx_add_vid() to create the default VLAN
++       * entry. Do this only when the tagging protocol is not
++       * DSA_TAG_PROTO_NONE
++       */
++      b53_for_each_port(dev, i) {
++              v = &dev->vlans[def_vid];
++              v->members |= BIT(i);
++              if (!b53_vlan_port_needs_forced_tagged(ds, i))
++                      v->untag = v->members;
+               b53_write16(dev, B53_VLAN_PAGE,
+                           B53_VLAN_PORT_DEF_TAG(i), def_vid);
++      }
+       /* Upon initial call we have not set-up any VLANs, but upon
+        * system resume, we need to restore all VLAN entries.
+@@ -1429,13 +1447,6 @@ int b53_vlan_prepare(struct dsa_switch *
+ }
+ EXPORT_SYMBOL(b53_vlan_prepare);
+  
+-static bool b53_vlan_port_needs_forced_tagged(struct dsa_switch *ds, int port)
+-{
+-      struct b53_device *dev = ds->priv;
+-
+-      return dev->tag_protocol == DSA_TAG_PROTO_NONE && dsa_is_cpu_port(ds, port);
+-}
+-
+ void b53_vlan_add(struct dsa_switch *ds, int port,
+                 const struct switchdev_obj_port_vlan *vlan)
+ {
diff --git a/target/linux/generic/backport-5.10/792-v5.15-0001-net-dsa-b53-Fix-calculating-number-of-switch-ports.patch b/target/linux/generic/backport-5.10/792-v5.15-0001-net-dsa-b53-Fix-calculating-number-of-switch-ports.patch
new file mode 100644 (file)
index 0000000..4a7cbd9
--- /dev/null
@@ -0,0 +1,39 @@
+From cdb067d31c0fe4cce98b9d15f1f2ef525acaa094 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
+Date: Thu, 2 Sep 2021 10:30:50 +0200
+Subject: [PATCH] net: dsa: b53: Fix calculating number of switch ports
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+It isn't true that CPU port is always the last one. Switches BCM5301x
+have 9 ports (port 6 being inactive) and they use port 5 as CPU by
+default (depending on design some other may be CPU ports too).
+
+A more reliable way of determining number of ports is to check for the
+last set bit in the "enabled_ports" bitfield.
+
+This fixes b53 internal state, it will allow providing accurate info to
+the DSA and is required to fix BCM5301x support.
+
+Fixes: 967dd82ffc52 ("net: dsa: b53: Add support for Broadcom RoboSwitch")
+Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
+Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+---
+ drivers/net/dsa/b53/b53_common.c | 3 +--
+ 1 file changed, 1 insertion(+), 2 deletions(-)
+
+--- a/drivers/net/dsa/b53/b53_common.c
++++ b/drivers/net/dsa/b53/b53_common.c
+@@ -2584,9 +2584,8 @@ static int b53_switch_init(struct b53_de
+                       dev->cpu_port = 5;
+       }
+-      /* cpu port is always last */
+-      dev->num_ports = dev->cpu_port + 1;
+       dev->enabled_ports |= BIT(dev->cpu_port);
++      dev->num_ports = fls(dev->enabled_ports);
+       /* Include non standard CPU port built-in PHYs to be probed */
+       if (is539x(dev) || is531x5(dev)) {
diff --git a/target/linux/generic/backport-5.10/792-v5.15-0002-net-dsa-b53-Set-correct-number-of-ports-in-the-DSA-s.patch b/target/linux/generic/backport-5.10/792-v5.15-0002-net-dsa-b53-Set-correct-number-of-ports-in-the-DSA-s.patch
new file mode 100644 (file)
index 0000000..361b298
--- /dev/null
@@ -0,0 +1,43 @@
+From d12e1c4649883e8ca5e8ff341e1948b3b6313259 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
+Date: Thu, 2 Sep 2021 10:30:51 +0200
+Subject: [PATCH] net: dsa: b53: Set correct number of ports in the DSA struct
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Setting DSA_MAX_PORTS caused DSA to call b53 callbacks (e.g.
+b53_disable_port() during dsa_register_switch()) for invalid
+(non-existent) ports. That made b53 modify unrelated registers and is
+one of reasons for a broken BCM5301x support.
+
+This problem exists for years but DSA_MAX_PORTS usage has changed few
+times. It seems the most accurate to reference commit dropping
+dsa_switch_alloc() in the Fixes tag.
+
+Fixes: 7e99e3470172 ("net: dsa: remove dsa_switch_alloc helper")
+Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+---
+ drivers/net/dsa/b53/b53_common.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+--- a/drivers/net/dsa/b53/b53_common.c
++++ b/drivers/net/dsa/b53/b53_common.c
+@@ -2587,6 +2587,8 @@ static int b53_switch_init(struct b53_de
+       dev->enabled_ports |= BIT(dev->cpu_port);
+       dev->num_ports = fls(dev->enabled_ports);
++      dev->ds->num_ports = min_t(unsigned int, dev->num_ports, DSA_MAX_PORTS);
++
+       /* Include non standard CPU port built-in PHYs to be probed */
+       if (is539x(dev) || is531x5(dev)) {
+               for (i = 0; i < dev->num_ports; i++) {
+@@ -2631,7 +2633,6 @@ struct b53_device *b53_switch_alloc(stru
+               return NULL;
+       ds->dev = base;
+-      ds->num_ports = DSA_MAX_PORTS;
+       dev = devm_kzalloc(base, sizeof(*dev), GFP_KERNEL);
+       if (!dev)
diff --git a/target/linux/generic/backport-5.10/792-v5.15-0003-net-dsa-b53-Fix-IMP-port-setup-on-BCM5301x.patch b/target/linux/generic/backport-5.10/792-v5.15-0003-net-dsa-b53-Fix-IMP-port-setup-on-BCM5301x.patch
new file mode 100644 (file)
index 0000000..380a677
--- /dev/null
@@ -0,0 +1,237 @@
+From 63f8428b4077de3664eb0b252393c839b0b293ec Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
+Date: Sun, 5 Sep 2021 19:23:28 +0200
+Subject: [PATCH] net: dsa: b53: Fix IMP port setup on BCM5301x
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Broadcom's b53 switches have one IMP (Inband Management Port) that needs
+to be programmed using its own designed register. IMP port may be
+different than CPU port - especially on devices with multiple CPU ports.
+
+For that reason it's required to explicitly note IMP port index and
+check for it when choosing a register to use.
+
+This commit fixes BCM5301x support. Those switches use CPU port 5 while
+their IMP port is 8. Before this patch b53 was trying to program port 5
+with B53_PORT_OVERRIDE_CTRL instead of B53_GMII_PORT_OVERRIDE_CTRL(5).
+
+It may be possible to also replace "cpu_port" usages with
+dsa_is_cpu_port() but that is out of the scope of thix BCM5301x fix.
+
+Fixes: 967dd82ffc52 ("net: dsa: b53: Add support for Broadcom RoboSwitch")
+Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+---
+ drivers/net/dsa/b53/b53_common.c | 28 +++++++++++++++++++++++++---
+ drivers/net/dsa/b53/b53_priv.h   |  1 +
+ 2 files changed, 26 insertions(+), 3 deletions(-)
+
+--- a/drivers/net/dsa/b53/b53_common.c
++++ b/drivers/net/dsa/b53/b53_common.c
+@@ -1109,7 +1109,7 @@ static void b53_force_link(struct b53_de
+       u8 reg, val, off;
+       /* Override the port settings */
+-      if (port == dev->cpu_port) {
++      if (port == dev->imp_port) {
+               off = B53_PORT_OVERRIDE_CTRL;
+               val = PORT_OVERRIDE_EN;
+       } else {
+@@ -1133,7 +1133,7 @@ static void b53_force_port_config(struct
+       u8 reg, val, off;
+       /* Override the port settings */
+-      if (port == dev->cpu_port) {
++      if (port == dev->imp_port) {
+               off = B53_PORT_OVERRIDE_CTRL;
+               val = PORT_OVERRIDE_EN;
+       } else {
+@@ -1201,7 +1201,7 @@ static void b53_adjust_link(struct dsa_s
+       b53_force_link(dev, port, phydev->link);
+       if (is531x5(dev) && phy_interface_is_rgmii(phydev)) {
+-              if (port == 8)
++              if (port == dev->imp_port)
+                       off = B53_RGMII_CTRL_IMP;
+               else
+                       off = B53_RGMII_CTRL_P(port);
+@@ -2266,6 +2266,7 @@ struct b53_chip_data {
+       const char *dev_name;
+       u16 vlans;
+       u16 enabled_ports;
++      u8 imp_port;
+       u8 cpu_port;
+       u8 vta_regs[3];
+       u8 arl_bins;
+@@ -2290,6 +2291,7 @@ static const struct b53_chip_data b53_sw
+               .enabled_ports = 0x1f,
+               .arl_bins = 2,
+               .arl_buckets = 1024,
++              .imp_port = 5,
+               .cpu_port = B53_CPU_PORT_25,
+               .duplex_reg = B53_DUPLEX_STAT_FE,
+       },
+@@ -2300,6 +2302,7 @@ static const struct b53_chip_data b53_sw
+               .enabled_ports = 0x1f,
+               .arl_bins = 2,
+               .arl_buckets = 1024,
++              .imp_port = 5,
+               .cpu_port = B53_CPU_PORT_25,
+               .duplex_reg = B53_DUPLEX_STAT_FE,
+       },
+@@ -2310,6 +2313,7 @@ static const struct b53_chip_data b53_sw
+               .enabled_ports = 0x1f,
+               .arl_bins = 4,
+               .arl_buckets = 1024,
++              .imp_port = 8,
+               .cpu_port = B53_CPU_PORT,
+               .vta_regs = B53_VTA_REGS,
+               .duplex_reg = B53_DUPLEX_STAT_GE,
+@@ -2323,6 +2327,7 @@ static const struct b53_chip_data b53_sw
+               .enabled_ports = 0x1f,
+               .arl_bins = 4,
+               .arl_buckets = 1024,
++              .imp_port = 8,
+               .cpu_port = B53_CPU_PORT,
+               .vta_regs = B53_VTA_REGS,
+               .duplex_reg = B53_DUPLEX_STAT_GE,
+@@ -2336,6 +2341,7 @@ static const struct b53_chip_data b53_sw
+               .enabled_ports = 0x1f,
+               .arl_bins = 4,
+               .arl_buckets = 1024,
++              .imp_port = 8,
+               .cpu_port = B53_CPU_PORT,
+               .vta_regs = B53_VTA_REGS_9798,
+               .duplex_reg = B53_DUPLEX_STAT_GE,
+@@ -2349,6 +2355,7 @@ static const struct b53_chip_data b53_sw
+               .enabled_ports = 0x7f,
+               .arl_bins = 4,
+               .arl_buckets = 1024,
++              .imp_port = 8,
+               .cpu_port = B53_CPU_PORT,
+               .vta_regs = B53_VTA_REGS_9798,
+               .duplex_reg = B53_DUPLEX_STAT_GE,
+@@ -2363,6 +2370,7 @@ static const struct b53_chip_data b53_sw
+               .arl_bins = 4,
+               .arl_buckets = 1024,
+               .vta_regs = B53_VTA_REGS,
++              .imp_port = 8,
+               .cpu_port = B53_CPU_PORT,
+               .duplex_reg = B53_DUPLEX_STAT_GE,
+               .jumbo_pm_reg = B53_JUMBO_PORT_MASK,
+@@ -2375,6 +2383,7 @@ static const struct b53_chip_data b53_sw
+               .enabled_ports = 0xff,
+               .arl_bins = 4,
+               .arl_buckets = 1024,
++              .imp_port = 8,
+               .cpu_port = B53_CPU_PORT,
+               .vta_regs = B53_VTA_REGS,
+               .duplex_reg = B53_DUPLEX_STAT_GE,
+@@ -2388,6 +2397,7 @@ static const struct b53_chip_data b53_sw
+               .enabled_ports = 0x1ff,
+               .arl_bins = 4,
+               .arl_buckets = 1024,
++              .imp_port = 8,
+               .cpu_port = B53_CPU_PORT,
+               .vta_regs = B53_VTA_REGS,
+               .duplex_reg = B53_DUPLEX_STAT_GE,
+@@ -2401,6 +2411,7 @@ static const struct b53_chip_data b53_sw
+               .enabled_ports = 0, /* pdata must provide them */
+               .arl_bins = 4,
+               .arl_buckets = 1024,
++              .imp_port = 8,
+               .cpu_port = B53_CPU_PORT,
+               .vta_regs = B53_VTA_REGS_63XX,
+               .duplex_reg = B53_DUPLEX_STAT_63XX,
+@@ -2414,6 +2425,7 @@ static const struct b53_chip_data b53_sw
+               .enabled_ports = 0x1f,
+               .arl_bins = 4,
+               .arl_buckets = 1024,
++              .imp_port = 8,
+               .cpu_port = B53_CPU_PORT_25, /* TODO: auto detect */
+               .vta_regs = B53_VTA_REGS,
+               .duplex_reg = B53_DUPLEX_STAT_GE,
+@@ -2427,6 +2439,7 @@ static const struct b53_chip_data b53_sw
+               .enabled_ports = 0x1bf,
+               .arl_bins = 4,
+               .arl_buckets = 1024,
++              .imp_port = 8,
+               .cpu_port = B53_CPU_PORT_25, /* TODO: auto detect */
+               .vta_regs = B53_VTA_REGS,
+               .duplex_reg = B53_DUPLEX_STAT_GE,
+@@ -2440,6 +2453,7 @@ static const struct b53_chip_data b53_sw
+               .enabled_ports = 0x1bf,
+               .arl_bins = 4,
+               .arl_buckets = 1024,
++              .imp_port = 8,
+               .cpu_port = B53_CPU_PORT_25, /* TODO: auto detect */
+               .vta_regs = B53_VTA_REGS,
+               .duplex_reg = B53_DUPLEX_STAT_GE,
+@@ -2453,6 +2467,7 @@ static const struct b53_chip_data b53_sw
+               .enabled_ports = 0x1f,
+               .arl_bins = 4,
+               .arl_buckets = 1024,
++              .imp_port = 8,
+               .cpu_port = B53_CPU_PORT_25, /* TODO: auto detect */
+               .vta_regs = B53_VTA_REGS,
+               .duplex_reg = B53_DUPLEX_STAT_GE,
+@@ -2466,6 +2481,7 @@ static const struct b53_chip_data b53_sw
+               .enabled_ports = 0x1f,
+               .arl_bins = 4,
+               .arl_buckets = 1024,
++              .imp_port = 8,
+               .cpu_port = B53_CPU_PORT_25, /* TODO: auto detect */
+               .vta_regs = B53_VTA_REGS,
+               .duplex_reg = B53_DUPLEX_STAT_GE,
+@@ -2479,6 +2495,7 @@ static const struct b53_chip_data b53_sw
+               .enabled_ports = 0x1ff,
+               .arl_bins = 4,
+               .arl_buckets = 1024,
++              .imp_port = 8,
+               .cpu_port = B53_CPU_PORT,
+               .vta_regs = B53_VTA_REGS,
+               .duplex_reg = B53_DUPLEX_STAT_GE,
+@@ -2492,6 +2509,7 @@ static const struct b53_chip_data b53_sw
+               .enabled_ports = 0x103,
+               .arl_bins = 4,
+               .arl_buckets = 1024,
++              .imp_port = 8,
+               .cpu_port = B53_CPU_PORT,
+               .vta_regs = B53_VTA_REGS,
+               .duplex_reg = B53_DUPLEX_STAT_GE,
+@@ -2505,6 +2523,7 @@ static const struct b53_chip_data b53_sw
+               .enabled_ports = 0x1ff,
+               .arl_bins = 4,
+               .arl_buckets = 1024,
++              .imp_port = 8,
+               .cpu_port = B53_CPU_PORT,
+               .vta_regs = B53_VTA_REGS,
+               .duplex_reg = B53_DUPLEX_STAT_GE,
+@@ -2518,6 +2537,7 @@ static const struct b53_chip_data b53_sw
+               .enabled_ports = 0x1ff,
+               .arl_bins = 4,
+               .arl_buckets = 256,
++              .imp_port = 8,
+               .cpu_port = B53_CPU_PORT,
+               .vta_regs = B53_VTA_REGS,
+               .duplex_reg = B53_DUPLEX_STAT_GE,
+@@ -2543,6 +2563,7 @@ static int b53_switch_init(struct b53_de
+                       dev->vta_regs[1] = chip->vta_regs[1];
+                       dev->vta_regs[2] = chip->vta_regs[2];
+                       dev->jumbo_pm_reg = chip->jumbo_pm_reg;
++                      dev->imp_port = chip->imp_port;
+                       dev->cpu_port = chip->cpu_port;
+                       dev->num_vlans = chip->vlans;
+                       dev->num_arl_bins = chip->arl_bins;
+--- a/drivers/net/dsa/b53/b53_priv.h
++++ b/drivers/net/dsa/b53/b53_priv.h
+@@ -122,6 +122,7 @@ struct b53_device {
+       /* used ports mask */
+       u16 enabled_ports;
++      unsigned int imp_port;
+       unsigned int cpu_port;
+       /* connect specific data */
diff --git a/target/linux/generic/backport-5.10/793-v5.16-0001-net-dsa-b53-Include-all-ports-in-enabled_ports.patch b/target/linux/generic/backport-5.10/793-v5.16-0001-net-dsa-b53-Include-all-ports-in-enabled_ports.patch
new file mode 100644 (file)
index 0000000..d80b5db
--- /dev/null
@@ -0,0 +1,131 @@
+From 983d96a9116a328668601555d96736261d33170c Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
+Date: Thu, 16 Sep 2021 14:03:51 +0200
+Subject: [PATCH] net: dsa: b53: Include all ports in "enabled_ports"
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Make "enabled_ports" bitfield contain all available switch ports
+including a CPU port. This way there is no need for fixup during
+initialization.
+
+For BCM53010, BCM53018 and BCM53019 include also other available ports.
+
+Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
+Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
+Tested-by: Florian Fainelli <f.fainelli@gmail.com>
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+---
+ drivers/net/dsa/b53/b53_common.c | 23 +++++++++++------------
+ 1 file changed, 11 insertions(+), 12 deletions(-)
+
+--- a/drivers/net/dsa/b53/b53_common.c
++++ b/drivers/net/dsa/b53/b53_common.c
+@@ -2288,7 +2288,7 @@ static const struct b53_chip_data b53_sw
+               .chip_id = BCM5325_DEVICE_ID,
+               .dev_name = "BCM5325",
+               .vlans = 16,
+-              .enabled_ports = 0x1f,
++              .enabled_ports = 0x3f,
+               .arl_bins = 2,
+               .arl_buckets = 1024,
+               .imp_port = 5,
+@@ -2299,7 +2299,7 @@ static const struct b53_chip_data b53_sw
+               .chip_id = BCM5365_DEVICE_ID,
+               .dev_name = "BCM5365",
+               .vlans = 256,
+-              .enabled_ports = 0x1f,
++              .enabled_ports = 0x3f,
+               .arl_bins = 2,
+               .arl_buckets = 1024,
+               .imp_port = 5,
+@@ -2310,7 +2310,7 @@ static const struct b53_chip_data b53_sw
+               .chip_id = BCM5389_DEVICE_ID,
+               .dev_name = "BCM5389",
+               .vlans = 4096,
+-              .enabled_ports = 0x1f,
++              .enabled_ports = 0x11f,
+               .arl_bins = 4,
+               .arl_buckets = 1024,
+               .imp_port = 8,
+@@ -2324,7 +2324,7 @@ static const struct b53_chip_data b53_sw
+               .chip_id = BCM5395_DEVICE_ID,
+               .dev_name = "BCM5395",
+               .vlans = 4096,
+-              .enabled_ports = 0x1f,
++              .enabled_ports = 0x11f,
+               .arl_bins = 4,
+               .arl_buckets = 1024,
+               .imp_port = 8,
+@@ -2338,7 +2338,7 @@ static const struct b53_chip_data b53_sw
+               .chip_id = BCM5397_DEVICE_ID,
+               .dev_name = "BCM5397",
+               .vlans = 4096,
+-              .enabled_ports = 0x1f,
++              .enabled_ports = 0x11f,
+               .arl_bins = 4,
+               .arl_buckets = 1024,
+               .imp_port = 8,
+@@ -2352,7 +2352,7 @@ static const struct b53_chip_data b53_sw
+               .chip_id = BCM5398_DEVICE_ID,
+               .dev_name = "BCM5398",
+               .vlans = 4096,
+-              .enabled_ports = 0x7f,
++              .enabled_ports = 0x17f,
+               .arl_bins = 4,
+               .arl_buckets = 1024,
+               .imp_port = 8,
+@@ -2366,7 +2366,7 @@ static const struct b53_chip_data b53_sw
+               .chip_id = BCM53115_DEVICE_ID,
+               .dev_name = "BCM53115",
+               .vlans = 4096,
+-              .enabled_ports = 0x1f,
++              .enabled_ports = 0x11f,
+               .arl_bins = 4,
+               .arl_buckets = 1024,
+               .vta_regs = B53_VTA_REGS,
+@@ -2380,7 +2380,7 @@ static const struct b53_chip_data b53_sw
+               .chip_id = BCM53125_DEVICE_ID,
+               .dev_name = "BCM53125",
+               .vlans = 4096,
+-              .enabled_ports = 0xff,
++              .enabled_ports = 0x1ff,
+               .arl_bins = 4,
+               .arl_buckets = 1024,
+               .imp_port = 8,
+@@ -2422,7 +2422,7 @@ static const struct b53_chip_data b53_sw
+               .chip_id = BCM53010_DEVICE_ID,
+               .dev_name = "BCM53010",
+               .vlans = 4096,
+-              .enabled_ports = 0x1f,
++              .enabled_ports = 0x1bf,
+               .arl_bins = 4,
+               .arl_buckets = 1024,
+               .imp_port = 8,
+@@ -2464,7 +2464,7 @@ static const struct b53_chip_data b53_sw
+               .chip_id = BCM53018_DEVICE_ID,
+               .dev_name = "BCM53018",
+               .vlans = 4096,
+-              .enabled_ports = 0x1f,
++              .enabled_ports = 0x1bf,
+               .arl_bins = 4,
+               .arl_buckets = 1024,
+               .imp_port = 8,
+@@ -2478,7 +2478,7 @@ static const struct b53_chip_data b53_sw
+               .chip_id = BCM53019_DEVICE_ID,
+               .dev_name = "BCM53019",
+               .vlans = 4096,
+-              .enabled_ports = 0x1f,
++              .enabled_ports = 0x1bf,
+               .arl_bins = 4,
+               .arl_buckets = 1024,
+               .imp_port = 8,
+@@ -2605,7 +2605,6 @@ static int b53_switch_init(struct b53_de
+                       dev->cpu_port = 5;
+       }
+-      dev->enabled_ports |= BIT(dev->cpu_port);
+       dev->num_ports = fls(dev->enabled_ports);
+       dev->ds->num_ports = min_t(unsigned int, dev->num_ports, DSA_MAX_PORTS);
diff --git a/target/linux/generic/backport-5.10/793-v5.16-0002-net-dsa-b53-Drop-BCM5301x-workaround-for-a-wrong-CPU.patch b/target/linux/generic/backport-5.10/793-v5.16-0002-net-dsa-b53-Drop-BCM5301x-workaround-for-a-wrong-CPU.patch
new file mode 100644 (file)
index 0000000..4a4f8e9
--- /dev/null
@@ -0,0 +1,42 @@
+From b290c6384afabbca5ae6e2af72fb1b2bc37922be Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
+Date: Thu, 16 Sep 2021 14:03:52 +0200
+Subject: [PATCH] net: dsa: b53: Drop BCM5301x workaround for a wrong CPU/IMP
+ port
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+On BCM5301x port 8 requires a fixed link when used.
+
+Years ago when b53 was an OpenWrt downstream driver (with configuration
+based on sometimes bugged NVRAM) there was a need for a fixup. In case
+of forcing fixed link for (incorrectly specified) port 5 the code had to
+actually setup port 8 link.
+
+For upstream b53 driver with setup based on DT there is no need for that
+workaround. In DT we have and require correct ports setup.
+
+Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
+Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
+Tested-by: Florian Fainelli <f.fainelli@gmail.com>
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+---
+ drivers/net/dsa/b53/b53_common.c | 6 ------
+ 1 file changed, 6 deletions(-)
+
+--- a/drivers/net/dsa/b53/b53_common.c
++++ b/drivers/net/dsa/b53/b53_common.c
+@@ -1256,12 +1256,6 @@ static void b53_adjust_link(struct dsa_s
+                               return;
+                       }
+               }
+-      } else if (is5301x(dev)) {
+-              if (port != dev->cpu_port) {
+-                      b53_force_port_config(dev, dev->cpu_port, 2000,
+-                                            DUPLEX_FULL, true, true);
+-                      b53_force_link(dev, dev->cpu_port, 1);
+-              }
+       }
+       /* Re-negotiate EEE if it was enabled already */
diff --git a/target/linux/generic/backport-5.10/793-v5.16-0003-net-dsa-b53-Improve-flow-control-setup-on-BCM5301x.patch b/target/linux/generic/backport-5.10/793-v5.16-0003-net-dsa-b53-Improve-flow-control-setup-on-BCM5301x.patch
new file mode 100644 (file)
index 0000000..3954ee4
--- /dev/null
@@ -0,0 +1,32 @@
+From 3ff26b29230c54fea2353b63124c589b61953e14 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
+Date: Thu, 16 Sep 2021 14:03:53 +0200
+Subject: [PATCH] net: dsa: b53: Improve flow control setup on BCM5301x
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+According to the Broadcom's reference driver flow control needs to be
+enabled for any CPU switch port (5, 7 or 8 - depending on which one is
+used). Current code makes it work only for the port 5. Use
+dsa_is_cpu_port() which solved that problem.
+
+Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
+Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
+Tested-by: Florian Fainelli <f.fainelli@gmail.com>
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+---
+ drivers/net/dsa/b53/b53_common.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/net/dsa/b53/b53_common.c
++++ b/drivers/net/dsa/b53/b53_common.c
+@@ -1187,7 +1187,7 @@ static void b53_adjust_link(struct dsa_s
+               return;
+       /* Enable flow control on BCM5301x's CPU port */
+-      if (is5301x(dev) && port == dev->cpu_port)
++      if (is5301x(dev) && dsa_is_cpu_port(ds, port))
+               tx_pause = rx_pause = true;
+       if (phydev->pause) {
diff --git a/target/linux/generic/backport-5.10/793-v5.16-0004-net-dsa-b53-Drop-unused-cpu_port-field.patch b/target/linux/generic/backport-5.10/793-v5.16-0004-net-dsa-b53-Drop-unused-cpu_port-field.patch
new file mode 100644 (file)
index 0000000..9e687b1
--- /dev/null
@@ -0,0 +1,205 @@
+From 7d5af56418d7d01e43247a33b6fe6492ea871923 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
+Date: Thu, 16 Sep 2021 14:03:54 +0200
+Subject: [PATCH] net: dsa: b53: Drop unused "cpu_port" field
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+It's set but never used anymore.
+
+Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
+Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
+Tested-by: Florian Fainelli <f.fainelli@gmail.com>
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+---
+ drivers/net/dsa/b53/b53_common.c | 28 ----------------------------
+ drivers/net/dsa/b53/b53_priv.h   |  1 -
+ 2 files changed, 29 deletions(-)
+
+--- a/drivers/net/dsa/b53/b53_common.c
++++ b/drivers/net/dsa/b53/b53_common.c
+@@ -2286,7 +2286,6 @@ static const struct b53_chip_data b53_sw
+               .arl_bins = 2,
+               .arl_buckets = 1024,
+               .imp_port = 5,
+-              .cpu_port = B53_CPU_PORT_25,
+               .duplex_reg = B53_DUPLEX_STAT_FE,
+       },
+       {
+@@ -2297,7 +2296,6 @@ static const struct b53_chip_data b53_sw
+               .arl_bins = 2,
+               .arl_buckets = 1024,
+               .imp_port = 5,
+-              .cpu_port = B53_CPU_PORT_25,
+               .duplex_reg = B53_DUPLEX_STAT_FE,
+       },
+       {
+@@ -2308,7 +2306,6 @@ static const struct b53_chip_data b53_sw
+               .arl_bins = 4,
+               .arl_buckets = 1024,
+               .imp_port = 8,
+-              .cpu_port = B53_CPU_PORT,
+               .vta_regs = B53_VTA_REGS,
+               .duplex_reg = B53_DUPLEX_STAT_GE,
+               .jumbo_pm_reg = B53_JUMBO_PORT_MASK,
+@@ -2322,7 +2319,6 @@ static const struct b53_chip_data b53_sw
+               .arl_bins = 4,
+               .arl_buckets = 1024,
+               .imp_port = 8,
+-              .cpu_port = B53_CPU_PORT,
+               .vta_regs = B53_VTA_REGS,
+               .duplex_reg = B53_DUPLEX_STAT_GE,
+               .jumbo_pm_reg = B53_JUMBO_PORT_MASK,
+@@ -2336,7 +2332,6 @@ static const struct b53_chip_data b53_sw
+               .arl_bins = 4,
+               .arl_buckets = 1024,
+               .imp_port = 8,
+-              .cpu_port = B53_CPU_PORT,
+               .vta_regs = B53_VTA_REGS_9798,
+               .duplex_reg = B53_DUPLEX_STAT_GE,
+               .jumbo_pm_reg = B53_JUMBO_PORT_MASK,
+@@ -2350,7 +2345,6 @@ static const struct b53_chip_data b53_sw
+               .arl_bins = 4,
+               .arl_buckets = 1024,
+               .imp_port = 8,
+-              .cpu_port = B53_CPU_PORT,
+               .vta_regs = B53_VTA_REGS_9798,
+               .duplex_reg = B53_DUPLEX_STAT_GE,
+               .jumbo_pm_reg = B53_JUMBO_PORT_MASK,
+@@ -2365,7 +2359,6 @@ static const struct b53_chip_data b53_sw
+               .arl_buckets = 1024,
+               .vta_regs = B53_VTA_REGS,
+               .imp_port = 8,
+-              .cpu_port = B53_CPU_PORT,
+               .duplex_reg = B53_DUPLEX_STAT_GE,
+               .jumbo_pm_reg = B53_JUMBO_PORT_MASK,
+               .jumbo_size_reg = B53_JUMBO_MAX_SIZE,
+@@ -2378,7 +2371,6 @@ static const struct b53_chip_data b53_sw
+               .arl_bins = 4,
+               .arl_buckets = 1024,
+               .imp_port = 8,
+-              .cpu_port = B53_CPU_PORT,
+               .vta_regs = B53_VTA_REGS,
+               .duplex_reg = B53_DUPLEX_STAT_GE,
+               .jumbo_pm_reg = B53_JUMBO_PORT_MASK,
+@@ -2392,7 +2384,6 @@ static const struct b53_chip_data b53_sw
+               .arl_bins = 4,
+               .arl_buckets = 1024,
+               .imp_port = 8,
+-              .cpu_port = B53_CPU_PORT,
+               .vta_regs = B53_VTA_REGS,
+               .duplex_reg = B53_DUPLEX_STAT_GE,
+               .jumbo_pm_reg = B53_JUMBO_PORT_MASK,
+@@ -2406,7 +2397,6 @@ static const struct b53_chip_data b53_sw
+               .arl_bins = 4,
+               .arl_buckets = 1024,
+               .imp_port = 8,
+-              .cpu_port = B53_CPU_PORT,
+               .vta_regs = B53_VTA_REGS_63XX,
+               .duplex_reg = B53_DUPLEX_STAT_63XX,
+               .jumbo_pm_reg = B53_JUMBO_PORT_MASK_63XX,
+@@ -2420,7 +2410,6 @@ static const struct b53_chip_data b53_sw
+               .arl_bins = 4,
+               .arl_buckets = 1024,
+               .imp_port = 8,
+-              .cpu_port = B53_CPU_PORT_25, /* TODO: auto detect */
+               .vta_regs = B53_VTA_REGS,
+               .duplex_reg = B53_DUPLEX_STAT_GE,
+               .jumbo_pm_reg = B53_JUMBO_PORT_MASK,
+@@ -2434,7 +2423,6 @@ static const struct b53_chip_data b53_sw
+               .arl_bins = 4,
+               .arl_buckets = 1024,
+               .imp_port = 8,
+-              .cpu_port = B53_CPU_PORT_25, /* TODO: auto detect */
+               .vta_regs = B53_VTA_REGS,
+               .duplex_reg = B53_DUPLEX_STAT_GE,
+               .jumbo_pm_reg = B53_JUMBO_PORT_MASK,
+@@ -2448,7 +2436,6 @@ static const struct b53_chip_data b53_sw
+               .arl_bins = 4,
+               .arl_buckets = 1024,
+               .imp_port = 8,
+-              .cpu_port = B53_CPU_PORT_25, /* TODO: auto detect */
+               .vta_regs = B53_VTA_REGS,
+               .duplex_reg = B53_DUPLEX_STAT_GE,
+               .jumbo_pm_reg = B53_JUMBO_PORT_MASK,
+@@ -2462,7 +2449,6 @@ static const struct b53_chip_data b53_sw
+               .arl_bins = 4,
+               .arl_buckets = 1024,
+               .imp_port = 8,
+-              .cpu_port = B53_CPU_PORT_25, /* TODO: auto detect */
+               .vta_regs = B53_VTA_REGS,
+               .duplex_reg = B53_DUPLEX_STAT_GE,
+               .jumbo_pm_reg = B53_JUMBO_PORT_MASK,
+@@ -2476,7 +2462,6 @@ static const struct b53_chip_data b53_sw
+               .arl_bins = 4,
+               .arl_buckets = 1024,
+               .imp_port = 8,
+-              .cpu_port = B53_CPU_PORT_25, /* TODO: auto detect */
+               .vta_regs = B53_VTA_REGS,
+               .duplex_reg = B53_DUPLEX_STAT_GE,
+               .jumbo_pm_reg = B53_JUMBO_PORT_MASK,
+@@ -2490,7 +2475,6 @@ static const struct b53_chip_data b53_sw
+               .arl_bins = 4,
+               .arl_buckets = 1024,
+               .imp_port = 8,
+-              .cpu_port = B53_CPU_PORT,
+               .vta_regs = B53_VTA_REGS,
+               .duplex_reg = B53_DUPLEX_STAT_GE,
+               .jumbo_pm_reg = B53_JUMBO_PORT_MASK,
+@@ -2504,7 +2488,6 @@ static const struct b53_chip_data b53_sw
+               .arl_bins = 4,
+               .arl_buckets = 1024,
+               .imp_port = 8,
+-              .cpu_port = B53_CPU_PORT,
+               .vta_regs = B53_VTA_REGS,
+               .duplex_reg = B53_DUPLEX_STAT_GE,
+               .jumbo_pm_reg = B53_JUMBO_PORT_MASK,
+@@ -2518,7 +2501,6 @@ static const struct b53_chip_data b53_sw
+               .arl_bins = 4,
+               .arl_buckets = 1024,
+               .imp_port = 8,
+-              .cpu_port = B53_CPU_PORT,
+               .vta_regs = B53_VTA_REGS,
+               .duplex_reg = B53_DUPLEX_STAT_GE,
+               .jumbo_pm_reg = B53_JUMBO_PORT_MASK,
+@@ -2532,7 +2514,6 @@ static const struct b53_chip_data b53_sw
+               .arl_bins = 4,
+               .arl_buckets = 256,
+               .imp_port = 8,
+-              .cpu_port = B53_CPU_PORT,
+               .vta_regs = B53_VTA_REGS,
+               .duplex_reg = B53_DUPLEX_STAT_GE,
+               .jumbo_pm_reg = B53_JUMBO_PORT_MASK,
+@@ -2558,7 +2539,6 @@ static int b53_switch_init(struct b53_de
+                       dev->vta_regs[2] = chip->vta_regs[2];
+                       dev->jumbo_pm_reg = chip->jumbo_pm_reg;
+                       dev->imp_port = chip->imp_port;
+-                      dev->cpu_port = chip->cpu_port;
+                       dev->num_vlans = chip->vlans;
+                       dev->num_arl_bins = chip->arl_bins;
+                       dev->num_arl_buckets = chip->arl_buckets;
+@@ -2590,13 +2570,6 @@ static int b53_switch_init(struct b53_de
+                       break;
+ #endif
+               }
+-      } else if (dev->chip_id == BCM53115_DEVICE_ID) {
+-              u64 strap_value;
+-
+-              b53_read48(dev, B53_STAT_PAGE, B53_STRAP_VALUE, &strap_value);
+-              /* use second IMP port if GMII is enabled */
+-              if (strap_value & SV_GMII_CTRL_115)
+-                      dev->cpu_port = 5;
+       }
+       dev->num_ports = fls(dev->enabled_ports);
+--- a/drivers/net/dsa/b53/b53_priv.h
++++ b/drivers/net/dsa/b53/b53_priv.h
+@@ -123,7 +123,6 @@ struct b53_device {
+       /* used ports mask */
+       u16 enabled_ports;
+       unsigned int imp_port;
+-      unsigned int cpu_port;
+       /* connect specific data */
+       u8 current_page;