]> git.ipfire.org Git - thirdparty/openwrt.git/commitdiff
qualcommax: ipq50xx: Add force mode support for qca8k switch
authorGeorge Moussalem <george.moussalem@outlook.com>
Thu, 4 Jun 2026 05:47:51 +0000 (09:47 +0400)
committerRobert Marko <robimarko@gmail.com>
Thu, 4 Jun 2026 20:21:50 +0000 (22:21 +0200)
Force mode is required to support fixed links between the SoC's MAC and
the qca8k switch. As such, add support for force mode in the qca8k DSA
driver and remove the workaround patch that always enables SGMII
auto-negotiation.

Signed-off-by: George Moussalem <george.moussalem@outlook.com>
Link: https://github.com/openwrt/openwrt/pull/23654
Signed-off-by: Robert Marko <robimarko@gmail.com>
target/linux/qualcommax/patches-6.12/0750-net-dsa-qca8k-add-support-for-force-mode-for-fixed-link-topology.patch [new file with mode: 0644]
target/linux/qualcommax/patches-6.12/0751-net-dsa-qca8k-always-enable-SGMII-auto-negotiation.patch [deleted file]

diff --git a/target/linux/qualcommax/patches-6.12/0750-net-dsa-qca8k-add-support-for-force-mode-for-fixed-link-topology.patch b/target/linux/qualcommax/patches-6.12/0750-net-dsa-qca8k-add-support-for-force-mode-for-fixed-link-topology.patch
new file mode 100644 (file)
index 0000000..dcdf902
--- /dev/null
@@ -0,0 +1,49 @@
+From 486e857206fa494a8aaff7d5aa5de2eade034538 Mon Sep 17 00:00:00 2001
+From: George Moussalem <george.moussalem@outlook.com>
+Date: Wed, 03 Jun 2026 11:56:40 +0400
+Subject: [PATCH next-next] net: dsa: qca8k: Add support for force mode for fixed link topology
+MIME-Version: 1.0
+Content-Type: text/plain; charset="utf-8"
+Content-Transfer-Encoding: 7bit
+Message-Id: <20260603-qca8337-force-mode-v1-1-44a4600c9213@outlook.com>
+X-Change-ID: 20260603-qca8337-force-mode-fbcba5296446
+
+A fixed link topology is commonly used to connect this switch (on port
+0 or 6) to a SoC's MAC over SGMII. When inband negotiation is not used,
+the switch needs to be configured to operate in force mode. As such,
+enable support for force mode.
+
+Signed-off-by: George Moussalem <george.moussalem@outlook.com>
+---
+ drivers/net/dsa/qca/qca8k-8xxx.c | 6 +++++-
+ drivers/net/dsa/qca/qca8k.h      | 1 +
+ 2 files changed, 6 insertions(+), 1 deletion(-)
+
+--- a/drivers/net/dsa/qca/qca8k-8xxx.c
++++ b/drivers/net/dsa/qca/qca8k-8xxx.c
+@@ -1611,10 +1611,14 @@ static int qca8k_pcs_config(struct phyli
+       if (priv->ports_config.sgmii_tx_clk_falling_edge)
+               val |= QCA8K_PORT0_PAD_SGMII_TXCLK_FALLING_EDGE;
++      if (neg_mode == PHYLINK_PCS_NEG_OUTBAND)
++              val |= QCA8K_PORT_PAD_SGMII_FORCE_MODE;
++
+       if (val)
+               ret = qca8k_rmw(priv, reg,
+                               QCA8K_PORT0_PAD_SGMII_RXCLK_FALLING_EDGE |
+-                              QCA8K_PORT0_PAD_SGMII_TXCLK_FALLING_EDGE,
++                              QCA8K_PORT0_PAD_SGMII_TXCLK_FALLING_EDGE |
++                              QCA8K_PORT_PAD_SGMII_FORCE_MODE,
+                               val);
+       return 0;
+--- a/drivers/net/dsa/qca/qca8k.h
++++ b/drivers/net/dsa/qca/qca8k.h
+@@ -58,6 +58,7 @@
+ #define         QCA8K_PORT_PAD_RGMII_TX_DELAY_EN              BIT(25)
+ #define   QCA8K_PORT_PAD_RGMII_RX_DELAY_EN            BIT(24)
+ #define   QCA8K_PORT_PAD_SGMII_EN                     BIT(7)
++#define   QCA8K_PORT_PAD_SGMII_FORCE_MODE             BIT(3)
+ #define QCA8K_REG_PWS                                 0x010
+ #define   QCA8K_PWS_POWER_ON_SEL                      BIT(31)
+ /* This reg is only valid for QCA832x and toggle the package
diff --git a/target/linux/qualcommax/patches-6.12/0751-net-dsa-qca8k-always-enable-SGMII-auto-negotiation.patch b/target/linux/qualcommax/patches-6.12/0751-net-dsa-qca8k-always-enable-SGMII-auto-negotiation.patch
deleted file mode 100644 (file)
index 48f3550..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-From d7a41a3ab6b8e3a3158997cda13f1fe28a37268c Mon Sep 17 00:00:00 2001
-From: Ziyang Huang <hzyitc@outlook.com>
-Date: Sun, 8 Sep 2024 16:40:12 +0800
-Subject: [PATCH] net: dsa: qca8k: always enable SGMII auto-negotiation
-
-fixed-link can't work well without this
-
-Signed-off-by: Ziyang Huang <hzyitc@outlook.com>
----
- drivers/net/dsa/qca/qca8k-8xxx.c | 9 ++++-----
- 1 file changed, 4 insertions(+), 5 deletions(-)
-
---- a/drivers/net/dsa/qca/qca8k-8xxx.c
-+++ b/drivers/net/dsa/qca/qca8k-8xxx.c
-@@ -1557,11 +1557,10 @@ static int qca8k_pcs_config(struct phyli
-               return -EINVAL;
-       }
--      /* Enable/disable SerDes auto-negotiation as necessary */
--      val = neg_mode == PHYLINK_PCS_NEG_INBAND_ENABLED ?
--              0 : QCA8K_PWS_SERDES_AEN_DIS;
--
--      ret = qca8k_rmw(priv, QCA8K_REG_PWS, QCA8K_PWS_SERDES_AEN_DIS, val);
-+      /* Enable SerDes auto-negotiation always.
-+       * So fixed-link can work.
-+       */
-+      ret = qca8k_rmw(priv, QCA8K_REG_PWS, QCA8K_PWS_SERDES_AEN_DIS, 0);
-       if (ret)
-               return ret;