aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/realtek
diff options
context:
space:
mode:
authorJan Hoffmann <jan@3e8.eu>2022-07-23 22:53:13 +0200
committerDaniel Golle <daniel@makrotopia.org>2022-07-28 14:07:10 +0200
commitbac50e39a7b4f109bb5efed0738c9a896a1c140e (patch)
treedad42ef83dc3f0137d5eee7fdbb5f0bab33dbfbf /target/linux/realtek
parentb2681e584c0674788fc1f11dd9950cb769d961e9 (diff)
downloadupstream-bac50e39a7b4f109bb5efed0738c9a896a1c140e.tar.gz
upstream-bac50e39a7b4f109bb5efed0738c9a896a1c140e.tar.bz2
upstream-bac50e39a7b4f109bb5efed0738c9a896a1c140e.zip
realtek: rtl83xx-phy: fix RTL8214FC media change
Toggle power on the individual PHY instead of the package. Otherwise a media change always toggles power on the first port, and not the one that is being configured. Signed-off-by: Jan Hoffmann <jan@3e8.eu>
Diffstat (limited to 'target/linux/realtek')
-rw-r--r--target/linux/realtek/files-5.10/drivers/net/phy/rtl83xx-phy.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/target/linux/realtek/files-5.10/drivers/net/phy/rtl83xx-phy.c b/target/linux/realtek/files-5.10/drivers/net/phy/rtl83xx-phy.c
index f0c30b3655..2523894891 100644
--- a/target/linux/realtek/files-5.10/drivers/net/phy/rtl83xx-phy.c
+++ b/target/linux/realtek/files-5.10/drivers/net/phy/rtl83xx-phy.c
@@ -949,19 +949,20 @@ static void rtl8380_rtl8214fc_media_set(struct phy_device *phydev, bool set_fibr
pr_info("Current media %x\n", media);
if (media & 0x2) {
pr_info("Powering off COPPER\n");
- phy_package_write_paged(phydev, RTL83XX_PAGE_RAW, RTL821XINT_MEDIA_PAGE_SELECT, RTL821X_MEDIA_PAGE_COPPER);
+ phy_write_paged(phydev, RTL83XX_PAGE_RAW, RTL821XINT_MEDIA_PAGE_SELECT, RTL821X_MEDIA_PAGE_COPPER);
/* Ensure power is off */
- power = phy_package_read_paged(phydev, RTL821X_PAGE_POWER, 0x10);
+ power = phy_read_paged(phydev, RTL821X_PAGE_POWER, 0x10);
if (!(power & (1 << 11)))
- phy_package_write_paged(phydev, RTL821X_PAGE_POWER, 0x10, power | (1 << 11));
+ phy_write_paged(phydev, RTL821X_PAGE_POWER, 0x10, power | (1 << 11));
} else {
- pr_info("Powering off FIBRE");
- phy_package_write_paged(phydev, RTL83XX_PAGE_RAW, RTL821XINT_MEDIA_PAGE_SELECT, RTL821X_MEDIA_PAGE_FIBRE);
+ pr_info("Powering off FIBRE\n");
+ phy_write_paged(phydev, RTL83XX_PAGE_RAW, RTL821XINT_MEDIA_PAGE_SELECT, RTL821X_MEDIA_PAGE_FIBRE);
/* Ensure power is off */
- power = phy_package_read_paged(phydev, RTL821X_PAGE_POWER, 0x10);
+ power = phy_read_paged(phydev, RTL821X_PAGE_POWER, 0x10);
if (!(power & (1 << 11)))
- phy_package_write_paged(phydev, RTL821X_PAGE_POWER, 0x10, power | (1 << 11));
+ phy_write_paged(phydev, RTL821X_PAGE_POWER, 0x10, power | (1 << 11));
}
+ phy_write_paged(phydev, RTL83XX_PAGE_RAW, RTL821XINT_MEDIA_PAGE_SELECT, RTL821X_MEDIA_PAGE_AUTO);
if (set_fibre) {
val |= 1 << 10;
@@ -975,22 +976,21 @@ static void rtl8380_rtl8214fc_media_set(struct phy_device *phydev, bool set_fibr
phy_package_write_paged(phydev, RTL83XX_PAGE_RAW, RTL821XINT_MEDIA_PAGE_SELECT, RTL821X_MEDIA_PAGE_AUTO);
if (set_fibre) {
- pr_info("Powering on FIBRE");
- phy_package_write_paged(phydev, RTL83XX_PAGE_RAW, RTL821XINT_MEDIA_PAGE_SELECT, RTL821X_MEDIA_PAGE_FIBRE);
+ pr_info("Powering on FIBRE\n");
+ phy_write_paged(phydev, RTL83XX_PAGE_RAW, RTL821XINT_MEDIA_PAGE_SELECT, RTL821X_MEDIA_PAGE_FIBRE);
/* Ensure power is off */
- power = phy_package_read_paged(phydev, RTL821X_PAGE_POWER, 0x10);
+ power = phy_read_paged(phydev, RTL821X_PAGE_POWER, 0x10);
if (power & (1 << 11))
- phy_package_write_paged(phydev, RTL821X_PAGE_POWER, 0x10, power & ~(1 << 11));
+ phy_write_paged(phydev, RTL821X_PAGE_POWER, 0x10, power & ~(1 << 11));
} else {
pr_info("Powering on COPPER\n");
- phy_package_write_paged(phydev, RTL83XX_PAGE_RAW, RTL821XINT_MEDIA_PAGE_SELECT, RTL821X_MEDIA_PAGE_COPPER);
+ phy_write_paged(phydev, RTL83XX_PAGE_RAW, RTL821XINT_MEDIA_PAGE_SELECT, RTL821X_MEDIA_PAGE_COPPER);
/* Ensure power is off */
- power = phy_package_read_paged(phydev, RTL821X_PAGE_POWER, 0x10);
+ power = phy_read_paged(phydev, RTL821X_PAGE_POWER, 0x10);
if (power & (1 << 11))
- phy_package_write_paged(phydev, RTL821X_PAGE_POWER, 0x10, power & ~(1 << 11));
+ phy_write_paged(phydev, RTL821X_PAGE_POWER, 0x10, power & ~(1 << 11));
}
-
- phy_package_write_paged(phydev, RTL83XX_PAGE_RAW, RTL821XINT_MEDIA_PAGE_SELECT, RTL821X_MEDIA_PAGE_AUTO);
+ phy_write_paged(phydev, RTL83XX_PAGE_RAW, RTL821XINT_MEDIA_PAGE_SELECT, RTL821X_MEDIA_PAGE_AUTO);
}
static bool rtl8380_rtl8214fc_media_is_fibre(struct phy_device *phydev)