Merge tag 'soc2' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc
[firefly-linux-kernel-4.4.55.git] / arch / arm / mach-exynos / mach-exynos5-dt.c
index f906f599a141b414e045a6664d90f3eb5bcca2c4..f038c8cadca484e1831cd3277394bd8565ab88c1 100644 (file)
@@ -10,7 +10,9 @@
 */
 
 #include <linux/of_platform.h>
+#include <linux/of_fdt.h>
 #include <linux/serial_core.h>
+#include <linux/memblock.h>
 #include <linux/io.h>
 
 #include <asm/mach/arch.h>
@@ -20,6 +22,7 @@
 
 #include <plat/cpu.h>
 #include <plat/regs-serial.h>
+#include <plat/mfc.h>
 
 #include "common.h"
 
@@ -51,6 +54,16 @@ static const struct of_dev_auxdata exynos5250_auxdata_lookup[] __initconst = {
                                "s3c2440-i2c.1", NULL),
        OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS5_PA_IIC(2),
                                "s3c2440-i2c.2", NULL),
+       OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS5_PA_IIC(3),
+                               "s3c2440-i2c.3", NULL),
+       OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS5_PA_IIC(4),
+                               "s3c2440-i2c.4", NULL),
+       OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS5_PA_IIC(5),
+                               "s3c2440-i2c.5", NULL),
+       OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS5_PA_IIC(6),
+                               "s3c2440-i2c.6", NULL),
+       OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS5_PA_IIC(7),
+                               "s3c2440-i2c.7", NULL),
        OF_DEV_AUXDATA("samsung,s3c2440-hdmiphy-i2c", EXYNOS5_PA_IIC(8),
                                "s3c2440-hdmiphy-i2c", NULL),
        OF_DEV_AUXDATA("samsung,exynos5250-dw-mshc", EXYNOS5_PA_DWMCI0,
@@ -67,6 +80,12 @@ static const struct of_dev_auxdata exynos5250_auxdata_lookup[] __initconst = {
                                "exynos4210-spi.1", NULL),
        OF_DEV_AUXDATA("samsung,exynos4210-spi", EXYNOS5_PA_SPI2,
                                "exynos4210-spi.2", NULL),
+       OF_DEV_AUXDATA("samsung,exynos5-sata-ahci", 0x122F0000,
+                               "exynos5-sata", NULL),
+       OF_DEV_AUXDATA("samsung,exynos5-sata-phy", 0x12170000,
+                               "exynos5-sata-phy", NULL),
+       OF_DEV_AUXDATA("samsung,exynos5-sata-phy-i2c", 0x121D0000,
+                               "exynos5-sata-phy-i2c", NULL),
        OF_DEV_AUXDATA("arm,pl330", EXYNOS5_PA_PDMA0, "dma-pl330.0", NULL),
        OF_DEV_AUXDATA("arm,pl330", EXYNOS5_PA_PDMA1, "dma-pl330.1", NULL),
        OF_DEV_AUXDATA("arm,pl330", EXYNOS5_PA_MDMA1, "dma-pl330.2", NULL),
@@ -82,16 +101,29 @@ static const struct of_dev_auxdata exynos5250_auxdata_lookup[] __initconst = {
                                "exynos5-hdmi", NULL),
        OF_DEV_AUXDATA("samsung,exynos5-mixer", 0x14450000,
                                "exynos5-mixer", NULL),
+       OF_DEV_AUXDATA("samsung,mfc-v6", 0x11000000, "s5p-mfc-v6", NULL),
+       OF_DEV_AUXDATA("samsung,exynos5250-tmu", 0x10060000,
+                               "exynos-tmu", NULL),
        {},
 };
 
-static void __init exynos5250_dt_map_io(void)
+static const struct of_dev_auxdata exynos5440_auxdata_lookup[] __initconst = {
+       OF_DEV_AUXDATA("samsung,exynos4210-uart", EXYNOS5440_PA_UART0,
+                               "exynos4210-uart.0", NULL),
+       {},
+};
+
+static void __init exynos5_dt_map_io(void)
 {
+       unsigned long root = of_get_flat_dt_root();
+
        exynos_init_io(NULL, 0);
-       s3c24xx_init_clocks(24000000);
+
+       if (of_flat_dt_is_compatible(root, "samsung,exynos5250"))
+               s3c24xx_init_clocks(24000000);
 }
 
-static void __init exynos5250_dt_machine_init(void)
+static void __init exynos5_dt_machine_init(void)
 {
        struct device_node *i2c_np;
        const char *i2c_compat = "samsung,s3c2440-i2c";
@@ -115,24 +147,41 @@ static void __init exynos5250_dt_machine_init(void)
                }
        }
 
-       of_platform_populate(NULL, of_default_bus_match_table,
-                               exynos5250_auxdata_lookup, NULL);
+       if (of_machine_is_compatible("samsung,exynos5250"))
+               of_platform_populate(NULL, of_default_bus_match_table,
+                                    exynos5250_auxdata_lookup, NULL);
+       else if (of_machine_is_compatible("samsung,exynos5440"))
+               of_platform_populate(NULL, of_default_bus_match_table,
+                                    exynos5440_auxdata_lookup, NULL);
 }
 
-static char const *exynos5250_dt_compat[] __initdata = {
+static char const *exynos5_dt_compat[] __initdata = {
        "samsung,exynos5250",
+       "samsung,exynos5440",
        NULL
 };
 
+static void __init exynos5_reserve(void)
+{
+       struct s5p_mfc_dt_meminfo mfc_mem;
+
+       /* Reserve memory for MFC only if it's available */
+       mfc_mem.compatible = "samsung,mfc-v6";
+       if (of_scan_flat_dt(s5p_fdt_find_mfc_mem, &mfc_mem))
+               s5p_mfc_reserve_mem(mfc_mem.roff, mfc_mem.rsize, mfc_mem.loff,
+                               mfc_mem.lsize);
+}
+
 DT_MACHINE_START(EXYNOS5_DT, "SAMSUNG EXYNOS5 (Flattened Device Tree)")
        /* Maintainer: Kukjin Kim <kgene.kim@samsung.com> */
        .init_irq       = exynos5_init_irq,
        .smp            = smp_ops(exynos_smp_ops),
-       .map_io         = exynos5250_dt_map_io,
+       .map_io         = exynos5_dt_map_io,
        .handle_irq     = gic_handle_irq,
-       .init_machine   = exynos5250_dt_machine_init,
+       .init_machine   = exynos5_dt_machine_init,
        .init_late      = exynos_init_late,
        .timer          = &exynos4_timer,
-       .dt_compat      = exynos5250_dt_compat,
+       .dt_compat      = exynos5_dt_compat,
        .restart        = exynos5_restart,
+       .reserve        = exynos5_reserve,
 MACHINE_END