Kirkstone - Custom Device Tree in meta-layer

Hi,

I want to use a custom device tree in my meta-layer to add names for different GPIO lines to the system. I use this guide from Toradex as a reference but my GPIO names aren´t exported to the system.

I did the following steps

  • I add a file gpio_verdin_plus.dts to a recipes-kernel/linux/linux-toradex/Verdin-Plus directory in my meta-layer. The file looks like this:
&gpio3 {
	gpio-line-names = "chrg-fault",
			  "Signal1",
			  "",
			  "",
			  "",
			  "",
			  "Signal2",
			  "",
			  "",
			  "",
			  "",
			  "",
			  "",
			  "",
			  "",
			  "",
			  "",
			  "",
			  "",
			  "",
			  "",
			  "",
			  "",
			  "",
			  "",
			  "",
			  "",
			  "",
			  "",
			  "";
};
  • I add a file verdin_plus.dts to a recipes-kernel/linux/linux-toradex/Verdin-Plus directory in my meta-layer. The file looks like this:
/dts-v1/;

#include "imx8mp-verdin.dtsi"
#include "imx8mp-verdin-wifi.dtsi"
#include "imx8mp-verdin-dev.dtsi"

#include "gpio.dts"

/ {
    model = "Toradex Verdin iMX8M Mini WB on Verdin Development Board";
    compatible = "toradex,verdin-imx8mp-wifi-dev",
                 "toradex,verdin-imx8mp-wifi",
                 "toradex,verdin-imx8mp",
                 "fsl,imx8mp";
};

  • I add a linux-toradex_%.bbappend file to recipes-kernel/linux with the following content:
SRC_URI += " \
    file://Verdin-Plus/verdin_plus.dts \
    file://Verdin-Plus/gpio_verdin_plus.dts \
"

do_configure:append:verdin-imx8mp () {
    cp ${WORKDIR}/Verdin-Plus/gpio_verdin_plus.dts ${S}/arch/arm64/boot/dts/freescale/gpio.dts

    cp ${WORKDIR}/Verdin-Plus/verdin_plus.dts ${S}/arch/arm64/boot/dts/freescale/verdin_plus.dts
}
  • I add a verdin-imx8mp-extra.conf to the conf/machine directory in my meta-layer with the following content:
KERNEL_DEVICETREE:append = " freescale/verdin_plus.dtb"
  • Now I build everything for the Verdin Plus
  • After the build I check the file /proc/device-tree/soc@0/bus@30000000/gpio@30220000/gpio-line-names and get the following output:
SODIMM_52SODIMM_54SODIMM_56SODIMM_58SODIMM_60SODIMM_62SODIMM_66SODIMM_64SODIMM_34SODIMM_19SODIMM_32SODIMM_30SODIMM_59SODIMM_57SODIMM_63SODIMM_61

So it looks that my Device Tree isn´t used. Where is my mistake?

Hi, I’m the Toradex AI Assistant. The Toradex Support team will follow up with you shortly!

Did you like my answer?

:+1: :-1:


Based on the context provided, it seems like the custom device tree is not being utilized as expected. Here are some potential areas to investigate and verify:

  1. Device Tree Compilation: Ensure that the custom device tree files are being compiled correctly. Check the build logs for any errors or warnings related to device tree compilation. It’s crucial to confirm that the custom device tree is being included in the final image.

  2. Bootloader Configuration: Verify that the bootloader is configured to load the correct DTB file. If the bootloader is not loading the new DTB, the system will default to the original device tree. You can check the boot logs to see which device tree is being loaded.

  3. File Paths and Naming: Double-check the paths and filenames in the SRC_URI and do_configure steps to ensure they are correct. Make sure the files are being copied to the right locations in the build output.

  4. Build Process Verification: After building, confirm that the correct DTB is being loaded at boot time. This can be done by reviewing the boot logs to see which device tree is being loaded.

  5. Integration Steps: Review the integration steps to ensure that the custom device tree is being referenced correctly in the kernel configuration and that there are no conflicting configurations in other layers.

  6. Device Tree Inclusion: Ensure that the custom device tree file gpio_verdin_plus.dts is correctly included in the main device tree file verdin_plus.dts. The inclusion should be properly referenced and not commented out or missing.

By focusing on these areas, you should be able to identify where the integration process might be failing and ensure that the custom GPIO names are recognized by the system.

Please, also check if these links can help you solve your problem:

Interrupts not fired on M7 when Torizon OS is running.

Hello @Kampi,

The general procedure followed here appears to be correct, your custom device tree should be built and present in the image at this point.
Please confirm if it is in your board under /boot.

The issue you see is likely that the device tree is not loaded by default. This is a u-boot configuration, that can be changed at runtime by setting the fdtfile variable in u-boot with the correct device tree and resetting the board.

To configure this in a Yocto build, you will need to setup a .bbappend file for u-boot.
An example configuration for this is at the end of the “Customize the Kernel” section on the following page: Custom meta layers, recipes and images in Yocto Project (hello-world examples) | Toradex Developer Center

Please also note that the gpio.dts file is used as a .dtsi file, so it should be named gpio.dtsi.

If this does not work or if you have other questions, please feel free to reach out.

Best Regards,
Bruno

Hi @bruno.tx

I rename the files to .dtsi. The boot directory contains the following Device Trees

image

So there is no verdin_plus.dtb available.

Hello @Kampi,

Just to confirm, did you add the following line to your layer.conf file?

include conf/machine/verdin-imx8mp-extra.conf

Best Regards,
Bruno

Hi @bruno.tx

it looks that I missed the line. After adding it I get this error:

/tmp/work-shared/verdin-imx8mp/kernel-source/arch/arm64/boot/dts/freescale/imx8mp.dtsi:1172.26-1185.6: ERROR (phandle_references): /soc@0/bus@30800000/spi@30bb0000: Reference to non-existent node or label "pinctrl_flexspi0"

Hello @Kampi,

What version of the BSP and kernel are you using?

Best Regards,
Bruno

Hi @bruno.tx,

I use the latest Kirkstone version from Toradex with Kernel 5.15.148+gitAUTOINC+8c5c2dcbf6

Hi @Kampi,

Noted, then you should not be seeing such problems.

Can you send me the exact files you have for the .dts and the .dtsi so I can try to reproduce the problem?

Best Regards,
Bruno

Hi @bruno.tx,

sure. How can I send it to you?

@Kampi,

You can either send them here directly or upload them to share.toradex.com and send an email with the link to support.eu@toradex.com.

Best Regards,
Bruno

Hi @bruno.tx

I sent you the link to the meta-layer.

Hello @Kampi,

I received it, thanks!

While I did not yet start a build with it, I had a look at the device tree files.
On your .dts file for the Verdin iMX8MP, please try to make the following change:

Remove:

#include "imx8mp.dtsi"
#include "imx8mp-verdin.dtsi"
#include "imx8mp-verdin-dev.dtsi"

Add in their place:

#include "imx8mp-verdin.dtsi"
#include "imx8mp-verdin-wifi.dtsi"
#include "imx8mp-verdin-dev.dtsi"

Best Regards,
Bruno

Hi @bruno.tx,

my bad. I saw that another Device Tree has deleted the flexspi-node. I removed this line and the build of the Device Tree is successful now. I will also add your changes.

@bruno.tx it´s working now. The issue was the missing include of the extra conf file.

Thanks for your help!

Hello @Kampi,

Perfect, thanks for the update!

Best Regards,
Bruno