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.

Configuring GPIO pins getting failed from u-boot

Other Parts Discussed in Thread: OMAPL138

Hi, 

I am having OMAPL138 custom board, for one of my applications, I want to make the GP2[9] functionality as output and need to make the value high. The GP 2[9 ]  pin drives the peripheral and the line is pulled up.  

Here are the code, i have used in the board file. Tried the below possibilities, but the output pins is not going high anymore, verified the behavior in scope.

#define DAVINCI_GPIO_BASE (0x01c67000)
#define GPIO_BANK2_REG_DIR_ADDR (DAVINCI_GPIO_BASE + 0x38)
#define GPIO_BANK2_REG_OPDATA_ADDR (DAVINCI_GPIO_BASE + 0x3c)
#define GPIO_BANK2_REG_SET_ADDR (DAVINCI_GPIO_BASE + 0x40)
#define GPIO_BANK2_REG_CLR_ADDR (DAVINCI_GPIO_BASE + 0x44)

davinci_syscfg_regs->pinmux[5] &= 0xF0FFFFFF;
davinci_syscfg_regs->pinmux[5] |= 0x08000000; // Enabling GP2_9 from the pinmux5_24

/* Making the direction output, followed by setting value high

Try 1:

REG(GPIO_BANK2_REG_DIR_ADDR) &= ~(0x01 << (0+9));
REG(GPIO_BANK2_REG_SET_ADDR) |= (0x01 << (0+9));

Try 2:

REG(GPIO_BANK2_REG_DIR_ADDR) &= ~(0x01 << (0+9));
REG(GPIO_BANK2_REG_CLR_ADDR) |= (0x01 << (0+9));
REG(GPIO_BANK2_REG_SET_ADDR) |= (0x01 << (0+9));

Try 3:

REG(GPIO_BANK2_REG_DIR_ADDR) &= ~(0x01 << (0+9));

udelay(10000);
REG(GPIO_BANK2_REG_SET_ADDR) |= (0x01 << (0+9));

udelay(100);

Thanks,

MUTHUKUMAR V

  • Hi Muthu,
    Have you tried GPIO cmds "gpio..." @u-boot prompt on your set-up?
    Best,
    -Hong

  • Hong,

    I am using u-boot-03.20.00.12 version, the gpio env parameter is not present currently. since this is quite an old version, the gpio handling functionality from the prompt might have been implemented after that?

    - MUTHUKUMAR V

  • Added information,

    After changing the mux config and register value in the u-boot code (mentioned in the description), I have tried to read the register value using the same interface REG(rag_addr), the new value got reflected but the physical status of the gpio is low always. The expectation of GPIO should go high.

    Here is th log:

    The MUX before 110110,
    The MUX after 8110110,
    DIR before EFFFFFFF,
    DIR after EFFFFDFF,
    SET before 10000000,
    SET after 10000200,

    The same configuration I am doing in the kernel using sysfs, but it is working well and good. I can see the GPIO status is changed to high when I start to run the kernel from the u-boot prompt in the scope.

    - MUTHUKUMAR V

  • Hi Muthu,
    Do we have any output after you type in "gpio" @u-boot prompt on your setup?
    Best,
    -Hong

  • Hong,

    Here is the response.

    => gpio
    NOT YET IMPLEMENTED
    Usage:
    [power [on | off]] | [out [1 - 4] [on | off | state]] | [in [1 - 4]]
    - Change/query the state or configuration of the external (user) GPIO

    =>

  • Hi Muthu,
    My understanding is the GPIO works in kernel, but not at u-boot on your set-up?
    Can we run some test to read/write MMR registers related to GPIO PINMUX, GPIO_OE, GPIO_DATAOUT...using the following primitives
    at u-boot(non-working case) and kernel(working case for correlation reference):
    - <md...> and <mw...) at u-boot prompt
    - <devmem2...> at kernel

    One reference is in this e2e post
    e2e.ti.com/.../3678289
    Best,
    -Hong