diff --git a/board/freescale/mx6sxsabreauto/mx6sxsabreauto.c b/board/freescale/mx6sxsabreauto/mx6sxsabreauto.c index dc3295a..9a24c99 100644 --- a/board/freescale/mx6sxsabreauto/mx6sxsabreauto.c +++ b/board/freescale/mx6sxsabreauto/mx6sxsabreauto.c @@ -34,6 +34,10 @@ #include #endif +#ifdef CONFIG_MAX7310_IOEXP +#include +#endif + #ifdef CONFIG_FASTBOOT #include #ifdef CONFIG_ANDROID_RECOVERY @@ -200,6 +204,26 @@ static void setup_iomux_fec(int fec_id) } #endif +#ifdef CONFIG_MAX7310_IOEXP + +#define CPU_PER_RST_B IOEXP_GPIO_NR(1, 4) +#define LVDS_EN_PIN IOEXP_GPIO_NR(1, 7) +#define STEER_ENET IOEXP_GPIO_NR(2, 2) + +int setup_max7310(void) +{ + /* Must call this function after i2c has setup */ +#ifdef CONFIG_SYS_I2C_MXC + gpio_exp_setup_port(1, 2, 0x30); + gpio_exp_setup_port(2, 2, 0x32); + + return 0; +#else + return -EPERM; +#endif +} +#endif + static void setup_iomux_uart(void) { imx_iomux_v3_setup_multiple_pads(uart1_pads, ARRAY_SIZE(uart1_pads)); @@ -466,6 +490,11 @@ void do_enable_lvds(struct lcd_panel_info_t const *dev) imx_iomux_v3_setup_multiple_pads(lvds_ctrl_pads, ARRAY_SIZE(lvds_ctrl_pads)); +#ifdef CONFIG_MAX7310_IOEXP + /* LVDS Enable pin */ + gpio_exp_direction_output(LVDS_EN_PIN , 1); +#endif + /* Set Brightness to high */ gpio_direction_output(IMX_GPIO_NR(6, 3) , 1); } @@ -805,6 +834,18 @@ int board_init(void) setup_i2c(2, CONFIG_SYS_I2C_SPEED, 0x7f, &i2c_pad_info3); #endif +#ifdef CONFIG_MAX7310_IOEXP + setup_max7310(); + + /* Reset CPU_PER_RST_B signal for enet phy and PCIE */ + gpio_exp_direction_output(CPU_PER_RST_B, 0); + udelay(500); + gpio_exp_direction_output(CPU_PER_RST_B, 1); + + /* Set steering signal to L for selecting B0 */ + gpio_exp_direction_output(STEER_ENET, 0); +#endif + #ifdef CONFIG_FEC_MXC setup_fec(CONFIG_FEC_ENET_DEV); #endif diff --git a/include/configs/mx6sxsabreauto.h b/include/configs/mx6sxsabreauto.h index 40043f8..8caf676 100644 --- a/include/configs/mx6sxsabreauto.h +++ b/include/configs/mx6sxsabreauto.h @@ -108,6 +108,11 @@ #define CONFIG_PMIC_I2C_SLAVE 0x8 #endif +/* MAX7310 configs*/ +#define CONFIG_MAX7310_IOEXP +#define CONFIG_IOEXP_DEVICES_NUM 2 +#define CONFIG_IOEXP_DEV_PINS_NUM 8 + /* VIDEO */ #define CONFIG_VIDEO