* [PATCH 0/2] Populate of_node for i.MX netdevs
@ 2025-07-17 9:00 Primoz Fiser
2025-07-17 9:00 ` [PATCH 1/2] net: fec: fec_probe(): Populate netdev of_node Primoz Fiser
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Primoz Fiser @ 2025-07-17 9:00 UTC (permalink / raw)
To: Wei Fang, Shenwei Wang, Clark Wang, Andrew Lunn, davem,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, Maxime Coquelin,
Alexandre Torgue
Cc: imx, netdev, linux-kernel, linux-stm32, linux-arm-kernel,
upstream
Recently when working on predictable network names for i.MX SoCs, it
was discovered that of_node sysfs properties are missing for FEC and
EQOS interfaces.
Without this, udev is unable to expose the OF_* properties (OF_NAME,
OF_FULLNAME, OF_COMPATIBLE, OF_ALIAS, etc.) and thus we cannot identify
interface based on those properties.
Fix this by populating netdev of_node in respective drivers.
Result:
$ ls -l /sys/class/net/end1/of_node
/sys/class/net/end1/of_node ->
'../../../../../../../firmware/devicetree/base/soc@0/bus@42800000/ethernet@428a0000'/
$ ls -l /sys/class/net/end0/of_node
/sys/class/net/end0/of_node ->
'../../../../../../../firmware/devicetree/base/soc@0/bus@42800000/ethernet@42890000'/
$ udevadm info /sys/class/net/end0
P: /devices/platform/soc@0/42800000.bus/42890000.ethernet/net/end0
M: end0
R: 0
U: net
I: 2
E: DEVPATH=/devices/platform/soc@0/42800000.bus/42890000.ethernet/net/end0
E: SUBSYSTEM=net
E: OF_NAME=ethernet
E: OF_FULLNAME=/soc@0/bus@42800000/ethernet@42890000
E: OF_COMPATIBLE_0=fsl,imx93-fec
E: OF_COMPATIBLE_1=fsl,imx8mq-fec
E: OF_COMPATIBLE_2=fsl,imx6sx-fec
E: OF_COMPATIBLE_N=3
E: OF_ALIAS_0=ethernet0
E: INTERFACE=end0
E: IFINDEX=2
E: USEC_INITIALIZED=5227083
E: ID_NET_DRIVER=fec
E: ID_NET_NAMING_SCHEME=latest
E: ID_NET_NAME_MAC=enx502df44dbd5e
E: ID_NET_NAME_ONBOARD=end0
E: ID_PATH=platform-42890000.ethernet
E: ID_PATH_TAG=platform-42890000_ethernet
E: SYSTEMD_ALIAS=/sys/subsystem/net/devices/end0
E: TAGS=:systemd:
E: CURRENT_TAGS=:systemd:
$ udevadm info /sys/class/net/end1
P: /devices/platform/soc@0/42800000.bus/428a0000.ethernet/net/end1
M: end1
R: 1
U: net
I: 3
E: DEVPATH=/devices/platform/soc@0/42800000.bus/428a0000.ethernet/net/end1
E: SUBSYSTEM=net
E: OF_NAME=ethernet
E: OF_FULLNAME=/soc@0/bus@42800000/ethernet@428a0000
E: OF_COMPATIBLE_0=nxp,imx93-dwmac-eqos
E: OF_COMPATIBLE_1=snps,dwmac-5.10a
E: OF_COMPATIBLE_N=2
E: OF_ALIAS_0=ethernet1
E: INTERFACE=end1
E: IFINDEX=3
E: USEC_INITIALIZED=5370305
E: ID_NET_NAMING_SCHEME=latest
E: ID_NET_NAME_MAC=enx502df44dbd5f
E: ID_NET_NAME_ONBOARD=end1
E: ID_PATH=platform-428a0000.ethernet
E: ID_PATH_TAG=platform-428a0000_ethernet
E: SYSTEMD_ALIAS=/sys/subsystem/net/devices/end1
E: TAGS=:systemd:
E: CURRENT_TAGS=:systemd:
Primoz Fiser (2):
net: fec: fec_probe(): Populate netdev of_node
net: stmmac: Populate netdev of_node
drivers/net/ethernet/freescale/fec_main.c | 1 +
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 1 +
2 files changed, 2 insertions(+)
--
2.34.1
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/2] net: fec: fec_probe(): Populate netdev of_node
2025-07-17 9:00 [PATCH 0/2] Populate of_node for i.MX netdevs Primoz Fiser
@ 2025-07-17 9:00 ` Primoz Fiser
2025-07-21 9:44 ` Peng Fan
2025-07-17 9:00 ` [PATCH 2/2] net: stmmac: " Primoz Fiser
2025-07-17 14:02 ` [PATCH 0/2] Populate of_node for i.MX netdevs Jakub Kicinski
2 siblings, 1 reply; 7+ messages in thread
From: Primoz Fiser @ 2025-07-17 9:00 UTC (permalink / raw)
To: Wei Fang, Shenwei Wang, Clark Wang, Andrew Lunn, davem,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, Maxime Coquelin,
Alexandre Torgue
Cc: imx, netdev, linux-kernel, linux-stm32, linux-arm-kernel,
upstream
Populate netdev of_node with pdev of_node so that the network device
inherits the device tree node information from the platform device and
its of_node is available in sysfs.
Without this, udev is unable to expose the OF_* properties (OF_NAME,
OF_FULLNAME, OF_COMPATIBLE, OF_ALIAS, etc.) for the network interface.
These properties are commonly used by udev rules and other userspace
tools for device identification and configuration.
Signed-off-by: Primoz Fiser <primoz.fiser@norik.com>
---
drivers/net/ethernet/freescale/fec_main.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
index 63dac4272045..5142fed08cba 100644
--- a/drivers/net/ethernet/freescale/fec_main.c
+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -4359,6 +4359,7 @@ fec_probe(struct platform_device *pdev)
return -ENOMEM;
SET_NETDEV_DEV(ndev, &pdev->dev);
+ ndev->dev.of_node = pdev->dev.of_node;
/* setup board info structure */
fep = netdev_priv(ndev);
--
2.34.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/2] net: stmmac: Populate netdev of_node
2025-07-17 9:00 [PATCH 0/2] Populate of_node for i.MX netdevs Primoz Fiser
2025-07-17 9:00 ` [PATCH 1/2] net: fec: fec_probe(): Populate netdev of_node Primoz Fiser
@ 2025-07-17 9:00 ` Primoz Fiser
2025-07-21 9:47 ` Peng Fan
2025-07-17 14:02 ` [PATCH 0/2] Populate of_node for i.MX netdevs Jakub Kicinski
2 siblings, 1 reply; 7+ messages in thread
From: Primoz Fiser @ 2025-07-17 9:00 UTC (permalink / raw)
To: Wei Fang, Shenwei Wang, Clark Wang, Andrew Lunn, davem,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, Maxime Coquelin,
Alexandre Torgue
Cc: imx, netdev, linux-kernel, linux-stm32, linux-arm-kernel,
upstream
Populate netdev of_node with device of_node so that the network device
inherits the device tree node information in case of platform device.
On the other hand, when stmmac_dvr_probe() is called from pci device,
of_node will be NULL preserving current behavior.
With this in place, when initiated from platform device, udev will be
able to export OF_* properties (OF_NAME, OF_FULLNAME, OF_COMPATIBLE,
OF_ALIAS, etc) for the network interface. These properties are commonly
used by udev rules and other userspace tools for device identification
and configuration.
Signed-off-by: Primoz Fiser <primoz.fiser@norik.com>
---
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index f350a6662880..dfd503a87f22 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -7487,6 +7487,7 @@ int stmmac_dvr_probe(struct device *device,
return -ENOMEM;
SET_NETDEV_DEV(ndev, device);
+ ndev->dev.of_node = device->of_node;
priv = netdev_priv(ndev);
priv->device = device;
--
2.34.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 0/2] Populate of_node for i.MX netdevs
2025-07-17 9:00 [PATCH 0/2] Populate of_node for i.MX netdevs Primoz Fiser
2025-07-17 9:00 ` [PATCH 1/2] net: fec: fec_probe(): Populate netdev of_node Primoz Fiser
2025-07-17 9:00 ` [PATCH 2/2] net: stmmac: " Primoz Fiser
@ 2025-07-17 14:02 ` Jakub Kicinski
2025-07-18 5:10 ` Primoz Fiser
2 siblings, 1 reply; 7+ messages in thread
From: Jakub Kicinski @ 2025-07-17 14:02 UTC (permalink / raw)
To: Primoz Fiser
Cc: Wei Fang, Shenwei Wang, Clark Wang, Andrew Lunn, davem,
Eric Dumazet, Paolo Abeni, Maxime Coquelin, Alexandre Torgue, imx,
netdev, linux-kernel, linux-stm32, linux-arm-kernel, upstream
On Thu, 17 Jul 2025 11:00:35 +0200 Primoz Fiser wrote:
> Recently when working on predictable network names for i.MX SoCs, it
> was discovered that of_node sysfs properties are missing for FEC and
> EQOS interfaces.
>
> Without this, udev is unable to expose the OF_* properties (OF_NAME,
> OF_FULLNAME, OF_COMPATIBLE, OF_ALIAS, etc.) and thus we cannot identify
> interface based on those properties.
>
> Fix this by populating netdev of_node in respective drivers.
Seems legit, but would be good to CC Open Firmware maintainers.
If we want to make propagating the OF linkage a think I think we should
add a flavor of SET_NETDEV_DEV() which does that for the caller.
SET_NETDEV_DEV_OF() ?
--
pw-bot: cr
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 0/2] Populate of_node for i.MX netdevs
2025-07-17 14:02 ` [PATCH 0/2] Populate of_node for i.MX netdevs Jakub Kicinski
@ 2025-07-18 5:10 ` Primoz Fiser
0 siblings, 0 replies; 7+ messages in thread
From: Primoz Fiser @ 2025-07-18 5:10 UTC (permalink / raw)
To: Jakub Kicinski
Cc: Wei Fang, Shenwei Wang, Clark Wang, Andrew Lunn, davem,
Eric Dumazet, Paolo Abeni, Maxime Coquelin, Alexandre Torgue, imx,
netdev, linux-kernel, linux-stm32, linux-arm-kernel, upstream,
Rob Herring, Saravana Kannan,
open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS
Hi Jakub,
On 17. 07. 25 16:02, Jakub Kicinski wrote:
> On Thu, 17 Jul 2025 11:00:35 +0200 Primoz Fiser wrote:
>> Recently when working on predictable network names for i.MX SoCs, it
>> was discovered that of_node sysfs properties are missing for FEC and
>> EQOS interfaces.
>>
>> Without this, udev is unable to expose the OF_* properties (OF_NAME,
>> OF_FULLNAME, OF_COMPATIBLE, OF_ALIAS, etc.) and thus we cannot identify
>> interface based on those properties.
>>
>> Fix this by populating netdev of_node in respective drivers.
>
> Seems legit, but would be good to CC Open Firmware maintainers.
Added Rob & Saravana to CC.
>
> If we want to make propagating the OF linkage a think I think we should
> add a flavor of SET_NETDEV_DEV() which does that for the caller.
> SET_NETDEV_DEV_OF() ?
OK, so you suggest to add MACRO:
#define SET_NETDEV_DEV_OF(net, np) ((net)->dev.of_node = (np))
I like the idea too.
Way cleaner especially if others will join later.
Shall we do that already for v2 or as a separate series?
BR,
Primoz
--
Primoz Fiser
phone: +386-41-390-545
email: primoz.fiser@norik.com
--
Norik systems d.o.o.
Your embedded software partner
Slovenia, EU
phone: +386-41-540-545
email: info@norik.com
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] net: fec: fec_probe(): Populate netdev of_node
2025-07-17 9:00 ` [PATCH 1/2] net: fec: fec_probe(): Populate netdev of_node Primoz Fiser
@ 2025-07-21 9:44 ` Peng Fan
0 siblings, 0 replies; 7+ messages in thread
From: Peng Fan @ 2025-07-21 9:44 UTC (permalink / raw)
To: Primoz Fiser
Cc: Wei Fang, Shenwei Wang, Clark Wang, Andrew Lunn, davem,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, Maxime Coquelin,
Alexandre Torgue, imx, netdev, linux-kernel, linux-stm32,
linux-arm-kernel, upstream
On Thu, Jul 17, 2025 at 11:00:36AM +0200, Primoz Fiser wrote:
>Populate netdev of_node with pdev of_node so that the network device
>inherits the device tree node information from the platform device and
>its of_node is available in sysfs.
>
>Without this, udev is unable to expose the OF_* properties (OF_NAME,
>OF_FULLNAME, OF_COMPATIBLE, OF_ALIAS, etc.) for the network interface.
>These properties are commonly used by udev rules and other userspace
>tools for device identification and configuration.
>
>Signed-off-by: Primoz Fiser <primoz.fiser@norik.com>
>---
> drivers/net/ethernet/freescale/fec_main.c | 1 +
> 1 file changed, 1 insertion(+)
>
>diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
>index 63dac4272045..5142fed08cba 100644
>--- a/drivers/net/ethernet/freescale/fec_main.c
>+++ b/drivers/net/ethernet/freescale/fec_main.c
>@@ -4359,6 +4359,7 @@ fec_probe(struct platform_device *pdev)
> return -ENOMEM;
>
> SET_NETDEV_DEV(ndev, &pdev->dev);
>+ ndev->dev.of_node = pdev->dev.of_node;
You may need to use device_set_of_node_from_dev.
Regards,
Peng
>
> /* setup board info structure */
> fep = netdev_priv(ndev);
>--
>2.34.1
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2/2] net: stmmac: Populate netdev of_node
2025-07-17 9:00 ` [PATCH 2/2] net: stmmac: " Primoz Fiser
@ 2025-07-21 9:47 ` Peng Fan
0 siblings, 0 replies; 7+ messages in thread
From: Peng Fan @ 2025-07-21 9:47 UTC (permalink / raw)
To: Primoz Fiser
Cc: Wei Fang, Shenwei Wang, Clark Wang, Andrew Lunn, davem,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, Maxime Coquelin,
Alexandre Torgue, imx, netdev, linux-kernel, linux-stm32,
linux-arm-kernel, upstream
On Thu, Jul 17, 2025 at 11:00:37AM +0200, Primoz Fiser wrote:
>Populate netdev of_node with device of_node so that the network device
>inherits the device tree node information in case of platform device.
>On the other hand, when stmmac_dvr_probe() is called from pci device,
>of_node will be NULL preserving current behavior.
>
>With this in place, when initiated from platform device, udev will be
>able to export OF_* properties (OF_NAME, OF_FULLNAME, OF_COMPATIBLE,
>OF_ALIAS, etc) for the network interface. These properties are commonly
>used by udev rules and other userspace tools for device identification
>and configuration.
>
>Signed-off-by: Primoz Fiser <primoz.fiser@norik.com>
>---
> drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 1 +
> 1 file changed, 1 insertion(+)
>
>diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
>index f350a6662880..dfd503a87f22 100644
>--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
>+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
>@@ -7487,6 +7487,7 @@ int stmmac_dvr_probe(struct device *device,
> return -ENOMEM;
>
> SET_NETDEV_DEV(ndev, device);
>+ ndev->dev.of_node = device->of_node;
You may need to device_set_node.
TBH: I am not sure why device_set_node does not increments the refcnt,
while device_set_of_node_from_dev has. But this driver supports
non-OF platform, so using device_set_of_node_from_dev may not be good,
and I would suggest use device_set_node.
Regards
Peng
>
> priv = netdev_priv(ndev);
> priv->device = device;
>--
>2.34.1
>
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2025-07-21 8:36 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-17 9:00 [PATCH 0/2] Populate of_node for i.MX netdevs Primoz Fiser
2025-07-17 9:00 ` [PATCH 1/2] net: fec: fec_probe(): Populate netdev of_node Primoz Fiser
2025-07-21 9:44 ` Peng Fan
2025-07-17 9:00 ` [PATCH 2/2] net: stmmac: " Primoz Fiser
2025-07-21 9:47 ` Peng Fan
2025-07-17 14:02 ` [PATCH 0/2] Populate of_node for i.MX netdevs Jakub Kicinski
2025-07-18 5:10 ` Primoz Fiser
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).