diff options
| author | Markus Stockhausen | 2026-01-17 18:50:32 +0000 |
|---|---|---|
| committer | Robert Marko | 2026-01-24 10:44:09 +0000 |
| commit | 07bb4f51158be149f5bef54faf9dc545ce2c40d5 (patch) | |
| tree | 46579c31a8c9f6fd35fc7601757102cce1f11a6f | |
| parent | 17f12695d0838681020e598ce231af87057f955f (diff) | |
| download | openwrt-07bb4f51158be149f5bef54faf9dc545ce2c40d5.tar.gz | |
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 <markus.stockhausen@gmx.de>
Link: https://github.com/openwrt/openwrt/pull/21582
Signed-off-by: Robert Marko <robimarko@gmail.com>
| -rw-r--r-- | target/linux/realtek/files-6.12/drivers/net/phy/rtl83xx-phy.c | 8 |
1 files changed, 5 insertions, 3 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 fad43dd8aa..81fa9799fd 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) { |