Device Tree Customization for Verdin AM62

Hello Toradex Team,

I have successfully built a Yocto image for the Verdin AM62 and tested it using the Mallow Carrier Board. Now, I’m moving toward a custom carrier board that is based on Mallow but with several unused peripherals removed, such as:

  • CAN interface
  • DSI display
  • CTRL (debug) headers
  • Possibly others not needed in our design

I would like to know the recommended approach to remove these interfaces from the device tree to match our minimal custom hardware.

  1. Should I create a new .dts file based on verdin-am62-mallow.dts and remove the unwanted peripherals?
  2. Or is it better to create a .dtsi overlay and disable nodes using status = "disabled";?
  3. Are there specific files under arch/arm64/boot/dts/ti/ that I should duplicate and modify?

Any guidance on the best practices for this kind of DT customization for Verdin AM62 would be appreciated.

Thanks in advance,
Uday

Hi, I’m the Toradex AI Assistant.

I might make mistakes. Our support team will step in if needed. If I answered your question, please tick the “Solution” checkbox. For follow-up questions to me, please use @ToradexAI in your post.

Did you like my answer? :+1: :-1:


Hello Uday,

Thank you for your detailed question! For customizing device trees on the Verdin AM62, especially when moving to a custom carrier board with unused peripherals, here are the best practices:

1. Use Device Tree Overlays (Recommended Approach)

  • The preferred and maintainable way to disable unused peripherals (like CAN, DSI, debug headers, etc.) is to create a Device Tree Overlay that sets the unwanted nodes to status = "disabled";.
  • This method avoids modifying the main board .dts files, ensuring your changes are modular and easier to maintain—especially when updating to new BSP versions.
    (Read more on overlays and their benefits)

Sample Overlay Structure:

/dts-v1/;
/plugin/;

/ {
    fragment@0 {
        target-path = "/";
        __overlay__ {
            &can_node {
                status = "disabled";
            };
            &dsi_node {
                status = "disabled";
            };
            /* Repeat for other interfaces */
        };
    };
};

Replace &can_node, &dsi_node, etc., with the actual node names you need to disable.

2. Avoid Duplicating Complete .dts or .dtsi Files

  • It is not required (nor recommended) to create a new .dts based solely on verdin-am62-mallow.dts and remove peripherals there.
  • Directly duplicating or editing upstream device trees can make future maintenance and upgrades more difficult.
  • Instead, your custom overlay should be added to the build (either with Yocto or via Torizon).

3. Maintainability

  • Device Tree Overlays make it easy to enable/disable features as your hardware evolves.
  • Pre-built overlays also exist for many peripherals for quick reference (see overlays and examples).

4. Special Considerations

  • Some interface disablement may have power/control dependencies—ensure related nodes and supplies are handled to avoid issues.
  • Overlays work well for both Yocto and Torizon-based builds; you can apply your overlay at boot or via the build system.

Summary:

  • Create a Device Tree Overlay that disables (via status = "disabled") any peripheral not needed.
  • Do not duplicate and directly modify the main device tree files—use overlays for modularity and easier maintenance.
  • Always check related dependencies when disabling nodes, especially for display and power-critical peripherals.

Useful Resources:

Let me know if you’d like an example overlay for a specific interface, or if you need guidance on integrating overlays with Yocto or Torizon.

Best regards,
Toradex AI Assistant.

Hey, @Uday10122,

Choosing between device trees and device tree overlays depends highly on the way you designed your custom board. You said your carrier board is based on the Mallow, have you followed our Reference Design?

If you did follow our reference design and simply removed peripherals, it may be a good approach to use the verdin-am62-mallow.dts device tree and add a custom overlay disabling the unused interfaces.

If your board differs in some significant way from our reference design, the recommended approach is to write your own device tree. If you have questions about writing the .dts file, check out our Overview on Device Trees. One thing to note is that if you build your own device tree, you should be aware of the hierarchical structure of the .dts files. Since you are using a Verdin AM62 SoM, your custom device tree should include at least the k3-am625.dtsi and k3-am62-verdin.dtsi. You can check the hierarchical structure of our device tree files here.

Lastly, I just wanted to point out a possible point of confusion. You asked about creating a .dtsi overlay, but .dtsi files are not device tree overlays. They are include files that will be simply added to the .dts files at compile time to create a .dtb binary. Device tree overlay files are .dtb files that are compiled separately into .dtbo files and applied at runtime to your system.

Let me know if you have any further questions.

