ARM: tegra: pcie: Remove dock detect variable
[linux-3.10.git] / arch / arm / mach-tegra / board-dalmore.c
index 79794e1..455f315 100644 (file)
 #include <linux/gpio.h>
 #include <linux/input.h>
 #include <linux/platform_data/tegra_usb.h>
-#include <linux/platform_data/tegra_xusb.h>
 #include <linux/spi/spi.h>
 #include <linux/spi/rm31080a_ts.h>
-#include <linux/tegra_uart.h>
+#include <linux/platform_data/serial-tegra.h>
 #include <linux/memblock.h>
 #include <linux/spi/spi-tegra.h>
 #include <linux/nfc/pn544.h>
 #include <linux/of_platform.h>
 #include <linux/edp.h>
 #include <linux/usb/tegra_usb_phy.h>
+#include <linux/clk/tegra.h>
+#include <linux/clocksource.h>
+#include <linux/irqchip.h>
+#include <linux/irqchip/tegra.h>
+#include <linux/tegra_fiq_debugger.h>
+#include <linux/platform_data/tegra_usb_modem_power.h>
 
-#include <asm/hardware/gic.h>
-
-#include <mach/clk.h>
-#include <mach/iomap.h>
 #include <mach/irqs.h>
 #include <mach/pinmux.h>
-#include <mach/pinmux-tegra30.h>
-#include <mach/iomap.h>
+#include <mach/pinmux-t11.h>
 #include <mach/io_dpd.h>
 #include <mach/i2s.h>
 #include <mach/isomgr.h>
@@ -65,8 +65,7 @@
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
 #include <mach/gpio-tegra.h>
-#include <mach/tegra_fiq_debugger.h>
-#include <mach/tegra_usb_modem_power.h>
+#include <mach/xusb.h>
 
 #include "board-touch-raydium.h"
 #include "board.h"
 #include "board-dalmore.h"
 #include "devices.h"
 #include "gpio-names.h"
-#include "fuse.h"
+#include "iomap.h"
 #include "pm.h"
-#include "pm-irq.h"
 #include "common.h"
 #include "tegra-board-id.h"
+#include "tegra-of-dev-auxdata.h"
 
 static struct board_info board_info, display_board_info;
 
@@ -138,7 +137,7 @@ static noinline void __init dalmore_setup_bluesleep(void)
        platform_device_register(&dalmore_bluesleep_device);
        return;
 }
