]> rtime.felk.cvut.cz Git - can-eth-gw-linux.git/blob - arch/arm/mach-exynos/mach-exynos5-dt.c
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next
[can-eth-gw-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/serial_core.h>
15
16 #include <asm/mach/arch.h>
17 #include <asm/hardware/gic.h>
18 #include <mach/map.h>
19
20 #include <plat/cpu.h>
21 #include <plat/regs-serial.h>
22
23 #include "common.h"
24
25 /*
26  * The following lookup table is used to override device names when devices
27  * are registered from device tree. This is temporarily added to enable
28  * device tree support addition for the EXYNOS5 architecture.
29  *
30  * For drivers that require platform data to be provided from the machine
31  * file, a platform data pointer can also be supplied along with the
32  * devices names. Usually, the platform data elements that cannot be parsed
33  * from the device tree by the drivers (example: function pointers) are
34  * supplied. But it should be noted that this is a temporary mechanism and
35  * at some point, the drivers should be capable of parsing all the platform
36  * data from the device tree.
37  */
38 static const struct of_dev_auxdata exynos5250_auxdata_lookup[] __initconst = {
39         OF_DEV_AUXDATA("samsung,exynos4210-uart", EXYNOS5_PA_UART0,
40                                 "exynos4210-uart.0", NULL),
41         OF_DEV_AUXDATA("samsung,exynos4210-uart", EXYNOS5_PA_UART1,
42                                 "exynos4210-uart.1", NULL),
43         OF_DEV_AUXDATA("samsung,exynos4210-uart", EXYNOS5_PA_UART2,
44                                 "exynos4210-uart.2", NULL),
45         OF_DEV_AUXDATA("samsung,exynos4210-uart", EXYNOS5_PA_UART3,
46                                 "exynos4210-uart.3", NULL),
47         OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS5_PA_IIC(0),
48                                 "s3c2440-i2c.0", NULL),
49         OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS5_PA_IIC(1),
50                                 "s3c2440-i2c.1", NULL),
51         OF_DEV_AUXDATA("samsung,exynos5250-dw-mshc", EXYNOS5_PA_DWMCI0,
52                                 "dw_mmc.0", NULL),
53         OF_DEV_AUXDATA("samsung,exynos5250-dw-mshc", EXYNOS5_PA_DWMCI1,
54                                 "dw_mmc.1", NULL),
55         OF_DEV_AUXDATA("samsung,exynos5250-dw-mshc", EXYNOS5_PA_DWMCI2,
56                                 "dw_mmc.2", NULL),
57         OF_DEV_AUXDATA("samsung,exynos5250-dw-mshc", EXYNOS5_PA_DWMCI3,
58                                 "dw_mmc.3", NULL),
59         OF_DEV_AUXDATA("samsung,exynos4210-spi", EXYNOS5_PA_SPI0,
60                                 "exynos4210-spi.0", NULL),
61         OF_DEV_AUXDATA("samsung,exynos4210-spi", EXYNOS5_PA_SPI1,
62                                 "exynos4210-spi.1", NULL),
63         OF_DEV_AUXDATA("samsung,exynos4210-spi", EXYNOS5_PA_SPI2,
64                                 "exynos4210-spi.2", NULL),
65         OF_DEV_AUXDATA("arm,pl330", EXYNOS5_PA_PDMA0, "dma-pl330.0", NULL),
66         OF_DEV_AUXDATA("arm,pl330", EXYNOS5_PA_PDMA1, "dma-pl330.1", NULL),
67         OF_DEV_AUXDATA("arm,pl330", EXYNOS5_PA_MDMA1, "dma-pl330.2", NULL),
68         OF_DEV_AUXDATA("samsung,exynos5-gsc", EXYNOS5_PA_GSC0,
69                                 "exynos-gsc.0", NULL),
70         OF_DEV_AUXDATA("samsung,exynos5-gsc", EXYNOS5_PA_GSC1,
71                                 "exynos-gsc.1", NULL),
72         OF_DEV_AUXDATA("samsung,exynos5-gsc", EXYNOS5_PA_GSC2,
73                                 "exynos-gsc.2", NULL),
74         OF_DEV_AUXDATA("samsung,exynos5-gsc", EXYNOS5_PA_GSC3,
75                                 "exynos-gsc.3", NULL),
76         {},
77 };
78
79 static const struct of_dev_auxdata exynos5440_auxdata_lookup[] __initconst = {
80         OF_DEV_AUXDATA("samsung,exynos4210-uart", EXYNOS5440_PA_UART0,
81                                 "exynos4210-uart.0", NULL),
82         {},
83 };
84
85 static void __init exynos5_dt_map_io(void)
86 {
87         unsigned long root = of_get_flat_dt_root();
88
89         exynos_init_io(NULL, 0);
90
91         if (of_flat_dt_is_compatible(root, "samsung,exynos5250"))
92                 s3c24xx_init_clocks(24000000);
93 }
94
95 static void __init exynos5_dt_machine_init(void)
96 {
97         if (of_machine_is_compatible("samsung,exynos5250"))
98                 of_platform_populate(NULL, of_default_bus_match_table,
99                                      exynos5250_auxdata_lookup, NULL);
100         else if (of_machine_is_compatible("samsung,exynos5440"))
101                 of_platform_populate(NULL, of_default_bus_match_table,
102                                      exynos5440_auxdata_lookup, NULL);
103 }
104
105 static char const *exynos5_dt_compat[] __initdata = {
106         "samsung,exynos5250",
107         "samsung,exynos5440",
108         NULL
109 };
110
111 DT_MACHINE_START(EXYNOS5_DT, "SAMSUNG EXYNOS5 (Flattened Device Tree)")
112         /* Maintainer: Kukjin Kim <kgene.kim@samsung.com> */
113         .init_irq       = exynos5_init_irq,
114         .smp            = smp_ops(exynos_smp_ops),
115         .map_io         = exynos5_dt_map_io,
116         .handle_irq     = gic_handle_irq,
117         .init_machine   = exynos5_dt_machine_init,
118         .init_late      = exynos_init_late,
119         .timer          = &exynos4_timer,
120         .dt_compat      = exynos5_dt_compat,
121         .restart        = exynos5_restart,
122 MACHINE_END