How do mapping GPIO number on u-boot and Kernel?

Hi Guys,

Our products want to set some pins to GPIO, and control these.
When I check the docs and source code, the same PIN had a difference GPIO number of u-boot and kernel.

Example, When I want to set H3 to GPIO.
Base of u-boot source code H3 GPIO number is 59.

=========================================================
#define TEGRA_GPIO(bank, offset)
((TEGRA_GPIO_BANK_ID_##bank * 8) + offset)

#endif

#define TEGRA_GPIO_BANK_ID_H 7

TEGRA_GPIO(H, 3) ===> 7*8+3 = 59

But when I find this pin number on Kernel, I reference “Jetson_TX1_Generic_Customer_Pinmux_Customer_Release.xlsm”.

I find the H3 is “GPIO3_PE.06”.

Base this name and trace kernel source code, I find the H3 GPIO number is 38.

gpio-names.h

#define TEGRA_GPIO_PE6 38

So, the same pin had a difference GPIO number is correct?

Thanks!!!
BR.

Alleen Wang

hello alleen.wang,

there’s mappings during kernel stage.
please check the [Tegra Linux Driver Package TX2 Adaptation Guide]-> [GPIO Changes] for reference.
thanks