P9_11 set output low on power up

Hi,
I would like to set low the logic level on the P9_11 during the power on, so before the linux kernel has bees loaded.
I do not have experince with tree device and boot loader so I am here to ask your help.

For what I was able to discover and collecting fragmentated informations, I have to modify the file “/boot/dtbs/4.14.71-bone-rt-r17/am335x-boneblack-uboot.dtb”.

This file should be responsable for give the earlier informations during the power on start up of the system.
I have decompiled this file and added:

pinmux_P9_11_gpio_pd_pin {
pinctrl-single,pins = <0x70 0x27>;
phandle = <0x180>;
};
P9_11_pinmux {
compatible = “bone-pinmux-helper”;
status = “okay”;
pinctrl-names = “default”, “gpio”, “gpio_pu”, “gpio_pd”, “gpio_input”, “uart”;
pinctrl-0 = <0x17d>;
pinctrl-1 = <0x17e>;
pinctrl-2 = <0x17f>;
pinctrl-3 = <0x180>;
pinctrl-4 = <0x181>;
pinctrl-5 = <0x182>;
};
P9_11 {
gpio-name = “P9_11”;
gpio = <0x35 0x1e 0x0>;
output;
dir-changeable;
};

So, I guess, the system in power up will be able to set up and drive this PIN.

Due to the lack of specific knowledge in this area now I am stuck, I don’t know how to precede.

Please help.

Use gpio-hog:

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/arm/boot/dts/am335x-bonegreen-wireless.dts?h=v5.6-rc3#n121

Regards,

Hi Robert, thank you for the fast reply.

I hade :

P9_11 {
gpio-name = “P9_11”;
gpio = <0x35 0x1e 0x0>;
output;
dir-changeable;
}

Following your directions I modify the initial code as follow:

P9_11 {
gpio-hog;
gpios = <11 GPIO_ACTIVE_HIGH>;
output-low;
gpio-name = “P9_11”;
gpio = <0x35 0x1e 0x0>;
dir-changeable;

};

Is now correct?

No, you can't combine those two..

If all you need is to set the logic level on startup, use gpio-hog..

Regards,

Hi Robert,

I apologize for having misunderstood your directions.

I found the controller declaration and attached as a child the gpio hog as follow:

gpio@44e07000 {
compatible = “ti,omap4-gpio”;
ti,hwmods = “gpio1”;
gpio-controller;
#gpio-cells = <0x2>;
interrupt-controller;
#interrupt-cells = <0x2>;
reg = <0x44e07000 0x1000>;
interrupts = <0x60>;
gpio-line-names = “MDIO_DATA”, “MDIO_CLK”, “SPI0_SCLK”, “SPI0_D0”, “SPI0_D1”, “SPI0_CS0”, “SPI0_CS1”, “ECAP0_IN_PWM0_OUT”, “LCD_DATA12”, “LCD_DATA13”, “LCD_DATA14”, “LCD_DATA15”, “UART1_CTSN”, “UART1_RTSN”, “UART1_RXD”, “UART1_TXD”, “GMII1_TXD3”, “GMII1_TXD2”, “USB0_DRVVBUS”, “XDMA_EVENT_INTR0”, “XDMA_EVENT_INTR1”, “GMII1_TXD1”, “GPMC_AD8”, “GPMC_AD9”, “NC”, “NC”, “GPMC_AD10”, “GPMC_AD11”, “GMII1_TXD0”, “RMII1_REFCLK”, “GPMC_WAIT0”, “GPMC_WPN”;
linux,phandle = <0x32>;
phandle = <0x32>;
};

P9_11 {
gpio-hog;
gpios = <11 GPIO_ACTIVE_LOW>;
output-low;
};

I am not sure about the value of ‘gpios’.
I read that: “gpios: Store the GPIO information (id, flags, …). Shall contain the number of cells specified in its parent node (GPIO controller node)”.
In this case the parent node contains: “#gpio-cells = <0x2>;”, but I have no idea what to write in.

https://github.com/derekmolloy/boneDeviceTree/blob/master/docs/BeagleboneBlackP8HeaderTable.pdf
https://github.com/derekmolloy/boneDeviceTree/blob/master/docs/BeagleboneBlackP9HeaderTable.pdf

P9.11 = gpio0[30]

If you edit a base device tree you'd do:

