ARM: tegra: reserve memory for ramoops by default
[linux-3.10.git] / arch / arm / mach-tegra / board-macallan.c
index c550302..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
@@ -34,9 +34,8 @@
 #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/skbuff.h>
 #include <linux/ti_wilink_st.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 <mach/clk.h>
 #include <mach/irqs.h>
 #include <mach/pinmux.h>
 #include <mach/pinmux-t11.h>
@@ -59,9 +62,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/hardware.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;
 
@@ -160,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   = 400000,
-       .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),
 };
@@ -210,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);
@@ -235,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)
 {
@@ -259,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();
@@ -376,6 +295,7 @@ static struct tegra_usb_platform_data tegra_udc_pdata = {
        .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,
@@ -403,6 +323,8 @@ static struct tegra_usb_platform_data tegra_ehci1_utmi_pdata = {
        .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,
@@ -426,8 +348,6 @@ static struct tegra_usb_platform_data tegra_ehci1_utmi_pdata = {
 static struct tegra_usb_otg_data tegra_otg_pdata = {
        .ehci_device = &tegra_ehci1_device,
        .ehci_pdata = &tegra_ehci1_utmi_pdata,
-       .vbus_extcon_dev_name = "palmas-extcon",
-       .id_extcon_dev_name = "palmas-extcon",
 };
 
 static void macallan_usb_init(void)
@@ -513,11 +433,6 @@ static void macallan_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 ((tegra_get_chipid() == TEGRA_CHIPID_TEGRA11) &&
-                   (tegra_revision == TEGRA_REVISION_A02)) {
-                       tegra_ehci2_hsic_baseband_pdata \
-                       .unaligned_dma_buf_supported = true;
-               }
                if (!(usb_port_owner_info & HSIC1_PORT_OWNER_XUSB))
                        platform_device_register(&icera_nemo_device);
                break;
@@ -536,50 +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 = {
-       .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);
-       macallan_spi_pdata.is_dma_based = (tegra_revision == TEGRA_REVISION_A01)
-                                                       ? false : true ;
-       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},
@@ -596,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,
 };
 
@@ -653,24 +524,15 @@ 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
 
 static void __init tegra_macallan_early_init(void)
 {
-       macallan_sysedp_init();
        tegra_clk_init_from_table(macallan_clk_init_table);
        tegra_clk_verify_parents();
        tegra_soc_device_init("macallan");
@@ -679,15 +541,11 @@ static void __init tegra_macallan_early_init(void)
 
 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();
@@ -703,7 +561,6 @@ static void __init tegra_macallan_late_init(void)
        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();
@@ -712,13 +569,6 @@ static void __init tegra_macallan_late_init(void)
        macallan_sensors_init();
        macallan_soctherm_init();
        tegra_register_fuse();
-       macallan_sysedp_core_init();
-       macallan_sysedp_psydepl_init();
-}
-
-static void __init macallan_ramconsole_reserve(unsigned long size)
-{
-       tegra_ram_console_debug_reserve(SZ_1M);
 }
 
 static void __init tegra_macallan_dt_init(void)
@@ -743,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[] = {
@@ -761,8 +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,
-       .init_time      = tegra_init_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,