Disable GPIO pin from bootup

after reboot from the following command I can see:
root@localhost:/sys/class/gpio# cat /sys/kernel/debug/gpio
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 hi
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

Is there a way to let gpio-289 and gpio-391 to set to lo on boot up time ?

Hi,

Those pins are occupied because some drivers register them and set it as high. But I am not sure which driver is gpio289…since that is a “?”.

Only those drivers are able to control the status of those gpio. Unless you remove those drivers.

Hi,

Is there a way to findout which driver uses uses gpio289 ?

I already modify the device tree and the dmesg already showing:
dmesg | grep “pcie-reg”
[0.982773] GPIO line 490 (pcie-reg-enable) hogged as output/high
[0.982815] GPIO line 289 (pcie-reg-disable) hogged as output/low

but cat /sys/kernel/debug/gpio still gets:
gpio-289 ( |? ) out hi

Hi,

I am not very sure what do you mean “I already modify the device tree and the dmesg already showing:”
Could you check the debug node before you modify the device tree? It should tell the correct name instead of “?”.

Hi,

I change:
gpio@2200000 {
pcie-reg-enable {
gpio-hog;
gpios = <TEGRA194_MAIN_GPIO(Z, 2) GPIO_ACTIVE_HIGH>;
/TEGRA194_MAIN_GPIO(A, 1) GPIO_ACTIVE_LOW>;/
label = “pcie-3v3-reg”;
/, “pcie-12v-reg”;/
output-high;
status = “okay”;
};

		pcie-reg-disable {
			gpio-hog;
			gpios = <TEGRA194_MAIN_GPIO(A, 1) GPIO_ACTIVE_LOW>;
			label = "pcie-12v-reg-disable";
			output-low;
			status = "okay";
		};
	};

and it is still the same

Hi,

Do you mean the result is always “?” before and after you modify the DT?

it is always “?” .

Let me check what is going on there.

Hi,

It seems the “?” does not harm. Which file did you modify the GPIO status?

its in platform/t19x/galen/kernel-dts/common/tegra194-p2888-0000-a00.dtsi

gpio@2200000 {
	pcie-reg-enable {
		gpio-hog;
		gpios = <TEGRA194_MAIN_GPIO(Z, 2) GPIO_ACTIVE_HIGH>;
			 /*TEGRA194_MAIN_GPIO(A, 1) GPIO_ACTIVE_LOW>;*/
		label = "pcie-3v3-reg"; 
                             /*, "pcie-12v-reg";*/
		output-high;
		status = "okay";
	};

	pcie-reg-disable {
		gpio-hog;
		gpios = <TEGRA194_MAIN_GPIO(A, 1) GPIO_ACTIVE_LOW>;
		label = "pcie-12v-reg-disable";
		output-low;
		status = "okay";
	};
};

Hi,

So it is still “hi” after your modification?

yes its still showing “hi” despite I saw this in desmg:
GPIO line 289 (pcie-reg-disable) hogged as output/low

Hi,

I think the cause of this issue is due to the next tegra_main_gpio TEGRA194_MAIN_GPIO(A, 1) in that file(tegra194-p2888-0000-a00.dtsi).

nvidia,plat-gpios =
<&tegra_main_gpio TEGRA194_MAIN_GPIO(Z, 2) GPIO_ACTIVE_HIGH /* 3V3 /
&tegra_main_gpio TEGRA194_MAIN_GPIO(A, 1) GPIO_ACTIVE_LOW /
12V /
/
&tegra_main_gpio TEGRA194_MAIN_GPIO(Y, 4) GPIO_ACTIVE_HIGH / / I2C */
;

Which is PCIe controller.

It means this pin is occupied by the PCIe controller.

oh thanks, so I just need to comment it out like:
nvidia,plat-gpios =
<&tegra_main_gpio TEGRA194_MAIN_GPIO(Z, 2) GPIO_ACTIVE_HIGH /* 3V3 /
/
&tegra_main_gpio TEGRA194_MAIN_GPIO(A, 1) GPIO_ACTIVE_LOW*/ /* 12V /
/
&tegra_main_gpio TEGRA194_MAIN_GPIO(Y, 4) GPIO_ACTIVE_HIGH / / I2C */
?

Hi,

after commenting it out, it is still showing high.
gpio-289 ( |pcie-reg-disable ) out hi

although my setting is low:
pcie-reg-disable {
gpio-hog;
gpios = <TEGRA194_MAIN_GPIO(A, 1) GPIO_ACTIVE_LOW>;
label = “pcie-12v-reg-disable”;
output-low;
status = “okay”;
};

Hi wenbin.leong,

There is one thing to check.

If you remove TEGRA194_MAIN_GPIO(A, 1) from both nvidia,plat-gpios and gpio@2200000, will you still see it in debug/gpio?

Hi

I change GPIO_ACTIVE_LOW to GPIO_ACTIVE_HIGH and now its showing “lo”

Hi

GPIO_ACTIVE_LOW may reverse the active status. In such case, 0 means high and 1 means low.

Thus when you set “output-low”, it would automatically set it to hi.

1 Like