ARM: tegra: pcie: Remove dock detect variable
[linux-3.10.git] / arch / arm / mach-tegra / board-dalmore.c
index 63c52f4..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/irqs.h>
 #include <mach/pinmux.h>
-#include <mach/pinmux-tegra30.h>
+#include <mach/pinmux-t11.h>
 #include <mach/io_dpd.h>
 #include <mach/i2s.h>
 #include <mach/isomgr.h>
@@ -63,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 <linux/platform_data/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;
 
@@ -137,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",
@@ -219,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},
 };
 
@@ -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[] = {
@@ -423,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
@@ -435,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,
@@ -448,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,
        },
@@ -473,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,
@@ -499,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,
@@ -520,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;
@@ -532,54 +508,19 @@ static void dalmore_usb_init(void)
        }
 }
 
-static struct tegra_xusb_pad_data xusb_padctl_data = {
-       .pad_mux = (0x1 << 2),
-       .port_cap = (0x1 << 4),
-       .snps_oc_map = (0x1fc << 0),
-       .usb2_oc_map = (0x2f << 0),
-       .ss_port_map = (0x1 << 0),
-       .oc_det = (0x2c << 10),
-       .rx_wander = (0xf << 4),
-       .rx_eq = (0x3070 << 8),
-       .cdr_cntl = (0x26 << 24),
-       .dfe_cntl = 0x002008EE,
-       .hs_slew = (0xE << 6),
-       .ls_rslew = (0x3 << 14),
-       .otg_pad0_ctl0 = (0x7 << 19),
-       .otg_pad1_ctl0 = (0x0 << 19),
-       .otg_pad0_ctl1 = (0x4 << 0),
-       .otg_pad1_ctl1 = (0x3 << 0),
-       .hs_disc_lvl = (0x5 << 2),
-       .hsic_pad0_ctl0 = (0x00 << 8),
-       .hsic_pad0_ctl1 = (0x00 << 8),
+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);
-
-               pr_info("dalmore_xusb_init: usb_calib0 = 0x%08x\n", usb_calib0);
-               /*
-                * read from usb_calib0 and pass to driver
-                * set HS_CURR_LEVEL (PAD0)     = usb_calib0[5:0]
-                * set TERM_RANGE_ADJ           = usb_calib0[10:7]
-                * set HS_SQUELCH_LEVEL         = usb_calib0[12:11]
-                * set HS_IREF_CAP              = usb_calib0[14:13]
-                * set HS_CURR_LEVEL (PAD1)     = usb_calib0[20:15]
-                */
-
-               xusb_padctl_data.hs_curr_level_pad0 = (usb_calib0 >> 0) & 0x3f;
-               xusb_padctl_data.hs_term_range_adj = (usb_calib0 >> 7) & 0xf;
-               xusb_padctl_data.hs_squelch_level = (usb_calib0 >> 11) & 0x3;
-               xusb_padctl_data.hs_iref_cap = (usb_calib0 >> 13) & 0x3;
-               xusb_padctl_data.hs_curr_level_pad1 = (usb_calib0 >> 15) & 0x3f;
-
-               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 */
@@ -627,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,
@@ -650,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;
        }
 }
@@ -668,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},
@@ -707,7 +629,7 @@ struct rm_spi_ts_platform_data rm31080ts_dalmore_data = {
 };
 
 static struct tegra_spi_device_controller_data dev_cdata = {
-       .rx_clk_tap_delay = 0,
+       .rx_clk_tap_delay = 16,
        .tx_clk_tap_delay = 16,
 };
 
@@ -775,20 +697,17 @@ 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
@@ -802,10 +721,9 @@ static void __init tegra_dalmore_early_init(void)
 
 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();
@@ -829,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();
@@ -868,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);
 }
@@ -884,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