Device Tree Customization/ Device Tree Overlays to Enable/multiplex GPIO

Hi Support Team,

I am trying to enable GPIO feature in my Verdin imx8m Plus with Dhalia carrier board setup running Boot to QT. currently 8 GPIO’s are enabled by default and wanted 4 more GPIO pins that are defaulted to other signals.

I went through some documentations but, it doesn’t seem to be straightforward. Need support for the same.

Thanks
Vijay

Hi @VijayRichard,

In order to do that, you will need to customize your device tree. You can build a device tree overlay that will change these pins for you.
Here are the articles for device tree customization and overlays: Device tree overview | Toradex Developer Center

Could you tell me what pins you want to change?

Best regards,
Hiago.

Hi I am trying to change the below pins to GPIO (GPIO3_IO9 AND GPIO3_IO16) . The reference is provided with respect to Dhalia.

Below is the reference for Verdin.

I see that pin 64 is enabled for GPIO i confirmed this from device tree pin mapping file.Its getting exported but the output value that i am setting doesn’t have any impact when i read the signals from the board.

Regards
Vijay Richard

Also is there any option to do this from the Uboot terminal?

Hi @VijayRichard,

For SODIMM 62, you can write an overlay as:


// Enable Verdin iMX8M Plus SODIMM 62 GPIO.

/dts-v1/;
/plugin/;

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

#include "imx8mp-pinfunc.h"

/* Verdin QSPI_1 */
&flexspi {
	status = "disabled";
};

/* Additional GPIO */
&iomuxc {

	pinctrl-0 = <&pinctrl_gpio1>, <&pinctrl_gpio2>,
		    <&pinctrl_gpio3>, <&pinctrl_gpio4>,
		    <&pinctrl_gpio7>, <&pinctrl_gpio8>,
		    <&pinctrl_gpio_hog1>, <&pinctrl_gpio_hog2>, <&pinctrl_gpio_hog3>,
		    <&pinctrl_hdmi_hog>, <&pinctrl_add_gpio>;
	
    pinctrl_add_gpio: add_gpio_grp {
		fsl,pins = <
			MX8MP_IOMUXC_NAND_DATA03__GPIO3_IO09        0x82	/* SODIMM 62 */
		>;
	};
};

I’ve searched this pin inside the linux-toradex and I’ve found it inside the flexspi node. So I disabled it to remove conflicts and then create a new group for the additional GPIO that you need to enable. Finally, I’ve added it to the iomuxc node.
I’ve also assumed your verdin imx8mp doesn’t have Wifi and Bluetooth, otherwise the pinctrl-0 inside iomuxc needs to be changed.

You can change the name and also the 0x82 to fit your needs.

Please, follow this article to compile your device tree overlay: Build U-Boot and Linux Kernel from Source Code | Toradex Developer Center

Have you check if you have the correct device tree enabled? Our modules come with the device tree for the Evaluation board by default.
You can check this by running

# printenv fdtfile
# printenv fdt_board

inside the u-boot terminal. If it’s incorrect, you can change it by running

# setenv fdt_board dahlia
# saveenv
# reset

This will fix your problem.

The only way to change the pins’ functions is by changing the device tree.

Please let me know if you need anything else.

Best regards,
Hiago.

Hi Hiago,

I tested the gpio64 issue that i explained quickly, I could see that now i am able to control the pin.
I will test the other things and update you.

One more issue i am facing is on WAKEUP pin below(GPIO4_IO0).I connected a switch and whenever I press or release the switch the pin seems to always be high. Any suggestion

Regards
Vijay Richard

Hi @VijayRichard,

Great! Let me know if you need anything else.

I checked Dahlia’s datasheet and there is a pull-up resistor in this pin:

The “#” symbol indicates this pin is active-low, you need to connect it to ground to activate the WAKE routine.

Best regards,
Hiago.