[PATCH v1] net: sun8i-emac: Add support for fixed-link phy

Andre Przywara andre.przywara at arm.com
Tue Jan 16 01:17:35 CET 2024


On Thu, 15 Jun 2023 00:44:06 +0300
Maxim Kiselev <bigunclemax at gmail.com> wrote:

Hi Maxim,

> From: Maksim Kiselev <bigunclemax at gmail.com>
> 
> Based on dt-specs fixed-link doesn't require phy-handle to be used.

Do you have such a board? And where is that written down? I don't see
it explicitly mentioned as optional in ethernet-controller.yaml or in
the DT spec PDF. The sun8i EMAC binding lists phy-handle as required,
so that would need to be relaxed there then.

> Fix driver to only read phy related setting when phy-handle is found.

The patch itself looks fine, we already specify -1 as the default when
the PHY DT node does not contain a reg property, so that looks like it
would work.

Cheers,
Andre

> Signed-off-by: Maksim Kiselev <bigunclemax at gmail.com>
> ---
>  drivers/net/sun8i_emac.c | 7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/net/sun8i_emac.c b/drivers/net/sun8i_emac.c
> index 04c3274fbe..0e339d69e0 100644
> --- a/drivers/net/sun8i_emac.c
> +++ b/drivers/net/sun8i_emac.c
> @@ -834,11 +834,8 @@ static int sun8i_emac_eth_of_to_plat(struct udevice *dev)
>  	priv->use_internal_phy = false;
>  
>  	offset = fdtdec_lookup_phandle(gd->fdt_blob, node, "phy-handle");
> -	if (offset < 0) {
> -		debug("%s: Cannot find PHY address\n", __func__);
> -		return -EINVAL;
> -	}
> -	priv->phyaddr = fdtdec_get_int(gd->fdt_blob, offset, "reg", -1);
> +	if (offset >= 0)
> +		priv->phyaddr = fdtdec_get_int(gd->fdt_blob, offset, "reg", -1);
>  
>  	pdata->phy_interface = dev_read_phy_mode(dev);
>  	debug("phy interface %d\n", pdata->phy_interface);



More information about the U-Boot mailing list