ARM: DT: Add DT entry for PWMs and Backlight
[linux-3.10.git] / arch / arm / mach-tegra / board-loki.c
index 2216885..9ba061a 100644 (file)
@@ -34,7 +34,6 @@
 #include <linux/platform_data/tegra_usb.h>
 #include <linux/spi/spi.h>
 #include <linux/spi/rm31080a_ts.h>
-#include <linux/tegra_uart.h>
 #include <linux/memblock.h>
 #include <linux/spi/spi-tegra.h>
 #include <linux/nfc/pn544.h>
 #include <linux/of_platform.h>
 #include <linux/i2c.h>
 #include <linux/i2c-tegra.h>
-#include <linux/tegra_uart.h>
-#include <linux/serial_tegra.h>
+#include <linux/platform_data/serial-tegra.h>
 #include <linux/edp.h>
 #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/clk.h>
 #include <mach/irqs.h>
-#include <mach/pci.h>
 #include <mach/tegra_fiq_debugger.h>
 
 #include <mach/pinmux.h>
@@ -72,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"
@@ -80,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"
@@ -135,15 +134,9 @@ static noinline void __init loki_setup_bluedroid_pm(void)
        platform_device_register(&loki_bluedroid_pm_device);
 }
 
-/*use board file for T12x*/
-#if defined(CONFIG_ARCH_TEGRA_12x_SOC) || !defined(CONFIG_USE_OF)
 static struct i2c_board_info __initdata rt5639_board_info = {
        I2C_BOARD_INFO("rt5639", 0x1c),
 };
