Problem reassigning pins to act as gpio-keys

I am working with a Colibri imx7d 512MB on an Iris v2 board. I’m trying to reassign pins on the X16 connector to act as gpio-keys. But Something is not working as expected.

One example is that I was asked to use X16/SODIMM pins 29/32 and 30/34 which by default belong to uart2. So in my dts file:

&iomuxc {
	/*
	* Redefine the UART2 pinout to be only a non-hardware flow controlled
	* UART, we need pins
	* MX7D_PAD_SAI2_RX_DATA__UART2_DTE_RTS 0x79
	* MX7D_PAD_SAI2_TX_DATA__UART2_DTE_CTS 0x79
	* for gpio-keys.
	*/
	pinctrl_uart2: uart2-grp {
		fsl,pins = <
			MX7D_PAD_UART2_TX_DATA__UART2_DTE_RX 0x79
			MX7D_PAD_UART2_RX_DATA__UART2_DTE_TX 0x79
		>;
	};
	
	/* Expand the gpio-keys pinctrl */
	pinctrl_gpiokeys {
		fsl,pins = <
			MX7D_PAD_LPSR_GPIO1_IO01__GPIO1_IO1	0x19 /* SODIMM 1 */
			MX7D_PAD_SAI2_RX_DATA__GPIO6_IO21	0x19 /* SODIMM 32 */
			MX7D_PAD_SAI2_TX_DATA__GPIO6_IO22	0x19 /* SODIMM 34 */
		>;
	};
};

/* Redefine UART2 as a simple UART with no hardware flow control. */
&uart2 {
	pinctrl-names = "default";
	pinctrl-0 = <&pinctrl_uart2>;
	assigned-clocks = <&clks IMX7D_UART2_ROOT_SRC>;
	assigned-clock-parents = <&clks IMX7D_OSC_24M_CLK>;
	/delete-property/uart-has-rtscts;
	/delete-property/fsl,dte-mode;
};

/ {
	/* Redefine gpio-keys */
	gpio-keys {
		compatible = "gpio-keys";
		pinctrl-names = "default";
		pinctrl-0 = <&pinctrl_gpiokeys>;

		right_key {
			label = "Right-key";
			gpios = <&gpio6 21 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>;
			linux,code = <KEY_RIGHT>;
			debounce-interval = <10>;
		};

		down_key {
			label = "Down-key";
			gpios = <&gpio6 22 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>;
			linux,code = <KEY_DOWN>;
			debounce-interval = <10>;
		};
	};
};

But it turns out that the MX7D_PAD_SAI2_TX_DATA__UART2_DTE_CTS aka MX7D_PAD_SAI2_TX_DATA__GPIO6_IO22 keeps it’s pull-up as if it where still using the old configuration.

In order to update the dtb I’m using:

ubiupdatevol /dev/ubi0_1 imx7d-colibri-iris-v2-myproject.dtb

I have decompiled the aforementioned dtb with

dtc --sort -I dtb -O dts imx7d-colibri-iris-v2-myproject.dtb -o myproject.dts

And reviewed the final codes for the pinmuxing and uart2 assignments, diffed it against the original iris-v2 decompiled dtb and everything seems fine…

What can I be missing?

LPSR pads can’t be defined in iomuxc, they have to be defined in iomuxc_lpsr. With LPSR pad in iomuxc, chances are settings for it will overwrite settings for other unrelated non-LPSR pad.

Mm, actually the LPSR one is just a left over, and not the pin I am having issues with (that’s the rest button which, yes, it should not be there).

Ah, but I might be targetting the wrong pinmux non the less. Will try that, thanks!

Exactly, I tried to reuse the existant gpio-keys node which was using an LPSR pin, while all the pins I needed where not LPSR. Adding another node was enough. Thanks a lot @Edward !!!