[PATCH net-next] net: ti: icssg_prueth: populate netdev of_node

Matthias Schiffer posted 1 patch 1 year, 4 months ago
drivers/net/ethernet/ti/icssg/icssg_prueth.c     | 1 +
drivers/net/ethernet/ti/icssg/icssg_prueth_sr1.c | 1 +
2 files changed, 2 insertions(+)
[PATCH net-next] net: ti: icssg_prueth: populate netdev of_node
Posted by Matthias Schiffer 1 year, 4 months ago
Allow of_find_net_device_by_node() to find icssg_prueth ports and make
the individual ports' of_nodes available in sysfs.

Signed-off-by: Matthias Schiffer <matthias.schiffer@ew.tq-group.com>
---

Tested on a TI AM64x SoC. I don't have a device using the icssg_prueth_sr1
variant of the driver, but as this part of icssg_prueth.c and
icssg_prueth_sr1.c is identical, it seems like a good idea to make the
same change in both variants.

 drivers/net/ethernet/ti/icssg/icssg_prueth.c     | 1 +
 drivers/net/ethernet/ti/icssg/icssg_prueth_sr1.c | 1 +
 2 files changed, 2 insertions(+)

diff --git a/drivers/net/ethernet/ti/icssg/icssg_prueth.c b/drivers/net/ethernet/ti/icssg/icssg_prueth.c
index 9dc9de39bb8f0..53a3e44b99a20 100644
--- a/drivers/net/ethernet/ti/icssg/icssg_prueth.c
+++ b/drivers/net/ethernet/ti/icssg/icssg_prueth.c
@@ -857,6 +857,7 @@ static int prueth_netdev_init(struct prueth *prueth,
 	}
 	ether_addr_copy(emac->mac_addr, ndev->dev_addr);
 
+	ndev->dev.of_node = eth_node;
 	ndev->min_mtu = PRUETH_MIN_PKT_SIZE;
 	ndev->max_mtu = PRUETH_MAX_MTU;
 	ndev->netdev_ops = &emac_netdev_ops;
diff --git a/drivers/net/ethernet/ti/icssg/icssg_prueth_sr1.c b/drivers/net/ethernet/ti/icssg/icssg_prueth_sr1.c
index 54b7e27608ce8..292f04d29f4f7 100644
--- a/drivers/net/ethernet/ti/icssg/icssg_prueth_sr1.c
+++ b/drivers/net/ethernet/ti/icssg/icssg_prueth_sr1.c
@@ -847,6 +847,7 @@ static int prueth_netdev_init(struct prueth *prueth,
 	}
 	ether_addr_copy(emac->mac_addr, ndev->dev_addr);
 
+	ndev->dev.of_node = eth_node;
 	ndev->min_mtu = PRUETH_MIN_PKT_SIZE;
 	ndev->max_mtu = PRUETH_MAX_MTU;
 	ndev->netdev_ops = &emac_netdev_ops;
-- 
TQ-Systems GmbH | Mühlstraße 2, Gut Delling | 82229 Seefeld, Germany
Amtsgericht München, HRB 105018
Geschäftsführer: Detlef Schneider, Rüdiger Stahl, Stefan Schneider
https://www.tq-group.com/

Re: [PATCH net-next] net: ti: icssg_prueth: populate netdev of_node
Posted by Andrew Lunn 1 year, 4 months ago
On Wed, Aug 07, 2024 at 02:12:15PM +0200, Matthias Schiffer wrote:
> Allow of_find_net_device_by_node() to find icssg_prueth ports and make
> the individual ports' of_nodes available in sysfs.
> 
> Signed-off-by: Matthias Schiffer <matthias.schiffer@ew.tq-group.com>

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew
Re: [PATCH net-next] net: ti: icssg_prueth: populate netdev of_node
Posted by MD Danish Anwar 1 year, 4 months ago

On 07/08/24 5:42 pm, Matthias Schiffer wrote:
> Allow of_find_net_device_by_node() to find icssg_prueth ports and make
> the individual ports' of_nodes available in sysfs.
> 
> Signed-off-by: Matthias Schiffer <matthias.schiffer@ew.tq-group.com>

Reviewed-by: MD Danish Anwar <danishanwar@ti.com>

-- 
Thanks and Regards,
Danish