Merge tag 'imx-fixes-3.16' of git://git.kernel.org/pub/scm/linux/kernel/git/shawnguo...
[cascardo/linux.git] / arch / arm / mach-exynos / exynos.c
index a763c08..f38cf7c 100644 (file)
@@ -26,8 +26,6 @@
 #include <asm/mach/map.h>
 #include <asm/memory.h>
 
-#include <plat/cpu.h>
-
 #include "common.h"
 #include "mfc.h"
 #include "regs-pmu.h"
@@ -111,51 +109,6 @@ static struct map_desc exynos4_iodesc[] __initdata = {
        },
 };
 
-static struct map_desc exynos4_iodesc0[] __initdata = {
-       {
-               .virtual        = (unsigned long)S5P_VA_SYSRAM,
-               .pfn            = __phys_to_pfn(EXYNOS4_PA_SYSRAM0),
-               .length         = SZ_4K,
-               .type           = MT_DEVICE,
-       },
-};
-
-static struct map_desc exynos4_iodesc1[] __initdata = {
-       {
-               .virtual        = (unsigned long)S5P_VA_SYSRAM,
-               .pfn            = __phys_to_pfn(EXYNOS4_PA_SYSRAM1),
-               .length         = SZ_4K,
-               .type           = MT_DEVICE,
-       },
-};
-
-static struct map_desc exynos4210_iodesc[] __initdata = {
-       {
-               .virtual        = (unsigned long)S5P_VA_SYSRAM_NS,
-               .pfn            = __phys_to_pfn(EXYNOS4210_PA_SYSRAM_NS),
-               .length         = SZ_4K,
-               .type           = MT_DEVICE,
-       },
-};
-
-static struct map_desc exynos4x12_iodesc[] __initdata = {
-       {
-               .virtual        = (unsigned long)S5P_VA_SYSRAM_NS,
-               .pfn            = __phys_to_pfn(EXYNOS4x12_PA_SYSRAM_NS),
-               .length         = SZ_4K,
-               .type           = MT_DEVICE,
-       },
-};
-
-static struct map_desc exynos5250_iodesc[] __initdata = {
-       {
-               .virtual        = (unsigned long)S5P_VA_SYSRAM_NS,
-               .pfn            = __phys_to_pfn(EXYNOS5250_PA_SYSRAM_NS),
-               .length         = SZ_4K,
-               .type           = MT_DEVICE,
-       },
-};
-
 static struct map_desc exynos5_iodesc[] __initdata = {
        {
                .virtual        = (unsigned long)S3C_VA_SYS,
@@ -177,11 +130,6 @@ static struct map_desc exynos5_iodesc[] __initdata = {
                .pfn            = __phys_to_pfn(EXYNOS5_PA_SROMC),
                .length         = SZ_4K,
                .type           = MT_DEVICE,
-       }, {
-               .virtual        = (unsigned long)S5P_VA_SYSRAM,
-               .pfn            = __phys_to_pfn(EXYNOS5_PA_SYSRAM),
-               .length         = SZ_4K,
-               .type           = MT_DEVICE,
        }, {
                .virtual        = (unsigned long)S5P_VA_CMU,
                .pfn            = __phys_to_pfn(EXYNOS5_PA_CMU),
@@ -218,12 +166,16 @@ void exynos_restart(enum reboot_mode mode, const char *cmd)
 }
 
 static struct platform_device exynos_cpuidle = {
-       .name           = "exynos_cpuidle",
-       .id             = -1,
+       .name              = "exynos_cpuidle",
+       .dev.platform_data = exynos_enter_aftr,
+       .id                = -1,
 };
 
 void __init exynos_cpuidle_init(void)
 {
+       if (soc_is_exynos5440())
+               return;
+
        platform_device_register(&exynos_cpuidle);
 }
 
@@ -232,6 +184,28 @@ void __init exynos_cpufreq_init(void)
        platform_device_register_simple("exynos-cpufreq", -1, NULL, 0);
 }
 
+void __iomem *sysram_base_addr;
+void __iomem *sysram_ns_base_addr;
+
+void __init exynos_sysram_init(void)
+{
+       struct device_node *node;
+
+       for_each_compatible_node(node, NULL, "samsung,exynos4210-sysram") {
+               if (!of_device_is_available(node))
+                       continue;
+               sysram_base_addr = of_iomap(node, 0);
+               break;
+       }
+
+       for_each_compatible_node(node, NULL, "samsung,exynos4210-sysram-ns") {
+               if (!of_device_is_available(node))
+                       continue;
+               sysram_ns_base_addr = of_iomap(node, 0);
+               break;
+       }
+}
+
 void __init exynos_init_late(void)
 {
        if (of_machine_is_compatible("samsung,exynos5440"))
@@ -246,8 +220,8 @@ static int __init exynos_fdt_map_chipid(unsigned long node, const char *uname,
                                        int depth, void *data)
 {
        struct map_desc iodesc;
-       __be32 *reg;
-       unsigned long len;
+       const __be32 *reg;
+       int len;
 
        if (!of_flat_dt_is_compatible(node, "samsung,exynos4210-chipid") &&
                !of_flat_dt_is_compatible(node, "samsung,exynos5440-clock"))
@@ -277,20 +251,6 @@ static void __init exynos_map_io(void)
 
        if (soc_is_exynos5())
                iotable_init(exynos5_iodesc, ARRAY_SIZE(exynos5_iodesc));
-
-       if (soc_is_exynos4210()) {
-               if (samsung_rev() == EXYNOS4210_REV_0)
-                       iotable_init(exynos4_iodesc0,
-                                               ARRAY_SIZE(exynos4_iodesc0));
-               else
-                       iotable_init(exynos4_iodesc1,
-                                               ARRAY_SIZE(exynos4_iodesc1));
-               iotable_init(exynos4210_iodesc, ARRAY_SIZE(exynos4210_iodesc));
-       }
-       if (soc_is_exynos4212() || soc_is_exynos4412())
-               iotable_init(exynos4x12_iodesc, ARRAY_SIZE(exynos4x12_iodesc));
-       if (soc_is_exynos5250())
-               iotable_init(exynos5250_iodesc, ARRAY_SIZE(exynos5250_iodesc));
 }
 
 void __init exynos_init_io(void)
@@ -305,17 +265,6 @@ void __init exynos_init_io(void)
        exynos_map_io();
 }
 
-struct bus_type exynos_subsys = {
-       .name           = "exynos-core",
-       .dev_name       = "exynos-core",
-};
-
-static int __init exynos_core_init(void)
-{
-       return subsys_system_register(&exynos_subsys, NULL);
-}
-core_initcall(exynos_core_init);
-
 static void __init exynos_dt_machine_init(void)
 {
        struct device_node *i2c_np;
@@ -344,6 +293,13 @@ static void __init exynos_dt_machine_init(void)
                }
        }
 
+       /*
+        * This is called from smp_prepare_cpus if we've built for SMP, but
+        * we still need to set it up for PM and firmware ops if not.
+        */
+       if (!IS_ENABLED(SMP))
+               exynos_sysram_init();
+
        exynos_cpuidle_init();
        exynos_cpufreq_init();
 
@@ -351,12 +307,15 @@ static void __init exynos_dt_machine_init(void)
 }
 
 static char const *exynos_dt_compat[] __initconst = {
+       "samsung,exynos3",
+       "samsung,exynos3250",
        "samsung,exynos4",
        "samsung,exynos4210",
        "samsung,exynos4212",
        "samsung,exynos4412",
        "samsung,exynos5",
        "samsung,exynos5250",
+       "samsung,exynos5260",
        "samsung,exynos5420",
        "samsung,exynos5440",
        NULL