Question about imx6qdl-colibri property in imx6qdl-colibri.dtsi

I am about to port my BSP changes from toradex_4.9-2.3.x to toradex_5.4-2.3.x.

I customized the device tree as explained in Device Tree Customization. I.e. I copied arch/arm/boot/dts/imx6dl-colibri-eval-v3.dts and modified it to meet the needs of our custom carrier board.

When integrating my changes into a new copy of imx6dl-colibri-eval-v3.dts from toradex_5.4-2.3.x-imx compiling the device tree failed at first:

 make imx6dl-colibri-myboard.dtb
  DTC     arch/arm/boot/dts/imx6dl-colibri-myboard.dtb
arch/arm/boot/dts/imx6dl-colibri-pe.dtsi:171.33-183.4: ERROR (duplicate_label): /soc/aips-bus@2000000/iomuxc@20e0000/csi_gpio-1: Duplicate label 'pinctrl_csi_gpio_1' on /soc/aips-bus@2000000/iomuxc@20e0000/csi_gpio-1 and /soc/aips-bus@2000000/iomuxc@20e0000/imx6qdl-colibri/csi_gpio-1
arch/arm/boot/dts/imx6dl-colibri-pe.dtsi:184.33-187.4: ERROR (duplicate_label): /soc/aips-bus@2000000/iomuxc@20e0000/csi_gpio-2: Duplicate label 'pinctrl_csi_gpio_2' on /soc/aips-bus@2000000/iomuxc@20e0000/csi_gpio-2 and /soc/aips-bus@2000000/iomuxc@20e0000/imx6qdl-colibri/csi_gpio-2
ERROR: Input tree has errors, aborting (use -f to force output)
make[1]: *** [scripts/Makefile.lib:285: arch/arm/boot/dts/imx6dl-colibri-myboard.dtb] Error 2
make: *** [Makefile:1270: imx6dl-colibri-myboard.dtb] Error 2

It turned out in commit “ARM: dts (ds): imx6: Merge changes from toradex_4.9-2.3.x-imx-next”
https://git.toradex.com/cgit/linux-toradex.git/commit/?h=toradex_5.4-2.3.x-imx&id=3ed8534fb0f612e534ca770498635ffd4082f9a0
a new property imx6qdl had been introduced within &iomuxc in arch/arm/boot/dts/imx6qdl-colibri.dtsi. Has this been done on purpose? I am just wondering because the indention level had not been adjusted and because the purpose of it is not clear to me.

Hi @lmoellendorf !

I would say that most certainly yes, as it is still there (talking about BSP 5 LTS here :slight_smile: ). And the content of the iomuxc node is probably used/poked/modified in every embedded project. Therefore it is hard to say that it might be wrong.

Looking at the arch/arm/boot/dts/imx6qdl-colibri.dtsi file from BSP 5 (branch toradex_5.4-2.3.x-imx) I see that the indentation is indeed off.

About the purpose, I actually don’t know… comparing imx6qdl-colibri.dtsi from BSP 5 downstream-based (branch toradex_5.4-2.3.x-imx) with BSP 5 mainline-based (branch toradex_5.4.y) shows that the the imx6qdl-colibri node is only present in downstream-based.


Side note: as you are porting your Colibri iMX6 project to a new kernel (which is great), I would like to ask: why are you porting it to a downstream kernel?

I think it would be better to port upstream instead. Since BSP 6 is mainline only for i.MX6-based modules, you are going to have a probably better (smoother) transition from BSP 5 to BSP 6 in the future if you are already in a mainline-based BSP 5.

Best regards,

@henrique.tx
Thanks for the quick reply. I was not aware of downstream and mainline kernels. I am assuming that mainline kernel is or will be part of upstream (Linus Torvald’s) kernel sources while downstream is Toradex-only?

I did as suggested and ported my project to mainline kernel now.

I saw that there have been major changes in how HDMI, LCD and framebuffer configuration is structured.

  1. hdmi_audio, hdmi_core, hdmi_video, sound_hdmi and i2dccc are now all part of hdmi? And hdmi is disabled by default?
  2. lcd is now lcd_display?
  3. mxcfb1 and mxcfb12 are gone? How can I enable the framebuffer devices?
  4. The content of drivers/video/fbdev/mxc/mxc_lcdif.c is [EDIT: now in drivers/video/fbdev/imxfb.c gone? Where can I add video modes?]

