VF61 Linux gpio issue

I am attempting to use pin PTB19 as GPIO 41 on my VF61 module. I started with a copy of the Toradex device tree file vf610-colibri-eval-v3.dts, named it vf610-colibri-eval-v3test.dts, and changed it by adding the following to the end of the file:

&iomuxc {
	vf610-colibri {
		pinctrl_hog_0: hoggrp-0 {
			fsl,pins = <
				VF610_PAD_PTA12__GPIO_5		0x22ed
				VF610_PAD_PTA17__GPIO_7		0x22ed
				VF610_PAD_PTA20__GPIO_10	0x22ed
				VF610_PAD_PTA21__GPIO_11	0x22ed
				VF610_PAD_PTA30__GPIO_20	0x22ed
				VF610_PAD_PTA31__GPIO_21	0x22ed
				VF610_PAD_PTB6__GPIO_28		0x22ed
				VF610_PAD_PTB7__GPIO_29		0x22ed
				VF610_PAD_PTB16__GPIO_38	0x22ed
				VF610_PAD_PTB17__GPIO_39	0x22ed
				VF610_PAD_PTB18__GPIO_40	0x22ed
				VF610_PAD_PTB19__GPIO_41	0x22ed	/* added new gpio */
				VF610_PAD_PTB21__GPIO_43	0x22ed
				VF610_PAD_PTB22__GPIO_44	0x22ed
				VF610_PAD_PTC1__GPIO_46		0x22ed
				VF610_PAD_PTC2__GPIO_47		0x22ed
				VF610_PAD_PTC3__GPIO_48		0x22ed
				VF610_PAD_PTC4__GPIO_49		0x22ed
				VF610_PAD_PTC5__GPIO_50		0x22ed
				VF610_PAD_PTC6__GPIO_51		0x22ed
				VF610_PAD_PTC7__GPIO_52		0x22ed
				VF610_PAD_PTC8__GPIO_53		0x22ed
				VF610_PAD_PTD30__GPIO_64	0x22ed
				VF610_PAD_PTD29__GPIO_65	0x22ed
				VF610_PAD_PTD28__GPIO_66	0x22ed
				VF610_PAD_PTD26__GPIO_68	0x22ed
				VF610_PAD_PTD25__GPIO_69	0x22ed
				VF610_PAD_PTD24__GPIO_70	0x22ed
				VF610_PAD_PTD9__GPIO_88		0x22ed
				VF610_PAD_PTD10__GPIO_89	0x22ed
				VF610_PAD_PTD11__GPIO_90	0x22ed
				VF610_PAD_PTD12__GPIO_91	0x22ed
				VF610_PAD_PTD13__GPIO_92	0x22ed
				VF610_PAD_PTB26__GPIO_96	0x22ed
				VF610_PAD_PTB28__GPIO_98	0x22ed
				VF610_PAD_PTC30__GPIO_103	0x22ed
				VF610_PAD_PTA7__GPIO_134	0x22ed
			>;
		};
	};
};

Exactly one line was added to the fsl,pins property. Now when I attempt to boot linux I get the following error on the console:
[ 3.965400] vf610-pinctrl 40048000.iomuxc: pin VF610_PAD_PTB19 already requested by 40048000.iomuxc; cannot claim for gpio-keys
[ 3.993998] vf610-pinctrl 40048000.iomuxc: pin-41 (gpio-keys) status -22
[ 4.009606] vf610-pinctrl 40048000.iomuxc: could not request pin 41 (VF610_PAD_PTB19) from group gpiokeys on device 40048000.iomuxc
[ 4.039532] gpio-keys gpio-keys: Error applying setting, reverse things back
[ 4.056914] input: gpio-keys as /devices/platform/gpio-keys/input/input1

This is apparently because PTB19 is already assigned to pinctrl_gpiokeys in vf-colibri-eval-v3.dtsi. I think this has something to do with some kind of wakeup function, which I do not need.

I have tried to eliminate this pin conflict by using a /delete-node/ line in my modified device tree file to delete the gpio-keys node defiled in vf-colibri-eval-v3.dtsi, but apparently I am not doing it right. My device tree file compiles, but the pin conflict error remains. I want to use a /delete-node/ in my own file because I don’t want to modify any of the toradex device tree include files. How do I properly delete the gpio-keys node?

hi @irbsd

Thanks for writing to the Toradex Community!

I have tried to eliminate this pin conflict by using a /delete-node/ line in my modified device tree file to delete the gpio-keys node defiled in vf-colibri-eval-v3.dtsi, but apparently I am not doing it right.

Which Syntax did you use?

Please have a look at the Documentation here?

Best regards,
Jaski

If I put the following line in my device tree file:

/delete-node/ pinctrl_gpiokeys;

Then I get the following error when compiling:

Error: arch/arm/boot/dts/vf610-colibri-eval-v3test.dts:19.15-31 syntax error

If I put the following in my device tree file:

&iomuxc {
	vf610-colibri {
		/delete-node/ pinctrl_gpiokeys;
	};
};

The device tree file compiles without error, but I get the following error on the Linux console when I try to boot:

[ 3.965277] vf610-pinctrl 40048000.iomuxc: pin VF610_PAD_PTB19 already requested by 40048000.iomuxc; cannot claim for gpio-keys

This tells me that the pinctrl-gpiokeys node must still exist, otherwise gpio-keys wouldn’t be trying to claim pin VF610_PAD_PTB19 (I think).

I want to completely free up PTB19 from whatever function it is being use for in vf-colibri-evel-v3.dtsi where it appears in the “pinctrl_gpiokeys: gpiokeys” node, and is referenced by the “gpio-keys” node.

I want to make PTB19 available as a GPIO pin, without it being used by any other function (which creates a pin conflict when Linux boots). Is it really so hard to make PTB19 available as a GPIO pin? Please tell me how to do that, as I am clearly doing something wrong.

Hi

Could you try to remove the gpio-keys node completely?

Best regards,
Jaski

Hi

The node is defined as follows with pinctrl_gpiokeys a reference to the node gpiokeys.:

pinctrl_gpiokeys: gpiokeys {
...

If you want to delete the node by using its reference you would use ‘&’ to dereference it:

/delete-node/ &pinctrl_gpiokeys;

If you want to delete the node by using its node name you would need to reconstruct the full node hierarchy:

&iomuxc {
        vf610-colibri {
                /delete-node/ gpiokeys;
}

However the gpio-keys node actually uses this pinctrl, so by deleting it the device tree compiler will give an error that the node is missing.


The way forward is to either delete the gpio-keys node (and optionally the pinctrl node) or to set the status of the gpio-keys node to disabled.

E.g.

/ {
        /delete-node/ gpio-keys;
};

or

/ {
        gpio-keys {
                status = "disabled";
        };
};

Which of the two depends on personal taste.

Max