Commit cefe06bf84c3093c875f19490841ff12e0939bda

Authored by Christian Gmeiner
Committed by Stefano Babic
1 parent 09cfa8ee6a

ot1200: setup i2c bus in board_early_init_f(..)

Make it possible to use the i2c bus in SPL.

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>

Showing 1 changed file with 22 additions and 18 deletions Side-by-side Diff

board/bachmann/ot1200/ot1200.c
... ... @@ -120,6 +120,27 @@
120 120 ARRAY_SIZE(feature_pads));
121 121 }
122 122  
  123 +#define PC MUX_PAD_CTRL(I2C_PAD_CTRL)
  124 +
  125 +/* I2C3 - IO expander */
  126 +static struct i2c_pads_info i2c_pad_info2 = {
  127 + .scl = {
  128 + .i2c_mode = MX6_PAD_EIM_D17__I2C3_SCL | PC,
  129 + .gpio_mode = MX6_PAD_EIM_D17__GPIO3_IO17 | PC,
  130 + .gp = IMX_GPIO_NR(3, 17)
  131 + },
  132 + .sda = {
  133 + .i2c_mode = MX6_PAD_EIM_D18__I2C3_SDA | PC,
  134 + .gpio_mode = MX6_PAD_EIM_D18__GPIO3_IO18 | PC,
  135 + .gp = IMX_GPIO_NR(3, 18)
  136 + }
  137 +};
  138 +
  139 +static void setup_iomux_i2c(void)
  140 +{
  141 + setup_i2c(2, CONFIG_SYS_I2C_SPEED, 0x7f, &i2c_pad_info2);
  142 +}
  143 +
123 144 static void ccgr_init(void)
124 145 {
125 146 struct mxc_ccm_reg *ccm = (struct mxc_ccm_reg *)CCM_BASE_ADDR;
... ... @@ -151,6 +172,7 @@
151 172  
152 173 setup_iomux_uart();
153 174 setup_iomux_spi();
  175 + setup_iomux_i2c();
154 176 setup_iomux_features();
155 177  
156 178 return 0;
... ... @@ -236,22 +258,6 @@
236 258 return 0;
237 259 }
238 260  
239   -#define PC MUX_PAD_CTRL(I2C_PAD_CTRL)
240   -
241   -/* I2C3 - IO expander */
242   -static struct i2c_pads_info i2c_pad_info2 = {
243   - .scl = {
244   - .i2c_mode = MX6_PAD_EIM_D17__I2C3_SCL | PC,
245   - .gpio_mode = MX6_PAD_EIM_D17__GPIO3_IO17 | PC,
246   - .gp = IMX_GPIO_NR(3, 17)
247   - },
248   - .sda = {
249   - .i2c_mode = MX6_PAD_EIM_D18__I2C3_SDA | PC,
250   - .gpio_mode = MX6_PAD_EIM_D18__GPIO3_IO18 | PC,
251   - .gp = IMX_GPIO_NR(3, 18)
252   - }
253   -};
254   -
255 261 static iomux_v3_cfg_t const pwm_pad[] = {
256 262 MX6_PAD_SD1_CMD__PWM4_OUT | MUX_PAD_CTRL(OUTPUT_40OHM),
257 263 };
... ... @@ -314,8 +320,6 @@
314 320 gd->bd->bi_boot_params = PHYS_SDRAM + 0x100;
315 321  
316 322 backlight_lcd_off();
317   -
318   - setup_i2c(2, CONFIG_SYS_I2C_SPEED, 0x7f, &i2c_pad_info2);
319 323  
320 324 leds_on();
321 325