From 8fa1b576bbb56d00765d15863daa1b4cf44060e5 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Rafa=C5=82=20Mi=C5=82ecki?= Date: Fri, 17 Sep 2021 10:07:22 +0200 Subject: [PATCH] linux: update b53 upstream driver MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Rafał Miłecki --- ...a-b53-add-support-for-BCM63xx-RGMIIs.patch | 8 +- ...-Add-debug-prints-in-b53_vlan_enable.patch | 65 +++++ ...a-b53-spi-allow-device-tree-probing.patch} | 0 ...-net-dsa-b53-relax-is63xx-condition.patch} | 0 ...ag_brcm-add-support-for-legacy-tags.patch} | 2 +- ...005-net-dsa-b53-support-legacy-tags.patch} | 4 +- ...sa-b53-mmap-Add-device-tree-support.patch} | 0 ...-spi-add-missing-MODULE_DEVICE_TABLE.patch | 27 ++ ...Do-not-force-CPU-to-be-always-tagged.patch | 86 +++++++ ...3-remove-redundant-null-check-on-dev.patch | 30 +++ ...Create-default-VLAN-entry-explicitly.patch | 71 ++++++ ...-calculating-number-of-switch-ports.patch} | 2 +- ...orrect-number-of-ports-in-the-DSA-s.patch} | 4 +- ...a-b53-Fix-IMP-port-setup-on-BCM5301x.patch | 237 ++++++++++++++++++ ...3-Include-all-ports-in-enabled_ports.patch | 131 ++++++++++ ...-BCM5301x-workaround-for-a-wrong-CPU.patch | 42 ++++ ...prove-flow-control-setup-on-BCM5301x.patch | 32 +++ ...t-dsa-b53-Drop-unused-cpu_port-field.patch | 205 +++++++++++++++ 18 files changed, 936 insertions(+), 10 deletions(-) create mode 100644 target/linux/generic/backport-5.10/790-v5.13-0001-net-dsa-b53-Add-debug-prints-in-b53_vlan_enable.patch rename target/linux/{bmips/patches-5.10/045-v5.13-net-dsa-b53-spi-allow-device-tree-probing.patch => generic/backport-5.10/790-v5.13-0002-net-dsa-b53-spi-allow-device-tree-probing.patch} (100%) rename target/linux/{bmips/patches-5.10/048-v5.13-net-dsa-b53-relax-is63xx-condition.patch => generic/backport-5.10/790-v5.13-0003-net-dsa-b53-relax-is63xx-condition.patch} (100%) rename target/linux/{bmips/patches-5.10/049-v5.13-net-dsa-tag_brcm-add-support-for-legacy-tags.patch => generic/backport-5.10/790-v5.13-0004-net-dsa-tag_brcm-add-support-for-legacy-tags.patch} (98%) rename target/linux/{bmips/patches-5.10/050-v5.13-net-dsa-b53-support-legacy-tags.patch => generic/backport-5.10/790-v5.13-0005-net-dsa-b53-support-legacy-tags.patch} (93%) rename target/linux/{bmips/patches-5.10/051-v5.13-net-dsa-b53-mmap-Add-device-tree-support.patch => generic/backport-5.10/790-v5.13-0006-net-dsa-b53-mmap-Add-device-tree-support.patch} (100%) create mode 100644 target/linux/generic/backport-5.10/790-v5.13-0007-net-dsa-b53-spi-add-missing-MODULE_DEVICE_TABLE.patch create mode 100644 target/linux/generic/backport-5.10/791-v5.14-0001-net-dsa-b53-Do-not-force-CPU-to-be-always-tagged.patch create mode 100644 target/linux/generic/backport-5.10/791-v5.14-0002-net-dsa-b53-remove-redundant-null-check-on-dev.patch create mode 100644 target/linux/generic/backport-5.10/791-v5.14-0003-net-dsa-b53-Create-default-VLAN-entry-explicitly.patch rename target/linux/generic/backport-5.10/{790-v5.15-0001-net-dsa-b53-Fix-calculating-number-of-switch-ports.patch => 792-v5.15-0001-net-dsa-b53-Fix-calculating-number-of-switch-ports.patch} (95%) rename target/linux/generic/backport-5.10/{790-v5.15-0002-net-dsa-b53-Set-correct-number-of-ports-in-the-DSA-s.patch => 792-v5.15-0002-net-dsa-b53-Set-correct-number-of-ports-in-the-DSA-s.patch} (92%) create mode 100644 target/linux/generic/backport-5.10/792-v5.15-0003-net-dsa-b53-Fix-IMP-port-setup-on-BCM5301x.patch create mode 100644 target/linux/generic/backport-5.10/793-v5.16-0001-net-dsa-b53-Include-all-ports-in-enabled_ports.patch create mode 100644 target/linux/generic/backport-5.10/793-v5.16-0002-net-dsa-b53-Drop-BCM5301x-workaround-for-a-wrong-CPU.patch create mode 100644 target/linux/generic/backport-5.10/793-v5.16-0003-net-dsa-b53-Improve-flow-control-setup-on-BCM5301x.patch create mode 100644 target/linux/generic/backport-5.10/793-v5.16-0004-net-dsa-b53-Drop-unused-cpu_port-field.patch diff --git a/target/linux/bmips/patches-5.10/510-net-dsa-b53-add-support-for-BCM63xx-RGMIIs.patch b/target/linux/bmips/patches-5.10/510-net-dsa-b53-add-support-for-BCM63xx-RGMIIs.patch index 41655231fa4..c636e3a907b 100644 --- a/target/linux/bmips/patches-5.10/510-net-dsa-b53-add-support-for-BCM63xx-RGMIIs.patch +++ b/target/linux/bmips/patches-5.10/510-net-dsa-b53-add-support-for-BCM63xx-RGMIIs.patch @@ -13,7 +13,7 @@ Signed-off-by: Álvaro Fernández Rojas --- 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 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 + 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 index 00000000000..91cf55b18a3 --- /dev/null +++ b/target/linux/generic/backport-5.10/790-v5.13-0001-net-dsa-b53-Add-debug-prints-in-b53_vlan_enable.patch @@ -0,0 +1,65 @@ +From ee47ed08d75e8f16b3cf882061ee19c2ea19dd6c Mon Sep 17 00:00:00 2001 +From: Florian Fainelli +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 +Reviewed-by: Andrew Lunn +Signed-off-by: David S. Miller +--- + 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/bmips/patches-5.10/045-v5.13-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 similarity index 100% rename from target/linux/bmips/patches-5.10/045-v5.13-net-dsa-b53-spi-allow-device-tree-probing.patch rename to target/linux/generic/backport-5.10/790-v5.13-0002-net-dsa-b53-spi-allow-device-tree-probing.patch diff --git a/target/linux/bmips/patches-5.10/048-v5.13-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 similarity index 100% rename from target/linux/bmips/patches-5.10/048-v5.13-net-dsa-b53-relax-is63xx-condition.patch rename to target/linux/generic/backport-5.10/790-v5.13-0003-net-dsa-b53-relax-is63xx-condition.patch 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/generic/backport-5.10/790-v5.13-0004-net-dsa-tag_brcm-add-support-for-legacy-tags.patch similarity index 98% rename from target/linux/bmips/patches-5.10/049-v5.13-net-dsa-tag_brcm-add-support-for-legacy-tags.patch rename to target/linux/generic/backport-5.10/790-v5.13-0004-net-dsa-tag_brcm-add-support-for-legacy-tags.patch index c689bc84d17..3b7d8f37cdf 100644 --- a/target/linux/bmips/patches-5.10/049-v5.13-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 @@ -1,7 +1,7 @@ From 964dbf186eaa84d409c359ddf09c827a3fbe8228 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= Date: Wed, 17 Mar 2021 11:29:26 +0100 -Subject: [PATCH 1/2] net: dsa: tag_brcm: add support for legacy tags +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 diff --git a/target/linux/bmips/patches-5.10/050-v5.13-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 similarity index 93% rename from target/linux/bmips/patches-5.10/050-v5.13-net-dsa-b53-support-legacy-tags.patch rename to target/linux/generic/backport-5.10/790-v5.13-0005-net-dsa-b53-support-legacy-tags.patch index 18cd09ff0e4..838e78a0571 100644 --- a/target/linux/bmips/patches-5.10/050-v5.13-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 @@ -1,7 +1,7 @@ From 46c5176c586c81306bf9e7024c13b95da775490f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= Date: Wed, 17 Mar 2021 11:29:27 +0100 -Subject: [PATCH 2/2] net: dsa: b53: support legacy tags +Subject: [PATCH] net: dsa: b53: support legacy tags MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -28,7 +28,7 @@ Signed-off-by: David S. Miller 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 +@@ -2024,15 +2024,17 @@ enum dsa_tag_protocol b53_get_tag_protoc { struct b53_device *dev = ds->priv; diff --git a/target/linux/bmips/patches-5.10/051-v5.13-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 similarity index 100% rename from target/linux/bmips/patches-5.10/051-v5.13-net-dsa-b53-mmap-Add-device-tree-support.patch rename to target/linux/generic/backport-5.10/790-v5.13-0006-net-dsa-b53-mmap-Add-device-tree-support.patch 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 index 00000000000..ea367557320 --- /dev/null +++ b/target/linux/generic/backport-5.10/790-v5.13-0007-net-dsa-b53-spi-add-missing-MODULE_DEVICE_TABLE.patch @@ -0,0 +1,27 @@ +From 866f1577ba69bde2b9f36c300f603596c7d84a62 Mon Sep 17 00:00:00 2001 +From: Qinglang Miao +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 +Signed-off-by: Qinglang Miao +Acked-by: Florian Fainelli +Signed-off-by: David S. Miller +--- + 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/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 index 00000000000..420e3ae31b0 --- /dev/null +++ b/target/linux/generic/backport-5.10/791-v5.14-0001-net-dsa-b53-Do-not-force-CPU-to-be-always-tagged.patch @@ -0,0 +1,86 @@ +From 2c32a3d3c233b855943677609fe388f82b1f0975 Mon Sep 17 00:00:00 2001 +From: Florian Fainelli +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 +Signed-off-by: Florian Fainelli +Reviewed-by: Vladimir Oltean +Tested-by: Matthew Hagan +Signed-off-by: David S. Miller +--- + 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 index 00000000000..ee3a71ffa5a --- /dev/null +++ b/target/linux/generic/backport-5.10/791-v5.14-0002-net-dsa-b53-remove-redundant-null-check-on-dev.patch @@ -0,0 +1,30 @@ +From 11b57faf951cd3a570e3d9e463fc7c41023bc8c6 Mon Sep 17 00:00:00 2001 +From: Colin Ian King +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 +Acked-by: Florian Fainelli +Signed-off-by: David S. Miller +--- + 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 index 00000000000..df891d68ab4 --- /dev/null +++ b/target/linux/generic/backport-5.10/791-v5.14-0003-net-dsa-b53-Create-default-VLAN-entry-explicitly.patch @@ -0,0 +1,71 @@ +From 64a81b24487f0d2fba0f033029eec2abc7d82cee Mon Sep 17 00:00:00 2001 +From: Florian Fainelli +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 +Signed-off-by: Florian Fainelli +Reviewed-by: Vladimir Oltean +Signed-off-by: David S. Miller +--- + 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/790-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 similarity index 95% rename from target/linux/generic/backport-5.10/790-v5.15-0001-net-dsa-b53-Fix-calculating-number-of-switch-ports.patch rename to target/linux/generic/backport-5.10/792-v5.15-0001-net-dsa-b53-Fix-calculating-number-of-switch-ports.patch index f1bef258af8..4a7cbd9a4fb 100644 --- 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/792-v5.15-0001-net-dsa-b53-Fix-calculating-number-of-switch-ports.patch @@ -26,7 +26,7 @@ Signed-off-by: David S. Miller --- 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 +@@ -2584,9 +2584,8 @@ static int b53_switch_init(struct b53_de dev->cpu_port = 5; } 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/792-v5.15-0002-net-dsa-b53-Set-correct-number-of-ports-in-the-DSA-s.patch similarity index 92% rename from target/linux/generic/backport-5.10/790-v5.15-0002-net-dsa-b53-Set-correct-number-of-ports-in-the-DSA-s.patch rename to target/linux/generic/backport-5.10/792-v5.15-0002-net-dsa-b53-Set-correct-number-of-ports-in-the-DSA-s.patch index 404389dc482..361b2984fc0 100644 --- 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/792-v5.15-0002-net-dsa-b53-Set-correct-number-of-ports-in-the-DSA-s.patch @@ -24,7 +24,7 @@ Signed-off-by: David S. Miller --- 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 +@@ -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); @@ -33,7 +33,7 @@ Signed-off-by: David S. Miller /* 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 +@@ -2631,7 +2633,6 @@ struct b53_device *b53_switch_alloc(stru return NULL; ds->dev = base; 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 index 00000000000..380a677c502 --- /dev/null +++ b/target/linux/generic/backport-5.10/792-v5.15-0003-net-dsa-b53-Fix-IMP-port-setup-on-BCM5301x.patch @@ -0,0 +1,237 @@ +From 63f8428b4077de3664eb0b252393c839b0b293ec Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +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 +Signed-off-by: David S. Miller +--- + 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 index 00000000000..d80b5db714b --- /dev/null +++ b/target/linux/generic/backport-5.10/793-v5.16-0001-net-dsa-b53-Include-all-ports-in-enabled_ports.patch @@ -0,0 +1,131 @@ +From 983d96a9116a328668601555d96736261d33170c Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +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 +Reviewed-by: Florian Fainelli +Tested-by: Florian Fainelli +Signed-off-by: Jakub Kicinski +--- + 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 index 00000000000..4a4f8e940d2 --- /dev/null +++ b/target/linux/generic/backport-5.10/793-v5.16-0002-net-dsa-b53-Drop-BCM5301x-workaround-for-a-wrong-CPU.patch @@ -0,0 +1,42 @@ +From b290c6384afabbca5ae6e2af72fb1b2bc37922be Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +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 +Reviewed-by: Florian Fainelli +Tested-by: Florian Fainelli +Signed-off-by: Jakub Kicinski +--- + 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 index 00000000000..3954ee4aac6 --- /dev/null +++ b/target/linux/generic/backport-5.10/793-v5.16-0003-net-dsa-b53-Improve-flow-control-setup-on-BCM5301x.patch @@ -0,0 +1,32 @@ +From 3ff26b29230c54fea2353b63124c589b61953e14 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +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 +Reviewed-by: Florian Fainelli +Tested-by: Florian Fainelli +Signed-off-by: Jakub Kicinski +--- + 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 index 00000000000..9e687b14880 --- /dev/null +++ b/target/linux/generic/backport-5.10/793-v5.16-0004-net-dsa-b53-Drop-unused-cpu_port-field.patch @@ -0,0 +1,205 @@ +From 7d5af56418d7d01e43247a33b6fe6492ea871923 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +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 +Reviewed-by: Florian Fainelli +Tested-by: Florian Fainelli +Signed-off-by: Jakub Kicinski +--- + 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; -- 2.30.2