System stucked when trying to pull GPIO04(PCC1) down

I was trying to control GPIO04, but when I pull down GPIO04 , system get stucked immediately:

echo 265 > /sys/class/gpio/export
echo 0 > /sys/class/gpio/gpio265/value

is there any way to control this GPIO pin?

hello 258633901,

please check the pinmux spreadsheets for the default pin configuration,
may I know what’s your actual use-case, it’s Baseboard Power LED Control for GPIO04,
thanks

tegra19x-mb1-pinmux-p3668-a01.cfg (27.2 KB)

Hi JerryChang,

 Thank you for your help
 I already check pinmux configuration , but not found the problem , 
 I uploaded the pinmux BCT file and pinmux xml spreadsheets (actually it was download from official website, i did not change anything) , and I think the GPIO04 is remain as gpio function,because the BCT file config it as rsvd2. 

 Our purpose to control GPIO04 is to show some indication . for example ,continuously blink led to indicate system is alive , etc..

 BTW ,  regardless of software operation ,   system is also hung if pulling down GPIO04 by short the pin to GND..

hello 258633901,

could you please refer to this change, it’s patch to supports led off during suspend and shutdown.
you may also have a try to access the pin with suspend_gpio.
thanks

Hi JerryChang,

System is hang up during boot when I add below change to DTS …
leds {
compatible = “gpio-leds”;
status = “okay”;
pwr_led {
gpios = <&tegra_aon_gpio TEGRA194_AON_GPIO(CC, 1) GPIO_ACTIVE_HIGH>;
default-state = “off”;
};
};

br.

hello 258633901,

please also share kernel initial messages for reference,
thanks

log.txt (28.8 KB)
Hi JerryChang,
please refer to attachment file for details

thanks

Hi Jerry,

any update?

thank you a lot

hello 258633901,

there’s error reported from pin control driver, please review the pin configurations.
for example,

[   0.719242] tegra194-pinctrl 2430000.pinmux: function 'shutdown' not supported
[    0.719289] tegra194-pinctrl 2430000.pinmux: invalid function shutdown in map table
[    0.719344] tegra194-pinctrl 2430000.pinmux: Failed to add default setting: -22
RNING: pll_d2 has no dyn ramp

Hi,
Why are you keeping default-state to off?

Hi Jerry,
the purpose is to show the problem.
set default-state = “on”; is OK , but i want to prove that this IO pin can not been pull down by anyway (physical or by software).
by setting default-state = “off”; the system will halt during booting state , and this is the problem.

beside , about the ‘shutdown’ pin configuration , seems there is no way i can config or review this pin by using the pinmux xml file.

but there is surely some information in generated DTSI file: tegra19x-jetson_xavier_nx_module-pinmux.dtsi:

shutdown_n {
nvidia,pins = “shutdown_n”;
nvidia,function = “shutdown”;
nvidia,pull = <TEGRA_PIN_PULL_NONE>;
nvidia,tristate = <TEGRA_PIN_DISABLE>;
nvidia,enable-input = <TEGRA_PIN_DISABLE>;
nvidia,io-high-voltage = <TEGRA_PIN_DISABLE>;
nvidia,lpdr = <TEGRA_PIN_DISABLE>;
};

is this the problem?

Hi,
This is already used as gpio. When system goes to suspend, gpio goes low, led goes off .
How are you able to write 265 into /sys/class/gpio/export? you should not be able to as this gpio is already hogged as output-high. You can see that from cat /sys/kernel/debug/gpio | grep “265”

If you do not want to control this in suspend, you may need to remove this:
gpio@c2f0000 {
suspend-led-gpio {
gpio-hog;
output-high;
gpio-suspend;
suspend-output-low;
gpios = <TEGRA194_AON_GPIO(CC, 1) GPIO_ACTIVE_HIGH>;
label = “suspend-led-gpio”;
status = “okay”;
};
};

tegra194-p3668-common.dtsi (11.5 KB)
gpio.txt (9.0 KB)
hi shgarg,
seems the DTS file in my sdk did not have such config…
thanks

hi shgard,
sorry,
I did not add everything in 0001-dts-Jakku-enable-gpio-led-for-P3668.patch to my project.
I don’t care about the the gpio04 level when suspend , I don’t need this modification.
I just want to control the GPIO04.

thanks

hi shgarg,

problem is the gpio04 can not been pull down by ANYWAY , if you have a NX devkit at hand, can you have a try ? and share the result ?

thanks a lot