Best regards,

Hi @leonardo.costa.tx

This helps me to disable those unused peripherals lets say i am not using SD card i have to use those pins as GPIO’s

how can i add that in my overlay any template code for that

here is images for reference

file : k3-am62-verdin.dtsi

&main_pmx0 {
	/* Verdin PWM_1 */
	pinctrl_epwm0_a: main-epwm0a-default-pins {
		pinctrl-single,pins = <
			AM62X_IOPAD(0x01b4, PIN_OUTPUT, 2) /* (A13) SPI0_CS0.EHRPWM0_A */ /* SODIMM 15 */
		>;
	};

	/* Verdin SD_1 */
	pinctrl_sdhci1: main-mmc1-default-pins {
		pinctrl-single,pins = <
			AM62X_IOPAD(0x23c, PIN_INPUT,        0) /* (A21) MMC1_CMD  */ /* SODIMM 74 */
			AM62X_IOPAD(0x234, PIN_INPUT,        0) /* (B22) MMC1_CLK  */ /* SODIMM 78 */
			AM62X_IOPAD(0x230, PIN_INPUT,        0) /* (A22) MMC1_DAT0 */ /* SODIMM 80 */
			AM62X_IOPAD(0x22c, PIN_INPUT,        0) /* (B21) MMC1_DAT1 */ /* SODIMM 82 */
			AM62X_IOPAD(0x228, PIN_INPUT,        0) /* (C21) MMC1_DAT2 */ /* SODIMM 70 */
			AM62X_IOPAD(0x224, PIN_INPUT,        0) /* (D22) MMC1_DAT3 */ /* SODIMM 72 */
		>;
	};
};

comes under main_pmx0

help me with template code and also i have to access those pins to user space so how can i do that

Best regards
Uday

Hey, @Uday10122,

What you want to do is to change the function of the SD card pins, which is called Pinmuxing. Please check out our guide on How to Write Device Tree Overlays and our Pinmuxing Guide for the AM62. You’ll need to write a group that changes the pin function, such as the ones you sent in your example. Then you’ll need to activate your group, such as shown here. Let me know if you have any trouble writing your overlay.

Best regards,

Hi @leonardo.costa.tx

Thanks for the guidance!

Based on your suggestion, we have repurposed the SD/MMC1 pins as GPIOs by updating the device tree overlay accordingly. Below is a summary of the changes we made:

:white_check_mark: Disabled Unused Interfaces
We disabled the unused peripherals like CAN, UARTs, USB, SD, and I2C as per our hardware requirements.

:white_check_mark: Pinmux Configuration Added
In the &main_pmx0 node, we added new pinmux groups to switch the SD/MMC1, QSPI1_DQS, and I2C4 (CSI) pins to GPIO mode using mode 7.

:white_check_mark: GPIO Hogs Added
We used the gpio-hog mechanism to initialize and configure these GPIOs as inputs with custom line-name labels for easy identification via sysfs or gpiod.

After these changes my overlay looks like this
to create overlay i followed this link

// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
/*
 * Copyright 2023 Toradex
 */

/dts-v1/;
/plugin/;

#include <dt-bindings/leds/common.h>
#include <dt-bindings/gpio/gpio.h>
#include "k3-pinctrl.h"

/ {
    compatible = "toradex,verdin-am62";
};

/* Disable Verdin CAN_1 */
&main_mcan0 {
    status = "disabled";
};

/* Disable Verdin CAN_2 */
&mcu_mcan0 {
    status = "disabled";
};

/* Verdin PWM_3 DSI */
&epwm1 {
	status = "disabled";
};

/* Verdin I2C_2 DSI */
&main_i2c2 {
	status = "disabled";
};

/* Verdin UART_1 */
&main_uart1 {
	status = "disabled";
};

/* Verdin UART_2 */
&wkup_uart0 {
	status = "disabled";
};

/* Verdin UART_4 */
&mcu_uart0 {
	status = "disabled";
};

/* Verdin USB_1 */
&usbss0 {
	status = "disabled";
};

&usb0 {
	status = "disabled";
};

/* Verdin SD_1 */
&sdhci1 {
	status = "disabled";
};

/* Verdin CTRL_WAKE1_MICO# */
&verdin_gpio_keys {
	status = "disabled";
};

/* Verdin PCIE_1_RESET# */
&verdin_pcie_1_reset_hog {
	status = "disabled";
};

/* Verdin I2C_4 CSI */
&main_i2c3 {
    status = "disabled";
};

