blob: 9208079d5d52084704f32dac962bd7cc51330364 [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 Bergmann863a08d2013-04-12 15:27:09 +0200450 combiner_init(S5P_VA_COMBINER_BASE, NULL,
451 max_combiner_nr(), COMBINER_IRQ(0, 0));
Kukjin Kimcc511b82011-12-27 08:18:36 +0100452
453 /*
454 * The parameters of s5p_init_irq() are for VIC init.
455 * Theses parameters should be NULL and 0 because EXYNOS4
456 * uses GIC instead of VIC.
457 */
458 s5p_init_irq(NULL, 0);
459}
460
Kukjin Kim94c7ca72012-02-11 22:15:45 +0900461void __init exynos5_init_irq(void)
462{
Tushar Behera6fff5a12012-04-24 13:25:01 -0700463#ifdef CONFIG_OF
Rob Herring0529e3152012-11-05 16:18:28 -0600464 irqchip_init();
Tushar Behera6fff5a12012-04-24 13:25:01 -0700465#endif
Kukjin Kim94c7ca72012-02-11 22:15:45 +0900466 /*
467 * The parameters of s5p_init_irq() are for VIC init.
468 * Theses parameters should be NULL and 0 because EXYNOS4
469 * uses GIC instead of VIC.
470 */
Kukjin Kim12fee192012-12-06 15:31:10 +0900471 if (!of_machine_is_compatible("samsung,exynos5440"))
472 s5p_init_irq(NULL, 0);
Inderpal Singh34455132012-11-22 14:46:21 +0900473
474 gic_arch_extn.irq_set_wake = s3c_irq_wake;
Kukjin Kim94c7ca72012-02-11 22:15:45 +0900475}
476
Thomas Abraham9ee6af92012-05-15 15:47:40 +0900477struct bus_type exynos_subsys = {
478 .name = "exynos-core",
479 .dev_name = "exynos-core",
Kukjin Kim94c7ca72012-02-11 22:15:45 +0900480};
481
Linus Torvalds7affca32012-01-07 12:03:30 -0800482static struct device exynos4_dev = {
Thomas Abraham9ee6af92012-05-15 15:47:40 +0900483 .bus = &exynos_subsys,
Kukjin Kim94c7ca72012-02-11 22:15:45 +0900484};
485
486static int __init exynos_core_init(void)
Kukjin Kimcc511b82011-12-27 08:18:36 +0100487{
Thomas Abraham9ee6af92012-05-15 15:47:40 +0900488 return subsys_system_register(&exynos_subsys, NULL);
Kukjin Kimcc511b82011-12-27 08:18:36 +0100489}
Kukjin Kim94c7ca72012-02-11 22:15:45 +0900490core_initcall(exynos_core_init);
Kukjin Kimcc511b82011-12-27 08:18:36 +0100491
492#ifdef CONFIG_CACHE_L2X0
493static int __init exynos4_l2x0_cache_init(void)
494{
Il Hane1b19942012-04-05 07:59:36 -0700495 int ret;
496
Kukjin Kim2edb36c2012-11-15 15:48:56 +0900497 if (soc_is_exynos5250() || soc_is_exynos5440())
Kukjin Kim94c7ca72012-02-11 22:15:45 +0900498 return 0;
499
Amit Daniel Kachhap6cdeddc2012-03-08 02:09:12 -0800500 ret = l2x0_of_init(L2_AUX_VAL, L2_AUX_MASK);
501 if (!ret) {
502 l2x0_regs_phys = virt_to_phys(&l2x0_saved_regs);
503 clean_dcache_area(&l2x0_regs_phys, sizeof(unsigned long));
504 return 0;
505 }
Kukjin Kimcc511b82011-12-27 08:18:36 +0100506
Amit Daniel Kachhapb756a502012-03-08 02:07:41 -0800507 if (!(__raw_readl(S5P_VA_L2CC + L2X0_CTRL) & 0x1)) {
508 l2x0_saved_regs.phy_base = EXYNOS4_PA_L2CC;
509 /* TAG, Data Latency Control: 2 cycles */
510 l2x0_saved_regs.tag_latency = 0x110;
Kukjin Kimcc511b82011-12-27 08:18:36 +0100511
Amit Daniel Kachhapb756a502012-03-08 02:07:41 -0800512 if (soc_is_exynos4212() || soc_is_exynos4412())
513 l2x0_saved_regs.data_latency = 0x120;
514 else
515 l2x0_saved_regs.data_latency = 0x110;
Kukjin Kimcc511b82011-12-27 08:18:36 +0100516
Amit Daniel Kachhapb756a502012-03-08 02:07:41 -0800517 l2x0_saved_regs.prefetch_ctrl = 0x30000007;
518 l2x0_saved_regs.pwr_ctrl =
519 (L2X0_DYNAMIC_CLK_GATING_EN | L2X0_STNDBY_MODE_EN);
Kukjin Kimcc511b82011-12-27 08:18:36 +0100520
Amit Daniel Kachhapb756a502012-03-08 02:07:41 -0800521 l2x0_regs_phys = virt_to_phys(&l2x0_saved_regs);
Kukjin Kimcc511b82011-12-27 08:18:36 +0100522
Amit Daniel Kachhapb756a502012-03-08 02:07:41 -0800523 __raw_writel(l2x0_saved_regs.tag_latency,
524 S5P_VA_L2CC + L2X0_TAG_LATENCY_CTRL);
525 __raw_writel(l2x0_saved_regs.data_latency,
526 S5P_VA_L2CC + L2X0_DATA_LATENCY_CTRL);
527
528 /* L2X0 Prefetch Control */
529 __raw_writel(l2x0_saved_regs.prefetch_ctrl,
530 S5P_VA_L2CC + L2X0_PREFETCH_CTRL);
531
532 /* L2X0 Power Control */
533 __raw_writel(l2x0_saved_regs.pwr_ctrl,
534 S5P_VA_L2CC + L2X0_POWER_CTRL);
535
536 clean_dcache_area(&l2x0_regs_phys, sizeof(unsigned long));
537 clean_dcache_area(&l2x0_saved_regs, sizeof(struct l2x0_regs));
538 }
Kukjin Kimcc511b82011-12-27 08:18:36 +0100539
Amit Daniel Kachhap6cdeddc2012-03-08 02:09:12 -0800540 l2x0_init(S5P_VA_L2CC, L2_AUX_VAL, L2_AUX_MASK);
Kukjin Kimcc511b82011-12-27 08:18:36 +0100541 return 0;
542}
Kukjin Kimcc511b82011-12-27 08:18:36 +0100543early_initcall(exynos4_l2x0_cache_init);
544#endif
545
Kukjin Kim906c7892012-02-11 21:27:08 +0900546static int __init exynos_init(void)
Kukjin Kimcc511b82011-12-27 08:18:36 +0100547{
548 printk(KERN_INFO "EXYNOS: Initializing architecture\n");
Kukjin Kim94c7ca72012-02-11 22:15:45 +0900549
Thomas Abraham9ee6af92012-05-15 15:47:40 +0900550 return device_register(&exynos4_dev);
Kukjin Kimcc511b82011-12-27 08:18:36 +0100551}
552
Kukjin Kimcc511b82011-12-27 08:18:36 +0100553/* uart registration process */
554
Thomas Abraham55b6ef72012-10-29 19:46:49 +0900555static void __init exynos4_init_uarts(struct s3c2410_uartcfg *cfg, int no)
Kukjin Kimcc511b82011-12-27 08:18:36 +0100556{
557 struct s3c2410_uartcfg *tcfg = cfg;
558 u32 ucnt;
559
Arnd Bergmann237c78b2012-01-07 12:30:20 +0000560 for (ucnt = 0; ucnt < no; ucnt++, tcfg++)
561 tcfg->has_fracval = 1;
Kukjin Kimcc511b82011-12-27 08:18:36 +0100562
Thomas Abraham55b6ef72012-10-29 19:46:49 +0900563 s3c24xx_init_uartdevs("exynos4210-uart", exynos4_uart_resources, cfg, no);
Kukjin Kimcc511b82011-12-27 08:18:36 +0100564}
565
Arnd Bergmannbd51de52013-04-10 14:57:15 +0200566
567#ifdef CONFIG_EXYNOS_ATAGS
Eunki Kim330c90a2012-03-14 01:43:31 -0700568static void __iomem *exynos_eint_base;
569
Kukjin Kimcc511b82011-12-27 08:18:36 +0100570static DEFINE_SPINLOCK(eint_lock);
571
572static unsigned int eint0_15_data[16];
573
Eunki Kim330c90a2012-03-14 01:43:31 -0700574static inline int exynos4_irq_to_gpio(unsigned int irq)
Kukjin Kimcc511b82011-12-27 08:18:36 +0100575{
Eunki Kim330c90a2012-03-14 01:43:31 -0700576 if (irq < IRQ_EINT(0))
577 return -EINVAL;
Kukjin Kimcc511b82011-12-27 08:18:36 +0100578
Eunki Kim330c90a2012-03-14 01:43:31 -0700579 irq -= IRQ_EINT(0);
580 if (irq < 8)
581 return EXYNOS4_GPX0(irq);
Kukjin Kimcc511b82011-12-27 08:18:36 +0100582
Eunki Kim330c90a2012-03-14 01:43:31 -0700583 irq -= 8;
584 if (irq < 8)
585 return EXYNOS4_GPX1(irq);
586
587 irq -= 8;
588 if (irq < 8)
589 return EXYNOS4_GPX2(irq);
590
591 irq -= 8;
592 if (irq < 8)
593 return EXYNOS4_GPX3(irq);
594
595 return -EINVAL;
Kukjin Kimcc511b82011-12-27 08:18:36 +0100596}
597
Eunki Kim330c90a2012-03-14 01:43:31 -0700598static inline int exynos5_irq_to_gpio(unsigned int irq)
599{
600 if (irq < IRQ_EINT(0))
601 return -EINVAL;
602
603 irq -= IRQ_EINT(0);
604 if (irq < 8)
605 return EXYNOS5_GPX0(irq);
606
607 irq -= 8;
608 if (irq < 8)
609 return EXYNOS5_GPX1(irq);
610
611 irq -= 8;
612 if (irq < 8)
613 return EXYNOS5_GPX2(irq);
614
615 irq -= 8;
616 if (irq < 8)
617 return EXYNOS5_GPX3(irq);
618
619 return -EINVAL;
620}
621
Kukjin Kimbb19a752012-01-25 13:48:11 +0900622static unsigned int exynos4_eint0_15_src_int[16] = {
623 EXYNOS4_IRQ_EINT0,
624 EXYNOS4_IRQ_EINT1,
625 EXYNOS4_IRQ_EINT2,
626 EXYNOS4_IRQ_EINT3,
627 EXYNOS4_IRQ_EINT4,
628 EXYNOS4_IRQ_EINT5,
629 EXYNOS4_IRQ_EINT6,
630 EXYNOS4_IRQ_EINT7,
631 EXYNOS4_IRQ_EINT8,
632 EXYNOS4_IRQ_EINT9,
633 EXYNOS4_IRQ_EINT10,
634 EXYNOS4_IRQ_EINT11,
635 EXYNOS4_IRQ_EINT12,
636 EXYNOS4_IRQ_EINT13,
637 EXYNOS4_IRQ_EINT14,
638 EXYNOS4_IRQ_EINT15,
639};
Kukjin Kimcc511b82011-12-27 08:18:36 +0100640
Kukjin Kimbb19a752012-01-25 13:48:11 +0900641static unsigned int exynos5_eint0_15_src_int[16] = {
642 EXYNOS5_IRQ_EINT0,
643 EXYNOS5_IRQ_EINT1,
644 EXYNOS5_IRQ_EINT2,
645 EXYNOS5_IRQ_EINT3,
646 EXYNOS5_IRQ_EINT4,
647 EXYNOS5_IRQ_EINT5,
648 EXYNOS5_IRQ_EINT6,
649 EXYNOS5_IRQ_EINT7,
650 EXYNOS5_IRQ_EINT8,
651 EXYNOS5_IRQ_EINT9,
652 EXYNOS5_IRQ_EINT10,
653 EXYNOS5_IRQ_EINT11,
654 EXYNOS5_IRQ_EINT12,
655 EXYNOS5_IRQ_EINT13,
656 EXYNOS5_IRQ_EINT14,
657 EXYNOS5_IRQ_EINT15,
658};
Eunki Kim330c90a2012-03-14 01:43:31 -0700659static inline void exynos_irq_eint_mask(struct irq_data *data)
Kukjin Kimcc511b82011-12-27 08:18:36 +0100660{
661 u32 mask;
662
663 spin_lock(&eint_lock);
Eunki Kim330c90a2012-03-14 01:43:31 -0700664 mask = __raw_readl(EINT_MASK(exynos_eint_base, data->irq));
665 mask |= EINT_OFFSET_BIT(data->irq);
666 __raw_writel(mask, EINT_MASK(exynos_eint_base, data->irq));
Kukjin Kimcc511b82011-12-27 08:18:36 +0100667 spin_unlock(&eint_lock);
668}
669
Eunki Kim330c90a2012-03-14 01:43:31 -0700670static void exynos_irq_eint_unmask(struct irq_data *data)
Kukjin Kimcc511b82011-12-27 08:18:36 +0100671{
672 u32 mask;
673
674 spin_lock(&eint_lock);
Eunki Kim330c90a2012-03-14 01:43:31 -0700675 mask = __raw_readl(EINT_MASK(exynos_eint_base, data->irq));
676 mask &= ~(EINT_OFFSET_BIT(data->irq));
677 __raw_writel(mask, EINT_MASK(exynos_eint_base, data->irq));
Kukjin Kimcc511b82011-12-27 08:18:36 +0100678 spin_unlock(&eint_lock);
679}
680
Eunki Kim330c90a2012-03-14 01:43:31 -0700681static inline void exynos_irq_eint_ack(struct irq_data *data)
Kukjin Kimcc511b82011-12-27 08:18:36 +0100682{
Eunki Kim330c90a2012-03-14 01:43:31 -0700683 __raw_writel(EINT_OFFSET_BIT(data->irq),
684 EINT_PEND(exynos_eint_base, data->irq));
Kukjin Kimcc511b82011-12-27 08:18:36 +0100685}
686
Eunki Kim330c90a2012-03-14 01:43:31 -0700687static void exynos_irq_eint_maskack(struct irq_data *data)
Kukjin Kimcc511b82011-12-27 08:18:36 +0100688{
Eunki Kim330c90a2012-03-14 01:43:31 -0700689 exynos_irq_eint_mask(data);
690 exynos_irq_eint_ack(data);
Kukjin Kimcc511b82011-12-27 08:18:36 +0100691}
692
Eunki Kim330c90a2012-03-14 01:43:31 -0700693static int exynos_irq_eint_set_type(struct irq_data *data, unsigned int type)
Kukjin Kimcc511b82011-12-27 08:18:36 +0100694{
695 int offs = EINT_OFFSET(data->irq);
696 int shift;
697 u32 ctrl, mask;
698 u32 newvalue = 0;
699
700 switch (type) {
701 case IRQ_TYPE_EDGE_RISING:
702 newvalue = S5P_IRQ_TYPE_EDGE_RISING;
703 break;
704
705 case IRQ_TYPE_EDGE_FALLING:
706 newvalue = S5P_IRQ_TYPE_EDGE_FALLING;
707 break;
708
709 case IRQ_TYPE_EDGE_BOTH:
710 newvalue = S5P_IRQ_TYPE_EDGE_BOTH;
711 break;
712
713 case IRQ_TYPE_LEVEL_LOW:
714 newvalue = S5P_IRQ_TYPE_LEVEL_LOW;
715 break;
716
717 case IRQ_TYPE_LEVEL_HIGH:
718 newvalue = S5P_IRQ_TYPE_LEVEL_HIGH;
719 break;
720
721 default:
722 printk(KERN_ERR "No such irq type %d", type);
723 return -EINVAL;
724 }
725
726 shift = (offs & 0x7) * 4;
727 mask = 0x7 << shift;
728
729 spin_lock(&eint_lock);
Eunki Kim330c90a2012-03-14 01:43:31 -0700730 ctrl = __raw_readl(EINT_CON(exynos_eint_base, data->irq));
Kukjin Kimcc511b82011-12-27 08:18:36 +0100731 ctrl &= ~mask;
732 ctrl |= newvalue << shift;
Eunki Kim330c90a2012-03-14 01:43:31 -0700733 __raw_writel(ctrl, EINT_CON(exynos_eint_base, data->irq));
Kukjin Kimcc511b82011-12-27 08:18:36 +0100734 spin_unlock(&eint_lock);
735
Eunki Kim330c90a2012-03-14 01:43:31 -0700736 if (soc_is_exynos5250())
737 s3c_gpio_cfgpin(exynos5_irq_to_gpio(data->irq), S3C_GPIO_SFN(0xf));
738 else
739 s3c_gpio_cfgpin(exynos4_irq_to_gpio(data->irq), S3C_GPIO_SFN(0xf));
Kukjin Kimcc511b82011-12-27 08:18:36 +0100740
741 return 0;
742}
743
Eunki Kim330c90a2012-03-14 01:43:31 -0700744static struct irq_chip exynos_irq_eint = {
745 .name = "exynos-eint",
746 .irq_mask = exynos_irq_eint_mask,
747 .irq_unmask = exynos_irq_eint_unmask,
748 .irq_mask_ack = exynos_irq_eint_maskack,
749 .irq_ack = exynos_irq_eint_ack,
750 .irq_set_type = exynos_irq_eint_set_type,
Kukjin Kimcc511b82011-12-27 08:18:36 +0100751#ifdef CONFIG_PM
752 .irq_set_wake = s3c_irqext_wake,
753#endif
754};
755
756/*
757 * exynos4_irq_demux_eint
758 *
759 * This function demuxes the IRQ from from EINTs 16 to 31.
760 * It is designed to be inlined into the specific handler
761 * s5p_irq_demux_eintX_Y.
762 *
763 * Each EINT pend/mask registers handle eight of them.
764 */
Eunki Kim330c90a2012-03-14 01:43:31 -0700765static inline void exynos_irq_demux_eint(unsigned int start)
Kukjin Kimcc511b82011-12-27 08:18:36 +0100766{
767 unsigned int irq;
768
Eunki Kim330c90a2012-03-14 01:43:31 -0700769 u32 status = __raw_readl(EINT_PEND(exynos_eint_base, start));
770 u32 mask = __raw_readl(EINT_MASK(exynos_eint_base, start));
Kukjin Kimcc511b82011-12-27 08:18:36 +0100771
772 status &= ~mask;
773 status &= 0xff;
774
775 while (status) {
776 irq = fls(status) - 1;
777 generic_handle_irq(irq + start);
778 status &= ~(1 << irq);
779 }
780}
781
Eunki Kim330c90a2012-03-14 01:43:31 -0700782static void exynos_irq_demux_eint16_31(unsigned int irq, struct irq_desc *desc)
Kukjin Kimcc511b82011-12-27 08:18:36 +0100783{
784 struct irq_chip *chip = irq_get_chip(irq);
785 chained_irq_enter(chip, desc);
Eunki Kim330c90a2012-03-14 01:43:31 -0700786 exynos_irq_demux_eint(IRQ_EINT(16));
787 exynos_irq_demux_eint(IRQ_EINT(24));
Kukjin Kimcc511b82011-12-27 08:18:36 +0100788 chained_irq_exit(chip, desc);
789}
790
Kukjin Kimbb19a752012-01-25 13:48:11 +0900791static void exynos_irq_eint0_15(unsigned int irq, struct irq_desc *desc)
Kukjin Kimcc511b82011-12-27 08:18:36 +0100792{
793 u32 *irq_data = irq_get_handler_data(irq);
794 struct irq_chip *chip = irq_get_chip(irq);
795
796 chained_irq_enter(chip, desc);
Kukjin Kimcc511b82011-12-27 08:18:36 +0100797 generic_handle_irq(*irq_data);
Kukjin Kimcc511b82011-12-27 08:18:36 +0100798 chained_irq_exit(chip, desc);
799}
800
Eunki Kim330c90a2012-03-14 01:43:31 -0700801static int __init exynos_init_irq_eint(void)
Kukjin Kimcc511b82011-12-27 08:18:36 +0100802{
803 int irq;
804
Thomas Abrahamfef05c22012-09-07 06:07:40 +0900805#ifdef CONFIG_PINCTRL_SAMSUNG
806 /*
807 * The Samsung pinctrl driver provides an integrated gpio/pinmux/pinconf
808 * functionality along with support for external gpio and wakeup
809 * interrupts. If the samsung pinctrl driver is enabled and includes
810 * the wakeup interrupt support, then the setting up external wakeup
811 * interrupts here can be skipped. This check here is temporary to
812 * allow exynos4 platforms that do not use Samsung pinctrl driver to
813 * co-exist with platforms that do. When all of the Samsung Exynos4
814 * platforms switch over to using the pinctrl driver, the wakeup
815 * interrupt support code here can be completely removed.
816 */
Tomasz Figaab7b51f2012-11-07 08:44:51 +0900817 static const struct of_device_id exynos_pinctrl_ids[] = {
Kukjin Kimb533c862013-01-02 16:05:42 -0800818 { .compatible = "samsung,exynos4210-pinctrl", },
819 { .compatible = "samsung,exynos4x12-pinctrl", },
Thomas Abraham97916772012-12-28 10:37:27 -0800820 { .compatible = "samsung,exynos5250-pinctrl", },
Tomasz Figaab7b51f2012-11-07 08:44:51 +0900821 };
Thomas Abrahamfef05c22012-09-07 06:07:40 +0900822 struct device_node *pctrl_np, *wkup_np;
Thomas Abrahamfef05c22012-09-07 06:07:40 +0900823 const char *wkup_compat = "samsung,exynos4210-wakeup-eint";
824
Tomasz Figaab7b51f2012-11-07 08:44:51 +0900825 for_each_matching_node(pctrl_np, exynos_pinctrl_ids) {
Thomas Abrahamfef05c22012-09-07 06:07:40 +0900826 if (of_device_is_available(pctrl_np)) {
827 wkup_np = of_find_compatible_node(pctrl_np, NULL,
828 wkup_compat);
829 if (wkup_np)
830 return -ENODEV;
831 }
832 }
833#endif
Kukjin Kim2edb36c2012-11-15 15:48:56 +0900834 if (soc_is_exynos5440())
835 return 0;
Thomas Abrahamfef05c22012-09-07 06:07:40 +0900836
Kukjin Kim94c7ca72012-02-11 22:15:45 +0900837 if (soc_is_exynos5250())
Eunki Kim330c90a2012-03-14 01:43:31 -0700838 exynos_eint_base = ioremap(EXYNOS5_PA_GPIO1, SZ_4K);
839 else
840 exynos_eint_base = ioremap(EXYNOS4_PA_GPIO2, SZ_4K);
841
842 if (exynos_eint_base == NULL) {
843 pr_err("unable to ioremap for EINT base address\n");
844 return -ENOMEM;
845 }
Kukjin Kim94c7ca72012-02-11 22:15:45 +0900846
Kukjin Kimcc511b82011-12-27 08:18:36 +0100847 for (irq = 0 ; irq <= 31 ; irq++) {
Eunki Kim330c90a2012-03-14 01:43:31 -0700848 irq_set_chip_and_handler(IRQ_EINT(irq), &exynos_irq_eint,
Kukjin Kimcc511b82011-12-27 08:18:36 +0100849 handle_level_irq);
850 set_irq_flags(IRQ_EINT(irq), IRQF_VALID);
851 }
852
Eunki Kim330c90a2012-03-14 01:43:31 -0700853 irq_set_chained_handler(EXYNOS_IRQ_EINT16_31, exynos_irq_demux_eint16_31);
Kukjin Kimcc511b82011-12-27 08:18:36 +0100854
855 for (irq = 0 ; irq <= 15 ; irq++) {
856 eint0_15_data[irq] = IRQ_EINT(irq);
857
Kukjin Kimbb19a752012-01-25 13:48:11 +0900858 if (soc_is_exynos5250()) {
859 irq_set_handler_data(exynos5_eint0_15_src_int[irq],
860 &eint0_15_data[irq]);
861 irq_set_chained_handler(exynos5_eint0_15_src_int[irq],
862 exynos_irq_eint0_15);
863 } else {
864 irq_set_handler_data(exynos4_eint0_15_src_int[irq],
865 &eint0_15_data[irq]);
866 irq_set_chained_handler(exynos4_eint0_15_src_int[irq],
867 exynos_irq_eint0_15);
868 }
Kukjin Kimcc511b82011-12-27 08:18:36 +0100869 }
870
871 return 0;
872}
Eunki Kim330c90a2012-03-14 01:43:31 -0700873arch_initcall(exynos_init_irq_eint);
Arnd Bergmannbd51de52013-04-10 14:57:15 +0200874#endif
Chanho Parkb7bbdbe2012-12-12 14:03:54 +0900875
876static struct resource exynos4_pmu_resource[] = {
877 DEFINE_RES_IRQ(EXYNOS4_IRQ_PMU),
878 DEFINE_RES_IRQ(EXYNOS4_IRQ_PMU_CPU1),
879#if defined(CONFIG_SOC_EXYNOS4412)
880 DEFINE_RES_IRQ(EXYNOS4_IRQ_PMU_CPU2),
881 DEFINE_RES_IRQ(EXYNOS4_IRQ_PMU_CPU3),
882#endif
883};
884
885static struct platform_device exynos4_device_pmu = {
886 .name = "arm-pmu",
887 .num_resources = ARRAY_SIZE(exynos4_pmu_resource),
888 .resource = exynos4_pmu_resource,
889};
890
891static int __init exynos_armpmu_init(void)
892{
893 if (!of_have_populated_dt()) {
894 if (soc_is_exynos4210() || soc_is_exynos4212())
895 exynos4_device_pmu.num_resources = 2;
896 platform_device_register(&exynos4_device_pmu);
897 }
898
899 return 0;
900}
901arch_initcall(exynos_armpmu_init);