# GPIO manipulation in the device tree Rom 5722

**URL:** https://forum.aim-linux.advantech.com/t/gpio-manipulation-in-the-device-tree-rom-5722/587
**Category:** Technical Supports
**Created:** [October 17, 2023, 12:41pm UTC](https://forum.aim-linux.advantech.com/t/gpio-manipulation-in-the-device-tree-rom-5722/587 "2023-10-17T12:41:12Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Anthony\_garza1](https://avatars.discourse-cdn.com/v4/letter/a/e47774/32.png) [@Anthony\_garza1](https://forum.aim-linux.advantech.com/u/Anthony_garza1)
#### Post date: [October 17, 2023, 12:41pm UTC](https://forum.aim-linux.advantech.com/t/gpio-manipulation-in-the-device-tree-rom-5722/587/1 "2023-10-17T12:41:12Z")

</div>

I would like specifics if possible. I am going to include my version of what I think it should be I would really like to make sure that I am correct.  
I am attempting to modify some of the GPIO via the device tree so that it comes up in that configuration on boot.

P62 GPIO 1 12 Needs to be input weak pull low  
S142 GPIO12 TCA9528@71 needs to be an output pulled low  
P118 GPIO11 TCA9528@71 needs to be an output pulled high  
P111 GPIO 3 IOMUXC\_SAI3\_RXC\_\_GPIO4\_IO29

First I added to the pin hog group. Then I added a GPIO LED group.  
Did I do it correctly? does the led group need to be gpio-leds or &gpio-leds

&iomuxc {  
pinctrl-names = “default”;  
pinctrl-0 = \<&pinctrl\_hog\>;

```
pinctrl_hog: hoggrp {
	fsl,pins = <
		MX8MP_IOMUXC_HDMI_DDC_SCL__HDMIMIX_HDMI_SCL	0x400001c3
		MX8MP_IOMUXC_HDMI_DDC_SDA__HDMIMIX_HDMI_SDA	0x400001c3
		MX8MP_IOMUXC_HDMI_HPD__HDMIMIX_HDMI_HPD 0x40000019
		//MX8MP_IOMUXC_SAI1_TXD6__GPIO4_IO18	0x19 /* GPIO0 / CAM0_PWR# */
		//MX8MP_IOMUXC_SAI1_TXD7__GPIO4_IO19	0x19 /* GPIO1 / CAM1_PWR# */
		//MX8MP_IOMUXC_SAI3_RXFS__GPIO4_IO28	0x19 /* GPIO2 / CAM0_RST# */
		//MX8MP_IOMUXC_SAI3_RXC__GPIO4_IO29	0x19 /* GPIO3 / CAM1_RST# */
		MX8MP_IOMUXC_SAI2_MCLK__GPIO4_IO27	0x19 /* GPIO4 */
		MX8MP_IOMUXC_SPDIF_EXT_CLK__GPIO5_IO05	0x19 /* GPIO5 */
		MX8MP_IOMUXC_UART3_RXD__GPIO5_IO26	0x19 /* GPIO6 */
		MX8MP_IOMUXC_UART3_TXD__GPIO5_IO27	0x19 /* GPIO7 */
                    MX8MP_IOMUXC_GPIO1_IO12__GPIO1_IO12 0x11D /* GPIO 1 12 */
	>;
};

```

gpio-leds {  
compatible = “gpio-leds”;

```
	led {
		label = "gpio-backplane";
		gpios = <&tca9538_a71 3 GPIO_ACTIVE_HIGH>;
		default-state = "on";
	};
           led {
		label = "gpio-amplifier";
		gpios = <&tca9538_a71 4 GPIO_ACTIVE_HIGH>;
		default-state = "on";
	};

```

};

---

<div class="post-metadata">

### Author: ![Anthony\_garza1](https://avatars.discourse-cdn.com/v4/letter/a/e47774/32.png) [@Anthony\_garza1](https://forum.aim-linux.advantech.com/u/Anthony_garza1)
#### Post date: [October 17, 2023, 12:54pm UTC](https://forum.aim-linux.advantech.com/t/gpio-manipulation-in-the-device-tree-rom-5722/587/2 "2023-10-17T12:54:58Z")

</div>

Also do you have the .mex file for creating the dts that you used. Would help me to be able to see what I need to change these too.

---

<div class="post-metadata">

### Author: ![Jems\_Cheng](https://avatars.discourse-cdn.com/v4/letter/j/c57346/32.png) [@Jems\_Cheng](https://forum.aim-linux.advantech.com/u/Jems_Cheng)
#### Post date: [October 18, 2023, 8:56am UTC](https://forum.aim-linux.advantech.com/t/gpio-manipulation-in-the-device-tree-rom-5722/587/4 "2023-10-18T08:56:44Z")

</div>

Hi~

1. For including version, please reference Yocto project document  
[Welcome to the Yocto Project Documentation — The Yocto Project ® 4.2.999 documentation](https://www.yoctoproject.org/docs/current/ref-manual/ref-manual.html)  

2. For GPIO control, it can reference the link below,  
[https://github.com/nxp-imx/linux-imx/blob/lf-6.1.y/Documentation/devicetree/bindings/gpio/gpio.txt](https://github.com/nxp-imx/linux-imx/blob/lf-6.1.y/Documentation/devicetree/bindings/gpio/gpio.txt)

---

<div class="post-metadata">

### Author: ![Anthony\_garza1](https://avatars.discourse-cdn.com/v4/letter/a/e47774/32.png) [@Anthony\_garza1](https://forum.aim-linux.advantech.com/u/Anthony_garza1)
#### Post date: [October 18, 2023, 11:31am UTC](https://forum.aim-linux.advantech.com/t/gpio-manipulation-in-the-device-tree-rom-5722/587/5 "2023-10-18T11:31:55Z")

</div>

Can you expand on the GPIO implementation specific to your SOM. I mean an actual example of the three lines configured the way I described. I know it is a pain, but really us devs are working on a timeline and a ton of research into something that the vendor should readily have is not really great.  
I would like a specific dts example for your gpios that are on the expansion and not on the expansion. The NXP pin configuration utility will give the the proper values like 0x106 or whatever. But I have a list of these and having quick examples how to put them together would save me a bunch of time. When I am on a development schedule that was already pushed back over a month do to slow bsp releases.

Honestly if I wanted something a google search could turn up I would just use google. I asked for specifics regarding your chip.

Also one of my devs is having a very hard time getting weston to run on startup using your generic display driver. I will have him make a post regarding his troubles.

---

<div class="post-metadata">

### Author: ![Jems\_Cheng](https://avatars.discourse-cdn.com/v4/letter/j/c57346/32.png) [@Jems\_Cheng](https://forum.aim-linux.advantech.com/u/Jems_Cheng)
#### Post date: [October 19, 2023, 3:16am UTC](https://forum.aim-linux.advantech.com/t/gpio-manipulation-in-the-device-tree-rom-5722/587/6 "2023-10-19T03:16:13Z")

</div>

Hi~,

For ROM-5722, the imx8mp-rom5722-a1.dts is develop for the carrier board DB2510 and the GPIO have connected to the GPIO pin header.

So use RSB-3720 for an example. There is an GPIO\_LED on RSB-3720.  
 ![image](https://us1.discourse-cdn.com/flex016/uploads/aim_linux/original/1X/fa8badf7664e52713197d25625ffd98362121213.png)  
 ![image](https://us1.discourse-cdn.com/flex016/uploads/aim_linux/original/1X/7f25323de356b5686bab18d86bca4bdf58853583.png)

Please check Advantech github imx8mp-rsb-3720-a1.dts file for an example.  
[linux-imx/arch/arm64/boot/dts/freescale/imx8mp-rsb3720-a1.dts at adv\_5.4.70\_2.3.0 · ADVANTECH-Corp/linux-imx (github.com)](https://github.com/ADVANTECH-Corp/linux-imx/blob/adv_5.4.70_2.3.0/arch/arm64/boot/dts/freescale/imx8mp-rsb3720-a1.dts)  
 ![image](https://us1.discourse-cdn.com/flex016/uploads/aim_linux/original/1X/60f69e9861ebe591ff3111e2ad3ceaf28b4dc4c9.png)  
 ![image](https://us1.discourse-cdn.com/flex016/uploads/aim_linux/original/1X/8211fe4eff633afdfd5405a2bdedc208d7dc0f3e.png)

 ![image](https://us1.discourse-cdn.com/flex016/uploads/aim_linux/original/1X/87b59a27224ca9a3c71d2bc07c4188cbd9cd5495.png)

For pad control register: Please reference the link below to download i.MX8MP reference manual

> **[i.MX8MP IOMUX controller in reference manual](https://community.nxp.com/t5/i-MX-Processors/i-MX8MP-IOMUX-controller-in-reference-manual/td-p/1288015)**
>
> Hello,  I have downloaded the IMX8MP reference manual from this link (https://www.nxp.com/docs/en/reference-manual/IMX8MPRM.pdf) but I see the chapter 32 is empty.  Looking in the EVK device...

![image](https://us1.discourse-cdn.com/flex016/uploads/aim_linux/original/1X/41fbbbf0568d37a8a5988a6dfeb10dba57d0ac38.png)  
And reference the pad control register.

 ![image](https://us1.discourse-cdn.com/flex016/uploads/aim_linux/original/1X/5b017c10544b3779087b9f9689a54a3da48d598e.png)
