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
- bf45143f03
- 2fb02a5745
- 598a16a8d8
Signed-off-by: Andrew LaMarche <andrewjlamarche@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/19081
Signed-off-by: Robert Marko <robimarko@gmail.com>
This commit is contained in:
Andrew LaMarche 2025-06-09 18:49:28 +00:00 committed by Robert Marko
parent d2f9846760
commit b77fa45d12
2 changed files with 22 additions and 5 deletions

View file

@ -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;
}

View file

@ -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)