blob: f906f599a141b414e045a6664d90f3eb5bcca2c4 [file] [log] [blame]
Kukjin Kimb3e68fb2012-02-10 13:13:15 +09001/*
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>
Abhilash Kesavan7000fe82012-11-20 18:20:38 +090014#include <linux/io.h>
Kukjin Kimb3e68fb2012-02-10 13:13:15 +090015
16#include <asm/mach/arch.h>
17#include <asm/hardware/gic.h>
18#include <mach/map.h>
Abhilash Kesavan7000fe82012-11-20 18:20:38 +090019#include <mach/regs-pmu.h>
Kukjin Kimb3e68fb2012-02-10 13:13:15 +090020
21#include <plat/cpu.h>
22#include <plat/regs-serial.h>
23
24#include "common.h"
25
26/*
27 * The following lookup table is used to override device names when devices
28 * are registered from device tree. This is temporarily added to enable
29 * device tree support addition for the EXYNOS5 architecture.
30 *
31 * For drivers that require platform data to be provided from the machine
32 * file, a platform data pointer can also be supplied along with the
33 * devices names. Usually, the platform data elements that cannot be parsed
34 * from the device tree by the drivers (example: function pointers) are
35 * supplied. But it should be noted that this is a temporary mechanism and
36 * at some point, the drivers should be capable of parsing all the platform
37 * data from the device tree.
38 */
39static const struct of_dev_auxdata exynos5250_auxdata_lookup[] __initconst = {
40 OF_DEV_AUXDATA("samsung,exynos4210-uart", EXYNOS5_PA_UART0,
41 "exynos4210-uart.0", NULL),
42 OF_DEV_AUXDATA("samsung,exynos4210-uart", EXYNOS5_PA_UART1,
43 "exynos4210-uart.1", NULL),
44 OF_DEV_AUXDATA("samsung,exynos4210-uart", EXYNOS5_PA_UART2,
45 "exynos4210-uart.2", NULL),
46 OF_DEV_AUXDATA("samsung,exynos4210-uart", EXYNOS5_PA_UART3,
47 "exynos4210-uart.3", NULL),
Thomas Abraham380c3a52012-05-15 15:56:57 +090048 OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS5_PA_IIC(0),
49 "s3c2440-i2c.0", NULL),
50 OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS5_PA_IIC(1),
51 "s3c2440-i2c.1", NULL),
Rahul Sharma62a1f832012-10-29 21:51:47 +090052 OF_DEV_AUXDATA("samsung,s3c2440-i2c", EXYNOS5_PA_IIC(2),
53 "s3c2440-i2c.2", NULL),
Rahul Sharma3e3e9ce2012-10-29 21:51:42 +090054 OF_DEV_AUXDATA("samsung,s3c2440-hdmiphy-i2c", EXYNOS5_PA_IIC(8),
55 "s3c2440-hdmiphy-i2c", NULL),
Thomas Abrahama5c17772012-09-26 08:54:42 +090056 OF_DEV_AUXDATA("samsung,exynos5250-dw-mshc", EXYNOS5_PA_DWMCI0,
57 "dw_mmc.0", NULL),
58 OF_DEV_AUXDATA("samsung,exynos5250-dw-mshc", EXYNOS5_PA_DWMCI1,
59 "dw_mmc.1", NULL),
60 OF_DEV_AUXDATA("samsung,exynos5250-dw-mshc", EXYNOS5_PA_DWMCI2,
61 "dw_mmc.2", NULL),
62 OF_DEV_AUXDATA("samsung,exynos5250-dw-mshc", EXYNOS5_PA_DWMCI3,
63 "dw_mmc.3", NULL),
Thomas Abrahamb0b27812012-07-14 10:54:31 +090064 OF_DEV_AUXDATA("samsung,exynos4210-spi", EXYNOS5_PA_SPI0,
65 "exynos4210-spi.0", NULL),
66 OF_DEV_AUXDATA("samsung,exynos4210-spi", EXYNOS5_PA_SPI1,
67 "exynos4210-spi.1", NULL),
68 OF_DEV_AUXDATA("samsung,exynos4210-spi", EXYNOS5_PA_SPI2,
69 "exynos4210-spi.2", NULL),
Kukjin Kimb3e68fb2012-02-10 13:13:15 +090070 OF_DEV_AUXDATA("arm,pl330", EXYNOS5_PA_PDMA0, "dma-pl330.0", NULL),
71 OF_DEV_AUXDATA("arm,pl330", EXYNOS5_PA_PDMA1, "dma-pl330.1", NULL),
Thomas Abraham60806222012-04-10 08:37:59 -070072 OF_DEV_AUXDATA("arm,pl330", EXYNOS5_PA_MDMA1, "dma-pl330.2", NULL),
Shaik Ameer Basha11286582012-09-07 14:13:08 +090073 OF_DEV_AUXDATA("samsung,exynos5-gsc", EXYNOS5_PA_GSC0,
74 "exynos-gsc.0", NULL),
75 OF_DEV_AUXDATA("samsung,exynos5-gsc", EXYNOS5_PA_GSC1,
76 "exynos-gsc.1", NULL),
77 OF_DEV_AUXDATA("samsung,exynos5-gsc", EXYNOS5_PA_GSC2,
78 "exynos-gsc.2", NULL),
79 OF_DEV_AUXDATA("samsung,exynos5-gsc", EXYNOS5_PA_GSC3,
80 "exynos-gsc.3", NULL),
Rahul Sharma566cf8e2012-10-29 21:48:43 +090081 OF_DEV_AUXDATA("samsung,exynos5-hdmi", 0x14530000,
82 "exynos5-hdmi", NULL),
Rahul Sharma5af0d8a2012-10-29 21:51:36 +090083 OF_DEV_AUXDATA("samsung,exynos5-mixer", 0x14450000,
84 "exynos5-mixer", NULL),
Kukjin Kimb3e68fb2012-02-10 13:13:15 +090085 {},
86};
87
88static void __init exynos5250_dt_map_io(void)
89{
90 exynos_init_io(NULL, 0);
91 s3c24xx_init_clocks(24000000);
92}
93
94static void __init exynos5250_dt_machine_init(void)
95{
Abhilash Kesavan7000fe82012-11-20 18:20:38 +090096 struct device_node *i2c_np;
97 const char *i2c_compat = "samsung,s3c2440-i2c";
98 unsigned int tmp;
99
100 /*
101 * Exynos5's legacy i2c controller and new high speed i2c
102 * controller have muxed interrupt sources. By default the
103 * interrupts for 4-channel HS-I2C controller are enabled.
104 * If node for first four channels of legacy i2c controller
105 * are available then re-configure the interrupts via the
106 * system register.
107 */
108 for_each_compatible_node(i2c_np, NULL, i2c_compat) {
109 if (of_device_is_available(i2c_np)) {
110 if (of_alias_get_id(i2c_np, "i2c") < 4) {
111 tmp = readl(EXYNOS5_SYS_I2C_CFG);
112 writel(tmp & ~(0x1 << of_alias_get_id(i2c_np, "i2c")),
113 EXYNOS5_SYS_I2C_CFG);
114 }
115 }
116 }
117
Kukjin Kimb3e68fb2012-02-10 13:13:15 +0900118 of_platform_populate(NULL, of_default_bus_match_table,
119 exynos5250_auxdata_lookup, NULL);
120}
121
122static char const *exynos5250_dt_compat[] __initdata = {
123 "samsung,exynos5250",
124 NULL
125};
126
127DT_MACHINE_START(EXYNOS5_DT, "SAMSUNG EXYNOS5 (Flattened Device Tree)")
128 /* Maintainer: Kukjin Kim <kgene.kim@samsung.com> */
129 .init_irq = exynos5_init_irq,
Marc Zyngier06853ae2011-09-08 13:15:22 +0100130 .smp = smp_ops(exynos_smp_ops),
Kukjin Kimb3e68fb2012-02-10 13:13:15 +0900131 .map_io = exynos5250_dt_map_io,
132 .handle_irq = gic_handle_irq,
133 .init_machine = exynos5250_dt_machine_init,
Shawn Guobb13fab2012-04-26 10:35:40 +0800134 .init_late = exynos_init_late,
Kukjin Kimb3e68fb2012-02-10 13:13:15 +0900135 .timer = &exynos4_timer,
136 .dt_compat = exynos5250_dt_compat,
137 .restart = exynos5_restart,
138MACHINE_END