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

Grygorii Strashko grygorii.strashko at ti.com
Thu Jun 28 19:47:50 UTC 2018


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.

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/ti.c         |  7 +++++--
 drivers/net/phy/xilinx_phy.c | 10 ++++++----
 drivers/net/zynq_gem.c       |  2 +-
 include/phy.h                | 13 +++++++++++++
 5 files changed, 26 insertions(+), 8 deletions(-)

-- 
2.10.5



More information about the U-Boot mailing list