/* Pinmux for repurposing MMC1 pins to GPIO */
&main_pmx0 {
    pinctrl_gpio_sd_repurpose: sd-gpio-pins {
        pinctrl-single,pins = <
            AM62X_IOPAD(0x23c, PIN_INPUT, 7) /* MMC1_CMD  -->  GPIO1_15 (47) */
            AM62X_IOPAD(0x234, PIN_INPUT, 7) /* MMC1_CLK  -->  GPIO1_14 (46) */
            AM62X_IOPAD(0x230, PIN_INPUT, 7) /* MMC1_DAT0 -->  GPIO1_13 (45) */
            AM62X_IOPAD(0x22c, PIN_INPUT, 7) /* MMC1_DAT1 -->  GPIO1_12 (44) */
            AM62X_IOPAD(0x228, PIN_INPUT, 7) /* MMC1_DAT2 -->  GPIO1_11 (43) */
            AM62X_IOPAD(0x224, PIN_INPUT, 7) /* MMC1_DAT3 -->  GPIO1_10 (42) */
        >;
    };

   /* Repurpose QSPI1_DQS pin */
    pinctrl_qspi1_dqs_gpio: qspi1-dqs-gpio {
        pinctrl-single,pins = <
            AM62X_IOPAD(0x01c0, PIN_INPUT, 7) /* GPIO1_18, SODIMM 66 */
        >;
    };

   /* Repurpose I2C4 (CSI) pins */
    pinctrl_i2c3_gpio: i2c3-gpio-pins {
        pinctrl-single,pins = <
            AM62X_IOPAD(0x01d4, PIN_INPUT, 7) /* GPIO1_23, SODIMM 93 */
        >;
    };
};

/* GPIO1 hog for repurposed MMC1 as input */
&main_gpio1 {
    gpio-line-names = 
        "SD1_CMD", "SD1_CLK", "SD1_DAT0", "SD1_DAT1", 
        "SD1_DAT2", "SD1_DAT3", "SODIMM_66", "SODIMM_93";

    gpio-hog@0 {
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_gpio_sd_repurpose>;
        gpios = <47 GPIO_ACTIVE_HIGH>, <46 GPIO_ACTIVE_HIGH>,
                <45 GPIO_ACTIVE_HIGH>, <44 GPIO_ACTIVE_HIGH>,
                <43 GPIO_ACTIVE_HIGH>, <42 GPIO_ACTIVE_HIGH>;
        input;
        line-name = "repurposed-sd1-gpios";
    };

    gpio-hog@1 {
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_qspi1_dqs_gpio>;
        gpios = <18 GPIO_ACTIVE_HIGH>;
        input;
        line-name = "repurposed-QSPI1-gpios";
    };

    gpio-hog@2 {
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_i2c3_gpio>;
        gpios = <23 GPIO_ACTIVE_HIGH>;
        input;
        line-name = "repurposed-I2C4-gpios";
    };
};

After deploying the overlay and rebooting, the GPIOs show up correctly under /sys/class/gpio/ and in gpioinfo but its in gpiochip3 i menrioned it somwhere

gpiochip3 - 52 lines:
	line   0:	"SD1_CMD"       	input
	line   1:	"SD1_CLK"       	input
	line   2:	"SD1_DAT0"      	input
	line   3:	"SD1_DAT1"      	input
	line   4:	"SD1_DAT2"      	input
	line   5:	"SD1_DAT3"      	input
	line   6:	"SODIMM_66"     	input
	line   7:	"SODIMM_93"     	input
	line   8:	unnamed         	input
	line   9:	unnamed         	input
	line  10:	unnamed         	input
	line  11:	unnamed         	input
	line  12:	unnamed         	input

Also, I want to configure some GPIOs as outputs. Even though I’ve specified them as outputs in the device tree, some of the pins are still being treated as inputs. For the ones that are recognized as outputs, they are automatically claimed by consumers like output consumer="red:debug-2". When I try to access those GPIOs via /sys/class/gpio, I get a “resource busy” error.

Kindly help me with this issue like where exactly i am making mistake

