From cf1721cb7b36c2c98e53fb66a8ce5f1173bee714 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= Date: Wed, 28 May 2025 21:46:40 +0200 Subject: [PATCH] generic: 6.12: backport b53 upstream patches MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The support_eee patch is needed in order to prevent system hangs on bmips devices. c4f873c2b65c8 net: dsa: b53: mdio: add support for BCM53101 c86692fc2cb77 net: dsa: b53/bcm_sf2: implement .support_eee() method f12b363887c70 net: dsa: use ethtool string helpers Signed-off-by: Álvaro Fernández Rojas --- ...3-net-dsa-use-ethtool-string-helpers.patch | 30 ++++++++ ...cm_sf2-implement-.support_eee-method.patch | 69 +++++++++++++++++ ...sa-b53-mdio-add-support-for-BCM53101.patch | 76 +++++++++++++++++++ 3 files changed, 175 insertions(+) create mode 100644 target/linux/generic/backport-6.12/710-01-v6.13-net-dsa-use-ethtool-string-helpers.patch create mode 100644 target/linux/generic/backport-6.12/710-02-v6.14-net-dsa-b53-bcm_sf2-implement-.support_eee-method.patch create mode 100644 target/linux/generic/backport-6.12/710-03-v6.15-net-dsa-b53-mdio-add-support-for-BCM53101.patch diff --git a/target/linux/generic/backport-6.12/710-01-v6.13-net-dsa-use-ethtool-string-helpers.patch b/target/linux/generic/backport-6.12/710-01-v6.13-net-dsa-use-ethtool-string-helpers.patch new file mode 100644 index 00000000000..003a896f30a --- /dev/null +++ b/target/linux/generic/backport-6.12/710-01-v6.13-net-dsa-use-ethtool-string-helpers.patch @@ -0,0 +1,30 @@ +From f12b363887c706c40611fba645265527a8415832 Mon Sep 17 00:00:00 2001 +From: Rosen Penev +Date: Sun, 27 Oct 2024 21:48:28 -0700 +Subject: [PATCH] net: dsa: use ethtool string helpers + +These are the preferred way to copy ethtool strings. + +Avoids incrementing pointers all over the place. + +Signed-off-by: Rosen Penev +(for hellcreek driver) +Reviewed-by: Kurt Kanzenbach +Link: https://patch.msgid.link/20241028044828.1639668-1-rosenp@gmail.com +Signed-off-by: Jakub Kicinski +--- + 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 +@@ -1061,8 +1061,7 @@ void b53_get_strings(struct dsa_switch * + + if (stringset == ETH_SS_STATS) { + for (i = 0; i < mib_size; i++) +- strscpy(data + i * ETH_GSTRING_LEN, +- mibs[i].name, ETH_GSTRING_LEN); ++ ethtool_puts(&data, mibs[i].name); + } else if (stringset == ETH_SS_PHY_STATS) { + phydev = b53_get_phy_device(ds, port); + if (!phydev) diff --git a/target/linux/generic/backport-6.12/710-02-v6.14-net-dsa-b53-bcm_sf2-implement-.support_eee-method.patch b/target/linux/generic/backport-6.12/710-02-v6.14-net-dsa-b53-bcm_sf2-implement-.support_eee-method.patch new file mode 100644 index 00000000000..ca0f61013ca --- /dev/null +++ b/target/linux/generic/backport-6.12/710-02-v6.14-net-dsa-b53-bcm_sf2-implement-.support_eee-method.patch @@ -0,0 +1,69 @@ +From c86692fc2cb77d94dd8c166c2b9017f196d02a84 Mon Sep 17 00:00:00 2001 +From: "Russell King (Oracle)" +Date: Tue, 10 Dec 2024 14:18:26 +0000 +Subject: [PATCH] net: dsa: b53/bcm_sf2: implement .support_eee() method + +Implement the .support_eee() method to indicate that EEE is not +supported by two switch variants, rather than making these checks in +the .set_mac_eee() and .get_mac_eee() methods. + +Signed-off-by: Russell King (Oracle) +Reviewed-by: Florian Fainelli +Reviewed-by: Vladimir Oltean +Link: https://patch.msgid.link/E1tL14E-006cZU-Nc@rmk-PC.armlinux.org.uk +Signed-off-by: Jakub Kicinski +--- + drivers/net/dsa/b53/b53_common.c | 13 +++++++------ + drivers/net/dsa/b53/b53_priv.h | 1 + + 2 files changed, 8 insertions(+), 6 deletions(-) + +--- a/drivers/net/dsa/b53/b53_common.c ++++ b/drivers/net/dsa/b53/b53_common.c +@@ -2358,13 +2358,16 @@ int b53_eee_init(struct dsa_switch *ds, + } + EXPORT_SYMBOL(b53_eee_init); + +-int b53_get_mac_eee(struct dsa_switch *ds, int port, struct ethtool_keee *e) ++bool b53_support_eee(struct dsa_switch *ds, int port) + { + struct b53_device *dev = ds->priv; + +- if (is5325(dev) || is5365(dev)) +- return -EOPNOTSUPP; ++ return !is5325(dev) && !is5365(dev); ++} ++EXPORT_SYMBOL(b53_support_eee); + ++int b53_get_mac_eee(struct dsa_switch *ds, int port, struct ethtool_keee *e) ++{ + return 0; + } + EXPORT_SYMBOL(b53_get_mac_eee); +@@ -2374,9 +2377,6 @@ int b53_set_mac_eee(struct dsa_switch *d + struct b53_device *dev = ds->priv; + struct ethtool_keee *p = &dev->ports[port].eee; + +- if (is5325(dev) || is5365(dev)) +- return -EOPNOTSUPP; +- + p->eee_enabled = e->eee_enabled; + b53_eee_enable_set(ds, port, e->eee_enabled); + +@@ -2433,6 +2433,7 @@ static const struct dsa_switch_ops b53_s + .port_setup = b53_setup_port, + .port_enable = b53_enable_port, + .port_disable = b53_disable_port, ++ .support_eee = b53_support_eee, + .get_mac_eee = b53_get_mac_eee, + .set_mac_eee = b53_set_mac_eee, + .port_bridge_join = b53_br_join, +--- a/drivers/net/dsa/b53/b53_priv.h ++++ b/drivers/net/dsa/b53/b53_priv.h +@@ -387,6 +387,7 @@ int b53_enable_port(struct dsa_switch *d + void b53_disable_port(struct dsa_switch *ds, int port); + void b53_brcm_hdr_setup(struct dsa_switch *ds, int port); + int b53_eee_init(struct dsa_switch *ds, int port, struct phy_device *phy); ++bool b53_support_eee(struct dsa_switch *ds, int port); + int b53_get_mac_eee(struct dsa_switch *ds, int port, struct ethtool_keee *e); + int b53_set_mac_eee(struct dsa_switch *ds, int port, struct ethtool_keee *e); + diff --git a/target/linux/generic/backport-6.12/710-03-v6.15-net-dsa-b53-mdio-add-support-for-BCM53101.patch b/target/linux/generic/backport-6.12/710-03-v6.15-net-dsa-b53-mdio-add-support-for-BCM53101.patch new file mode 100644 index 00000000000..900117af5e1 --- /dev/null +++ b/target/linux/generic/backport-6.12/710-03-v6.15-net-dsa-b53-mdio-add-support-for-BCM53101.patch @@ -0,0 +1,76 @@ +From c4f873c2b65c839ff5e7c996bd9ef5a1e7eae11a Mon Sep 17 00:00:00 2001 +From: Torben Nielsen +Date: Mon, 17 Feb 2025 09:05:01 +0100 +Subject: [PATCH] net: dsa: b53: mdio: add support for BCM53101 + +BCM53101 is a ethernet switch, very similar to the BCM53115. +Enable support for it, in the existing b53 dsa driver. + +Signed-off-by: Torben Nielsen +Signed-off-by: Claus Stovgaard +Link: https://patch.msgid.link/20250217080503.1390282-1-claus.stovgaard@gmail.com +Signed-off-by: Jakub Kicinski +--- + drivers/net/dsa/b53/b53_common.c | 14 ++++++++++++++ + drivers/net/dsa/b53/b53_mdio.c | 1 + + drivers/net/dsa/b53/b53_priv.h | 2 ++ + 3 files changed, 17 insertions(+) + +--- a/drivers/net/dsa/b53/b53_common.c ++++ b/drivers/net/dsa/b53/b53_common.c +@@ -2552,6 +2552,19 @@ static const struct b53_chip_data b53_sw + .jumbo_size_reg = B53_JUMBO_MAX_SIZE, + }, + { ++ .chip_id = BCM53101_DEVICE_ID, ++ .dev_name = "BCM53101", ++ .vlans = 4096, ++ .enabled_ports = 0x11f, ++ .arl_bins = 4, ++ .arl_buckets = 512, ++ .vta_regs = B53_VTA_REGS, ++ .imp_port = 8, ++ .duplex_reg = B53_DUPLEX_STAT_GE, ++ .jumbo_pm_reg = B53_JUMBO_PORT_MASK, ++ .jumbo_size_reg = B53_JUMBO_MAX_SIZE, ++ }, ++ { + .chip_id = BCM53115_DEVICE_ID, + .dev_name = "BCM53115", + .vlans = 4096, +@@ -2932,6 +2945,7 @@ int b53_switch_detect(struct b53_device + return ret; + + switch (id32) { ++ case BCM53101_DEVICE_ID: + case BCM53115_DEVICE_ID: + case BCM53125_DEVICE_ID: + case BCM53128_DEVICE_ID: +--- a/drivers/net/dsa/b53/b53_mdio.c ++++ b/drivers/net/dsa/b53/b53_mdio.c +@@ -374,6 +374,7 @@ static void b53_mdio_shutdown(struct mdi + + static const struct of_device_id b53_of_match[] = { + { .compatible = "brcm,bcm5325" }, ++ { .compatible = "brcm,bcm53101" }, + { .compatible = "brcm,bcm53115" }, + { .compatible = "brcm,bcm53125" }, + { .compatible = "brcm,bcm53128" }, +--- a/drivers/net/dsa/b53/b53_priv.h ++++ b/drivers/net/dsa/b53/b53_priv.h +@@ -66,6 +66,7 @@ enum { + BCM5395_DEVICE_ID = 0x95, + BCM5397_DEVICE_ID = 0x97, + BCM5398_DEVICE_ID = 0x98, ++ BCM53101_DEVICE_ID = 0x53101, + BCM53115_DEVICE_ID = 0x53115, + BCM53125_DEVICE_ID = 0x53125, + BCM53128_DEVICE_ID = 0x53128, +@@ -190,6 +191,7 @@ static inline int is531x5(struct b53_dev + { + return dev->chip_id == BCM53115_DEVICE_ID || + dev->chip_id == BCM53125_DEVICE_ID || ++ dev->chip_id == BCM53101_DEVICE_ID || + dev->chip_id == BCM53128_DEVICE_ID || + dev->chip_id == BCM53134_DEVICE_ID; + }