Device tree peripheral configuration

Hello, Toradex team,

We are trying to build custom device tree for Apalis iMX6 module.
Device tree sources were downloaded from branch toradex_5.4-2.3.x-imx

We would like to use some of the interfaces as GPIO.
Regarding the Apalis iMX6 datasheet default configuration of the I/O is as following:
pin 122 - UART1_RI
pin 200 - DAP1_BIT_CLK
pin 202 - DAP1_D_IN
pin 204 - DAP1_SYNC

We expected to find the following configuration in the device tree sources:
MX6QDL_PAD_EIM_EB3__UART1_RI_B
MX6QDL_PAD_DISP0_DAT16__AUD5_TXC
MX6QDL_PAD_DISP0_DAT19__AUD5_RXD
MX6QDL_PAD_DISP0_DAT18__AUD5_TXFS
and change it to:
MX6QDL_PAD_EIM_EB3__GPIO2_IO31
MX6QDL_PAD_DISP0_DAT16__GPIO5_IO10
MX6QDL_PAD_DISP0_DAT19__GPIO5_IO13
MX6QDL_PAD_DISP0_DAT18__GPIO5_IO12

Unfortunately we were not able to find where this peripheral is configured. Could you please advise us how to proceed. We are using custom board, some of the listed pins are outputs regarding the datasheet, it’s possible to damage the module if wrong peripheral configuration used.

Apalis iMX6 Dual 1GB IT V1.1Y
Yocto Dunfell, BSP 5, branch dunfell-5.x.y
Custom board

With kind regards,
Ivan Gorchev

Hi @Ivan_Gorchev !

It is expected that you perform changes on the carrier board level of your device tree.

These articles might help you:


In addition, to deal with the device tree and find stuff in all those files, I created the following tools.

Command line only:

With GUI:

Hopefully, it will help you to find what you need. Let us know :slight_smile:

Best regards,

Hello @henrique.tx,

Thank you very much for the quick reply and the articles.
I will share them with my colleagues and will let you know about our progress asap.

With kind regards,
Ivan Gorchev

Hello @henrique.tx,

Thank you very much for the support, we were able to compile working device tree, based on apalis evaluation dts.

Could you please advise us how to update the u-boot configuration to enable the new device tree.

We try to modify /etc/u-boot-initial-env
fdt_file=imx6q-apalis-eval.dtb
fdtfile=imx6q-apalis-eval.dtb
to:
fdt_file=imx6q-apalis-custom.dtb
fdtfile=imx6q-apalis-custom.dtb

but during boot u-boot is still loading imx6q-apalis-eval.dtb.

With kind regards,
Ivan Gorchev

Hi @Ivan_Gorchev ,

in the U-Boot environment variables, you will find a variable that dynamically builds the string imx6q-apalis-eval.dtb

For example you will see a variable called soc that will contain imx6q. Furthermore you should find a variable containing the value eval this one you could replace with custom then it should boot with your device tree instead.

Best Regards
Kevin

Hi, @kevin.tx,

Thank you very much for the reply. Unfortunately we were not able to find board or fdt_board defined as eval.

We were able to switch to custom device tree after update of u-boot environment variables fdt_file and fdtfile and now u-boot loads the right file, this is the boot log at tty0:

mmc0(part 0) is current device
Scanning mmc 0:1…
Found U-Boot script /boot.scr
5752 bytes read in 16 ms (350.6 KiB/s)
Executing script at 17000000
Loading DeviceTree: imx6q-apalis-custom-v1.0.dtb
79600 bytes read in 24 ms (3.2 MiB/s)

Unfortunately our dtb does not acts as expected.

We did the following in dts:

&iomuxc {
	/* Mux the Apalis GPIOs */

	pinctrl_custom_gpios: additionalgpios {
        fsl,pins = <
            MX6QDL_PAD_DISP0_DAT16__GPIO5_IO10      0x1b0b0   //Red LED, Enable pull up
            MX6QDL_PAD_DISP0_DAT19__GPIO5_IO13      0x130b0   //Yellow LED, Enable pull down
            MX6QDL_PAD_DISP0_DAT18__GPIO5_IO12      0x130b0   // Green LED, Enable pull down
        >;
    };

and

	leds {
		compatible = "gpio-leds";

		pinctrl-names = "default";
		pinctrl-0 = <&pinctrl_custom_gpios>;

		led4-green {
			label = "LED_4_GREEN";
			gpio = <&gpio5 12 GPIO_ACTIVE_HIGH>;
			default-state = "off";
		};

		led5-yellow {
			label = "LED_5_YELLOW";
			gpio = <&gpio5 13 GPIO_ACTIVE_HIGH>;
			default-state = "off";
		};

		led6-red {
			label = "LED_6_RED";
			gpio = <&gpio5 10 GPIO_ACTIVE_HIGH>;
			default-state = "on";
		};
	};

After reset all of the listed GPIOs acts as high level, even pull-downs enabled.
Once exported and set as outputs in Linux works fine and LEDs can be controlled.

We used to measure the voltage at pins GPIO pins. It’s as follows:
GPIO5_10 - 3.3V
GPIO5_13 - 1.65V
GPIO5_12 - 1.65V

Looks like internal pull-ups are still enabled for GPIOs 5_12 and 5_13 instead of pull-downs. Could you please advise us how to fix this issue.

With kind regards,
Ivan Gorchev

Hello,

We found the problem. Out custom device tree was based on eval device tree (imx6q-apalis-eval.dts).
The problem was the compatible section in the beginning of the file does not contain ixora boards.
After adding “toradex,apalis_imx6q-ixora-v1.2” and “toradex,apalis_imx6q-ixora” everything works as expected.

Issue can be closed. Thank you for the support!