net: phy: Don't create phy device when there is no phy
Subsystems (2)
PATCH v2 1/3 net: phy: Don't create phy device when there is no phy
In get_phy_device_by_mask(), when no phy is found, we should not create any phy device.
---
Changes in v2:
- Rebase on u-boot/master
drivers/net/phy/phy.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/phy/phy.c +2 -1
@@ -672,7 +672,8 @@ static struct phy_device *get_phy_device_by_mask(struct mii_dev *bus,return phydev; }printf ("Phy %d not found\n" ,ffs (phy_mask) -1 ); -return phy_device_create (bus,ffs (phy_mask) -1 ,0xffffffff , interface); + +return NULL ; }/**
Signature · 1 line
1.8.2.1
PATCH v2 2/3 net: phy: Change to print all phys that are not found
In get_phy_device_by_mask(), when no phy is found, currently we only print a message to show the first phy address that is not found. But this is not always the case as multiple phys can be specified by phy_mask. Change to print all phys that are not found, and to reduce the console boot log, change to use 'debug' instead of 'printf'.
---
Changes in v2: None
drivers/net/phy/phy.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/net/phy/phy.c +8 -1
@@ -671,7 +671,14 @@ static struct phy_device *get_phy_device_by_mask(struct mii_dev *bus,if (phydev)return phydev; } -printf ("Phy %d not found\n" ,ffs (phy_mask) -1 ); + +debug ("\n%s PHY: " , bus->name); +while (phy_mask) { +int addr =ffs (phy_mask) -1 ; +debug ("%d " , addr); + phy_mask &= ~(1 << addr); + } +debug ("not found\n" );return NULL ; }
Signature · 1 line
1.8.2.1
PATCH v2 2/3 net: phy: Change to print all phys that are not found
Quoted 8 lines · Bin Meng
In
get_phy_device_by_mask(), when no phy is found, currently we only print a message to show the first phy address that is not found. But this is not always the case as multiple phys can be specified byphy_mask. Change to print all phys that are not found, and to reduce the console boot log, change to use 'debug' instead of 'printf'.Signed-off-by Bin Meng <[email protected]>Acked-by Joe Hershberger <[email protected]>
Applied to u-boot-net/master, thanks!
-Joe
PATCH v2 3/3 net: phy: Test previous phydev->dev against new mac dev
In reply to Bin MengIn phy_connect_dev(), if the phy device has an accociated mac device before, a warning message will be printed. But we should test the old device against the new one, if they are actually the same one, don't print the warning message.
---
Changes in v2: None
drivers/net/phy/phy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/phy/phy.c +1 -1
@@ -789,7 +789,7 @@ void phy_connect_dev(struct phy_device *phydev, struct eth_device *dev) {/* Soft Reset the PHY */ phy_reset (phydev); -if (phydev->dev) { +if (phydev->dev && phydev->dev != dev) {printf ("%s:%d is connected to %s. Reconnecting to %s\n" , phydev->bus->name, phydev->addr, phydev->dev->name, dev->name);
Signature · 1 line
1.8.2.1
PATCH v2 3/3 net: phy: Test previous phydev->dev against new mac dev
Quoted 7 lines · Bin Meng
In
phy_connect_dev(), if the phy device has an accociated mac device before, a warning message will be printed. But we should test the old device against the new one, if they are actually the same one, don't print the warning message.Signed-off-by Bin Meng <[email protected]>Acked-by Joe Hershberger <[email protected]>
Applied to u-boot-net/master, thanks!
-Joe
PATCH v2 1/3 net: phy: Don't create phy device when there is no phy
In reply to Bin MengQuoted 5 lines · Bin Meng
In
get_phy_device_by_mask(), when no phy is found, we should not create any phy device.Signed-off-by Bin Meng <[email protected]>Acked-by Joe Hershberger <[email protected]>
Applied to u-boot-net/master, thanks!
-Joe