summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Niebel <[email protected]>2025-11-21 18:34:47 +0100
committerFabio Estevam <[email protected]>2025-11-29 17:06:34 -0300
commitc5d3f7ac8e78d199cd961bee2c3f63726a1c4c69 (patch)
tree1396b7305c21ec781e3c9682e7c23bcc99858473
parentf4434ae02d5f96016cdad5e69862bf5139745e30 (diff)
net: fec_mxc: add unique bus and device names for DM_MDIO
When using DM_MDIO on SOC with more than one FEC and not sharing the MDIO bus the name of the driver and the bus needs to be unique. Since name used in device_bind_driver_to_node needs to be a static string, add the string to the fec_priv struct and reuse fec_set_dev_name to generate the name with the device sequence number. Fixes: 3b8f99a3e762 ("net: fec: add support for DM_MDIO") Signed-off-by: Markus Niebel <[email protected]> Signed-off-by: Alexander Stein <[email protected]> Signed-off-by: Alexander Feilke <[email protected]>
-rw-r--r--drivers/net/fec_mxc.c6
-rw-r--r--drivers/net/fec_mxc.h1
2 files changed, 5 insertions, 2 deletions
diff --git a/drivers/net/fec_mxc.c b/drivers/net/fec_mxc.c
index f62366dde6e..512f96e8df9 100644
--- a/drivers/net/fec_mxc.c
+++ b/drivers/net/fec_mxc.c
@@ -1067,6 +1067,7 @@ U_BOOT_DRIVER(fec_mdio) = {
static int dm_fec_bind_mdio(struct udevice *dev)
{
+ struct fec_priv *fec = dev_get_priv(dev);
struct udevice *mdiodev;
const char *name;
ofnode mdio;
@@ -1081,8 +1082,9 @@ static int dm_fec_bind_mdio(struct udevice *dev)
if (strcmp(name, "mdio"))
continue;
+ fec_set_dev_name(fec->mdio_name, dev_seq(dev));
ret = device_bind_driver_to_node(dev, "fec_mdio",
- name, mdio, &mdiodev);
+ fec->mdio_name, mdio, &mdiodev);
if (ret) {
printf("%s bind %s failed: %d\n", __func__, name, ret);
break;
@@ -1369,7 +1371,7 @@ static int fecmxc_probe(struct udevice *dev)
*/
ret = dm_fec_bind_mdio(dev);
if (!ret)
- bus = miiphy_get_dev_by_name("mdio");
+ bus = miiphy_get_dev_by_name(priv->mdio_name);
else if (ret != -ENODEV)
return ret;
#endif
diff --git a/drivers/net/fec_mxc.h b/drivers/net/fec_mxc.h
index 12cc00423fa..8e95b539cd6 100644
--- a/drivers/net/fec_mxc.h
+++ b/drivers/net/fec_mxc.h
@@ -256,6 +256,7 @@ struct fec_priv {
int (*mii_postcall)(int);
#endif
#ifdef CONFIG_DM_MDIO
+ char mdio_name[MDIO_NAME_LEN];
struct udevice *mdio_bus;
#endif
#ifdef CONFIG_DM_REGULATOR