]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
net: mv88e6xxx: fix missing SMI address initialization
authorMarek Mojík <marek.mojik@nic.cz>
Wed, 6 Dec 2023 14:35:56 +0000 (15:35 +0100)
committerStefan Roese <sr@denx.de>
Tue, 5 Mar 2024 07:27:59 +0000 (08:27 +0100)
The mv88e6xxx driver does not currently initialize the smi_addr field, but
instead keeps the default zero value. This leads to driver being unusable
on devices where the switch is not on address zero of the mdio bus. Fix
this problem by reading the SMI address from device tree.

Signed-off-by: Marek Mojík <marek.mojik@nic.cz>
Reviewed-by: Marek Behún <kabel@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
drivers/net/mv88e6xxx.c

index c073f81e72d0dffc1f3a94bd451cb64acce68256..8fbbc1caccad0c534f1f48dc311b6da8f46f247f 100644 (file)
@@ -745,6 +745,7 @@ static int mv88e6xxx_probe(struct udevice *dev)
 {
        struct dsa_pdata *dsa_pdata = dev_get_uclass_plat(dev);
        struct mv88e6xxx_priv *priv = dev_get_priv(dev);
+       fdt_addr_t smi_addr;
        int val, ret;
 
        if (ofnode_valid(dev_ofnode(dev)) &&
@@ -753,6 +754,13 @@ static int mv88e6xxx_probe(struct udevice *dev)
                return -ENODEV;
        }
 
+       smi_addr = dev_read_addr(dev);
+       if (smi_addr == FDT_ADDR_T_NONE) {
+               dev_err(dev, "Missing SMI address\n");
+               return -EINVAL;
+       }
+       priv->smi_addr = smi_addr;
+
        /* probe internal mdio bus */
        ret = mv88e6xxx_probe_mdio(dev);
        if (ret)