From 4542b17102eac99de0eb8801392dfe57c30225d0 Mon Sep 17 00:00:00 2001 From: Yanhong Wang Date: Fri, 24 Mar 2023 10:28:48 +0800 Subject: net: phy: motorcomm: Move ytphy_of_config function call to startup function In order to dynamically adjust the phy clock delay configuration, so move ytphy_of_config function call to startup function. Signed-off-by: Yanhong Wang --- drivers/net/phy/motorcomm.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/net/phy/motorcomm.c b/drivers/net/phy/motorcomm.c index 94142a5a5a..6e8beac30e 100644 --- a/drivers/net/phy/motorcomm.c +++ b/drivers/net/phy/motorcomm.c @@ -96,6 +96,8 @@ static const struct ytphy_reg_field ytphy_rxden_grp[] = { { "rxc_dly_en", 1, 8, 0x1 } }; +static int ytphy_of_config(struct phy_device *phydev); + static int ytphy_read_ext(struct phy_device *phydev, u32 regnum) { int ret; @@ -194,6 +196,11 @@ static int ytphy_startup(struct phy_device *phydev) { int retval; + /*set delay config*/ + retval = ytphy_of_config(phydev); + if (retval < 0) + return retval; + retval = genphy_update_link(phydev); if (retval) return retval; @@ -256,6 +263,7 @@ static int ytphy_of_config(struct phy_device *phydev) cfg = ofnode_read_u32_default(node, ytphy_rxtxd_grp[i].name, ~0); + cfg = (cfg != -1) ? cfg : ytphy_rxtxd_grp[i].dflt; /*check the cfg overflow or not*/ @@ -369,10 +377,6 @@ static int yt8531_config(struct phy_device *phydev) ret = 0; genphy_config_aneg(phydev); - /*set delay config*/ - ret = ytphy_of_config(phydev); - if (ret < 0) - return ret; return 0; } -- cgit v1.2.3