Merge branch 'next/dt-samsung-2' of git://git.kernel.org/pub/scm/linux/kernel/git...
[cascardo/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/serial_core.h>
14 #include <linux/memblock.h>
15 #include <linux/of_fdt.h>
16
17 #include <asm/mach/arch.h>
18 #include <asm/hardware/gic.h>
19 #include <mach/map.h>
20
21 #include <plat/cpu.h>
22 #include <plat/regs-serial.h>
23 #include <plat/mfc.h>
24
25 #include "common.h"
26
27 /*
28  * The following lookup table is used to override device names when devices
29  * are registered from device tree. This is temporarily added to enable
30  * device tree support addition for the EXYNOS5 architecture.
31  *
32  * For drivers that require platform data to be provided from the machine
33  * file, a platform data pointer can also be supplied along with the
34  * devices names. Usually, the platform data elements that cannot be parsed
35  * from the device tree by the drivers (example: function pointers) are
36  * supplied. But it should be noted that this is a temporary mechanism and
37  * at some point, the drivers should be capable of parsing all the platform
38  * data from the device tree.
39  */
40 static const struct of_dev_auxdata exynos5250_auxdata_lookup[] __initconst = {
41         OF_DEV_AUXDATA("samsung,exynos4210-uart", EXYNOS5_PA_UART0,
42                                 "exynos4210-uart.0", NULL),
43         OF_DEV_AUXDATA("samsung,exynos4210-uart", EXYNOS5_PA_UART1,
44                                 "exynos4210-uart.1", NULL),
45         OF_DEV_AUXDATA("samsung,exynos4210-uart", EXYNOS5_PA_UART2,
46                                 "exynos4210-uart.2", NULL),
47         OF_DEV_AUXDATA("samsung,exynos4210-uart", EXYNOS5_PA_UART3,
48                                 "exynos4210-uart.3", NULL),
49         OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS5_PA_IIC(0),
50                                 "s3c2440-i2c.0", NULL),
51         OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS5_PA_IIC(1),
52                                 "s3c2440-i2c.1", NULL),
53         OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS5_PA_IIC(2),
54                                 "s3c2440-i2c.2", NULL),
55         OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS5_PA_IIC(3),
56                                 "s3c2440-i2c.3", NULL),
57         OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS5_PA_IIC(4),
58                                 "s3c2440-i2c.4", NULL),
59         OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS5_PA_IIC(5),
60                                 "s3c2440-i2c.5", NULL),
61         OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS5_PA_IIC(6),
62                                 "s3c2440-i2c.6", NULL),
63         OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS5_PA_IIC(7),
64                                 "s3c2440-i2c.7", NULL),
65         OF_DEV_AUXDATA("samsung,s3c2440-hdmiphy-i2c", EXYNOS5_PA_IIC(8),
66                                 "s3c2440-hdmiphy-i2c", NULL),
67         OF_DEV_AUXDATA("samsung,exynos5250-dw-mshc", EXYNOS5_PA_DWMCI0,
68                                 "dw_mmc.0", NULL),
69         OF_DEV_AUXDATA("samsung,exynos5250-dw-mshc", EXYNOS5_PA_DWMCI1,
70                                 "dw_mmc.1", NULL),
71         OF_DEV_AUXDATA("samsung,exynos5250-dw-mshc", EXYNOS5_PA_DWMCI2,
72                                 "dw_mmc.2", NULL),
73         OF_DEV_AUXDATA("samsung,exynos5250-dw-mshc", EXYNOS5_PA_DWMCI3,
74                                 "dw_mmc.3", NULL),
75         OF_DEV_AUXDATA("samsung,exynos4210-spi", EXYNOS5_PA_SPI0,
76                                 "exynos4210-spi.0", NULL),
77         OF_DEV_AUXDATA("samsung,exynos4210-spi", EXYNOS5_PA_SPI1,
78                                 "exynos4210-spi.1", NULL),
79         OF_DEV_AUXDATA("samsung,exynos4210-spi", EXYNOS5_PA_SPI2,
80                                 "exynos4210-spi.2", NULL),
81         OF_DEV_AUXDATA("samsung,exynos5-sata-ahci", 0x122F0000,
82                                 "exynos5-sata", NULL),
83         OF_DEV_AUXDATA("samsung,exynos5-sata-phy", 0x12170000,
84                                 "exynos5-sata-phy", NULL),
85         OF_DEV_AUXDATA("samsung,exynos5-sata-phy-i2c", 0x121D0000,
86                                 "exynos5-sata-phy-i2c", NULL),
87         OF_DEV_AUXDATA("arm,pl330", EXYNOS5_PA_PDMA0, "dma-pl330.0", NULL),
88         OF_DEV_AUXDATA("arm,pl330", EXYNOS5_PA_PDMA1, "dma-pl330.1", NULL),
89         OF_DEV_AUXDATA("arm,pl330", EXYNOS5_PA_MDMA1, "dma-pl330.2", NULL),
90         OF_DEV_AUXDATA("samsung,exynos5-gsc", EXYNOS5_PA_GSC0,
91                                 "exynos-gsc.0", NULL),
92         OF_DEV_AUXDATA("samsung,exynos5-gsc", EXYNOS5_PA_GSC1,
93                                 "exynos-gsc.1", NULL),
94         OF_DEV_AUXDATA("samsung,exynos5-gsc", EXYNOS5_PA_GSC2,
95                                 "exynos-gsc.2", NULL),
96         OF_DEV_AUXDATA("samsung,exynos5-gsc", EXYNOS5_PA_GSC3,
97                                 "exynos-gsc.3", NULL),
98         OF_DEV_AUXDATA("samsung,exynos5-hdmi", 0x14530000,
99                                 "exynos5-hdmi", NULL),
100         OF_DEV_AUXDATA("samsung,exynos5-mixer", 0x14450000,
101                                 "exynos5-mixer", NULL),
102         OF_DEV_AUXDATA("samsung,mfc-v6", 0x11000000, "s5p-mfc-v6", NULL),
103         OF_DEV_AUXDATA("samsung,exynos5250-tmu", 0x10060000,
104                                 "exynos-tmu", NULL),
105         {},
106 };
107
108 static void __init exynos5250_dt_map_io(void)
109 {
110         exynos_init_io(NULL, 0);
111         s3c24xx_init_clocks(24000000);
112 }
113
114 static void __init exynos5250_dt_machine_init(void)
115 {
116         of_platform_populate(NULL, of_default_bus_match_table,
117                                 exynos5250_auxdata_lookup, NULL);
118 }
119
120 static char const *exynos5250_dt_compat[] __initdata = {
121         "samsung,exynos5250",
122         NULL
123 };
124
125 static void __init exynos5_reserve(void)
126 {
127         struct s5p_mfc_dt_meminfo mfc_mem;
128
129         /* Reserve memory for MFC only if it's available */
130         mfc_mem.compatible = "samsung,mfc-v6";
131         if (of_scan_flat_dt(s5p_fdt_find_mfc_mem, &mfc_mem))
132                 s5p_mfc_reserve_mem(mfc_mem.roff, mfc_mem.rsize, mfc_mem.loff,
133                                 mfc_mem.lsize);
134 }
135
136 DT_MACHINE_START(EXYNOS5_DT, "SAMSUNG EXYNOS5 (Flattened Device Tree)")
137         /* Maintainer: Kukjin Kim <kgene.kim@samsung.com> */
138         .init_irq       = exynos5_init_irq,
139         .smp            = smp_ops(exynos_smp_ops),
140         .map_io         = exynos5250_dt_map_io,
141         .handle_irq     = gic_handle_irq,
142         .init_machine   = exynos5250_dt_machine_init,
143         .init_late      = exynos_init_late,
144         .timer          = &exynos4_timer,
145         .dt_compat      = exynos5250_dt_compat,
146         .restart        = exynos5_restart,
147         .reserve        = exynos5_reserve,
148 MACHINE_END