ARM: tegra: enterprise: Add A03/A04 support
Tom Cherry [Thu, 1 Mar 2012 01:39:50 +0000 (17:39 -0800)]
Bug 939799

Reviewed-on: http://git-master/r/90824
(cherry-picked from commit 8c556f816196c17e059db2c11b966ca89848efa3)

Change-Id: I67b26958862b8b60217c2750fe0b2eef3013d9b3
Signed-off-by: Tom Cherry <tcherry@nvidia.com>
Reviewed-on: http://git-master/r/92409
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>

arch/arm/mach-tegra/board-enterprise-memory.c
arch/arm/mach-tegra/board-enterprise-panel.c
arch/arm/mach-tegra/board-enterprise-pinmux.c
arch/arm/mach-tegra/board-enterprise-power.c
arch/arm/mach-tegra/board-enterprise.h

index ba088f0..3fb7fa9 100644 (file)
@@ -21,6 +21,7 @@
 
 #include "board-enterprise.h"
 #include "tegra3_emc.h"
+#include "board.h"
 
 
 static const struct tegra_emc_table enterprise_emc_tables_h5tc2g[] = {
@@ -748,7 +749,13 @@ static const struct tegra_emc_table enterprise_emc_tables_h5tc2g[] = {
 
 int enterprise_emc_init(void)
 {
-       tegra_init_emc(enterprise_emc_tables_h5tc2g,
-               ARRAY_SIZE(enterprise_emc_tables_h5tc2g));
+       struct board_info board_info;
+
+       tegra_get_board_info(&board_info);
+
+       if (board_info.fab == BOARD_FAB_A02)
+               tegra_init_emc(enterprise_emc_tables_h5tc2g,
+                              ARRAY_SIZE(enterprise_emc_tables_h5tc2g));
+
        return 0;
 }
index fe91867..2d5b808 100644 (file)
@@ -62,7 +62,8 @@
 #define enterprise_lcd_te              TEGRA_GPIO_PJ1
 
 #ifdef CONFIG_TEGRA_DC
-static struct regulator *enterprise_dsi_reg = NULL;
+static struct regulator *enterprise_dsi_reg;
+static struct regulator *enterprise_lcd_reg;
 
 static struct regulator *enterprise_hdmi_reg;
 static struct regulator *enterprise_hdmi_pll;
@@ -71,7 +72,7 @@ static struct regulator *enterprise_hdmi_vddio;
 
 static atomic_t sd_brightness = ATOMIC_INIT(255);
 
-static tegra_dc_bl_output enterprise_bl_output_measured = {
+static tegra_dc_bl_output enterprise_bl_output_measured_a02 = {
        1, 5, 9, 10, 11, 12, 12, 13,
        13, 14, 14, 15, 15, 16, 16, 17,
        17, 18, 18, 19, 19, 20, 21, 21,
@@ -106,6 +107,42 @@ static tegra_dc_bl_output enterprise_bl_output_measured = {
        183, 184, 185, 186, 186, 187, 188, 188
 };
 
+/* TODO: Measure BL response for this table */
+static tegra_dc_bl_output enterprise_bl_output_measured_a03 = {
+       0, 255, 255, 255, 255, 255, 255, 255,
+       255, 255, 255, 255, 255, 255, 255, 255,
+       255, 255, 255, 255, 255, 255, 255, 255,
+       255, 255, 255, 255, 255, 255, 255, 255,
+       255, 255, 255, 255, 255, 255, 255, 255,
+       255, 255, 255, 255, 255, 255, 255, 255,
+       255, 255, 255, 255, 255, 255, 255, 255,
+       255, 255, 255, 255, 255, 255, 255, 255,
+       255, 255, 255, 255, 255, 255, 255, 255,
+       255, 255, 255, 255, 255, 255, 255, 255,
+       255, 255, 255, 255, 255, 255, 255, 255,
+       255, 255, 255, 255, 255, 255, 255, 255,
+       255, 255, 255, 255, 255, 255, 255, 255,
+       255, 255, 255, 255, 255, 255, 255, 255,
+       255, 255, 255, 255, 255, 255, 255, 255,
+       255, 255, 255, 255, 255, 255, 255, 255,
+       255, 255, 255, 255, 255, 255, 255, 255,
+       255, 255, 255, 255, 255, 255, 255, 255,
+       255, 255, 255, 255, 255, 255, 255, 255,
+       255, 255, 255, 255, 255, 255, 255, 255,
+       255, 255, 255, 255, 255, 255, 255, 255,
+       255, 255, 255, 255, 255, 255, 255, 255,
+       255, 255, 255, 255, 255, 255, 255, 255,
+       255, 255, 255, 255, 255, 255, 255, 255,
+       255, 255, 255, 255, 255, 255, 255, 255,
+       255, 255, 255, 255, 255, 255, 255, 255,
+       255, 255, 255, 255, 255, 255, 255, 255,
+       255, 255, 255, 255, 255, 255, 255, 255,
+       255, 255, 255, 255, 255, 255, 255, 255,
+       255, 255, 255, 255, 255, 255, 255, 255,
+       255, 255, 255, 255, 255, 255, 255, 255,
+       255, 255, 255, 255, 255, 255, 255, 255,
+};
+
 static p_tegra_dc_bl_output bl_output;
 
 static bool kernel_1st_panel_init = true;
@@ -421,6 +458,9 @@ static struct tegra_dc_platform_data enterprise_disp2_pdata = {
 static int enterprise_dsi_panel_enable(void)
 {
        int ret;
+       struct board_info board_info;
+
+       tegra_get_board_info(&board_info);
 
        if (enterprise_dsi_reg == NULL) {
                enterprise_dsi_reg = regulator_get(NULL, "avdd_dsi_csi");
@@ -438,6 +478,26 @@ static int enterprise_dsi_panel_enable(void)
        }
 
 #if DSI_PANEL_RESET
+
+       if (board_info.fab >= BOARD_FAB_A03) {
+               if (enterprise_lcd_reg == NULL) {
+                       enterprise_lcd_reg = regulator_get(NULL, "lcd_vddio_en");
+                       if (IS_ERR_OR_NULL(enterprise_lcd_reg)) {
+                               pr_err("Could not get regulator lcd_vddio_en\n");
+                               ret = PTR_ERR(enterprise_lcd_reg);
+                               enterprise_lcd_reg = NULL;
+                               return ret;
+                       }
+               }
+               if (enterprise_lcd_reg != NULL) {
+                       ret = regulator_enable(enterprise_lcd_reg);
+                       if (ret < 0) {
+                               pr_err("Could not enable lcd_vddio_en\n");
+                               return ret;
+                       }
+               }
+       }
+
        if (kernel_1st_panel_init != true) {
                ret = gpio_request(enterprise_dsi_panel_reset, "panel reset");
                if (ret < 0)
@@ -462,6 +522,9 @@ static int enterprise_dsi_panel_enable(void)
 
 static int enterprise_dsi_panel_disable(void)
 {
+       if (enterprise_lcd_reg != NULL)
+               regulator_disable(enterprise_lcd_reg);
+
 #if DSI_PANEL_RESET
        if (kernel_1st_panel_init != true) {
                tegra_gpio_disable(enterprise_dsi_panel_reset);
@@ -750,11 +813,17 @@ int __init enterprise_panel_init(void)
 {
        int err;
        struct resource __maybe_unused *res;
+       struct board_info board_info;
 
-       bl_output = enterprise_bl_output_measured;
+       tegra_get_board_info(&board_info);
 
-       if (WARN_ON(ARRAY_SIZE(enterprise_bl_output_measured) != 256))
-               pr_err("bl_output array does not have 256 elements\n");
+       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)
+               bl_output = enterprise_bl_output_measured_a03;
+       else
+               bl_output = enterprise_bl_output_measured_a02;
 
        enterprise_dsi.chip_id = tegra_get_chipid();
        enterprise_dsi.chip_rev = tegra_get_revision();
index 7bcb2b4..8d18e32 100644 (file)
@@ -134,7 +134,7 @@ static __initdata struct tegra_drive_pingroup_config enterprise_drive_pinmux[] =
                .ioreset        = TEGRA_PIN_IO_RESET_##_ioreset \
        }
 
-static __initdata struct tegra_pingroup_config enterprise_pinmux[] = {
+static __initdata struct tegra_pingroup_config enterprise_pinmux_common[] = {
        /* SDMMC1 pinmux */
        DEFAULT_PINMUX(SDMMC1_CLK,      SDMMC1,          NORMAL,     NORMAL,     INPUT),
        DEFAULT_PINMUX(SDMMC1_CMD,      SDMMC1,          PULL_UP,    NORMAL,     INPUT),
@@ -357,7 +357,12 @@ static __initdata struct tegra_pingroup_config enterprise_pinmux[] = {
        VI_PINMUX(VI_VSYNC,        RSVD1,           NORMAL,    NORMAL,     INPUT,  DISABLE, DISABLE),
 };
 
-static __initdata struct tegra_pingroup_config enterprise_unused_pinmux[] = {
+static __initdata struct tegra_pingroup_config enterprise_pinmux_a03[] = {
+       DEFAULT_PINMUX(LCD_PWR0,        DISPLAYA,        NORMAL,    NORMAL,     OUTPUT),
+       DEFAULT_PINMUX(LCD_D10,         DISPLAYA,        NORMAL,    NORMAL,     OUTPUT),
+};
+
+static __initdata struct tegra_pingroup_config enterprise_unused_pinmux_common[] = {
        DEFAULT_PINMUX(CLK2_OUT,       EXTPERIPH2,       PULL_DOWN,    TRISTATE,  OUTPUT),
        DEFAULT_PINMUX(CLK2_REQ,       DAP,              PULL_DOWN,    TRISTATE,  OUTPUT),
        DEFAULT_PINMUX(CLK3_OUT,       EXTPERIPH3,       PULL_DOWN,    TRISTATE,  OUTPUT),
@@ -396,8 +401,6 @@ static __initdata struct tegra_pingroup_config enterprise_unused_pinmux[] = {
        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_D10,         DISPLAYA,        PULL_DOWN,    TRISTATE,  OUTPUT),
-       DEFAULT_PINMUX(LCD_PWR0,        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),
@@ -415,6 +418,11 @@ static __initdata struct tegra_pingroup_config enterprise_unused_pinmux[] = {
        DEFAULT_PINMUX(SPI2_MISO,       SPI2,            PULL_DOWN,    TRISTATE,  OUTPUT),
 };
 
+static __initdata struct tegra_pingroup_config enterprise_unused_pinmux_a02[] = {
+       DEFAULT_PINMUX(LCD_D10,         DISPLAYA,        PULL_DOWN,    TRISTATE,  OUTPUT),
+       DEFAULT_PINMUX(LCD_PWR0,        DISPLAYA,        PULL_DOWN,    TRISTATE,  OUTPUT),
+};
+
 static struct tegra_gpio_table gpio_table[] = {
        { .gpio = TEGRA_GPIO_HP_DET,            .enable = true  },
 };
@@ -435,7 +443,7 @@ struct pin_info_low_power_mode {
                .is_input       = _is_input,    \
                .value          = _value,       \
        }
-static __initdata struct pin_info_low_power_mode enterprise_unused_gpio_pins[] = {
+static __initdata struct pin_info_low_power_mode enterprise_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_OUT",     TEGRA_GPIO_PEE0,  0, 0),
@@ -475,8 +483,6 @@ static __initdata struct pin_info_low_power_mode enterprise_unused_gpio_pins[] =
        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_D10",      TEGRA_GPIO_PF2,  0, 0),
-       PIN_GPIO_LPM("LCD_PWR0",     TEGRA_GPIO_PB2,  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),
@@ -494,6 +500,11 @@ static __initdata struct pin_info_low_power_mode enterprise_unused_gpio_pins[] =
        PIN_GPIO_LPM("SPI2_MISO",    TEGRA_GPIO_PX1,  0, 0),
 };
 
+static __initdata struct pin_info_low_power_mode enterprise_unused_gpio_pins_a02[] = {
+       PIN_GPIO_LPM("LCD_D10",      TEGRA_GPIO_PF2,  0, 0),
+       PIN_GPIO_LPM("LCD_PWR0",     TEGRA_GPIO_PB2,  0, 0),
+};
+
 static void enterprise_set_unused_pin_gpio(struct pin_info_low_power_mode *lpm_pin_info,
                int list_count)
 {
@@ -529,14 +540,29 @@ static void enterprise_set_unused_pin_gpio(struct pin_info_low_power_mode *lpm_p
 
 int __init enterprise_pinmux_init(void)
 {
-       tegra_pinmux_config_table(enterprise_pinmux, ARRAY_SIZE(enterprise_pinmux));
+       struct board_info board_info;
+       tegra_get_board_info(&board_info);
+
+       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,
-                               ARRAY_SIZE(enterprise_unused_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,
-                       ARRAY_SIZE(enterprise_unused_gpio_pins));
+       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_unused_pinmux_a02,
+                                         ARRAY_SIZE(enterprise_unused_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,
+                                         ARRAY_SIZE(enterprise_pinmux_a03));
+       }
+
        return 0;
 }
index f34ddea..02792f4 100644 (file)
@@ -54,7 +54,7 @@
 #define PMC_DPD_PADS_ORIDE_BLINK       (1 << 20)
 
 /************************ TPS80031 based regulator ****************/
-static struct regulator_consumer_supply tps80031_vio_supply[] = {
+static struct regulator_consumer_supply tps80031_vio_supply_a02[] = {
        REGULATOR_SUPPLY("vio_1v8", NULL),
        REGULATOR_SUPPLY("avdd_osc", NULL),
        REGULATOR_SUPPLY("vddio_sys", NULL),
@@ -85,48 +85,94 @@ static struct regulator_consumer_supply tps80031_vio_supply[] = {
        REGULATOR_SUPPLY("pwrdet_pex_ctl", NULL),
 };
 
-static struct regulator_consumer_supply tps80031_smps1_supply[] = {
+static struct regulator_consumer_supply tps80031_vio_supply_a03[] = {
+       REGULATOR_SUPPLY("vio_1v8", NULL),
+       REGULATOR_SUPPLY("vddio_sys", NULL),
+       REGULATOR_SUPPLY("vddio_uart", NULL),
+       REGULATOR_SUPPLY("pwrdet_uart", NULL),
+       REGULATOR_SUPPLY("vddio_lcd", NULL),
+       REGULATOR_SUPPLY("pwrdet_lcd", NULL),
+       REGULATOR_SUPPLY("vddio_audio", NULL),
+       REGULATOR_SUPPLY("pwrdet_audio", NULL),
+       REGULATOR_SUPPLY("vddio_bb", NULL),
+       REGULATOR_SUPPLY("pwrdet_bb", NULL),
+       REGULATOR_SUPPLY("vddio_gmi", NULL),
+       REGULATOR_SUPPLY("vddio_cam", NULL),
+       REGULATOR_SUPPLY("pwrdet_cam", NULL),
+       REGULATOR_SUPPLY("vddio_sdmmc1", NULL),
+       REGULATOR_SUPPLY("pwrdet_sdmmc1", NULL),
+       REGULATOR_SUPPLY("vddio_sdmmc4", NULL),
+       REGULATOR_SUPPLY("pwrdet_sdmmc4", NULL),
+       REGULATOR_SUPPLY("avdd_hdmi_pll", NULL),
+       REGULATOR_SUPPLY("vddio_gps", NULL),
+       REGULATOR_SUPPLY("vdd_lcd_buffered", NULL),
+       REGULATOR_SUPPLY("vddio_nand", NULL),
+       REGULATOR_SUPPLY("pwrdet_nand", NULL),
+       REGULATOR_SUPPLY("vddio_sd", NULL),
+       REGULATOR_SUPPLY("vdd_bat", NULL),
+       REGULATOR_SUPPLY("vdd_io", NULL),
+       REGULATOR_SUPPLY("pwrdet_pex_ctl", NULL),
+};
+
+static struct regulator_consumer_supply tps80031_smps1_supply_common[] = {
        REGULATOR_SUPPLY("vdd_cpu", NULL),
 };
 
-static struct regulator_consumer_supply tps80031_smps2_supply[] = {
+static struct regulator_consumer_supply tps80031_smps2_supply_common[] = {
        REGULATOR_SUPPLY("vdd_core", NULL),
 };
 
-static struct regulator_consumer_supply tps80031_smps3_supply[] = {
+static struct regulator_consumer_supply tps80031_smps3_supply_common[] = {
        REGULATOR_SUPPLY("en_vddio_ddr_1v2", NULL),
        REGULATOR_SUPPLY("vddio_ddr", NULL),
        REGULATOR_SUPPLY("vdd_lpddr", NULL),
        REGULATOR_SUPPLY("ddr_comp_pu", NULL),
 };
 
-static struct regulator_consumer_supply tps80031_smps4_supply[] = {
+static struct regulator_consumer_supply tps80031_smps4_supply_a02[] = {
+       REGULATOR_SUPPLY("vddio_sdmmc_2v85", NULL),
+       REGULATOR_SUPPLY("pwrdet_sdmmc3", NULL),
+};
+
+static struct regulator_consumer_supply tps80031_smps4_supply_a03[] = {
        REGULATOR_SUPPLY("vddio_sdmmc_2v85", NULL),
        REGULATOR_SUPPLY("pwrdet_sdmmc3", NULL),
+       REGULATOR_SUPPLY("vdd_ddr_rx", NULL),
+       REGULATOR_SUPPLY("vddf_core_emmc", NULL),
 };
 
-static struct regulator_consumer_supply tps80031_vana_supply[] = {
+static struct regulator_consumer_supply tps80031_vana_supply_common[] = {
        REGULATOR_SUPPLY("unused_vana", NULL),
 };
 
-static struct regulator_consumer_supply tps80031_ldo1_supply[] = {
+static struct regulator_consumer_supply tps80031_ldo1_supply_a02[] = {
        REGULATOR_SUPPLY("avdd_dsi_csi", NULL),
        REGULATOR_SUPPLY("pwrdet_mipi", NULL),
 };
 
-static struct regulator_consumer_supply tps80031_ldo2_supply[] = {
+static struct regulator_consumer_supply tps80031_ldo1_supply_a03[] = {
+       REGULATOR_SUPPLY("vdd_ddr_hs", NULL),
+};
+
+static struct regulator_consumer_supply tps80031_ldo2_supply_common[] = {
        REGULATOR_SUPPLY("vdd_rtc", NULL),
 };
 
-static struct regulator_consumer_supply tps80031_ldo3_supply[] = {
+static struct regulator_consumer_supply tps80031_ldo3_supply_common[] = {
        REGULATOR_SUPPLY("vdd_vbrtr", NULL),
 };
 
-static struct regulator_consumer_supply tps80031_ldo4_supply[] = {
+static struct regulator_consumer_supply tps80031_ldo4_supply_a02[] = {
        REGULATOR_SUPPLY("avdd_lcd", NULL),
 };
 
-static struct regulator_consumer_supply tps80031_ldo5_supply[] = {
+static struct regulator_consumer_supply tps80031_ldo4_supply_a03[] = {
+       REGULATOR_SUPPLY("avdd_dsi_csi", NULL),
+       REGULATOR_SUPPLY("avdd_hsic", NULL),
+       REGULATOR_SUPPLY("pwrdet_mipi", NULL),
+};
+
+static struct regulator_consumer_supply tps80031_ldo5_supply_common[] = {
        REGULATOR_SUPPLY("vdd_sensor", NULL),
        REGULATOR_SUPPLY("vdd_compass", NULL),
        REGULATOR_SUPPLY("vdd_als", NULL),
@@ -135,27 +181,50 @@ static struct regulator_consumer_supply tps80031_ldo5_supply[] = {
        REGULATOR_SUPPLY("vdd_proxim_diode", NULL),
 };
 
-static struct regulator_consumer_supply tps80031_ldo6_supply[] = {
+static struct regulator_consumer_supply tps80031_ldo6_supply_a02[] = {
        REGULATOR_SUPPLY("vdd_ddr_rx", NULL),
        REGULATOR_SUPPLY("vddf_core_emmc", NULL),
 };
 
-static struct regulator_consumer_supply tps80031_ldo7_supply[] = {
+static struct regulator_consumer_supply tps80031_ldo6_supply_a03[] = {
+       REGULATOR_SUPPLY("avdd_osc", NULL),
+       REGULATOR_SUPPLY("avdd_usb_pll", NULL),
+};
+
+static struct regulator_consumer_supply tps80031_ldo7_supply_a02[] = {
        REGULATOR_SUPPLY("vdd_plla_p_c_s", NULL),
        REGULATOR_SUPPLY("vdd_pllm", NULL),
        REGULATOR_SUPPLY("vdd_pllu_d", NULL),
        REGULATOR_SUPPLY("vdd_pllx", NULL),
 };
 
-static struct regulator_consumer_supply tps80031_ldoln_supply[] = {
+static struct regulator_consumer_supply tps80031_ldo7_supply_a03[] = {
+       REGULATOR_SUPPLY("avdd_lcd", NULL),
+};
+
+static struct regulator_consumer_supply tps80031_ldoln_supply_a02[] = {
        REGULATOR_SUPPLY("vdd_ddr_hs", NULL),
 };
 
-static struct regulator_consumer_supply tps80031_ldousb_supply[] = {
+static struct regulator_consumer_supply tps80031_ldoln_supply_a03[] = {
+       REGULATOR_SUPPLY("vdd_plla_p_c_s", NULL),
+       REGULATOR_SUPPLY("vdd_pllm", NULL),
+       REGULATOR_SUPPLY("vdd_pllu_d", NULL),
+       REGULATOR_SUPPLY("vdd_pllx", NULL),
+};
+
+static struct regulator_consumer_supply tps80031_ldousb_supply_a02[] = {
        REGULATOR_SUPPLY("unused_ldousb", NULL),
 };
 
-static struct regulator_consumer_supply tps80031_vbus_supply[] = {
+static struct regulator_consumer_supply tps80031_ldousb_supply_a03[] = {
+       REGULATOR_SUPPLY("avdd_usb_hdmi_3v3", NULL),
+       REGULATOR_SUPPLY("avdd_usb", NULL),
+       REGULATOR_SUPPLY("avdd_hdmi", NULL),
+       REGULATOR_SUPPLY("vdd", "4-004c"),
+};
+
+static struct regulator_consumer_supply tps80031_vbus_supply_common[] = {
        REGULATOR_SUPPLY("usb_vbus", NULL),
 };
 
@@ -163,52 +232,60 @@ static struct regulator_consumer_supply tps80031_battery_charge_supply[] = {
        REGULATOR_SUPPLY("usb_bat_chg", NULL),
 };
 
-#define TPS_PDATA_INIT(_id, _minmv, _maxmv, _supply_reg, _always_on,   \
-       _boot_on, _apply_uv, _init_uV, _init_enable, _init_apply,       \
-       _flags, _ectrl, _delay)                                         \
-       static struct tps80031_regulator_platform_data pdata_##_id = {  \
-               .regulator = {                                          \
-                       .constraints = {                                \
-                               .min_uV = (_minmv)*1000,                \
-                               .max_uV = (_maxmv)*1000,                \
-                               .valid_modes_mask = (REGULATOR_MODE_NORMAL |  \
-                                               REGULATOR_MODE_STANDBY),      \
-                               .valid_ops_mask = (REGULATOR_CHANGE_MODE |    \
-                                               REGULATOR_CHANGE_STATUS |     \
-                                               REGULATOR_CHANGE_VOLTAGE),    \
-                               .always_on = _always_on,                \
-                               .boot_on = _boot_on,                    \
-                               .apply_uV = _apply_uv,                  \
-                       },                                              \
-                       .num_consumer_supplies =                        \
-                               ARRAY_SIZE(tps80031_##_id##_supply),    \
-                       .consumer_supplies = tps80031_##_id##_supply,   \
-                       .supply_regulator = _supply_reg,                \
-               },                                                      \
-               .init_uV =  _init_uV * 1000,                            \
-               .init_enable = _init_enable,                            \
-               .init_apply = _init_apply,                              \
-               .flags = _flags,                                        \
-               .ext_ctrl_flag = _ectrl,                                \
-               .delay_us = _delay,                                     \
+#define TPS_PDATA_INIT(_id, _sname, _minmv, _maxmv, _supply_reg, _always_on,           \
+       _boot_on, _apply_uv, _init_uV, _init_enable, _init_apply,                       \
+       _flags, _ectrl, _delay)                                                         \
+       static struct tps80031_regulator_platform_data pdata_##_id##_##_sname = {       \
+               .regulator = {                                                          \
+                       .constraints = {                                                \
+                               .min_uV = (_minmv)*1000,                                \
+                               .max_uV = (_maxmv)*1000,                                \
+                               .valid_modes_mask = (REGULATOR_MODE_NORMAL |            \
+                                               REGULATOR_MODE_STANDBY),                \
+                               .valid_ops_mask = (REGULATOR_CHANGE_MODE |              \
+                                               REGULATOR_CHANGE_STATUS |               \
+                                               REGULATOR_CHANGE_VOLTAGE),              \
+                               .always_on = _always_on,                                \
+                               .boot_on = _boot_on,                                    \
+                               .apply_uV = _apply_uv,                                  \
+                       },                                                              \
+                       .num_consumer_supplies =                                        \
+                               ARRAY_SIZE(tps80031_##_id##_supply_##_sname),           \
+                       .consumer_supplies = tps80031_##_id##_supply_##_sname,          \
+                       .supply_regulator = _supply_reg,                                \
+               },                                                                      \
+               .init_uV =  _init_uV * 1000,                                            \
+               .init_enable = _init_enable,                                            \
+               .init_apply = _init_apply,                                              \
+               .flags = _flags,                                                        \
+               .ext_ctrl_flag = _ectrl,                                                \
+               .delay_us = _delay,                                                     \
        }
 
-TPS_PDATA_INIT(vio,   600, 2100, 0, 1, 0, 0, -1, 0, 0, 0, 0, 0);
-TPS_PDATA_INIT(smps1, 600, 2100, 0, 0, 0, 0, -1, 0, 0, 0, PWR_REQ_INPUT_PREQ2 | PWR_OFF_ON_SLEEP, 0);
-TPS_PDATA_INIT(smps2, 600, 2100, 0, 0, 0, 0, -1, 0, 0, 0, PWR_REQ_INPUT_PREQ1, 0);
-TPS_PDATA_INIT(smps3, 600, 2100, 0, 1, 0, 0, -1, 0, 0, 0, 0, 0);
-TPS_PDATA_INIT(smps4, 600, 2100, 0, 0, 0, 0, -1, 0, 0, 0, PWR_REQ_INPUT_PREQ1, 0);
-TPS_PDATA_INIT(ldo1, 1000, 3300, tps80031_rails(VIO), 0, 0, 0, -1, 0, 0, 0, 0, 0);
-TPS_PDATA_INIT(ldo2, 1000, 3300, 0, 1, 1, 1, 1000, 1, 1, 0, 0, 0);
-TPS_PDATA_INIT(ldo3, 1000, 3300, tps80031_rails(VIO), 0, 0, 0, -1, 0, 0, 0, PWR_OFF_ON_SLEEP, 0);
-TPS_PDATA_INIT(ldo4, 1000, 3300, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0);
-TPS_PDATA_INIT(ldo5, 1000, 3300, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0);
-TPS_PDATA_INIT(ldo6, 1000, 3300, 0, 0, 0, 0, -1, 0, 0, 0, PWR_REQ_INPUT_PREQ1, 0);
-TPS_PDATA_INIT(ldo7, 1000, 3300, tps80031_rails(VIO), 0, 0, 0, -1, 0, 0, 0, PWR_REQ_INPUT_PREQ1, 0);
-TPS_PDATA_INIT(ldoln, 1000, 3300, tps80031_rails(SMPS3), 0, 0, 0, -1, 0, 0, 0, PWR_REQ_INPUT_PREQ1, 0);
-TPS_PDATA_INIT(ldousb, 1000, 3300, 0, 0, 0, 0, -1, 0, 0, USBLDO_INPUT_VSYS, PWR_OFF_ON_SLEEP, 0);
-TPS_PDATA_INIT(vana,  1000, 3300, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0);
-TPS_PDATA_INIT(vbus,  0, 5000, 0, 0, 0, 0, -1, 0, 0, (VBUS_SW_ONLY | VBUS_DISCHRG_EN_PDN), 0, 100000);
+TPS_PDATA_INIT(vio, a02,   600, 2100, 0, 1, 0, 0, -1, 0, 0, 0, 0, 0);
+TPS_PDATA_INIT(vio, a03,   600, 2100, 0, 1, 0, 0, -1, 0, 0, 0, 0, 0);
+TPS_PDATA_INIT(smps1, common, 600, 2100, 0, 0, 0, 0, -1, 0, 0, 0, PWR_REQ_INPUT_PREQ2 | PWR_OFF_ON_SLEEP, 0);
+TPS_PDATA_INIT(smps2, common, 600, 2100, 0, 0, 0, 0, -1, 0, 0, 0, PWR_REQ_INPUT_PREQ1, 0);
+TPS_PDATA_INIT(smps3, common, 600, 2100, 0, 1, 0, 0, -1, 0, 0, 0, 0, 0);
+TPS_PDATA_INIT(smps4, a02, 600, 2100, 0, 0, 0, 0, -1, 0, 0, 0, PWR_REQ_INPUT_PREQ1, 0);
+TPS_PDATA_INIT(smps4, a03, 600, 2100, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0);
+TPS_PDATA_INIT(ldo1, a02, 1000, 3300, tps80031_rails(VIO), 0, 0, 0, -1, 0, 0, 0, 0, 0);
+TPS_PDATA_INIT(ldo1, a03, 1000, 3300, tps80031_rails(VIO), 0, 0, 0, -1, 0, 0, 0, PWR_REQ_INPUT_PREQ1, 0);
+TPS_PDATA_INIT(ldo2, common, 1000, 3300, 0, 1, 1, 1, 1000, 1, 1, 0, 0, 0);
+TPS_PDATA_INIT(ldo3, common, 1000, 3300, tps80031_rails(VIO), 0, 0, 0, -1, 0, 0, 0, PWR_OFF_ON_SLEEP, 0);
+TPS_PDATA_INIT(ldo4, a02, 1000, 3300, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0);
+TPS_PDATA_INIT(ldo4, a03, 1000, 3300, tps80031_rails(VIO), 0, 0, 0, -1, 0, 0, 0, 0, 0);
+TPS_PDATA_INIT(ldo5, common, 1000, 3300, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0);
+TPS_PDATA_INIT(ldo6, a02, 1000, 3300, 0, 0, 0, 0, -1, 0, 0, 0, PWR_REQ_INPUT_PREQ1, 0);
+TPS_PDATA_INIT(ldo6, a03, 1000, 3300, 0, 0, 0, 0, -1, 0, 0, 0, PWR_REQ_INPUT_PREQ1, 0);
+TPS_PDATA_INIT(ldo7, a02, 1000, 3300, tps80031_rails(VIO), 0, 0, 0, -1, 0, 0, 0, PWR_REQ_INPUT_PREQ1, 0);
+TPS_PDATA_INIT(ldo7, a03, 1000, 3300, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0);
+TPS_PDATA_INIT(ldoln, a02, 1000, 3300, tps80031_rails(SMPS3), 0, 0, 0, -1, 0, 0, 0, PWR_REQ_INPUT_PREQ1, 0);
+TPS_PDATA_INIT(ldoln, a03, 1000, 3300, tps80031_rails(VIO), 0, 0, 0, -1, 0, 0, 0, PWR_REQ_INPUT_PREQ1, 0);
+TPS_PDATA_INIT(ldousb, a02, 1000, 3300, 0, 0, 0, 0, -1, 0, 0, USBLDO_INPUT_VSYS, PWR_OFF_ON_SLEEP, 0);
+TPS_PDATA_INIT(ldousb, a03, 1000, 3300, 0, 0, 0, 0, -1, 0, 0, USBLDO_INPUT_VSYS, PWR_OFF_ON_SLEEP, 0);
+TPS_PDATA_INIT(vana, common,  1000, 3300, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0);
+TPS_PDATA_INIT(vbus, common,  0, 5000, 0, 0, 0, 0, -1, 0, 0, (VBUS_SW_ONLY | VBUS_DISCHRG_EN_PDN), 0, 100000);
 
 static struct tps80031_rtc_platform_data rtc_data = {
        .irq = ENT_TPS80031_IRQ_BASE + TPS80031_INT_RTC_ALARM,
@@ -259,11 +336,11 @@ static struct tps80031_bg_platform_data battery_gauge_data = {
                .platform_data = &rtc_data,     \
        }
 
-#define TPS_REG(_id, _data)                            \
-       {                                               \
-               .id      = TPS80031_ID_##_id,           \
-               .name   = "tps80031-regulator",         \
-               .platform_data  = &pdata_##_data,       \
+#define TPS_REG(_id, _data, _sname)                            \
+       {                                                       \
+               .id      = TPS80031_ID_##_id,                   \
+               .name   = "tps80031-regulator",                 \
+               .platform_data  = &pdata_##_data##_##_sname,    \
        }
 #define TPS_BATTERY()                                  \
        {                                               \
@@ -280,27 +357,45 @@ static struct tps80031_bg_platform_data battery_gauge_data = {
                .name   = "tps80031-gpadc",             \
        }
 
-static struct tps80031_subdev_info tps80031_devs[] = {
-       TPS_REG(VIO, vio),
-       TPS_REG(SMPS1, smps1),
-       TPS_REG(SMPS2, smps2),
-       TPS_REG(SMPS3, smps3),
-       TPS_REG(SMPS4, smps4),
-       TPS_REG(LDO1, ldo1),
-       TPS_REG(LDO2, ldo2),
-       TPS_REG(LDO3, ldo3),
-       TPS_REG(LDO4, ldo4),
-       TPS_REG(LDO5, ldo5),
-       TPS_REG(LDO6, ldo6),
-       TPS_REG(LDO7, ldo7),
-       TPS_REG(LDOLN, ldoln),
-       TPS_REG(LDOUSB, ldousb),
-       TPS_REG(VANA, vana),
-       TPS_REG(VBUS, vbus),
-       TPS_RTC(),
-       TPS_BATTERY(),
-       TPS_BATTERY_GAUGE(),
-       TPS_GPADC(),
+#define TPS80031_DEVS_COMMON           \
+       TPS_REG(SMPS1, smps1, common),  \
+       TPS_REG(SMPS2, smps2, common),  \
+       TPS_REG(SMPS3, smps3, common),  \
+       TPS_REG(VANA, vana, common),    \
+       TPS_REG(LDO2, ldo2, common),    \
+       TPS_REG(LDO3, ldo3, common),    \
+       TPS_REG(LDO5, ldo5, common),    \
+       TPS_REG(VBUS, vbus, common),    \
+       TPS_RTC(),                      \
+       TPS_BATTERY(),                  \
+       TPS_BATTERY_GAUGE(),            \
+       TPS_GPADC()
+
+
+static struct tps80031_subdev_info tps80031_devs_a02[] = {
+       TPS80031_DEVS_COMMON,
+       TPS_REG(VIO, vio, a02),
+       TPS_REG(SMPS4, smps4, a02),
+       TPS_REG(LDO1, ldo1, a02),
+       TPS_REG(LDO4, ldo4, a02),
+       TPS_REG(LDO6, ldo6, a02),
+       TPS_REG(LDO7, ldo7, a02),
+       TPS_REG(LDOLN, ldoln, a02),
+       TPS_REG(LDOUSB, ldousb, a02),
+
+};
+
+static struct tps80031_subdev_info tps80031_devs_a03[] = {
+       TPS80031_DEVS_COMMON,
+       TPS_REG(VIO, vio, a03),
+       TPS_REG(SMPS4, smps4, a03),
+       TPS_REG(LDO1, ldo1, a03),
+       TPS_REG(LDO4, ldo4, a03),
+       TPS_REG(LDO6, ldo6, a03),
+       TPS_REG(LDO7, ldo7, a03),
+       TPS_REG(LDOLN, ldoln, a03),
+       TPS_REG(LDOUSB, ldousb, a03),
+
 };
 
 struct tps80031_clk32k_init_data clk32k_idata[] = {
@@ -317,8 +412,6 @@ struct tps80031_clk32k_init_data clk32k_idata[] = {
 };
 
 static struct tps80031_platform_data tps_platform = {
-       .num_subdevs    = ARRAY_SIZE(tps80031_devs),
-       .subdevs        = tps80031_devs,
        .irq_base       = ENT_TPS80031_IRQ_BASE,
        .gpio_base      = ENT_TPS80031_GPIO_BASE,
        .clk32k_init_data       = clk32k_idata,
@@ -402,6 +495,17 @@ static struct regulator_consumer_supply fixed_reg_cam_ldo_1v8_en_supply[] = {
        REGULATOR_SUPPLY("vdd", "7-0036"),
 };
 
+/* LCD-D10 (GPIO F2) from T30*/
+static struct regulator_consumer_supply fixed_reg_vdd_sdmmc3_2v85_en_supply[] = {
+       REGULATOR_SUPPLY("en_vdd_sdmmc3", NULL),
+       REGULATOR_SUPPLY("vddio_sd_slot", "sdhci-tegra.2"),
+};
+
+/* LCD_PWR0 (GPIO B2) from T30*/
+static struct regulator_consumer_supply fixed_reg_lcd_1v8_en_supply[] = {
+       REGULATOR_SUPPLY("lcd_vddio_en", NULL),
+};
+
 static struct gpio_regulator_state gpio_reg_sdmmc3_vdd_sel_states[] = {
        {
                .gpios = 0,
@@ -502,8 +606,6 @@ GPIO_REG(4, sdmmc3_vdd_sel,  tps80031_rails(SMPS4),
 
 FIXED_REG(0, pmu_5v15_en,     NULL,
                ENT_TPS80031_GPIO_REGEN1, true, 5000, 0 );
-FIXED_REG(1, pmu_3v3_en,      "fixed_reg_pmu_5v15_en",
-               ENT_TPS80031_GPIO_REGEN2, true, 3300, 0);
 FIXED_REG(2, pmu_hdmi_5v0_en, "fixed_reg_pmu_5v15_en",
                ENT_TPS80031_GPIO_SYSEN, true, 5000, 0);
 FIXED_REG(3, vdd_fuse_en,     "fixed_reg_pmu_3v3_en",
@@ -513,14 +615,34 @@ FIXED_REG(5, cam_ldo_2v8_en,  NULL,
 FIXED_REG(6, cam_ldo_1v8_en,  NULL,
                TEGRA_GPIO_PF1, true, 1800, 0);
 
+/* Enterprise A02- specific */
+FIXED_REG(1, pmu_3v3_en,      "fixed_reg_pmu_5v15_en",
+               ENT_TPS80031_GPIO_REGEN2, true, 3300, 0);
+
+/* Enterprise A03+ specific */
+FIXED_REG(7, vdd_sdmmc3_2v85_en,  NULL,
+               TEGRA_GPIO_PF2, true, 2850, 0);
+FIXED_REG(8, lcd_1v8_en,  NULL,
+               TEGRA_GPIO_PB2, true, 1800, 0);
+
 #define ADD_FIXED_REG(_name)   (&fixed_reg_##_name##_dev)
-static struct platform_device *fixed_regs_devices[] = {
-       ADD_FIXED_REG(pmu_5v15_en),
+
+#define FIXED_REGS_COMMON              \
+       ADD_FIXED_REG(pmu_5v15_en),     \
+       ADD_FIXED_REG(pmu_hdmi_5v0_en), \
+       ADD_FIXED_REG(vdd_fuse_en),     \
+       ADD_FIXED_REG(cam_ldo_2v8_en),  \
+       ADD_FIXED_REG(cam_ldo_1v8_en)
+
+static struct platform_device *fixed_regs_devices_a02[] = {
+       FIXED_REGS_COMMON,
        ADD_FIXED_REG(pmu_3v3_en),
-       ADD_FIXED_REG(pmu_hdmi_5v0_en),
-       ADD_FIXED_REG(vdd_fuse_en),
-       ADD_FIXED_REG(cam_ldo_2v8_en),
-       ADD_FIXED_REG(cam_ldo_1v8_en),
+};
+
+static struct platform_device *fixed_regs_devices_a03[] = {
+       FIXED_REGS_COMMON,
+       ADD_FIXED_REG(vdd_sdmmc3_2v85_en),
+       ADD_FIXED_REG(lcd_1v8_en),
 };
 
 #define ADD_GPIO_REG(_name) (&gpio_reg_##_name##_dev)
@@ -531,15 +653,27 @@ static struct platform_device *gpio_regs_devices[] = {
 static int __init enterprise_fixed_regulator_init(void)
 {
        int i;
+       struct board_info board_info;
+       struct platform_device **fixed_regs_devices;
+       int nfixreg_devs;
+
+       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);
+       } else {
+               fixed_regs_devices = fixed_regs_devices_a03;
+               nfixreg_devs = ARRAY_SIZE(fixed_regs_devices_a03);
+       }
 
-       for (i = 0; i < ARRAY_SIZE(fixed_regs_devices); ++i) {
+       for (i = 0; i < nfixreg_devs; ++i) {
                struct fixed_voltage_config *fixed_reg_pdata =
                                fixed_regs_devices[i]->dev.platform_data;
                if (fixed_reg_pdata->gpio < TEGRA_NR_GPIOS)
                        tegra_gpio_enable(fixed_reg_pdata->gpio);
        }
-       return platform_add_devices(fixed_regs_devices,
-                               ARRAY_SIZE(fixed_regs_devices));
+       return platform_add_devices(fixed_regs_devices, nfixreg_devs);
 }
 
 static int __init enterprise_gpio_regulator_init(void)
@@ -579,6 +713,9 @@ int __init enterprise_regulator_init(void)
        void __iomem *pmc = IO_ADDRESS(TEGRA_PMC_BASE);
        u32 pmc_ctrl;
        u32 pmc_dpd_pads;
+       struct board_info board_info;
+
+       tegra_get_board_info(&board_info);
 
        /* configure the power management controller to trigger PMU
         * interrupts when low */
@@ -596,6 +733,14 @@ int __init enterprise_regulator_init(void)
                battery_gauge_data.battery_present = 0;
        }
 
+       if (board_info.fab < BOARD_FAB_A03) {
+               tps_platform.num_subdevs = ARRAY_SIZE(tps80031_devs_a02);
+               tps_platform.subdevs = tps80031_devs_a02;
+       } else {
+               tps_platform.num_subdevs = ARRAY_SIZE(tps80031_devs_a03);
+               tps_platform.subdevs = tps80031_devs_a03;
+       }
+
        i2c_register_board_info(4, enterprise_regulators, 1);
        return 0;
 }
index 3d86fe6..f476720 100644 (file)
@@ -34,6 +34,8 @@
 #define BOARD_FAB_A00          0x0
 #define BOARD_FAB_A01          0x1
 #define BOARD_FAB_A02          0x2
+#define BOARD_FAB_A03          0x3
+#define BOARD_FAB_A04          0x4
 
 /* vdd_cpu voltage follower */
 #define BOARD_SKU_VF_BIT       0x0400