diff --git a/arch/risc-v/src/mpfs/mpfs_ethernet.c b/arch/risc-v/src/mpfs/mpfs_ethernet.c index c6117858058..c329a0a4195 100644 --- a/arch/risc-v/src/mpfs/mpfs_ethernet.c +++ b/arch/risc-v/src/mpfs/mpfs_ethernet.c @@ -3368,6 +3368,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 */ @@ -3518,31 +3529,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");