From a31689c507ef1fa54ee5c0dace8e3e7ca64901b2 Mon Sep 17 00:00:00 2001 From: Jani Paalijarvi Date: Thu, 22 Aug 2024 14:45:05 +0300 Subject: [PATCH] arch/risc-v/src/mpfs/mpfs_ethernet.c: Remove unnecessary phyinit mpfs_phyinit() was called twice during ifup(). Signed-off-by: Jani Paalijarvi --- arch/risc-v/src/mpfs/mpfs_ethernet.c | 31 ++++++++++------------------ 1 file changed, 11 insertions(+), 20 deletions(-) diff --git a/arch/risc-v/src/mpfs/mpfs_ethernet.c b/arch/risc-v/src/mpfs/mpfs_ethernet.c index b11226afd88e3..37dd1eef23e7c 100644 --- a/arch/risc-v/src/mpfs/mpfs_ethernet.c +++ b/arch/risc-v/src/mpfs/mpfs_ethernet.c @@ -3350,6 +3350,17 @@ static int mpfs_phyinit(struct mpfs_ethmac_s *priv) { int ret = -EINVAL; +#ifdef CONFIG_MPFS_PHYINIT + /* Perform any necessary, board-specific PHY initialization */ + + ret = mpfs_phy_boardinitialize(priv->intf); + if (ret < 0) + { + nerr("ERROR: Failed to initialize the PHY: %d\n", ret); + return ret; + } +#endif + #ifdef ETH_HAS_MDIO_PHY /* Configure PHY clocking */ @@ -3496,31 +3507,11 @@ static int mpfs_ethconfig(struct mpfs_ethmac_s *priv) ninfo("Entry\n"); -#ifdef CONFIG_MPFS_PHYINIT - /* Perform any necessary, board-specific PHY initialization */ - - ret = mpfs_phy_boardinitialize(priv->intf); - if (ret < 0) - { - nerr("ERROR: Failed to initialize the PHY: %d\n", ret); - return ret; - } -#endif - /* Reset the Ethernet block */ ninfo("Reset the Ethernet block\n"); mpfs_ethreset(priv); - /* Initialize the PHY */ - - ninfo("Initialize the PHY\n"); - ret = mpfs_phyinit(priv); - if (ret < 0) - { - return ret; - } - /* Initialize the MAC and DMA */ ninfo("Initialize the MAC and DMA\n");