[openwrt/openwrt] kernel: rtl8261n: Add support for Serdes RX swap
LEDE Commits
lede-commits at lists.infradead.org
Wed Oct 29 11:37:30 PDT 2025
ansuel pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/2b773bddeb7695076691e3247efcf0b604a2154a
commit 2b773bddeb7695076691e3247efcf0b604a2154a
Author: Richard Huynh <voxlympha at gmail.com>
AuthorDate: Sun Oct 19 21:52:59 2025 +1100
kernel: rtl8261n: Add support for Serdes RX swap
Datasheet claims this register bit is supposed to be set by default,
however it was found in practice to not be, and OEM drivers would set
this bit at the same time.
Signed-off-by: Richard Huynh <voxlympha at gmail.com>
Link: https://github.com/openwrt/openwrt/pull/20465
Signed-off-by: Christian Marangi <ansuelsmth at gmail.com>
---
target/linux/generic/files/drivers/net/phy/rtl8261n/rtk_phy.c | 6 ++++++
target/linux/generic/files/drivers/net/phy/rtl8261n/rtk_phylib.h | 1 +
2 files changed, 7 insertions(+)
diff --git a/target/linux/generic/files/drivers/net/phy/rtl8261n/rtk_phy.c b/target/linux/generic/files/drivers/net/phy/rtl8261n/rtk_phy.c
index faa057f029..a1eb2c1614 100644
--- a/target/linux/generic/files/drivers/net/phy/rtl8261n/rtk_phy.c
+++ b/target/linux/generic/files/drivers/net/phy/rtl8261n/rtk_phy.c
@@ -61,6 +61,7 @@ static int rtl826xb_probe(struct phy_device *phydev)
priv->phytype = (phydev->drv->phy_id == REALTEK_PHY_ID_RTL8261N) ? (RTK_PHYLIB_RTL8261N) : (RTK_PHYLIB_RTL8264B);
priv->isBasePort = (phydev->drv->phy_id == REALTEK_PHY_ID_RTL8261N) ? (1) : (((phydev->mdio.addr % 4) == 0) ? (1) : (0));
+ priv->pnswap_rx = device_property_read_bool(dev, "realtek,pnswap-rx");
priv->pnswap_tx = device_property_read_bool(dev, "realtek,pnswap-tx");
phydev->priv = priv;
@@ -125,6 +126,11 @@ static int rtkphy_config_init(struct phy_device *phydev)
}
#endif
+ if (priv->pnswap_rx)
+ phy_set_bits_mmd(phydev, MDIO_MMD_VEND1,
+ REALTEK_SERDES_GLOBAL_CFG,
+ REALTEK_HSI_INV);
+
if (priv->pnswap_tx)
phy_set_bits_mmd(phydev, MDIO_MMD_VEND1,
REALTEK_SERDES_GLOBAL_CFG,
diff --git a/target/linux/generic/files/drivers/net/phy/rtl8261n/rtk_phylib.h b/target/linux/generic/files/drivers/net/phy/rtl8261n/rtk_phylib.h
index c94e9cb966..c1253b1ec9 100644
--- a/target/linux/generic/files/drivers/net/phy/rtl8261n/rtk_phylib.h
+++ b/target/linux/generic/files/drivers/net/phy/rtl8261n/rtk_phylib.h
@@ -51,6 +51,7 @@ struct rtk_phy_priv {
uint8 isBasePort;
rt_phy_patch_db_t *patch;
+ bool pnswap_rx;
bool pnswap_tx;
};
More information about the lede-commits
mailing list