summaryrefslogtreecommitdiff
path: root/net/dsa-uclass.c
diff options
context:
space:
mode:
authorMichael Walle <michael@walle.cc>2021-02-24 17:40:40 +0100
committerPriyanka Jain <priyanka.jain@nxp.com>2021-03-05 10:25:42 +0530
commite5d7d119287ed1bc867e77225660c1ac9bb51072 (patch)
tree5658910da0c5b80f7063cc43eae17b099e31e71c /net/dsa-uclass.c
parenta02dcbbb5a8e24a3f6cd3e7f158e1953b82d5e2e (diff)
downloadu-boot-e5d7d119287ed1bc867e77225660c1ac9bb51072.tar.gz
u-boot-e5d7d119287ed1bc867e77225660c1ac9bb51072.tar.bz2
u-boot-e5d7d119287ed1bc867e77225660c1ac9bb51072.zip
net: dsa: probe master device
DSA needs to have the master device probed first for MAC inheritance. Until now, it only works by chance because the only user (LS1028A SoC) will probe the master device first. The probe order is given by the PCI device ordering, thus it works because the master device has a "smaller" BDF then the switch device. Explicitly probe the master device in dsa_port_probe(). Fixes: fc054d563bfb ("net: Introduce DSA class for Ethernet switches") Signed-off-by: Michael Walle <michael@walle.cc> Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com> Reviewed-by: Ramon Fried <rfried.dev@gmail.com> Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
Diffstat (limited to 'net/dsa-uclass.c')
-rw-r--r--net/dsa-uclass.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/net/dsa-uclass.c b/net/dsa-uclass.c
index 88a8ea9352..7898f30e15 100644
--- a/net/dsa-uclass.c
+++ b/net/dsa-uclass.c
@@ -272,6 +272,7 @@ static int dsa_port_probe(struct udevice *pdev)
struct dsa_port_pdata *port_pdata;
struct dsa_priv *dsa_priv;
struct udevice *master;
+ int ret;
port_pdata = dev_get_parent_plat(pdev);
dsa_priv = dev_get_uclass_priv(dev);
@@ -285,6 +286,14 @@ static int dsa_port_probe(struct udevice *pdev)
return -ENODEV;
/*
+ * Probe the master device. We depend on the master device for proper
+ * operation and we also need it for MAC inheritance below.
+ */
+ ret = device_probe(master);
+ if (ret)
+ return ret;
+
+ /*
* Inherit port's hwaddr from the DSA master, unless the port already
* has a unique MAC address specified in the environment.
*/