All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] net: phy: Use PHY MDIO address from DT if available
@ 2024-01-28  1:19 Marek Vasut
  2024-01-28 22:05 ` Paul Barker
  2024-03-09 21:58 ` Tom Rini
  0 siblings, 2 replies; 3+ messages in thread
From: Marek Vasut @ 2024-01-28  1:19 UTC (permalink / raw)
  To: u-boot; +Cc: Marek Vasut, Joe Hershberger, Paul Barker, Ramon Fried

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@mailbox.org>
---
Cc: Joe Hershberger <joe.hershberger@ni.com>
Cc: Paul Barker <paul.barker.ct@bp.renesas.com>
Cc: Ramon Fried <rfried.dev@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)
-- 
2.43.0


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

* Re: [PATCH v2] net: phy: Use PHY MDIO address from DT if available
  2024-01-28  1:19 [PATCH v2] net: phy: Use PHY MDIO address from DT if available Marek Vasut
@ 2024-01-28 22:05 ` Paul Barker
  2024-03-09 21:58 ` Tom Rini
  1 sibling, 0 replies; 3+ messages in thread
From: Paul Barker @ 2024-01-28 22:05 UTC (permalink / raw)
  To: Marek Vasut, u-boot; +Cc: Joe Hershberger, Ramon Fried


[-- Attachment #1.1.1: Type: text/plain, Size: 1360 bytes --]

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@mailbox.org>
> ---
> Cc: Joe Hershberger <joe.hershberger@ni.com>
> Cc: Paul Barker <paul.barker.ct@bp.renesas.com>
> Cc: Ramon Fried <rfried.dev@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@bp.renesas.com>

[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 3577 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 236 bytes --]

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

* Re: [PATCH v2] net: phy: Use PHY MDIO address from DT if available
  2024-01-28  1:19 [PATCH v2] net: phy: Use PHY MDIO address from DT if available Marek Vasut
  2024-01-28 22:05 ` Paul Barker
@ 2024-03-09 21:58 ` Tom Rini
  1 sibling, 0 replies; 3+ messages in thread
From: Tom Rini @ 2024-03-09 21:58 UTC (permalink / raw)
  To: u-boot, Marek Vasut; +Cc: Joe Hershberger, Paul Barker, Ramon Fried

On Sun, 28 Jan 2024 02:19:40 +0100, 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.
> 
> 

Applied to u-boot/master, thanks!

-- 
Tom



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

end of thread, other threads:[~2024-03-09 21:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-28  1:19 [PATCH v2] net: phy: Use PHY MDIO address from DT if available Marek Vasut
2024-01-28 22:05 ` Paul Barker
2024-03-09 21:58 ` Tom Rini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.