AnsweredAssumed Answered

Where is the correct correct Place in the U-boot directory to configurate a GPIO?

Question asked by Breixo Lopez Garcia on Aug 30, 2013
Latest reply on Sep 2, 2013 by Breixo Lopez Garcia

Hi Community,

 

I´m a newbei in the U-boot development, nowadays I try to create a U-boot for a custom board based in iMX6Q from freescale. I have been understanding the IOMUX files and program and also the GPIO register in that board, because I would like to set a led during the U-boot connected in the GPIO5_15 in the board like it is in the SabreAI Card as default.

I have configured the Iomux to select the GPIO function in the ball T20 of the iMX6Q with the following description in the PAD_DISP0_DAT21:

 

  writel((SION_DISABLED & 0x1) << 4 | (ALT5 & 0x7), IOMUXC_SW_MUX_CTL_PAD_DISP0_DAT21);

  writel((HYS_ENABLED & 0x1) << 16 | (PUS_100KOHM_PU & 0x3) << 14 | (PUE_PULL & 0x1) << 13 |

           (PKE_ENABLED & 0x1) << 12 | (ODE_DISABLED & 0x1) << 11 | (SPD_100MHZ & 0x3) << 6 |

           (DSE_40OHM & 0x7) << 3 | (SRE_SLOW & 0x1), IOMUXC_SW_PAD_CTL_PAD_DISP0_DAT21);

 

I have seen that when the pins works like a GPIO, they have a extra registers that they are independent of the IOMUX configuration (Reference: Chapter 28 in the iMX6Q Data sheet). If I am not wrong, to work like a output the GPIO5_15 and the led will be on. I need to set the following registers:

  • GPIO5_DR 1 in bit 15 to indicate High level in the output
  • GPIO5_GDIR 1 in bit 15 to indicate output work

My question If it is possible to make in the U-boot and whether it is, which is the correct file to do that. I tried to change the c file from the board in  <u-boot directory>/<board>/<directory of my custom board>/<name_of_the_board>.c.

in the function board_init. The changes in that function are the following:

 

        writel((1 & 0xffffffff ) << 15, GPIO5_BASE_ADDR + GPIO_GDIR);

       writel((1 & 0xffffffff ) << 15, GPIO5_BASE_ADDR + GPIO_DR);

 

Although that could be work, I am still thinking that it is a complety wrong system to develop a correct U-boot for my custom board.

 

Any help will be gratefully,

 

-Regards

Outcomes