ARM: tegra: integration of slave mode support.
[linux-2.6.git] / arch / arm / mach-tegra / board-enterprise.c
index 6a6ab5d..fcb00a1 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * arch/arm/mach-tegra/board-enterprise.c
  *
- * Copyright (c) 2011, NVIDIA Corporation.
+ * Copyright (c) 2011-2012, NVIDIA Corporation.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
 #include <linux/platform_data/tegra_usb.h>
 #include <linux/spi/spi.h>
 #include <linux/tegra_uart.h>
+#include <linux/fsl_devices.h>
+#include <linux/i2c/atmel_mxt_ts.h>
+#include <linux/memblock.h>
+#include <linux/rfkill-gpio.h>
+#include <linux/nfc/pn544.h>
+
+#include <sound/max98088.h>
+
+#include <asm/hardware/gic.h>
 
 #include <mach/clk.h>
 #include <mach/iomap.h>
 #include <mach/pinmux.h>
 #include <mach/iomap.h>
 #include <mach/io.h>
+#include <mach/io_dpd.h>
+#include <mach/usb_phy.h>
+#include <mach/i2s.h>
+#include <mach/tegra_asoc_pdata.h>
+#include <mach/thermal.h>
+#include <mach/tegra-bb-power.h>
+#include <mach/gpio-tegra.h>
+#include <mach/tegra_fiq_debugger.h>
+
 #include <asm/mach-types.h>
+#include <asm/hardware/gic.h>
 #include <asm/mach/arch.h>
-#include <mach/usb_phy.h>
 
 #include "board.h"
 #include "clock.h"
 #include "board-enterprise.h"
+#include "baseband-xmm-power.h"
 #include "devices.h"
 #include "gpio-names.h"
 #include "fuse.h"
+#include "pm.h"
+#include "common.h"
 
