[openwrt/openwrt] realtek: phy: optimize RTL8214FC register usage during media set
LEDE Commits
lede-commits at lists.infradead.org
Sat Jan 24 02:44:15 PST 2026
robimarko pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/45fb8f9739272fc6d12ee4bc44cae5c217341a10
commit 45fb8f9739272fc6d12ee4bc44cae5c217341a10
Author: Markus Stockhausen <markus.stockhausen at gmx.de>
AuthorDate: Sun Jan 18 13:05:30 2026 +0100
realtek: phy: optimize RTL8214FC register usage during media set
There are some shortcomings in rtl8214fc_media_set()
- It always uses the mdio raw page (4095) of RTL838x for writes.
That is wrong when the phy is attached to an RTL839x (raw = 8191)
- It uses the internal write only extended page companion (29)
- The extended page content is not preserved
Fix the three issues.
Signed-off-by: Markus Stockhausen <markus.stockhausen at gmx.de>
Link: https://github.com/openwrt/openwrt/pull/21582
Signed-off-by: Robert Marko <robimarko at gmail.com>
---
target/linux/realtek/files-6.12/drivers/net/phy/rtl83xx-phy.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/target/linux/realtek/files-6.12/drivers/net/phy/rtl83xx-phy.c b/target/linux/realtek/files-6.12/drivers/net/phy/rtl83xx-phy.c
index 8d0700d5ca..b47e88aa98 100644
--- a/target/linux/realtek/files-6.12/drivers/net/phy/rtl83xx-phy.c
+++ b/target/linux/realtek/files-6.12/drivers/net/phy/rtl83xx-phy.c
@@ -498,14 +498,15 @@ static int rtl8214fc_resume(struct phy_device *phydev)
static void rtl8214fc_media_set(struct phy_device *phydev, bool set_fibre)
{
struct phy_device *basephy = get_base_phy(phydev);
+ int oldxpage = phy_read(basephy, RTL821XEXT_MEDIA_PAGE_SELECT);
int copper = set_fibre ? 0 : RTL8214FC_MEDIA_COPPER;
static int regs[] = {16, 19, 20, 21};
int reg = regs[phydev->mdio.addr & 3];
phydev_info(phydev, "switch to %s\n", set_fibre ? "fibre" : "copper");
- phy_write_paged(basephy, RTL838X_PAGE_RAW, RTL821XINT_MEDIA_PAGE_SELECT, RTL821X_MEDIA_PAGE_INTERNAL);
+ phy_write(basephy, RTL821XEXT_MEDIA_PAGE_SELECT, RTL821X_MEDIA_PAGE_INTERNAL);
phy_modify_paged(basephy, RTL821X_PAGE_PORT, reg, RTL8214FC_MEDIA_COPPER, copper);
- phy_write_paged(basephy, RTL838X_PAGE_RAW, RTL821XINT_MEDIA_PAGE_SELECT, RTL821X_MEDIA_PAGE_AUTO);
+ phy_write(basephy, RTL821XEXT_MEDIA_PAGE_SELECT, oldxpage);
if (!phydev->suspended) {
rtl8214fc_power_set(phydev, PORT_MII, !set_fibre);
More information about the lede-commits
mailing list