[PATCH v1] net: ldpaa_eth: fix error logics of unconfigured DPMACs

Vincent Jardin <[email protected]>
Newsgroups org.u-boot-project.lists.u-boot
Message-ID <[email protected]>
ldpaa_eth_bind() returned -EINVAL for a DPMAC node without
phy-connection-type.

That is not "skip this device", it is "the tree is broken":
the DM core propagates it out of lists_bind_fdt() and
dm_scan_fdt(), initr_dm() fails, and U-Boot stops before the prompt with

  ldpaa_eth ethernet@1: incorrect phy mode
  initcall_run_r(): initcall initr_dm() failed
  ### ERROR ### Please RESET the board ###

for a MAC nobody asked U-Boot to drive.

Why it matters: device trees imported from Linux enable
every DPMAC and leave the phy description to the board file, because the
kernel's dpaa2 driver does not need one for an MC-managed MAC. U-Boot's
own Layerscape .dtsi instead ships all eighteen disabled for the board to
opt into. So the moment a board takes its SoC description from
dts/upstream, every DPMAC it does not configure in U-Boot is enabled and
unconfigured, and one of them is enough to stop the boot.

Signed-off-by: Vincent Jardin <[email protected]>

---

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

diff --git a/drivers/net/ldpaa_eth/ldpaa_eth.c b/drivers/net/ldpaa_eth/ldpaa_eth.c
index 94e62748239..27ae6747464 100644
--- a/drivers/net/ldpaa_eth/ldpaa_eth.c
+++ b/drivers/net/ldpaa_eth/ldpaa_eth.c
@@ -970,8 +970,8 @@ static int ldpaa_eth_bind(struct udevice *dev)
 
 	phy_mode = dev_read_phy_mode(dev);
 	if (phy_mode == PHY_INTERFACE_MODE_NA) {
-		dev_err(dev, "incorrect phy mode\n");
-		return -EINVAL;
+		dev_dbg(dev, "no phy mode, not binding\n");
+		return -ENODEV;
 	}
 
 	dpmac_id = ldpaa_eth_get_dpmac_id(dev);
---
base-commit: 6073c36b2c8d39afe3ecc789b281667a3ddebc70
branch: for-upstream/net-ldpaa-eth-decline-dpmac-v1

-- 
2.43.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.