-static struct i2c_board_info __initdata rt5645_board_info = {
-       I2C_BOARD_INFO("rt5645", 0x1a),
-};
-#endif
 
 static __initdata struct tegra_clk_init_table loki_clk_init_table[] = {
        /* name         parent          rate            enabled */
@@ -184,105 +177,9 @@ static __initdata struct tegra_clk_init_table loki_clk_init_table[] = {
        { NULL,         NULL,           0,              0},
 };
 
-#if defined(CONFIG_ARCH_TEGRA_12x_SOC) || !defined(CONFIG_USE_OF)
-static struct tegra_i2c_platform_data loki_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 loki_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 loki_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 loki_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 loki_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
-
-static struct i2c_hid_platform_data i2c_keyboard_pdata = {
-       .hid_descriptor_address = 0x0,
-};
-
-static struct i2c_board_info __initdata i2c_keyboard_board_info = {
-       I2C_BOARD_INFO("hid", 0x3B),
-       .platform_data  = &i2c_keyboard_pdata,
-};
-
-static struct i2c_hid_platform_data i2c_touchpad_pdata = {
-       .hid_descriptor_address = 0x20,
-};
-
-static struct i2c_board_info __initdata i2c_touchpad_board_info = {
-       I2C_BOARD_INFO("hid", 0x2C),
-       .platform_data  = &i2c_touchpad_pdata,
-};
-
 static void loki_i2c_init(void)
 {
-       struct board_info board_info;
-       tegra_get_board_info(&board_info);
-#ifdef CONFIG_ARCH_TEGRA_11x_SOC
-#ifndef CONFIG_USE_OF
-       tegra11_i2c_device1.dev.platform_data = &loki_i2c1_platform_data;
-       tegra11_i2c_device2.dev.platform_data = &loki_i2c2_platform_data;
-       tegra11_i2c_device3.dev.platform_data = &loki_i2c3_platform_data;
-       tegra11_i2c_device4.dev.platform_data = &loki_i2c4_platform_data;
-       tegra11_i2c_device5.dev.platform_data = &loki_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
-#else
-       /* T124 does not use device tree as of now */
-       tegra14_i2c_device1.dev.platform_data = &loki_i2c1_platform_data;
-       tegra14_i2c_device2.dev.platform_data = &loki_i2c2_platform_data;
-       tegra14_i2c_device3.dev.platform_data = &loki_i2c3_platform_data;
-       tegra14_i2c_device4.dev.platform_data = &loki_i2c4_platform_data;
-       tegra14_i2c_device5.dev.platform_data = &loki_i2c5_platform_data;
-
-       platform_device_register(&tegra14_i2c_device5);
-       platform_device_register(&tegra14_i2c_device4);
-       platform_device_register(&tegra14_i2c_device3);
-       platform_device_register(&tegra14_i2c_device2);
-       platform_device_register(&tegra14_i2c_device1);
-#endif
-
-#if defined(CONFIG_ARCH_TEGRA_12x_SOC) || !defined(CONFIG_USE_OF)
        i2c_register_board_info(0, &rt5639_board_info, 1);
-       i2c_register_board_info(0, &rt5645_board_info, 1);
-#endif
-
-       if (board_info.board_id == BOARD_PM359 ||
-                       board_info.board_id == BOARD_PM358 ||
-                       board_info.board_id == BOARD_PM363) {
-               i2c_keyboard_board_info.irq = gpio_to_irq(I2C_KB_IRQ);
-               i2c_register_board_info(1, &i2c_keyboard_board_info , 1);
-
-               i2c_touchpad_board_info.irq = gpio_to_irq(I2C_TP_IRQ);
-               i2c_register_board_info(1, &i2c_touchpad_board_info , 1);
-       }
 }
 
 #ifndef CONFIG_USE_OF
@@ -313,8 +210,6 @@ static struct tegra_serial_platform_data loki_uartd_pdata = {
        .modem_interrupt = false,
 };
 
-/*use board file for T12x*/
-#if defined(CONFIG_ARCH_TEGRA_12x_SOC) || !defined(CONFIG_USE_OF)
 static struct tegra_asoc_platform_data loki_audio_pdata_rt5639 = {
        .gpio_hp_det = TEGRA_GPIO_HP_DET,
        .gpio_ldo1_en = TEGRA_GPIO_LDO_EN,
@@ -337,72 +232,20 @@ static struct tegra_asoc_platform_data loki_audio_pdata_rt5639 = {
        },
 };
 
-static struct tegra_asoc_platform_data loki_audio_pdata_rt5645 = {
-       .gpio_hp_det = TEGRA_GPIO_HP_DET,
-       .gpio_ldo1_en = TEGRA_GPIO_LDO_EN,
-       .gpio_spkr_en = -1,
-       .gpio_int_mic_en = -1,
-       .gpio_ext_mic_en = -1,
-       .gpio_hp_mute = -1,
-       .gpio_codec1 = -1,
-       .gpio_codec2 = -1,
-       .gpio_codec3 = -1,
-       .i2s_param[HIFI_CODEC]       = {
-               .audio_port_id = 1,
-               .is_i2s_master = 0,
-               .i2s_mode = TEGRA_DAIFMT_I2S,
-       },
-       .i2s_param[BT_SCO] = {
-               .audio_port_id = 3,
-               .is_i2s_master = 1,
-               .i2s_mode = TEGRA_DAIFMT_DSP_A,
-       },
-};
-
 static void loki_audio_init(void)
 {
-       struct board_info board_info;
-       tegra_get_board_info(&board_info);
-       if (board_info.board_id == BOARD_PM359 ||
-                       board_info.board_id == BOARD_PM358 ||
-                       board_info.board_id == BOARD_PM363) {
-               /*Laguna*/
-               loki_audio_pdata_rt5645.gpio_hp_det =
-                       TEGRA_GPIO_HP_DET;
-               loki_audio_pdata_rt5645.gpio_hp_det_active_high = 1;
-               loki_audio_pdata_rt5645.gpio_ldo1_en = -1;
-       } else {
-               /*Loki*/
-               loki_audio_pdata_rt5645.gpio_hp_det =
-                       TEGRA_GPIO_HP_DET;
-               loki_audio_pdata_rt5645.gpio_hp_det_active_high = 0;
-               loki_audio_pdata_rt5645.gpio_ldo1_en =
-                       TEGRA_GPIO_LDO_EN;
-       }
-
        loki_audio_pdata_rt5639.gpio_hp_det =
-               loki_audio_pdata_rt5645.gpio_hp_det;
+                       TEGRA_GPIO_HP_DET;
 
-       loki_audio_pdata_rt5639.gpio_hp_det_active_high =
-               loki_audio_pdata_rt5645.gpio_hp_det_active_high;
+       loki_audio_pdata_rt5639.gpio_hp_det_active_high = 0;
 
        loki_audio_pdata_rt5639.gpio_ldo1_en =
-               loki_audio_pdata_rt5645.gpio_ldo1_en;
+                       TEGRA_GPIO_LDO_EN;
 
        loki_audio_pdata_rt5639.codec_name = "rt5639.0-001c";
        loki_audio_pdata_rt5639.codec_dai_name = "rt5639-aif1";
-       loki_audio_pdata_rt5645.codec_name = "rt5645.0-001a";
-       loki_audio_pdata_rt5645.codec_dai_name = "rt5645-aif1";
 }
 
-static struct platform_device loki_audio_device_rt5645 = {
-       .name = "tegra-snd-rt5645",
-       .id = 0,
-       .dev = {
-               .platform_data = &loki_audio_pdata_rt5645,
-       },
-};
-
 static struct platform_device loki_audio_device_rt5639 = {
        .name = "tegra-snd-rt5639",
        .id = 0,
@@ -411,8 +254,6 @@ static struct platform_device loki_audio_device_rt5639 = {
        },
 };
 
-#endif
-
 static void __init loki_uart_init(void)
 {
        int debug_port_id;
@@ -462,19 +303,15 @@ 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
 #if defined(CONFIG_CRYPTO_DEV_TEGRA_SE)
-#ifdef CONFIG_ARCH_TEGRA_12x_SOC
        &tegra12_se_device,
 #endif
-#ifdef CONFIG_ARCH_TEGRA_11x_SOC
-       &tegra11_se_device,
-#endif
-#endif
-/*use board file for T12x*/
-#if defined(CONFIG_ARCH_TEGRA_12x_SOC) || !defined(CONFIG_USE_OF)
        &tegra_ahub_device,
        &tegra_dam_device0,
        &tegra_dam_device1,
@@ -484,7 +321,6 @@ static struct platform_device *loki_devices[] __initdata = {
        &tegra_i2s_device4,
        &loki_audio_device_rt5639,
        &tegra_spdif_device,
-#endif
        &spdif_dit_device,
        &bluetooth_dit_device,
        &tegra_hda_device,
@@ -544,7 +380,6 @@ static struct tegra_usb_platform_data tegra_ehci1_utmi_pdata = {
        },
 };
 
-#ifdef CONFIG_ARCH_TEGRA_12x_SOC
 static struct tegra_usb_platform_data tegra_ehci2_utmi_pdata = {
        .port_otg = false,
        .has_hostpc = true,
@@ -570,7 +405,6 @@ static struct tegra_usb_platform_data tegra_ehci2_utmi_pdata = {
                .vbus_oc_map = 0x5,
        },
 };
-#endif
 
 static struct tegra_usb_platform_data tegra_ehci3_utmi_pdata = {
        .port_otg = false,
@@ -599,7 +433,6 @@ static struct tegra_usb_platform_data tegra_ehci3_utmi_pdata = {
 };
 
 static struct gpio modem_gpios[] = { /* Bruce modem */
-       {MODEM_EN, GPIOF_OUT_INIT_HIGH, "MODEM EN"},
        {MDM_RST, GPIOF_OUT_INIT_LOW, "MODEM RESET"},
 };
 
@@ -641,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;
@@ -664,7 +486,6 @@ static void loki_usb_init(void)
                /* Setup the udc platform data */
                tegra_udc_device.dev.platform_data = &tegra_udc_pdata;
        }
-#ifdef CONFIG_ARCH_TEGRA_12x_SOC
        if (!(usb_port_owner_info & UTMI2_PORT_OWNER_XUSB)) {
                if (!modem_id) {
                        tegra_ehci2_device.dev.platform_data =
@@ -672,7 +493,6 @@ static void loki_usb_init(void)
                        platform_device_register(&tegra_ehci2_device);
                }
        }
-#endif
        if (!(usb_port_owner_info & UTMI3_PORT_OWNER_XUSB)) {
                tegra_ehci3_device.dev.platform_data = &tegra_ehci3_utmi_pdata;
                platform_device_register(&tegra_ehci3_device);
@@ -680,32 +500,18 @@ static void loki_usb_init(void)
 }
 
 static struct tegra_xusb_board_data xusb_bdata = {
-#ifdef CONFIG_ARCH_TEGRA_11x_SOC
-       .portmap = TEGRA_XUSB_SS_P0 | TEGRA_XUSB_USB2_P0 | TEGRA_XUSB_USB2_P1,
-       .supply = {
-               .s5p0v = "usb_vbus0",
-               .s5p0v1 = "usb_vbus1",
-               .s5p0v2 = "usb_vbus2",
-               .s3p3v = "hvdd_usb",
-               .s1p8v = "avdd_usb_pll",
-               .s1p2v = "vddio_hsic",
-               .s1p05v = "avddio_usb",
-       },
-#else
        .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",
-               .s1p2v = "vddio_hsic",
+               .vddio_hsic = "vddio_hsic",
                .s1p05v = "avddio_usb",
        },
-#endif
        .uses_external_pmic = false,
-       .uses_different_vbus_per_port = true,
 };
 
 static void loki_xusb_init(void)
@@ -877,29 +683,6 @@ static void __init loki_spi_init(void)
 
 #ifdef CONFIG_USE_OF
 struct of_dev_auxdata loki_auxdata_lookup[] __initdata = {
-#ifdef CONFIG_ARCH_TEGRA_11x_SOC
-       /* sdhci and i2c dt support not planned for bringup */
-       OF_DEV_AUXDATA("nvidia,tegra114-sdhci", 0x78000600, "sdhci-tegra.3",
-                               NULL),
-       OF_DEV_AUXDATA("nvidia,tegra114-sdhci", 0x78000400, "sdhci-tegra.2",
-                               NULL),
-#if 0
-       OF_DEV_AUXDATA("nvidia,tegra114-sdhci", 0x78000000, "sdhci-tegra.0",
-                               &loki_tegra_sdhci_platform_data0),
-#endif
-       OF_DEV_AUXDATA("nvidia,tegra114-camera", 0x0, "tegra_camera",
-                               NULL),
-       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
        OF_DEV_AUXDATA("nvidia,tegra114-spi", 0x7000d400, "spi-tegra114.0",
                                NULL),
        OF_DEV_AUXDATA("nvidia,tegra114-spi", 0x7000d600, "spi-tegra114.1",
@@ -912,48 +695,41 @@ struct of_dev_auxdata loki_auxdata_lookup[] __initdata = {
                                NULL),
        OF_DEV_AUXDATA("nvidia,tegra114-spi", 0x7000de00, "spi-tegra114.5",
                                NULL),
-#ifdef CONFIG_ARCH_TEGRA_11x_SOC
-       OF_DEV_AUXDATA("nvidia,tegra30-ahub", 0x70080000, "tegra30-ahub",
-                               NULL),
-       OF_DEV_AUXDATA("nvidia,tegra-audio-rt5645", 0x0, "tegra-snd-rt5645",
-                               NULL),
-       OF_DEV_AUXDATA("nvidia,tegra-audio-rt5639", 0x0, "tegra-snd-rt5639",
-                               NULL),
-       OF_DEV_AUXDATA("nvidia,tegra114-apbdma", 0x6000a000, "tegra-apbdma",
-                               NULL),
-       OF_DEV_AUXDATA("nvidia,tegra114-host1x", TEGRA_HOST1X_BASE, "host1x",
-                               NULL),
-       OF_DEV_AUXDATA("nvidia,tegra114-gr3d", TEGRA_GR3D_BASE, "gr3d",
-                               NULL),
-       OF_DEV_AUXDATA("nvidia,tegra114-gr2d", TEGRA_GR2D_BASE, "gr2d",
-                               NULL),
-       OF_DEV_AUXDATA("nvidia,tegra114-msenc", TEGRA_MSENC_BASE, "msenc",
-                               NULL),
-       OF_DEV_AUXDATA("nvidia,tegra114-vi", TEGRA_VI_BASE, "vi",
-                               NULL),
-       OF_DEV_AUXDATA("nvidia,tegra114-isp", TEGRA_ISP_BASE, "isp",
-                               NULL),
-       OF_DEV_AUXDATA("nvidia,tegra114-tsec", TEGRA_TSEC_BASE, "tsec",
-                               NULL),
-#else
        OF_DEV_AUXDATA("nvidia,tegra124-apbdma", 0x60020000, "tegra-apbdma",
                                NULL),
        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),
        OF_DEV_AUXDATA("nvidia,tegra124-isp", TEGRA_ISP_BASE, "isp", NULL),
        OF_DEV_AUXDATA("nvidia,tegra124-tsec", TEGRA_TSEC_BASE, "tsec", NULL),
-#endif
        OF_DEV_AUXDATA("nvidia,tegra114-hsuart", 0x70006000, "serial-tegra.0",
                                NULL),
        OF_DEV_AUXDATA("nvidia,tegra114-hsuart", 0x70006040, "serial-tegra.1",
                                NULL),
        OF_DEV_AUXDATA("nvidia,tegra114-hsuart", 0x70006200, "serial-tegra.2",
                                NULL),
+       OF_DEV_AUXDATA("nvidia,tegra124-i2c", 0x7000c000, "tegra12-i2c.0",
+                               NULL),
+       OF_DEV_AUXDATA("nvidia,tegra124-i2c", 0x7000c400, "tegra12-i2c.1",
+                               NULL),
+       OF_DEV_AUXDATA("nvidia,tegra124-i2c", 0x7000c500, "tegra12-i2c.2",
+                               NULL),
+       OF_DEV_AUXDATA("nvidia,tegra124-i2c", 0x7000c700, "tegra12-i2c.3",
+                               NULL),
+       OF_DEV_AUXDATA("nvidia,tegra124-i2c", 0x7000d000, "tegra12-i2c.4",
+                               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
@@ -968,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",
 };
@@ -992,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);
@@ -1026,35 +804,28 @@ static void __init tegra_loki_late_init(void)
        loki_i2c_init();
        loki_spi_init();
        loki_uart_init();
-/*use board file for T12x*/
-#if defined(CONFIG_ARCH_TEGRA_12x_SOC) || !defined(CONFIG_USE_OF)
        loki_audio_init();
-#endif
        platform_add_devices(loki_devices, ARRAY_SIZE(loki_devices));
        //tegra_ram_console_debug_init();
        tegra_io_dpd_init();
        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);
@@ -1075,7 +846,6 @@ static void __init tegra_loki_dt_init(void)
        of_platform_populate(NULL,
                of_default_bus_match_table, loki_auxdata_lookup,
                &platform_bus);
-       platform_device_register(&tegra_gpio_device);
 #endif
 
        tegra_loki_late_init();
@@ -1098,19 +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,
-#ifdef CONFIG_ARCH_TEGRA_12x_SOC
-       .init_early     = tegra12x_init_early,
-#else
-       .init_early     = tegra11x_init_early,
-#endif
-       .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