]> git.ipfire.org Git - thirdparty/openwrt.git/commitdiff
bmips: update BCM531x5 RGMII delays patch 19107/head
authorÁlvaro Fernández Rojas <noltari@gmail.com>
Wed, 11 Jun 2025 07:46:44 +0000 (09:46 +0200)
committerÁlvaro Fernández Rojas <noltari@gmail.com>
Wed, 18 Jun 2025 09:12:00 +0000 (11:12 +0200)
Replace BCM531x5 patch with the one sent upstream.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
target/linux/bmips/bcm6318/config-6.12
target/linux/bmips/bcm63268/config-6.12
target/linux/bmips/bcm6328/config-6.12
target/linux/bmips/bcm6358/config-6.12
target/linux/bmips/bcm6362/config-6.12
target/linux/bmips/bcm6368/config-6.12
target/linux/bmips/patches-6.12/110-net-dsa-b53-bcm531x5-fix-cpu-rgmii-mode-interpretation.patch [new file with mode: 0644]
target/linux/bmips/patches-6.12/110-net-dsa-b53-invert-bcm531x5-rgmii-delay-heuristic.patch [deleted file]

index 746ba1fc179abc2d4d17d988a5e76c24e394424e..71133429576002ce09eea03690d79617550358d9 100644 (file)
@@ -7,6 +7,7 @@ CONFIG_ARCH_SUSPEND_POSSIBLE=y
 CONFIG_B53=y
 CONFIG_B53_MDIO_DRIVER=y
 CONFIG_B53_MMAP_DRIVER=y
+# CONFIG_B53_QUIRK_IMP_RGMII_IMPLIES_DELAYS is not set
 CONFIG_B53_SPI_DRIVER=y
 CONFIG_BCM6345_EXT_IRQ=y
 CONFIG_BCM6345_L1_IRQ=y
index 8d692322d826c08db1a0202f00473a4a2d5791d7..29cfd9fc955181a7ca75e860c2ade799757d7933 100644 (file)
@@ -7,6 +7,7 @@ CONFIG_ARCH_SUSPEND_POSSIBLE=y
 CONFIG_B53=y
 CONFIG_B53_MDIO_DRIVER=y
 CONFIG_B53_MMAP_DRIVER=y
+# CONFIG_B53_QUIRK_IMP_RGMII_IMPLIES_DELAYS is not set
 CONFIG_B53_SPI_DRIVER=y
 CONFIG_BCM6345_EXT_IRQ=y
 CONFIG_BCM6345_L1_IRQ=y
index fd7a058381af9bb310ee819965f891020f913f39..20e365dfba13d53b416acb61558ff35dee881f13 100644 (file)
@@ -7,6 +7,7 @@ CONFIG_ARCH_SUSPEND_POSSIBLE=y
 CONFIG_B53=y
 CONFIG_B53_MDIO_DRIVER=y
 CONFIG_B53_MMAP_DRIVER=y
+# CONFIG_B53_QUIRK_IMP_RGMII_IMPLIES_DELAYS is not set
 CONFIG_B53_SPI_DRIVER=y
 CONFIG_BCM6345_EXT_IRQ=y
 CONFIG_BCM6345_L1_IRQ=y
index 7f5da923968dfc73735d3ff9de607a52a532fb00..60e1f3ec8f5d30008f40890f079aa84c2744f6a7 100644 (file)
@@ -6,6 +6,7 @@ CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MAX=15
 CONFIG_ARCH_SUSPEND_POSSIBLE=y
 CONFIG_B53=y
 CONFIG_B53_MDIO_DRIVER=y
+# CONFIG_B53_QUIRK_IMP_RGMII_IMPLIES_DELAYS is not set
 CONFIG_B53_SPI_DRIVER=y
 CONFIG_BCM6345_EXT_IRQ=y
 CONFIG_BCM6345_L1_IRQ=y
index 2eef21a31ab4b70e1834967f1620a1ee14eeb5ee..68b1526b385352d520a4936997000f2b77c201a3 100644 (file)
@@ -7,6 +7,7 @@ CONFIG_ARCH_SUSPEND_POSSIBLE=y
 CONFIG_B53=y
 CONFIG_B53_MDIO_DRIVER=y
 CONFIG_B53_MMAP_DRIVER=y
+# CONFIG_B53_QUIRK_IMP_RGMII_IMPLIES_DELAYS is not set
 CONFIG_B53_SPI_DRIVER=y
 CONFIG_BCM6345_EXT_IRQ=y
 CONFIG_BCM6345_L1_IRQ=y
index 9c7b27be441ac7ea4a81281d20807cb33f9d85a6..7633c8e838b273513fb5cc385904ea5eaae3bef7 100644 (file)
@@ -7,6 +7,7 @@ CONFIG_ARCH_SUSPEND_POSSIBLE=y
 CONFIG_B53=y
 CONFIG_B53_MDIO_DRIVER=y
 CONFIG_B53_MMAP_DRIVER=y