now i want to configure these node as GPIO output

    /* Repurpose MCASP1 (I2S2) pins */
    pinctrl_mcasp1_gpio: mcasp1-gpio-pins {
        pinctrl-single,pins = <
            // AM62X_IOPAD(0x0090, PIN_OUTPUT, 7) /* MCASP1_ACLKX --> GPIO0_9,  SODIMM 42 (commented out) */
            AM62X_IOPAD(0x0098, PIN_OUTPUT, 7) /* MCASP1_AFSX  --> GPIO0_11, SODIMM 44 */
            AM62X_IOPAD(0x008c, PIN_OUTPUT, 7) /* MCASP1_AXR0  --> GPIO0_8,  SODIMM 46 */
            AM62X_IOPAD(0x0088, PIN_OUTPUT, 7) /* MCASP1_AXR1  --> GPIO0_7,  SODIMM 48 */
        >;
    };

    /* Repurpose OSPI0 pins */
    pinctrl_ospi0_gpio: ospi0-gpio-pins {
        pinctrl-single,pins = <
            AM62X_IOPAD(0x0000, PIN_OUTPUT, 7) /* OSPI0_CLK   --> GPIO0_0,  SODIMM 52 */
            AM62X_IOPAD(0x002c, PIN_OUTPUT, 7) /* OSPI0_CSn0  --> GPIO0_11, SODIMM 54 */
            AM62X_IOPAD(0x0030, PIN_OUTPUT, 7) /* OSPI0_CSn1  --> GPIO0_12, SODIMM 64 */
            AM62X_IOPAD(0x000c, PIN_INPUT,  7) /* OSPI0_D0    --> GPIO0_3,  SODIMM 56 */
            AM62X_IOPAD(0x0010, PIN_INPUT,  7) /* OSPI0_D1    --> GPIO0_4,  SODIMM 58 */
            AM62X_IOPAD(0x0014, PIN_INPUT,  7) /* OSPI0_D2    --> GPIO0_5,  SODIMM 60 */
            AM62X_IOPAD(0x0018, PIN_INPUT,  7) /* OSPI0_D3    --> GPIO0_6,  SODIMM 62 */
        >;
    };

Best regards,
Uday

Hey, @Uday10122,

You said you configured some GPIO pins in your overlay as outputs and is observing them as inputs, but I only see pins configured as inputs in the overlay you provided:

Am I missing something? Or did you mean that you added that second snippet to the overlay and then saw that the pins remained as inputs?

