BSP5 device tree overlay file modification with Yocto build

Hi,

As described in my previous question https://www.toradex.com/community/questions/58635/lvds-display-integration-with-imx8mm-verdin-and-da.html?childToView=58948#comment-58948 I was able to create Yocto Linux image, modify device tree using mmc mode (ums 0 mmc 0, copy paste dtbo file into overlays folder, and edit overlays.txt file from my host machine) and got custom display working fine.

Now I have tried to do same from Yocto build to include my version of DTBO file into device instead of default verdin-imx8mm_lt8912_overlay.dtbo.

I have functional layer for kernel

├── linux-toradex
│   └── defconfig
├── linux-toradex_%.bbappend

…and I have my-overlay.dts file and I know it is ok cause tried it.

I have also own machine version verdin-imx8mm-h.conf and changes local.conf:

├── apalis-imx8.conf

├── colibri-imx8x-v10b.conf
├── include
│   ├── apalis-imx6.inc

│   ├── colibri-imx7.inc
│   └── README
├── verdin-imx8mm.conf
├── **verdin-imx8mm-my.conf**
└── verdin-imx8mp.conf

verdin-imx8mm-my.conf I have this:

TEZI_EXTERNAL_KERNEL_DEVICETREE_BOOT = “my-overlay.dtbo”

I know Yocto build will fetch all the overlay files using this recipe: device-tree-overlays_git.bb from git://git.toradex.com/device-tree-overlays.git

I want my my-overlay.dts file to be integrated together of Toradex default files which allow me to change configuration using mmc mode and uboot.

I have created device-tree-overlays_git.bbappend recipe into my layer, used many different approach but not succeeded.

├── conf
│   └── layer.conf
├── recipes-images
└── recipes-kernel
    └── linux
        ├── device-tree-overlays_git
        │   └── my-overlay.dts
        ├── device-tree-overlays_git.bbappend
        ├── linux-toradex
        │   └── defconfig
        └── linux-toradex_%.bbappend

Typically the error is my-overlay.dts is not found from the search path. I have tried to define FILESEXTRAPATHS_append, FILESEXTRAPATHS_prepend and SRC_URI using different locations and definitions but not succeeded with Yocto build. I have also tried to but my my-overlay.dts into several different folders but bitbake will never find it. Base recipe fetch something from GIT and appended recipe should fetch something more from local folder.–mission impossible ? :slight_smile:

This is my current version of device-tree-overlays_git.bbappend

SUMMARY = "Toradex BSP device tree overlays for my great machine"
DESCRIPTION = "Toradex BSP device tree overlays from within layer."

CUSTOM_DEVICETREE = "my-overlay.dts"
# I have tried everything here X-)
FILESEXTRAPATHS_append := ":${THISDIR}"
#FILESEXTRAPATHS_prepend := "${THISDIR}/{$PN}:"

SRC_URI += "file://${CUSTOM_DEVICETREE}"

First I get this warning:
WARNING: device-tree-overlays-toradex_5.4-2.1.x-imx+gitAUTOINC+106305bdf4-r0 do_fetch: Failed to fetch URL file://my-overlay.dts, attempting MIRRORS if available

and then errors like:
ERROR: device-tree-overlays-toradex_5.4-2.1.x-imx+gitAUTOINC+106305bdf4-r0 do_fetch: Fetcher failure: Unable to find file file://my-overlay.dts anywhere. The paths that were searched were:
/home/vesaeskola/nnnn_work/nnnn-psw-manifest/tdx/build/…/layers/meta-nnnn/recipes-kernel/linux/tdx
/home/vesaeskola/nnnn_work/nnnn-psw-manifest/tdx/build/…/layers/meta-toradex-nxp/recipes-kernel/linux/device-tree-overlays-toradex_5.4-2.1.x-imx+gitAUTOINC+106305bdf4/tdx

I assume there must be quite easy method to change that file, and kindly ask if you can tell what :slight_smile:

Br Vesa

Hello @veskola ,

Generally, the device tree and the device tree sources are searched in arch/arm/boot/dts. If you files are placed in a different folder, they might not be able to be detected by the bbappend.
Could you please re-check your folder and file placement structure?

