Skip to content

Commit fdfd103

Browse files
author
Paolo Abeni
committed
Merge branch 'net-enetc-fix-fallback-phy-address-handling-and-do-not-skip-setting-for-addr-0'
Wei Fang says: ==================== net: enetc: fix fallback PHY address handling and do not skip setting for addr 0 There are two potential issues when PHY address 0 is used on the board, see the commit messages of the patches for more details. v1: https://lore.kernel.org/imx/20260303103047.228005-1-wei.fang@nxp.com/ ==================== Link: https://patch.msgid.link/20260305031211.904812-1-wei.fang@nxp.com Signed-off-by: Paolo Abeni <pabeni@redhat.com>
2 parents 0d9a60a + dbe17e7 commit fdfd103

1 file changed

Lines changed: 10 additions & 14 deletions

File tree

drivers/net/ethernet/freescale/enetc/netc_blk_ctrl.c

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -333,11 +333,13 @@ static int netc_get_phy_addr(struct device_node *np)
333333

334334
mdio_node = of_get_child_by_name(np, "mdio");
335335
if (!mdio_node)
336-
return 0;
336+
return -ENODEV;
337337

338338
phy_node = of_get_next_child(mdio_node, NULL);
339-
if (!phy_node)
339+
if (!phy_node) {
340+
err = -ENODEV;
340341
goto of_put_mdio_node;
342+
}
341343

342344
err = of_property_read_u32(phy_node, "reg", &addr);
343345
if (err)
@@ -423,6 +425,9 @@ static int imx95_enetc_mdio_phyaddr_config(struct platform_device *pdev)
423425

424426
addr = netc_get_phy_addr(gchild);
425427
if (addr < 0) {
428+
if (addr == -ENODEV)
429+
continue;
430+
426431
dev_err(dev, "Failed to get PHY address\n");
427432
return addr;
428433
}
@@ -433,12 +438,6 @@ static int imx95_enetc_mdio_phyaddr_config(struct platform_device *pdev)
433438
return -EINVAL;
434439
}
435440

436-
/* The default value of LaBCR[MDIO_PHYAD_PRTAD ] is
437-
* 0, so no need to set the register.
438-
*/
439-
if (!addr)
440-
continue;
441-
442441
switch (bus_devfn) {
443442
case IMX95_ENETC0_BUS_DEVFN:
444443
netc_reg_write(priv->ierb, IERB_LBCR(0),
@@ -578,16 +577,13 @@ static int imx94_enetc_mdio_phyaddr_config(struct netc_blk_ctrl *priv,
578577

579578
addr = netc_get_phy_addr(np);
580579
if (addr < 0) {
580+
if (addr == -ENODEV)
581+
return 0;
582+
581583
dev_err(dev, "Failed to get PHY address\n");
582584
return addr;
583585
}
584586

585-
/* The default value of LaBCR[MDIO_PHYAD_PRTAD] is 0,
586-
* so no need to set the register.
587-
*/
588-
if (!addr)
589-
return 0;
590-
591587
if (phy_mask & BIT(addr)) {
592588
dev_err(dev,
593589
"Find same PHY address in EMDIO and ENETC node\n");

0 commit comments

Comments
 (0)