[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240503232445.oayegsi6au7qxgpl@joaog-nb>
Date: Fri, 3 May 2024 20:24:45 -0300
From: João Paulo Gonçalves <jpaulo.silvagoncalves@...il.com>
To: Hiago De Franco <hiagofranco@...il.com>
Cc: "David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
Sean Anderson <sean.anderson@...ux.dev>, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org,
Hiago De Franco <hiago.franco@...adex.com>
Subject: Re: [PATCH] net: ethernet: ti: am65-cpsw-nuss: create platform
device for port nodes
On Fri, May 03, 2024 at 05:00:38PM -0300, Hiago De Franco wrote:
> From: Hiago De Franco <hiago.franco@...adex.com>
>
> After this change, an 'of_node' link from '/sys/devices/platform' to
> '/sys/firmware/devicetree' will be created. The 'ethernet-ports' device
> allows multiple netdevs to have the exact same parent device, e.g. port@x
> netdevs are child nodes of ethernet-ports.
>
> When ethernet aliases are used (e.g. 'ethernet0 = &cpsw_port1' and
> 'ethernet1 = &cpsw_port2') in the device tree, without an of_node
> device exposed to the userspace, it is not possible to determine where
> exactly the alias is pointing to.
>
> As an example, this is essential for applications like systemd, which rely
> on the of_node information to identify and manage Ethernet devices
> using device tree aliases introduced in the v251 naming scheme.
>
> Signed-off-by: Hiago De Franco <hiago.franco@...adex.com>
> ---
> drivers/net/ethernet/ti/am65-cpsw-nuss.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/drivers/net/ethernet/ti/am65-cpsw-nuss.c b/drivers/net/ethernet/ti/am65-cpsw-nuss.c
> index 1d00e21808c1..f74915f56fa2 100644
> --- a/drivers/net/ethernet/ti/am65-cpsw-nuss.c
> +++ b/drivers/net/ethernet/ti/am65-cpsw-nuss.c
> @@ -2091,6 +2091,13 @@ static int am65_cpsw_nuss_init_slave_ports(struct am65_cpsw_common *common)
> if (strcmp(port_np->name, "port"))
> continue;
>
> + if (!of_platform_device_create(port_np, NULL, NULL)) {
> + dev_err(dev, "%pOF error creating port platform device\n",
> + port_np);
> + ret = -ENODEV;
> + goto of_node_put;
> + }
> +
> ret = of_property_read_u32(port_np, "reg", &port_id);
> if (ret < 0) {
> dev_err(dev, "%pOF error reading port_id %d\n",
> --
> 2.43.0
>
>
Reviewed-by: Joao Paulo Goncalves <joao.goncalves@...adex.com>
Regards,
João Paulo Gonçalves
Powered by blists - more mailing lists