And have you included your “new machine file” in the conf/local.conf? Something like, include conf/machine/verdin-imx8mm-h.conf.

Please check if you have followed all the instructions from here. If you have done everything as described in the article and you still have issues, then I recommend you to compile your Device tree separately and add it as a meta-layer to your Yocto build.

I hope this helps!

Best Regards,
Janani

Hi,

Let’s forget this DTBO I talked previously, and investigate the problem to construct full DTB instead for iMX8mm using BSP5.x. I’m following instructions in the proposed link (Custom meta layers, recipes and images in Yocto Project (hello-world examples) | Toradex Developer Center).

I have kernel bbappend recipe in /tdx/layers/meta-mylayer/recipes-kernel/linux/linux-toradex_%.bbappend. I am able to modify kernel configuration with it. I have my version of device tree, at this point it is just copy paste of imx8mm-verdin-nonwifi-dev.dts, only modification I have made is rename and compatibility change:

[imx8mm-verdin-nonwifi-dev-my.dts]:

// SPDX-License-Identifier: GPL-2.0+ OR MIT
/*
 * Copyright 2019 Toradex
 */

/dts-v1/;

#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/interrupt-controller/arm-gic.h>
#include "dt-bindings/pwm/pwm.h"
#include "imx8mm-verdin-nonwifi-dev.dts"

/ {
	model = "My Verdin iMX8M Mini on Verdin Development Board";
	compatible = "my,verdin-imx8mm-nonwifi-dev",
		     "toradex,verdin-imx8mm-nonwifi-dev",
		     "toradex,verdin-imx8mm-nonwifi",
		     "toradex,verdin-imx8mm",
		     "fsl,imx8mm";
};

&gpu {
	status = "okay";
};

At this point I can build kernel (and image) without problem using bitbake linux-toradex.

Next I will add my DTS complied as DTB into image, in the file:

[.../tdx/layers/meta-mylayer/conf/layer.conf]
include conf/machine/verdin-imx8mm-extra.conf

and there I have this line
[tdx/layers/meta-mylayer/conf/machine/verdin-imx8mm-extra.conf]
KERNEL_DEVICETREE_append = " imx8mm-verdin-nonwifi-dev-my.dtb"

Now the build is broken, error is:

| make[2]: *** No rule to make target 'arch/arm64/boot/dts/imx8mm-verdin-nonwifi-dev-my.dtb'.  Stop.
| make[1]: *** [/.../tdx/build/tmp/work-shared/verdin-imx8mm/kernel-source/Makefile:1265: imx8mm-verdin-nonwifi-dev-my.dtb] Error 2

…and if I comment this out, image creation is again succeeded again, but obviously my DTS is not used.

What am I missing ?

Br Vesa

Hello @veskola ,

Have you created the Makefile? If so, then I think you have to edit Makefile inside arch/arm/boot/dts to add the correct entry for the dtb.

Best Regards,
Janani

No I haven’t. Idea is just take layers from Toradex Yocto BSP delivery and add minimal own layer on top of that to make minimal DTS change, just like done in the documention (recipes-kernel/linux/linux-toradex_%.bbappend), there is not mentioned anything about Makefile. How I can create such Makefile for Yocto build, where and especially why i should do Makefile to be able compile one extra DTS together with others ? Where is Makefile which compile e.g. this one imx8mm-verdin-nonwifi-dev.dtb

If you refer to the path “arch/arm/boot/dts” where do you refer ? Do you mean folders in Yocto tmp directory:
…/tdx/build/tmp/work/verdin_imx8mm-tdx-linux/linux-toradex/5.4.77+gitAUTOINC+a2f08dfd79-r0/git/arch/arm64/boot/dts/freescale
or may be here:
…/tdx/build/tmp/work-shared/verdin-imx8mm/kernel-source/arch/arm64/boot/dts/freescale

Anyhow, there is no sense to do anything inside tmp folder, because those will disappear. I need to do something into Layers/recipes to be able repeat this in Yocto build but I cannot find any arch/arm64/boot/dts/ folder in layers/recipes.

