public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [PATCH v2] net: sun8i-emac: Add support for fixed-link phy
@ 2024-01-20 16:26 Maksim Kiselev
  2024-01-29  0:20 ` Andre Przywara
  0 siblings, 1 reply; 2+ messages in thread
From: Maksim Kiselev @ 2024-01-20 16:26 UTC (permalink / raw)
  Cc: Maksim Kiselev, Joe Hershberger, Ramon Fried, Andre Przywara,
	Samuel Holland, Sam Edwards, Simon Glass, u-boot

Make the "phy-handle" property optional, which allows support
for a fixed-link phy configuration.

Thus if the "phy-handle" is present in a DT, then driver will work as
before. Otherwise, phyaddr initialization will not be necessary,
as it is not needed in case of a fixed-link config.

Signed-off-by: Maksim Kiselev <bigunclemax@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 a12f7e32e8..8bff4fe9a9 100644
--- a/drivers/net/sun8i_emac.c
+++ b/drivers/net/sun8i_emac.c
@@ -833,11 +833,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);
-- 
2.40.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] net: sun8i-emac: Add support for fixed-link phy
  2024-01-20 16:26 [PATCH v2] net: sun8i-emac: Add support for fixed-link phy Maksim Kiselev
@ 2024-01-29  0:20 ` Andre Przywara
  0 siblings, 0 replies; 2+ messages in thread
From: Andre Przywara @ 2024-01-29  0:20 UTC (permalink / raw)
  To: Maksim Kiselev
  Cc: Joe Hershberger, Ramon Fried, Samuel Holland, Sam Edwards,
	Simon Glass, u-boot

On Sat, 20 Jan 2024 19:26:24 +0300
Maksim Kiselev <bigunclemax@gmail.com> wrote:

> Make the "phy-handle" property optional, which allows support
> for a fixed-link phy configuration.
> 
> Thus if the "phy-handle" is present in a DT, then driver will work as
> before. Otherwise, phyaddr initialization will not be necessary,
> as it is not needed in case of a fixed-link config.
> 
> Signed-off-by: Maksim Kiselev <bigunclemax@gmail.com>

Thanks, looks good now:

Reviewed-by: Andre Przywara <andre.przywara@arm.com>

Queued for the first PR.

Cheers,
Andre


> ---
>  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 a12f7e32e8..8bff4fe9a9 100644
> --- a/drivers/net/sun8i_emac.c
> +++ b/drivers/net/sun8i_emac.c
> @@ -833,11 +833,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);


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-01-29  0:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-20 16:26 [PATCH v2] net: sun8i-emac: Add support for fixed-link phy Maksim Kiselev
2024-01-29  0:20 ` Andre Przywara

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox