I am working on a custom device tree for a board we are developing based on the Verdin iMX8MP SOM. Currently we are trying to get PTP 1588 working on the onboard PHY (any advice there would be helpful, but that’s not the main point of this post).
In imx8mp.dtsi - torvalds/linux, the aliases declare ethernet0=&fec and ethernet1=&eqos. Below, these are configured at register addresses 30be0000 and 30bf0000, respectively.
In imx8mp-verdin.dtsi, these aliases are swapped: ethernet0=&eqos and ethernet1=&fec. I believe the eqos device configuration is being used because the pinctrl pins appear to be the ones that go to that chip.
My question is partially a “how does yocto work” question and partially a “why was this done?” What is actually happening in the compiled device tree due to these names? Why are the aliases swapped, and how does that affect the actual .dtb generated?
Hi, I’m the Toradex AI Assistant. The Toradex Support team will follow up with you shortly!
Did you like my answer?
Good afternoon,
The confusion you’re experiencing stems from the way device tree source (DTS) files are structured and how they are compiled into a device tree blob (DTB). Let’s break down your questions:
1. Aliases in Device Trees:
Aliases in device trees are used to provide a consistent naming scheme across different parts of the device tree. They don’t change the actual hardware configuration but provide a way to reference devices more easily.
2. Swapping Aliases:
In the imx8mp.dtsi file, the aliases ethernet0 and ethernet1 are initially set to &fec and &eqos respectively. However, in the imx8mp-verdin.dtsi file, these aliases are swapped. This means that ethernet0 now points to &eqos and ethernet1 points to &fec.
3. Why the Swap?
The swap in aliases is likely done to match the specific hardware configuration of the Verdin iMX8MP SoM. The Verdin module might have different pin assignments or hardware configurations that necessitate this change. By swapping the aliases, the device tree ensures that the correct Ethernet controller is used for the appropriate physical interface.
4. Effect on Compiled Device Tree:
When the device tree is compiled, the aliases are resolved to their respective hardware nodes. The actual hardware configuration (register addresses, pinctrl settings, etc.) defined in the DTS files will be used in the final DTB. The swap in aliases ensures that the correct hardware settings are applied to the correct Ethernet controller.
5. Yocto and Device Trees:
In Yocto, the device tree files are compiled as part of the build process. The build system takes the various DTS files, applies any patches or overlays, and compiles them into a DTB file. The aliases in the DTS files are resolved during this compilation process.
6. PTP 1588 on Verdin iMX8MP:
For PTP 1588 support, you need to ensure that the Ethernet controller and PHY support hardware timestamping. The eqos (Ethernet Quality of Service) controller on the iMX8MP typically supports PTP 1588. You will need to enable the appropriate settings in the device tree and ensure that the kernel has the necessary drivers and configurations enabled.
Summary:
The swap in aliases is done to
Please, also check if these links can help you solve your problem:
I believe the ‘how does Yocto work’ part of your question was explained by AI. As for ‘why was this done?’, it is explained in the imx8mp-verdin.dtsi file itself: /* Ethernet aliases to ensure correct MAC addresses */. The eqos MAC is connected to the onboard PHY on the Verdin iMX8MP, so we renamed the Ethernet interfaces to ensure ethernet0 was the first Verdin Ethernet and ethernet1 was the second."