net: ethernet: ti: cpsw: Assign OF node to slave devices
authorMarek Vasut <marex@denx.de>
Sun, 23 Jun 2019 12:11:43 +0000 (14:11 +0200)
committerDavid S. Miller <davem@davemloft.net>
Fri, 28 Jun 2019 21:32:51 +0000 (14:32 -0700)
Assign OF node to CPSW slave devices, otherwise it is not possible to
bind e.g. DSA switch to them. Without this patch, the DSA code tries
to find the ethernet device by OF match, but fails to do so because
the slave device has NULL OF node.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: David S. Miller <davem@davemloft.net>
Cc: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/ti/cpsw.c
drivers/net/ethernet/ti/cpsw_priv.h

index 634fc484a0b373bf870352224f61f20c2241b272..4e3026f9abed26662ddd970ddcd8c54e6b6267a4 100644 (file)
@@ -2179,6 +2179,7 @@ static int cpsw_probe_dt(struct cpsw_platform_data *data,
                        return ret;
                }
 
+               slave_data->slave_node = slave_node;
                slave_data->phy_node = of_parse_phandle(slave_node,
                                                        "phy-handle", 0);
                parp = of_get_property(slave_node, "phy_id", &lenp);
@@ -2330,6 +2331,7 @@ static int cpsw_probe_dual_emac(struct cpsw_priv *priv)
 
        /* register the network device */
        SET_NETDEV_DEV(ndev, cpsw->dev);
+       ndev->dev.of_node = cpsw->slaves[1].data->slave_node;
        ret = register_netdev(ndev);
        if (ret)
                dev_err(cpsw->dev, "cpsw: error registering net device\n");
@@ -2507,6 +2509,7 @@ static int cpsw_probe(struct platform_device *pdev)
 
        /* register the network device */
        SET_NETDEV_DEV(ndev, dev);
+       ndev->dev.of_node = cpsw->slaves[0].data->slave_node;
        ret = register_netdev(ndev);
        if (ret) {
                dev_err(dev, "error registering net device\n");
index 04795b97ee715e9af292fec1dfeb899eca69b1a5..e32f11da2dce8bd28fef7965c6a685646a81c1dd 100644 (file)
@@ -272,6 +272,7 @@ struct cpsw_host_regs {
 };
 
 struct cpsw_slave_data {
+       struct device_node *slave_node;
        struct device_node *phy_node;
        char            phy_id[MII_BUS_ID_SIZE];
        int             phy_if;