Question: There is this file: tdx/layers/meta-toradex-nxp/conf/machine/verdin-imx8mm.conf which is used by my SOM and it have these:

TEZI_EXTERNAL_KERNEL_DEVICETREE_BOOT = "verdin-imx8mm_lt8912_overlay.dtbo"
TORADEX_PRODUCT_IDS = "0055 0057 0059 0060"
TORADEX_PRODUCT_IDS[0055] = "imx8mm-verdin-wifi-v1.1-dev.dtb"
TORADEX_PRODUCT_IDS[0057] = "imx8mm-verdin-nonwifi-v1.1-dev.dtb"
TORADEX_PRODUCT_IDS[0059] = "imx8mm-verdin-nonwifi-v1.1-dev.dtb"
TORADEX_PRODUCT_IDS[0060] = "imx8mm-verdin-wifi-v1.1-dev.dtb"

May I get some documentation what that table TORADEX_PRODUCT_IDS means, and how I can use it in my layers. It looks something I need to change ?

TORADEX_PRODUCT_IDS[0057] = "imx8mm-verdin-nonwifi-dev**-my.**dtb"
TORADEX_PRODUCT_IDS[0059] = "imx8mm-verdin-nonwifi-dev**-my**.dtb"

BTW: If i change “KERNEL_DEVICETREE_append” to “KERNEL_DEVICETREE” build will be completed but my DTS is not compiled at all.

Dear @veskola

| May I get some documentation what that table TORADEX_PRODUCT_IDS means

These are the Product identification numbers’s first four digits. And as you are using Verdin iMX8M Mini Quad 2GB Wi-fi / BT IY V1.0B, it would be [0055], as mentioned in the snippet you pasted. And this found in the product page in our website. But you would not need to change anything there, as the dtbo already includes your SoM

| just like done in the documention (recipes-kernel/linux/linux-toradex_%.bbappend)

Could you please check if you have used the correct and specific version of U-Boot and kernel, instead of %? in your case with BSP 5 and Verdin iMX8M mini, the corresponding git repos to be synced are toradex_imx_v2020.04_5.4.24_2.1.0(U-Boot) and toradex_5.4-2.1.x-imx (kernel Git branch) more info here

| How I can create such Makefile for Yocto build, where and especially why i should do Makefile to be able compile one extra DTS together with others ?

If you want the kernel to build your newly created device tree file, you must add it to the device tree’s Makefile in the path arch/arm/boot/dts/Makefile . If following is the device tree you need to compile, then you need to add a line imx8mm-verdin-nonwifi-dev.dtb \ in the makefile.

A similar thread in the community that you could also refer:

Best Regards,
Janani

Hi,

I got original problem solved using following solution:

  1. Change overlays.txt file content from the BOOT partition:
    verdin-imx8mm-my-machine.conf file added into the tdx/layers/meta-toradex-nxp/conf/machine folder with content:

     require conf/machine/verdin-imx8mm.conf
     MACHINEOVERRIDES =. "verdin-imx8mm:"
     TEZI_EXTERNAL_KERNEL_DEVICETREE_BOOT = ""    
    

This was important to remove HDMI bridge adapter loading at u-boot runtime which break the LVDS bridge functionality.

