]> git.ipfire.org Git - thirdparty/openwrt.git/commitdiff
realtek: phy: save RTL8214FC extended page during power set
authorMarkus Stockhausen <markus.stockhausen@gmx.de>
Sun, 18 Jan 2026 11:58:51 +0000 (12:58 +0100)
committerRobert Marko <robimarko@gmail.com>
Sat, 24 Jan 2026 10:44:09 +0000 (11:44 +0100)
Changing the fibre/copper power of a RTL8214FC changes the
extended page via register 29. This is the write only companion
of register 30. The register is afterwards overwritten to 0.

Use the proper extended page register 30 and preserve its content
during the operation.

Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
Link: https://github.com/openwrt/openwrt/pull/21582
Signed-off-by: Robert Marko <robimarko@gmail.com>
target/linux/realtek/files-6.12/drivers/net/phy/rtl83xx-phy.c

index 81fa9799fd25761911c3cb553709363b0b73e66e..8d0700d5ca076bf0a45ef5aca18fa146b3eb3e1a 100644 (file)
@@ -466,14 +466,15 @@ static bool rtl8214fc_media_is_fibre(struct phy_device *phydev)
 static void rtl8214fc_power_set(struct phy_device *phydev, int port, bool on)
 {
        int page = port == PORT_FIBRE ? RTL821X_MEDIA_PAGE_FIBRE : RTL821X_MEDIA_PAGE_COPPER;
+       int oldxpage = __phy_read(phydev, RTL821XEXT_MEDIA_PAGE_SELECT);
        int pdown = on ? 0 : BMCR_PDOWN;
 
        phydev_info(phydev, "power %s %s\n", on ? "on" : "off",
                    port == PORT_FIBRE ? "fibre" : "copper");
 
-       phy_write(phydev, RTL821XINT_MEDIA_PAGE_SELECT, page);
+       phy_write(phydev, RTL821XEXT_MEDIA_PAGE_SELECT, page);
        phy_modify_paged(phydev, RTL821X_PAGE_POWER, 0x10, BMCR_PDOWN, pdown);
-       phy_write(phydev, RTL821XINT_MEDIA_PAGE_SELECT, RTL821X_MEDIA_PAGE_AUTO);
+       phy_write(phydev, RTL821XEXT_MEDIA_PAGE_SELECT, oldxpage);
 }
 
 static int rtl8214fc_suspend(struct phy_device *phydev)