ARM: DT: Add DT entry for PWMs and Backlight
[linux-3.10.git] / arch / arm / mach-tegra / board-loki.c
index 99eb06d..9ba061a 100644 (file)
 #include <linux/mfd/palmas.h>
 #include <linux/usb/tegra_usb_phy.h>
 #include <linux/clk/tegra.h>
+#include <linux/clocksource.h>
+#include <linux/platform_data/tegra_usb_modem_power.h>
+#include <linux/irqchip.h>
 
 #include <mach/irqs.h>
-#include <mach/pci.h>
 #include <mach/tegra_fiq_debugger.h>
 
 #include <mach/pinmux.h>
@@ -70,6 +72,7 @@
 #include <mach/tegra_fiq_debugger.h>
 #include <mach/xusb.h>
 #include <linux/platform_data/tegra_usb_modem_power.h>
+#include <linux/irqchip/tegra.h>
 
 #include "board-touch-raydium.h"
 #include "board.h"
@@ -78,9 +81,7 @@
 #include "board-loki.h"
 #include "devices.h"
 #include "gpio-names.h"
-#include "fuse.h"
 #include "pm.h"
-#include "pm-irq.h"
 #include "common.h"
 #include "tegra-board-id.h"
 #include "iomap.h"
@@ -302,6 +303,9 @@ static struct platform_device *loki_devices[] __initdata = {
        &tegra_pmu_device,
        &tegra_rtc_device,
        &tegra_udc_device,
+#if defined(CONFIG_TEGRA_WATCHDOG)
+       &tegra_wdt0_device,
+#endif
 #if defined(CONFIG_TEGRA_AVP)
        &tegra_avp_device,
 #endif
@@ -470,22 +474,11 @@ static void loki_usb_init(void)
 {
        int usb_port_owner_info = tegra_get_usb_port_owner_info();
        int modem_id = tegra_get_modem_id();
-       struct board_info bi;
 
-       tegra_get_pmu_board_info(&bi);
-
-       switch (bi.board_id) {
-       case BOARD_E1733:
-               /* Host cable is detected through USB ID */
-               tegra_udc_pdata.id_det_type = TEGRA_USB_ID;
-               tegra_ehci1_utmi_pdata.id_det_type = TEGRA_USB_ID;
-               break;
-       case BOARD_E1735:
-               /* Host cable is detected through PMU Interrupt */
-               tegra_udc_pdata.id_det_type = TEGRA_USB_PMU_ID;
-               tegra_ehci1_utmi_pdata.id_det_type = TEGRA_USB_PMU_ID;
-               tegra_otg_pdata.id_extcon_dev_name = "palmas-extcon";
-       }
+       /* Device cable is detected through PMU Interrupt */
+       tegra_udc_pdata.support_pmu_vbus = true;
+       tegra_ehci1_utmi_pdata.support_pmu_vbus = true;
+       tegra_otg_pdata.vbus_extcon_dev_name = "palmas-extcon";
 
        if (!(usb_port_owner_info & UTMI1_PORT_OWNER_XUSB)) {
                tegra_otg_device.dev.platform_data = &tegra_otg_pdata;
@@ -510,16 +503,15 @@ static struct tegra_xusb_board_data xusb_bdata = {
        .portmap = TEGRA_XUSB_SS_P0 | TEGRA_XUSB_USB2_P0 | TEGRA_XUSB_SS_P1 |
                        TEGRA_XUSB_USB2_P1 | TEGRA_XUSB_USB2_P2,
        .supply = {
-               .s5p0v = "usb_vbus0",
-               .s5p0v1 = "usb_vbus1",
-               .s5p0v2 = "usb_vbus2",
+               .utmi_vbuses = {
+                       NULL, NULL, NULL
+               },
                .s3p3v = "hvdd_usb",
                .s1p8v = "avdd_pll_utmip",
                .vddio_hsic = "vddio_hsic",
                .s1p05v = "avddio_usb",
        },
        .uses_external_pmic = false,
-       .uses_different_vbus_per_port = true,
 };
 
 static void loki_xusb_init(void)
@@ -708,7 +700,9 @@ struct of_dev_auxdata loki_auxdata_lookup[] __initdata = {
        OF_DEV_AUXDATA("nvidia,tegra124-host1x", TEGRA_HOST1X_BASE, "host1x",
                NULL),
        OF_DEV_AUXDATA("nvidia,tegra124-gk20a", 0x538F0000, "gk20a", NULL),
+#ifdef CONFIG_ARCH_TEGRA_VIC
        OF_DEV_AUXDATA("nvidia,tegra124-vic", TEGRA_VIC_BASE, "vic03", NULL),
+#endif
        OF_DEV_AUXDATA("nvidia,tegra124-msenc", TEGRA_MSENC_BASE, "msenc",
                NULL),
        OF_DEV_AUXDATA("nvidia,tegra124-vi", TEGRA_VI_BASE, "vi", NULL),
@@ -732,6 +726,10 @@ struct of_dev_auxdata loki_auxdata_lookup[] __initdata = {
                                NULL),
        OF_DEV_AUXDATA("nvidia,tegra124-i2c", 0x7000d100, "tegra12-i2c.5",
                                NULL),
+       OF_DEV_AUXDATA("nvidia,tegra124-pwm", TEGRA_PWFM_BASE, "tegra-pwm",
+                               NULL),
+       OF_DEV_AUXDATA("pwm-backlight", NULL, "pwm-backlight",
+                               NULL),
        {}
 };
 #endif
@@ -746,7 +744,7 @@ static __initdata struct tegra_clk_init_table touch_clk_init_table[] = {
 struct rm_spi_ts_platform_data rm31080ts_loki_data = {
        .gpio_reset = TOUCH_GPIO_RST_RAYDIUM_SPI,
        .config = 0,
-       .platform_id = RM_PLATFORM_R005,
+       .platform_id = RM_PLATFORM_L005,
        .name_of_clock = "clk_out_2",
        .name_of_clock_con = "extern2",
 };
@@ -770,6 +768,8 @@ struct spi_board_info rm31080a_loki_spi_board[1] = {
 
 static int __init loki_touch_init(void)
 {
+       if (tegra_get_touch_panel_id() == TOUCH_PANEL_THOR_WINTEK)
+               rm31080ts_loki_data.platform_id = RM_PLATFORM_R005;
        tegra_clk_init_from_table(touch_clk_init_table);
        rm31080a_loki_spi_board[0].irq =
                gpio_to_irq(TOUCH_GPIO_IRQ_RAYDIUM_SPI);
@@ -811,25 +811,21 @@ static void __init tegra_loki_late_init(void)
        loki_sdhci_init();
        loki_regulator_init();
        loki_suspend_init();
-#if 0
        loki_emc_init();
        loki_edp_init();
-#endif
        isomgr_init();
        loki_touch_init();
        loki_panel_init();
        loki_kbc_init();
        loki_pmon_init();
-       tegra_release_bootloader_fb();
 #ifdef CONFIG_TEGRA_WDT_RECOVERY
        tegra_wdt_recovery_init();
 #endif
        tegra_serial_debug_init(TEGRA_UARTD_BASE, INT_WDT_CPU, NULL, -1, -1);
 
        loki_sensors_init();
-#if 0
+       loki_fan_init();
        loki_soctherm_init();
-#endif
        loki_setup_bluedroid_pm();
        tegra_register_fuse();
        tegra_serial_debug_init(TEGRA_UARTD_BASE, INT_WDT_CPU, NULL, -1, -1);
@@ -872,15 +868,22 @@ static const char * const loki_dt_board_compat[] = {
        NULL
 };
 
+static void __init tegra_loki_init_early(void)
+{
+       loki_rail_alignment_init();
+       tegra12x_init_early();
+}
+
 DT_MACHINE_START(LOKI, "loki")
        .atag_offset    = 0x100,
        .smp            = smp_ops(tegra_smp_ops),
        .map_io         = tegra_map_common_io,
        .reserve        = tegra_loki_reserve,
-       .init_early     = tegra12x_init_early,
-       .init_irq       = tegra_dt_init_irq,
-       .init_time      = tegra_init_timer,
+       .init_early     = tegra_loki_init_early,
+       .init_irq       = irqchip_init,
+       .init_time      = clocksource_of_init,
        .init_machine   = tegra_loki_dt_init,
        .restart        = tegra_assert_system_reset,
        .dt_compat      = loki_dt_board_compat,
+       .init_late      = tegra_init_late
 MACHINE_END