now i want to configure these node as GPIO output

   /* Repurpose MCASP1 (I2S2) pins */
  pinctrl_mcasp1_gpio: mcasp1-gpio-pins {
       pinctrl-single,pins = <
           // AM62X_IOPAD(0x0090, PIN_OUTPUT, 7) /* MCASP1_ACLKX --> GPIO0_9,  SODIMM 42 >(commented out) */
           AM62X_IOPAD(0x0098, PIN_OUTPUT, 7) /* MCASP1_AFSX  --> GPIO0_11, SODIMM 44 */
...

Additionally, you don’t need to configure the GPIO pins as outputs to use them as outputs. the PIN_OUTPUT macro will simply disable the input functionality.

/* k3-pinctrl.h */ 

/* Only these macros are expected be used directly in device tree files */
#define PIN_OUTPUT		(INPUT_DISABLE | PULL_DISABLE)
#define PIN_OUTPUT_PULLUP	(INPUT_DISABLE | PULL_UP)
#define PIN_OUTPUT_PULLDOWN	(INPUT_DISABLE | PULL_DOWN)
#define PIN_INPUT		(INPUT_EN | PULL_DISABLE)
#define PIN_INPUT_PULLUP	(INPUT_EN | PULL_UP)
#define PIN_INPUT_PULLDOWN	(INPUT_EN | PULL_DOWN)

Also, here you mentioned some unexpected behavior from the GPIO pins:

For the ones that are recognized as outputs, they are automatically claimed by consumers like output consumer="red:debug-2" . When I try to access those GPIOs via /sys/class/gpio , I get a “resource busy” error.

Can you specify which pins exhibit this behavior? Which bins are claimed by the red-debug-2 consumer? Can you provide the output that showed this?

Best regards,

Hi @leonardo.costa.tx

You said you configured some GPIO pins in your overlay as outputs and is observing them as inputs, but I only see pins configured as inputs in the overlay you provided:

I initially configured some pins as outputs, but a few were already claimed by the debug LED, and some remained as inputs. So, I made a few adjustments afterward to avoid output claiming by debug led by disabling entire node in overlay code.

Here is the updated and current overlay code:

// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
/*
 * Copyright 2023 Toradex
 */

/dts-v1/;
/plugin/;

#include <dt-bindings/leds/common.h>
#include <dt-bindings/gpio/gpio.h>
#include "k3-pinctrl.h"

/ {
    compatible = "toradex,verdin-am62";
};

&{/leds} {
    status = "disabled";
};

&ospi0 {
    status = "disabled";
};

/* Disable Verdin CAN_1 */
&main_mcan0 {
    status = "disabled";
};

/* Disable Verdin CAN_2 */
&mcu_mcan0 {
    status = "disabled";
};

/* Verdin PWM_3 DSI */
&epwm1 {
	status = "disabled";
};

/* Verdin I2C_2 DSI */
&main_i2c2 {
	status = "disabled";
};

/* Verdin UART_1 */
&main_uart1 {
	status = "disabled";
};

/* Verdin UART_2 */
&wkup_uart0 {
	status = "disabled";
};

/* Verdin UART_4 */
&mcu_uart0 {
	status = "disabled";
};

/* Verdin USB_1 */
&usbss0 {
	status = "disabled";
};

&usb0 {
	status = "disabled";
};

/* Verdin SD_1 */
&sdhci1 {
	status = "disabled";
};

/* Verdin CTRL_WAKE1_MICO# */
&verdin_gpio_keys {
	status = "disabled";
};

/* Verdin PCIE_1_RESET# */
&verdin_pcie_1_reset_hog {
	status = "disabled";
};

/* Verdin I2C_4 CSI */
&main_i2c3 {
    status = "disabled";
};

/* Pinmux for repurposing MMC1 pins to GPIO */
&main_pmx0 {
    pinctrl_gpio_sd_repurpose: sd-gpio-pins {
        pinctrl-single,pins = <
            AM62X_IOPAD(0x23c, PIN_INPUT, 7) /* MMC1_CMD  -->  GPIO1_15 (47) */
            AM62X_IOPAD(0x234, PIN_INPUT, 7) /* MMC1_CLK  -->  GPIO1_14 (46) */
            AM62X_IOPAD(0x230, PIN_INPUT, 7) /* MMC1_DAT0 -->  GPIO1_13 (45) */
            AM62X_IOPAD(0x22c, PIN_INPUT, 7) /* MMC1_DAT1 -->  GPIO1_12 (44) */
            AM62X_IOPAD(0x228, PIN_INPUT, 7) /* MMC1_DAT2 -->  GPIO1_11 (43) */
            AM62X_IOPAD(0x224, PIN_INPUT, 7) /* MMC1_DAT3 -->  GPIO1_10 (42) */
        >;
    };

   /* Repurpose QSPI1_DQS pin */
    pinctrl_qspi1_dqs_gpio: qspi1-dqs-gpio {
        pinctrl-single,pins = <
            AM62X_IOPAD(0x01c0, PIN_INPUT, 7) /* GPIO1_18, SODIMM 66 */
        >;
    };

   /* Repurpose I2C4 (CSI) pins */
    pinctrl_i2c3_gpio: i2c3-gpio-pins {
        pinctrl-single,pins = <
            AM62X_IOPAD(0x01d4, PIN_INPUT, 7) /* GPIO1_23, SODIMM 93 */
        >;
    };

    pinctrl_ospi0_gpio: ospi0-gpio-pins {
        pinctrl-single,pins = <
            AM62X_IOPAD(0x0000, PIN_OUTPUT, 7) /* OSPI0_CLK   --> GPIO0_0,  SODIMM 52 */
            AM62X_IOPAD(0x002c, PIN_OUTPUT, 7) /* OSPI0_CSn0  --> GPIO0_11, SODIMM 54 */
            AM62X_IOPAD(0x0030, PIN_OUTPUT, 7) /* OSPI0_CSn1  --> GPIO0_12, SODIMM 64 */
            AM62X_IOPAD(0x000c, PIN_OUTPUT, 7) /* OSPI0_D0    --> GPIO0_3,  SODIMM 56 */
            AM62X_IOPAD(0x0010, PIN_OUTPUT, 7) /* OSPI0_D1    --> GPIO0_4,  SODIMM 58 */
            AM62X_IOPAD(0x0014, PIN_OUTPUT, 7) /* OSPI0_D2    --> GPIO0_5,  SODIMM 60 */
            AM62X_IOPAD(0x0018, PIN_OUTPUT, 7) /* OSPI0_D3    --> GPIO0_6,  SODIMM 62 */
        >;
    };
};

/* GPIO1 hog for repurposed MMC1 as input */
&main_gpio1 {
    gpio-line-names = 
        "SD1_CMD", "SD1_CLK", "SD1_DAT0", "SD1_DAT1", 
        "SD1_DAT2", "SD1_DAT3", "SODIMM_66", "SODIMM_93";

    gpio-hog@0 {
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_gpio_sd_repurpose>;
        gpios = <47 GPIO_ACTIVE_HIGH>, <46 GPIO_ACTIVE_HIGH>,
                <45 GPIO_ACTIVE_HIGH>, <44 GPIO_ACTIVE_HIGH>,
                <43 GPIO_ACTIVE_HIGH>, <42 GPIO_ACTIVE_HIGH>;
        input;
        line-name = "repurposed-sd1-gpios";
    };

    gpio-hog@1 {
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_qspi1_dqs_gpio>;
        gpios = <18 GPIO_ACTIVE_HIGH>;
        input;
        line-name = "repurposed-QSPI1-gpios";
    };

    gpio-hog@2 {
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_i2c3_gpio>;
        gpios = <23 GPIO_ACTIVE_HIGH>;
        input;
        line-name = "repurposed-I2C4-gpios";
    };
};

&main_gpio0 {
    gpio-line-names = 
        "OSPI0_CLK", "OSPI0_CSn0", "OSPI0_CSn1",
        "OSPI0_D0", "OSPI0_D1", "OSPI0_D2", "OSPI0_D3";

    gpio-hog {
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_ospi0_gpio>;
        gpios = <0 GPIO_ACTIVE_HIGH>, <11 GPIO_ACTIVE_HIGH>,
                <12 GPIO_ACTIVE_HIGH>, <3 GPIO_ACTIVE_HIGH>,
                <4 GPIO_ACTIVE_HIGH>, <5 GPIO_ACTIVE_HIGH>,
                <4 GPIO_ACTIVE_HIGH>;
        output-high;
        line-name = "repurposed-qspi1-gpios";
    };
};

To avoid that debug led claiming i disabled that complete code in my overlay u can see that in the above code and also i found that in

k3-am62-verdin-mallow.dtsi

// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
/*
 * Copyright 2023 Toradex
 *
 * Common dtsi for Verdin AM62 SoM on Mallow carrier board
 *
 * https://www.toradex.com/computer-on-modules/verdin-arm-family/ti-am62
 * https://www.toradex.com/products/carrier-board/mallow-carrier-board
 */

#include <dt-bindings/leds/common.h>

/ {
	leds {
		compatible = "gpio-leds";
		pinctrl-names = "default";
		pinctrl-0 = <&pinctrl_qspi1_clk_gpio>,
			    <&pinctrl_qspi1_cs_gpio>,
			    <&pinctrl_qspi1_io0_gpio>,
			    <&pinctrl_qspi1_io1_gpio>;

		/* SODIMM 52 - USER_LED_1_RED */
		led-0 {
			color = <LED_COLOR_ID_RED>;
			function = LED_FUNCTION_DEBUG;
			function-enumerator = <1>;
			gpios = <&main_gpio0 0 GPIO_ACTIVE_HIGH>;
		};

		/* SODIMM 54 - USER_LED_1_GREEN */
		led-1 {
			color = <LED_COLOR_ID_GREEN>;
			function = LED_FUNCTION_DEBUG;
			function-enumerator = <1>;
			gpios = <&main_gpio0 11 GPIO_ACTIVE_HIGH>;
		};

		/* SODIMM 56 - USER_LED_2_RED */
		led-2 {
			color = <LED_COLOR_ID_RED>;
			function = LED_FUNCTION_DEBUG;
			function-enumerator = <2>;
			gpios = <&main_gpio0 3 GPIO_ACTIVE_HIGH>;
		};

		/* SODIMM 58 - USER_LED_2_GREEN */
		led-3 {
			color = <LED_COLOR_ID_GREEN>;
			function = LED_FUNCTION_DEBUG;
			function-enumerator = <2>;
			gpios = <&main_gpio0 4 GPIO_ACTIVE_HIGH>;
		};
	};
};

i booted with that overlay after that here is the gpioinfo output

root@verdin-am62-15415775:~# gpioinfo
gpiochip0 - 3 lines:
	line   0:	unnamed         	output
	line   1:	unnamed         	output
	line   2:	unnamed         	output
gpiochip1 - 24 lines:
	line   0:	"SODIMM_244"    	input
	line   1:	"SODIMM_206"    	input
	line   2:	"SODIMM_208"    	input
	line   3:	"SODIMM_210"    	input
	line   4:	"SODIMM_212"    	input
	line   5:	unnamed         	input
	line   6:	unnamed         	input
	line   7:	unnamed         	input
	line   8:	unnamed         	input
	line   9:	unnamed         	input
	line  10:	unnamed         	input
	line  11:	unnamed         	input
	line  12:	unnamed         	input
	line  13:	unnamed         	input
	line  14:	unnamed         	input
	line  15:	unnamed         	input
	line  16:	unnamed         	input
	line  17:	unnamed         	input
	line  18:	unnamed         	input
	line  19:	unnamed         	input
	line  20:	unnamed         	input
	line  21:	unnamed         	input
	line  22:	unnamed         	input
	line  23:	unnamed         	input
gpiochip2 - 92 lines:
	line   0:	"OSPI0_CLK"     	input
	line   1:	"OSPI0_CSn0"    	input
	line   2:	"OSPI0_CSn1"    	input
	line   3:	"OSPI0_D0"      	input
	line   4:	"OSPI0_D1"      	input
	line   5:	"OSPI0_D2"      	input
	line   6:	"OSPI0_D3"      	input
	line   7:	unnamed         	input
	line   8:	unnamed         	input
	line   9:	unnamed         	input
	line  10:	unnamed         	input
	line  11:	unnamed         	input
	line  12:	unnamed         	output active-low consumer=spi0 CS1
	line  13:	unnamed         	input
	line  14:	unnamed         	input
	line  15:	unnamed         	input
	line  16:	unnamed         	input
	line  17:	unnamed         	output active-low consumer=PHY reset
	line  18:	unnamed         	input
	line  19:	unnamed         	input
	line  20:	unnamed         	output active-low consumer=reset
	line  21:	unnamed         	output consumer=LDO1-VSEL-SD (PMIC)
	line  22:	unnamed         	input
	line  23:	unnamed         	input
	line  24:	unnamed         	input
	line  25:	unnamed         	input
	line  26:	unnamed         	input
	line  27:	unnamed         	input
	line  28:	unnamed         	input
	line  29:	unnamed         	output consumer=regulator-sdhci1
	line  30:	unnamed         	output active-low consumer=reset
	line  31:	unnamed         	output consumer=regulator-force-sleep-moci
	line  32:	unnamed         	input
	line  33:	unnamed         	output
	line  34:	unnamed         	output consumer=enable
	line  35:	unnamed         	input
	line  36:	unnamed         	input
	line  37:	unnamed         	input
	line  38:	unnamed         	input
	line  39:	unnamed         	input
	line  40:	unnamed         	input
	line  41:	unnamed         	input
	line  42:	unnamed         	input
	line  43:	unnamed         	input
	line  44:	unnamed         	input
	line  45:	unnamed         	input
	line  46:	unnamed         	input
	line  47:	unnamed         	input
	line  48:	unnamed         	input
	line  49:	unnamed         	input
	line  50:	unnamed         	input
	line  51:	unnamed         	input
	line  52:	unnamed         	input
	line  53:	unnamed         	input
	line  54:	unnamed         	input
	line  55:	unnamed         	input
	line  56:	unnamed         	input
	line  57:	unnamed         	input
	line  58:	unnamed         	input
	line  59:	unnamed         	input
	line  60:	unnamed         	input
	line  61:	unnamed         	input
	line  62:	unnamed         	input
	line  63:	unnamed         	input
	line  64:	unnamed         	input
	line  65:	unnamed         	input
	line  66:	unnamed         	input
	line  67:	unnamed         	input
	line  68:	unnamed         	input
	line  69:	unnamed         	input
	line  70:	unnamed         	input
	line  71:	unnamed         	input
	line  72:	unnamed         	input
	line  73:	unnamed         	input
	line  74:	unnamed         	input
	line  75:	unnamed         	input
	line  76:	unnamed         	input
	line  77:	unnamed         	input
	line  78:	unnamed         	input
	line  79:	unnamed         	input
	line  80:	unnamed         	input
	line  81:	unnamed         	input
	line  82:	unnamed         	input
	line  83:	unnamed         	input
	line  84:	unnamed         	input
	line  85:	unnamed         	input
	line  86:	unnamed         	input
	line  87:	unnamed         	input
	line  88:	unnamed         	input
	line  89:	unnamed         	input
	line  90:	unnamed         	input
	line  91:	unnamed         	input
gpiochip3 - 52 lines:
	line   0:	"SD1_CMD"       	input
	line   1:	"SD1_CLK"       	input
	line   2:	"SD1_DAT0"      	input
	line   3:	"SD1_DAT1"      	input
	line   4:	"SD1_DAT2"      	input
	line   5:	"SD1_DAT3"      	input
	line   6:	"SODIMM_66"     	input
	line   7:	"SODIMM_93"     	input
	line   8:	unnamed         	input
	line   9:	unnamed         	input
	line  10:	unnamed         	input
	line  11:	unnamed         	input
	line  12:	unnamed         	input
	line  13:	unnamed         	input
	line  14:	unnamed         	input
	line  15:	unnamed         	input
	line  16:	unnamed         	input
	line  17:	unnamed         	input consumer=hpd
	line  18:	unnamed         	input
	line  19:	unnamed         	input consumer=id
	line  20:	unnamed         	input
	line  21:	unnamed         	input
	line  22:	unnamed         	input
	line  23:	unnamed         	input
	line  24:	unnamed         	input
	line  25:	unnamed         	input
	line  26:	unnamed         	input
	line  27:	unnamed         	input
	line  28:	unnamed         	input
	line  29:	unnamed         	input
	line  30:	unnamed         	input
	line  31:	unnamed         	input
	line  32:	unnamed         	input
	line  33:	unnamed         	input
	line  34:	unnamed         	input
	line  35:	unnamed         	input
	line  36:	unnamed         	input
	line  37:	unnamed         	input
	line  38:	unnamed         	input
	line  39:	unnamed         	input
	line  40:	unnamed         	input
	line  41:	unnamed         	input
	line  42:	unnamed         	input
	line  43:	unnamed         	input
	line  44:	unnamed         	input
	line  45:	unnamed         	input
	line  46:	unnamed         	input
	line  47:	unnamed         	input
	line  48:	unnamed         	input
	line  49:	unnamed         	input
	line  50:	unnamed         	output consumer=regulator-usb0-vbus
	line  51:	unnamed         	input
root@verdin-am62-15415775:~# 

i configured OSPI0 as ouput in my overlay still its taking input

Kindly tell me that am i making any mistake in this overlay or while configuring pins as gpio what exactly i should do to use some unused peripherals as gpio’s am planning to use ospi0 and sd_card pins

Please find the attached image regarding the output-consumer

Best regards
Uday

Hey, @Uday10122,

I apologize for taking long to respond.

Let me know if I got it right, from what I understood:

  • You solved the problem about the LEDs claiming the GPIO pins
  • The only issue currently is that even though you configure the pins as outputs in the device tree overlay, they appear as inputs in gpioinfo

About the second point, even though the pins appear as inputs in gpioinfo, they can still be used as outputs, since the input configuration does not disable output functionality. Have you tested the pins? They should still function properly for your use-case.

For instance, here is a test I made: I applied your overlay to one of our boards and verified the gpioinfo output. Check the line for the OSPI0_CLK:

gpiochip2 - 92 lines:
        line   0:       "OSPI0_CLK"             input

After that, I set the pin value through the command gpioset -c 2 0=1. Leaving that process in the background and running gpioinfo again, it shows the following output:

gpiochip2 - 92 lines:
        line   0:       "OSPI0_CLK"             output consumer="gpioset"

Thus, the pin is configured as output at the moment you use it as such.

Honestly, I’m not sure why the pin doesn’t appear to be immediately set as an output (or at least isn’t shown as such in gpioinfo). Your overlay actually looks fine to me, since you disabled the previous functionality and configured the pins as outputs both in the groups and in the gpio-hog node. The libgpioc is known to behave strangely, so my guess is that the reason is something related to it.

Can you try using the overlay as is for your application and see if the pins behave as expected?

Best regards,

Hi Leonardo,

Thanks for the detailed response.

Instead of using the overlay, I decided to go with a custom approach. I created my own versions of k3-am62-verdin.dtsi and k3-am62-mallow-verdin.dtsi. I removed the entire conflicting node and then added the LED node directly in my custom k3-am62-mallow-verdin.dtsi. I also added pinctrl configuration to main_pmx0 to custom k3-am62-verdin.dtsi

With this setup, everything is working as expected. I’m not facing any issues with the pins showing as input/output incorrectly anymore.

now also pins claiming by consumer led its ok
i am accessing those with ls /sys/class/leds

Thanks again for your support!

Best regards,
Uday

1 Like