GPIO Configuration Issue on Apalis TK1

Hello, I want to simply toggle a GPIO low and then high in uboot and then set up the device tree such that the pin is held high after system is booted.

I was able to do this successfully for Apalis GPIO8 which is available on my Evaluation Board on the X4 header labeled GPIO8. I did this with a modification to “board/toradex/apalis-tk1/apalis-tk1.c” in uboot and a modification to “arch/arm/boot/dts/tegra124-platforms/tegra124-apalis-gpio.dtsi” in the kernel device tree. In both cases, I used TEGRA_GPIO(DD, 2) per page 33 of the datasheet: https://docs.toradex.com/103129-apalis-tk1-datasheet.pdf

So that all worked as expected, so I anticipated that just transitioning the behavior from GPIO8 to GPIO3 would be easy. However, it does not work for me. I’m using TEGRA_GPIO(N, 4) as that is the port/offset I see in the datasheet. However, I did notice a comment in “arch/arm/boot/dts/tegra124-platforms/tegra124-apalis-gpio.dtsi” that made it seem that TEGRA_GPIO(V, 4) would be GPIO3. So I did try this as well but it did not work.

I also just tried exporting gpio-108 using sysfs since 108 is the mapping for GPIO N,4 according to GPIO Alphanumeric to GPIO Numeric Assignment

This did not work. I got an error: “Device or resource busy”.

If I read /sys/kernel/debug/gpio, I see the following:

GPIOs 0-255, platform/6000d000.gpio, tegra-gpio:

gpio-63 (+V1.05_AVDD_HDMI_PLL) out hi

gpio-70 (temp_alert ) in hi

gpio-74 (apalis-tk1-k20-int2 ) out hi

gpio-108 (VCC_USBO1 ) out lo

gpio-109 (VCC_USBH(2A|2C|2D|3|) out hi

gpio-117 (WOL_GPIO ) in hi

gpio-118 (LAN_DEV_OFF_N ) out hi

gpio-146 (LAN_RESET_N ) out hi

gpio-164 (RESET_MOCI_CTRL ) out hi

gpio-170 (sdhci_cd ) in lo

gpio-171 (sdhci_cd ) in hi

gpio-172 (sysfs ) out hi

gpio-178 (apalis-tk1-k20-ezpcs) out hi

gpio-222 (apalis-tk1-k20-reset) out hi

gpio-233 (PEX_PERST_N ) out hi

gpio-234 (sysfs ) out lo

gpio-235 (WAKE1_MICO ) in hi

GPIOs 856-1015, platform/apalis-tk1-k20-gpio, can sleep:

GPIOs 1016-1023, platform/as3722-pinctrl, as3722-gpio, can sleep:

gpio-1018 (+V3.3 ) out hi

root@apalis-tk1:~#

Can you help my understand what I am missing in regards to controlling Apalis GPIO3?

And actually even setting it from uboot prompt, has no effect on GPIO3. I tried both:

108 is N,4 which is what I expect based on the datasheet:
Apalis TK1 # gpio set 108

172 is V,4:
Apalis TK1 # gpio set 172

But again, GPIO8 works as expected:
Apalis TK1 # gpio set 172

What exact Apalis TK1 module hardware version are you talking about? Please note that up to V1.2A GPIO3 and GPIO4 are known to be open-drain only unable to truly drive a high value as stated in resp. errata document.

I’m using Apalis TK1 modle v1.1A so it looks like that does apply to me. I will switch to using GPIO2 and confirm that works over the weekend. Thanks.

You are very welcome.

yep, no problems switching to any of the other GPIO. Thanks again.

You are very welcome. Once you get your hand on a V1.2A or later hardware revision this should all be working as expected without any limitations.