I can't set gpio pins via U-Boot "Warning: value of pin is still 0"

Hi,

I have an Apalis iMX6Q 2GB IT.
I followed the instruction on http://developer.toradex.com/knowledge-base/board-support-package/openembedded-(core) to build my own image.

I flashed an apalis module with “run setupdate; run update_it” (U-Boot, linux kernel, linux rootfs) with my output.

My current U-Boot Version:
U-Boot 2016.11-2.7.2+g60021a4 (Aug 23 2017 - 10:58:31 +0200)
arm-angstrom-linux-gnueabi-gcc (Linaro GCC 6.2-2016.11) 6.2.1 20161016
GNU ld (GNU Binutils) 2.27.0.20160806

Now I want to set the GPIO pins 14 and 15 (MX6QDL_PAD_SD2_DAT0__SD2_DATA0 and MX6QDL_PAD_SD2_DAT0__SD2_DATA0) via U-Boot. But this doesn’t work. I get the warning “Warning: value of pin is still 0”.
And I can’t set any GPIO pin (1, 2, 3, …) via U-Boot.

Apalis iMX6 # gpio set 14
gpio: pin 14 (gpio 14) value is 1
   Warning: value of pin is still 0

I have an other modul with an older U-Boot version [U-Boot 2015.04 (May 18 2015 - 13:08:37) arm-angstrom-linux-gnueabi-gcc (Linaro GCC 4.9-2014.11) 4.9.3 20141031 (prerelease) GNU ld (GNU Binutils) Linaro 2014.11-2 2.24.0.20141017].
With that, I can set GPIO pins via uboot:

Apalis iMX6 # gpio set 1
gpio: pin 1 (gpio 1) value is 1
Apalis iMX6 # gpio set 14
gpio: pin 14 (gpio 14) value is 1

I tried to downgrade my U-Boot version with the image from Apalis_iMX6_LinuxImageV2.4Beta1_20150518.
My steps:

Apalis iMX6 # run setupdate
reading flash_blk.img
1987 bytes read in 18 ms (107.4 KiB/s)
reading flash_blk.img
1987 bytes read in 18 ms (107.4 KiB/s)
## Executing script at 12000000
enter "run update" or "run update_it" to update the entire module
Apalis iMX6 # run update_uboot_it
reading u-boot-it.imx
310272 bytes read in 38 ms (7.8 MiB/s)
switch to partitions #0, OK
mmc0(part 0) is current device

MMC write: dev # 0, block # 2, count 606 ... 606 blocks written: OK
Apalis iMX6 #

But after restart the U-Boot version hasn’t changed (U-Boot 2016.11-2.7.2+g60021a4 (Aug 23 2017 - 10:58:31 +0200).

Is it possible to downgrade U-Boot?

Or how can I fix my U-Boot version to set gpio pins?

Hi,
This may be useful.
https://www.toradex.com/community/questions/971/gpio-handling-in-uboot.html

Now I want to set the GPIO pins 14 and 15 (MX6QDL_PAD_SD2_DAT0_SD2_DATA0 and MX6QDL_PAD_SD2_DAT0_SD2_DATA0) via U-Boot.

You are probably talking about the MXM3 pins 186 and 188 which by default are used for the SD card interface and therefore are pin muxed for the same e.g. here. In order to be able to use them for anything else you would need to compile a custom U-Boot which configures them according to your requirements.

Is it possible to downgrade U-Boot?

Not easily due to newer BSPs/modules defaulting to using the fast boot mode. While depending on what exact hardware revision of module(s) you have it may still be feasible we definitely do not recommend staying on such ancient unsupported BSPs.

Or how can I fix my U-Boot version to set gpio pins?

The article @jaymin referred to above is a good start. However there are a few subtle differences in GPIO handling between Vybrid and the i.MX 6 SoCs:

  1. For the i.MX 6 to be able to use the GPIO functionality of a certain ball/pin its pin muxing needs to be set properly.
  2. For the i.MX 6 to be able to read back the state of a GPIO the SION bit needs to be set.

Once that is taken care of I would expect your GPIOs to work flawless again.