Logo Search packages:      
Sourcecode: linux-fsl-imx51 version File versions  Download package

void gpio_i2c_active ( int  i2c_num  ) 

Activate an I2C device

Parameters:
i2c_num an I2C device
Setup GPIO for an I2C device to be active

Parameters:
i2c_num an I2C device

Definition at line 489 of file mx25_3stack_gpio.c.

References MUX_CONFIG_ALT1, MUX_CONFIG_ALT2, MUX_CONFIG_SION, mxc_iomux_set_input(), mxc_iomux_set_pad(), and mxc_request_iomux().

{
#define I2C_PAD_CTL (PAD_CTL_HYS_SCHMITZ | PAD_CTL_PKE_ENABLE | \
                 PAD_CTL_PUE_PUD | PAD_CTL_100K_PU | PAD_CTL_ODE_OpenDrain)

      switch (i2c_num) {
      case 0:
            /*I2C1*/
            mxc_request_iomux(MX25_PIN_I2C1_CLK, MUX_CONFIG_SION);
            mxc_request_iomux(MX25_PIN_I2C1_DAT, MUX_CONFIG_SION);
            mxc_iomux_set_pad(MX25_PIN_I2C1_CLK, I2C_PAD_CTL);
            mxc_iomux_set_pad(MX25_PIN_I2C1_DAT, I2C_PAD_CTL);
            break;
      case 1:
            /*I2C2*/
            mxc_request_iomux(MX25_PIN_GPIO_C, MUX_CONFIG_ALT2); /*SCL*/
            mxc_request_iomux(MX25_PIN_GPIO_D, MUX_CONFIG_ALT2); /*SDA*/
            mxc_iomux_set_pad(MX25_PIN_GPIO_C, I2C_PAD_CTL);
            mxc_iomux_set_pad(MX25_PIN_GPIO_D, I2C_PAD_CTL);
            mxc_iomux_set_input(MUX_IN_I2C2_IPP_SCL_IN, INPUT_CTL_PATH1);
            mxc_iomux_set_input(MUX_IN_I2C2_IPP_SDA_IN, INPUT_CTL_PATH1);

#if 0
            /* Or use FEC pins if it is not used */
            mxc_request_iomux(MX25_PIN_FEC_RDATA1, MUX_CONFIG_ALT1); /*SCL*/
            mxc_request_iomux(MX25_PIN_FEC_RX_DV, MUX_CONFIG_ALT1); /*SDA*/
            mxc_iomux_set_pad(MX25_PIN_FEC_RDATA1, I2C_PAD_CTL);
            mxc_iomux_set_pad(MX25_PIN_FEC_RX_DV, I2C_PAD_CTL);
            mxc_iomux_set_input(MUX_IN_I2C2_IPP_SCL_IN, INPUT_CTL_PATH0);
            mxc_iomux_set_input(MUX_IN_I2C2_IPP_SDA_IN, INPUT_CTL_PATH0);
#endif

            break;
      case 2:
            /*I2C3*/
            mxc_request_iomux(MX25_PIN_HSYNC, MUX_CONFIG_ALT2); /*SCL*/
            mxc_request_iomux(MX25_PIN_VSYNC, MUX_CONFIG_ALT2); /*SDA*/
            mxc_iomux_set_pad(MX25_PIN_HSYNC, I2C_PAD_CTL);
            mxc_iomux_set_pad(MX25_PIN_VSYNC, I2C_PAD_CTL);
            mxc_iomux_set_input(MUX_IN_I2C3_IPP_SCL_IN, INPUT_CTL_PATH0);
            mxc_iomux_set_input(MUX_IN_I2C3_IPP_SDA_IN, INPUT_CTL_PATH0);
            break;
      default:
            break;
      }
#undef I2C_PAD_CTL
}


Generated by  Doxygen 1.6.0   Back to index