]> git.karo-electronics.de Git - karo-tx-linux.git/blob - arch/arm/mach-exynos/mach-exynos5-dt.c
ARM: EXYNOS: DT Support for SATA and SATA PHY
[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/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,exynos5250-dw-mshc", EXYNOS5_PA_DWMCI0,
54                                 "dw_mmc.0", NULL),
55         OF_DEV_AUXDATA("samsung,exynos5250-dw-mshc", EXYNOS5_PA_DWMCI1,
56                                 "dw_mmc.1", NULL),
57         OF_DEV_AUXDATA("samsung,exynos5250-dw-mshc", EXYNOS5_PA_DWMCI2,
58                                 "dw_mmc.2", NULL),
59         OF_DEV_AUXDATA("samsung,exynos5250-dw-mshc", EXYNOS5_PA_DWMCI3,
60                                 "dw_mmc.3", NULL),
61         OF_DEV_AUXDATA("samsung,exynos4210-spi", EXYNOS5_PA_SPI0,
62                                 "exynos4210-spi.0", NULL),
63         OF_DEV_AUXDATA("samsung,exynos4210-spi", EXYNOS5_PA_SPI1,
64                                 "exynos4210-spi.1", NULL),
65         OF_DEV_AUXDATA("samsung,exynos4210-spi", EXYNOS5_PA_SPI2,
66                                 "exynos4210-spi.2", NULL),
67         OF_DEV_AUXDATA("samsung,exynos5-sata-ahci", 0x122F0000,
68                                 "exynos5-sata", NULL),
69         OF_DEV_AUXDATA("samsung,exynos5-sata-phy", 0x12170000,
70                                 "exynos5-sata-phy", NULL),
71         OF_DEV_AUXDATA("samsung,exynos5-sata-phy-i2c", 0x121D0000,
72                                 "exynos5-sata-phy-i2c", NULL),
73         OF_DEV_AUXDATA("arm,pl330", EXYNOS5_PA_PDMA0, "dma-pl330.0", NULL),
74         OF_DEV_AUXDATA("arm,pl330", EXYNOS5_PA_PDMA1, "dma-pl330.1", NULL),
75         OF_DEV_AUXDATA("arm,pl330", EXYNOS5_PA_MDMA1, "dma-pl330.2", NULL),
76         OF_DEV_AUXDATA("samsung,exynos5-gsc", EXYNOS5_PA_GSC0,
77                                 "exynos-gsc.0", NULL),
78         OF_DEV_AUXDATA("samsung,exynos5-gsc", EXYNOS5_PA_GSC1,
79                                 "exynos-gsc.1", NULL),
80         OF_DEV_AUXDATA("samsung,exynos5-gsc", EXYNOS5_PA_GSC2,
81                                 "exynos-gsc.2", NULL),
82         OF_DEV_AUXDATA("samsung,exynos5-gsc", EXYNOS5_PA_GSC3,
83                                 "exynos-gsc.3", NULL),
84         OF_DEV_AUXDATA("samsung,mfc-v6", 0x11000000, "s5p-mfc-v6", NULL),
85         OF_DEV_AUXDATA("samsung,exynos5250-tmu", 0x10060000,
86                                 "exynos-tmu", NULL),
87         {},
88 };
89
90 static void __init exynos5250_dt_map_io(void)
91 {
92         exynos_init_io(NULL, 0);
93         s3c24xx_init_clocks(24000000);
94 }
95
96 static void __init exynos5250_dt_machine_init(void)
97 {
98         of_platform_populate(NULL, of_default_bus_match_table,
99                                 exynos5250_auxdata_lookup, NULL);
100 }
101
102 static char const *exynos5250_dt_compat[] __initdata = {
103         "samsung,exynos5250",
104         NULL
105 };
106
107 static void __init exynos5_reserve(void)
108 {
109         struct s5p_mfc_dt_meminfo mfc_mem;
110
111         /* Reserve memory for MFC only if it's available */
112         mfc_mem.compatible = "samsung,mfc-v6";
113         if (of_scan_flat_dt(s5p_fdt_find_mfc_mem, &mfc_mem))
114                 s5p_mfc_reserve_mem(mfc_mem.roff, mfc_mem.rsize, mfc_mem.loff,
115                                 mfc_mem.lsize);
116 }
117
118 DT_MACHINE_START(EXYNOS5_DT, "SAMSUNG EXYNOS5 (Flattened Device Tree)")
119         /* Maintainer: Kukjin Kim <kgene.kim@samsung.com> */
120         .init_irq       = exynos5_init_irq,
121         .smp            = smp_ops(exynos_smp_ops),
122         .map_io         = exynos5250_dt_map_io,
123         .handle_irq     = gic_handle_irq,
124         .init_machine   = exynos5250_dt_machine_init,
125         .init_late      = exynos_init_late,
126         .timer          = &exynos4_timer,
127         .dt_compat      = exynos5250_dt_compat,
128         .restart        = exynos5_restart,
129         .reserve        = exynos5_reserve,
130 MACHINE_END