]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
net: fec_mxc: add unique bus and device names for DM_MDIO
authorMarkus Niebel <Markus.Niebel@ew.tq-group.com>
Fri, 21 Nov 2025 17:34:47 +0000 (18:34 +0100)
committerFabio Estevam <festevam@nabladev.com>
Sat, 29 Nov 2025 20:06:34 +0000 (17:06 -0300)
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 <Markus.Niebel@ew.tq-group.com>
Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com>
Signed-off-by: Alexander Feilke <alexander.feilke@ew.tq-group.com>
drivers/net/fec_mxc.c
drivers/net/fec_mxc.h

index f62366dde6e96fe73d184d904560d45a4e988996..512f96e8df9599783c1ceadd25b213333ba0c044 100644 (file)
@@ -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
index 12cc00423fab62b7e813aabadc9480cde141f593..8e95b539cd6988aacc5d841165e6b5d15010b3eb 100644 (file)
@@ -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