GPIO issue in U-boot


The gpio298 works in the Ubuntu but cannot be access in U-boot.

Error message is as following:
Tegra186 (P2771-0000-500) # gpio input 298
gpio: requesting pin 298 failed
gpio - query and control gpio pins

gpio <input|set|clear|toggle>
- input/set/clear/toggle the specified pin
gpio status [-a] [ | ] - show [all/claimed] GPIOs
Tegra186 (P2771-0000-500) #

But The gpio pins in J21 for TX1 works.
Does anyone know how to access the GPIO pin in U-boot for TX2?

hello IsaHung,

may i know how did you get the gpio number 298?
which J21 pin you would like to control for TX2 in u-boot?

Dear Jerry,

From the reference:

The pin 31 in J21 for TX2 is gpio298,
I can use the gpio186 in J21 for TX1 in U-Boot, but I can not use the same way to get the GPIO status for TX2.
I think it has some mapping on TX2, is it correct?
Thank you.

hello IsaHung,

sorry for late reply.
please notice that there’s gpio mapping at the kernel init stage.
[ 0.262225] gpiochip_add_data: registered GPIOs 320 to 511 on device: tegra-gpio
[ 0.264558] gpiochip_add_data: registered GPIOs 256 to 319 on device: tegra-gpio-aon

hence, gpio298 should not be the correct gpio pin in u-boot.
could you please try to minus the base(256) to control gpio pin in u-boot again?