[PATCH 3/3] net: ravb: Use PHY MDIO address from DT if available

Marek Vasut marek.vasut at mailbox.org
Mon Jan 22 01:28:50 CET 2024


On 1/21/24 22:37, Paul Barker wrote:
> On 21/01/2024 17:29, 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>
>> ---
>>   drivers/net/sh_eth.c | 10 ++++++++--
>>   1 file changed, 8 insertions(+), 2 deletions(-)
> 
> I think the commit summaries are mixed up here - this patch says 'ravb'
> but changes 'sh_eth.c' and vice-versa with the other patch.

Sigh ... too much git commit --fixup/rebase --autosquash .

>> diff --git a/drivers/net/sh_eth.c b/drivers/net/sh_eth.c
>> index 7b1f59dc498..5e2e3054ecf 100644
>> --- a/drivers/net/sh_eth.c
>> +++ b/drivers/net/sh_eth.c
>> @@ -12,6 +12,7 @@
>>   #include <common.h>
>>   #include <cpu_func.h>
>>   #include <env.h>
>> +#include <eth_phy.h>
>>   #include <log.h>
>>   #include <malloc.h>
>>   #include <net.h>
>> @@ -597,11 +598,16 @@ static int sh_eth_phy_config(struct udevice *dev)
>>   	struct sh_ether_priv *priv = dev_get_priv(dev);
>>   	struct eth_pdata *pdata = dev_get_plat(dev);
>>   	struct sh_eth_dev *eth = &priv->shdev;
>> -	int ret = 0;
>>   	struct sh_eth_info *port_info = &eth->port_info[eth->port];
>>   	struct phy_device *phydev;
>> +	int phy_addr;
>> +	int ret = 0;
>> +
>> +	phy_addr = eth_phy_get_addr(dev);
>> +	if (phy_addr < 0)
>> +		phy_addr = -1;
>>   
>> -	phydev = phy_connect(priv->bus, -1, dev, pdata->phy_interface);
>> +	phydev = phy_connect(priv->bus, phy_addr, dev, pdata->phy_interface);
>>   	if (!phydev)
>>   		return -ENODEV;
>>   
> 
> I have a local patch to handle (phy_addr < 0) in phy_connect_phy_id()
> and lookup the address there. I think that's the better place to handle
> this as it's a universal fix for all users of CONFIG_PHY_ETHERNET_ID.
> Unfortunately I've been distracted by some higher priority work but I'm
> hoping to get back to this soon.
> 
> I can do some quick testing with that patch and send it this week if
> that's helpful.

Please do send it, yes.


More information about the U-Boot mailing list