From: Markus Stockhausen Date: Sat, 17 Jan 2026 18:50:32 +0000 (+0100) Subject: realtek: phy: convert confusing BMCR_PDOWN usage for RTL8214FC X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=07bb4f51158be149f5bef54faf9dc545ce2c40d5;p=thirdparty%2Fopenwrt.git realtek: phy: convert confusing BMCR_PDOWN usage for RTL8214FC Bit 11 of registers 16, 19, 20, 21 in page 0x266 denotes if a port of a RTL8214FC is set/favoured to fibre (0) or copper (1). For unknown reasons the bit was mixed with BMCR_PDOWN. Convert this to a meaningful define. Signed-off-by: Markus Stockhausen Link: https://github.com/openwrt/openwrt/pull/21582 Signed-off-by: Robert Marko --- 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 fad43dd8aa0..81fa9799fd2 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 @@ -57,6 +57,8 @@ extern struct rtl83xx_soc_info soc_info; #define RTL821X_JOIN_LAST 1 #define RTL821X_JOIN_OTHER 2 +#define RTL8214FC_MEDIA_COPPER BIT(11) + static const struct firmware rtl838x_8380_fw; static const struct firmware rtl838x_8218b_fw; @@ -447,7 +449,7 @@ static bool __rtl8214fc_media_is_fibre(struct phy_device *phydev) __phy_write(basephy, RTL821XEXT_MEDIA_PAGE_SELECT, oldxpage); __phy_write(basephy, RTL8XXX_PAGE_SELECT, oldpage); - return !(val & BMCR_PDOWN); + return !(val & RTL8214FC_MEDIA_COPPER); } static bool rtl8214fc_media_is_fibre(struct phy_device *phydev) @@ -495,13 +497,13 @@ 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 pdown = set_fibre ? 0 : BMCR_PDOWN; + 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_modify_paged(basephy, RTL821X_PAGE_PORT, reg, BMCR_PDOWN, pdown); + 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); if (!phydev->suspended) {