ARM: tegra: reserve memory for ramoops by default
[linux-3.10.git] / arch / arm / mach-tegra / board-macallan.c
index 7828b07..47d320b 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * arch/arm/mach-tegra/board-macallan.c
  *
- * Copyright (c) 2013, NVIDIA CORPORATION.  All rights reserved.
+ * Copyright (c) 2013-2014, NVIDIA CORPORATION.  All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 as
 #include <linux/usb/tegra_usb_phy.h>
 #include <linux/spi/spi.h>
 #include <linux/spi/rm31080a_ts.h>
-#include <linux/tegra_uart.h>
 #include <linux/memblock.h>
-#include <linux/spi-tegra.h>
+#include <linux/spi/spi-tegra.h>
 #include <linux/nfc/pn544.h>
-#include <linux/rfkill-gpio.h>
 #include <linux/skbuff.h>
 #include <linux/ti_wilink_st.h>
 #include <linux/regulator/consumer.h>
 #include <linux/leds.h>
 #include <linux/i2c/at24.h>
 #include <linux/of_platform.h>
-#include <linux/edp.h>
+#include <linux/clk/tegra.h>
+#include <linux/tegra-soc.h>
+#include <linux/clocksource.h>
+#include <linux/irqchip.h>
+#include <linux/irqchip/tegra.h>
+#include <linux/tegra_fiq_debugger.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>
@@ -62,8 +62,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 <linux/platform_data/tegra_usb_modem_power.h>
 
 #include "board-touch-raydium.h"
 #include "board.h"
 #include "board-macallan.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;
 