2 . Custom LVDS panel support was added by patching imx8mm.dtsi file:
0001-add-support-for-Evervision-panel-display.patch was added into the tdx/layers/my-layer/recipes-kernel/linux/linux-toradex/verdin-imx8mm with content:

     arch/arm64/boot/dts/freescale/imx8mm.dtsi | 111 ++++++++++++++++++++++
     1 file changed, 111 insertions(+)
    
    diff --git a/arch/arm64/boot/dts/freescale/imx8mm.dtsi b/arch/arm64/boot/dts/freescale/imx8mm.dtsi
    index f22417f4abbf..ec39cb9ff6d4 100755
    --- a/arch/arm64/boot/dts/freescale/imx8mm.dtsi
    +++ b/arch/arm64/boot/dts/freescale/imx8mm.dtsi
    @@ -1486,3 +1486,114 @@
     		status = "disabled";
     	};
     };
    +
    +&{/} {
    +	backlight {
    +		compatible = "pwm-backlight";
    +		brightness-levels = <0 45 63 88 119 158 203 255>;
    +		default-brightness-level = <4>;
    +		/* Verdin MEZ_DSI_1_BKL_EN (SODIMM 21) */
    +		enable-gpios = <&gpio3 3 GPIO_ACTIVE_HIGH>;
    +		pinctrl-names = "default";
    +		pinctrl-0 = <&pinctrl_mez_dsi_1_bkl_en>;
    +		power-supply = <&reg_3p3v>;
    +		/* Verdin MEZ_PWM_3_DSI (SODIMM 19) */
    +		pwms = <&pwm1 0 6666667 PWM_POLARITY_INVERTED>;
    +	};
    +};
    +
    +&{/soc@0/bus@32c00000/display-subsystem} {
    +	status = "okay";
    +};
    +
    +/* Verdin I2C_2_DSI */
    +&i2c2 {
    +	clock-frequency = <10000>;
    +	pinctrl-names = "default";
    +	pinctrl-0 = <&pinctrl_i2c2>;
    +	status = "okay";
    +};
    +
    +/* Verdin I2C_4 */
    +&i2c4 {
    +	#address-cells = <1>;
    +	#size-cells = <0>;
    +	status = "okay";
    +
    +	bridge@2c {
    +		compatible = "ti,sn65dsi83";
    +		/* Verdin MEZ_GPIO_1 (SODIMM 206) */
    +		enable-gpios = <&gpio3 4 GPIO_ACTIVE_HIGH>;
    +		pinctrl-names = "default";
    +		pinctrl-0 = <&pinctrl_mez_gpio1>;
    +		reg = <0x2c>;
    +		ti,dsi-lanes = <4>;
    +		ti,height-mm = <67>;
    +		ti,lvds-bpp = <24>;
    +		ti,lvds-format = <2>;
    +		ti,width-mm = <105>;
    +
    +		display-timings {
    +			native-mode = <&lvds_timing0>;
    +
    +			lvds_timing0: lt170410_2whc {
    +				/*
    +				 * PLL1 is at 2079000000, take PLL1/70
    +				 * otherwise we don't get a picture NXP i.MX8M Plus
    +				 */clock-frequency = <29700000>;
    +				hactive = <800 800 800>;
    +				hfront-porch = <18 18 18>;
    +				hback-porch = <88 88 88>;
    +				hsync-len = <22 22 22>;
    +				vactive = <480 480 480>;
    +				vfront-porch = <10 10 10>;
    +				vback-porch = <32 32 32>;
    +				vsync-len = <3 3 3>;
    +				de-active = <1>;
    +				pixelclk-active = <0>;
    +				
    +			};
    +		};
    +
    +		port {
    +			dsi85_in: endpoint {
    +				remote-endpoint = <&mipi_dsi_bridge1_out>;
    +			};
    +		};
    +
    +	};
    +
    +	touch@38 {
    +		status = "okay";
    +		compatible = "evervision,ev-ft5726" , "edt,edt-ft5x06";
    +		reg = <0x38>;
    +		interrupts = <15 IRQ_TYPE_EDGE_FALLING>;
    +		touchscreen-size-x = <2048>;
    +		touchscreen-size-y = <2048>;
    +		interrupt-parent = <&gpio3>;
    +	};
    +};
    +
    +&lcdif {
    +	status = "okay";
    +};
    +
    +&mipi_dsi {
    +	#address-cells = <1>;
    +	#size-cells = <0>;
    +	status = "okay";
    +
    +	port@1 {
    +		reg = <1>;
    +
    +		mipi_dsi_bridge1_out: endpoint {
    +			remote-endpoint = <&dsi85_in>;
    +			attach-bridge;
    +		};
    +	};
    +};
    +
    +&gpu {
    +	status = "okay";
    +};
    +
    -- 
    2.26.0

linux-toradex_%.bbappend file was added into the custom layer …/tdx/layers/my-layer/recipes-kernel/linux with content:

