This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AM625: How to set a specific GPIO to High in uboot

Part Number: AM625


I would like to set a specific GPIO to High/Low as follows

  • GPIO0_10:High
  • GPIO1_12:Low

To accomplish this, we have added the following code.

// k3-am625-sk.dts
&main_pmx{
    mygpios: mygpio{
        pinctrl-single,pins = <
			AM62X_IOPAD(0x0028, PIN_INPUT, 7) /* (J22) OSPI0_D7.GPIO0_10 */
			AM62X_IOPAD(0x01a8, PIN_INPUT, 7) /* (D20) MCASP0_AFSX.GPIO1_12 */
        >;
    };
};
&main_gpio0{
    status = "okay";
    pinctrl-names = "default";
    pinctrl-0 = <&mygpios>;
};

// evm.c
int board_late_init(void){
    int gpio_num = 409;
    if(gpio_request(gpio_num, "GPIO") < 0){
        printf("GPIO failed\n");
    }else{
        gpio_direction_output(gpio_num, 1);
        gpio_set_value(gpio_num, 1);
    }
    ...
}

I expect GPIO to be set high during u-boot initialization, but it fails with a GPIO failed message at startup.

Is there an error in procedure? Also, if there is a better way to do this, please let me know.

The original source code was taken from

git.ti.com/.../ti-u-boot.git


Thank you in advance.