[U-Boot] [PATCH 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.
Signed-off-by: Bin Meng bmeng.cn@gmail.com ---
drivers/net/phy/phy.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index 65c731a..0d66e75 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c @@ -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; }
/**

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'.
Signed-off-by: Bin Meng bmeng.cn@gmail.com ---
drivers/net/phy/phy.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index 0d66e75..651e456 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c @@ -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; }

Hi Bin,
On Fri, Sep 4, 2015 at 6:56 AM, Bin Meng bmeng.cn@gmail.com wrote:
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'.
Signed-off-by: Bin Meng bmeng.cn@gmail.com
Acked-by: Joe Hershberger joe.hershberger@ni.com

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 bmeng.cn@gmail.com ---
drivers/net/phy/phy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index 651e456..35dfcc1 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c @@ -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);

Hi Bin,
On Fri, Sep 4, 2015 at 6:56 AM, Bin Meng bmeng.cn@gmail.com wrote:
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 bmeng.cn@gmail.com
Acked-by: Joe Hershberger joe.hershberger@ni.com

Hi Joe,
On Fri, Sep 4, 2015 at 7:56 PM, Bin Meng bmeng.cn@gmail.com wrote:
In get_phy_device_by_mask(), when no phy is found, we should not create any phy device.
Signed-off-by: Bin Meng bmeng.cn@gmail.com
drivers/net/phy/phy.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index 65c731a..0d66e75 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c @@ -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;
}
/**
Ping?
Regards, Bin

Hi Bin,
On Fri, Sep 4, 2015 at 6:56 AM, Bin Meng bmeng.cn@gmail.com wrote:
In get_phy_device_by_mask(), when no phy is found, we should not create any phy device.
Signed-off-by: Bin Meng bmeng.cn@gmail.com
Acked-by: Joe Hershberger joe.hershberger@ni.com

Hi Joe,
On Sat, Sep 12, 2015 at 3:44 AM, Joe Hershberger joe.hershberger@gmail.com wrote:
Hi Bin,
On Fri, Sep 4, 2015 at 6:56 AM, Bin Meng bmeng.cn@gmail.com wrote:
In get_phy_device_by_mask(), when no phy is found, we should not create any phy device.
Signed-off-by: Bin Meng bmeng.cn@gmail.com
Acked-by: Joe Hershberger joe.hershberger@ni.com
What about the other 2 patches in this series?
Regards, Bin

Hi Joe,
On Tue, Sep 15, 2015 at 10:46 AM, Bin Meng bmeng.cn@gmail.com wrote:
Hi Joe,
On Sat, Sep 12, 2015 at 3:44 AM, Joe Hershberger joe.hershberger@gmail.com wrote:
Hi Bin,
On Fri, Sep 4, 2015 at 6:56 AM, Bin Meng bmeng.cn@gmail.com wrote:
In get_phy_device_by_mask(), when no phy is found, we should not create any phy device.
Signed-off-by: Bin Meng bmeng.cn@gmail.com
Acked-by: Joe Hershberger joe.hershberger@ni.com
What about the other 2 patches in this series?
A gentle ping?
Regards, Bin

Hi Bin,
On Mon, Sep 21, 2015 at 10:44 PM, Bin Meng bmeng.cn@gmail.com wrote:
Hi Joe,
On Tue, Sep 15, 2015 at 10:46 AM, Bin Meng bmeng.cn@gmail.com wrote:
Hi Joe,
On Sat, Sep 12, 2015 at 3:44 AM, Joe Hershberger joe.hershberger@gmail.com wrote:
Hi Bin,
On Fri, Sep 4, 2015 at 6:56 AM, Bin Meng bmeng.cn@gmail.com wrote:
In get_phy_device_by_mask(), when no phy is found, we should not create any phy device.
Signed-off-by: Bin Meng bmeng.cn@gmail.com
Acked-by: Joe Hershberger joe.hershberger@ni.com
What about the other 2 patches in this series?
A gentle ping?
Sorry but my email threading is not helping me find the other two. What are the exact subjects?
Thanks, -Joe

Hi Joe,
On Tue, Sep 22, 2015 at 11:23 PM, Joe Hershberger joe.hershberger@gmail.com wrote:
Hi Bin,
On Mon, Sep 21, 2015 at 10:44 PM, Bin Meng bmeng.cn@gmail.com wrote:
Hi Joe,
On Tue, Sep 15, 2015 at 10:46 AM, Bin Meng bmeng.cn@gmail.com wrote:
Hi Joe,
On Sat, Sep 12, 2015 at 3:44 AM, Joe Hershberger joe.hershberger@gmail.com wrote:
Hi Bin,
On Fri, Sep 4, 2015 at 6:56 AM, Bin Meng bmeng.cn@gmail.com wrote:
In get_phy_device_by_mask(), when no phy is found, we should not create any phy device.
Signed-off-by: Bin Meng bmeng.cn@gmail.com
Acked-by: Joe Hershberger joe.hershberger@ni.com
What about the other 2 patches in this series?
A gentle ping?
Sorry but my email threading is not helping me find the other two. What are the exact subjects?
They are here: http://patchwork.ozlabs.org/patch/514398/ http://patchwork.ozlabs.org/patch/514399/
Regards, Bin
participants (2)
-
Bin Meng
-
Joe Hershberger