-
-/* !!!TODO: Change for enterprise (Taken from Cardhu) */
-static struct tegra_utmip_config utmi_phy_config[] = {
-       [0] = {
-                       .hssync_start_delay = 0,
-                       .idle_wait_delay = 17,
-                       .elastic_limit = 16,
-                       .term_range_adj = 6,
-                       .xcvr_setup = 15,
-                       .xcvr_lsfslew = 2,
-                       .xcvr_lsrslew = 2,
-       },
-       [1] = {
-                       .hssync_start_delay = 0,
-                       .idle_wait_delay = 17,
-                       .elastic_limit = 16,
-                       .term_range_adj = 6,
-                       .xcvr_setup = 15,
-                       .xcvr_lsfslew = 2,
-                       .xcvr_lsrslew = 2,
+static struct balanced_throttle throttle_list[] = {
+       {
+               .id = BALANCED_THROTTLE_ID_TJ,
+               .throt_tab_size = 10,
+               .throt_tab = {
+                       {      0, 1000 },
+                       { 640000, 1000 },
+                       { 640000, 1000 },
+                       { 640000, 1000 },
+                       { 640000, 1000 },
+                       { 640000, 1000 },
+                       { 760000, 1000 },
+                       { 760000, 1050 },
+                       {1000000, 1050 },
+                       {1000000, 1100 },
+               },
        },
-       [2] = {
-                       .hssync_start_delay = 0,
-                       .idle_wait_delay = 17,
-                       .elastic_limit = 16,
-                       .term_range_adj = 6,
-                       .xcvr_setup = 8,
-                       .xcvr_lsfslew = 2,
-                       .xcvr_lsrslew = 2,
+#ifdef CONFIG_TEGRA_SKIN_THROTTLE
+       {
+               .id = BALANCED_THROTTLE_ID_SKIN,
+               .throt_tab_size = 6,
+               .throt_tab = {
+                       { 640000, 1200 },
+                       { 640000, 1200 },
+                       { 760000, 1200 },
+                       { 760000, 1200 },
+                       {1000000, 1200 },
+                       {1000000, 1200 },
+               },
        },
+#endif
+};
+
+/* All units are in millicelsius */
+static struct tegra_thermal_data thermal_data = {
+       .shutdown_device_id = THERMAL_DEVICE_ID_NCT_EXT,
+       .temp_shutdown = 90000,
+#if defined(CONFIG_TEGRA_EDP_LIMITS) || defined(CONFIG_TEGRA_THERMAL_THROTTLE)
+       .throttle_edp_device_id = THERMAL_DEVICE_ID_NCT_EXT,
+#endif
+#ifdef CONFIG_TEGRA_EDP_LIMITS
+       .edp_offset = TDIODE_OFFSET,  /* edp based on tdiode */
+       .hysteresis_edp = 3000,
+#endif
+#ifdef CONFIG_TEGRA_THERMAL_THROTTLE
+       .temp_throttle = 85000,
+       .tc1 = 0,
+       .tc2 = 1,
+       .passive_delay = 2000,
+#endif
+#ifdef CONFIG_TEGRA_SKIN_THROTTLE
+       .skin_device_id = THERMAL_DEVICE_ID_SKIN,
+       .temp_throttle_skin = 43000,
+#endif
 };
 
-#ifdef CONFIG_BCM4329_RFKILL
-static struct resource enterprise_bcm4329_rfkill_resources[] = {
+static struct rfkill_gpio_platform_data enterprise_bt_rfkill_pdata[] = {
        {
-               .name   = "bcm4329_nshutdown_gpio",
-               .start  = TEGRA_GPIO_PE6,
-               .end    = TEGRA_GPIO_PE6,
-               .flags  = IORESOURCE_IO,
+               .name           = "bt_rfkill",
+               .shutdown_gpio  = TEGRA_GPIO_PE6,
+               .reset_gpio     = TEGRA_GPIO_INVALID,
+               .type           = RFKILL_TYPE_BLUETOOTH,
        },
 };
 
-static struct platform_device enterprise_bcm4329_rfkill_device = {
-       .name = "bcm4329_rfkill",
+static struct platform_device enterprise_bt_rfkill_device = {
+       .name = "rfkill_gpio",
        .id             = -1,
-       .num_resources  = ARRAY_SIZE(enterprise_bcm4329_rfkill_resources),
-       .resource       = enterprise_bcm4329_rfkill_resources,
+       .dev = {
+               .platform_data = &enterprise_bt_rfkill_pdata,
+       },
 };
 
-static noinline void __init enterprise_bt_rfkill(void)
-{
-       platform_device_register(&enterprise_bcm4329_rfkill_device);
+static struct resource enterprise_bluesleep_resources[] = {
+       [0] = {
+               .name = "gpio_host_wake",
+                       .start  = TEGRA_GPIO_PS2,
+                       .end    = TEGRA_GPIO_PS2,
+                       .flags  = IORESOURCE_IO,
+       },
+       [1] = {
+               .name = "gpio_ext_wake",
+                       .start  = TEGRA_GPIO_PE7,
+                       .end    = TEGRA_GPIO_PE7,
+                       .flags  = IORESOURCE_IO,
+       },
+       [2] = {
+               .name = "host_wake",
+                       .flags  = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
+       },
+};
+
+static struct platform_device enterprise_bluesleep_device = {
+       .name           = "bluesleep",
+       .id             = -1,
+       .num_resources  = ARRAY_SIZE(enterprise_bluesleep_resources),
+       .resource       = enterprise_bluesleep_resources,
+};
 
+static void __init enterprise_setup_bluesleep(void)
+{
+       enterprise_bluesleep_resources[2].start =
+               enterprise_bluesleep_resources[2].end =
+                       gpio_to_irq(TEGRA_GPIO_PS2);
+       platform_device_register(&enterprise_bluesleep_device);
        return;
 }
-#else
-static inline void enterprise_bt_rfkill(void) { }
-#endif
 
 static __initdata struct tegra_clk_init_table enterprise_clk_init_table[] = {
        /* name         parent          rate            enabled */
-       { "pll_m",      NULL,           0,              true},
+       { "pll_m",      NULL,           0,              false},
        { "hda",        "pll_p",        108000000,      false},
        { "hda2codec_2x","pll_p",       48000000,       false},
-       { "pwm",        "clk_32k",      32768,          false},
+       { "pwm",        "pll_p",        3187500,        false},
        { "blink",      "clk_32k",      32768,          true},
-       { "pll_a",      NULL,           564480000,      false},
-       { "pll_a_out0", NULL,           11289600,       false},
+       { "i2s0",       "pll_a_out0",   0,              false},
+       { "i2s1",       "pll_a_out0",   0,              false},
+       { "i2s2",       "pll_a_out0",   0,              false},
+       { "i2s3",       "pll_a_out0",   0,              false},
+       { "spdif_out",  "pll_a_out0",   0,              false},
+       { "d_audio",    "clk_m",        12000000,       false},
+       { "dam0",       "clk_m",        12000000,       false},
+       { "dam1",       "clk_m",        12000000,       false},
+       { "dam2",       "clk_m",        12000000,       false},
+       { "audio0",     "i2s0_sync",    0,              false},
+       { "audio1",     "i2s1_sync",    0,              false},
+       { "audio2",     "i2s2_sync",    0,              false},
+       { "audio3",     "i2s3_sync",    0,              false},
+       { "vi",         "pll_p",        0,              false},
+       { "vi_sensor",  "pll_p",        0,              false},
        { NULL,         NULL,           0,              0},
 };
 
-static struct i2c_board_info __initdata enterprise_i2c_bus1_board_info[] = {
-       {
-               I2C_BOARD_INFO("wm8903", 0x1a),
-       },
-};
-
 static struct tegra_i2c_platform_data enterprise_i2c1_platform_data = {
        .adapter_nr     = 0,
        .bus_count      = 1,
        .bus_clk_rate   = { 100000, 0 },
+       .scl_gpio               = {TEGRA_GPIO_PC4, 0},
+       .sda_gpio               = {TEGRA_GPIO_PC5, 0},
+       .arb_recovery = arb_lost_recovery,
 };
 
 static struct tegra_i2c_platform_data enterprise_i2c2_platform_data = {
        .adapter_nr     = 1,
        .bus_count      = 1,
-       .bus_clk_rate   = { 100000, 0 },
+       .bus_clk_rate   = { 400000, 0 },
        .is_clkon_always = true,
+       .scl_gpio               = {TEGRA_GPIO_PT5, 0},
+       .sda_gpio               = {TEGRA_GPIO_PT6, 0},
+       .arb_recovery = arb_lost_recovery,
 };
 
 static struct tegra_i2c_platform_data enterprise_i2c3_platform_data = {
        .adapter_nr     = 2,
        .bus_count      = 1,
-       .bus_clk_rate   = { 100000, 0 },
+       .bus_clk_rate   = { 271000, 0 },
+       .scl_gpio               = {TEGRA_GPIO_PBB1, 0},
+       .sda_gpio               = {TEGRA_GPIO_PBB2, 0},
+       .arb_recovery = arb_lost_recovery,
 };
 
 static struct tegra_i2c_platform_data enterprise_i2c4_platform_data = {
        .adapter_nr     = 3,
        .bus_count      = 1,
-       .bus_clk_rate   = { 100000, 0 },
+       .bus_clk_rate   = { 10000, 0 },
+       .scl_gpio               = {TEGRA_GPIO_PV4, 0},
+       .sda_gpio               = {TEGRA_GPIO_PV5, 0},
+       .arb_recovery = arb_lost_recovery,
 };
 
 static struct tegra_i2c_platform_data enterprise_i2c5_platform_data = {
        .adapter_nr     = 4,
        .bus_count      = 1,
-       .bus_clk_rate   = { 100000, 0 },
+       .bus_clk_rate   = { 400000, 0 },
+       .scl_gpio               = {TEGRA_GPIO_PZ6, 0},
+       .sda_gpio               = {TEGRA_GPIO_PZ7, 0},
+       .arb_recovery = arb_lost_recovery,
+};
+
+/* Equalizer filter coefs generated from the MAXIM MAX98088
+ * evkit software tool */
+static struct max98088_eq_cfg max98088_eq_cfg[] = {
+       {
+               .name = "FLAT",
+               .rate = 44100,
+               .band1 = {0x2000, 0xC002, 0x4000, 0x00E9, 0x0000},
+               .band2 = {0x2000, 0xC00F, 0x4000, 0x02BC, 0x0000},
+               .band3 = {0x2000, 0xC0A7, 0x4000, 0x0916, 0x0000},
+               .band4 = {0x2000, 0xC5C2, 0x4000, 0x1A87, 0x0000},
+               .band5 = {0x2000, 0xF6B0, 0x4000, 0x3F51, 0x0000},
+       },
+       {
+               .name = "LOWPASS1K",
+               .rate = 44100,
+               .band1 = {0x205D, 0xC001, 0x3FEF, 0x002E, 0x02E0},
+               .band2 = {0x5B9A, 0xC093, 0x3AB2, 0x088B, 0x1981},
+               .band3 = {0x0D22, 0xC170, 0x26EA, 0x0D79, 0x32CF},
+               .band4 = {0x0894, 0xC612, 0x01B3, 0x1B34, 0x3FFA},
+               .band5 = {0x0815, 0x3FFF, 0xCF78, 0x0000, 0x29B7},
+       },
+       { /* BASS=-12dB, TREBLE=+9dB, Fc=5KHz */
+               .name = "HIBOOST",
+               .rate = 44100,
+               .band1 = {0x0815, 0xC001, 0x3AA4, 0x0003, 0x19A2},
+               .band2 = {0x0815, 0xC103, 0x092F, 0x0B55, 0x3F56},
+               .band3 = {0x0E0A, 0xC306, 0x1E5C, 0x136E, 0x3856},
+               .band4 = {0x2459, 0xF665, 0x0CAA, 0x3F46, 0x3EBB},
+               .band5 = {0x5BBB, 0x3FFF, 0xCEB0, 0x0000, 0x28CA},
+       },
+       { /* BASS=12dB, TREBLE=+12dB */
+               .name = "LOUD12DB",
+               .rate = 44100,
+               .band1 = {0x7FC1, 0xC001, 0x3EE8, 0x0020, 0x0BC7},
+               .band2 = {0x51E9, 0xC016, 0x3C7C, 0x033F, 0x14E9},
+               .band3 = {0x1745, 0xC12C, 0x1680, 0x0C2F, 0x3BE9},
+               .band4 = {0x4536, 0xD7E2, 0x0ED4, 0x31DD, 0x3E42},
+               .band5 = {0x7FEF, 0x3FFF, 0x0BAB, 0x0000, 0x3EED},
+       },
+       {
+               .name = "FLAT",
+               .rate = 16000,
+               .band1 = {0x2000, 0xC004, 0x4000, 0x0141, 0x0000},
+               .band2 = {0x2000, 0xC033, 0x4000, 0x0505, 0x0000},
+               .band3 = {0x2000, 0xC268, 0x4000, 0x115F, 0x0000},
+               .band4 = {0x2000, 0xDA62, 0x4000, 0x33C6, 0x0000},
+               .band5 = {0x2000, 0x4000, 0x4000, 0x0000, 0x0000},
+       },
+       {
+               .name = "LOWPASS1K",
+               .rate = 16000,
+               .band1 = {0x2000, 0xC004, 0x4000, 0x0141, 0x0000},
+               .band2 = {0x5BE8, 0xC3E0, 0x3307, 0x15ED, 0x26A0},
+               .band3 = {0x0F71, 0xD15A, 0x08B3, 0x2BD0, 0x3F67},
+               .band4 = {0x0815, 0x3FFF, 0xCF78, 0x0000, 0x29B7},
+               .band5 = {0x0815, 0x3FFF, 0xCF78, 0x0000, 0x29B7},
+       },
+       { /* BASS=-12dB, TREBLE=+9dB, Fc=2KHz */
+               .name = "HIBOOST",
+               .rate = 16000,
+               .band1 = {0x0815, 0xC001, 0x3BD2, 0x0009, 0x16BF},
+               .band2 = {0x080E, 0xC17E, 0xF653, 0x0DBD, 0x3F43},
+               .band3 = {0x0F80, 0xDF45, 0xEE33, 0x36FE, 0x3D79},
+               .band4 = {0x590B, 0x3FF0, 0xE882, 0x02BD, 0x3B87},
+               .band5 = {0x4C87, 0xF3D0, 0x063F, 0x3ED4, 0x3FB1},
+       },
+       { /* BASS=12dB, TREBLE=+12dB */
+               .name = "LOUD12DB",
+               .rate = 16000,
+               .band1 = {0x7FC1, 0xC001, 0x3D07, 0x0058, 0x1344},
+               .band2 = {0x2DA6, 0xC013, 0x3CF1, 0x02FF, 0x138B},
+               .band3 = {0x18F1, 0xC08E, 0x244D, 0x0863, 0x34B5},
+               .band4 = {0x2BE0, 0xF385, 0x04FD, 0x3EC5, 0x3FCE},
+               .band5 = {0x7FEF, 0x4000, 0x0BAB, 0x0000, 0x3EED},
+       },
+};
+
+
+static struct max98088_pdata enterprise_max98088_pdata = {
+       /* equalizer configuration */
+       .eq_cfg = max98088_eq_cfg,
+       .eq_cfgcnt = ARRAY_SIZE(max98088_eq_cfg),
+
+       /* debounce time */
+       .debounce_time_ms = 200,
+
+       /* microphone configuration */
+       .digmic_left_mode = 1,
+       .digmic_right_mode = 1,
+
+       /* receiver output configuration */
+       .receiver_mode = 0,     /* 0 = amplifier, 1 = line output */
+};
+
+static struct pn544_i2c_platform_data nfc_pdata = {
+               .irq_gpio = TEGRA_GPIO_PS4,
+               .ven_gpio = TEGRA_GPIO_PM6,
+               .firm_gpio = 0,
+};
+
+
+static struct i2c_board_info __initdata max98088_board_info = {
+       I2C_BOARD_INFO("max98088", 0x10),
+       .platform_data = &enterprise_max98088_pdata,
+};
+
+static struct i2c_board_info __initdata enterprise_codec_aic326x_info = {
+       I2C_BOARD_INFO("aic3262-codec", 0x18),
+};
+
+static struct i2c_board_info __initdata nfc_board_info = {
+       I2C_BOARD_INFO("pn544", 0x28),
+       .platform_data = &nfc_pdata,
 };
 
 static void enterprise_i2c_init(void)
@@ -173,6 +380,13 @@ static void enterprise_i2c_init(void)
        platform_device_register(&tegra_i2c_device3);
        platform_device_register(&tegra_i2c_device2);
        platform_device_register(&tegra_i2c_device1);
+
+       max98088_board_info.irq = enterprise_codec_aic326x_info.irq =
+               gpio_to_irq(TEGRA_GPIO_HP_DET);
+       i2c_register_board_info(0, &max98088_board_info, 1);
+       i2c_register_board_info(0, &enterprise_codec_aic326x_info, 1);
+       nfc_board_info.irq = gpio_to_irq(TEGRA_GPIO_PS4);
+       i2c_register_board_info(0, &nfc_board_info, 1);
 }
 
 static struct platform_device *enterprise_uart_devices[] __initdata = {
@@ -184,12 +398,14 @@ static struct platform_device *enterprise_uart_devices[] __initdata = {
 };
 
 static struct uart_clk_parent uart_parent_clk[] = {
-       [0] = {.name = "pll_p"},
-       [1] = {.name = "pll_m"},
-       [2] = {.name = "clk_m"},
+       [0] = {.name = "clk_m"},
+       [1] = {.name = "pll_p"},
+#ifndef CONFIG_TEGRA_PLLM_RESTRICTED
+       [2] = {.name = "pll_m"},
+#endif
 };
-static struct clk *debug_uart_clk;
 static struct tegra_uart_platform_data enterprise_uart_pdata;
+static struct tegra_uart_platform_data enterprise_loopback_uart_pdata;
 
 static void __init uart_debug_init(void)
 {
@@ -199,6 +415,8 @@ static void __init uart_debug_init(void)
        /* UARTD is the debug port. */
        pr_info("Selecting UARTD as the debug console\n");
        enterprise_uart_devices[3] = &debug_uartd_device;
+       debug_uart_port_base = ((struct plat_serial8250_port *)(
+                       debug_uartd_device.dev.platform_data))->mapbase;
        debug_uart_clk = clk_get_sys("serial8250.0", "uartd");
 
        /* Clock enable for the debug channel */
@@ -238,11 +456,16 @@ static void __init enterprise_uart_init(void)
        }
        enterprise_uart_pdata.parent_clk_list = uart_parent_clk;
        enterprise_uart_pdata.parent_clk_count = ARRAY_SIZE(uart_parent_clk);
+       enterprise_loopback_uart_pdata.parent_clk_list = uart_parent_clk;
+       enterprise_loopback_uart_pdata.parent_clk_count =
+                                               ARRAY_SIZE(uart_parent_clk);
+       enterprise_loopback_uart_pdata.is_loopback = true;
        tegra_uarta_device.dev.platform_data = &enterprise_uart_pdata;
        tegra_uartb_device.dev.platform_data = &enterprise_uart_pdata;
        tegra_uartc_device.dev.platform_data = &enterprise_uart_pdata;
        tegra_uartd_device.dev.platform_data = &enterprise_uart_pdata;
-       tegra_uarte_device.dev.platform_data = &enterprise_uart_pdata;
+       /* UARTE is used for loopback test purpose */
+       tegra_uarte_device.dev.platform_data = &enterprise_loopback_uart_pdata;
 
        /* Register low speed only if it is selected */
        if (!is_tegra_debug_uartport_hs())
@@ -252,8 +475,6 @@ static void __init enterprise_uart_init(void)
                                ARRAY_SIZE(enterprise_uart_devices));
 }
 
-
-
 static struct resource tegra_rtc_resources[] = {
        [0] = {
                .start = TEGRA_RTC_BASE,
@@ -279,148 +500,523 @@ static struct platform_device tegra_camera = {
        .id = -1,
 };
 
+static struct tegra_asoc_platform_data enterprise_audio_pdata = {
+       .gpio_spkr_en           = -1,
+       .gpio_hp_det            = TEGRA_GPIO_HP_DET,
+       .gpio_hp_mute           = -1,
+       .gpio_int_mic_en        = -1,
+       .gpio_ext_mic_en        = -1,
+       .debounce_time_hp       = -1,
+       /*defaults for Enterprise board*/
+       .i2s_param[HIFI_CODEC]  = {
+               .audio_port_id  = 0,
+               .is_i2s_master  = 1,
+               .i2s_mode       = TEGRA_DAIFMT_I2S,
+               .sample_size    = 16,
+       },
+       .i2s_param[BASEBAND]    = {
+               .audio_port_id  = 2,
+               .is_i2s_master  = 1,
+               .i2s_mode       = TEGRA_DAIFMT_DSP_A,
+               .sample_size    = 16,
+               .rate           = 8000,
+               .channels       = 1,
+       },
+       .i2s_param[BT_SCO]      = {
+               .audio_port_id  = 3,
+               .is_i2s_master  = 1,
+               .i2s_mode       = TEGRA_DAIFMT_DSP_A,
+               .sample_size    = 16,
+       },
+};
+
+static struct platform_device enterprise_audio_device = {
+       .name   = "tegra-snd-max98088",
+       .id     = 0,
+       .dev    = {
+               .platform_data  = &enterprise_audio_pdata,
+       },
+};
+
+static struct tegra_asoc_platform_data enterprise_audio_aic326x_pdata = {
+       .gpio_spkr_en           = -1,
+       .gpio_hp_det            = TEGRA_GPIO_HP_DET,
+       .gpio_hp_mute           = -1,
+       .gpio_int_mic_en        = -1,
+       .gpio_ext_mic_en        = -1,
+       /*defaults for Verbier-Enterprise (E1197) board with TI AIC326X codec*/
+       .i2s_param[HIFI_CODEC]  = {
+               .audio_port_id  = 0,
+               .is_i2s_master  = 1,
+               .i2s_mode       = TEGRA_DAIFMT_I2S,
+               .sample_size    = 16,
+       },
+       .i2s_param[BASEBAND]    = {
+               .audio_port_id  = 2,
+               .is_i2s_master  = 1,
+               .i2s_mode       = TEGRA_DAIFMT_DSP_A,
+               .sample_size    = 16,
+               .rate           = 8000,
+               .channels       = 1,
+       },
+       .i2s_param[BT_SCO]      = {
+               .sample_size    = 16,
+               .audio_port_id  = 3,
+               .is_i2s_master  = 1,
+               .i2s_mode       = TEGRA_DAIFMT_DSP_A,
+       },
+};
+
+static struct platform_device enterprise_audio_aic326x_device = {
+       .name   = "tegra-snd-aic326x",
+       .id     = 0,
+       .dev    = {
+               .platform_data  = &enterprise_audio_aic326x_pdata,
+       },
+};
+
 static struct platform_device *enterprise_devices[] __initdata = {
        &tegra_pmu_device,
        &tegra_rtc_device,
        &tegra_udc_device,
-#if defined(CONFIG_SND_HDA_TEGRA)
-       &tegra_hda_device,
-#endif
-#if defined(CONFIG_TEGRA_IOVMM_SMMU)
+#if defined(CONFIG_TEGRA_IOVMM_SMMU) || defined(CONFIG_TEGRA_IOMMU_SMMU)
        &tegra_smmu_device,
 #endif
-       &tegra_wdt_device,
+       &tegra_wdt0_device,
+       &tegra_wdt1_device,
+       &tegra_wdt2_device,
+#if defined(CONFIG_TEGRA_AVP)
        &tegra_avp_device,
+#endif
        &tegra_camera,
+       &enterprise_bt_rfkill_device,
        &tegra_spi_device4,
+       &tegra_hda_device,
 #if defined(CONFIG_CRYPTO_DEV_TEGRA_SE)
        &tegra_se_device,
 #endif
+#if defined(CONFIG_CRYPTO_DEV_TEGRA_AES)
+       &tegra_aes_device,
+#endif
 };
 
-static struct usb_phy_plat_data tegra_usb_phy_pdata[] = {
-       [0] = {
-                       .instance = 0,
-                       .vbus_gpio = -1,
-                       .vbus_reg_supply = "usb_vbus",
-       },
-       [1] = {
-                       .instance = 1,
-                       .vbus_gpio = -1,
+#define MXT_CONFIG_CRC 0x62F903
+/*
+ * Config converted from memory-mapped cfg-file with
+ * following version information:
+ *
+ *
+ *
+ *      FAMILY_ID=128
+ *      VARIANT=1
+ *      VERSION=32
+ *      BUILD=170
+ *      VENDOR_ID=255
+ *      PRODUCT_ID=TBD
+ *      CHECKSUM=0xC189B6
+ *
+ *
+ */
+
+static const u8 config[] = {
+        0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+        0xFF, 0xFF, 0x32, 0x0A, 0x00, 0x05, 0x01, 0x00,
+        0x00, 0x1E, 0x0A, 0x8B, 0x00, 0x00, 0x13, 0x0B,
+        0x00, 0x10, 0x32, 0x03, 0x03, 0x00, 0x03, 0x01,
+        0x00, 0x0A, 0x0A, 0x0A, 0x0A, 0xBF, 0x03, 0x1B,
+        0x02, 0x00, 0x00, 0x37, 0x37, 0x00, 0x00, 0x00,
+        0x00, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+        0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
+        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+        0x00, 0x00, 0x00, 0xA9, 0x7F, 0x9A, 0x0E, 0x00,
+        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+        0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00,
+        0x00, 0x00, 0x03, 0x23, 0x00, 0x00, 0x00, 0x0A,
+        0x0F, 0x14, 0x19, 0x03, 0x00, 0x00, 0x00, 0x00,
+        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+        0x00, 0x00, 0x00, 0x01, 0x00, 0x03, 0x08, 0x10,
+        0x00
+};
+
+static struct mxt_platform_data atmel_mxt_info = {
+        .x_line         = 19,
+        .y_line         = 11,
+        .x_size         = 960,
+        .y_size         = 540,
+        .blen           = 0x10,
+        .threshold      = 0x32,
+        .voltage        = 3300000,              /* 3.3V */
+        .orient         = 3,
+        .config         = config,
+        .config_length  = 168,
+        .config_crc     = MXT_CONFIG_CRC,
+        .irqflags       = IRQF_TRIGGER_FALLING,
+/*      .read_chg       = &read_chg, */
+        .read_chg       = NULL,
+};
+
+static struct i2c_board_info __initdata atmel_i2c_info[] = {
+       {
+               I2C_BOARD_INFO("atmel_mxt_ts", MXT224_I2C_ADDR1),
+               .platform_data = &atmel_mxt_info,
+       }
+};
+
+static int __init enterprise_touch_init(void)
+{
+       gpio_request(TEGRA_GPIO_PH6, "atmel-irq");
+       gpio_direction_input(TEGRA_GPIO_PH6);
+
+       gpio_request(TEGRA_GPIO_PF5, "atmel-reset");
+       gpio_direction_output(TEGRA_GPIO_PF5, 0);
+       msleep(1);
+       gpio_set_value(TEGRA_GPIO_PF5, 1);
+       msleep(100);
+
+       atmel_i2c_info[0].irq = gpio_to_irq(TEGRA_GPIO_PH6);
+       i2c_register_board_info(1, atmel_i2c_info, 1);
+
+       return 0;
+}
+
+static void enterprise_usb_hsic_postsupend(void)
+{
+       pr_debug("%s\n", __func__);
+#ifdef CONFIG_TEGRA_BB_XMM_POWER
+       baseband_xmm_set_power_status(BBXMM_PS_L2);
+#endif
+}
+
+static void enterprise_usb_hsic_preresume(void)
+{
+       pr_debug("%s\n", __func__);
+#ifdef CONFIG_TEGRA_BB_XMM_POWER
+       baseband_xmm_set_power_status(BBXMM_PS_L2TOL0);
+#endif
+}
+
+static void enterprise_usb_hsic_phy_power(void)
+{
+       pr_debug("%s\n", __func__);
+#ifdef CONFIG_TEGRA_BB_XMM_POWER
+       baseband_xmm_set_power_status(BBXMM_PS_L0);
+#endif
+}
+
+static void enterprise_usb_hsic_post_phy_off(void)
+{
+       pr_debug("%s\n", __func__);
+#ifdef CONFIG_TEGRA_BB_XMM_POWER
+       baseband_xmm_set_power_status(BBXMM_PS_L2);
+#endif
+}
+
+static struct tegra_usb_phy_platform_ops hsic_xmm_plat_ops = {
+       .post_suspend = enterprise_usb_hsic_postsupend,
+       .pre_resume = enterprise_usb_hsic_preresume,
+       .port_power = enterprise_usb_hsic_phy_power,
+       .post_phy_off = enterprise_usb_hsic_post_phy_off,
+};
+
+static struct tegra_usb_platform_data tegra_ehci2_hsic_xmm_pdata = {
+       .port_otg = false,
+       .has_hostpc = true,
+       .phy_intf = TEGRA_USB_PHY_INTF_HSIC,
+       .op_mode        = TEGRA_USB_OPMODE_HOST,
+       .u_data.host = {
+               .vbus_gpio = -1,
+               .hot_plug = false,
+               .remote_wakeup_supported = false,
+               .power_off_on_suspend = false,
        },
-       [2] = {
-                       .instance = 2,
-                       .vbus_gpio = -1,
+       .u_cfg.hsic = {
+               .sync_start_delay = 9,
+               .idle_wait_delay = 17,
+               .term_range_adj = 0,
+               .elastic_underrun_limit = 16,
+               .elastic_overrun_limit = 16,
        },
+       .ops = &hsic_xmm_plat_ops,
 };
 
 
-static struct tegra_ehci_platform_data tegra_ehci_pdata[] = {
-       [0] = {
-                       .phy_config = &utmi_phy_config[0],
-                       .operating_mode = TEGRA_USB_HOST,
-                       .power_down_on_bus_suspend = 1,
+
+static struct tegra_usb_platform_data tegra_udc_pdata = {
+       .port_otg = true,
+       .has_hostpc = true,
+       .builtin_host_disabled = true,
+       .phy_intf = TEGRA_USB_PHY_INTF_UTMI,
+       .op_mode = TEGRA_USB_OPMODE_DEVICE,
+       .u_data.dev = {
+               .vbus_pmu_irq = ENT_TPS80031_IRQ_BASE +
+                               TPS80031_INT_VBUS_DET,
+               .vbus_gpio = -1,
+               .charging_supported = false,
+               .remote_wakeup_supported = false,
        },
-       [1] = {
-                       .phy_config = &utmi_phy_config[1],
-                       .operating_mode = TEGRA_USB_HOST,
-                       .power_down_on_bus_suspend = 1,
+       .u_cfg.utmi = {
+               .hssync_start_delay = 0,
+               .elastic_limit = 16,
+               .idle_wait_delay = 17,
+               .term_range_adj = 6,
+               .xcvr_setup = 8,
+               .xcvr_lsfslew = 2,
+               .xcvr_lsrslew = 2,
+               .xcvr_setup_offset = 0,
+               .xcvr_use_fuses = 1,
        },
-       [2] = {
-                       .phy_config = &utmi_phy_config[2],
-                       .operating_mode = TEGRA_USB_HOST,
-                       .power_down_on_bus_suspend = 1,
+};
+
+static struct tegra_usb_platform_data tegra_ehci1_utmi_pdata = {
+       .port_otg = true,
+       .has_hostpc = true,
+       .builtin_host_disabled = true,
+       .phy_intf = TEGRA_USB_PHY_INTF_UTMI,
+       .op_mode = TEGRA_USB_OPMODE_HOST,
+       .u_data.host = {
+               .vbus_gpio = -1,
+               .vbus_reg = "usb_vbus",
+               .hot_plug = true,
+               .remote_wakeup_supported = true,
+               .power_off_on_suspend = true,
+       },
+       .u_cfg.utmi = {
+               .hssync_start_delay = 0,
+               .elastic_limit = 16,
+               .idle_wait_delay = 17,
+               .term_range_adj = 6,
+               .xcvr_setup = 15,
+               .xcvr_lsfslew = 2,
+               .xcvr_lsrslew = 2,
+               .xcvr_setup_offset = 0,
+               .xcvr_use_fuses = 1,
        },
 };
 
-static struct platform_device *tegra_usb_otg_host_register(void)
+static struct tegra_usb_otg_data tegra_otg_pdata = {
+       .ehci_device = &tegra_ehci1_device,
+       .ehci_pdata = &tegra_ehci1_utmi_pdata,
+};
+
+struct platform_device *tegra_usb_hsic_host_register(void)
 {
        struct platform_device *pdev;
-       void *platform_data;
        int val;
 
-       pdev = platform_device_alloc(tegra_ehci1_device.name,
-               tegra_ehci1_device.id);
+       pdev = platform_device_alloc(tegra_ehci2_device.name,
+               tegra_ehci2_device.id);
        if (!pdev)
                return NULL;
 
-       val = platform_device_add_resources(pdev, tegra_ehci1_device.resource,
-               tegra_ehci1_device.num_resources);
+       val = platform_device_add_resources(pdev, tegra_ehci2_device.resource,
+               tegra_ehci2_device.num_resources);
        if (val)
                goto error;
 
-       pdev->dev.dma_mask =  tegra_ehci1_device.dev.dma_mask;
-       pdev->dev.coherent_dma_mask = tegra_ehci1_device.dev.coherent_dma_mask;
+       pdev->dev.dma_mask =  tegra_ehci2_device.dev.dma_mask;
+       pdev->dev.coherent_dma_mask = tegra_ehci2_device.dev.coherent_dma_mask;
 
-       platform_data = kmalloc(sizeof(struct tegra_ehci_platform_data),
-               GFP_KERNEL);
-       if (!platform_data)
+       val = platform_device_add_data(pdev, &tegra_ehci2_hsic_xmm_pdata,
+                       sizeof(struct tegra_usb_platform_data));
+       if (val)
                goto error;
 
-       memcpy(platform_data, &tegra_ehci_pdata[0],
-                               sizeof(struct tegra_ehci_platform_data));
-       pdev->dev.platform_data = platform_data;
-
        val = platform_device_add(pdev);
        if (val)
-               goto error_add;
+               goto error;
 
        return pdev;
 
-error_add:
-       kfree(platform_data);
 error:
        pr_err("%s: failed to add the host contoller device\n", __func__);
        platform_device_put(pdev);
        return NULL;
 }
 
-static void tegra_usb_otg_host_unregister(struct platform_device *pdev)
+void tegra_usb_hsic_host_unregister(struct platform_device *pdev)
 {
        platform_device_unregister(pdev);
 }
 
-static struct tegra_otg_platform_data tegra_otg_pdata = {
-       .host_register = &tegra_usb_otg_host_register,
-       .host_unregister = &tegra_usb_otg_host_unregister,
-};
-
 static void enterprise_usb_init(void)
 {
-       tegra_usb_phy_init(tegra_usb_phy_pdata, ARRAY_SIZE(tegra_usb_phy_pdata));
+       tegra_udc_device.dev.platform_data = &tegra_udc_pdata;
 
        tegra_otg_device.dev.platform_data = &tegra_otg_pdata;
        platform_device_register(&tegra_otg_device);
+}
+
+static struct platform_device *enterprise_audio_devices[] __initdata = {
+       &tegra_ahub_device,
+       &tegra_dam_device0,
+       &tegra_dam_device1,
+       &tegra_dam_device2,
+       &tegra_i2s_device0,
+       &tegra_i2s_device1,
+       &tegra_i2s_device2,
+       &tegra_i2s_device3,
+       &tegra_spdif_device,
+       &spdif_dit_device,
+       &bluetooth_dit_device,
+       &baseband_dit_device,
+       &tegra_pcm_device,
+       &enterprise_audio_device,
+       &enterprise_audio_aic326x_device,
+};
 
-       tegra_ehci3_device.dev.platform_data = &tegra_ehci_pdata[2];
-       platform_device_register(&tegra_ehci3_device);
+static void enterprise_audio_init(void)
+{
+       struct board_info board_info;
+
+       tegra_get_board_info(&board_info);
+
+       if (board_info.board_id == BOARD_E1197)
+               enterprise_audio_pdata.i2s_param[HIFI_CODEC].audio_port_id = 1;
 
+       platform_add_devices(enterprise_audio_devices,
+                       ARRAY_SIZE(enterprise_audio_devices));
 }
 
-static void enterprise_gps_init(void)
+
+static struct baseband_power_platform_data tegra_baseband_power_data = {
+       .baseband_type = BASEBAND_XMM,
+       .modem = {
+               .xmm = {
+                       .bb_rst = XMM_GPIO_BB_RST,
+                       .bb_on = XMM_GPIO_BB_ON,
+                       .ipc_bb_wake = XMM_GPIO_IPC_BB_WAKE,
+                       .ipc_ap_wake = XMM_GPIO_IPC_AP_WAKE,
+                       .ipc_hsic_active = XMM_GPIO_IPC_HSIC_ACTIVE,
+                       .ipc_hsic_sus_req = XMM_GPIO_IPC_HSIC_SUS_REQ,
+               },
+       },
+};
+
+static struct platform_device tegra_baseband_power_device = {
+       .name = "baseband_xmm_power",
+       .id = -1,
+       .dev = {
+               .platform_data = &tegra_baseband_power_data,
+       },
+};
+
+static struct platform_device tegra_baseband_power2_device = {
+       .name = "baseband_xmm_power2",
+       .id = -1,
+       .dev = {
+               .platform_data = &tegra_baseband_power_data,
+       },
+};
+
+#ifdef CONFIG_TEGRA_BB_M7400
+static union tegra_bb_gpio_id m7400_gpio_id = {
+       .m7400 = {
+               .pwr_status = GPIO_BB_RESET,
+               .pwr_on = GPIO_BB_PWRON,
+               .uart_awr = GPIO_BB_APACK,
+               .uart_cwr = GPIO_BB_CPACK,
+               .usb_awr = GPIO_BB_APACK2,
+               .usb_cwr = GPIO_BB_CPACK2,
+               .service = GPIO_BB_RSVD2,
+               .resout2 = GPIO_BB_RSVD1,
+       },
+};
+
+static struct tegra_bb_pdata m7400_pdata = {
+       .id = &m7400_gpio_id,
+       .device = &tegra_ehci2_device,
+       .ehci_register = tegra_usb_hsic_host_register,
+       .ehci_unregister = tegra_usb_hsic_host_unregister,
+       .bb_id = TEGRA_BB_M7400,
+};
+
+static struct platform_device tegra_baseband_m7400_device = {
+       .name = "tegra_baseband_power",
+       .id = -1,
+       .dev = {
+               .platform_data = &m7400_pdata,
+       },
+};
+#endif
+
+static void enterprise_baseband_init(void)
+{
+       int modem_id = tegra_get_modem_id();
+
+       switch (modem_id) {
+       case TEGRA_BB_PH450: /* PH450 ULPI */
+               enterprise_modem_init();
+               break;
+       case TEGRA_BB_XMM6260: /* XMM6260 HSIC */
+               /* baseband-power.ko will register ehci2 device */
+               tegra_ehci2_device.dev.platform_data =
+                                       &tegra_ehci2_hsic_xmm_pdata;
+               tegra_baseband_power_data.hsic_register =
+                                               &tegra_usb_hsic_host_register;
+               tegra_baseband_power_data.hsic_unregister =
+                                               &tegra_usb_hsic_host_unregister;
+
+               platform_device_register(&tegra_baseband_power_device);
+               platform_device_register(&tegra_baseband_power2_device);
+               break;
+#ifdef CONFIG_TEGRA_BB_M7400
+       case TEGRA_BB_M7400: /* M7400 HSIC */
+               tegra_ehci2_hsic_xmm_pdata.u_data.host.power_off_on_suspend = 0;
+               tegra_ehci2_device.dev.platform_data
+                       = &tegra_ehci2_hsic_xmm_pdata;
+               platform_device_register(&tegra_baseband_m7400_device);
+               break;
+#endif
+       }
+}
+static void enterprise_nfc_init(void)
 {
-       tegra_gpio_enable(TEGRA_GPIO_PE4);
-       tegra_gpio_enable(TEGRA_GPIO_PE5);
+       struct board_info bi;
+
+       /* Enable firmware GPIO PX7 for board E1205 */
+       tegra_get_board_info(&bi);
+       if (bi.board_id == BOARD_E1205 && bi.fab >= BOARD_FAB_A03) {
+               nfc_pdata.firm_gpio = TEGRA_GPIO_PX7;
+       }
 }
 
 static void __init tegra_enterprise_init(void)
 {
+       tegra_thermal_init(&thermal_data,
+                               throttle_list,
+                               ARRAY_SIZE(throttle_list));
        tegra_clk_init_from_table(enterprise_clk_init_table);
+       tegra_enable_pinmux();
        enterprise_pinmux_init();
        enterprise_i2c_init();
        enterprise_uart_init();
+       enterprise_usb_init();
        platform_add_devices(enterprise_devices, ARRAY_SIZE(enterprise_devices));
+       tegra_ram_console_debug_init();
        enterprise_regulator_init();
+       tegra_io_dpd_init();
        enterprise_sdhci_init();
-       enterprise_usb_init();
-       /* enterprise_kbc_init(); */
-       enterprise_gps_init();
+#ifdef CONFIG_TEGRA_EDP_LIMITS
+       enterprise_edp_init();
+#endif
+       enterprise_kbc_init();
+       enterprise_nfc_init();
+       enterprise_touch_init();
+       enterprise_audio_init();
        enterprise_baseband_init();
        enterprise_panel_init();
-       enterprise_bt_rfkill();
+       enterprise_setup_bluesleep();
        enterprise_emc_init();
        enterprise_sensors_init();
        enterprise_suspend_init();
+       enterprise_bpc_mgmt_init();
+       tegra_release_bootloader_fb();
+       tegra_serial_debug_init(TEGRA_UARTD_BASE, INT_WDT_CPU, NULL, -1, -1);
 }
 
 static void __init tegra_enterprise_reserve(void)
@@ -430,14 +1026,18 @@ static void __init tegra_enterprise_reserve(void)
 #else
        tegra_reserve(SZ_128M, SZ_4M, SZ_8M);
 #endif
+       tegra_ram_console_debug_reserve(SZ_1M);
 }
 
 MACHINE_START(TEGRA_ENTERPRISE, "tegra_enterprise")
-       .boot_params    = 0x80000100,
+       .atag_offset    = 0x100,
+       .soc            = &tegra_soc_desc,
        .map_io         = tegra_map_common_io,
        .reserve        = tegra_enterprise_reserve,
-       .init_early     = tegra_init_early,
+       .init_early     = tegra30_init_early,
        .init_irq       = tegra_init_irq,
+       .handle_irq     = gic_handle_irq,
        .timer          = &tegra_timer,
        .init_machine   = tegra_enterprise_init,
+       .restart        = tegra_assert_system_reset,
 MACHINE_END