Commit 3f66148f3dc4ed3966e211e59bd864b955389706

Authored by Ye.Li
1 parent 0ae8c2c4f0

MLK-9705 imx: mx6sxsabreauto: add MAX7310 support to reset peripherals

The MAX7310 uses I2C3 bus. At system initialization, enable the driver to:
1. Reset CPU_PER_RST_B signal
2. Set the steering for ENET
3. Enable the LVDS display

Signed-off-by: Ye.Li <B37916@freescale.com>

Showing 2 changed files with 46 additions and 0 deletions Side-by-side Diff

board/freescale/mx6sxsabreauto/mx6sxsabreauto.c
... ... @@ -34,6 +34,10 @@
34 34 #include <mxsfb.h>
35 35 #endif
36 36  
  37 +#ifdef CONFIG_MAX7310_IOEXP
  38 +#include <gpio_exp.h>
  39 +#endif
  40 +
37 41 #ifdef CONFIG_FASTBOOT
38 42 #include <fastboot.h>
39 43 #ifdef CONFIG_ANDROID_RECOVERY
... ... @@ -200,6 +204,26 @@
200 204 }
201 205 #endif
202 206  
  207 +#ifdef CONFIG_MAX7310_IOEXP
  208 +
  209 +#define CPU_PER_RST_B IOEXP_GPIO_NR(1, 4)
  210 +#define LVDS_EN_PIN IOEXP_GPIO_NR(1, 7)
  211 +#define STEER_ENET IOEXP_GPIO_NR(2, 2)
  212 +
  213 +int setup_max7310(void)
  214 +{
  215 + /* Must call this function after i2c has setup */
  216 +#ifdef CONFIG_SYS_I2C_MXC
  217 + gpio_exp_setup_port(1, 2, 0x30);
  218 + gpio_exp_setup_port(2, 2, 0x32);
  219 +
  220 + return 0;
  221 +#else
  222 + return -EPERM;
  223 +#endif
  224 +}
  225 +#endif
  226 +
203 227 static void setup_iomux_uart(void)
204 228 {
205 229 imx_iomux_v3_setup_multiple_pads(uart1_pads, ARRAY_SIZE(uart1_pads));
... ... @@ -466,6 +490,11 @@
466 490 imx_iomux_v3_setup_multiple_pads(lvds_ctrl_pads,
467 491 ARRAY_SIZE(lvds_ctrl_pads));
468 492  
  493 +#ifdef CONFIG_MAX7310_IOEXP
  494 + /* LVDS Enable pin */
  495 + gpio_exp_direction_output(LVDS_EN_PIN , 1);
  496 +#endif
  497 +
469 498 /* Set Brightness to high */
470 499 gpio_direction_output(IMX_GPIO_NR(6, 3) , 1);
471 500 }
... ... @@ -803,6 +832,18 @@
803 832 #ifdef CONFIG_SYS_I2C_MXC
804 833 setup_i2c(1, CONFIG_SYS_I2C_SPEED, 0x7f, &i2c_pad_info2);
805 834 setup_i2c(2, CONFIG_SYS_I2C_SPEED, 0x7f, &i2c_pad_info3);
  835 +#endif
  836 +
  837 +#ifdef CONFIG_MAX7310_IOEXP
  838 + setup_max7310();
  839 +
  840 + /* Reset CPU_PER_RST_B signal for enet phy and PCIE */
  841 + gpio_exp_direction_output(CPU_PER_RST_B, 0);
  842 + udelay(500);
  843 + gpio_exp_direction_output(CPU_PER_RST_B, 1);
  844 +
  845 + /* Set steering signal to L for selecting B0 */
  846 + gpio_exp_direction_output(STEER_ENET, 0);
806 847 #endif
807 848  
808 849 #ifdef CONFIG_FEC_MXC
include/configs/mx6sxsabreauto.h
... ... @@ -108,6 +108,11 @@
108 108 #define CONFIG_PMIC_I2C_SLAVE 0x8
109 109 #endif
110 110  
  111 +/* MAX7310 configs*/
  112 +#define CONFIG_MAX7310_IOEXP
  113 +#define CONFIG_IOEXP_DEVICES_NUM 2
  114 +#define CONFIG_IOEXP_DEV_PINS_NUM 8
  115 +
111 116 /* VIDEO */
112 117 #define CONFIG_VIDEO
113 118