mirror of
https://github.com/u-boot/u-boot.git
synced 2025-05-09 03:21:51 +00:00
net: dsa: introduce a .port_probe() method in struct dsa_ops
Some drivers might want to execute code for each port at probe time, as opposed to executing code just-in-time for the port selected for networking. To cater to that use case, introduce a .port_probe() callback method into the DSA switch operations which is called for each available port, at the end of dsa_port_probe(). Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com> Reviewed-by: Ramon Fried <rfried.dev@gmail.com> Tested-by: Michael Walle <michael@walle.cc>
This commit is contained in:
parent
5eee5ab916
commit
4b46e83885
2 changed files with 12 additions and 1 deletions
|
@ -270,6 +270,7 @@ static void dsa_port_set_hwaddr(struct udevice *pdev, struct udevice *master)
|
|||
static int dsa_port_probe(struct udevice *pdev)
|
||||
{
|
||||
struct udevice *dev = dev_get_parent(pdev);
|
||||
struct dsa_ops *ops = dsa_get_ops(dev);
|
||||
struct dsa_port_pdata *port_pdata;
|
||||
struct dsa_priv *dsa_priv;
|
||||
struct udevice *master;
|
||||
|
@ -299,6 +300,13 @@ static int dsa_port_probe(struct udevice *pdev)
|
|||
|
||||
dsa_port_set_hwaddr(pdev, master);
|
||||
|
||||
if (ops->port_probe) {
|
||||
err = ops->port_probe(dev, port_pdata->index,
|
||||
port_pdata->phy);
|
||||
if (err)
|
||||
return err;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue