Change GPIO State in uboot

      Change GPIO State in uboot

      Dear FS-Support,

      ​in order to have 0V on the pin 58 (spi_b_cs2, efusA9q) by System start, i want to configure this pin in U-Boot.
      ​So, i want try to modify ​fsimx6.c (/fsimx6-V3.0/build/u-boot-2014.07-fsimx6-V3.0/board/F+S/fsimx6) as follow:

      in the function int board_init(void)
      {

      ...

      gpio_direction_output(IMX_GPIO_NR(3,25), 0);

      SETUP_IOMUX_PADS(testpad);
      }

      ​...

      static iomux_v3_cfg_t const testpad [] = {
      IOMUX_PADS(PAD_SPI_B_CS2__GPIO3_IO25 | MUX_PAD_CTRL(NO_PAD_CTRL)),
      };

      ​Is this correct way?

      ​Thanks!
      Basically correct, only the sequence is back to front. First you have to declare the testpad variable, then you have to call SETUP_IOMUX_PADS() and then you can set the gpio_direction_output().

      The NO_PAD_CTRL is usually sufficient, unless you really want to set some other defaults for the signal speed, pull-up/down, hysteresis, etc. If you use NO_PAD_CTRL, then the pad settings remain as they were set before, which is mostly the reset value. A few pads may differ from the reset value, because either the CPU-Boot-ROM code or NBoot already initialized them.

      Your F&S Support Team
      F&S Elektronik Systeme GmbH
      As this is an international forum, please try to post in English.
      Da dies ein internationales Forum ist, bitten wir darum, Beiträge möglichst in Englisch zu verfassen.
      Thank you very much! It's works.

      I have one more question. By power up the board, the voltage on the pin 58 goes high and after 640 ms goes low as i want. Is it possible to reduce this 640ms by the Software? Or is the modification of the uboot the earliest way for pin config?
      Well, the default function of this pin is a chip select for an SPI port. These chip selects are active low. So the regular way to prevent that an SPI device is selected by accident during boot phase is to keep such pins high. The reset value configures this pin as GPIO with a 100k internal pull-up. So the pin is held high at boot time.

      If you do not want this, then you should add an external pull-down (e.g. 10k) to pull the line low until you can handle it by software. And yes, U-Boot is the first option to handle the pin by software.

      Your F&S Support Team
      F&S Elektronik Systeme GmbH
      As this is an international forum, please try to post in English.
      Da dies ein internationales Forum ist, bitten wir darum, Beiträge möglichst in Englisch zu verfassen.