diff mbox series

[PATCHv6,01/18] phy: make phy_connect_fixed work with a null mdio bus

Message ID 20200922085017.47972-2-Zhiqiang.Hou@nxp.com
State Accepted
Commit 15c49df8d4cfbcc02ed28fff2703fb382545caf1
Delegated to: Priyanka Jain
Headers show
Series powerpc: convert p1010, p1020 and p2020 RDB boards to DM_ETH | expand

Commit Message

Z.Q. Hou Sept. 22, 2020, 8:50 a.m. UTC
From: Vladimir Oltean <vladimir.oltean@nxp.com>

It is utterly pointless to require an MDIO bus pointer for a fixed PHY
device. The fixed.c implementation does not require it, only
phy_device_create. Fix that.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
Reviewed-by: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
---
V6:
 - No change.

 drivers/net/phy/phy.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Priyanka Jain (OSS) Sept. 23, 2020, 1:24 p.m. UTC | #1
>-----Original Message-----
>From: U-Boot <u-boot-bounces@lists.denx.de> On Behalf Of Zhiqiang Hou
>Sent: Tuesday, September 22, 2020 2:20 PM
>To: u-boot@lists.denx.de; bmeng.cn@gmail.com; olteanv@gmail.com;
>Priyanka Jain <priyanka.jain@nxp.com>
>Cc: Vladimir Oltean <vladimir.oltean@nxp.com>; Z.q. Hou
><zhiqiang.hou@nxp.com>
>Subject: [PATCHv6 01/18] phy: make phy_connect_fixed work with a null mdio
>bus
>
>From: Vladimir Oltean <vladimir.oltean@nxp.com>
>
>It is utterly pointless to require an MDIO bus pointer for a fixed PHY device.
>The fixed.c implementation does not require it, only phy_device_create. Fix
>that.
>
>Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
>Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
>Reviewed-by: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
>---
Hello,

I have already picked v5 and rebased.
This is now integrated in u-boot-mpc85xx and pull-request is generated for  next branch today.
Kindly rebase and resend the delta over that.

Regards
Priyanka
Z.Q. Hou Sept. 24, 2020, 4:37 a.m. UTC | #2
Hi Priyanka,

> -----Original Message-----
> From: Priyanka Jain (OSS) <priyanka.jain@oss.nxp.com>
> Sent: 2020年9月23日 21:25
> To: Z.q. Hou <zhiqiang.hou@nxp.com>; u-boot@lists.denx.de;
> bmeng.cn@gmail.com; olteanv@gmail.com
> Cc: Vladimir Oltean <vladimir.oltean@nxp.com>; Z.q. Hou
> <zhiqiang.hou@nxp.com>
> Subject: RE: [PATCHv6 01/18] phy: make phy_connect_fixed work with a null
> mdio bus
> 
> >-----Original Message-----
> >From: U-Boot <u-boot-bounces@lists.denx.de> On Behalf Of Zhiqiang Hou
> >Sent: Tuesday, September 22, 2020 2:20 PM
> >To: u-boot@lists.denx.de; bmeng.cn@gmail.com; olteanv@gmail.com;
> >Priyanka Jain <priyanka.jain@nxp.com>
> >Cc: Vladimir Oltean <vladimir.oltean@nxp.com>; Z.q. Hou
> ><zhiqiang.hou@nxp.com>
> >Subject: [PATCHv6 01/18] phy: make phy_connect_fixed work with a null
> >mdio bus
> >
> >From: Vladimir Oltean <vladimir.oltean@nxp.com>
> >
> >It is utterly pointless to require an MDIO bus pointer for a fixed PHY device.
> >The fixed.c implementation does not require it, only phy_device_create.
> >Fix that.
> >
> >Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
> >Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
> >Reviewed-by: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
> >---
> Hello,
> 
> I have already picked v5 and rebased.
> This is now integrated in u-boot-mpc85xx and pull-request is generated for
> next branch today.
> Kindly rebase and resend the delta over that.

No code change in V6, just move the #2 of V5 to the end of the patch set to avoid ls1021a build error at #2, refer to Vladimir's comments in http://patchwork.ozlabs.org/project/uboot/patch/20200716100925.10721-3-Zhiqiang.Hou@nxp.com/

Thanks,
Zhiqiang

> 
> Regards
> Priyanka
diff mbox series

Patch

diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index 67789897c2..9587e6b9fa 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -664,7 +664,7 @@  static struct phy_device *phy_device_create(struct mii_dev *bus, int addr,
 	dev = malloc(sizeof(*dev));
 	if (!dev) {
 		printf("Failed to allocate PHY device for %s:%d\n",
-		       bus->name, addr);
+		       bus ? bus->name : "(null bus)", addr);
 		return NULL;
 	}
 
@@ -692,7 +692,7 @@  static struct phy_device *phy_device_create(struct mii_dev *bus, int addr,
 		return NULL;
 	}
 
-	if (addr >= 0 && addr < PHY_MAX_ADDR)
+	if (addr >= 0 && addr < PHY_MAX_ADDR && phy_id != PHY_FIXED_ID)
 		bus->phymap[addr] = dev;
 
 	return dev;