blob: 368fa4b01e7c2724e974b284b875fc2e3d6784d7 [file] [log] [blame]
Kukjin Kimcc511b82011-12-27 08:18:36 +01001/*
2 * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd.
3 * http://www.samsung.com
4 *
5 * Common Codes for EXYNOS
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/kernel.h>
13#include <linux/interrupt.h>
14#include <linux/irq.h>
Rob Herringa900e5d2013-02-12 16:04:52 -060015#include <linux/irqchip.h>
Kukjin Kimcc511b82011-12-27 08:18:36 +010016#include <linux/io.h>
Linus Torvalds7affca32012-01-07 12:03:30 -080017#include <linux/device.h>
Kukjin Kimcc511b82011-12-27 08:18:36 +010018#include <linux/gpio.h>
19#include <linux/sched.h>
20#include <linux/serial_core.h>
Arnd Bergmann237c78b2012-01-07 12:30:20 +000021#include <linux/of.h>
Doug Anderson5b7897d2012-11-27 11:53:14 -080022#include <linux/of_fdt.h>
Arnd Bergmann237c78b2012-01-07 12:30:20 +000023#include <linux/of_irq.h>
Thomas Abraham1e60bc02012-05-15 16:18:35 +090024#include <linux/export.h>
25#include <linux/irqdomain.h>
Rob Herring0529e3152012-11-05 16:18:28 -060026#include <linux/irqchip.h>
Thomas Abrahame873a472012-05-15 16:25:23 +090027#include <linux/of_address.h>
Thomas Abraham6923ae42013-03-09 17:03:29 +090028#include <linux/clocksource.h>
29#include <linux/clk-provider.h>
Rob Herring520f7bd2012-12-27 13:10:24 -060030#include <linux/irqchip/arm-gic.h>
Kukjin Kimcc511b82011-12-27 08:18:36 +010031
32#include <asm/proc-fns.h>
Arnd Bergmann40ba95f2012-01-07 11:51:28 +000033#include <asm/exception.h>
Kukjin Kimcc511b82011-12-27 08:18:36 +010034#include <asm/hardware/cache-l2x0.h>
Kukjin Kimcc511b82011-12-27 08:18:36 +010035#include <asm/mach/map.h>
36#include <asm/mach/irq.h>
Amit Daniel Kachhapb756a502012-03-08 02:07:41 -080037#include <asm/cacheflush.h>
Kukjin Kimcc511b82011-12-27 08:18:36 +010038
39#include <mach/regs-irq.h>
40#include <mach/regs-pmu.h>
41#include <mach/regs-gpio.h>
Chanho Parkb7bbdbe2012-12-12 14:03:54 +090042#include <mach/irqs.h>
Kukjin Kimcc511b82011-12-27 08:18:36 +010043
44#include <plat/cpu.h>
Kukjin Kimcc511b82011-12-27 08:18:36 +010045#include <plat/devs.h>
46#include <plat/pm.h>
Kukjin Kimcc511b82011-12-27 08:18:36 +010047#include <plat/sdhci.h>
48#include <plat/gpio-cfg.h>
49#include <plat/adc-core.h>
50#include <plat/fb-core.h>
51#include <plat/fimc-core.h>
52#include <plat/iic-core.h>
53#include <plat/tv-core.h>
Heiko Stuebner308b3af2012-10-17 16:47:11 +090054#include <plat/spi-core.h>
Kukjin Kimcc511b82011-12-27 08:18:36 +010055#include <plat/regs-serial.h>
56
57#include "common.h"
Amit Daniel Kachhap6cdeddc2012-03-08 02:09:12 -080058#define L2_AUX_VAL 0x7C470001
59#define L2_AUX_MASK 0xC200ffff
Kukjin Kimcc511b82011-12-27 08:18:36 +010060
Kukjin Kimcc511b82011-12-27 08:18:36 +010061static const char name_exynos4210[] = "EXYNOS4210";
62static const char name_exynos4212[] = "EXYNOS4212";
63static const char name_exynos4412[] = "EXYNOS4412";
Kukjin Kim94c7ca72012-02-11 22:15:45 +090064static const char name_exynos5250[] = "EXYNOS5250";
Kukjin Kim2edb36c2012-11-15 15:48:56 +090065static const char name_exynos5440[] = "EXYNOS5440";
Kukjin Kimcc511b82011-12-27 08:18:36 +010066
Kukjin Kim906c7892012-02-11 21:27:08 +090067static void exynos4_map_io(void);
Kukjin Kim94c7ca72012-02-11 22:15:45 +090068static void exynos5_map_io(void);
Kukjin Kim2edb36c2012-11-15 15:48:56 +090069static void exynos5440_map_io(void);
Thomas Abraham55b6ef72012-10-29 19:46:49 +090070static void exynos4_init_uarts(struct s3c2410_uartcfg *cfg, int no);
Kukjin Kim906c7892012-02-11 21:27:08 +090071static int exynos_init(void);
Kukjin Kimcc511b82011-12-27 08:18:36 +010072
Thomas Abraham92744272013-03-09 17:03:33 +090073unsigned long xxti_f = 0, xusbxti_f = 0;
74
Kukjin Kimcc511b82011-12-27 08:18:36 +010075static struct cpu_table cpu_ids[] __initdata = {
76 {
77 .idcode = EXYNOS4210_CPU_ID,
78 .idmask = EXYNOS4_CPU_MASK,
79 .map_io = exynos4_map_io,
Thomas Abraham55b6ef72012-10-29 19:46:49 +090080 .init_uarts = exynos4_init_uarts,
Kukjin Kimcc511b82011-12-27 08:18:36 +010081 .init = exynos_init,
82 .name = name_exynos4210,
83 }, {
84 .idcode = EXYNOS4212_CPU_ID,
85 .idmask = EXYNOS4_CPU_MASK,
86 .map_io = exynos4_map_io,
Thomas Abraham55b6ef72012-10-29 19:46:49 +090087 .init_uarts = exynos4_init_uarts,
Kukjin Kimcc511b82011-12-27 08:18:36 +010088 .init = exynos_init,
89 .name = name_exynos4212,
90 }, {
91 .idcode = EXYNOS4412_CPU_ID,
92 .idmask = EXYNOS4_CPU_MASK,
93 .map_io = exynos4_map_io,
Thomas Abraham55b6ef72012-10-29 19:46:49 +090094 .init_uarts = exynos4_init_uarts,
Kukjin Kimcc511b82011-12-27 08:18:36 +010095 .init = exynos_init,
96 .name = name_exynos4412,
Kukjin Kim94c7ca72012-02-11 22:15:45 +090097 }, {
98 .idcode = EXYNOS5250_SOC_ID,
99 .idmask = EXYNOS5_SOC_MASK,
100 .map_io = exynos5_map_io,
Kukjin Kim94c7ca72012-02-11 22:15:45 +0900101 .init = exynos_init,
102 .name = name_exynos5250,
Kukjin Kim2edb36c2012-11-15 15:48:56 +0900103 }, {
104 .idcode = EXYNOS5440_SOC_ID,
105 .idmask = EXYNOS5_SOC_MASK,
106 .map_io = exynos5440_map_io,
107 .init = exynos_init,
108 .name = name_exynos5440,
Kukjin Kimcc511b82011-12-27 08:18:36 +0100109 },
110};
111
112/* Initial IO mappings */
113
114static struct map_desc exynos_iodesc[] __initdata = {
115 {
116 .virtual = (unsigned long)S5P_VA_CHIPID,
Kukjin Kim94c7ca72012-02-11 22:15:45 +0900117 .pfn = __phys_to_pfn(EXYNOS_PA_CHIPID),
Kukjin Kimcc511b82011-12-27 08:18:36 +0100118 .length = SZ_4K,
119 .type = MT_DEVICE,
Kukjin Kim94c7ca72012-02-11 22:15:45 +0900120 },
121};
122
Doug Anderson5b7897d2012-11-27 11:53:14 -0800123#ifdef CONFIG_ARCH_EXYNOS5
Kukjin Kim2edb36c2012-11-15 15:48:56 +0900124static struct map_desc exynos5440_iodesc[] __initdata = {
125 {
126 .virtual = (unsigned long)S5P_VA_CHIPID,
127 .pfn = __phys_to_pfn(EXYNOS5440_PA_CHIPID),
128 .length = SZ_4K,
129 .type = MT_DEVICE,
130 },
131};
Doug Anderson5b7897d2012-11-27 11:53:14 -0800132#endif
Kukjin Kim2edb36c2012-11-15 15:48:56 +0900133
Kukjin Kim94c7ca72012-02-11 22:15:45 +0900134static struct map_desc exynos4_iodesc[] __initdata = {
135 {
Kukjin Kimcc511b82011-12-27 08:18:36 +0100136 .virtual = (unsigned long)S3C_VA_SYS,
137 .pfn = __phys_to_pfn(EXYNOS4_PA_SYSCON),
138 .length = SZ_64K,
139 .type = MT_DEVICE,
140 }, {
141 .virtual = (unsigned long)S3C_VA_TIMER,
142 .pfn = __phys_to_pfn(EXYNOS4_PA_TIMER),
143 .length = SZ_16K,
144 .type = MT_DEVICE,
145 }, {
146 .virtual = (unsigned long)S3C_VA_WATCHDOG,
147 .pfn = __phys_to_pfn(EXYNOS4_PA_WATCHDOG),
148 .length = SZ_4K,
149 .type = MT_DEVICE,
150 }, {
151 .virtual = (unsigned long)S5P_VA_SROMC,
152 .pfn = __phys_to_pfn(EXYNOS4_PA_SROMC),
153 .length = SZ_4K,
154 .type = MT_DEVICE,
155 }, {
156 .virtual = (unsigned long)S5P_VA_SYSTIMER,
157 .pfn = __phys_to_pfn(EXYNOS4_PA_SYSTIMER),
158 .length = SZ_4K,
159 .type = MT_DEVICE,
160 }, {
161 .virtual = (unsigned long)S5P_VA_PMU,
162 .pfn = __phys_to_pfn(EXYNOS4_PA_PMU),
163 .length = SZ_64K,
164 .type = MT_DEVICE,
165 }, {
166 .virtual = (unsigned long)S5P_VA_COMBINER_BASE,
167 .pfn = __phys_to_pfn(EXYNOS4_PA_COMBINER),
168 .length = SZ_4K,
169 .type = MT_DEVICE,
170 }, {
171 .virtual = (unsigned long)S5P_VA_GIC_CPU,
172 .pfn = __phys_to_pfn(EXYNOS4_PA_GIC_CPU),
173 .length = SZ_64K,
174 .type = MT_DEVICE,
175 }, {
176 .virtual = (unsigned long)S5P_VA_GIC_DIST,
177 .pfn = __phys_to_pfn(EXYNOS4_PA_GIC_DIST),
178 .length = SZ_64K,
179 .type = MT_DEVICE,
180 }, {
181 .virtual = (unsigned long)S3C_VA_UART,
182 .pfn = __phys_to_pfn(EXYNOS4_PA_UART),
183 .length = SZ_512K,
184 .type = MT_DEVICE,
Kukjin Kim94c7ca72012-02-11 22:15:45 +0900185 }, {
Kukjin Kimcc511b82011-12-27 08:18:36 +0100186 .virtual = (unsigned long)S5P_VA_CMU,
187 .pfn = __phys_to_pfn(EXYNOS4_PA_CMU),
188 .length = SZ_128K,
189 .type = MT_DEVICE,
190 }, {
191 .virtual = (unsigned long)S5P_VA_COREPERI_BASE,
192 .pfn = __phys_to_pfn(EXYNOS4_PA_COREPERI),
193 .length = SZ_8K,
194 .type = MT_DEVICE,
195 }, {
196 .virtual = (unsigned long)S5P_VA_L2CC,
197 .pfn = __phys_to_pfn(EXYNOS4_PA_L2CC),
198 .length = SZ_4K,
199 .type = MT_DEVICE,
200 }, {
Kukjin Kimcc511b82011-12-27 08:18:36 +0100201 .virtual = (unsigned long)S5P_VA_DMC0,
202 .pfn = __phys_to_pfn(EXYNOS4_PA_DMC0),
MyungJoo Ham2bde0b02011-12-01 15:12:30 +0900203 .length = SZ_64K,
204 .type = MT_DEVICE,
205 }, {
206 .virtual = (unsigned long)S5P_VA_DMC1,
207 .pfn = __phys_to_pfn(EXYNOS4_PA_DMC1),
208 .length = SZ_64K,
Kukjin Kimcc511b82011-12-27 08:18:36 +0100209 .type = MT_DEVICE,
210 }, {
Kukjin Kimcc511b82011-12-27 08:18:36 +0100211 .virtual = (unsigned long)S3C_VA_USB_HSPHY,
212 .pfn = __phys_to_pfn(EXYNOS4_PA_HSPHY),
213 .length = SZ_4K,
214 .type = MT_DEVICE,
215 },
216};
217
218static struct map_desc exynos4_iodesc0[] __initdata = {
219 {
220 .virtual = (unsigned long)S5P_VA_SYSRAM,
221 .pfn = __phys_to_pfn(EXYNOS4_PA_SYSRAM0),
222 .length = SZ_4K,
223 .type = MT_DEVICE,
224 },
225};
226
227static struct map_desc exynos4_iodesc1[] __initdata = {
228 {
229 .virtual = (unsigned long)S5P_VA_SYSRAM,
230 .pfn = __phys_to_pfn(EXYNOS4_PA_SYSRAM1),
231 .length = SZ_4K,
232 .type = MT_DEVICE,
233 },
234};
235
Kukjin Kim94c7ca72012-02-11 22:15:45 +0900236static struct map_desc exynos5_iodesc[] __initdata = {
237 {
238 .virtual = (unsigned long)S3C_VA_SYS,
239 .pfn = __phys_to_pfn(EXYNOS5_PA_SYSCON),
240 .length = SZ_64K,
241 .type = MT_DEVICE,
242 }, {
243 .virtual = (unsigned long)S3C_VA_TIMER,
244 .pfn = __phys_to_pfn(EXYNOS5_PA_TIMER),
245 .length = SZ_16K,
246 .type = MT_DEVICE,
247 }, {
248 .virtual = (unsigned long)S3C_VA_WATCHDOG,
249 .pfn = __phys_to_pfn(EXYNOS5_PA_WATCHDOG),
250 .length = SZ_4K,
251 .type = MT_DEVICE,
252 }, {
253 .virtual = (unsigned long)S5P_VA_SROMC,
254 .pfn = __phys_to_pfn(EXYNOS5_PA_SROMC),
255 .length = SZ_4K,
256 .type = MT_DEVICE,
257 }, {
Kukjin Kim94c7ca72012-02-11 22:15:45 +0900258 .virtual = (unsigned long)S5P_VA_SYSRAM,
259 .pfn = __phys_to_pfn(EXYNOS5_PA_SYSRAM),
260 .length = SZ_4K,
261 .type = MT_DEVICE,
262 }, {
263 .virtual = (unsigned long)S5P_VA_CMU,
264 .pfn = __phys_to_pfn(EXYNOS5_PA_CMU),
265 .length = 144 * SZ_1K,
266 .type = MT_DEVICE,
267 }, {
268 .virtual = (unsigned long)S5P_VA_PMU,
269 .pfn = __phys_to_pfn(EXYNOS5_PA_PMU),
270 .length = SZ_64K,
271 .type = MT_DEVICE,
272 }, {
Kukjin Kim94c7ca72012-02-11 22:15:45 +0900273 .virtual = (unsigned long)S3C_VA_UART,
274 .pfn = __phys_to_pfn(EXYNOS5_PA_UART),
275 .length = SZ_512K,
276 .type = MT_DEVICE,
Kukjin Kim94c7ca72012-02-11 22:15:45 +0900277 },
278};
279
Kukjin Kim2edb36c2012-11-15 15:48:56 +0900280static struct map_desc exynos5440_iodesc0[] __initdata = {
281 {
282 .virtual = (unsigned long)S3C_VA_UART,
283 .pfn = __phys_to_pfn(EXYNOS5440_PA_UART0),
284 .length = SZ_512K,
285 .type = MT_DEVICE,
286 },
287};
288
Russell King9eb48592012-01-03 11:56:53 +0100289void exynos4_restart(char mode, const char *cmd)
Kukjin Kimcc511b82011-12-27 08:18:36 +0100290{
291 __raw_writel(0x1, S5P_SWRESET);
292}
293
Kukjin Kim94c7ca72012-02-11 22:15:45 +0900294void exynos5_restart(char mode, const char *cmd)
295{
Thomas Abraham60db7e52013-01-24 10:09:13 -0800296 struct device_node *np;
Kukjin Kim2edb36c2012-11-15 15:48:56 +0900297 u32 val;
298 void __iomem *addr;
299
300 if (of_machine_is_compatible("samsung,exynos5250")) {
301 val = 0x1;
302 addr = EXYNOS_SWRESET;
303 } else if (of_machine_is_compatible("samsung,exynos5440")) {
Thomas Abraham60db7e52013-01-24 10:09:13 -0800304 np = of_find_compatible_node(NULL, NULL, "samsung,exynos5440-clock");
305 addr = of_iomap(np, 0) + 0xcc;
306 val = (0xfff << 20) | (0x1 << 16);
Kukjin Kim2edb36c2012-11-15 15:48:56 +0900307 } else {
308 pr_err("%s: cannot support non-DT\n", __func__);
309 return;
310 }
311
312 __raw_writel(val, addr);
Kukjin Kim94c7ca72012-02-11 22:15:45 +0900313}
314
Shawn Guobb13fab2012-04-26 10:35:40 +0800315void __init exynos_init_late(void)
316{
Kukjin Kim2edb36c2012-11-15 15:48:56 +0900317 if (of_machine_is_compatible("samsung,exynos5440"))
318 /* to be supported later */
319 return;
320
Shawn Guobb13fab2012-04-26 10:35:40 +0800321 exynos_pm_late_initcall();
322}
323
Kukjin Kimcc511b82011-12-27 08:18:36 +0100324/*
325 * exynos_map_io
326 *
327 * register the standard cpu IO areas
328 */
329
330void __init exynos_init_io(struct map_desc *mach_desc, int size)
331{
Doug Anderson5b7897d2012-11-27 11:53:14 -0800332 struct map_desc *iodesc = exynos_iodesc;
333 int iodesc_sz = ARRAY_SIZE(exynos_iodesc);
334#if defined(CONFIG_OF) && defined(CONFIG_ARCH_EXYNOS5)
335 unsigned long root = of_get_flat_dt_root();
336
Kukjin Kimcc511b82011-12-27 08:18:36 +0100337 /* initialize the io descriptors we need for initialization */
Doug Anderson5b7897d2012-11-27 11:53:14 -0800338 if (of_flat_dt_is_compatible(root, "samsung,exynos5440")) {
339 iodesc = exynos5440_iodesc;
340 iodesc_sz = ARRAY_SIZE(exynos5440_iodesc);
341 }
342#endif
343
344 iotable_init(iodesc, iodesc_sz);
Kukjin Kim2edb36c2012-11-15 15:48:56 +0900345
Kukjin Kimcc511b82011-12-27 08:18:36 +0100346 if (mach_desc)
347 iotable_init(mach_desc, size);
348
349 /* detect cpu id and rev. */
350 s5p_init_cpu(S5P_VA_CHIPID);
351
352 s3c_init_cpu(samsung_cpu_id, cpu_ids, ARRAY_SIZE(cpu_ids));
353}
354
Kukjin Kim906c7892012-02-11 21:27:08 +0900355static void __init exynos4_map_io(void)
Kukjin Kimcc511b82011-12-27 08:18:36 +0100356{
357 iotable_init(exynos4_iodesc, ARRAY_SIZE(exynos4_iodesc));
358
359 if (soc_is_exynos4210() && samsung_rev() == EXYNOS4210_REV_0)
360 iotable_init(exynos4_iodesc0, ARRAY_SIZE(exynos4_iodesc0));
361 else
362 iotable_init(exynos4_iodesc1, ARRAY_SIZE(exynos4_iodesc1));
363
Arnd Bergmannbd51de52013-04-10 14:57:15 +0200364 if (!IS_ENABLED(CONFIG_EXYNOS_ATAGS))
365 return
366
Kukjin Kimcc511b82011-12-27 08:18:36 +0100367 /* initialize device information early */
368 exynos4_default_sdhci0();
369 exynos4_default_sdhci1();
370 exynos4_default_sdhci2();
371 exynos4_default_sdhci3();
372
373 s3c_adc_setname("samsung-adc-v3");
374
375 s3c_fimc_setname(0, "exynos4-fimc");
376 s3c_fimc_setname(1, "exynos4-fimc");
377 s3c_fimc_setname(2, "exynos4-fimc");
378 s3c_fimc_setname(3, "exynos4-fimc");
379
Thomas Abraham8482c812012-04-14 08:04:46 -0700380 s3c_sdhci_setname(0, "exynos4-sdhci");
381 s3c_sdhci_setname(1, "exynos4-sdhci");
382 s3c_sdhci_setname(2, "exynos4-sdhci");
383 s3c_sdhci_setname(3, "exynos4-sdhci");
384
Kukjin Kimcc511b82011-12-27 08:18:36 +0100385 /* The I2C bus controllers are directly compatible with s3c2440 */
386 s3c_i2c0_setname("s3c2440-i2c");
387 s3c_i2c1_setname("s3c2440-i2c");
388 s3c_i2c2_setname("s3c2440-i2c");
389
390 s5p_fb_setname(0, "exynos4-fb");
391 s5p_hdmi_setname("exynos4-hdmi");
Heiko Stuebner308b3af2012-10-17 16:47:11 +0900392
393 s3c64xx_spi_setname("exynos4210-spi");
Kukjin Kimcc511b82011-12-27 08:18:36 +0100394}
395
Kukjin Kim94c7ca72012-02-11 22:15:45 +0900396static void __init exynos5_map_io(void)
397{
398 iotable_init(exynos5_iodesc, ARRAY_SIZE(exynos5_iodesc));
Kukjin Kim94c7ca72012-02-11 22:15:45 +0900399}
400
Kukjin Kim2edb36c2012-11-15 15:48:56 +0900401static void __init exynos5440_map_io(void)
402{
403 iotable_init(exynos5440_iodesc0, ARRAY_SIZE(exynos5440_iodesc0));
404}
405
Thomas Abraham6923ae42013-03-09 17:03:29 +0900406void __init exynos_init_time(void)
Kukjin Kim94c7ca72012-02-11 22:15:45 +0900407{
Thomas Abraham6923ae42013-03-09 17:03:29 +0900408 if (of_have_populated_dt()) {
409#ifdef CONFIG_OF
410 of_clk_init(NULL);
411 clocksource_of_init();
Kukjin Kim61bcbc22013-01-05 08:32:55 -0800412#endif
Thomas Abraham6923ae42013-03-09 17:03:29 +0900413 } else {
414 /* todo: remove after migrating legacy E4 platforms to dt */
Thomas Abraham296f3f22013-04-05 15:17:47 +0900415#ifdef CONFIG_ARCH_EXYNOS4
Arnd Bergmann25e56eb2013-04-10 11:31:44 +0200416 exynos4_clk_init(NULL, !soc_is_exynos4210(), S5P_VA_CMU, readl(S5P_VA_CHIPID + 8) & 1);
Thomas Abraham92744272013-03-09 17:03:33 +0900417 exynos4_clk_register_fixed_ext(xxti_f, xusbxti_f);
Thomas Abraham296f3f22013-04-05 15:17:47 +0900418#endif
Arnd Bergmann034c0972013-04-10 11:35:29 +0200419 mct_init(S5P_VA_SYSTIMER, EXYNOS4_IRQ_MCT_G0, EXYNOS4_IRQ_MCT_L0, EXYNOS4_IRQ_MCT_L1);
Thomas Abraham6923ae42013-03-09 17:03:29 +0900420 }
Kukjin Kim94c7ca72012-02-11 22:15:45 +0900421}
422
Arnd Bergmann6761dcf2013-04-10 15:17:47 +0200423static unsigned int max_combiner_nr(void)
424{
425 if (soc_is_exynos5250())
426 return EXYNOS5_MAX_COMBINER_NR;
427 else if (soc_is_exynos4412())
428 return EXYNOS4412_MAX_COMBINER_NR;
429 else if (soc_is_exynos4212())
430 return EXYNOS4212_MAX_COMBINER_NR;
431 else
432 return EXYNOS4210_MAX_COMBINER_NR;
433}
434
435
Kukjin Kimcc511b82011-12-27 08:18:36 +0100436void __init exynos4_init_irq(void)
437{
Arnd Bergmann40ba95f2012-01-07 11:51:28 +0000438 unsigned int gic_bank_offset;
Kukjin Kimcc511b82011-12-27 08:18:36 +0100439
440 gic_bank_offset = soc_is_exynos4412() ? 0x4000 : 0x8000;
441
Arnd Bergmann237c78b2012-01-07 12:30:20 +0000442 if (!of_have_populated_dt())
Grant Likely75294952012-02-14 14:06:57 -0700443 gic_init_bases(0, IRQ_PPI(0), S5P_VA_GIC_DIST, S5P_VA_GIC_CPU, gic_bank_offset, NULL);
Arnd Bergmann237c78b2012-01-07 12:30:20 +0000444#ifdef CONFIG_OF
445 else
Rob Herring0529e3152012-11-05 16:18:28 -0600446 irqchip_init();
Arnd Bergmann237c78b2012-01-07 12:30:20 +0000447#endif
Kukjin Kimcc511b82011-12-27 08:18:36 +0100448
Thomas Abrahame873a472012-05-15 16:25:23 +0900449 if (!of_have_populated_dt())
Arnd Bergmann6761dcf2013-04-10 15:17:47 +0200450 combiner_init(S5P_VA_COMBINER_BASE, NULL, max_combiner_nr());
Kukjin Kimcc511b82011-12-27 08:18:36 +0100451
452 /*
453 * The parameters of s5p_init_irq() are for VIC init.
454 * Theses parameters should be NULL and 0 because EXYNOS4
455 * uses GIC instead of VIC.
456 */
457 s5p_init_irq(NULL, 0);
458}
459
Kukjin Kim94c7ca72012-02-11 22:15:45 +0900460void __init exynos5_init_irq(void)
461{
Tushar Behera6fff5a12012-04-24 13:25:01 -0700462#ifdef CONFIG_OF
Rob Herring0529e3152012-11-05 16:18:28 -0600463 irqchip_init();
Tushar Behera6fff5a12012-04-24 13:25:01 -0700464#endif
Kukjin Kim94c7ca72012-02-11 22:15:45 +0900465 /*
466 * The parameters of s5p_init_irq() are for VIC init.
467 * Theses parameters should be NULL and 0 because EXYNOS4
468 * uses GIC instead of VIC.
469 */
Kukjin Kim12fee192012-12-06 15:31:10 +0900470 if (!of_machine_is_compatible("samsung,exynos5440"))
471 s5p_init_irq(NULL, 0);
Inderpal Singh34455132012-11-22 14:46:21 +0900472
473 gic_arch_extn.irq_set_wake = s3c_irq_wake;
Kukjin Kim94c7ca72012-02-11 22:15:45 +0900474}
475
Thomas Abraham9ee6af92012-05-15 15:47:40 +0900476struct bus_type exynos_subsys = {
477 .name = "exynos-core",
478 .dev_name = "exynos-core",
Kukjin Kim94c7ca72012-02-11 22:15:45 +0900479};
480
Linus Torvalds7affca32012-01-07 12:03:30 -0800481static struct device exynos4_dev = {
Thomas Abraham9ee6af92012-05-15 15:47:40 +0900482 .bus = &exynos_subsys,
Kukjin Kim94c7ca72012-02-11 22:15:45 +0900483};
484
485static int __init exynos_core_init(void)
Kukjin Kimcc511b82011-12-27 08:18:36 +0100486{
Thomas Abraham9ee6af92012-05-15 15:47:40 +0900487 return subsys_system_register(&exynos_subsys, NULL);
Kukjin Kimcc511b82011-12-27 08:18:36 +0100488}
Kukjin Kim94c7ca72012-02-11 22:15:45 +0900489core_initcall(exynos_core_init);
Kukjin Kimcc511b82011-12-27 08:18:36 +0100490
491#ifdef CONFIG_CACHE_L2X0
492static int __init exynos4_l2x0_cache_init(void)
493{
Il Hane1b19942012-04-05 07:59:36 -0700494 int ret;
495
Kukjin Kim2edb36c2012-11-15 15:48:56 +0900496 if (soc_is_exynos5250() || soc_is_exynos5440())
Kukjin Kim94c7ca72012-02-11 22:15:45 +0900497 return 0;
498
Amit Daniel Kachhap6cdeddc2012-03-08 02:09:12 -0800499 ret = l2x0_of_init(L2_AUX_VAL, L2_AUX_MASK);
500 if (!ret) {
501 l2x0_regs_phys = virt_to_phys(&l2x0_saved_regs);
502 clean_dcache_area(&l2x0_regs_phys, sizeof(unsigned long));
503 return 0;
504 }
Kukjin Kimcc511b82011-12-27 08:18:36 +0100505
Amit Daniel Kachhapb756a502012-03-08 02:07:41 -0800506 if (!(__raw_readl(S5P_VA_L2CC + L2X0_CTRL) & 0x1)) {
507 l2x0_saved_regs.phy_base = EXYNOS4_PA_L2CC;
508 /* TAG, Data Latency Control: 2 cycles */
509 l2x0_saved_regs.tag_latency = 0x110;
Kukjin Kimcc511b82011-12-27 08:18:36 +0100510
Amit Daniel Kachhapb756a502012-03-08 02:07:41 -0800511 if (soc_is_exynos4212() || soc_is_exynos4412())
512 l2x0_saved_regs.data_latency = 0x120;
513 else
514 l2x0_saved_regs.data_latency = 0x110;
Kukjin Kimcc511b82011-12-27 08:18:36 +0100515
Amit Daniel Kachhapb756a502012-03-08 02:07:41 -0800516 l2x0_saved_regs.prefetch_ctrl = 0x30000007;
517 l2x0_saved_regs.pwr_ctrl =
518 (L2X0_DYNAMIC_CLK_GATING_EN | L2X0_STNDBY_MODE_EN);
Kukjin Kimcc511b82011-12-27 08:18:36 +0100519
Amit Daniel Kachhapb756a502012-03-08 02:07:41 -0800520 l2x0_regs_phys = virt_to_phys(&l2x0_saved_regs);
Kukjin Kimcc511b82011-12-27 08:18:36 +0100521
Amit Daniel Kachhapb756a502012-03-08 02:07:41 -0800522 __raw_writel(l2x0_saved_regs.tag_latency,
523 S5P_VA_L2CC + L2X0_TAG_LATENCY_CTRL);
524 __raw_writel(l2x0_saved_regs.data_latency,
525 S5P_VA_L2CC + L2X0_DATA_LATENCY_CTRL);
526
527 /* L2X0 Prefetch Control */
528 __raw_writel(l2x0_saved_regs.prefetch_ctrl,
529 S5P_VA_L2CC + L2X0_PREFETCH_CTRL);
530
531 /* L2X0 Power Control */
532 __raw_writel(l2x0_saved_regs.pwr_ctrl,
533 S5P_VA_L2CC + L2X0_POWER_CTRL);
534
535 clean_dcache_area(&l2x0_regs_phys, sizeof(unsigned long));
536 clean_dcache_area(&l2x0_saved_regs, sizeof(struct l2x0_regs));
537 }
Kukjin Kimcc511b82011-12-27 08:18:36 +0100538
Amit Daniel Kachhap6cdeddc2012-03-08 02:09:12 -0800539 l2x0_init(S5P_VA_L2CC, L2_AUX_VAL, L2_AUX_MASK);
Kukjin Kimcc511b82011-12-27 08:18:36 +0100540 return 0;
541}
Kukjin Kimcc511b82011-12-27 08:18:36 +0100542early_initcall(exynos4_l2x0_cache_init);
543#endif
544
Kukjin Kim906c7892012-02-11 21:27:08 +0900545static int __init exynos_init(void)
Kukjin Kimcc511b82011-12-27 08:18:36 +0100546{
547 printk(KERN_INFO "EXYNOS: Initializing architecture\n");
Kukjin Kim94c7ca72012-02-11 22:15:45 +0900548
Thomas Abraham9ee6af92012-05-15 15:47:40 +0900549 return device_register(&exynos4_dev);
Kukjin Kimcc511b82011-12-27 08:18:36 +0100550}
551
Kukjin Kimcc511b82011-12-27 08:18:36 +0100552/* uart registration process */
553
Thomas Abraham55b6ef72012-10-29 19:46:49 +0900554static void __init exynos4_init_uarts(struct s3c2410_uartcfg *cfg, int no)
Kukjin Kimcc511b82011-12-27 08:18:36 +0100555{
556 struct s3c2410_uartcfg *tcfg = cfg;
557 u32 ucnt;
558
Arnd Bergmann237c78b2012-01-07 12:30:20 +0000559 for (ucnt = 0; ucnt < no; ucnt++, tcfg++)
560 tcfg->has_fracval = 1;
Kukjin Kimcc511b82011-12-27 08:18:36 +0100561
Thomas Abraham55b6ef72012-10-29 19:46:49 +0900562 s3c24xx_init_uartdevs("exynos4210-uart", exynos4_uart_resources, cfg, no);
Kukjin Kimcc511b82011-12-27 08:18:36 +0100563}
564
Arnd Bergmannbd51de52013-04-10 14:57:15 +0200565
566#ifdef CONFIG_EXYNOS_ATAGS
Eunki Kim330c90a2012-03-14 01:43:31 -0700567static void __iomem *exynos_eint_base;
568
Kukjin Kimcc511b82011-12-27 08:18:36 +0100569static DEFINE_SPINLOCK(eint_lock);
570
571static unsigned int eint0_15_data[16];
572
Eunki Kim330c90a2012-03-14 01:43:31 -0700573static inline int exynos4_irq_to_gpio(unsigned int irq)
Kukjin Kimcc511b82011-12-27 08:18:36 +0100574{
Eunki Kim330c90a2012-03-14 01:43:31 -0700575 if (irq < IRQ_EINT(0))
576 return -EINVAL;
Kukjin Kimcc511b82011-12-27 08:18:36 +0100577
Eunki Kim330c90a2012-03-14 01:43:31 -0700578 irq -= IRQ_EINT(0);
579 if (irq < 8)
580 return EXYNOS4_GPX0(irq);
Kukjin Kimcc511b82011-12-27 08:18:36 +0100581
Eunki Kim330c90a2012-03-14 01:43:31 -0700582 irq -= 8;
583 if (irq < 8)
584 return EXYNOS4_GPX1(irq);
585
586 irq -= 8;
587 if (irq < 8)
588 return EXYNOS4_GPX2(irq);
589
590 irq -= 8;
591 if (irq < 8)
592 return EXYNOS4_GPX3(irq);
593
594 return -EINVAL;
Kukjin Kimcc511b82011-12-27 08:18:36 +0100595}
596
Eunki Kim330c90a2012-03-14 01:43:31 -0700597static inline int exynos5_irq_to_gpio(unsigned int irq)
598{
599 if (irq < IRQ_EINT(0))
600 return -EINVAL;
601
602 irq -= IRQ_EINT(0);
603 if (irq < 8)
604 return EXYNOS5_GPX0(irq);
605
606 irq -= 8;
607 if (irq < 8)
608 return EXYNOS5_GPX1(irq);
609
610 irq -= 8;
611 if (irq < 8)
612 return EXYNOS5_GPX2(irq);
613
614 irq -= 8;
615 if (irq < 8)
616 return EXYNOS5_GPX3(irq);
617
618 return -EINVAL;
619}
620
Kukjin Kimbb19a752012-01-25 13:48:11 +0900621static unsigned int exynos4_eint0_15_src_int[16] = {
622 EXYNOS4_IRQ_EINT0,
623 EXYNOS4_IRQ_EINT1,
624 EXYNOS4_IRQ_EINT2,
625 EXYNOS4_IRQ_EINT3,
626 EXYNOS4_IRQ_EINT4,
627 EXYNOS4_IRQ_EINT5,
628 EXYNOS4_IRQ_EINT6,
629 EXYNOS4_IRQ_EINT7,
630 EXYNOS4_IRQ_EINT8,
631 EXYNOS4_IRQ_EINT9,
632 EXYNOS4_IRQ_EINT10,
633 EXYNOS4_IRQ_EINT11,
634 EXYNOS4_IRQ_EINT12,
635 EXYNOS4_IRQ_EINT13,
636 EXYNOS4_IRQ_EINT14,
637 EXYNOS4_IRQ_EINT15,
638};
Kukjin Kimcc511b82011-12-27 08:18:36 +0100639
Kukjin Kimbb19a752012-01-25 13:48:11 +0900640static unsigned int exynos5_eint0_15_src_int[16] = {
641 EXYNOS5_IRQ_EINT0,
642 EXYNOS5_IRQ_EINT1,
643 EXYNOS5_IRQ_EINT2,
644 EXYNOS5_IRQ_EINT3,
645 EXYNOS5_IRQ_EINT4,
646 EXYNOS5_IRQ_EINT5,
647 EXYNOS5_IRQ_EINT6,
648 EXYNOS5_IRQ_EINT7,
649 EXYNOS5_IRQ_EINT8,
650 EXYNOS5_IRQ_EINT9,
651 EXYNOS5_IRQ_EINT10,
652 EXYNOS5_IRQ_EINT11,
653 EXYNOS5_IRQ_EINT12,
654 EXYNOS5_IRQ_EINT13,
655 EXYNOS5_IRQ_EINT14,
656 EXYNOS5_IRQ_EINT15,
657};
Eunki Kim330c90a2012-03-14 01:43:31 -0700658static inline void exynos_irq_eint_mask(struct irq_data *data)
Kukjin Kimcc511b82011-12-27 08:18:36 +0100659{
660 u32 mask;
661
662 spin_lock(&eint_lock);
Eunki Kim330c90a2012-03-14 01:43:31 -0700663 mask = __raw_readl(EINT_MASK(exynos_eint_base, data->irq));
664 mask |= EINT_OFFSET_BIT(data->irq);
665 __raw_writel(mask, EINT_MASK(exynos_eint_base, data->irq));
Kukjin Kimcc511b82011-12-27 08:18:36 +0100666 spin_unlock(&eint_lock);
667}
668
Eunki Kim330c90a2012-03-14 01:43:31 -0700669static void exynos_irq_eint_unmask(struct irq_data *data)
Kukjin Kimcc511b82011-12-27 08:18:36 +0100670{
671 u32 mask;
672
673 spin_lock(&eint_lock);
Eunki Kim330c90a2012-03-14 01:43:31 -0700674 mask = __raw_readl(EINT_MASK(exynos_eint_base, data->irq));
675 mask &= ~(EINT_OFFSET_BIT(data->irq));
676 __raw_writel(mask, EINT_MASK(exynos_eint_base, data->irq));
Kukjin Kimcc511b82011-12-27 08:18:36 +0100677 spin_unlock(&eint_lock);
678}
679
Eunki Kim330c90a2012-03-14 01:43:31 -0700680static inline void exynos_irq_eint_ack(struct irq_data *data)
Kukjin Kimcc511b82011-12-27 08:18:36 +0100681{
Eunki Kim330c90a2012-03-14 01:43:31 -0700682 __raw_writel(EINT_OFFSET_BIT(data->irq),
683 EINT_PEND(exynos_eint_base, data->irq));
Kukjin Kimcc511b82011-12-27 08:18:36 +0100684}
685
Eunki Kim330c90a2012-03-14 01:43:31 -0700686static void exynos_irq_eint_maskack(struct irq_data *data)
Kukjin Kimcc511b82011-12-27 08:18:36 +0100687{
Eunki Kim330c90a2012-03-14 01:43:31 -0700688 exynos_irq_eint_mask(data);
689 exynos_irq_eint_ack(data);
Kukjin Kimcc511b82011-12-27 08:18:36 +0100690}
691
Eunki Kim330c90a2012-03-14 01:43:31 -0700692static int exynos_irq_eint_set_type(struct irq_data *data, unsigned int type)
Kukjin Kimcc511b82011-12-27 08:18:36 +0100693{
694 int offs = EINT_OFFSET(data->irq);
695 int shift;
696 u32 ctrl, mask;
697 u32 newvalue = 0;
698
699 switch (type) {
700 case IRQ_TYPE_EDGE_RISING:
701 newvalue = S5P_IRQ_TYPE_EDGE_RISING;
702 break;
703
704 case IRQ_TYPE_EDGE_FALLING:
705 newvalue = S5P_IRQ_TYPE_EDGE_FALLING;
706 break;
707
708 case IRQ_TYPE_EDGE_BOTH:
709 newvalue = S5P_IRQ_TYPE_EDGE_BOTH;
710 break;
711
712 case IRQ_TYPE_LEVEL_LOW:
713 newvalue = S5P_IRQ_TYPE_LEVEL_LOW;
714 break;
715
716 case IRQ_TYPE_LEVEL_HIGH:
717 newvalue = S5P_IRQ_TYPE_LEVEL_HIGH;
718 break;
719
720 default:
721 printk(KERN_ERR "No such irq type %d", type);
722 return -EINVAL;
723 }
724
725 shift = (offs & 0x7) * 4;
726 mask = 0x7 << shift;
727
728 spin_lock(&eint_lock);
Eunki Kim330c90a2012-03-14 01:43:31 -0700729 ctrl = __raw_readl(EINT_CON(exynos_eint_base, data->irq));
Kukjin Kimcc511b82011-12-27 08:18:36 +0100730 ctrl &= ~mask;
731 ctrl |= newvalue << shift;
Eunki Kim330c90a2012-03-14 01:43:31 -0700732 __raw_writel(ctrl, EINT_CON(exynos_eint_base, data->irq));
Kukjin Kimcc511b82011-12-27 08:18:36 +0100733 spin_unlock(&eint_lock);
734
Eunki Kim330c90a2012-03-14 01:43:31 -0700735 if (soc_is_exynos5250())
736 s3c_gpio_cfgpin(exynos5_irq_to_gpio(data->irq), S3C_GPIO_SFN(0xf));
737 else
738 s3c_gpio_cfgpin(exynos4_irq_to_gpio(data->irq), S3C_GPIO_SFN(0xf));
Kukjin Kimcc511b82011-12-27 08:18:36 +0100739
740 return 0;
741}
742
Eunki Kim330c90a2012-03-14 01:43:31 -0700743static struct irq_chip exynos_irq_eint = {
744 .name = "exynos-eint",
745 .irq_mask = exynos_irq_eint_mask,
746 .irq_unmask = exynos_irq_eint_unmask,
747 .irq_mask_ack = exynos_irq_eint_maskack,
748 .irq_ack = exynos_irq_eint_ack,
749 .irq_set_type = exynos_irq_eint_set_type,
Kukjin Kimcc511b82011-12-27 08:18:36 +0100750#ifdef CONFIG_PM
751 .irq_set_wake = s3c_irqext_wake,
752#endif
753};
754
755/*
756 * exynos4_irq_demux_eint
757 *
758 * This function demuxes the IRQ from from EINTs 16 to 31.
759 * It is designed to be inlined into the specific handler
760 * s5p_irq_demux_eintX_Y.
761 *
762 * Each EINT pend/mask registers handle eight of them.
763 */
Eunki Kim330c90a2012-03-14 01:43:31 -0700764static inline void exynos_irq_demux_eint(unsigned int start)
Kukjin Kimcc511b82011-12-27 08:18:36 +0100765{
766 unsigned int irq;
767
Eunki Kim330c90a2012-03-14 01:43:31 -0700768 u32 status = __raw_readl(EINT_PEND(exynos_eint_base, start));
769 u32 mask = __raw_readl(EINT_MASK(exynos_eint_base, start));
Kukjin Kimcc511b82011-12-27 08:18:36 +0100770
771 status &= ~mask;
772 status &= 0xff;
773
774 while (status) {
775 irq = fls(status) - 1;
776 generic_handle_irq(irq + start);
777 status &= ~(1 << irq);
778 }
779}
780
Eunki Kim330c90a2012-03-14 01:43:31 -0700781static void exynos_irq_demux_eint16_31(unsigned int irq, struct irq_desc *desc)
Kukjin Kimcc511b82011-12-27 08:18:36 +0100782{
783 struct irq_chip *chip = irq_get_chip(irq);
784 chained_irq_enter(chip, desc);
Eunki Kim330c90a2012-03-14 01:43:31 -0700785 exynos_irq_demux_eint(IRQ_EINT(16));
786 exynos_irq_demux_eint(IRQ_EINT(24));
Kukjin Kimcc511b82011-12-27 08:18:36 +0100787 chained_irq_exit(chip, desc);
788}
789
Kukjin Kimbb19a752012-01-25 13:48:11 +0900790static void exynos_irq_eint0_15(unsigned int irq, struct irq_desc *desc)
Kukjin Kimcc511b82011-12-27 08:18:36 +0100791{
792 u32 *irq_data = irq_get_handler_data(irq);
793 struct irq_chip *chip = irq_get_chip(irq);
794
795 chained_irq_enter(chip, desc);
Kukjin Kimcc511b82011-12-27 08:18:36 +0100796 generic_handle_irq(*irq_data);
Kukjin Kimcc511b82011-12-27 08:18:36 +0100797 chained_irq_exit(chip, desc);
798}
799
Eunki Kim330c90a2012-03-14 01:43:31 -0700800static int __init exynos_init_irq_eint(void)
Kukjin Kimcc511b82011-12-27 08:18:36 +0100801{
802 int irq;
803
Thomas Abrahamfef05c22012-09-07 06:07:40 +0900804#ifdef CONFIG_PINCTRL_SAMSUNG
805 /*
806 * The Samsung pinctrl driver provides an integrated gpio/pinmux/pinconf
807 * functionality along with support for external gpio and wakeup
808 * interrupts. If the samsung pinctrl driver is enabled and includes
809 * the wakeup interrupt support, then the setting up external wakeup
810 * interrupts here can be skipped. This check here is temporary to
811 * allow exynos4 platforms that do not use Samsung pinctrl driver to
812 * co-exist with platforms that do. When all of the Samsung Exynos4
813 * platforms switch over to using the pinctrl driver, the wakeup
814 * interrupt support code here can be completely removed.
815 */
Tomasz Figaab7b51f2012-11-07 08:44:51 +0900816 static const struct of_device_id exynos_pinctrl_ids[] = {
Kukjin Kimb533c862013-01-02 16:05:42 -0800817 { .compatible = "samsung,exynos4210-pinctrl", },
818 { .compatible = "samsung,exynos4x12-pinctrl", },
Thomas Abraham97916772012-12-28 10:37:27 -0800819 { .compatible = "samsung,exynos5250-pinctrl", },
Tomasz Figaab7b51f2012-11-07 08:44:51 +0900820 };
Thomas Abrahamfef05c22012-09-07 06:07:40 +0900821 struct device_node *pctrl_np, *wkup_np;
Thomas Abrahamfef05c22012-09-07 06:07:40 +0900822 const char *wkup_compat = "samsung,exynos4210-wakeup-eint";
823
Tomasz Figaab7b51f2012-11-07 08:44:51 +0900824 for_each_matching_node(pctrl_np, exynos_pinctrl_ids) {
Thomas Abrahamfef05c22012-09-07 06:07:40 +0900825 if (of_device_is_available(pctrl_np)) {
826 wkup_np = of_find_compatible_node(pctrl_np, NULL,
827 wkup_compat);
828 if (wkup_np)
829 return -ENODEV;
830 }
831 }
832#endif
Kukjin Kim2edb36c2012-11-15 15:48:56 +0900833 if (soc_is_exynos5440())
834 return 0;
Thomas Abrahamfef05c22012-09-07 06:07:40 +0900835
Kukjin Kim94c7ca72012-02-11 22:15:45 +0900836 if (soc_is_exynos5250())
Eunki Kim330c90a2012-03-14 01:43:31 -0700837 exynos_eint_base = ioremap(EXYNOS5_PA_GPIO1, SZ_4K);
838 else
839 exynos_eint_base = ioremap(EXYNOS4_PA_GPIO2, SZ_4K);
840
841 if (exynos_eint_base == NULL) {
842 pr_err("unable to ioremap for EINT base address\n");
843 return -ENOMEM;
844 }
Kukjin Kim94c7ca72012-02-11 22:15:45 +0900845
Kukjin Kimcc511b82011-12-27 08:18:36 +0100846 for (irq = 0 ; irq <= 31 ; irq++) {
Eunki Kim330c90a2012-03-14 01:43:31 -0700847 irq_set_chip_and_handler(IRQ_EINT(irq), &exynos_irq_eint,
Kukjin Kimcc511b82011-12-27 08:18:36 +0100848 handle_level_irq);
849 set_irq_flags(IRQ_EINT(irq), IRQF_VALID);
850 }
851
Eunki Kim330c90a2012-03-14 01:43:31 -0700852 irq_set_chained_handler(EXYNOS_IRQ_EINT16_31, exynos_irq_demux_eint16_31);
Kukjin Kimcc511b82011-12-27 08:18:36 +0100853
854 for (irq = 0 ; irq <= 15 ; irq++) {
855 eint0_15_data[irq] = IRQ_EINT(irq);
856
Kukjin Kimbb19a752012-01-25 13:48:11 +0900857 if (soc_is_exynos5250()) {
858 irq_set_handler_data(exynos5_eint0_15_src_int[irq],
859 &eint0_15_data[irq]);
860 irq_set_chained_handler(exynos5_eint0_15_src_int[irq],
861 exynos_irq_eint0_15);
862 } else {
863 irq_set_handler_data(exynos4_eint0_15_src_int[irq],
864 &eint0_15_data[irq]);
865 irq_set_chained_handler(exynos4_eint0_15_src_int[irq],
866 exynos_irq_eint0_15);
867 }
Kukjin Kimcc511b82011-12-27 08:18:36 +0100868 }
869
870 return 0;
871}
Eunki Kim330c90a2012-03-14 01:43:31 -0700872arch_initcall(exynos_init_irq_eint);
Arnd Bergmannbd51de52013-04-10 14:57:15 +0200873#endif
Chanho Parkb7bbdbe2012-12-12 14:03:54 +0900874
875static struct resource exynos4_pmu_resource[] = {
876 DEFINE_RES_IRQ(EXYNOS4_IRQ_PMU),
877 DEFINE_RES_IRQ(EXYNOS4_IRQ_PMU_CPU1),
878#if defined(CONFIG_SOC_EXYNOS4412)
879 DEFINE_RES_IRQ(EXYNOS4_IRQ_PMU_CPU2),
880 DEFINE_RES_IRQ(EXYNOS4_IRQ_PMU_CPU3),
881#endif
882};
883
884static struct platform_device exynos4_device_pmu = {
885 .name = "arm-pmu",
886 .num_resources = ARRAY_SIZE(exynos4_pmu_resource),
887 .resource = exynos4_pmu_resource,
888};
889
890static int __init exynos_armpmu_init(void)
891{
892 if (!of_have_populated_dt()) {
893 if (soc_is_exynos4210() || soc_is_exynos4212())
894 exynos4_device_pmu.num_resources = 2;
895 platform_device_register(&exynos4_device_pmu);
896 }
897
898 return 0;
899}
900arch_initcall(exynos_armpmu_init);