ARM: EXYNOS: Add support to reserve memory for MFC-v7
[firefly-linux-kernel-4.4.55.git] / arch / arm / mach-exynos / mach-exynos5-dt.c
1 /*
2  * SAMSUNG EXYNOS5250 Flattened Device Tree enabled machine
3  *
4  * Copyright (c) 2012 Samsung Electronics Co., Ltd.
5  *              http://www.samsung.com
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License version 2 as
9  * published by the Free Software Foundation.
10 */
11
12 #include <linux/of_platform.h>
13 #include <linux/of_fdt.h>
14 #include <linux/io.h>
15
16 #include <asm/mach/arch.h>
17
18 #include "common.h"
19 #include "mfc.h"
20 #include "regs-pmu.h"
21
22 static void __init exynos5_dt_machine_init(void)
23 {
24         struct device_node *i2c_np;
25         const char *i2c_compat = "samsung,s3c2440-i2c";
26         unsigned int tmp;
27
28         /*
29          * Exynos5's legacy i2c controller and new high speed i2c
30          * controller have muxed interrupt sources. By default the
31          * interrupts for 4-channel HS-I2C controller are enabled.
32          * If node for first four channels of legacy i2c controller
33          * are available then re-configure the interrupts via the
34          * system register.
35          */
36         for_each_compatible_node(i2c_np, NULL, i2c_compat) {
37                 if (of_device_is_available(i2c_np)) {
38                         if (of_alias_get_id(i2c_np, "i2c") < 4) {
39                                 tmp = readl(EXYNOS5_SYS_I2C_CFG);
40                                 writel(tmp & ~(0x1 << of_alias_get_id(i2c_np, "i2c")),
41                                                 EXYNOS5_SYS_I2C_CFG);
42                         }
43                 }
44         }
45
46         exynos_cpuidle_init();
47         exynos_cpufreq_init();
48
49         of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
50 }
51
52 static char const *exynos5_dt_compat[] __initdata = {
53         "samsung,exynos5250",
54         "samsung,exynos5420",
55         "samsung,exynos5440",
56         NULL
57 };
58
59 static void __init exynos5_reserve(void)
60 {
61 #ifdef CONFIG_S5P_DEV_MFC
62         int i;
63         char *mfc_mem[] = {
64                 "samsung,mfc-v6",
65                 "samsung,mfc-v7",
66         };
67
68         for (i = 0; i < ARRAY_SIZE(mfc_mem); i++)
69                 if (of_scan_flat_dt(s5p_fdt_alloc_mfc_mem, mfc_mem[i]))
70                         break;
71 #endif
72 }
73
74 DT_MACHINE_START(EXYNOS5_DT, "SAMSUNG EXYNOS5 (Flattened Device Tree)")
75         /* Maintainer: Kukjin Kim <kgene.kim@samsung.com> */
76         .smp            = smp_ops(exynos_smp_ops),
77         .map_io         = exynos_init_io,
78         .init_machine   = exynos5_dt_machine_init,
79         .init_late      = exynos_init_late,
80         .dt_compat      = exynos5_dt_compat,
81         .restart        = exynos5_restart,
82         .reserve        = exynos5_reserve,
83 MACHINE_END