+# CONFIG_B53_QUIRK_IMP_RGMII_IMPLIES_DELAYS is not set
 CONFIG_B53_SPI_DRIVER=y
 CONFIG_BCM6345_EXT_IRQ=y
 CONFIG_BCM6345_L1_IRQ=y
diff --git a/target/linux/bmips/patches-6.12/110-net-dsa-b53-bcm531x5-fix-cpu-rgmii-mode-interpretation.patch b/target/linux/bmips/patches-6.12/110-net-dsa-b53-bcm531x5-fix-cpu-rgmii-mode-interpretation.patch
new file mode 100644 (file)
index 0000000..30f346f
--- /dev/null
@@ -0,0 +1,111 @@
+From d9fa3835bb8913757c74af96fa8db0d621e2e980 Mon Sep 17 00:00:00 2001
+From: Jonas Gorski <jonas.gorski@gmail.com>
+Date: Mon, 9 Jun 2025 11:18:24 +0200
+Subject: [PATCH] net: dsa: b53: bcm531x5: fix cpu rgmii mode interpretation
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+b53_adjust_531x5_rgmii() incorrectly enable delays in rgmii mode, but
+disables them in rgmii-id mode. Only rgmii-txid is correctly handled.
+
+Fix this by correctly enabling rx delay in rgmii-rxid and rgmii-id
+modes, and tx delay in rgmii-txid and rgmii-id modes.
+
+Since b53_adjust_531x5_rgmii() is only called for fixed-link ports,
+these are usually used as the CPU port, connected to a MAC. This means
+the chip is assuming the role of the PHY and enabling delays is
+expected.
+
+Since this has the potential to break existing setups, add a config
+options to treat rgmii as rgmii-id, and enable it by default.
+
+I only made the quirk fixup rgmii to rgmii-id, but not rgmii-id to
+rgmii, or no delays for rgmii-rxid. My reasoning is that
+
+a) Boards not requiring internal delays are probably rather seldom, so I
+   considered the likelyhood requiring/wrongly specifying rgmii-id when
+   they need rgmii as very unlikely.
+   And if they understand the difference enough to know to use the
+   "wrong" mode, they would have hopefully noticed the discrepancy and
+   reported the issue by now.
+b) I don't want to require new users to wrongly use rgmii to get
+   rgmii-id behavior with the quirk enabled.
+
+Fixes: 967dd82ffc52 ("net: dsa: b53: Add support for Broadcom RoboSwitch")
+Reported-by: Álvaro Fernández Rojas <noltari@gmail.com>
+Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
+---
+ drivers/net/dsa/b53/Kconfig      | 10 ++++++++++
+ drivers/net/dsa/b53/b53_common.c | 33 +++++++++++++++++++++++---------
+ 2 files changed, 34 insertions(+), 9 deletions(-)
+
+--- a/drivers/net/dsa/b53/Kconfig
++++ b/drivers/net/dsa/b53/Kconfig
+@@ -47,3 +47,13 @@ config B53_SERDES
+       default ARCH_BCM_NSP
+       help
+         Select to enable support for SerDes on e.g: Northstar Plus SoCs.
++
++config B53_QUIRK_IMP_RGMII_IMPLIES_DELAYS
++      bool "Treat RGMII as RGMII-ID for CPU port"
++      depends on B53
++      default y
++      help
++        Select to enable RGMII delays also in RGMII (no ID) mode for the CPU
++        port to mirror old driver behavior.
++        Enable this if your board wrongly uses RGMII instead of RGMII-ID as
++        the phy interface, but actually requires internal delays enabled.
+--- a/drivers/net/dsa/b53/b53_common.c
++++ b/drivers/net/dsa/b53/b53_common.c
+@@ -1426,6 +1426,16 @@ static void b53_adjust_531x5_rgmii(struc
+       else
+               off = B53_RGMII_CTRL_P(port);
++      if (IS_ENABLED(CONFIG_B53_QUIRK_IMP_RGMII_IMPLIES_DELAYS) &&
++          interface == PHY_INTERFACE_MODE_RGMII) {
++              /* Older driver versions incorrectly applied delays in
++               * PHY_INTERFACE_MODE_RGMII mode.
++               *
++               * So fixup the interface to match the old behavior.
++               */
++              interface = PHY_INTERFACE_MODE_RGMII_ID;
++      }
++
+       /* Configure the port RGMII clock delay by DLL disabled and
+        * tx_clk aligned timing (restoring to reset defaults)
+        */
+@@ -1437,19 +1447,24 @@ static void b53_adjust_531x5_rgmii(struc
+        * account for this internal delay that is inserted, otherwise
+        * the switch won't be able to receive correctly.
+        *
++       * PHY_INTERFACE_MODE_RGMII_RXID means RX internal delay, make
++       * sure that we enable the port RX clock internal sampling delay
++       * to account for this internal delay that is inserted, otherwise
++       * the switch won't be able to send correctly.
++       *
++       * PHY_INTERFACE_MODE_RGMII_ID means both RX and TX internal delay,
++       * make sure that we enable delays for both.
++       *
+        * PHY_INTERFACE_MODE_RGMII means that we are not introducing
+        * any delay neither on transmission nor reception, so the
+-       * BCM53125 must also be configured accordingly to account for
+-       * the lack of delay and introduce
+-       *
+-       * The BCM53125 switch has its RX clock and TX clock control
+-       * swapped, hence the reason why we modify the TX clock path in
+-       * the "RGMII" case
++       * BCM53125 must also be configured accordingly.
+        */
+-      if (interface == PHY_INTERFACE_MODE_RGMII_TXID)
++      if (interface == PHY_INTERFACE_MODE_RGMII_TXID ||
++          interface == PHY_INTERFACE_MODE_RGMII_ID)
+               rgmii_ctrl |= RGMII_CTRL_DLL_TXC;
+-      if (interface == PHY_INTERFACE_MODE_RGMII)
+-              rgmii_ctrl |= RGMII_CTRL_DLL_TXC | RGMII_CTRL_DLL_RXC;
++      if (interface == PHY_INTERFACE_MODE_RGMII_RXID ||
++          interface == PHY_INTERFACE_MODE_RGMII_ID)
++              rgmii_ctrl |= RGMII_CTRL_DLL_RXC;
+       if (dev->chip_id != BCM53115_DEVICE_ID)
+               rgmii_ctrl |= RGMII_CTRL_TIMING_SEL;
diff --git a/target/linux/bmips/patches-6.12/110-net-dsa-b53-invert-bcm531x5-rgmii-delay-heuristic.patch b/target/linux/bmips/patches-6.12/110-net-dsa-b53-invert-bcm531x5-rgmii-delay-heuristic.patch
deleted file mode 100644 (file)
index 2c3e27c..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-From eb9e6142ac5f42beee48c9ec8edf1da3a3d7ff81 Mon Sep 17 00:00:00 2001
-From: Jonas Gorski <jonas.gorski@gmail.com>
-Date: Thu, 5 Jun 2025 16:39:20 +0200
-Subject: [PATCH] net: dsa: b53: invert bcm531x5 rgmii delay heuristic
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-When configuring the RGMII port for BCM531x5, we are only doing so in
-MLO_AN_FIXED, i.e. fixed link mode. This implies this port is used as
-cpu port and thus connected to an ethernet mac, so the switch takes the
-role of the PHY.
-
-Therefore we need to enable delays when the interface mode is rgmii-id,
-and not rgmii. Enabling delays for rgmii is wrong in any case.
-
-Also update the comment with the incomplete sentence to match what we
-are now doing, and add a comment about rgmii-id.
-
-Luckily there are at least no in-tree users of rgmii or rgmii-id mode
-that would be affected, as the only user with a defined link mode uses
-rgmii-txid, which we already handle correctly.
-
-Fixes: 967dd82ffc52 ("net: dsa: b53: Add support for Broadcom RoboSwitch")
-Reported-by: Álvaro Fernández Rojas <noltari@gmail.com>
-Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
----
- drivers/net/dsa/b53/b53_common.c | 13 ++++++-------
- 1 file changed, 6 insertions(+), 7 deletions(-)
-
---- a/drivers/net/dsa/b53/b53_common.c
-+++ b/drivers/net/dsa/b53/b53_common.c
-@@ -1363,16 +1363,15 @@ static void b53_adjust_531x5_rgmii(struc
-        *
-        * PHY_INTERFACE_MODE_RGMII means that we are not introducing
-        * any delay neither on transmission nor reception, so the
--       * BCM53125 must also be configured accordingly to account for
--       * the lack of delay and introduce
--       *
--       * The BCM53125 switch has its RX clock and TX clock control
--       * swapped, hence the reason why we modify the TX clock path in
--       * the "RGMII" case
-+       * BCM53125 must also be configured accordingly, and not enable
-+       * either delay.
-+       * 
-+       * PHY_INTERFACE_MODE_RGMII_ID means both TX internal delay and RX
-+       * interal delay, so enable delay on both paths.
-        */
-       if (interface == PHY_INTERFACE_MODE_RGMII_TXID)
-               rgmii_ctrl |= RGMII_CTRL_DLL_TXC;
--      if (interface == PHY_INTERFACE_MODE_RGMII)
-+      if (interface == PHY_INTERFACE_MODE_RGMII_ID)
-               rgmii_ctrl |= RGMII_CTRL_DLL_TXC | RGMII_CTRL_DLL_RXC;
-       if (dev->chip_id != BCM53115_DEVICE_ID)