How to set a GPIO as output in u-boot without glich?


I have modified u-boot to change the MUX for specific pins (44 and 91), there are set as GPIO output open drain from board_early_init_f.
Then in board_late_init, I also set these GPIO using gpio-request and gpio_direction_output(xx, 1).

My issue is that between MUX setting and gpio_direction_output, the PDOR bit for these gpio is set to 0 (default boot value), so the pad is driven to 0 for a short time.

What is the proper way to fix that glich?

  • Should I change mux after I have used gpio_direction_output?
  • Should I change PDOR in board_early_init_f?
  • Is there another cleaner way to set PDOR bit as the same time the IOMUX register is set?

Thanks in advance for your help

hi guillaume

what is duration of the glitch? What is connected at the output of these pins?


The glitch is around 100ms. On the GPIO there is a 10K pull-up to 3V3.
If I let the GPIO in high impedance, there is no glitch.
I will try to set the PDOR value before changing the IOMUX register but I’m not sure what I have to use to do it. Is clr/setbits_le32 the right functions to use, or should I use raw_read or direct memory access in C?



Sorry I just get it. The pull-up is missing … due to a disconnected board.
So everything work as expected.


Perfect, that it works. Thanks for the update.