RE: [PATCH net] net: enetc: fix fallback PHY address handling and do not skip setting for addr 0

From: Clark Wang

Date: Wed Mar 04 2026 - 02:33:09 EST


> The current netc_get_phy_addr() implementation falls back to PHY address
> 0 when the "mdio" node or any PHY child node is missing. On i.MX95, this
> causes failures when a real PHY is actually assigned address 0 and is
> managed through the EMDIO interface, the bit 0 of phy_mask becomes set,
> leading imx95_enetc_mdio_phyaddr_config() to return an error, and the
> netc_blk_ctrl driver probe subsequently fails. Fix this by returning
> -ENODEV when neither an "mdio" node nor any PHY node is present.
>
> Given that some platforms may use PHY address 0 (I suppose the PHY may
> not treat address 0 as a broadcast address or default response address).
> It is possible for some boards to connect multiple PHYs to a single
> ENETC MAC, for example:
>
> - a SGMII PHY with a non-zero address (selected via DTS_A)
> - a RGMII PHY with address 0 (selected via DTS_B)
>
> For the case where the ENETC port MDIO is used to manage the PHY, when
> switching from DTS_A to DTS_B via soft reboot,
> LaBCR[MDIO_PHYAD_PRTAD]
> must be updated to 0 because the NETCMIX block is not reset during soft
> reboot. However, the current driver explicitly skips configuring address
> 0, which leaves the hardware in an inconsistent state.
>
> Therefore, remove the special-case skip of PHY address 0 so that valid
> configurations using address 0 are properly supported.
>
> Reported-by: Alexander Stein <alexander.stein@xxxxxxxxxxxxxxx>
> Closes: https://lore.kernel.org/all/7825188.GXAFRqVoOG@steina-w
> Fixes: 6633df05f3ad ("net: enetc: set the external PHY address in IERB for
> port MDIO usage")
> Fixes: 50bfd9c06f0f ("net: enetc: set external PHY address in IERB for i.MX94
> ENETC")
> Signed-off-by: Wei Fang <wei.fang@xxxxxxx>

Reviewed-by: Clark Wang <xiaoning.wang@xxxxxxx>

Thanks!
Clark Wang