# This recipe modify linux-toradex-mainline-5.4 recipe in the my-system    
FILESEXTRAPATHS_prepend := "${THISDIR}/linux-toradex:"
SUMMARY = "My Linux kernel additions and modification"
SRC_URI += "file://imx8mm_fragment.cfg"
SRC_URI_append_verdin-imx8mm = "\
                                file://0001-add-support-for-Evervision-panel-display.patch \
                                "

I assume I can now use different iMX8mm SOM versions (wifi and no-wifi) and all of those will get LVDS support without extra effort.

3 . Kernel configuration was changed to have touch functionality, this was done by configuration fragment definition:
imx8mm_fragment.cfg was added into the tdx/layers/my-layer/recipes-kernel/linux/linux-toradex with content:

CONFIG_LOCALVERSION="-5.2.0-devel"
CONFIG_LOCALVERSION_AUTO=y
CONFIG_TOUCHSCREEN_EDT_FT5X06=y
# CONFIG_MXC_GPU_VIV is not set

4 . Machine type was changed to be custom:
local.conf file was edited to have this definition:

MACHINE ?= "verdin-imx8mm-my-machine"

After this I realize u-boot need a separate DTS change, but this was something I didn’t get working. I tried following:
5 . Custom LVDS panel support by was added by patching imx8mm-verdin.dts file, 0001-LVDS-support.patch file added into tdx/layers/my-layer/recipes-bsp/u-boot/u-boot-toradex/verdin-imx8mm with content:

arch/arm/dts/imx8mm-verdin.dts | 55 +++++++++++++++++++++++-----------
 1 file changed, 37 insertions(+), 18 deletions(-)

diff --git a/arch/arm/dts/imx8mm-verdin.dts b/arch/arm/dts/imx8mm-verdin.dts
index e134a13fb9..e808982417 100644
--- a/arch/arm/dts/imx8mm-verdin.dts
+++ b/arch/arm/dts/imx8mm-verdin.dts
@@ -19,7 +19,6 @@
 	aliases {
 		eeprom0 = &eeprom_module;
 		eeprom1 = &eeprom_carrier;
-		eeprom2 = &eeprom_mipi_dsi;
 	};
 
 	regulators {
@@ -312,30 +311,48 @@
 	};
 
 	/* MIPI-DSI to HDMI adapter */