The differences in arch/arm/boot/dts/imx6qdl-colibri.dtsi and arch/arm/boot/dts/imx6qdl.dtsi between downstream and mainline are huge.

My port to downstream compiled and booted. My port to mainline compiles, but does not boot. It stops at:

## Flattened Device Tree blob at 12100000
   Booting using the fdt blob at 0x12100000
   Loading Device Tree to 1fff0000, end 1ffff2ec ... OK

Starting kernel ...

Comparing arch/arm/boot/dts/.imx6dl-colibri-myboard.dtb.dts.tmp mainline version with downstream shows that mainline DTB is missing a lot entries of that are part of the DTB in downstream, although both include the same files.

How can I find the missing parts and how can I add them?

Hi @lmoellendorf ,

Be aware that this device tree file is describing on a module level,:

while:

this device tree is on the SoC level. Here’s a little graphic to give you an overview:

Can you share a screen shot from the logs after u-boot is launched? There we should see all applied device tree files?

Best Regards
Kevin

@kevin.tx: What I meant was that the differences between mainline and downstream arch/arm/boot/dts/imx6qdl-colibri.dtsi as well as between mainline and downstream arch/arm/boot/dts/imx6qdl.dtsi are huge.

As I already wrote, I based my custom DTS on a copy of imx6dl-colibri-eval-v3.dts which I then customized. I could update my DTS to the downstream based kernel by comparing my old DTS with the new imx6dl-colibri-eval-v3.dts and incorporating the changes.

But in mainline-based kernel a lot of entries have been removed from imx6dl-colibri-eval-v3.dts and I cannot see where they are defined now.

I did some more comparsion between my “downstream” DTS and mainline imx6dl-colibri-eval-v3.dts and found out that my major problem is pin muxing.

E.g. in my custom DTS on downstream kernel I have these lines in iomuxc:

