Skip to content

net: phy: prevent uclass_eth device "node" field overwriting

Grygorii Strashko u-boot 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest5 patches 5 repliesIn review
  2. v15 patches 0 repliesSuperseded

Changes in v2 from the cover letter

- struct phy_device->node field initialization added to phy_device_create()

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/5net: phy: add ofnode node to struct phy_devicedrivers/net/phy/phy.c include/phy.h+17 -02 replies
2/5net: phy: dp83867: switch to use phy_get_ofnode()drivers/net/phy/ti.c+5 -21 reply
3/5net: phy: xilinx: switch to use phy_get_ofnode()drivers/net/phy/xilinx_phy.c+6 -41 reply
4/5drivers: net: cpsw: fix phy dt node settingdrivers/net/cpsw.c+1 -11 reply
5/5drivers: net: zynq_gem: fix phy dt node settingdrivers/net/zynq_gem.c+1 -11 reply

Reviews trailers per patch

All 5 patches have a Reviewed-by or Acked-by.

PatchJoe Hershberger
1/5A-b
2/5A-b
3/5A-b
4/5A-b
5/5A-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [U-Boot] [PATCH v2 0/5] net: phy: prevent uclass_eth device "node" field overwriting

This series prevents the UCLASS_ETH device "node" field overwriting by some network drivers when Ethernet PHYs are linked to UCLASS_ETH device using "phy-handle" DT property and when Ethernet PHY driver needs to read some additional information from DT (like dp83867).

It fixes following cases:

- network drivers

	priv->phydev = phy_connect(priv->bus, priv->phyaddr, dev,
				   priv->interface);
	<-- phydev is connected to dev which is UCLASS_ETH device

	if (priv->phy_of_handle > 0)
		dev_set_of_offset(priv->phydev->dev, priv->phy_of_handle);
	<-- phydev->dev->node is overwritten by phy-handle DT node

- PHY driver in .config() callback

	int node = dev_of_offset(dev);
	<-- PHY driver uses overwritten dev->node
        const void *fdt = gd->fdt_blob;

	 if (fdtdec_get_bool(fdt, node, "property"))
		...

As result, UCLASS_ETH device can't be used any more for DT accessing.

It adds new field ofnode node to struct phy_device and updates TI CPSW and zynq_gem drivers to use it.

zynq_gem.c, xilinx_phy.c changes only build tested.

Changes in v2:
- struct phy_device->node field initialization added to phy_device_create()

Dependency:
This series has dependency from
https://patchwork.ozlabs.org/cover/936370/
due to possible merge conflicts

PS: Not sure if any other Net drivers need to be updated,
at least I've not found any.

Grygorii Strashko (5):
net: phy: add ofnode node to struct phy_device
net: phy: dp83867: switch to use phy_get_ofnode()
net: phy: xilinx: switch to use phy_get_ofnode()
drivers: net: cpsw: fix phy dt node setting
drivers: net: zynq_gem: fix phy dt node setting

 drivers/net/cpsw.c           |  2 +-
 drivers/net/phy/phy.c        |  4 ++++
 drivers/net/phy/ti.c         |  7 +++++--
 drivers/net/phy/xilinx_phy.c | 10 ++++++----
 drivers/net/zynq_gem.c       |  2 +-
 include/phy.h                | 13 +++++++++++++
 6 files changed, 30 insertions(+), 8 deletions(-)
Signature · 1 line
2.10.5