This is an automated email from the ASF dual-hosted git repository. acassis pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit fdaeb00910b527c8bccbea594ec9bd98e73bb4d7 Author: Jukka Laitinen <[email protected]> AuthorDate: Fri Jan 30 08:37:42 2026 +0200 arch/imx9/enet: Move imx9_phy_boardinitialize to "ifup" phase Move the board-specific phy initialization from early boot into ifup phase. The board specific phy initialization may need to implement delays, or bus communication, for example via i2c bus. These OS services are not necessarily available yet in arm64_netinitialize, and PHY initialization is not necessary until the driver actually starts using it. In addition, this allows the board to reset the ethernet phy at every ifup, if needed for error recover. Signed-off-by: Jukka Laitinen <[email protected]> --- arch/arm64/src/imx9/imx9_enet.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/arch/arm64/src/imx9/imx9_enet.c b/arch/arm64/src/imx9/imx9_enet.c index 48bed4f266d..f225916f6fa 100644 --- a/arch/arm64/src/imx9/imx9_enet.c +++ b/arch/arm64/src/imx9/imx9_enet.c @@ -182,6 +182,7 @@ enum phy_type_t struct imx9_driver_s { struct net_driver_s dev; /* Interface understood by the network */ + int intf; /* Interface number within the driver */ const uint32_t base; /* Base address of ENET controller */ const int clk_gate; /* Enet clock gate */ const int irq; /* Enet interrupt */ @@ -2170,6 +2171,17 @@ static int imx9_determine_phy(struct imx9_driver_s *priv) int retries; int ret; +#ifdef CONFIG_IMX9_ENET_PHYINIT + /* Perform any necessary, one-time, board-specific PHY initialization */ + + ret = imx9_phy_boardinitialize(priv->intf); + if (ret < 0) + { + nerr("ERROR: Failed to initialize the PHY: %d\n", ret); + return ret; + } +#endif + for (i = 0; i < priv->n_phys; i++) { priv->phyaddr = (uint8_t)priv->phy_list[i].address_lo; @@ -3201,6 +3213,7 @@ int imx9_netinitialize(int intf) /* Get the interface structure associated with this interface number. */ priv = &g_enet[intf]; + priv->intf = intf; /* Disable the ENET clock */ @@ -3292,17 +3305,6 @@ int imx9_netinitialize(int intf) #endif -#ifdef CONFIG_IMX9_ENET_PHYINIT - /* Perform any necessary, one-time, board-specific PHY initialization */ - - ret = imx9_phy_boardinitialize(intf); - if (ret < 0) - { - nerr("ERROR: Failed to initialize the PHY: %d\n", ret); - return ret; - } -#endif - /* Put the interface in the down state. This usually amounts to resetting * the device and/or calling imx9_ifdown(). */