&iomuxc {
	pinctrl-names = "default";
	pinctrl-0 = <
		&pinctrl_weim_gpio_1 &pinctrl_weim_gpio_2
		&pinctrl_weim_gpio_3 &pinctrl_weim_gpio_4
		&pinctrl_weim_gpio_5 &pinctrl_weim_gpio_6
		&pinctrl_csi_gpio_1
		&pinctrl_gpio_1
		&pinctrl_gpio_2
		&pinctrl_usbh_oc_1
	>;

...

But if I add these section to my mainline DTS the kernel does not start booting. I am booting via TFTP/NFS, this is the output in minicom (the “screenshot”, I have no screen attached):

U-Boot 2016.11-2.8.4+gfae215c23c (Sep 16 2020 - 08:36:53 +0000)

CPU:   Freescale i.MX6DL rev1.3 at 792 MHz
Reset cause: POR
I2C:   ready
DRAM:  512 MiB
PMIC:  device id: 0x10, revision id: 0x21, programmed
MMC:   FSL_SDHC: 0, FSL_SDHC: 1
auto-detected panel vga-rgb
Display: vga-rgb (640x480)
In:    serial
Out:   serial
Err:   serial
Model: Toradex Colibri iMX6 DualLite 512MB V1.1A, Serial# 05189691
Net:   using PHY at 0
FEC [PRIME]
Hit any key to stop autoboot:  0
Colibri iMX6 # run netboot
Booting via TFTP/NFS...
Using FEC device
TFTP from server 192.168.17.26; our IP address is 192.168.17.50
Filename 'colibri_imx6/imx6dl-colibri-myboard.dtb'.
Load address: 0x12100000
Loading: ##################################################  51 KiB
         4.2 MiB/s
done
Bytes transferred = 52233 (cc09 hex)
Using FEC device
TFTP from server 192.168.17.26; our IP address is 192.168.17.50
Filename 'colibri_imx6/zImage'.
Load address: 0x11000000
Loading: ##################################################  6.3 MiB
         3.8 MiB/s
done
Bytes transferred = 6560784 (641c10 hex)
## Flattened Device Tree blob at 12100000
   Booting using the fdt blob at 0x12100000
   Loading Device Tree to 1fff0000, end 1ffffc08 ... OK

Starting kernel ...

I use a custom command netboot which is similar to nfsboot. Only difference is that it uses hard coded variables instead of retrieving them via DHCP.

If I comment out the above mentioned lines in iomuxc, the kernel starts booting, but I get this warning:

[    0.058142] imx6dl-pinctrl 20e0000.iomuxc: no fsl,pins and pins property in node /soc/aips-bus@2000000/iomuxc@20e0000/csi
[    0.058179] imx6dl-pinctrl 20e0000.iomuxc: no fsl,pins and pins property in node /soc/aips-bus@2000000/iomuxc@20e0000/gpio
[    0.058208] imx6dl-pinctrl 20e0000.iomuxc: initialized IMX pinctrl driver

And later some custom kernel modules fail to load because of invalid pin configuration:

[    1.848833] input: gpio-keys as /devices/soc0/gpio-keys/input/input0
[    1.856079] imx6dl-pinctrl 20e0000.iomuxc: invalid function gpio in map table
[    1.863239] gpio-keys: probe of mymodule failed with error -22

Further below systemd complains:

[    6.466796] mymodule2: module is from the staging directory, the quality is unknown, you have been warned.
[FAILED] Failed to start Load Kernel Modules.
See 'systemctl status systemd-modules-load.service' for details.

And finally systemd enters emergency mode with:

[  OK  ] Listening on Load/Save RF Kill Switch Status /dev/rfkill Watch.
[ TIME ] Timed out waiting for device dev-mmcblk0p3.device.
[DEPEND] Dependency failed for /data.
[DEPEND] Dependency failed for Local File Systems.

This is the output of ‘systemctl status systemd-modules-load.service’ (custom module names edited):

[[0;1;31m●[[0m systemd-modules-load.service - Load Kernel Modules
   Loaded: loaded (/lib/systemd/system/systemd-modules-load.service; static; ven
dor preset: enabled)
   Active: [[0;1;31mfailed[[0m (Result: exit-code) since Thu 1970-01-01 00:00:06
 UTC; 15min ago
     Docs: man:systemd-modules-load.service(8)
           man:modules-load.d(5)
  Process: 158 ExecStart=/lib/systemd/systemd-modules-load [[0;1;31m(code=exited
, status=1/FAILURE)[[0m
 Main PID: 158 (code=exited, status=1/FAILURE)

Jan 01 00:00:06 pe8007-00142d4e42cf systemd-modules-load[158]: [[0;1;31m[[0;1;39
m[[0;1;31mFailed to find module 'galcore'[[0m
Jan 01 00:00:06 pe8007-00142d4e42cf systemd-modules-load[158]: Inserted module '
libcomposite'
Jan 01 00:00:06 pe8007-00142d4e42cf systemd-modules-load[158]: Inserted module '
mymodule3'
Jan 01 00:00:06 pe8007-00142d4e42cf systemd-modules-load[158]: Inserted module '
mymodule4'
Jan 01 00:00:06 pe8007-00142d4e42cf systemd-modules-load[158]: Inserted module '
mymodule5'
Jan 01 00:00:06 pe8007-00142d4e42cf systemd-modules-load[158]: Inserted module '
mymodule6'

imx6dl-colibri-myboard.dts (renamed) is including:

#include <dt-bindings/input/input.h>
#include <dt-bindings/interrupt-controller/irq.h>
#include "imx6dl.dtsi"
#include "imx6qdl-colibri.dtsi"

If I use imx6dl-colibri-eval-v3.dtb instead of the custom DTS the kernel starts, but of course my modules fail to load.

For now I will use my downstream based kernel, but I would be grateful for help with the migration to mainline.

Hi @lmoellendorf ,

I understand, sorry for my confusion with the different files.

In the meantime, I had some chats internally about the changes you mentioned from downstream to upstream. It is right what you observed, there were a lot of changes to these files.

Can you maybe state here which entries you do not find anymore? Or are you mainly talking about the &iomuxc? Or are you using the ones you list here:

Furthermore, I would be curious to know what exactly you would like to enable. Are there a lot of things you’re enabling and disabling? If not, could you list them here?

Just so we have a better understanding of what the final setup should have enabled and disabled.

Best Regards
Kevin

Ok, here is the list:

disable (if not already disabled):

  • &hdmi_audio
  • &hdmi_core
  • &hdmi_video
  • &sound_hdmi
  • &i2cddc
  • &pwm1
  • &pwm4

enable:

  • &can1
  • &lcd

configure these pins:

  • MX6QDL_PAD_GPIO_5__GPIO1_IO05
  • MX6QDL_PAD_GPIO_4__GPIO1_IO04
  • MX6QDL_PAD_RGMII_RD1__GPIO6_IO27
  • MX6QDL_PAD_EIM_A19__GPIO2_IO19
  • MX6QDL_PAD_SD2_CMD__GPIO1_IO11
  • MX6QDL_PAD_NANDF_WP_B__GPIO6_IO09
  • MX6QDL_PAD_NANDF_CS0__GPIO6_IO11
  • MX6QDL_PAD_EIM_A23__GPIO6_IO06
  • MX6QDL_PAD_GPIO_8__GPIO1_IO08
  • MX6QDL_PAD_EIM_A24__GPIO5_IO04
  • MX6QDL_PAD_NANDF_RB0__GPIO6_IO10
  • MX6QDL_PAD_NANDF_ALE__GPIO6_IO08
  • MX6QDL_PAD_NANDF_D2__GPIO2_IO02
  • MX6QDL_PAD_NANDF_D3__GPIO2_IO03
  • MX6QDL_PAD_GPIO_9__GPIO1_IO09
  • MX6QDL_PAD_SD4_DAT2__GPIO2_IO10

The rest is similar to imx6dl-colibri-eval-v3.dts besides some WEIM and USB configuration.

Hi @lmoellendorf !

With the information you shared, you will be able to search across the device trees and figure out what you need to tweak.

I developed a tool to help search in device trees. Here they are if you want to try them out:

Best regards,

I tried this tool, but it gives me this error:

../../3rdparty/find_in_devicetree/find_in_dt.py arch/arm/boot/dts/my.dts lcd
/path/to/sources/colibri-imx6-kernel-sources
Traceback (most recent call last):
  File "/path/to/sources/colibri-imx6-kernel-sources/../../3rdparty/find_in_devicetree/find_in_dt.py", line 287, in <module>
    dt_file = sys.argv[1]  # 'imx6dl-colibri-eval-v3.dts'
NameError: name 'sys' is not defined

Hm, it is missing import sys. Maybe I do not invoke it correctly? Or do I have to install it? Sorry, I am not that familiar with python.

Hi @lmoellendorf ,

Did you setup the minconda environment?

Did you use conda activate before running the tool?

Best Regards
Kevin

No, I never heard of minconda and there was no hint that it is needed.

Hi @lmoellendorf ,

Sorry I made a typo it would have been “miniconda”.

But as I just see now, for the command line version this is not needed. My bad sorry for the confusion.

Which version of python do you have on your machine? You can see that by launching python3 --version.

Best Regards
Kevin

Python 3.10.10

Hi @lmoellendorf ,

Thanks.

I just pulled the command line version as well. I have Python 3.10.6 installed.

I launch the script from within its directory with the following command (based on the example)

python3 find_in_dt.py ../../git/linux-toradex/arch/arm64/boot/dts/freescale/imx8mm-verdin-wifi-dev.dts "pinctrl_uart\d"

Are you doing it the same way?

Best Regards
Kevin

Hello @lmoellendorf ,
Do you have any updates on this topic? Could you solve it with the information from @kevin.tx?

Best regards,
Josep

This is what happens here:

python3 find_in_dt.py ../../sources/colibri-imx6-kernel-sources/arch/arm64/boot/dts/freescale/imx8mm-verdin-wifi-dev.dts "pinctrl_uart\d"
/home/lars.moellendorf/pe8007/devel/3rdparty/find_in_devicetree
Traceback (most recent call last):
  File "/home/lars.moellendorf/pe8007/devel/3rdparty/find_in_devicetree/find_in_dt.py", line 287, in <module>
    dt_file = sys.argv[1]  # 'imx6dl-colibri-eval-v3.dts'
NameError: name 'sys' is not defined

I made sure to be on recent main and stashed all changes.

Hi @lmoellendorf !

I just pushed some commits. I unwantedly deleted the import sys in the past.

Please update your local clone of the repository and try again.

And thanks for finding the bug :slight_smile:

Best regards,

Thanks for the update. I think there are still some imports missing:

python3 find_in_dt.py ../../sources/colibri-imx6-kernel-sources/arch/arm64/boot/dts/freescale/imx8mm-verdin-wifi-dev.dts "pinctrl_uart\d"
/home/lars.moellendorf/pe8007/devel/3rdparty/find_in_devicetree
Traceback (most recent call last):
  File "/home/lars.moellendorf/pe8007/devel/3rdparty/find_in_devicetree/find_in_dt.py", line 298, in <module>
    print(color(f'search_in: {si}, returning: {ret}', Colors.yellow))
NameError: name 'color' is not defined