Merge branch 'net-ethernet-ti-am65-cpsw-fix-mac-address-fetching'

Michael Walle says:

====================
net: ethernet: ti: am65-cpsw: Fix MAC address fetching

MAC addresses can be fetched from a NVMEM device. of_get_mac_address()
will return EPROBE_DEFER if that device is not available yet. That
isn't handled correctly by the driver and it will always fall back
to either a random MAC address or it's own "fetch by fuse" method.

Also, if the ethernet (sub)node has a link to the nvmem device,
it will fail to create a device link as the fwnode parameter isn't
populated. That's fixed in the first patch.
====================

Link: https://patch.msgid.link/20250414084336.4017237-1-mwalle@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
Jakub Kicinski
2025-04-16 17:51:35 -07:00

View File

@@ -2679,7 +2679,9 @@ static int am65_cpsw_nuss_init_slave_ports(struct am65_cpsw_common *common)
goto of_node_put;
ret = of_get_mac_address(port_np, port->slave.mac_addr);
if (ret) {
if (ret == -EPROBE_DEFER) {
goto of_node_put;
} else if (ret) {
am65_cpsw_am654_get_efuse_macid(port_np,
port->port_id,
port->slave.mac_addr);
@@ -2749,7 +2751,7 @@ am65_cpsw_nuss_init_port_ndev(struct am65_cpsw_common *common, u32 port_idx)
mutex_init(&ndev_priv->mm_lock);
port->qos.link_speed = SPEED_UNKNOWN;
SET_NETDEV_DEV(port->ndev, dev);
port->ndev->dev.of_node = port->slave.port_np;
device_set_node(&port->ndev->dev, of_fwnode_handle(port->slave.port_np));
eth_hw_addr_set(port->ndev, port->slave.mac_addr);
@@ -3550,6 +3552,16 @@ static int am65_cpsw_nuss_probe(struct platform_device *pdev)
return ret;
}
am65_cpsw_nuss_get_ver(common);
ret = am65_cpsw_nuss_init_host_p(common);
if (ret)
goto err_pm_clear;
ret = am65_cpsw_nuss_init_slave_ports(common);
if (ret)
goto err_pm_clear;
node = of_get_child_by_name(dev->of_node, "mdio");
if (!node) {
dev_warn(dev, "MDIO node not found\n");
@@ -3566,16 +3578,6 @@ static int am65_cpsw_nuss_probe(struct platform_device *pdev)
}
of_node_put(node);
am65_cpsw_nuss_get_ver(common);
ret = am65_cpsw_nuss_init_host_p(common);
if (ret)
goto err_of_clear;
ret = am65_cpsw_nuss_init_slave_ports(common);
if (ret)
goto err_of_clear;
/* init common data */
ale_params.dev = dev;
ale_params.ale_ageout = AM65_CPSW_ALE_AGEOUT_DEFAULT;