Skip to contentSkip to conversation

net: ethernet: ti: cpsw: Assign OF node to slave devices

PATCH New Marek Vasut 1 participant 1 message Dec 7, 2018

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: ethernet: ti: cpsw: Assign OF node to slave devices

Assign OF node to CPSW slave devices, otherwise it is not possible to bind eg. 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.

Cc David S. Miller <[email protected]>
Cc Ivan Khoronzhuk <[email protected]>
---
 drivers/net/ethernet/ti/cpsw.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/net/ethernet/ti/cpsw.c +4 -0
index a591583d120e1..702101b0aebd1 100644
@@ -383,6 +383,7 @@ struct cpsw_hw_stats {
 };
 
 struct cpsw_slave_data {
+	struct device_node *slave_node;
 	struct device_node *phy_node;
 	char		phy_id[MII_BUS_ID_SIZE];
 	int		phy_if;
@@ -3291,6 +3292,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);
@@ -3441,6 +3443,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");
@@ -3709,6 +3712,7 @@ static int cpsw_probe(struct platform_device *pdev)
 
 	/* register the network device */
 	SET_NETDEV_DEV(ndev, &pdev->dev);
+	ndev->dev.of_node = cpsw->slaves[0].data->slave_node;
 	ret = register_netdev(ndev);
 	if (ret) {
 		dev_err(priv->dev, "error registering net device\n");
Signature · 1 line
2.18.0