From 87f766b53a8fdd746a32d64cad1cd94a82862474 Mon Sep 17 00:00:00 2001 From: David Wu Date: Wed, 20 Apr 2022 14:38:45 +0800 Subject: [PATCH] net: phy: RK630phy: Disable uaps and eee advertised for t22 For some MTK solution routers, there may be link up/down situation, after disable these two function, the problem can be solved, and the power consumption is tested, and there is no increase. Signed-off-by: David Wu Change-Id: I46122188b2fcb67dc02630827b4b631ecfc0ec5e --- drivers/net/phy/rk630phy.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/drivers/net/phy/rk630phy.c b/drivers/net/phy/rk630phy.c index f0128a53785d..7e9072fd9d20 100644 --- a/drivers/net/phy/rk630phy.c +++ b/drivers/net/phy/rk630phy.c @@ -24,6 +24,8 @@ #define RK630_PHY_ID 0x00441400 /* PAGE 0 */ +#define REG_MMD_ACCESS_CONTROL 0x0d +#define REG_MMD_ACCESS_DATA_ADDRESS 0x0e #define REG_INTERRUPT_STATUS 0X10 #define REG_INTERRUPT_MASK 0X11 #define REG_GLOBAL_CONFIGURATION 0X13 @@ -198,6 +200,12 @@ static void rk630_phy_t22_config_init(struct phy_device *phydev) /* Switch to page 0 */ phy_write(phydev, REG_PAGE_SEL, 0x0000); + + /* Disable eee mode advertised */ + phy_write(phydev, REG_MMD_ACCESS_CONTROL, 0x0007); + phy_write(phydev, REG_MMD_ACCESS_DATA_ADDRESS, 0x003c); + phy_write(phydev, REG_MMD_ACCESS_CONTROL, 0x4007); + phy_write(phydev, REG_MMD_ACCESS_DATA_ADDRESS, 0x0000); } static int rk630_phy_config_init(struct phy_device *phydev) @@ -205,6 +213,11 @@ static int rk630_phy_config_init(struct phy_device *phydev) switch (phydev->mdio.addr) { case PHY_ADDR_S40: rk630_phy_s40_config_init(phydev); + /* + * Ultra Auto-Power Saving Mode (UAPS) is designed to + * save power when cable is not plugged into PHY. + */ + rk630_phy_set_uaps(phydev); break; case PHY_ADDR_T22: rk630_phy_t22_config_init(phydev); @@ -216,11 +229,6 @@ static int rk630_phy_config_init(struct phy_device *phydev) } rk630_phy_ieee_set(phydev, true); - /* - * Ultra Auto-Power Saving Mode (UAPS) is designed to - * save power when cable is not plugged into PHY. - */ - rk630_phy_set_uaps(phydev); return 0; }