AGX Xavier set GPIO to high in device tree

Hi all,

I’m trying to set one specific GPIO pin as output-high in the device tree. For that I’ve used the pinmuxing spreadsheet that NVIDIA provides. Basically, I configured the pin direction and initial state of gpio493 (pin 19 of the 40-pins header, pin D55 of the SoM) in this spreadsheet. Then I clicked on generate DT files to get 3 dtsi. Finally I included these dtsi files in the final dts for the dev kit in ./nvidia/platform/t19x/galen/kernel-dts/tegra194-p2888-0001-p2822-0000.dts like this:

#include "common/tegra194-p2888-0001-p2822-0000-common.dtsi"
#include "common/tegra194-p2822-camera-modules.dtsi"
#include "t19x-common-modules/tegra194-camera-plugin-manager.dtsi"

#include "common/tegra19x-jetson_agx_devkit-gpio-default.dtsi"
#include "common/tegra19x-jetson_agx_devkit-padvoltage-default.dtsi"
#include "common/tegra19x-jetson_agx_devkit-pinmux.dtsi"

/ {
	model = "test-board";
};

I’m sure that the board is loading this device tree because I verified the model property in /proc/device-tree/model, but if I check the status of the pin I don’t see a high value in the output. I’m also certain I’m connected to the right pin as I can control the status through the sys interface in gpio493, however, we would need to configure this pin from kernel initialization, before going into user space. Do you know any other steps I may be missing?

Thanks

Please, whatever feedback here is welcome. For me it isn’t very clear how to apply the dtsi files coming from the spreadsheet.

You could add the property as below one in device tree.

gpio-hog;
output-high;
gpios = <TEGRA194_AON_GPIO(AA, 5) 0>;

Hi WayneWWW,

Thanks for your reply. Sorry if this is too obvious, but, where to place those lines? in “common/tegra19x-jetson_agx_devkit-gpio-default.dtsi”?

I saw that I had missed one step before. I hadn’t generated the *.cfg files from the files “tegra19x-jetson_agx_devkit-pinmux.dtsi” and “tegra19x-jetson_agx_devkit-gpio-default.dtsi 1.0” as indicated in https://elinux.org/Jetson/AGX_Xavier_Update_Pinmux. So, whenever there are changes in the pinmux and/or GPIO states, actually theses changes are applied int the MB1 bootloader, right?

On the other hand, even though the pin I had configured is now in the requested state, I cannot see it in /sys/class/gpio/. Is there a way to also show this pin in the sys interface by default? as the others that appear there when booting up the board.

Thanks!

You should put it under either gpio@2200000 or gpio@c2f0000. It depends on which GPIO you are using.

The file is the dts file you are flashing to device and it is NOT the “common/tegra19x-jetson_agx_devkit-gpio-default.dtsi”. You could download our kernel source code and you will know what I am talking about.

Regarding my last comment…

I meant that if I do a cat in /sys/kernel/debug/gpio I see this:

gpiochip2: GPIOs 240-247, parent: platform/max77620-gpio, max77620-gpio, can sleep:
 gpio-246 (                    |gpio_default        ) out hi    
 gpio-247 (                    |gpio_default        ) out hi    

gpiochip1: GPIOs 248-287, parent: platform/c2f0000.gpio, tegra-gpio-aon:
 gpio-253 (                    |pex-refclk-sel-low  ) out lo    
 gpio-284 (                    |power-key           ) in  hi    

gpiochip0: GPIOs 288-511, parent: platform/2200000.gpio, tegra-gpio:
 gpio-288 (                    |vdd-1v8-sd          ) out hi    
 gpio-289 (                    |?                   ) out hi    
 gpio-291 (                    |vdd-hdmi-5v0        ) out hi    
 gpio-336 (                    |force-recovery      ) in  hi    
 gpio-339 (                    |wifi-enable         ) out hi    
 gpio-341 (                    |eqos_phy_reset      ) out hi    
 gpio-343 (                    |cd                  ) in  hi    
 gpio-346 (                    |temp-alert          ) in  hi    
 gpio-378 (                    |pcie_wake           ) in  hi    
 gpio-386 (                    |hdmi2.0_hpd         ) in  lo    
 gpio-389 (                    |vdd_sys_en          ) out lo    
 gpio-390 (                    |reset_gpio          ) out lo    
 gpio-391 (                    |bt_ext_wake         ) out hi    
 gpio-392 (                    |avdd-cam-2v8        ) out lo    
 gpio-480 (                    |bt_host_wake        ) in  lo    
 gpio-489 (                    |vdd-5v-sata         ) out hi    
 gpio-490 (                    |?                   ) out lo

So, even if the GPIO493 pin was set to high by the MB1 bootloader, I don’t see it there. I guess I have to set this in other place apart from the bootloader. If so, do you know where?

Hi WayneWWW

I just saw you last reply. Many thanks.

Sorry, I did not say that “common/tegra19x-jetson_agx_devkit-gpio-default.dtsi” was the dts being flashed. In the first post I had already said that I’m using the /nvidia/platform/t19x/galen/kernel-dts/tegra194-p2888-0001-p2822-0000.dts, so I’m also using your kernel… I just wanted to make sure if I had to add the dtsi files obtained from the spreadsheet to THIS dts. Could you confirm this? Or these dtsi files are only meant to generate the cfg files for the bootloader?

For the dtsi from the spreadsheet, you need to use the script tool to convert it to a cfg file, put it into somewhere inside the Linux_for_Tegra/bootloader and then do the flash.

What I was talking about in previous thread has nothing to do with it.

The gpio-hog is engaged in kernel so you need to put this under the tegra194-p2888-0001-p2822-0000.dts or any other dtsi that can be included to final dts.

Other dts/dtsi in our kernel source also have such usage (gpio-hog, output-high/low…). You could see it once you grep the folder.