]> git.ipfire.org Git - thirdparty/openwrt.git/commitdiff
realtek: patches: simplify dsa/phy port hacks 23186/head
authorMarkus Stockhausen <markus.stockhausen@gmx.de>
Fri, 1 May 2026 17:22:28 +0000 (19:22 +0200)
committerRobert Marko <robimarko@gmail.com>
Wed, 6 May 2026 08:52:40 +0000 (10:52 +0200)
The mdio driver has found a simple way to handle phy addresses
for all devices with upstream kernel defaults. Remove all unneeded
hacks from the corresponding patch and reword it.

While we are here increase DSA_MAX_PORTS to 56 to match RTL931x.

Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
Link: https://github.com/openwrt/openwrt/pull/23186
Signed-off-by: Robert Marko <robimarko@gmail.com>
target/linux/realtek/files-6.18/drivers/net/mdio/mdio-realtek-otto-serdes.c
target/linux/realtek/patches-6.18/700-dsa-mdio-increase-max-ports-for-rtl839x-rtl931x.patch

index 58b4e4610df4dbcba96f3d5220272789b37c71a4..63b0b0d5d167c973fa76485521c2f6456d70b192 100644 (file)
@@ -462,7 +462,7 @@ static int rtsds_probe(struct platform_device *pdev)
        bus->parent = dev;
        bus->read_c45 = rtsds_read;
        bus->write_c45 = rtsds_write;
-       bus->phy_mask = ~0ULL;
+       bus->phy_mask = ~0;
 
        ret = devm_of_mdiobus_register(dev, bus, dev->of_node);
        if (ret)
index 24d87e4bbe4af32f16f82eda9d1f680366e3739d..f9e9a5ac2cf617005fb51d6ddcffdd4e90782795 100644 (file)
@@ -3,10 +3,10 @@ From: John Crispin <john@phrozen.org>
 Date: Thu, 26 Nov 2020 12:02:21 +0100
 Subject: realtek dsa/phy: Increase max ports for RTL839X/RTL931X
 
-Linux standard can only support up to 32 devices per mdio bus and up to
-12 ports per DSA switch. This is not enough for the large RTL839X and
-RTL931X devices. Increase the max values accordingly. Additionally take
-care about the functions that work on bit masks.
+Linux standard can only support up to 12 ports per DSA switch. This is
+not enough for the large RTL839X and RTL931X devices. Increase the max
+values accordingly. Additionally take care about the DSA functions that 
+work on port bit masks. For this enhance the mask type from u32 to u64.
 
 Submitted-by: Bert Vermeulen <bert@biot.com>
 Submitted-by: Birger Koblitz <mail@birger-koblitz.de>
@@ -15,48 +15,10 @@ Submitted-by: Bjørn Mork <bjorn@mork.no>
 Submitted-by: John Crispin <john@phrozen.org>
 Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
 ---
- drivers/net/mdio/fwnode_mdio.c    |  2 +-
- include/linux/phy.h               |  6 +++---
  include/linux/platform_data/dsa.h |  2 +-
  include/net/dsa.h                 | 14 +++++++-------
- net/dsa/slave.c                   |  4 ++--
- 5 files changed, 14 insertions(+), 14 deletions(-)
+ 2 files changed, 8 insertions(+), 8 deletions(-)
 
---- a/drivers/net/mdio/fwnode_mdio.c
-+++ b/drivers/net/mdio/fwnode_mdio.c
-@@ -90,7 +90,7 @@ int fwnode_mdiobus_phy_device_register(s
-       }
-       if (fwnode_property_read_bool(child, "broken-turn-around"))
--              mdio->phy_ignore_ta_mask |= 1 << addr;
-+              mdio->phy_ignore_ta_mask |= BIT_ULL(addr);
-       fwnode_property_read_u32(child, "reset-assert-us",
-                                &phy->mdio.reset_assert_delay);
---- a/include/linux/phy.h
-+++ b/include/linux/phy.h
-@@ -316,7 +316,7 @@ static inline long rgmii_clock(int speed
-       }
- }
--#define PHY_MAX_ADDR  32
-+#define PHY_MAX_ADDR  64
- /* Used when trying to connect to a specific phy (mii bus id:phy device id) */
- #define PHY_ID_FMT "%s:%02x"
-@@ -402,10 +402,10 @@ struct mii_bus {
-       struct mdio_device *mdio_map[PHY_MAX_ADDR];
-       /** @phy_mask: PHY addresses to be ignored when probing */
--      u32 phy_mask;
-+      u64 phy_mask;
-       /** @phy_ignore_ta_mask: PHY addresses to ignore the TA/read failure */
--      u32 phy_ignore_ta_mask;
-+      u64 phy_ignore_ta_mask;
-       /**
-        * @irq: An array of interrupts, each PHY's interrupt at the index
 --- a/include/linux/platform_data/dsa.h
 +++ b/include/linux/platform_data/dsa.h
 @@ -6,7 +6,7 @@ struct device;
@@ -64,7 +26,7 @@ Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
  
  #define DSA_MAX_SWITCHES      4
 -#define DSA_MAX_PORTS         12
-+#define DSA_MAX_PORTS         54
++#define DSA_MAX_PORTS         56
  #define DSA_RTABLE_NONE               -1
  
  struct dsa_chip_data {
@@ -110,43 +72,3 @@ Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
  
        return mask;
  }
---- a/net/dsa/user.c
-+++ b/net/dsa/user.c
-@@ -320,7 +320,7 @@ static int dsa_user_phy_read(struct mii_
- {
-       struct dsa_switch *ds = bus->priv;
--      if (ds->phys_mii_mask & (1 << addr))
-+      if (ds->phys_mii_mask & BIT_ULL(addr))
-               return ds->ops->phy_read(ds, addr, reg);
-       return 0xffff;
-@@ -330,7 +330,7 @@ static int dsa_user_phy_write(struct mii
- {
-       struct dsa_switch *ds = bus->priv;
--      if (ds->phys_mii_mask & (1 << addr))
-+      if (ds->phys_mii_mask & BIT_ULL(addr))
-               return ds->ops->phy_write(ds, addr, reg, val);
-       return 0;
---- a/drivers/net/phy/mdio_bus_provider.c
-+++ b/drivers/net/phy/mdio_bus_provider.c
-@@ -209,7 +209,7 @@ static int mdiobus_scan_bus_c22(struct m
-       int i;
-       for (i = 0; i < PHY_MAX_ADDR; i++) {
--              if ((bus->phy_mask & BIT(i)) == 0) {
-+              if ((bus->phy_mask & BIT_ULL(i)) == 0) {
-                       struct phy_device *phydev;
-                       phydev = mdiobus_scan_c22(bus, i);
-@@ -225,7 +225,7 @@ static int mdiobus_scan_bus_c45(struct m
-       int i;
-       for (i = 0; i < PHY_MAX_ADDR; i++) {
--              if ((bus->phy_mask & BIT(i)) == 0) {
-+              if ((bus->phy_mask & BIT_ULL(i)) == 0) {
-                       struct phy_device *phydev;
-                       /* Don't scan C45 if we already have a C22 device */