&gpio0 {
        some_unique_name {
                gpio-hog;
                gpios = <30 GPIO_ACTIVE_HIGH>;
                output-low;
                line-name = "SOME_OTHER_UNIQUE_NAME";
        };
};

if your doing an overlay you'd do:

        fragment@15 {
                target = <&gpio0>;
                __overlay__ {
                        some_unique_name {
                                gpio-hog;
                                gpios = <30 GPIO_ACTIVE_HIGH>;
                                output-low;
                                line-name = "SOME_OTHER_UNIQUE_NAME";
                        };
                };
        };

Regards,

I put right at the end of the DTS file:

&gpio0 {
adc_reset_pin {
gpio-hog;
gpios = <30 GPIO_ACTIVE_HIGH>;
output-low;
line-name = “ADC_RESET_PIN_POWER_ON”;
};
};

Than if this time is correct I will compile in DTB a test, right?

Correct, just stick it at the bottom..

Regards,

Hello Mr. Robert,

I am still having troubles but before ask you for help, I’d like to thank you for your time I really appreciate that.

I tried to compile the .dts file and this is what I got:

COMMAND
root@beaglebone:/boot/dtbs/4.14.71-bone-rt-r17# dtc -I dts -O dtb -o am335x-boneblack-uboot.dtb am335x-boneblack-uboot.dts

RESPONSE
Error: am335x-boneblack-uboot.dts:2703.20-21 syntax error
FATAL ERROR: Unable to parse input tree

LINE 2703 content:
gpios = <30 GPIO_ACTIVE_HIGH>;

That same file is available under:

/opt/source/dtb-4.14-ti/

Then you just issue :

make
sudo make install
sudo reboot

Regards,

Hello,

I add into the file am335x-boneblack-uboot.dts located at /opt/source/dtb-4.14-ti/src/arm, right at the very end as follow:
I

&gpio0 {
adc_reset_pin {
gpio-hog;
gpios = <30 GPIO_ACTIVE_HIGH>;
output-low;
line-name = “ADC_RESET_PIN_POWER_ON”;
};
};

then I followed the commands sequence:
make
sudo make install
sudo reboot

After reboot I checked if the file am335x-boneblack-uboot.dtb located at /boot/dtbs/4.14.71-bone-rt-17 hat the gpio-hog inside.

And Yes it is there under the controller:

gpio@44e07000 {
compatible = “ti,omap4-gpio”;
ti,hwmods = “gpio1”;
gpio-controller;
#gpio-cells = <0x2>;
interrupt-controller;
#interrupt-cells = <0x2>;
reg = <0x44e07000 0x1000>;
interrupts = <0x60>;
gpio-line-names = “MDIO_DATA”, “MDIO_CLK”, “SPI0_SCLK”, “SPI0_D0”, “SPI0_D1”, “SPI0_CS0”, “SPI0_CS1”, “ECAP0_IN_PWM0_OUT”, “LCD_DATA12”, “LCD_DATA13”, “LCD_DATA14”, “LCD_DATA15”, “UART1_CTSN”, “UART1_RTSN”, “UART1_RXD”, “UART1_TXD”, “GMII1_TXD3”, “GMII1_TXD2”, “USB0_DRVVBUS”, “XDMA_EVENT_INTR0”, “XDMA_EVENT_INTR1”, “GMII1_TXD1”, “GPMC_AD8”, “GPMC_AD9”, “NC”, “NC”, “GPMC_AD10”, “GPMC_AD11”, “GMII1_TXD0”, “RMII1_REFCLK”, “GPMC_WAIT0”, “GPMC_WPN”;
linux,phandle = <0x35>;
phandle = <0x35>;

adc_reset_pin {
gpio-hog;
gpios = <0x1e 0x0>;
output-low;
line-name = “ADC_RESET_PIN_POWER_ON”;
};
};
On Monday I will test the it.
Thank you so much for your help and for supporting my request till here.
Have a nice WE.

Hello,

this morning I tried to see if the pin9_11 on power-up remain to logic level 0 but it continues to go up immediately after power up and it never changes its state.

Today I tried with an overlay and it works, but with about 12 seconds of delay.
That is not the expected result, but finally somethings moves.
Any suggestion or advise would be great.

If you need a pin set one way or another on boot buffer it
use a tristate gate pull it high or low then after your overlay is loaded
enable the buffer so you have control

Good morning,

thank you for contribute.

Could you please enrich your advice with details, due to the lack of knowledge on this area I do not understand what and how I could follow your directions.