-	lt8912@48 {
-		compatible = "lontium,lt8912";
-		ddc-i2c-bus = <&i2c2>;
-		hpd-gpios = <&gpio3 15 GPIO_ACTIVE_HIGH>;
-		reset-gpios = <&gpio5 5 GPIO_ACTIVE_LOW>;
+	bridge@2c {
+		compatible = "ti,sn65dsi83";
+		enable-gpios = <&gpio3 4 GPIO_ACTIVE_HIGH>;
 		pinctrl-names = "default";
-		pinctrl-0 = <&pinctrl_gpio_hpd>, <&pinctrl_gpio1>,
-			    <&pinctrl_gpio2>;
-		reg = <0x48>;
+		pinctrl-0 = <&pinctrl_gpio1>;
+		reg = <0x2c>;
+
+		ti,dsi-lanes = <4>;
+		ti,height-mm = <67>;
+		ti,lvds-bpp = <24>;
+		ti,lvds-format = <2>;
+		ti,width-mm = <105>;
+
+		display-timings {
<<etc..>>

6 . u-boot-toradex_%.bbappend file was created into tdx/layers/my-layer/recipes-bsp/u-boot with following content:

# This recipe modify u-boot-toradex_2020.%.bb recipe in the system

#Somewhere it was said Yocto patch automatically, but I will let these here anyway
FILESEXTRAPATHS_prepend := "${THISDIR}/u-boot-toradex:"

SUMMARY = "U-Boot bootloader additions and modification"

# Verdin-imx8mm DTS change for touch and display is in folder 'verdin-imx8mm'
SRC_URI_append_verdin-imx8mm = "\
	file://0001-LVDS-support.patch \
	"

It seems the patch for uboot DTS is ok in source level but in runtime I can see this error:

Reset cause: POR
DRAM:  2 GiB
MMC:   FSL_SDHC: 0, FSL_SDHC: 1
Loading Environment from MMC... OK
Fail to setup video link
In:    serial
Out:   serial
Err:   serial
Model: Toradex Verdin iMX8M Mini Quad 2GB Wi-Fi / BT IT V1.1A, Serial# 06803931
Carrier: Toradex Dahlia V1.0C, Serial# 00000000

I hope to get a bit more clear documentation of u-boot configuration and how to adding custom LVDS there, I assume the problem is in missing panel driver support but all this will took quite lot of time.

Br Vesa

Hello @veskola ,

Are you trying to use a dual-channel LVDS with our DSi - HDMI adapter?

Of course not, with LVDS panel I’m using DSI to LVDS adapter (Verdin DSI to LVDS Adapter which contain SN65DSI84-Q1 chip). Adapter is working fine when Linux is booting, just like I have described in the original post. Last problem is related only to u-boot display out.

Final target is to integrate this chip or maybe SN65DSI83 into our custom carrier board.

@veskola ,

Thank you for your message.

The error you see with the U-boot is because the video support is not enabled for the U-Boot. But you would still be able to drive a display because it is enabled in the Linux kernel. We were able to see a display (HDMI) even after U-boot threw an error.

But I understand your display is also not working?

Best Regards,
Janani

During u-boot phase not working, in Linux boot and afterwards display is working fine.

I do not need it immediately, but sooner or later I need to fix this. Have I understand correctly, even splash screen is not possible if video support is not enabled for u-boot ?

Is it possible I can enable video support for U-Boot somehow or is it something coming later with Toradex Yocto BSP reference layers update ?

Dear @veskola ,

You still should at least see the console working, if not the graphical stack. When you don’t see them yet, can you please post a question as a separate thread.

And you are right with the U-Boot splash screen. That would not be possible, but I would like to ask if its really needed for your application as the U-Boot splash screens are super short. Generally, we recommend to use splash screen from the Kernel

BR, Janani

Actually I started this exercise by configuring splash screen for kernel but for unknown reason it was not succeeded. Next i realized that error info in u-boot log, and thought that was the root cause for not working splash screen. I followed the splash screen integration instructions from Toradex web pages. I also patched the arch/arm/dts/imx8mm-verdin.dts file I assume is used by u-boot.

If I halt u-boot, the display is totally white, if i keep it in this state long time it starts to ‘burn’ from the corners, and it will take quite long time panel to recover. I feel this can’t be healthy for the panel in long terms. Attached image illustrate this ‘burning’

If u-boot is stopped by keyboard, one give a command ‘ums 0 mmc 0’ to manipulate BOOT partition content, is it normal during that time the panel is totally white ?

In this state I can see this text in my host (tty connection), I would like to see it in panel instead.

MMC:   FSL_SDHC: 0, FSL_SDHC: 1 
Loading Environment from MMC... OK
Fail to setup video link
In:    serial
Out:   serial
Err:   serial
Model: Toradex Verdin iMX8M Mini Quad 2GB Wi-Fi / BT IT V1.1A, Serial# 06803931
Carrier: Toradex Dahlia V1.0C, Serial# 00000000

 BuildInfo:
  - ATF 7f1187b
  - U-Boot 2020.04-5.2.0-devel+git.586f79f64f6a

Net:   eth0: ethernet@30be0000
Normal Boot
Hit any key to stop autoboot:  0 
Verdin iMX8MM #  

Now for testing I wait about 30 minutes in u-boot halt state, and then let it to boot into Linux. During Linux boot I can see boot log running in the panel, but there is this ‘burning’ in the corners. The display does not have contrast, corners have that issue, but it will recover within hour or couple back to normal.

I feel there should be done some initialization for the panel in the start of u-boot to prevent this happen ? Some initialization for the DSI/LVDS bridge chip ?

alt text

Dear @veskola ,

When you are in U-boot, you don’t see anything on your display panel. That is common. But usually, the display is just off (as in black). But in your case, it looks like the backlight is turned on. I think this needs to changed in the display’s driver setting.

But the topics that we discuss now are not related to the original question, I will close the comments on this thread, adhering to the community norms.

However, when you still have questions related to this topic, please kindly post your queries in a separate question.

Thank you for your understanding.

Best Regards,
Janani.