]> git.karo-electronics.de Git - karo-tx-linux.git/blob - arch/arm/mach-exynos/mach-exynos5-dt.c
Merge tag 'drivers-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/arm...
[karo-tx-linux.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/memblock.h>
15 #include <linux/io.h>
16 #include <linux/clocksource.h>
17
18 #include <asm/mach/arch.h>
19 #include <mach/regs-pmu.h>
20
21 #include <plat/cpu.h>
22 #include <plat/mfc.h>
23
24 #include "common.h"
25
26 static void __init exynos5_dt_map_io(void)
27 {
28         exynos_init_io(NULL, 0);
29 }
30
31 static void __init exynos5_dt_machine_init(void)
32 {
33         struct device_node *i2c_np;
34         const char *i2c_compat = "samsung,s3c2440-i2c";
35         unsigned int tmp;
36
37         /*
38          * Exynos5's legacy i2c controller and new high speed i2c
39          * controller have muxed interrupt sources. By default the
40          * interrupts for 4-channel HS-I2C controller are enabled.
41          * If node for first four channels of legacy i2c controller
42          * are available then re-configure the interrupts via the
43          * system register.
44          */
45         for_each_compatible_node(i2c_np, NULL, i2c_compat) {
46                 if (of_device_is_available(i2c_np)) {
47                         if (of_alias_get_id(i2c_np, "i2c") < 4) {
48                                 tmp = readl(EXYNOS5_SYS_I2C_CFG);
49                                 writel(tmp & ~(0x1 << of_alias_get_id(i2c_np, "i2c")),
50                                                 EXYNOS5_SYS_I2C_CFG);
51                         }
52                 }
53         }
54
55         of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
56 }
57
58 static char const *exynos5_dt_compat[] __initdata = {
59         "samsung,exynos5250",
60         "samsung,exynos5440",
61         NULL
62 };
63
64 static void __init exynos5_reserve(void)
65 {
66 #ifdef CONFIG_S5P_DEV_MFC
67         struct s5p_mfc_dt_meminfo mfc_mem;
68
69         /* Reserve memory for MFC only if it's available */
70         mfc_mem.compatible = "samsung,mfc-v6";
71         if (of_scan_flat_dt(s5p_fdt_find_mfc_mem, &mfc_mem))
72                 s5p_mfc_reserve_mem(mfc_mem.roff, mfc_mem.rsize, mfc_mem.loff,
73                                 mfc_mem.lsize);
74 #endif
75 }
76
77 DT_MACHINE_START(EXYNOS5_DT, "SAMSUNG EXYNOS5 (Flattened Device Tree)")
78         /* Maintainer: Kukjin Kim <kgene.kim@samsung.com> */
79         .init_irq       = exynos5_init_irq,
80         .smp            = smp_ops(exynos_smp_ops),
81         .map_io         = exynos5_dt_map_io,
82         .init_machine   = exynos5_dt_machine_init,
83         .init_late      = exynos_init_late,
84         .init_time      = exynos_init_time,
85         .dt_compat      = exynos5_dt_compat,
86         .restart        = exynos5_restart,
87         .reserve        = exynos5_reserve,
88 MACHINE_END