-#ifdef CONFIG_BT_BLUESLEEP
-static struct rfkill_gpio_platform_data macallan_bt_rfkill_pdata = {
-               .name           = "bt_rfkill",
-               .shutdown_gpio  = TEGRA_GPIO_PQ7,
-               .reset_gpio     = TEGRA_GPIO_PQ6,
-               .type           = RFKILL_TYPE_BLUETOOTH,
+#if defined CONFIG_TI_ST || defined CONFIG_TI_ST_MODULE
+struct ti_st_plat_data macallan_wilink_pdata = {
+       .nshutdown_gpio = TEGRA_GPIO_PQ7,
+       .dev_name = BLUETOOTH_UART_DEV_NAME,
+       .flow_cntrl = 1,
+       .baud_rate = 3000000,
 };
 
-static struct platform_device macallan_bt_rfkill_device = {
-       .name = "rfkill_gpio",
+static struct platform_device wl128x_device = {
+       .name           = "kim",
        .id             = -1,
-       .dev = {
-               .platform_data = &macallan_bt_rfkill_pdata,
-       },
+       .dev.platform_data = &macallan_wilink_pdata,
 };
 
-static struct resource macallan_bluesleep_resources[] = {
-       [0] = {
-               .name = "gpio_host_wake",
-                       .start  = TEGRA_GPIO_PU6,
-                       .end    = TEGRA_GPIO_PU6,
-                       .flags  = IORESOURCE_IO,
-       },
-       [1] = {
-               .name = "gpio_ext_wake",
-                       .start  = TEGRA_GPIO_PEE1,
-                       .end    = TEGRA_GPIO_PEE1,
-                       .flags  = IORESOURCE_IO,
-       },
-       [2] = {
-               .name = "host_wake",
-                       .flags  = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
-       },
-};
-
-static struct platform_device macallan_bluesleep_device = {
-       .name           = "bluesleep",
-       .id             = -1,
-       .num_resources  = ARRAY_SIZE(macallan_bluesleep_resources),
-       .resource       = macallan_bluesleep_resources,
+static struct platform_device btwilink_device = {
+       .name = "btwilink",
+       .id = -1,
 };
 
-static noinline void __init macallan_setup_bt_rfkill(void)
+static noinline void __init macallan_bt_st(void)
 {
-       platform_device_register(&macallan_bt_rfkill_device);
-}
+       pr_info("macallan_bt_st");
 
-static noinline void __init macallan_setup_bluesleep(void)
-{
-       macallan_bluesleep_resources[2].start =
-               macallan_bluesleep_resources[2].end =
-                       gpio_to_irq(TEGRA_GPIO_PU6);
-       platform_device_register(&macallan_bluesleep_device);
-       return;
+       platform_device_register(&wl128x_device);
+       platform_device_register(&btwilink_device);
 }
-#elif defined CONFIG_BLUEDROID_PM
-static struct resource macallan_bluedroid_pm_resources[] = {
+
+static struct resource macallan_st_host_wake_resources[] = {
        [0] = {
-               .name   = "shutdown_gpio",
-               .start  = TEGRA_GPIO_PQ7,
-               .end    = TEGRA_GPIO_PQ7,
-               .flags  = IORESOURCE_IO,
-       },
-       [1] = {
                .name = "host_wake",
                .flags  = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
        },
-       [2] = {
-               .name = "gpio_ext_wake",
-               .start  = TEGRA_GPIO_PEE1,
-               .end    = TEGRA_GPIO_PEE1,
-               .flags  = IORESOURCE_IO,
-       },
-       [3] = {
-               .name = "gpio_host_wake",
-               .start  = TEGRA_GPIO_PU6,
-               .end    = TEGRA_GPIO_PU6,
-               .flags  = IORESOURCE_IO,
-       },
-       [4] = {
-               .name = "reset_gpio",
-               .start  = TEGRA_GPIO_PQ6,
-               .end    = TEGRA_GPIO_PQ6,
-               .flags  = IORESOURCE_IO,
-       },
 };
 
-static struct platform_device macallan_bluedroid_pm_device = {
-       .name = "bluedroid_pm",
+static struct platform_device macallan_st_host_wake_device = {
+       .name           = "st_host_wake",
        .id             = 0,
-       .num_resources  = ARRAY_SIZE(macallan_bluedroid_pm_resources),
-       .resource       = macallan_bluedroid_pm_resources,
+       .num_resources  = ARRAY_SIZE(macallan_st_host_wake_resources),
+       .resource       = macallan_st_host_wake_resources,
 };
 
-static noinline void __init macallan_setup_bluedroid_pm(void)
+static noinline void __init macallan_tegra_setup_st_host_wake(void)
 {
-       macallan_bluedroid_pm_resources[1].start =
-               macallan_bluedroid_pm_resources[1].end =
-                               gpio_to_irq(TEGRA_GPIO_PU6);
-       platform_device_register(&macallan_bluedroid_pm_device);
+       macallan_st_host_wake_resources[0].start =
+               macallan_st_host_wake_resources[0].end =
+               gpio_to_irq(TEGRA_GPIO_PU6);
+       platform_device_register(&macallan_st_host_wake_device);
 }
 #endif
 
@@ -215,39 +160,6 @@ static __initdata struct tegra_clk_init_table macallan_clk_init_table[] = {
        { NULL,         NULL,           0,              0},
 };
 
-#ifndef CONFIG_USE_OF
-static struct tegra_i2c_platform_data macallan_i2c1_platform_data = {
-       .bus_clk_rate   = 100000,
-       .scl_gpio       = TEGRA_GPIO_I2C1_SCL,
-       .sda_gpio       = TEGRA_GPIO_I2C1_SDA,
-};
-
-static struct tegra_i2c_platform_data macallan_i2c2_platform_data = {
-       .bus_clk_rate   = 100000,
-       .is_clkon_always = true,
-       .scl_gpio       = TEGRA_GPIO_I2C2_SCL,
-       .sda_gpio       = TEGRA_GPIO_I2C2_SDA,
-};
-
-static struct tegra_i2c_platform_data macallan_i2c3_platform_data = {
-       .bus_clk_rate   = 100000,
-       .scl_gpio       = TEGRA_GPIO_I2C3_SCL,
-       .sda_gpio       = TEGRA_GPIO_I2C3_SDA,
-};
-
-static struct tegra_i2c_platform_data macallan_i2c4_platform_data = {
-       .bus_clk_rate   = 10000,
-       .scl_gpio       = TEGRA_GPIO_I2C4_SCL,
-       .sda_gpio       = TEGRA_GPIO_I2C4_SDA,
-};
-
-static struct tegra_i2c_platform_data macallan_i2c5_platform_data = {
-       .bus_clk_rate   = 400000,
-       .scl_gpio       = TEGRA_GPIO_I2C5_SCL,
-       .sda_gpio       = TEGRA_GPIO_I2C5_SDA,
-};
-#endif
-
 static struct i2c_board_info __initdata rt5640_board_info = {
        I2C_BOARD_INFO("rt5640", 0x1c),
 };
@@ -265,20 +177,6 @@ static struct i2c_board_info __initdata nfc_board_info = {
 
 static void macallan_i2c_init(void)
 {
-#ifndef CONFIG_USE_OF
-       tegra11_i2c_device1.dev.platform_data = &macallan_i2c1_platform_data;
-       tegra11_i2c_device2.dev.platform_data = &macallan_i2c2_platform_data;
-       tegra11_i2c_device3.dev.platform_data = &macallan_i2c3_platform_data;
-       tegra11_i2c_device4.dev.platform_data = &macallan_i2c4_platform_data;
-       tegra11_i2c_device5.dev.platform_data = &macallan_i2c5_platform_data;
-
-       platform_device_register(&tegra11_i2c_device5);
-       platform_device_register(&tegra11_i2c_device4);
-       platform_device_register(&tegra11_i2c_device3);
-       platform_device_register(&tegra11_i2c_device2);
-       platform_device_register(&tegra11_i2c_device1);
-#endif
-
        nfc_board_info.irq = gpio_to_irq(TEGRA_GPIO_PW2);
        i2c_register_board_info(0, &nfc_board_info, 1);
        i2c_register_board_info(0, &rt5640_board_info, 1);
@@ -290,16 +188,6 @@ static struct platform_device *macallan_uart_devices[] __initdata = {
        &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_uart_platform_data macallan_uart_pdata;
-static struct tegra_uart_platform_data macallan_loopback_uart_pdata;
 
 static void __init uart_debug_init(void)
 {
@@ -314,30 +202,6 @@ static void __init uart_debug_init(void)
 
 static void __init macallan_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);
-       }
-       macallan_uart_pdata.parent_clk_list = uart_parent_clk;
-       macallan_uart_pdata.parent_clk_count = ARRAY_SIZE(uart_parent_clk);
-       macallan_loopback_uart_pdata.parent_clk_list = uart_parent_clk;
-       macallan_loopback_uart_pdata.parent_clk_count =
-                                               ARRAY_SIZE(uart_parent_clk);
-       macallan_loopback_uart_pdata.is_loopback = true;
-       tegra_uarta_device.dev.platform_data = &macallan_uart_pdata;
-       tegra_uartb_device.dev.platform_data = &macallan_uart_pdata;
-       tegra_uartc_device.dev.platform_data = &macallan_uart_pdata;
-       tegra_uartd_device.dev.platform_data = &macallan_uart_pdata;
-
        /* Register low speed only if it is selected */
        if (!is_tegra_debug_uartport_hs())
                uart_debug_init();
@@ -427,8 +291,11 @@ static struct platform_device *macallan_devices[] __initdata = {
 static struct tegra_usb_platform_data tegra_udc_pdata = {
        .port_otg = true,
        .has_hostpc = true,
+       .support_pmu_vbus = true,
+       .id_det_type = TEGRA_USB_PMU_ID,
        .phy_intf = TEGRA_USB_PHY_INTF_UTMI,
        .op_mode = TEGRA_USB_OPMODE_DEVICE,
+       .vbus_extcon_dev_name = "palmas-extcon",
        .u_data.dev = {
                .vbus_pmu_irq = 0,
                .vbus_gpio = -1,
@@ -441,8 +308,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,
        },
@@ -451,9 +318,13 @@ static struct tegra_usb_platform_data tegra_udc_pdata = {
 static struct tegra_usb_platform_data tegra_ehci1_utmi_pdata = {
        .port_otg = true,
        .has_hostpc = true,
+       .support_pmu_vbus = true,
+       .id_det_type = TEGRA_USB_PMU_ID,
        .unaligned_dma_buf_supported = false,
        .phy_intf = TEGRA_USB_PHY_INTF_UTMI,
        .op_mode = TEGRA_USB_OPMODE_HOST,
+       .vbus_extcon_dev_name = "palmas-extcon",
+       .id_extcon_dev_name = "palmas-extcon",
        .u_data.host = {
                .vbus_gpio = -1,
                .hot_plug = false,
@@ -466,8 +337,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,
@@ -580,49 +451,6 @@ static void macallan_audio_init(void)
 }
 
 
-static struct platform_device *macallan_spi_devices[] __initdata = {
-       &tegra11_spi_device1,
-};
-
-struct spi_clk_parent spi_parent_clk_macallan[] = {
-       [0] = {.name = "pll_p"},
-#ifndef CONFIG_TEGRA_PLLM_RESTRICTED
-       [1] = {.name = "pll_m"},
-       [2] = {.name = "clk_m"},
-#else
-       [1] = {.name = "clk_m"},
-#endif
-};
-
-static struct tegra_spi_platform_data macallan_spi_pdata = {
-       .is_dma_based           = false,
-       .max_dma_buffer         = 16 * 1024,
-       .is_clkon_always        = false,
-       .max_rate               = 25000000,
-};
-
-static void __init macallan_spi_init(void)
-{
-       int i;
-       struct clk *c;
-
-       for (i = 0; i < ARRAY_SIZE(spi_parent_clk_macallan); ++i) {
-               c = tegra_get_clock_by_name(spi_parent_clk_macallan[i].name);
-               if (IS_ERR_OR_NULL(c)) {
-                       pr_err("Not able to get the clock for %s\n",
-                                       spi_parent_clk_macallan[i].name);
-                       continue;
-               }
-               spi_parent_clk_macallan[i].parent_clk = c;
-               spi_parent_clk_macallan[i].fixed_clk_rate = clk_get_rate(c);
-       }
-       macallan_spi_pdata.parent_clk_list = spi_parent_clk_macallan;
-       macallan_spi_pdata.parent_clk_count = ARRAY_SIZE(spi_parent_clk_macallan);
-       tegra11_spi_device1.dev.platform_data = &macallan_spi_pdata;
-       platform_add_devices(macallan_spi_devices,
-                               ARRAY_SIZE(macallan_spi_devices));
-}
-
 static __initdata struct tegra_clk_init_table touch_clk_init_table[] = {
        /* name         parent          rate            enabled */
        { "extern2",    "pll_p",        41000000,       false},
@@ -639,7 +467,7 @@ struct rm_spi_ts_platform_data rm31080ts_macallan_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,
 };
 
@@ -696,17 +524,9 @@ struct of_dev_auxdata macallan_auxdata_lookup[] __initdata = {
                                NULL),
        OF_DEV_AUXDATA("nvidia,tegra114-tsec", TEGRA_TSEC_BASE, "tsec",
                                NULL),
+       T114_I2C_OF_DEV_AUXDATA,
+       T114_SPI_OF_DEV_AUXDATA,
 
-       OF_DEV_AUXDATA("nvidia,tegra114-i2c", 0x7000c000, "tegra11-i2c.0",
-                               NULL),
-       OF_DEV_AUXDATA("nvidia,tegra114-i2c", 0x7000c400, "tegra11-i2c.1",
-                               NULL),
-       OF_DEV_AUXDATA("nvidia,tegra114-i2c", 0x7000c500, "tegra11-i2c.2",
-                               NULL),
-       OF_DEV_AUXDATA("nvidia,tegra114-i2c", 0x7000c700, "tegra11-i2c.3",
-                               NULL),
-       OF_DEV_AUXDATA("nvidia,tegra114-i2c", 0x7000d000, "tegra11-i2c.4",
-                               NULL),
        {}
 };
 #endif
@@ -714,23 +534,18 @@ struct of_dev_auxdata macallan_auxdata_lookup[] __initdata = {
 static void __init tegra_macallan_early_init(void)
 {
        tegra_clk_init_from_table(macallan_clk_init_table);
-       tegra_clk_vefify_parents();
-       tegra_smmu_init();
+       tegra_clk_verify_parents();
        tegra_soc_device_init("macallan");
 }
 
 
 static void __init tegra_macallan_late_init(void)
 {
-       platform_device_register(&tegra_pinmux_device);
-       macallan_pinmux_init();
        macallan_i2c_init();
-       macallan_spi_init();
        macallan_usb_init();
        macallan_uart_init();
        macallan_audio_init();
        platform_add_devices(macallan_devices, ARRAY_SIZE(macallan_devices));
-       //tegra_ram_console_debug_init();
        tegra_io_dpd_init();
        macallan_regulator_init();
        macallan_sdhci_init();
@@ -742,28 +557,20 @@ static void __init tegra_macallan_late_init(void)
        macallan_panel_init();
        macallan_kbc_init();
        macallan_pmon_init();
-#ifdef CONFIG_BT_BLUESLEEP
-       macallan_setup_bluesleep();
-       macallan_setup_bt_rfkill();
-#elif defined CONFIG_BLUEDROID_PM
-       macallan_setup_bluedroid_pm();
+#if defined CONFIG_TI_ST || defined CONFIG_TI_ST_MODULE
+       macallan_bt_st();
+       macallan_tegra_setup_st_host_wake();
 #endif
-       tegra_release_bootloader_fb();
        macallan_modem_init();
 #ifdef CONFIG_TEGRA_WDT_RECOVERY
        tegra_wdt_recovery_init();
 #endif
        tegra_serial_debug_init(TEGRA_UARTD_BASE, INT_WDT_CPU, NULL, -1, -1);
-       /* macallan_sensors_init(); */
+       macallan_sensors_init();
        macallan_soctherm_init();
        tegra_register_fuse();
 }
 
-static void __init macallan_ramconsole_reserve(unsigned long size)
-{
-       tegra_ram_console_debug_reserve(SZ_1M);
-}
-
 static void __init tegra_macallan_dt_init(void)
 {
        tegra_get_board_info(&board_info);
@@ -786,11 +593,10 @@ static void __init tegra_macallan_reserve(void)
 {
 #if defined(CONFIG_NVMAP_CONVERT_CARVEOUT_TO_IOVMM)
        /* 1920*1200*4*2 = 18432000 bytes */
-       tegra_reserve(0, SZ_16M + SZ_2M, SZ_16M);
+       tegra_reserve(0, SZ_16M + SZ_2M, SZ_16M + SZ_2M);
 #else
-       tegra_reserve(SZ_128M, SZ_16M + SZ_2M, SZ_4M);
+       tegra_reserve(SZ_128M, SZ_16M + SZ_2M, SZ_16M + SZ_2M);
 #endif
-       macallan_ramconsole_reserve(SZ_1M);
 }
 
 static const char * const macallan_dt_board_compat[] = {
@@ -804,9 +610,8 @@ MACHINE_START(MACALLAN, "macallan")
        .map_io         = tegra_map_common_io,
        .reserve        = tegra_macallan_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_macallan_dt_init,
        .restart        = tegra_assert_system_reset,
        .dt_compat      = macallan_dt_board_compat,