[PATCH v2] net: phy: Use PHY MDIO address from DT if available

Paul Barker paul.barker.ct at bp.renesas.com
Sun Jan 28 23:05:48 CET 2024


On 28/01/2024 01:19, Marek Vasut wrote:
> In case the PHY is fully described in DT, use PHY MDIO address
> from DT directly instead of always using auto-detection. This
> also fixes the behavior of 'mdio list' in such DT setup, which
> now prints the PHY connected to the MAC correctly.
> 
> Signed-off-by: Marek Vasut <marek.vasut+renesas at mailbox.org>
> ---
> Cc: Joe Hershberger <joe.hershberger at ni.com>
> Cc: Paul Barker <paul.barker.ct at bp.renesas.com>
> Cc: Ramon Fried <rfried.dev at gmail.com>
> ---
> V2: This patch is generic replacement for
>     - net: ravb: Use PHY MDIO address from DT if available
>     - net: sh_eth: Use PHY MDIO address from DT if available
> ---
>  drivers/net/phy/ethernet_id.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/net/phy/ethernet_id.c b/drivers/net/phy/ethernet_id.c
> index 877a51c3d00..6cb1fd4453e 100644
> --- a/drivers/net/phy/ethernet_id.c
> +++ b/drivers/net/phy/ethernet_id.c
> @@ -71,6 +71,9 @@ struct phy_device *phy_connect_phy_id(struct mii_dev *bus, struct udevice *dev,
>  		}
>  	}
>  
> +	if (phyaddr == -1)
> +		phyaddr = ofnode_read_u32_default(phandle_args.node, "reg", -1);
> +
>  	id =  vendor << 16 | device;
>  	phydev = phy_device_create(bus, phyaddr, id, false);
>  	if (phydev)

Reviewed-by: Paul Barker <paul.barker.ct at bp.renesas.com>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_0x27F4B3459F002257.asc
Type: application/pgp-keys
Size: 3520 bytes
Desc: OpenPGP public key
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20240128/12eab6e9/attachment.key>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature.asc
Type: application/pgp-signature
Size: 236 bytes
Desc: OpenPGP digital signature
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20240128/12eab6e9/attachment.sig>


More information about the U-Boot mailing list