diff options
author | Seema Khowala <seemaj@nvidia.com> | 2012-08-22 11:14:29 -0700 |
---|---|---|
committer | Simone Willett <swillett@nvidia.com> | 2012-08-27 17:17:21 -0700 |
commit | b536b496165f0de2e854e6297f54371e27233dd2 (patch) | |
tree | dc7bb9961dedad323185ead38ab07de1b7e1c4be | |
parent | 59983fe4193541acfd8c7df7bf98139e2ec44d11 (diff) |
ARM: tegra: TAI: Add E1239 support
Bug 1002637
Change-Id: I1271f95e8c174422bcb93eed3cc2bd7df8012479
Signed-off-by: Seema Khowala <seemaj@nvidia.com>
Reviewed-on: http://git-master/r/123537
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Scott Peterson <speterson@nvidia.com>
-rw-r--r-- | arch/arm/mach-tegra/board-enterprise-panel.c | 112 | ||||
-rw-r--r-- | arch/arm/mach-tegra/board-enterprise-pinmux.c | 406 | ||||
-rw-r--r-- | arch/arm/mach-tegra/board-enterprise-power.c | 35 | ||||
-rw-r--r-- | arch/arm/mach-tegra/board-enterprise-sensors.c | 164 | ||||
-rw-r--r-- | arch/arm/mach-tegra/board-enterprise.c | 46 | ||||
-rw-r--r-- | arch/arm/mach-tegra/board-enterprise.h | 3 |
6 files changed, 676 insertions, 90 deletions
diff --git a/arch/arm/mach-tegra/board-enterprise-panel.c b/arch/arm/mach-tegra/board-enterprise-panel.c index 366bf921393d..c27201171e4b 100644 --- a/arch/arm/mach-tegra/board-enterprise-panel.c +++ b/arch/arm/mach-tegra/board-enterprise-panel.c @@ -63,6 +63,8 @@ #define enterprise_lcd_te TEGRA_GPIO_PJ1 +#define enterprise_bl_pwm TEGRA_GPIO_PH3 + #ifdef CONFIG_TEGRA_DC static struct regulator *enterprise_dsi_reg; static bool dsi_regulator_status; @@ -167,6 +169,16 @@ static int enterprise_backlight_notify(struct device *unused, int brightness) static int enterprise_disp1_check_fb(struct device *dev, struct fb_info *info); +static struct platform_pwm_backlight_data external_pwm_disp1_backlight_data = { + .pwm_id = 3, + .max_brightness = 255, + .dft_brightness = 224, + .pwm_period_ns = 1000000, + .notify = enterprise_backlight_notify, + /* Only toggle backlight on fb blank notifications for disp1 */ + .check_fb = enterprise_disp1_check_fb, +}; + #if IS_EXTERNAL_PWM static struct platform_pwm_backlight_data enterprise_disp1_backlight_data = { .pwm_id = 3, @@ -212,10 +224,21 @@ static struct platform_device enterprise_disp1_backlight_device = { }, }; +static struct platform_device external_pwm_disp1_backlight_device = { + .name = "pwm-backlight", + .id = -1, + .dev = { + .platform_data = &external_pwm_disp1_backlight_data, + }, +}; #ifdef CONFIG_TEGRA_DC static int enterprise_hdmi_vddio_enable(void) { int ret; + struct board_info board_info; + + tegra_get_board_info(&board_info); + if (!enterprise_hdmi_vddio) { enterprise_hdmi_vddio = regulator_get(NULL, "hdmi_5v0"); if (IS_ERR_OR_NULL(enterprise_hdmi_vddio)) { @@ -232,16 +255,40 @@ static int enterprise_hdmi_vddio_enable(void) enterprise_hdmi_vddio = NULL; return ret; } + if (board_info.board_id == BOARD_E1239) { + ret = gpio_request(TEGRA_GPIO_PM4, "en_hdmi_buffers"); + if (ret < 0) { + pr_err("%s: gpio_request failed %d\n", __func__, ret); + return ret; + } + + ret = gpio_direction_output(TEGRA_GPIO_PM4, 1); + if (ret < 0) { + pr_err("%s: gpio_direction_ouput failed %d\n", + __func__, ret); + gpio_free(TEGRA_GPIO_PM4); + return ret; + } + } + return ret; } static int enterprise_hdmi_vddio_disable(void) { + struct board_info board_info; + + tegra_get_board_info(&board_info); + if (enterprise_hdmi_vddio) { regulator_disable(enterprise_hdmi_vddio); regulator_put(enterprise_hdmi_vddio); enterprise_hdmi_vddio = NULL; } + if (board_info.board_id == BOARD_E1239) { + gpio_set_value(TEGRA_GPIO_PM4, 0); + gpio_free(TEGRA_GPIO_PM4); + } return 0; } @@ -528,8 +575,10 @@ static int enterprise_dsi_panel_enable(void) if (ret) return ret; + #if DSI_PANEL_RESET - if (board_info.fab >= BOARD_FAB_A03) { + if ((board_info.fab >= BOARD_FAB_A03) || + (board_info.board_id == BOARD_E1239)) { if (enterprise_lcd_reg == NULL) { enterprise_lcd_reg = regulator_get(NULL, "lcd_vddio_en"); if (IS_ERR_OR_NULL(enterprise_lcd_reg)) { @@ -812,6 +861,13 @@ static struct platform_device *enterprise_gfx_devices[] __initdata = { #endif }; +static struct platform_device *external_pwm_gfx_devices[] __initdata = { +#if defined(CONFIG_TEGRA_NVMAP) + &enterprise_nvmap_device, +#endif + &tegra_pwfm3_device, +}; + static struct platform_device *enterprise_bl_devices[] = { &enterprise_disp1_backlight_device, }; @@ -859,14 +915,22 @@ int __init enterprise_panel_init(void) BUILD_BUG_ON(ARRAY_SIZE(enterprise_bl_output_measured_a03) != 256); BUILD_BUG_ON(ARRAY_SIZE(enterprise_bl_output_measured_a02) != 256); - if (board_info.fab >= BOARD_FAB_A03) { + if (board_info.board_id != BOARD_E1239) { + if (board_info.fab >= BOARD_FAB_A03) { #if !(IS_EXTERNAL_PWM) - enterprise_disp1_backlight_data.clk_div = 0x1D; + enterprise_disp1_backlight_data.clk_div = 0x1D; #endif - bl_output = enterprise_bl_output_measured_a03; - } else - bl_output = enterprise_bl_output_measured_a02; - + bl_output = enterprise_bl_output_measured_a03; + } else + bl_output = enterprise_bl_output_measured_a02; + } else { + enterprise_sd_settings.bl_device = + &external_pwm_disp1_backlight_device; + enterprise_bl_devices[0] = + &external_pwm_disp1_backlight_device; + bl_output = + enterprise_bl_output_measured_a03; + } enterprise_dsi.chip_id = tegra_get_chipid(); enterprise_dsi.chip_rev = tegra_get_revision(); @@ -878,13 +942,25 @@ int __init enterprise_panel_init(void) gpio_request(enterprise_hdmi_hpd, "hdmi_hpd"); gpio_direction_input(enterprise_hdmi_hpd); - gpio_request(enterprise_lcd_2d_3d, "lcd_2d_3d"); - gpio_direction_output(enterprise_lcd_2d_3d, 0); - enterprise_stereo_set_mode(enterprise_stereo.mode_2d_3d); + if (board_info.board_id != BOARD_E1239) { + gpio_request(enterprise_lcd_2d_3d, "lcd_2d_3d"); + gpio_direction_output(enterprise_lcd_2d_3d, 0); + enterprise_stereo_set_mode(enterprise_stereo.mode_2d_3d); - gpio_request(enterprise_lcd_swp_pl, "lcd_swp_pl"); - gpio_direction_output(enterprise_lcd_swp_pl, 0); - enterprise_stereo_set_orientation(enterprise_stereo.orientation); + gpio_request(enterprise_lcd_swp_pl, "lcd_swp_pl"); + gpio_direction_output(enterprise_lcd_swp_pl, 0); + enterprise_stereo_set_orientation( + enterprise_stereo.orientation); +#if IS_EXTERNAL_PWM + gpio_request(enterprise_bl_pwm, "bl_pwm"); + gpio_free(enterprise_bl_pwm); +#endif + } else { + /* External pwm is used but do not use IS_EXTERNAL_PWM + compiler switch for TAI */ + gpio_request(enterprise_bl_pwm, "bl_pwm"); + gpio_free(enterprise_bl_pwm); + } #if !(DC_CTRL_MODE & TEGRA_DC_OUT_ONE_SHOT_MODE) gpio_request(enterprise_lcd_swp_pl, "lcd_te"); @@ -904,9 +980,13 @@ int __init enterprise_panel_init(void) return err; #endif - err = platform_add_devices(enterprise_gfx_devices, - ARRAY_SIZE(enterprise_gfx_devices)); - + if (board_info.board_id != BOARD_E1239) { + err = platform_add_devices(enterprise_gfx_devices, + ARRAY_SIZE(enterprise_gfx_devices)); + } else { + err = platform_add_devices(external_pwm_gfx_devices, + ARRAY_SIZE(external_pwm_gfx_devices)); + } #if defined(CONFIG_TEGRA_GRHOST) && defined(CONFIG_TEGRA_DC) res = nvhost_get_resource_byname(&enterprise_disp1_device, IORESOURCE_MEM, "fbmem"); diff --git a/arch/arm/mach-tegra/board-enterprise-pinmux.c b/arch/arm/mach-tegra/board-enterprise-pinmux.c index 1a19dbf95f4a..71cdd143c88c 100644 --- a/arch/arm/mach-tegra/board-enterprise-pinmux.c +++ b/arch/arm/mach-tegra/board-enterprise-pinmux.c @@ -501,7 +501,9 @@ static __initdata struct tegra_pingroup_config enterprise_pinmux_a02[] = { static struct tegra_gpio_table gpio_table[] = { { .gpio = TEGRA_GPIO_HP_DET, .enable = true }, }; - +static struct tegra_gpio_table tai_gpio_table[] = { + { .gpio = TEGRA_GPIO_CODEC_RST, .enable = true }, +}; struct pin_info_low_power_mode { char name[16]; int gpio_nr; @@ -594,6 +596,354 @@ static __initdata struct pin_info_low_power_mode enterprise_gpio_pins_a03[] = { PIN_GPIO_LPM("SPI1_MISO", TEGRA_GPIO_PX7, 0, 0), PIN_GPIO_LPM("SPI1_SCK", TEGRA_GPIO_PX5, 0, 0), }; +/*******************************TAI pinmux (E1239) ************************/ +static __initdata struct tegra_pingroup_config tai_pinmux_common[] = { + /* SDMMC1 pinmux */ + DEFAULT_PINMUX(SDMMC1_CLK, SDMMC1, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(SDMMC1_CMD, SDMMC1, PULL_UP, NORMAL, INPUT), + DEFAULT_PINMUX(SDMMC1_DAT3, SDMMC1, PULL_UP, NORMAL, INPUT), + DEFAULT_PINMUX(SDMMC1_DAT2, SDMMC1, PULL_UP, NORMAL, INPUT), + DEFAULT_PINMUX(SDMMC1_DAT1, SDMMC1, PULL_UP, NORMAL, INPUT), + DEFAULT_PINMUX(SDMMC1_DAT0, SDMMC1, PULL_UP, NORMAL, INPUT), + + /* SDMMC3 pinmux */ + DEFAULT_PINMUX(SDMMC3_CLK, SDMMC3, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(SDMMC3_CMD, SDMMC3, PULL_UP, NORMAL, INPUT), + DEFAULT_PINMUX(SDMMC3_DAT0, SDMMC3, PULL_UP, NORMAL, INPUT), + DEFAULT_PINMUX(SDMMC3_DAT1, SDMMC3, PULL_UP, NORMAL, INPUT), + DEFAULT_PINMUX(SDMMC3_DAT2, SDMMC3, PULL_UP, NORMAL, INPUT), + DEFAULT_PINMUX(SDMMC3_DAT3, SDMMC3, PULL_UP, NORMAL, INPUT), + + /* SDMMC4 pinmux */ + DEFAULT_PINMUX(SDMMC4_CLK, SDMMC4, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(SDMMC4_CMD, SDMMC4, PULL_UP, NORMAL, INPUT), + DEFAULT_PINMUX(SDMMC4_DAT0, SDMMC4, PULL_UP, NORMAL, INPUT), + DEFAULT_PINMUX(SDMMC4_DAT1, SDMMC4, PULL_UP, NORMAL, INPUT), + DEFAULT_PINMUX(SDMMC4_DAT2, SDMMC4, PULL_UP, NORMAL, INPUT), + DEFAULT_PINMUX(SDMMC4_DAT3, SDMMC4, PULL_UP, NORMAL, INPUT), + DEFAULT_PINMUX(SDMMC4_DAT4, SDMMC4, PULL_UP, NORMAL, INPUT), + DEFAULT_PINMUX(SDMMC4_DAT5, SDMMC4, PULL_UP, NORMAL, INPUT), + DEFAULT_PINMUX(SDMMC4_DAT6, SDMMC4, PULL_UP, NORMAL, INPUT), + DEFAULT_PINMUX(SDMMC4_DAT7, SDMMC4, PULL_UP, NORMAL, INPUT), + DEFAULT_PINMUX(SDMMC4_RST_N, RSVD1, PULL_DOWN, NORMAL, INPUT), + + /* I2C1 pinmux */ + I2C_PINMUX(GEN1_I2C_SCL, I2C1, NORMAL, NORMAL, INPUT, DISABLE, ENABLE), + I2C_PINMUX(GEN1_I2C_SDA, I2C1, NORMAL, NORMAL, INPUT, DISABLE, ENABLE), + + /* I2C2 pinmux */ + I2C_PINMUX(GEN2_I2C_SCL, I2C2, NORMAL, NORMAL, INPUT, DISABLE, ENABLE), + I2C_PINMUX(GEN2_I2C_SDA, I2C2, NORMAL, NORMAL, INPUT, DISABLE, ENABLE), + + /* I2C3 pinmux */ + I2C_PINMUX(CAM_I2C_SCL, I2C3, NORMAL, NORMAL, INPUT, DISABLE, ENABLE), + I2C_PINMUX(CAM_I2C_SDA, I2C3, NORMAL, NORMAL, INPUT, DISABLE, ENABLE), + + /* I2C4 pinmux */ + I2C_PINMUX(DDC_SCL, I2C4, PULL_UP, NORMAL, INPUT, DISABLE, DISABLE), + I2C_PINMUX(DDC_SDA, I2C4, PULL_UP, NORMAL, INPUT, DISABLE, DISABLE), + + /* Power I2C pinmux */ + I2C_PINMUX(PWR_I2C_SCL, I2CPWR, NORMAL, NORMAL, INPUT, DISABLE, ENABLE), + I2C_PINMUX(PWR_I2C_SDA, I2CPWR, NORMAL, NORMAL, INPUT, DISABLE, ENABLE), + + DEFAULT_PINMUX(ULPI_DATA0, ULPI, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(ULPI_DATA1, ULPI, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(ULPI_DATA2, ULPI, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(ULPI_DATA3, ULPI, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(ULPI_DATA4, ULPI, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(ULPI_DATA5, ULPI, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(ULPI_DATA6, ULPI, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(ULPI_DATA7, ULPI, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(ULPI_CLK, ULPI, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(ULPI_DIR, ULPI, NORMAL, NORMAL, OUTPUT), + DEFAULT_PINMUX(ULPI_NXT, ULPI, NORMAL, NORMAL, OUTPUT), + DEFAULT_PINMUX(ULPI_STP, ULPI, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(DAP3_FS, I2S2, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(DAP3_DIN, I2S2, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(DAP3_DOUT, I2S2, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(DAP3_SCLK, I2S2, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(GPIO_PV2, RSVD1, NORMAL, NORMAL, OUTPUT), + DEFAULT_PINMUX(GPIO_PV3, RSVD1, NORMAL, NORMAL, OUTPUT), + DEFAULT_PINMUX(LCD_CS0_N, DISPLAYA, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(LCD_DC0, DISPLAYA, PULL_DOWN, TRISTATE, OUTPUT), + DEFAULT_PINMUX(LCD_DE, DISPLAYA, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(LCD_D0, DISPLAYA, NORMAL, NORMAL, OUTPUT), + DEFAULT_PINMUX(LCD_D1, DISPLAYA, NORMAL, NORMAL, OUTPUT), + DEFAULT_PINMUX(LCD_D2, DISPLAYA, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(LCD_D3, DISPLAYA, NORMAL, NORMAL, OUTPUT), + DEFAULT_PINMUX(LCD_D4, DISPLAYA, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(LCD_D5, DISPLAYA, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(LCD_D6, RSVD1, NORMAL, NORMAL, OUTPUT), + DEFAULT_PINMUX(LCD_D7, RSVD1, NORMAL, NORMAL, OUTPUT), + DEFAULT_PINMUX(LCD_D8, DISPLAYA, NORMAL, TRISTATE, INPUT), + DEFAULT_PINMUX(LCD_D9, DISPLAYA, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(LCD_D11, DISPLAYA, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(LCD_D12, DISPLAYA, NORMAL, NORMAL, OUTPUT), + DEFAULT_PINMUX(LCD_D13, DISPLAYA, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(LCD_D14, DISPLAYA, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(LCD_D15, DISPLAYA, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(LCD_D16, DISPLAYA, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(LCD_D17, DISPLAYA, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(LCD_D18, DISPLAYA, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(LCD_D20, DISPLAYA, NORMAL, NORMAL, OUTPUT), + DEFAULT_PINMUX(LCD_D21, DISPLAYA, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(LCD_D22, RSVD1, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(LCD_D23, DISPLAYA, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(LCD_CS1_N, DISPLAYA, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(LCD_DC1, DISPLAYA, NORMAL, NORMAL, OUTPUT), + DEFAULT_PINMUX(VI_D0, RSVD1, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(VI_D1, SDMMC2, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(VI_D2, SDMMC2, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(VI_D3, SDMMC2, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(VI_D4, VI, NORMAL, NORMAL, OUTPUT), + DEFAULT_PINMUX(VI_D5, SDMMC2, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(VI_D7, SDMMC2, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(VI_D10, RSVD1, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(VI_MCLK, VI, PULL_UP, NORMAL, INPUT), + + DEFAULT_PINMUX(UART2_RXD, IRDA, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(UART2_TXD, IRDA, NORMAL, NORMAL, OUTPUT), + DEFAULT_PINMUX(UART2_RTS_N, UARTB, NORMAL, NORMAL, OUTPUT), + DEFAULT_PINMUX(UART2_CTS_N, UARTB, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(UART3_TXD, UARTC, NORMAL, NORMAL, OUTPUT), + DEFAULT_PINMUX(UART3_RXD, UARTC, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(UART3_CTS_N, UARTC, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(UART3_RTS_N, UARTC, NORMAL, NORMAL, OUTPUT), + DEFAULT_PINMUX(GPIO_PU0, UARTA, NORMAL, NORMAL, OUTPUT), + DEFAULT_PINMUX(GPIO_PU1, UARTA, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(GPIO_PU2, UARTA, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(GPIO_PU3, UARTA, NORMAL, NORMAL, OUTPUT), + DEFAULT_PINMUX(GPIO_PU4, PWM1, NORMAL, NORMAL, OUTPUT), + DEFAULT_PINMUX(GPIO_PU5, PWM2, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(GPIO_PU6, PWM3, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(DAP4_FS, I2S3, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(DAP4_DIN, I2S3, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(DAP4_DOUT, I2S3, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(DAP4_SCLK, I2S3, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(GMI_AD11, PWM3, NORMAL, NORMAL, OUTPUT), + DEFAULT_PINMUX(GMI_A16, UARTD, NORMAL, NORMAL, OUTPUT), + DEFAULT_PINMUX(GMI_A17, UARTD, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(GMI_A18, UARTD, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(GMI_A19, UARTD, NORMAL, NORMAL, OUTPUT), + DEFAULT_PINMUX(CAM_MCLK, VI_ALT2, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(GPIO_PCC1, RSVD1, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(GPIO_PBB0, RSVD1, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(GPIO_PBB3, VGP3, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(GPIO_PBB7, I2S4, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(GPIO_PCC2, I2S4, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(JTAG_RTCK, RTCK, NORMAL, NORMAL, OUTPUT), + DEFAULT_PINMUX(KB_ROW0, KBC, PULL_UP, NORMAL, INPUT), + DEFAULT_PINMUX(KB_ROW1, KBC, PULL_UP, NORMAL, INPUT), + DEFAULT_PINMUX(KB_ROW2, KBC, PULL_UP, NORMAL, INPUT), + DEFAULT_PINMUX(KB_ROW3, KBC, PULL_UP, NORMAL, INPUT), + DEFAULT_PINMUX(KB_ROW10, KBC, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(KB_ROW12, KBC, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(KB_COL0, KBC, PULL_UP, NORMAL, INPUT), + DEFAULT_PINMUX(KB_COL1, KBC, PULL_UP, NORMAL, INPUT), + DEFAULT_PINMUX(KB_COL2, KBC, PULL_UP, NORMAL, INPUT), + DEFAULT_PINMUX(KB_COL3, KBC, PULL_UP, NORMAL, INPUT), + DEFAULT_PINMUX(KB_COL4, KBC, PULL_UP, NORMAL, INPUT), + DEFAULT_PINMUX(KB_COL5, KBC, PULL_UP, NORMAL, INPUT), + DEFAULT_PINMUX(GPIO_PV0, RSVD, PULL_UP, NORMAL, INPUT), + DEFAULT_PINMUX(CLK_32K_OUT, BLINK, PULL_DOWN, TRISTATE, OUTPUT), + DEFAULT_PINMUX(SYS_CLK_REQ, SYSCLK, NORMAL, NORMAL, OUTPUT), + DEFAULT_PINMUX(OWR, OWR, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(DAP1_FS, I2S0, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(DAP1_DIN, I2S0, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(DAP1_DOUT, I2S0, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(DAP1_SCLK, I2S0, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(CLK1_REQ, DAP, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(CLK1_OUT, EXTPERIPH1, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(SPDIF_IN, SPDIF, NORMAL, NORMAL, INPUT), + + + DEFAULT_PINMUX(SPI2_CS1_N, INVALID, PULL_DOWN, TRISTATE, OUTPUT), + DEFAULT_PINMUX(PEX_L0_PRSNT_N, PCIE, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(PEX_L0_RST_N, PCIE, NORMAL, NORMAL, OUTPUT), + DEFAULT_PINMUX(PEX_L0_CLKREQ_N, PCIE, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(PEX_WAKE_N, PCIE, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(PEX_L1_PRSNT_N, PCIE, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(PEX_L1_RST_N, PCIE, NORMAL, NORMAL, OUTPUT), + DEFAULT_PINMUX(PEX_L1_CLKREQ_N, PCIE, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(PEX_L2_PRSNT_N, PCIE, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(PEX_L2_RST_N, PCIE, NORMAL, NORMAL, OUTPUT), + DEFAULT_PINMUX(PEX_L2_CLKREQ_N, PCIE, NORMAL, NORMAL, INPUT), + CEC_PINMUX(HDMI_CEC, CEC, NORMAL, TRISTATE, OUTPUT, DEFAULT, DISABLE), + DEFAULT_PINMUX(HDMI_INT, RSVD0, NORMAL, TRISTATE, INPUT), + + /* Gpios */ + /* SDMMC1 CD gpio */ + DEFAULT_PINMUX(GMI_IORDY, RSVD1, PULL_UP, NORMAL, INPUT), + /* SDMMC1 WP gpio */ + DEFAULT_PINMUX(VI_D11, RSVD1, PULL_UP, NORMAL, INPUT), + + /* Touch RESET */ + DEFAULT_PINMUX(GMI_AD14, NAND, NORMAL, NORMAL, INPUT), + + DEFAULT_PINMUX(GMI_AD15, NAND, PULL_UP, TRISTATE, INPUT), + + /* Power rails GPIO */ + DEFAULT_PINMUX(KB_ROW8, KBC, PULL_UP, NORMAL, INPUT), + + VI_PINMUX(VI_D6, VI, NORMAL, NORMAL, OUTPUT, DISABLE, DISABLE), + VI_PINMUX(VI_D8, SDMMC2, NORMAL, NORMAL, INPUT, DISABLE, DISABLE), + VI_PINMUX(VI_D9, SDMMC2, NORMAL, NORMAL, INPUT, DISABLE, DISABLE), + VI_PINMUX(VI_PCLK, RSVD1, PULL_UP, TRISTATE, INPUT, DISABLE, ENABLE), + VI_PINMUX(VI_HSYNC, RSVD1, NORMAL, NORMAL, INPUT, DISABLE, DISABLE), + VI_PINMUX(VI_VSYNC, RSVD1, NORMAL, NORMAL, INPUT, DISABLE, DISABLE), + + DEFAULT_PINMUX(LCD_PWR0, DISPLAYA, NORMAL, NORMAL, OUTPUT), + DEFAULT_PINMUX(LCD_D10, DISPLAYA, NORMAL, NORMAL, OUTPUT), + DEFAULT_PINMUX(GMI_CS7_N, NAND_ALT, PULL_UP, TRISTATE, INPUT), + DEFAULT_PINMUX(SPI2_MOSI, SPI6, PULL_UP, NORMAL, OUTPUT), + DEFAULT_PINMUX(CLK3_OUT, EXTPERIPH3, NORMAL, NORMAL, OUTPUT), +}; + +static __initdata struct tegra_pingroup_config tai_pinmux_a02[] = { + DEFAULT_PINMUX(LCD_PWR2, DISPLAYA, NORMAL, NORMAL, OUTPUT), + DEFAULT_PINMUX(LCD_PWR1, DISPLAYA, NORMAL, NORMAL, INPUT), +}; + +static __initdata struct tegra_pingroup_config tai_pinmux_a03[] = { + DEFAULT_PINMUX(LCD_PWR2, DISPLAYA, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(LCD_PWR1, DISPLAYA, NORMAL, NORMAL, OUTPUT), +}; + +static __initdata struct tegra_pingroup_config tai_unused_pinmux_common[] = { + DEFAULT_PINMUX(CLK2_OUT, EXTPERIPH2, PULL_DOWN, TRISTATE, OUTPUT), + DEFAULT_PINMUX(CLK2_REQ, DAP, PULL_DOWN, TRISTATE, OUTPUT), + DEFAULT_PINMUX(CLK3_REQ, DEV3, PULL_DOWN, TRISTATE, OUTPUT), + DEFAULT_PINMUX(CLK_32K_OUT, BLINK, PULL_DOWN, TRISTATE, OUTPUT), + DEFAULT_PINMUX(GPIO_PBB4, VGP4, PULL_DOWN, TRISTATE, OUTPUT), + DEFAULT_PINMUX(GPIO_PBB5, VGP5, PULL_DOWN, TRISTATE, OUTPUT), + DEFAULT_PINMUX(GPIO_PBB6, VGP6, PULL_DOWN, TRISTATE, OUTPUT), + DEFAULT_PINMUX(GMI_AD0, GMI, NORMAL, TRISTATE, OUTPUT), + DEFAULT_PINMUX(GMI_AD1, GMI, NORMAL, TRISTATE, OUTPUT), + DEFAULT_PINMUX(GMI_AD2, GMI, NORMAL, TRISTATE, OUTPUT), + DEFAULT_PINMUX(GMI_AD3, GMI, NORMAL, TRISTATE, OUTPUT), + DEFAULT_PINMUX(GMI_AD4, GMI, NORMAL, TRISTATE, OUTPUT), + DEFAULT_PINMUX(GMI_AD5, GMI, NORMAL, TRISTATE, OUTPUT), + DEFAULT_PINMUX(GMI_AD6, GMI, NORMAL, TRISTATE, OUTPUT), + DEFAULT_PINMUX(GMI_AD7, GMI, NORMAL, TRISTATE, OUTPUT), + DEFAULT_PINMUX(GMI_CS0_N, GMI, PULL_DOWN, TRISTATE, OUTPUT), + DEFAULT_PINMUX(GMI_CS2_N, GMI, PULL_DOWN, TRISTATE, OUTPUT), + DEFAULT_PINMUX(GMI_CS3_N, GMI, PULL_DOWN, TRISTATE, OUTPUT), + DEFAULT_PINMUX(GMI_CS6_N, GMI, PULL_DOWN, TRISTATE, OUTPUT), + DEFAULT_PINMUX(GMI_CLK, GMI, NORMAL, TRISTATE, OUTPUT), + DEFAULT_PINMUX(GMI_DQS, RSVD3, PULL_DOWN, TRISTATE, OUTPUT), + DEFAULT_PINMUX(GMI_RST_N, GMI, PULL_DOWN, TRISTATE, OUTPUT), + DEFAULT_PINMUX(GMI_WAIT, GMI, PULL_DOWN, TRISTATE, OUTPUT), + DEFAULT_PINMUX(GMI_WP_N, GMI, PULL_DOWN, TRISTATE, OUTPUT), + DEFAULT_PINMUX(KB_ROW6, KBC, PULL_DOWN, TRISTATE, OUTPUT), + DEFAULT_PINMUX(KB_ROW7, KBC, PULL_DOWN, TRISTATE, OUTPUT), + DEFAULT_PINMUX(KB_ROW9, KBC, PULL_DOWN, TRISTATE, OUTPUT), + DEFAULT_PINMUX(KB_ROW11, KBC, PULL_DOWN, TRISTATE, OUTPUT), + DEFAULT_PINMUX(KB_ROW13, KBC, PULL_DOWN, TRISTATE, OUTPUT), + DEFAULT_PINMUX(KB_ROW14, KBC, PULL_DOWN, TRISTATE, OUTPUT), + DEFAULT_PINMUX(KB_ROW15, KBC, PULL_DOWN, TRISTATE, OUTPUT), + DEFAULT_PINMUX(LCD_PCLK, DISPLAYA, PULL_DOWN, TRISTATE, OUTPUT), + DEFAULT_PINMUX(LCD_WR_N, DISPLAYA, PULL_DOWN, TRISTATE, OUTPUT), + DEFAULT_PINMUX(LCD_HSYNC, DISPLAYA, PULL_DOWN, TRISTATE, OUTPUT), + DEFAULT_PINMUX(LCD_VSYNC, DISPLAYA, PULL_DOWN, TRISTATE, OUTPUT), + DEFAULT_PINMUX(LCD_SCK, DISPLAYA, PULL_DOWN, TRISTATE, OUTPUT), + DEFAULT_PINMUX(LCD_SDOUT, DISPLAYA, PULL_DOWN, TRISTATE, OUTPUT), + DEFAULT_PINMUX(LCD_SDIN, DISPLAYA, PULL_DOWN, TRISTATE, OUTPUT), + DEFAULT_PINMUX(CRT_HSYNC, CRT, PULL_DOWN, TRISTATE, OUTPUT), + DEFAULT_PINMUX(CRT_VSYNC, CRT, PULL_DOWN, TRISTATE, OUTPUT), + DEFAULT_PINMUX(SDMMC3_DAT4, SDMMC3, PULL_DOWN, TRISTATE, OUTPUT), + DEFAULT_PINMUX(SDMMC3_DAT5, SDMMC3, PULL_DOWN, TRISTATE, OUTPUT), + DEFAULT_PINMUX(SDMMC3_DAT6, SDMMC3, PULL_DOWN, TRISTATE, OUTPUT), + DEFAULT_PINMUX(SDMMC3_DAT7, SDMMC3, PULL_DOWN, TRISTATE, OUTPUT), + DEFAULT_PINMUX(SPDIF_OUT, SPDIF, PULL_DOWN, TRISTATE, OUTPUT), + DEFAULT_PINMUX(SPI2_SCK, SPI2, PULL_DOWN, TRISTATE, OUTPUT), + DEFAULT_PINMUX(SPI2_MISO, SPI2, PULL_DOWN, TRISTATE, OUTPUT), + DEFAULT_PINMUX(SPI2_CS0_N, SPI2, PULL_DOWN, TRISTATE, OUTPUT), + + DEFAULT_PINMUX(LCD_D19, DISPLAYA, PULL_DOWN, TRISTATE, OUTPUT), + DEFAULT_PINMUX(LCD_M1, DISPLAYA, PULL_DOWN, TRISTATE, OUTPUT), + DEFAULT_PINMUX(GMI_AD8, PWM0, PULL_DOWN, TRISTATE, OUTPUT), + DEFAULT_PINMUX(GMI_AD9, PWM1, PULL_DOWN, TRISTATE, OUTPUT), + DEFAULT_PINMUX(GMI_AD10, PWM2, PULL_DOWN, TRISTATE, OUTPUT), + DEFAULT_PINMUX(GMI_AD12, RSVD1, PULL_DOWN, TRISTATE, OUTPUT), + DEFAULT_PINMUX(GMI_AD13, RSVD1, PULL_DOWN, TRISTATE, OUTPUT), + DEFAULT_PINMUX(DAP2_FS, I2S1, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(DAP2_DIN, I2S1, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(DAP2_DOUT, I2S1, NORMAL, NORMAL, OUTPUT), + DEFAULT_PINMUX(DAP2_SCLK, I2S1, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(SPI1_MOSI, SPI2, PULL_DOWN, TRISTATE, OUTPUT), + DEFAULT_PINMUX(SPI1_SCK , SPI2, PULL_DOWN, TRISTATE, OUTPUT), + DEFAULT_PINMUX(SPI1_MISO , INVALID, PULL_DOWN, TRISTATE, OUTPUT), + DEFAULT_PINMUX(SPI1_CS0_N, SPI1, PULL_DOWN, TRISTATE, OUTPUT), +}; + +static __initdata struct pin_info_low_power_mode +tai_unused_gpio_pins_common[] = { + PIN_GPIO_LPM("CLK2_OUT", TEGRA_GPIO_PW5, 0, 0), + PIN_GPIO_LPM("CLK2_REQ", TEGRA_GPIO_PCC5, 0, 0), + PIN_GPIO_LPM("CLK3_REQ", TEGRA_GPIO_PEE1, 0, 0), + PIN_GPIO_LPM("CLK_32K_OUT", TEGRA_GPIO_PA0, 0, 0), + PIN_GPIO_LPM("GPIO_PBB4", TEGRA_GPIO_PBB4, 0, 0), + PIN_GPIO_LPM("GPIO_PBB5", TEGRA_GPIO_PBB5, 0, 0), + PIN_GPIO_LPM("GPIO_PBB6", TEGRA_GPIO_PBB6, 0, 0), + PIN_GPIO_LPM("GMI_AD0", TEGRA_GPIO_PG0, 0, 0), + PIN_GPIO_LPM("GMI_AD1", TEGRA_GPIO_PG1, 0, 0), + PIN_GPIO_LPM("GMI_AD2", TEGRA_GPIO_PG2, 0, 0), + PIN_GPIO_LPM("GMI_AD3", TEGRA_GPIO_PG3, 0, 0), + PIN_GPIO_LPM("GMI_AD4", TEGRA_GPIO_PG4, 0, 0), + PIN_GPIO_LPM("GMI_AD5", TEGRA_GPIO_PG5, 0, 0), + PIN_GPIO_LPM("GMI_AD6", TEGRA_GPIO_PG6, 0, 0), + PIN_GPIO_LPM("GMI_AD7", TEGRA_GPIO_PG7, 0, 0), + PIN_GPIO_LPM("GMI_CS0_N", TEGRA_GPIO_PJ0, 0, 0), + PIN_GPIO_LPM("GMI_CS2_N", TEGRA_GPIO_PK3, 0, 0), + PIN_GPIO_LPM("GMI_CS3_N", TEGRA_GPIO_PK4, 0, 0), + PIN_GPIO_LPM("GMI_CS6_N", TEGRA_GPIO_PI3, 0, 0), + PIN_GPIO_LPM("GMI_CLK", TEGRA_GPIO_PK1, 0, 0), + PIN_GPIO_LPM("GMI_DQS", TEGRA_GPIO_PI2, 0, 0), + PIN_GPIO_LPM("GMI_RST_N", TEGRA_GPIO_PI4, 0, 0), + PIN_GPIO_LPM("GMI_WAIT", TEGRA_GPIO_PI7, 0, 0), + PIN_GPIO_LPM("GMI_WP_N", TEGRA_GPIO_PC7, 0, 0), + PIN_GPIO_LPM("KB_ROW6", TEGRA_GPIO_PR6, 0, 0), + PIN_GPIO_LPM("KB_ROW7", TEGRA_GPIO_PR7, 0, 0), + PIN_GPIO_LPM("KB_ROW9", TEGRA_GPIO_PS1, 0, 0), + PIN_GPIO_LPM("KB_ROW11", TEGRA_GPIO_PS3, 0, 0), + PIN_GPIO_LPM("KB_ROW13", TEGRA_GPIO_PS5, 0, 0), + PIN_GPIO_LPM("KB_ROW14", TEGRA_GPIO_PS6, 0, 0), + PIN_GPIO_LPM("KB_ROW15", TEGRA_GPIO_PS7, 0, 0), + PIN_GPIO_LPM("LCD_PCLK", TEGRA_GPIO_PB3, 0, 0), + PIN_GPIO_LPM("LCD_WR_N", TEGRA_GPIO_PZ3, 0, 0), + PIN_GPIO_LPM("LCD_HSYNC", TEGRA_GPIO_PJ3, 0, 0), + PIN_GPIO_LPM("LCD_VSYNC", TEGRA_GPIO_PJ4, 0, 0), + PIN_GPIO_LPM("LCD_SCK", TEGRA_GPIO_PZ4, 0, 0), + PIN_GPIO_LPM("LCD_SDOUT", TEGRA_GPIO_PN5, 0, 0), + PIN_GPIO_LPM("LCD_SDIN", TEGRA_GPIO_PZ2, 0, 0), + PIN_GPIO_LPM("CRT_HSYNC", TEGRA_GPIO_PV6, 0, 0), + PIN_GPIO_LPM("CRT_VSYNC", TEGRA_GPIO_PV7, 0, 0), + PIN_GPIO_LPM("SDMMC3_DAT4", TEGRA_GPIO_PD1, 0, 0), + PIN_GPIO_LPM("SDMMC3_DAT5", TEGRA_GPIO_PD0, 0, 0), + PIN_GPIO_LPM("SDMMC3_DAT6", TEGRA_GPIO_PD3, 0, 0), + PIN_GPIO_LPM("SDMMC3_DAT7", TEGRA_GPIO_PD4, 0, 0), + PIN_GPIO_LPM("SPDIF_OUT", TEGRA_GPIO_PK5, 0, 0), + PIN_GPIO_LPM("SPI1_CS0_N", TEGRA_GPIO_PX6, 0, 0), + PIN_GPIO_LPM("SPI2_SCK", TEGRA_GPIO_PX2, 0, 0), + PIN_GPIO_LPM("SPI2_MISO", TEGRA_GPIO_PX1, 0, 0), + PIN_GPIO_LPM("SPI2_CS0_N", TEGRA_GPIO_PX3, 0, 0), + PIN_GPIO_LPM("LCD_D19", TEGRA_GPIO_PM3, 0, 0), + PIN_GPIO_LPM("LCD_M1", TEGRA_GPIO_PW1, 0, 0), + PIN_GPIO_LPM("GMI_AD8", TEGRA_GPIO_PH0, 0, 0), + PIN_GPIO_LPM("GMI_AD9", TEGRA_GPIO_PH1, 0, 0), + PIN_GPIO_LPM("GMI_AD10", TEGRA_GPIO_PH2, 0, 0), + PIN_GPIO_LPM("GMI_AD12", TEGRA_GPIO_PH4, 0, 0), + PIN_GPIO_LPM("GMI_AD13", TEGRA_GPIO_PH5, 0, 0), + PIN_GPIO_LPM("DAP2_FS", TEGRA_GPIO_PA2, 0, 0), + PIN_GPIO_LPM("DAP2_DIN", TEGRA_GPIO_PA4, 0, 0), + PIN_GPIO_LPM("DAP2_DOUT", TEGRA_GPIO_PA5, 0, 0), + PIN_GPIO_LPM("DAP2_SCLK", TEGRA_GPIO_PA3, 0, 0), + PIN_GPIO_LPM("SPI1_MOSI", TEGRA_GPIO_PX4, 0, 0), + PIN_GPIO_LPM("SPI1_SCK", TEGRA_GPIO_PX5, 0, 0), + PIN_GPIO_LPM("SPI1_MISO", TEGRA_GPIO_PX7, 0, 0), + +}; static void enterprise_set_unused_pin_gpio(struct pin_info_low_power_mode *lpm_pin_info, int list_count) @@ -632,27 +982,51 @@ int __init enterprise_pinmux_init(void) struct board_info board_info; tegra_get_board_info(&board_info); - tegra_pinmux_config_table(enterprise_pinmux_common, + if (board_info.board_id != BOARD_E1239) { + tegra_pinmux_config_table(enterprise_pinmux_common, ARRAY_SIZE(enterprise_pinmux_common)); - tegra_drive_pinmux_config_table(enterprise_drive_pinmux, - ARRAY_SIZE(enterprise_drive_pinmux)); - tegra_pinmux_config_table(enterprise_unused_pinmux_common, + tegra_drive_pinmux_config_table(enterprise_drive_pinmux, + ARRAY_SIZE(enterprise_drive_pinmux)); + tegra_pinmux_config_table(enterprise_unused_pinmux_common, ARRAY_SIZE(enterprise_unused_pinmux_common)); - tegra_gpio_config(gpio_table, ARRAY_SIZE(gpio_table)); - enterprise_set_unused_pin_gpio(enterprise_unused_gpio_pins_common, - ARRAY_SIZE(enterprise_unused_gpio_pins_common)); + tegra_gpio_config(gpio_table, ARRAY_SIZE(gpio_table)); + enterprise_set_unused_pin_gpio( + enterprise_unused_gpio_pins_common, + ARRAY_SIZE(enterprise_unused_gpio_pins_common)); - if (board_info.fab < BOARD_FAB_A03) { - tegra_pinmux_config_table(enterprise_pinmux_a02, + if (board_info.fab < BOARD_FAB_A03) { + tegra_pinmux_config_table(enterprise_pinmux_a02, ARRAY_SIZE(enterprise_pinmux_a02)); - enterprise_set_unused_pin_gpio(enterprise_unused_gpio_pins_a02, - ARRAY_SIZE(enterprise_unused_gpio_pins_a02)); - } else { - tegra_pinmux_config_table(enterprise_pinmux_a03, + enterprise_set_unused_pin_gpio( + enterprise_unused_gpio_pins_a02, + ARRAY_SIZE(enterprise_unused_gpio_pins_a02)); + } else { + tegra_pinmux_config_table(enterprise_pinmux_a03, ARRAY_SIZE(enterprise_pinmux_a03)); - enterprise_set_unused_pin_gpio(enterprise_gpio_pins_a03, - ARRAY_SIZE(enterprise_gpio_pins_a03)); + enterprise_set_unused_pin_gpio(enterprise_gpio_pins_a03, + ARRAY_SIZE(enterprise_gpio_pins_a03)); + } + } else { + tegra_pinmux_config_table(tai_pinmux_common, + ARRAY_SIZE(tai_pinmux_common)); + if (board_info.fab <= BOARD_FAB_A02) { + tegra_pinmux_config_table(tai_pinmux_a02, + ARRAY_SIZE(tai_pinmux_a02)); + } else { + tegra_pinmux_config_table(tai_pinmux_a03, + ARRAY_SIZE(tai_pinmux_a03)); + } + tegra_drive_pinmux_config_table(enterprise_drive_pinmux, + ARRAY_SIZE(enterprise_drive_pinmux)); + tegra_pinmux_config_table(tai_unused_pinmux_common, + ARRAY_SIZE(tai_unused_pinmux_common)); + + tegra_gpio_config(gpio_table, ARRAY_SIZE(gpio_table)); + tegra_gpio_config(tai_gpio_table, ARRAY_SIZE(tai_gpio_table)); + enterprise_set_unused_pin_gpio(tai_unused_gpio_pins_common, + ARRAY_SIZE(tai_unused_gpio_pins_common)); + } return 0; diff --git a/arch/arm/mach-tegra/board-enterprise-power.c b/arch/arm/mach-tegra/board-enterprise-power.c index f974c49c9f50..7ea2095e6622 100644 --- a/arch/arm/mach-tegra/board-enterprise-power.c +++ b/arch/arm/mach-tegra/board-enterprise-power.c @@ -446,6 +446,10 @@ static struct regulator_consumer_supply fixed_reg_pmu_3v3_en_supply[] = { static struct regulator_consumer_supply fixed_reg_pmu_hdmi_5v0_en_supply[] = { REGULATOR_SUPPLY("hdmi_5v0", NULL), }; +static struct regulator_consumer_supply +fixed_reg_pmu_hdmi_5v0_en_tai_supply[] = { + REGULATOR_SUPPLY("hdmi_5v0", NULL), +}; /* LCD-D16 (GPIO M0) from T30*/ static struct regulator_consumer_supply fixed_reg_vdd_fuse_en_supply[] = { @@ -627,6 +631,9 @@ FIXED_REG(7, vdd_sdmmc3_2v85_en, NULL, FIXED_REG(8, lcd_1v8_en, NULL, TEGRA_GPIO_PB2, true, 1800, 0, 0); +FIXED_REG(9, pmu_hdmi_5v0_en_tai, NULL, + ENT_TPS80031_GPIO_SYSEN, true, 5000, 0, 0); + #define ADD_FIXED_REG(_name) (&fixed_reg_##_name##_dev) static struct platform_device *fixed_regs_devices_a02[] = { ADD_FIXED_REG(pmu_5v15_en), @@ -647,6 +654,14 @@ static struct platform_device *fixed_regs_devices_a03[] = { ADD_FIXED_REG(lcd_1v8_en), }; +static struct platform_device *fixed_regs_devices_tai[] = { + ADD_FIXED_REG(pmu_hdmi_5v0_en_tai), + ADD_FIXED_REG(cam_ldo_2v8_en), + ADD_FIXED_REG(cam_ldo_1v8_en), + ADD_FIXED_REG(vdd_sdmmc3_2v85_en), + ADD_FIXED_REG(lcd_1v8_en), +}; + #define ADD_GPIO_REG(_name) (&gpio_reg_##_name##_dev) static struct platform_device *gpio_regs_devices[] = { ADD_GPIO_REG(sdmmc3_vdd_sel), @@ -660,14 +675,18 @@ static int __init enterprise_fixed_regulator_init(void) tegra_get_board_info(&board_info); - if (board_info.fab < BOARD_FAB_A03) { - fixed_regs_devices = fixed_regs_devices_a02; - nfixreg_devs = ARRAY_SIZE(fixed_regs_devices_a02); + if (board_info.board_id == BOARD_E1239) { + fixed_regs_devices = fixed_regs_devices_tai; + nfixreg_devs = ARRAY_SIZE(fixed_regs_devices_tai); } else { - fixed_regs_devices = fixed_regs_devices_a03; - nfixreg_devs = ARRAY_SIZE(fixed_regs_devices_a03); + if (board_info.fab < BOARD_FAB_A03) { + fixed_regs_devices = fixed_regs_devices_a02; + nfixreg_devs = ARRAY_SIZE(fixed_regs_devices_a02); + } else { + fixed_regs_devices = fixed_regs_devices_a03; + nfixreg_devs = ARRAY_SIZE(fixed_regs_devices_a03); + } } - return platform_add_devices(fixed_regs_devices, nfixreg_devs); } @@ -721,7 +740,8 @@ int __init enterprise_regulator_init(void) battery_gauge_data.battery_present = 0; } - if (board_info.fab < BOARD_FAB_A03) { + if ((board_info.fab < BOARD_FAB_A03) && + (board_info.board_id != BOARD_E1239)) { tps_platform.num_regulator_pdata = ARRAY_SIZE(tps80031_reg_pdata_a02); tps_platform.regulator_pdata = tps80031_reg_pdata_a02; } else { @@ -770,6 +790,7 @@ static void enterprise_init_deep_sleep_mode(void) enterprise_suspend_data.suspend_mode = TEGRA_SUSPEND_LP1; if ((bi.board_id == BOARD_E1205 && (bi.sku & BOARD_SKU_VF_BIT) == 0) || + (bi.board_id == BOARD_E1239 && (bi.sku & BOARD_SKU_VF_BIT) == 0) || (bi.board_id == BOARD_E1197 && (bi.sku & BOARD_SKU_VF_BIT))) enterprise_suspend_data.cpu_timer = 8000; } diff --git a/arch/arm/mach-tegra/board-enterprise-sensors.c b/arch/arm/mach-tegra/board-enterprise-sensors.c index aab409b89ea9..c66d3fbbd1e8 100644 --- a/arch/arm/mach-tegra/board-enterprise-sensors.c +++ b/arch/arm/mach-tegra/board-enterprise-sensors.c @@ -40,16 +40,21 @@ #include <linux/platform_data/ina230.h> #include <linux/regulator/consumer.h> #include <linux/slab.h> +#include <linux/clk.h> #include <mach/gpio.h> #include <media/ar0832_main.h> #include <media/tps61050.h> #include <media/ov9726.h> #include <mach/edp.h> #include <mach/thermal.h> +#include <mach/clk.h> #include "cpu-tegra.h" #include "gpio-names.h" #include "board-enterprise.h" #include "board.h" +#include "clock.h" + +static struct board_info board_info; static int nct_get_temp(void *_data, long *temp) { @@ -283,6 +288,14 @@ struct enterprise_power_rail { static struct enterprise_power_rail ent_vicsi_pwr[NUM_OF_CAM]; +static __initdata struct tegra_clk_init_table tai_front_cam_clk_init_table[] = { + /* name parent rate enabled */ + { "extern3", "pll_p", 24000000, false}, + { "clk_out_3", "extern3", 24000000, false}, + { NULL, NULL, 0, 0}, +}; + + static int enterprise_cam_pwr(enum CAMERA_INDEX cam, bool pwr_on) { struct enterprise_power_rail *reg_cam = &ent_vicsi_pwr[cam]; @@ -357,7 +370,8 @@ static int enterprise_ar0832_ri_power_on(int is_stereo) /* Release Reset */ if (is_stereo) { gpio_set_value(CAM1_RST_L_GPIO, 1); - gpio_set_value(CAM2_RST_L_GPIO, 1); + if (board_info.board_id != BOARD_E1239) + gpio_set_value(CAM2_RST_L_GPIO, 1); } else gpio_set_value(CAM1_RST_L_GPIO, 1); /* @@ -375,11 +389,12 @@ static int enterprise_ar0832_le_power_on(int is_stereo) int ret = 0; pr_info("%s: ++\n", __func__); - ret = enterprise_cam_pwr(CAM_REAR_LEFT, true); - - /* Release Reset */ - gpio_set_value(CAM2_RST_L_GPIO, 1); + if (board_info.board_id != BOARD_E1239) { + ret = enterprise_cam_pwr(CAM_REAR_LEFT, true); + /* Release Reset */ + gpio_set_value(CAM2_RST_L_GPIO, 1); + } /* It takes 2400 EXTCLK for ar0832 to be ready for I2c. EXTCLK is 10 ~ 24MHz. 1 ms should be enough to cover @@ -387,8 +402,10 @@ static int enterprise_ar0832_le_power_on(int is_stereo) */ enterprise_msleep(1); - /* CSI B is shared between Front camera and Rear Left camera */ - gpio_set_value(CAM_CSI_MUX_SEL_GPIO, 1); + if (board_info.board_id != BOARD_E1239) { + /* CSI B is shared between Front camera and Rear Left camera */ + gpio_set_value(CAM_CSI_MUX_SEL_GPIO, 1); + } return ret; } @@ -403,7 +420,8 @@ static int enterprise_ar0832_ri_power_off(int is_stereo) /* Assert Reset */ if (is_stereo) { gpio_set_value(CAM1_RST_L_GPIO, 0); - gpio_set_value(CAM2_RST_L_GPIO, 0); + if (board_info.board_id != BOARD_E1239) + gpio_set_value(CAM2_RST_L_GPIO, 0); } else gpio_set_value(CAM1_RST_L_GPIO, 0); @@ -412,14 +430,15 @@ static int enterprise_ar0832_ri_power_off(int is_stereo) static int enterprise_ar0832_le_power_off(int is_stereo) { - int ret; - - pr_info("%s: ++\n", __func__); - ret = enterprise_cam_pwr(CAM_REAR_LEFT, false); + int ret = 0; - /* Assert Reset */ - gpio_set_value(CAM2_RST_L_GPIO, 0); + if (board_info.board_id != BOARD_E1239) { + pr_info("%s: ++\n", __func__); + ret = enterprise_cam_pwr(CAM_REAR_LEFT, false); + /* Assert Reset */ + gpio_set_value(CAM2_RST_L_GPIO, 0); + } return ret; } @@ -427,10 +446,15 @@ static int enterprise_ov9726_power_on(void) { pr_info("ov9726 power on\n"); - /* switch mipi mux to front camera */ - gpio_set_value(CAM_CSI_MUX_SEL_GPIO, CAM_CSI_MUX_SEL_FRONT); + if (board_info.board_id != BOARD_E1239) { + /* switch mipi mux to front camera */ + gpio_set_value(CAM_CSI_MUX_SEL_GPIO, CAM_CSI_MUX_SEL_FRONT); + } enterprise_cam_pwr(CAM_FRONT, true); + if (board_info.board_id == BOARD_E1239) + clk_enable(tegra_get_clock_by_name("clk_out_3")); + return 0; } @@ -440,6 +464,9 @@ static int enterprise_ov9726_power_off(void) enterprise_cam_pwr(CAM_FRONT, false); + if (board_info.board_id == BOARD_E1239) + clk_disable(tegra_get_clock_by_name("clk_out_3")); + return 0; } @@ -485,7 +512,13 @@ static struct enterprise_cam_gpio enterprise_cam_gpio_data[] = { [5] = TEGRA_CAMERA_GPIO(CAM_FLASH_EN_GPIO, "flash_en", 1), [6] = TEGRA_CAMERA_GPIO(CAM_I2C_MUX_RST_EXP, "cam_i2c_mux_rst", 1), }; - +static struct enterprise_cam_gpio tai_cam_gpio_data[] = { + [0] = TEGRA_CAMERA_GPIO(CAM1_RST_L_GPIO, "cam1_rst_lo", 0), + [1] = TEGRA_CAMERA_GPIO(CAM3_RST_L_GPIO, "cam3_rst_lo", 0), + [2] = TEGRA_CAMERA_GPIO(CAM3_PWDN_GPIO, "cam3_pwdn", 1), + [3] = TEGRA_CAMERA_GPIO(CAM_FLASH_EN_GPIO, "flash_en", 1), + [4] = TEGRA_CAMERA_GPIO(CAM_I2C_MUX_RST_EXP, "cam_i2c_mux_rst", 1), +}; static struct pca954x_platform_mode enterprise_pca954x_modes[] = { { .adap_id = PCA954x_I2C_BUS0, .deselect_on_exit = true, }, { .adap_id = PCA954x_I2C_BUS1, .deselect_on_exit = true, }, @@ -565,49 +598,87 @@ static struct i2c_board_info enterprise_i2c7_boardinfo[] = { .platform_data = &enterprise_ar0832_ri_data, }, }; +static struct i2c_board_info ar0832_i2c2_boardinfo_tai[] = { + { + /* 0x36: alternative slave address */ + I2C_BOARD_INFO("ar0832", 0x36), + .platform_data = &enterprise_ar0832_ri_data, + }, + { + I2C_BOARD_INFO("tps61050", 0x33), + .platform_data = &enterprise_tps61050_pdata, + }, + { + I2C_BOARD_INFO("ov9726", OV9726_I2C_ADDR >> 1), + .platform_data = &enterprise_ov9726_data, + }, +}; static int enterprise_cam_init(void) { int ret; int i; - struct board_info bi; struct board_info cam_bi; bool i2c_mux = false; pr_info("%s:++\n", __func__); memset(ent_vicsi_pwr, 0, sizeof(ent_vicsi_pwr)); - for (i = 0; i < ARRAY_SIZE(enterprise_cam_gpio_data); i++) { - ret = gpio_request(enterprise_cam_gpio_data[i].gpio, - enterprise_cam_gpio_data[i].label); - if (ret < 0) { - pr_err("%s: gpio_request failed for gpio #%d\n", - __func__, i); - goto fail_free_gpio; - } - gpio_direction_output(enterprise_cam_gpio_data[i].gpio, - enterprise_cam_gpio_data[i].value); - gpio_export(enterprise_cam_gpio_data[i].gpio, false); - } - tegra_get_board_info(&bi); tegra_get_camera_board_info(&cam_bi); - if (bi.board_id == BOARD_E1205) { - if (bi.fab == BOARD_FAB_A00 || bi.fab == BOARD_FAB_A01) + if (board_info.board_id == BOARD_E1239) { + for (i = 0; i < ARRAY_SIZE(tai_cam_gpio_data); i++) { + ret = gpio_request(tai_cam_gpio_data[i].gpio, + tai_cam_gpio_data[i].label); + if (ret < 0) { + pr_err("%s: gpio_request failed for gpio #%d\n", + __func__, i); + goto fail_free_gpio; + } + gpio_direction_output(tai_cam_gpio_data[i].gpio, + tai_cam_gpio_data[i].value); + gpio_export(tai_cam_gpio_data[i].gpio, false); + } + + tegra_clk_init_from_table(tai_front_cam_clk_init_table); + + } else { + for (i = 0; i < ARRAY_SIZE(enterprise_cam_gpio_data); i++) { + ret = gpio_request(enterprise_cam_gpio_data[i].gpio, + enterprise_cam_gpio_data[i].label); + if (ret < 0) { + pr_err("%s: gpio_request failed for gpio #%d\n", + __func__, i); + goto fail_free_gpio; + } + gpio_direction_output(enterprise_cam_gpio_data[i].gpio, + enterprise_cam_gpio_data[i].value); + gpio_export(enterprise_cam_gpio_data[i].gpio, false); + } + } + + if (board_info.board_id == BOARD_E1205) { + if (board_info.fab == BOARD_FAB_A00 || + board_info.fab == BOARD_FAB_A01) i2c_mux = false; - else if (bi.fab == BOARD_FAB_A02) + else if (board_info.fab == BOARD_FAB_A02) i2c_mux = true; - } else if (bi.board_id == BOARD_E1197) { + } else if (board_info.board_id == BOARD_E1197) { if (cam_bi.fab == BOARD_FAB_A00) i2c_mux = false; else if (cam_bi.fab == BOARD_FAB_A01) i2c_mux = true; } - if (!i2c_mux) - i2c_register_board_info(2, ar0832_i2c2_boardinfo, - ARRAY_SIZE(ar0832_i2c2_boardinfo)); - else { + if (!i2c_mux) { + if (board_info.board_id == BOARD_E1239) { + i2c_register_board_info(2, ar0832_i2c2_boardinfo_tai, + ARRAY_SIZE(ar0832_i2c2_boardinfo)); + } else { + i2c_register_board_info(2, ar0832_i2c2_boardinfo, + ARRAY_SIZE(ar0832_i2c2_boardinfo)); + } + } else { i2c_register_board_info(2, enterprise_i2c2_boardinfo, ARRAY_SIZE(enterprise_i2c2_boardinfo)); /* @@ -623,8 +694,14 @@ static int enterprise_cam_init(void) fail_free_gpio: pr_err("%s enterprise_cam_init failed!\n", __func__); - while (i--) - gpio_free(enterprise_cam_gpio_data[i].gpio); + if (board_info.board_id == BOARD_E1239) { + while (i--) + gpio_free(tai_cam_gpio_data[i].gpio); + + } else { + while (i--) + gpio_free(enterprise_cam_gpio_data[i].gpio); + } return ret; } @@ -657,9 +734,12 @@ int __init enterprise_sensors_init(void) { int ret; + tegra_get_board_info(&board_info); + enterprise_isl_init(); enterprise_nct1008_init(); - mpuirq_init(); + if (board_info.board_id != BOARD_E1239) + mpuirq_init(); #if ENTERPRISE_INA230_ENABLED enterprise_ina230_init(); #endif diff --git a/arch/arm/mach-tegra/board-enterprise.c b/arch/arm/mach-tegra/board-enterprise.c index 0a3024f62dab..498f8a176991 100644 --- a/arch/arm/mach-tegra/board-enterprise.c +++ b/arch/arm/mach-tegra/board-enterprise.c @@ -875,18 +875,31 @@ static void enterprise_audio_init(void) tegra_get_board_info(&board_info); - if (board_info.board_id == BOARD_E1197) - enterprise_audio_pdata.i2s_param[HIFI_CODEC].audio_port_id = 1; - else if (board_info.fab == BOARD_FAB_A04) { - enterprise_audio_pdata.i2s_param[BASEBAND].audio_port_id = 4; + if (board_info.board_id == BOARD_E1239) { + enterprise_audio_aic326x_pdata.i2s_param[BASEBAND]. + audio_port_id = 4; + enterprise_audio_aic326x_pdata.i2s_param[BASEBAND]. + i2s_mode = TEGRA_DAIFMT_I2S; + enterprise_audio_aic326x_pdata.i2s_param[BASEBAND]. + channels = 2; platform_device_register(&tegra_i2s_device4); } else { - enterprise_audio_pdata.i2s_param[BASEBAND].audio_port_id = 2; - platform_device_register(&tegra_i2s_device2); - } + if (board_info.board_id == BOARD_E1197) + enterprise_audio_pdata.i2s_param[HIFI_CODEC]. + audio_port_id = 1; + else if (board_info.fab == BOARD_FAB_A04) { + enterprise_audio_pdata.i2s_param[BASEBAND]. + audio_port_id = 4; + platform_device_register(&tegra_i2s_device4); + } else { + enterprise_audio_pdata.i2s_param[BASEBAND]. + audio_port_id = 2; + platform_device_register(&tegra_i2s_device2); + } + } platform_add_devices(enterprise_audio_devices, - ARRAY_SIZE(enterprise_audio_devices)); + ARRAY_SIZE(enterprise_audio_devices)); } @@ -953,8 +966,12 @@ static struct platform_device tegra_baseband_m7400_device = { static void enterprise_baseband_init(void) { + struct board_info board_info; + int modem_id = tegra_get_modem_id(); + tegra_get_board_info(&board_info); + switch (modem_id) { case TEGRA_BB_PH450: /* PH450 ULPI */ enterprise_modem_init(); @@ -967,7 +984,13 @@ static void enterprise_baseband_init(void) &tegra_usb_hsic_host_register; tegra_baseband_power_data.hsic_unregister = &tegra_usb_hsic_host_unregister; - + if ((board_info.board_id == BOARD_E1239) && + (board_info.fab <= BOARD_FAB_A02)) { + tegra_baseband_power_data.modem. + xmm.ipc_hsic_active = BB_GPIO_LCD_PWR2; + tegra_baseband_power_data.modem. + xmm.ipc_hsic_sus_req = BB_GPIO_LCD_PWR1; + } platform_device_register(&tegra_baseband_power_device); platform_device_register(&tegra_baseband_power2_device); break; @@ -989,6 +1012,8 @@ static void enterprise_nfc_init(void) tegra_get_board_info(&bi); if (bi.board_id == BOARD_E1205 && bi.fab >= BOARD_FAB_A03) { nfc_pdata.firm_gpio = TEGRA_GPIO_PX7; + } else if (bi.board_id == BOARD_E1239) { + nfc_pdata.firm_gpio = TEGRA_GPIO_PN6; } } @@ -1009,6 +1034,9 @@ static void __init tegra_enterprise_init(void) enterprise_i2c_init(); enterprise_uart_init(); enterprise_usb_init(); + if (board_info.board_id == BOARD_E1239) + enterprise_bt_rfkill_pdata[0].shutdown_gpio = TEGRA_GPIO_PF4; + platform_add_devices(enterprise_devices, ARRAY_SIZE(enterprise_devices)); tegra_ram_console_debug_init(); enterprise_regulator_init(); diff --git a/arch/arm/mach-tegra/board-enterprise.h b/arch/arm/mach-tegra/board-enterprise.h index 3c6d149abdff..b77c3cae7346 100644 --- a/arch/arm/mach-tegra/board-enterprise.h +++ b/arch/arm/mach-tegra/board-enterprise.h @@ -28,6 +28,7 @@ /* Processor Board ID */ #define BOARD_E1205 0x0C05 #define BOARD_E1197 0x0B61 +#define BOARD_E1239 0x0C27 #define SKU_BATTERY_SUPPORT 0x1 /* Board Fab version */ @@ -113,6 +114,7 @@ void enterprise_bpc_mgmt_init(void); /* Audio-related GPIOs */ #define TEGRA_GPIO_HP_DET TEGRA_GPIO_PW3 +#define TEGRA_GPIO_CODEC_RST TEGRA_GPIO_PX0 /* Baseband GPIO addresses */ @@ -159,6 +161,7 @@ enum tegra_bb_type { }; /* Indicate the pwm of backlight, DC pwm or external pwm3. */ +/* External pwm is used for TAI (E1239) but do not set this compiler switch */ #define IS_EXTERNAL_PWM 0 #endif /*_MACH_TEGRA_BOARD_ENTERPRISE_H */ |