diff options
| author | Andrew LaMarche | 2025-06-09 18:49:28 +0000 |
|---|---|---|
| committer | Robert Marko | 2025-07-09 12:45:14 +0000 |
| commit | b77fa45d1278443d534919598c0301719fed2784 (patch) | |
| tree | 35fa990bc574caceb882a01872e77dcb28004625 | |
| parent | d2f9846760b9dd97b35b7c6a0b6c40f1a2439845 (diff) | |
| download | openwrt-b77fa45d1278443d534919598c0301719fed2784.tar.gz | |
kernel: fix rtl8261n driver for realtek
The RTL8261N driver does not work correctly on non-mediatek devices. Remove
some of the power controls for Realtek chips.
This assumes the network has been started by the bootloader already:
(rtk network on).
Co-authored-by: Sebastian Gottschall
- https://github.com/mirror/dd-wrt/commit/bf45143f03d40bf259d34bba2151aab46ee011f4
- https://github.com/mirror/dd-wrt/commit/2fb02a5745bb538124a7467b399930b5ca79e71d
- https://github.com/mirror/dd-wrt/commit/598a16a8d801869e09c033f8ca35534289d393cf
Signed-off-by: Andrew LaMarche <andrewjlamarche@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/19081
Signed-off-by: Robert Marko <robimarko@gmail.com>
| -rw-r--r-- | target/linux/generic/files/drivers/net/phy/rtl8261n/phy_patch.c | 17 | ||||
| -rw-r--r-- | target/linux/generic/files/drivers/net/phy/rtl8261n/rtk_phy.c | 10 |
2 files changed, 22 insertions, 5 deletions
diff --git a/target/linux/generic/files/drivers/net/phy/rtl8261n/phy_patch.c b/target/linux/generic/files/drivers/net/phy/rtl8261n/phy_patch.c index f9af3ffe02..7563f67053 100644 --- a/target/linux/generic/files/drivers/net/phy/rtl8261n/phy_patch.c +++ b/target/linux/generic/files/drivers/net/phy/rtl8261n/phy_patch.c @@ -98,6 +98,11 @@ static int32 _phy_patch_process(uint32 unit, rtk_port_t port, uint8 portOffset, return (chk_ret == RT_ERR_CHECK_FAILED) ? chk_ret : RT_ERR_OK; } +rtk_hwpatch_t rtl826XB_patch_rtk_conf[] = { + {RTK_PATCH_OP_PSDS0 , 0xff , 0x07 , 0x10 , 15, 0, 0x80aa, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, + {RTK_PATCH_OP_PSDS0 , 0xff , 0x06 , 0x12 , 15, 0, 0x5078, RTK_PATCH_CMP_WC , 0, 0, 0, 0}, +}; + /* Function Name: * phy_patch * Description: @@ -170,10 +175,14 @@ int32 phy_patch(uint32 unit, rtk_port_t port, uint8 portOffset, uint8 patch_mode break; } } + ret = _phy_patch_process(unit, port, portOffset, rtl826XB_patch_rtk_conf, sizeof(rtl826XB_patch_rtk_conf), patch_mode); + if (ret == RT_ERR_CHECK_FAILED) + chk_ret = ret; + else if (ret != RT_ERR_OK) + { + RT_LOG(LOG_MAJOR_ERR, (MOD_HAL | MOD_PHY), "U%u P%u patch_mode:%u id:%u patch-%u failed. ret:0x%X\n", unit, port, patch_mode, i, patch_type, ret); + return ret; + } return (chk_ret == RT_ERR_CHECK_FAILED) ? chk_ret : RT_ERR_OK; } - - - - diff --git a/target/linux/generic/files/drivers/net/phy/rtl8261n/rtk_phy.c b/target/linux/generic/files/drivers/net/phy/rtl8261n/rtk_phy.c index 23e1d8c4ec..23916a89ef 100644 --- a/target/linux/generic/files/drivers/net/phy/rtl8261n/rtk_phy.c +++ b/target/linux/generic/files/drivers/net/phy/rtl8261n/rtk_phy.c @@ -69,7 +69,9 @@ static int rtkphy_config_init(struct phy_device *phydev) case REALTEK_PHY_ID_RTL8264B: case REALTEK_PHY_ID_RTL8264: phydev_info(phydev, "%s:%u [RTL8261N/RTL8264/RTL826XB] phy_id: 0x%X PHYAD:%d\n", __FUNCTION__, __LINE__, phydev->drv->phy_id, phydev->mdio.addr); - +#ifdef CONFIG_MACH_REALTEK_RTL + return 0; +#endif #if 1 /* toggle reset */ phy_modify_mmd_changed(phydev, 30, 0x145, BIT(0) , 1); @@ -128,7 +130,9 @@ static int rtkphy_c45_suspend(struct phy_device *phydev) { int ret = 0; +#ifndef CONFIG_MACH_REALTEK_RTL ret = rtk_phylib_c45_power_low(phydev); +#endif phydev->speed = SPEED_UNKNOWN; phydev->duplex = DUPLEX_UNKNOWN; @@ -140,7 +144,11 @@ static int rtkphy_c45_suspend(struct phy_device *phydev) static int rtkphy_c45_resume(struct phy_device *phydev) { +#ifndef CONFIG_MACH_REALTEK_RTL return rtk_phylib_c45_power_normal(phydev); +#else + return 0; +#endif } static int rtkphy_c45_config_aneg(struct phy_device *phydev) |