-#elif defined CONFIG_BLUEDROID_PM
+#elif defined(CONFIG_BLUEDROID_PM) || defined(CONFIG_BLUEDROID_PM_MODULE)
 static struct resource dalmore_bluedroid_pm_resources[] = {
        [0] = {
                .name   = "shutdown_gpio",
@@ -220,6 +219,10 @@ static __initdata struct tegra_clk_init_table dalmore_clk_init_table[] = {
        { "sbc4",       "pll_p",        25000000,       false},
        { "sbc5",       "pll_p",        25000000,       false},
        { "sbc6",       "pll_p",        25000000,       false},
+       { "uarta",      "pll_p",        408000000,      false},
+       { "uartb",      "pll_p",        408000000,      false},
+       { "uartc",      "pll_p",        408000000,      false},
+       { "uartd",      "pll_p",        408000000,      false},
        { NULL,         NULL,           0,              0},
 };
 
@@ -238,7 +241,7 @@ static struct tegra_i2c_platform_data dalmore_i2c2_platform_data = {
 };
 
 static struct tegra_i2c_platform_data dalmore_i2c3_platform_data = {
-       .bus_clk_rate   = 100000,
+       .bus_clk_rate   = 400000,
        .scl_gpio       = TEGRA_GPIO_I2C3_SCL,
        .sda_gpio       = TEGRA_GPIO_I2C3_SDA,
 };
@@ -253,6 +256,7 @@ static struct tegra_i2c_platform_data dalmore_i2c5_platform_data = {
        .bus_clk_rate   = 400000,
        .scl_gpio       = TEGRA_GPIO_I2C5_SCL,
        .sda_gpio       = TEGRA_GPIO_I2C5_SDA,
+       .needs_cl_dvfs_clock = true,
 };
 #endif
 
@@ -291,66 +295,28 @@ static void dalmore_i2c_init(void)
        i2c_register_board_info(0, &rt5640_board_info, 1);
 }
 
-static struct platform_device *dalmore_uart_devices[] __initdata = {
-       &tegra_uarta_device,
-       &tegra_uartb_device,
-       &tegra_uartc_device,
-       &tegra_uartd_device,
-};
-static struct uart_clk_parent uart_parent_clk[] = {
-       [0] = {.name = "clk_m"},
-       [1] = {.name = "pll_p"},
-#ifndef CONFIG_TEGRA_PLLM_RESTRICTED
-       [2] = {.name = "pll_m"},
-#endif
+static struct tegra_serial_platform_data dalmore_uartd_pdata = {
+       .dma_req_selector = 19,
+       .modem_interrupt = false,
 };
 
-static struct tegra_uart_platform_data dalmore_uart_pdata;
-static struct tegra_uart_platform_data dalmore_loopback_uart_pdata;
-
-static void __init uart_debug_init(void)
+static void __init dalmore_uart_init(void)
 {
        int debug_port_id;
 
-       debug_port_id = uart_console_debug_init(3);
-       if (debug_port_id < 0)
-               return;
+       /* Register low speed only if it is selected */
+       if (!is_tegra_debug_uartport_hs()) {
+               debug_port_id = uart_console_debug_init(3);
+               if (debug_port_id < 0)
+                       return;
 
-       dalmore_uart_devices[debug_port_id] = uart_console_debug_device;
-}
+               platform_device_register(uart_console_debug_device);
 
-static void __init dalmore_uart_init(void)
-{
-       struct clk *c;
-       int i;
-
-       for (i = 0; i < ARRAY_SIZE(uart_parent_clk); ++i) {
-               c = tegra_get_clock_by_name(uart_parent_clk[i].name);
-               if (IS_ERR_OR_NULL(c)) {
-                       pr_err("Not able to get the clock for %s\n",
-                                               uart_parent_clk[i].name);
-                       continue;
-               }
-               uart_parent_clk[i].parent_clk = c;
-               uart_parent_clk[i].fixed_clk_rate = clk_get_rate(c);
+       } else {
+               tegra_uartd_device.dev.platform_data = &dalmore_uartd_pdata;
+               platform_device_register(&tegra_uartd_device);
        }
-       dalmore_uart_pdata.parent_clk_list = uart_parent_clk;
-       dalmore_uart_pdata.parent_clk_count = ARRAY_SIZE(uart_parent_clk);
-       dalmore_loopback_uart_pdata.parent_clk_list = uart_parent_clk;
-       dalmore_loopback_uart_pdata.parent_clk_count =
-                                               ARRAY_SIZE(uart_parent_clk);
-       dalmore_loopback_uart_pdata.is_loopback = true;
-       tegra_uarta_device.dev.platform_data = &dalmore_uart_pdata;
-       tegra_uartb_device.dev.platform_data = &dalmore_uart_pdata;
-       tegra_uartc_device.dev.platform_data = &dalmore_uart_pdata;
-       tegra_uartd_device.dev.platform_data = &dalmore_uart_pdata;
 
-       /* Register low speed only if it is selected */
-       if (!is_tegra_debug_uartport_hs())
-               uart_debug_init();
-
-       platform_add_devices(dalmore_uart_devices,
-                               ARRAY_SIZE(dalmore_uart_devices));
 }
 
 static struct resource tegra_rtc_resources[] = {
@@ -403,13 +369,6 @@ static struct platform_device dalmore_audio_device = {
        },
 };
 
-#ifndef CONFIG_USE_OF
-static struct platform_device tegra_camera = {
-       .name = "tegra_camera",
-       .id = -1,
-};
-#endif
-
 static struct platform_device *dalmore_devices[] __initdata = {
        &tegra_pmu_device,
        &tegra_rtc_device,
@@ -417,9 +376,6 @@ static struct platform_device *dalmore_devices[] __initdata = {
 #if defined(CONFIG_TEGRA_AVP)
        &tegra_avp_device,
 #endif
-#ifndef CONFIG_USE_OF
-       &tegra_camera,
-#endif
 #if defined(CONFIG_CRYPTO_DEV_TEGRA_SE)
        &tegra11_se_device,
 #endif
@@ -433,8 +389,12 @@ static struct platform_device *dalmore_devices[] __initdata = {
        &tegra_spdif_device,
        &spdif_dit_device,
        &bluetooth_dit_device,
+       &tegra_pcm_device,
        &dalmore_audio_device,
        &tegra_hda_device,
+#if defined(CONFIG_TEGRA_CEC_SUPPORT)
+       &tegra_cec_device,
+#endif
 #if defined(CONFIG_CRYPTO_DEV_TEGRA_AES)
        &tegra_aes_device,
 #endif
@@ -445,6 +405,7 @@ static struct tegra_usb_platform_data tegra_udc_pdata = {
        .port_otg = true,
        .has_hostpc = true,
        .phy_intf = TEGRA_USB_PHY_INTF_UTMI,
+       .unaligned_dma_buf_supported = false,
        .op_mode = TEGRA_USB_OPMODE_DEVICE,
        .u_data.dev = {
                .vbus_pmu_irq = 0,
@@ -458,8 +419,8 @@ static struct tegra_usb_platform_data tegra_udc_pdata = {
                .idle_wait_delay = 17,
                .term_range_adj = 6,
                .xcvr_setup = 8,
-               .xcvr_lsfslew = 2,
-               .xcvr_lsrslew = 2,
+               .xcvr_lsfslew = 0,
+               .xcvr_lsrslew = 3,
                .xcvr_setup_offset = 0,
                .xcvr_use_fuses = 1,
        },
@@ -483,8 +444,8 @@ static struct tegra_usb_platform_data tegra_ehci1_utmi_pdata = {
                .idle_wait_delay = 17,
                .term_range_adj = 6,
                .xcvr_setup = 15,
-               .xcvr_lsfslew = 2,
-               .xcvr_lsrslew = 2,
+               .xcvr_lsfslew = 0,
+               .xcvr_lsrslew = 3,
                .xcvr_setup_offset = 0,
                .xcvr_use_fuses = 1,
                .vbus_oc_map = 0x4,
@@ -509,8 +470,8 @@ static struct tegra_usb_platform_data tegra_ehci3_utmi_pdata = {
                .idle_wait_delay = 17,
                .term_range_adj = 6,
                .xcvr_setup = 8,
-               .xcvr_lsfslew = 2,
-               .xcvr_lsrslew = 2,
+               .xcvr_lsfslew = 0,
+               .xcvr_lsrslew = 3,
                .xcvr_setup_offset = 0,
                .xcvr_use_fuses = 1,
                .vbus_oc_map = 0x5,
@@ -530,11 +491,16 @@ static void dalmore_usb_init(void)
        tegra_set_usb_wake_source();
 
        if (!(usb_port_owner_info & UTMI1_PORT_OWNER_XUSB)) {
-               tegra_otg_device.dev.platform_data = &tegra_otg_pdata;
-               platform_device_register(&tegra_otg_device);
-               /* Setup the udc platform data */
-               tegra_udc_device.dev.platform_data = &tegra_udc_pdata;
+               tegra_otg_pdata.is_xhci = false;
+               tegra_udc_pdata.u_data.dev.is_xhci = false;
+       } else {
+               tegra_otg_pdata.is_xhci = true;
+               tegra_udc_pdata.u_data.dev.is_xhci = true;
        }
+       tegra_otg_device.dev.platform_data = &tegra_otg_pdata;
+       platform_device_register(&tegra_otg_device);
+       /* Setup the udc platform data */
+       tegra_udc_device.dev.platform_data = &tegra_udc_pdata;
 
        if (!(usb_port_owner_info & UTMI2_PORT_OWNER_XUSB)) {
                tegra_ehci3_device.dev.platform_data = &tegra_ehci3_utmi_pdata;
@@ -542,51 +508,19 @@ static void dalmore_usb_init(void)
        }
 }
 
-static struct tegra_xusb_pad_data xusb_padctl_data = {
-       .pad_mux = 0x4,
-       .port_cap = 0x10,
-       .snps_oc_map = 0x1fc,
-       .usb2_oc_map = 0x2f,
-       .ss_port_map = 0x1,
-       .oc_det = 0xb000,
-       .rx_wander = 0xf0,
-       .rx_eq = 0x307000,
-       .cdr_cntl = 0x26000000,
-       .dfe_cntl = 0x002008EE,
-       .otg_pad0_ctl0 = 0xffffffff,
-       .hs_slew = 0x30,
-       .otg_pad0_ctl1 = 0x0,
-       .otg_pad1_ctl0 = 0xffc7ffff,
-       .otg_pad1_ctl1 = 0x7,
-       .bias_pad_ctl0 = 0,
-       .hsic_pad0_ctl0 = 0xffff00ff,
-       .hsic_pad0_ctl1 = 0xffff00ff,
-       .pmc_value = 0xfff0ffff,
+static struct tegra_xusb_platform_data xusb_pdata = {
+       .portmap = TEGRA_XUSB_SS_P0 | TEGRA_XUSB_USB2_P1 |
+                       TEGRA_XUSB_USB2_P0,
 };
 
 static void dalmore_xusb_init(void)
 {
        int usb_port_owner_info = tegra_get_usb_port_owner_info();
 
-       if (usb_port_owner_info & UTMI2_PORT_OWNER_XUSB) {
-               u32 usb_calib0 = tegra_fuse_readl(FUSE_SKU_USB_CALIB_0);
-
-               /*
-                * read from usb_calib0 and pass to driver
-                * set HS_CURR_LEVEL = usb_calib0[5:0]
-                * set TERM_RANGE_ADJ = usb_calib0[10:7]
-                * set HS_IREF_CAP = usb_calib0[14:13]
-                * set HS_SQUELCH_LEVEL = usb_calib0[12:11]
-                */
-
-               xusb_padctl_data.hs_curr_level = (usb_calib0 >> 0) & 0x3f;
-               xusb_padctl_data.hs_iref_cap = (usb_calib0 >> 13) & 0x3;
-               xusb_padctl_data.hs_term_range_adj = (usb_calib0 >> 7) & 0xf;
-               xusb_padctl_data.hs_squelch_level = (usb_calib0 >> 11) & 0x3;
-
-               tegra_xhci_device.dev.platform_data = &xusb_padctl_data;
-               platform_device_register(&tegra_xhci_device);
-       }
+       if (!(usb_port_owner_info & UTMI1_PORT_OWNER_XUSB))
+               xusb_pdata.portmap &= ~TEGRA_XUSB_USB2_P0;
+       if (!(usb_port_owner_info & UTMI2_PORT_OWNER_XUSB))
+               xusb_pdata.portmap &= ~(TEGRA_XUSB_USB2_P1 | TEGRA_XUSB_SS_P0);
 }
 
 static struct gpio modem_gpios[] = { /* Nemo modem */
@@ -634,9 +568,12 @@ static const struct tegra_modem_operations baseband_operations = {
 
 static struct tegra_usb_modem_power_platform_data baseband_pdata = {
        .ops = &baseband_operations,
+       .regulator_name = "vdd_modem_3v3",
        .wake_gpio = -1,
        .boot_gpio = MDM_COLDBOOT,
-       .boot_irq_flags = IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
+       .boot_irq_flags = IRQF_TRIGGER_RISING |
+                                   IRQF_TRIGGER_FALLING |
+                                   IRQF_ONESHOT,
        .autosuspend_delay = 2000,
        .short_autosuspend_delay = 50,
        .tegra_ehci_device = &tegra_ehci2_device,
@@ -657,8 +594,9 @@ static void dalmore_modem_init(void)
        int usb_port_owner_info = tegra_get_usb_port_owner_info();
        switch (modem_id) {
        case TEGRA_BB_NEMO: /* on board i500 HSIC */
-               if (!(usb_port_owner_info & HSIC1_PORT_OWNER_XUSB))
+               if (!(usb_port_owner_info & HSIC1_PORT_OWNER_XUSB)) {
                        platform_device_register(&icera_nemo_device);
+               }
                break;
        }
 }
@@ -675,29 +613,6 @@ static void dalmore_audio_init(void)
        dalmore_audio_pdata.codec_dai_name = "rt5640-aif1";
 }
 
-#ifndef CONFIG_USE_OF
-static struct platform_device *dalmore_spi_devices[] __initdata = {
-        &tegra11_spi_device4,
-};
-
-static struct tegra_spi_platform_data dalmore_spi_pdata = {
-       .dma_req_sel            = 0,
-       .spi_max_frequency      = 25000000,
-       .clock_always_on        = false,
-};
-
-static void __init dalmore_spi_init(void)
-{
-       tegra11_spi_device4.dev.platform_data = &dalmore_spi_pdata;
-        platform_add_devices(dalmore_spi_devices,
-                                ARRAY_SIZE(dalmore_spi_devices));
-}
-#else
-static void __init dalmore_spi_init(void)
-{
-}
-#endif
-
 static __initdata struct tegra_clk_init_table touch_clk_init_table[] = {
        /* name         parent          rate            enabled */
        { "extern2",    "pll_p",        41000000,       false},
@@ -706,14 +621,15 @@ static __initdata struct tegra_clk_init_table touch_clk_init_table[] = {
 };
 
 struct rm_spi_ts_platform_data rm31080ts_dalmore_data = {
-       .gpio_reset = 0,
+       .gpio_reset = TOUCH_GPIO_RST_RAYDIUM_SPI,
        .config = 0,
        .platform_id = RM_PLATFORM_D010,
        .name_of_clock = "clk_out_2",
+       .name_of_clock_con = "extern2",
 };
 
 static struct tegra_spi_device_controller_data dev_cdata = {
-       .rx_clk_tap_delay = 0,
+       .rx_clk_tap_delay = 16,
        .tx_clk_tap_delay = 16,
 };
 
@@ -732,7 +648,6 @@ struct spi_board_info rm31080a_dalmore_spi_board[1] = {
 static int __init dalmore_touch_init(void)
 {
        tegra_clk_init_from_table(touch_clk_init_table);
-       clk_enable(tegra_get_clock_by_name("clk_out_2"));
        if (display_board_info.board_id == BOARD_E1582)
                rm31080ts_dalmore_data.platform_id = RM_PLATFORM_P005;
        else
@@ -747,42 +662,6 @@ static int __init dalmore_touch_init(void)
        return 0;
 }
 
-#ifdef CONFIG_EDP_FRAMEWORK
-static struct edp_manager battery_edp_manager = {
-       .name = "battery",
-       .max = 9500
-};
-
-static void __init dalmore_battery_edp_init(void)
-{
-       struct edp_governor *g;
-       int r;
-
-       r = edp_register_manager(&battery_edp_manager);
-       if (r)
-               goto err_ret;
-
-       /* start with priority governor */
-       g = edp_get_governor("priority");
-       if (!g) {
-               r = -EFAULT;
-               goto err_ret;
-       }
-
-       r = edp_set_governor(&battery_edp_manager, g);
-       if (r)
-               goto err_ret;
-
-       return;
-
-err_ret:
-       pr_err("Battery EDP init failed with error %d\n", r);
-       WARN_ON(1);
-}
-#else
-static inline void dalmore_battery_edp_init(void) {}
-#endif
-
 #ifdef CONFIG_USE_OF
 struct of_dev_auxdata dalmore_auxdata_lookup[] __initdata = {
        OF_DEV_AUXDATA("nvidia,tegra114-sdhci", 0x78000600, "sdhci-tegra.3",
@@ -818,39 +697,33 @@ struct of_dev_auxdata dalmore_auxdata_lookup[] __initdata = {
                                NULL),
        OF_DEV_AUXDATA("nvidia,tegra114-i2c", 0x7000d000, "tegra11-i2c.4",
                                NULL),
-       OF_DEV_AUXDATA("nvidia,tegra114-spi", 0x7000d400, "spi-tegra114.0",
-                               NULL),
-       OF_DEV_AUXDATA("nvidia,tegra114-spi", 0x7000d600, "spi-tegra114.1",
-                               NULL),
-       OF_DEV_AUXDATA("nvidia,tegra114-spi", 0x7000d800, "spi-tegra114.2",
-                               NULL),
-       OF_DEV_AUXDATA("nvidia,tegra114-spi", 0x7000da00, "spi-tegra114.3",
+       T114_SPI_OF_DEV_AUXDATA,
+       OF_DEV_AUXDATA("nvidia,tegra114-apbdma", 0x6000a000, "tegra-apbdma",
                                NULL),
-       OF_DEV_AUXDATA("nvidia,tegra114-spi", 0x7000dc00, "spi-tegra114.4",
+       OF_DEV_AUXDATA("nvidia,tegra114-hsuart", 0x70006000, "serial-tegra.0",
                                NULL),
-       OF_DEV_AUXDATA("nvidia,tegra114-spi", 0x7000de00, "spi-tegra114.5",
+       OF_DEV_AUXDATA("nvidia,tegra114-hsuart", 0x70006040, "serial-tegra.1",
                                NULL),
-       OF_DEV_AUXDATA("nvidia,tegra114-apbdma", 0x6000a000, "tegra-apbdma",
+       OF_DEV_AUXDATA("nvidia,tegra114-hsuart", 0x70006200, "serial-tegra.2",
                                NULL),
+       OF_DEV_AUXDATA("nvidia,tegra114-xhci", 0x70090000, "tegra-xhci",
+                               &xusb_pdata),
        {}
 };
 #endif
 
 static void __init tegra_dalmore_early_init(void)
 {
-       dalmore_battery_edp_init();
        tegra_clk_init_from_table(dalmore_clk_init_table);
-       tegra_clk_vefify_parents();
-       tegra_smmu_init();
+       tegra_clk_verify_parents();
        tegra_soc_device_init("dalmore");
 }
 
 static void __init tegra_dalmore_late_init(void)
 {
-       platform_device_register(&tegra_pinmux_device);
+       platform_device_register(&tegra114_pinctrl_device);
        dalmore_pinmux_init();
        dalmore_i2c_init();
-       dalmore_spi_init();
        dalmore_usb_init();
        dalmore_xusb_init();
        dalmore_uart_init();
@@ -866,7 +739,7 @@ static void __init tegra_dalmore_late_init(void)
        isomgr_init();
        dalmore_touch_init();
        if (board_info.board_id == BOARD_E1582)
-               roth_panel_init();
+               roth_panel_init(board_info.board_id);
        else
                dalmore_panel_init();
        dalmore_kbc_init();
@@ -874,10 +747,9 @@ static void __init tegra_dalmore_late_init(void)
 #if defined(CONFIG_BT_BLUESLEEP) || defined(CONFIG_BT_BLUESLEEP_MODULE)
        dalmore_setup_bluesleep();
        dalmore_setup_bt_rfkill();
-#elif defined CONFIG_BLUEDROID_PM
+#elif defined(CONFIG_BLUEDROID_PM) || defined(CONFIG_BLUEDROID_PM_MODULE)
        dalmore_setup_bluedroid_pm();
 #endif
-       tegra_release_bootloader_fb();
        dalmore_modem_init();
 #ifdef CONFIG_TEGRA_WDT_RECOVERY
        tegra_wdt_recovery_init();
@@ -913,7 +785,7 @@ static void __init tegra_dalmore_reserve(void)
        /* 1920*1200*4*2 = 18432000 bytes */
        tegra_reserve(0, SZ_16M + SZ_2M, SZ_16M);
 #else
-       tegra_reserve(SZ_128M, SZ_16M + SZ_2M, SZ_4M);
+       tegra_reserve(SZ_512M, SZ_16M + SZ_2M, SZ_4M);
 #endif
        dalmore_ramconsole_reserve(SZ_1M);
 }
@@ -929,10 +801,10 @@ MACHINE_START(DALMORE, "dalmore")
        .map_io         = tegra_map_common_io,
        .reserve        = tegra_dalmore_reserve,
        .init_early     = tegra11x_init_early,
-       .init_irq       = tegra_dt_init_irq,
-       .handle_irq     = gic_handle_irq,
-       .timer          = &tegra_sys_timer,
+       .init_irq       = irqchip_init,
+       .init_time      = clocksource_of_init,
        .init_machine   = tegra_dalmore_dt_init,
        .restart        = tegra_assert_system_reset,
        .dt_compat      = dalmore_dt_board_compat,
+       .init_late      = tegra_init_late,
 MACHINE_END