Skip to contentSkip to conversation

phylib: Make PHYs children of their MDIO bus, not the bus' parent.

PATCH Applied David Daney 5 participants 7 messages Aug 21, 2015 – Nov 19, 2015

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 phylib: Make PHYs children of their MDIO bus, not the bus' parent.

From: David Daney <[email protected]>

commit 18ee49ddb0d2 ("phylib: rename mii_bus::dev to mii_bus::parent") changed the parent of PHY devices from the bus to the bus parent.

Then, commit 4dea547fef1b ("phylib: rework to prepare for OF registration of PHYs") moved the code into phy_device.c

At this point, it is somewhat unclear why the change was seen as necessary. But, when we look at the device model tree in /sys/devices, it is clearly incorrect. The PHYs should be children of their MDIO bus.

Change the PHY's parent device to be the MDIO bus device.

Cc Lennert Buytenhek <[email protected]>
Cc Grant Likely <[email protected]>
---
 drivers/net/phy/phy_device.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/phy/phy_device.c +1 -1
index 0302483..55f0178 100644
@@ -176,7 +176,7 @@ struct phy_device *phy_device_create(struct mii_bus *bus, int addr, int phy_id,
 	if (c45_ids)
 		dev->c45_ids = *c45_ids;
 	dev->bus = bus;
-	dev->dev.parent = bus->parent;
+	dev->dev.parent = &bus->dev;
 	dev->dev.bus = &mdio_bus_type;
 	dev->irq = bus->irq != NULL ? bus->irq[addr] : PHY_POLL;
 	dev_set_name(&dev->dev, PHY_ID_FMT, bus->id, addr);
Signature · 1 line
1.7.11.7
Acked-by on v1 1/1
#1 lore raw
Quoted 13 lines · David Daney

From: David Daney <[email protected]>

commit 18ee49ddb0d2 ("phylib: rename mii_bus::dev to mii_bus::parent") changed the parent of PHY devices from the bus to the bus parent.

Then, commit 4dea547fef1b ("phylib: rework to prepare for OF registration of PHYs") moved the code into phy_device.c

At this point, it is somewhat unclear why the change was seen as necessary. But, when we look at the device model tree in /sys/devices, it is clearly incorrect. The PHYs should be children of their MDIO bus.

Quoted 5 lines

Change the PHY's parent device to be the MDIO bus device.

Cc Lennert Buytenhek <[email protected]>
Cc Grant Likely <[email protected]>
Signature · 1 line
Florian
maintainer Applied
#2 lore raw
In reply to David Daney

From: David Daney <[email protected]>
Date: Fri, 21 Aug 2015 16:16:03 -0700

Quoted 13 lines

From: David Daney <[email protected]>

commit 18ee49ddb0d2 ("phylib: rename mii_bus::dev to mii_bus::parent") changed the parent of PHY devices from the bus to the bus parent.

Then, commit 4dea547fef1b ("phylib: rework to prepare for OF registration of PHYs") moved the code into phy_device.c

At this point, it is somewhat unclear why the change was seen as necessary. But, when we look at the device model tree in /sys/devices, it is clearly incorrect. The PHYs should be children of their MDIO bus.

Quoted 5 lines

Change the PHY's parent device to be the MDIO bus device.

Cc Lennert Buytenhek <[email protected]>
Cc Grant Likely <[email protected]>

Applied, thanks.

#3 lore raw
In reply to David Daney

Hello.

Quoted 27 lines · David Daney

From: David Daney <[email protected]>

commit 18ee49ddb0d2 ("phylib: rename mii_bus::dev to mii_bus::parent") changed the parent of PHY devices from the bus to the bus parent.

Then, commit 4dea547fef1b ("phylib: rework to prepare for OF registration of PHYs") moved the code into phy_device.c

At this point, it is somewhat unclear why the change was seen as necessary. But, when we look at the device model tree in /sys/devices, it is clearly incorrect. The PHYs should be children of their MDIO bus.

Change the PHY's parent device to be the MDIO bus device.

Cc Lennert Buytenhek <[email protected]>
Cc Grant Likely <[email protected]>
---
  drivers/net/phy/phy_device.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/phy/phy_device.c +0 -0
index 0302483..55f0178 100644

drivers/net/phy/phy_device.c struct phy_device *phy_device_create(struct mii_bus *bus, int addr, int phy_id, · line 182

Quoted 8 lines
drivers/net/phy/phy_device.c +1 -1
@@ -176,7 +176,7 @@ struct phy_device *phy_device_create(struct mii_bus *bus, int addr, int phy_id,
  	if (c45_ids)
  		dev->c45_ids = *c45_ids;
  	dev->bus = bus;
-	dev->dev.parent = bus->parent;
+	dev->dev.parent = &bus->dev;
  	dev->dev.bus = &mdio_bus_type;
  	dev->irq = bus->irq != NULL ? bus->irq[addr] : PHY_POLL;
  	dev_set_name(&dev->dev, PHY_ID_FMT, bus->id, addr);

This patch makes my sh_eth driver fail to connect to PHY usinjg
of_phy_connect(). (The ravb driver fails too but for some other reason.)

MBR, Sergei

maintainer
#4 lore raw
Quoted 35 lines · Sergei Shtylyov

Hello.

Quoted 31 lines · David Daney

From: David Daney <[email protected]>

commit 18ee49ddb0d2 ("phylib: rename mii_bus::dev to mii_bus::parent") changed the parent of PHY devices from the bus to the bus parent.

Then, commit 4dea547fef1b ("phylib: rework to prepare for OF registration of PHYs") moved the code into phy_device.c

At this point, it is somewhat unclear why the change was seen as necessary. But, when we look at the device model tree in /sys/devices, it is clearly incorrect. The PHYs should be children of their MDIO bus.

Change the PHY's parent device to be the MDIO bus device.

Cc Lennert Buytenhek <[email protected]>
Cc Grant Likely <[email protected]>
---
 drivers/net/phy/phy_device.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/phy/phy_device.c +0 -1
index 0302483..55f0178 100644
@@ -176,7 +176,7 @@ struct phy_device *phy_device_create(struct mii_bus *bus, int addr, int phy_id,
 	if (c45_ids)
 		dev->c45_ids = *c45_ids;
 	dev->bus = bus;
-	dev->dev.parent = bus->parent;
Quoted 8 lines

drivers/net/phy/phy_device.c struct phy_device *phy_device_create(struct mii_bus *bus, int addr, int phy_id, · line 182

Quoted 4 lines
drivers/net/phy/phy_device.c +1 -0
+	dev->dev.parent = &bus->dev;
 	dev->dev.bus = &mdio_bus_type;
 	dev->irq = bus->irq != NULL ? bus->irq[addr] : PHY_POLL;
 	dev_set_name(&dev->dev, PHY_ID_FMT, bus->id, addr);

This patch makes my sh_eth driver fail to connect to PHY usinjg
of_phy_connect(). (The ravb driver fails too but for some other reason.)

Hi Sergei

What phy is it?

Do you have phy DT properties in the MAC node?

Andrew

#5 lore raw

Hello.

Quoted 40 lines · Andrew Lunn
Quoted 31 lines
Quoted 31 lines

From: David Daney <[email protected]>

commit 18ee49ddb0d2 ("phylib: rename mii_bus::dev to mii_bus::parent") changed the parent of PHY devices from the bus to the bus parent.

Then, commit 4dea547fef1b ("phylib: rework to prepare for OF registration of PHYs") moved the code into phy_device.c

At this point, it is somewhat unclear why the change was seen as necessary. But, when we look at the device model tree in /sys/devices, it is clearly incorrect. The PHYs should be children of their MDIO bus.

Change the PHY's parent device to be the MDIO bus device.

Cc Lennert Buytenhek <[email protected]>
Cc Grant Likely <[email protected]>
---
  drivers/net/phy/phy_device.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/phy/phy_device.c +0 -1
index 0302483..55f0178 100644
@@ -176,7 +176,7 @@ struct phy_device *phy_device_create(struct mii_bus *bus, int addr, int phy_id,
  	if (c45_ids)
  		dev->c45_ids = *c45_ids;
  	dev->bus = bus;
-	dev->dev.parent = bus->parent;
Quoted 8 lines

drivers/net/phy/phy_device.c struct phy_device *phy_device_create(struct mii_bus *bus, int addr, int phy_id, · line 182

Quoted 4 lines
drivers/net/phy/phy_device.c +1 -0
+	dev->dev.parent = &bus->dev;
  	dev->dev.bus = &mdio_bus_type;
  	dev->irq = bus->irq != NULL ? bus->irq[addr] : PHY_POLL;
  	dev_set_name(&dev->dev, PHY_ID_FMT, bus->id, addr);

This patch makes my sh_eth driver fail to connect to PHY usinjg
of_phy_connect(). (The ravb driver fails too but for some other reason.)

Quoted 3 lines

Hi Sergei

What phy is it?

Micrel KSZ8041RNLI for sh_eth, KSZ9031 for ravb.

Quoted 1 line

Do you have phy DT properties in the MAC node?

I have PHY subnodes (with props) in the MAC node.

Quoted 1 line

Andrew

MBR, Sergei

maintainer
#6 lore raw
Quoted 7 lines
Quoted 1 line

What phy is it?

Micrel KSZ8041RNLI for sh_eth, KSZ9031 for ravb.

Quoted 1 line

Do you have phy DT properties in the MAC node?

I have PHY subnodes (with props) in the MAC node.

O.K, so this could be the same problems as

https://lkml.org/lkml/2015/10/15/726

https://www.mail-archive.com/[email protected]/msg83183.html

We never got a resolution to that problem.

It needs somebody with none working hardware to do some debugging to figure out exactly what is going on and why my idea to fix it does not work.

Andrew