blob: c3167b74118043230ef49488eb646baf3c02f91e [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
Thomas Abraham6923ae42013-03-09 17:03:29 +0900419 mct_init();
420 }
Kukjin Kim94c7ca72012-02-11 22:15:45 +0900421}
422
Kukjin Kimcc511b82011-12-27 08:18:36 +0100423void __init exynos4_init_irq(void)
424{
Arnd Bergmann40ba95f2012-01-07 11:51:28 +0000425 unsigned int gic_bank_offset;
Kukjin Kimcc511b82011-12-27 08:18:36 +0100426
427 gic_bank_offset = soc_is_exynos4412() ? 0x4000 : 0x8000;
428
Arnd Bergmann237c78b2012-01-07 12:30:20 +0000429 if (!of_have_populated_dt())
Grant Likely75294952012-02-14 14:06:57 -0700430 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 +0000431#ifdef CONFIG_OF
432 else
Rob Herring0529e3152012-11-05 16:18:28 -0600433 irqchip_init();
Arnd Bergmann237c78b2012-01-07 12:30:20 +0000434#endif
Kukjin Kimcc511b82011-12-27 08:18:36 +0100435
Thomas Abrahame873a472012-05-15 16:25:23 +0900436 if (!of_have_populated_dt())
437 combiner_init(S5P_VA_COMBINER_BASE, NULL);
Kukjin Kimcc511b82011-12-27 08:18:36 +0100438
439 /*
440 * The parameters of s5p_init_irq() are for VIC init.
441 * Theses parameters should be NULL and 0 because EXYNOS4
442 * uses GIC instead of VIC.
443 */
444 s5p_init_irq(NULL, 0);
445}
446
Kukjin Kim94c7ca72012-02-11 22:15:45 +0900447void __init exynos5_init_irq(void)
448{
Tushar Behera6fff5a12012-04-24 13:25:01 -0700449#ifdef CONFIG_OF
Rob Herring0529e3152012-11-05 16:18:28 -0600450 irqchip_init();
Tushar Behera6fff5a12012-04-24 13:25:01 -0700451#endif
Kukjin Kim94c7ca72012-02-11 22:15:45 +0900452 /*
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 */
Kukjin Kim12fee192012-12-06 15:31:10 +0900457 if (!of_machine_is_compatible("samsung,exynos5440"))
458 s5p_init_irq(NULL, 0);
Inderpal Singh34455132012-11-22 14:46:21 +0900459
460 gic_arch_extn.irq_set_wake = s3c_irq_wake;
Kukjin Kim94c7ca72012-02-11 22:15:45 +0900461}
462
Thomas Abraham9ee6af92012-05-15 15:47:40 +0900463struct bus_type exynos_subsys = {
464 .name = "exynos-core",
465 .dev_name = "exynos-core",
Kukjin Kim94c7ca72012-02-11 22:15:45 +0900466};
467
Linus Torvalds7affca32012-01-07 12:03:30 -0800468static struct device exynos4_dev = {
Thomas Abraham9ee6af92012-05-15 15:47:40 +0900469 .bus = &exynos_subsys,
Kukjin Kim94c7ca72012-02-11 22:15:45 +0900470};
471
472static int __init exynos_core_init(void)
Kukjin Kimcc511b82011-12-27 08:18:36 +0100473{
Thomas Abraham9ee6af92012-05-15 15:47:40 +0900474 return subsys_system_register(&exynos_subsys, NULL);
Kukjin Kimcc511b82011-12-27 08:18:36 +0100475}
Kukjin Kim94c7ca72012-02-11 22:15:45 +0900476core_initcall(exynos_core_init);
Kukjin Kimcc511b82011-12-27 08:18:36 +0100477
478#ifdef CONFIG_CACHE_L2X0
479static int __init exynos4_l2x0_cache_init(void)
480{
Il Hane1b19942012-04-05 07:59:36 -0700481 int ret;
482
Kukjin Kim2edb36c2012-11-15 15:48:56 +0900483 if (soc_is_exynos5250() || soc_is_exynos5440())
Kukjin Kim94c7ca72012-02-11 22:15:45 +0900484 return 0;
485
Amit Daniel Kachhap6cdeddc2012-03-08 02:09:12 -0800486 ret = l2x0_of_init(L2_AUX_VAL, L2_AUX_MASK);
487 if (!ret) {
488 l2x0_regs_phys = virt_to_phys(&l2x0_saved_regs);
489 clean_dcache_area(&l2x0_regs_phys, sizeof(unsigned long));
490 return 0;
491 }
Kukjin Kimcc511b82011-12-27 08:18:36 +0100492
Amit Daniel Kachhapb756a502012-03-08 02:07:41 -0800493 if (!(__raw_readl(S5P_VA_L2CC + L2X0_CTRL) & 0x1)) {
494 l2x0_saved_regs.phy_base = EXYNOS4_PA_L2CC;
495 /* TAG, Data Latency Control: 2 cycles */
496 l2x0_saved_regs.tag_latency = 0x110;
Kukjin Kimcc511b82011-12-27 08:18:36 +0100497
Amit Daniel Kachhapb756a502012-03-08 02:07:41 -0800498 if (soc_is_exynos4212() || soc_is_exynos4412())
499 l2x0_saved_regs.data_latency = 0x120;
500 else
501 l2x0_saved_regs.data_latency = 0x110;
Kukjin Kimcc511b82011-12-27 08:18:36 +0100502
Amit Daniel Kachhapb756a502012-03-08 02:07:41 -0800503 l2x0_saved_regs.prefetch_ctrl = 0x30000007;
504 l2x0_saved_regs.pwr_ctrl =
505 (L2X0_DYNAMIC_CLK_GATING_EN | L2X0_STNDBY_MODE_EN);
Kukjin Kimcc511b82011-12-27 08:18:36 +0100506
Amit Daniel Kachhapb756a502012-03-08 02:07:41 -0800507 l2x0_regs_phys = virt_to_phys(&l2x0_saved_regs);
Kukjin Kimcc511b82011-12-27 08:18:36 +0100508
Amit Daniel Kachhapb756a502012-03-08 02:07:41 -0800509 __raw_writel(l2x0_saved_regs.tag_latency,
510 S5P_VA_L2CC + L2X0_TAG_LATENCY_CTRL);
511 __raw_writel(l2x0_saved_regs.data_latency,
512 S5P_VA_L2CC + L2X0_DATA_LATENCY_CTRL);
513
514 /* L2X0 Prefetch Control */
515 __raw_writel(l2x0_saved_regs.prefetch_ctrl,
516 S5P_VA_L2CC + L2X0_PREFETCH_CTRL);
517
518 /* L2X0 Power Control */
519 __raw_writel(l2x0_saved_regs.pwr_ctrl,
520 S5P_VA_L2CC + L2X0_POWER_CTRL);
521
522 clean_dcache_area(&l2x0_regs_phys, sizeof(unsigned long));
523 clean_dcache_area(&l2x0_saved_regs, sizeof(struct l2x0_regs));
524 }
Kukjin Kimcc511b82011-12-27 08:18:36 +0100525
Amit Daniel Kachhap6cdeddc2012-03-08 02:09:12 -0800526 l2x0_init(S5P_VA_L2CC, L2_AUX_VAL, L2_AUX_MASK);
Kukjin Kimcc511b82011-12-27 08:18:36 +0100527 return 0;
528}
Kukjin Kimcc511b82011-12-27 08:18:36 +0100529early_initcall(exynos4_l2x0_cache_init);
530#endif
531
Kukjin Kim906c7892012-02-11 21:27:08 +0900532static int __init exynos_init(void)
Kukjin Kimcc511b82011-12-27 08:18:36 +0100533{
534 printk(KERN_INFO "EXYNOS: Initializing architecture\n");
Kukjin Kim94c7ca72012-02-11 22:15:45 +0900535
Thomas Abraham9ee6af92012-05-15 15:47:40 +0900536 return device_register(&exynos4_dev);
Kukjin Kimcc511b82011-12-27 08:18:36 +0100537}
538
Kukjin Kimcc511b82011-12-27 08:18:36 +0100539/* uart registration process */
540
Thomas Abraham55b6ef72012-10-29 19:46:49 +0900541static void __init exynos4_init_uarts(struct s3c2410_uartcfg *cfg, int no)
Kukjin Kimcc511b82011-12-27 08:18:36 +0100542{
543 struct s3c2410_uartcfg *tcfg = cfg;
544 u32 ucnt;
545
Arnd Bergmann237c78b2012-01-07 12:30:20 +0000546 for (ucnt = 0; ucnt < no; ucnt++, tcfg++)
547 tcfg->has_fracval = 1;
Kukjin Kimcc511b82011-12-27 08:18:36 +0100548
Thomas Abraham55b6ef72012-10-29 19:46:49 +0900549 s3c24xx_init_uartdevs("exynos4210-uart", exynos4_uart_resources, cfg, no);
Kukjin Kimcc511b82011-12-27 08:18:36 +0100550}
551
Arnd Bergmannbd51de52013-04-10 14:57:15 +0200552
553#ifdef CONFIG_EXYNOS_ATAGS
Eunki Kim330c90a2012-03-14 01:43:31 -0700554static void __iomem *exynos_eint_base;
555
Kukjin Kimcc511b82011-12-27 08:18:36 +0100556static DEFINE_SPINLOCK(eint_lock);
557
558static unsigned int eint0_15_data[16];
559
Eunki Kim330c90a2012-03-14 01:43:31 -0700560static inline int exynos4_irq_to_gpio(unsigned int irq)
Kukjin Kimcc511b82011-12-27 08:18:36 +0100561{
Eunki Kim330c90a2012-03-14 01:43:31 -0700562 if (irq < IRQ_EINT(0))
563 return -EINVAL;
Kukjin Kimcc511b82011-12-27 08:18:36 +0100564
Eunki Kim330c90a2012-03-14 01:43:31 -0700565 irq -= IRQ_EINT(0);
566 if (irq < 8)
567 return EXYNOS4_GPX0(irq);
Kukjin Kimcc511b82011-12-27 08:18:36 +0100568
Eunki Kim330c90a2012-03-14 01:43:31 -0700569 irq -= 8;
570 if (irq < 8)
571 return EXYNOS4_GPX1(irq);
572
573 irq -= 8;
574 if (irq < 8)
575 return EXYNOS4_GPX2(irq);
576
577 irq -= 8;
578 if (irq < 8)
579 return EXYNOS4_GPX3(irq);
580
581 return -EINVAL;
Kukjin Kimcc511b82011-12-27 08:18:36 +0100582}
583
Eunki Kim330c90a2012-03-14 01:43:31 -0700584static inline int exynos5_irq_to_gpio(unsigned int irq)
585{
586 if (irq < IRQ_EINT(0))
587 return -EINVAL;
588
589 irq -= IRQ_EINT(0);
590 if (irq < 8)
591 return EXYNOS5_GPX0(irq);
592
593 irq -= 8;
594 if (irq < 8)
595 return EXYNOS5_GPX1(irq);
596
597 irq -= 8;
598 if (irq < 8)
599 return EXYNOS5_GPX2(irq);
600
601 irq -= 8;
602 if (irq < 8)
603 return EXYNOS5_GPX3(irq);
604
605 return -EINVAL;
606}
607
Kukjin Kimbb19a752012-01-25 13:48:11 +0900608static unsigned int exynos4_eint0_15_src_int[16] = {
609 EXYNOS4_IRQ_EINT0,
610 EXYNOS4_IRQ_EINT1,
611 EXYNOS4_IRQ_EINT2,
612 EXYNOS4_IRQ_EINT3,
613 EXYNOS4_IRQ_EINT4,
614 EXYNOS4_IRQ_EINT5,
615 EXYNOS4_IRQ_EINT6,
616 EXYNOS4_IRQ_EINT7,
617 EXYNOS4_IRQ_EINT8,
618 EXYNOS4_IRQ_EINT9,
619 EXYNOS4_IRQ_EINT10,
620 EXYNOS4_IRQ_EINT11,
621 EXYNOS4_IRQ_EINT12,
622 EXYNOS4_IRQ_EINT13,
623 EXYNOS4_IRQ_EINT14,
624 EXYNOS4_IRQ_EINT15,
625};
Kukjin Kimcc511b82011-12-27 08:18:36 +0100626
Kukjin Kimbb19a752012-01-25 13:48:11 +0900627static unsigned int exynos5_eint0_15_src_int[16] = {
628 EXYNOS5_IRQ_EINT0,
629 EXYNOS5_IRQ_EINT1,
630 EXYNOS5_IRQ_EINT2,
631 EXYNOS5_IRQ_EINT3,
632 EXYNOS5_IRQ_EINT4,
633 EXYNOS5_IRQ_EINT5,
634 EXYNOS5_IRQ_EINT6,
635 EXYNOS5_IRQ_EINT7,
636 EXYNOS5_IRQ_EINT8,
637 EXYNOS5_IRQ_EINT9,
638 EXYNOS5_IRQ_EINT10,
639 EXYNOS5_IRQ_EINT11,
640 EXYNOS5_IRQ_EINT12,
641 EXYNOS5_IRQ_EINT13,
642 EXYNOS5_IRQ_EINT14,
643 EXYNOS5_IRQ_EINT15,
644};
Eunki Kim330c90a2012-03-14 01:43:31 -0700645static inline void exynos_irq_eint_mask(struct irq_data *data)
Kukjin Kimcc511b82011-12-27 08:18:36 +0100646{
647 u32 mask;
648
649 spin_lock(&eint_lock);
Eunki Kim330c90a2012-03-14 01:43:31 -0700650 mask = __raw_readl(EINT_MASK(exynos_eint_base, data->irq));
651 mask |= EINT_OFFSET_BIT(data->irq);
652 __raw_writel(mask, EINT_MASK(exynos_eint_base, data->irq));
Kukjin Kimcc511b82011-12-27 08:18:36 +0100653 spin_unlock(&eint_lock);
654}
655
Eunki Kim330c90a2012-03-14 01:43:31 -0700656static void exynos_irq_eint_unmask(struct irq_data *data)
Kukjin Kimcc511b82011-12-27 08:18:36 +0100657{
658 u32 mask;
659
660 spin_lock(&eint_lock);
Eunki Kim330c90a2012-03-14 01:43:31 -0700661 mask = __raw_readl(EINT_MASK(exynos_eint_base, data->irq));
662 mask &= ~(EINT_OFFSET_BIT(data->irq));
663 __raw_writel(mask, EINT_MASK(exynos_eint_base, data->irq));
Kukjin Kimcc511b82011-12-27 08:18:36 +0100664 spin_unlock(&eint_lock);
665}
666
Eunki Kim330c90a2012-03-14 01:43:31 -0700667static inline void exynos_irq_eint_ack(struct irq_data *data)
Kukjin Kimcc511b82011-12-27 08:18:36 +0100668{
Eunki Kim330c90a2012-03-14 01:43:31 -0700669 __raw_writel(EINT_OFFSET_BIT(data->irq),
670 EINT_PEND(exynos_eint_base, data->irq));
Kukjin Kimcc511b82011-12-27 08:18:36 +0100671}
672
Eunki Kim330c90a2012-03-14 01:43:31 -0700673static void exynos_irq_eint_maskack(struct irq_data *data)
Kukjin Kimcc511b82011-12-27 08:18:36 +0100674{
Eunki Kim330c90a2012-03-14 01:43:31 -0700675 exynos_irq_eint_mask(data);
676 exynos_irq_eint_ack(data);
Kukjin Kimcc511b82011-12-27 08:18:36 +0100677}
678
Eunki Kim330c90a2012-03-14 01:43:31 -0700679static int exynos_irq_eint_set_type(struct irq_data *data, unsigned int type)
Kukjin Kimcc511b82011-12-27 08:18:36 +0100680{
681 int offs = EINT_OFFSET(data->irq);
682 int shift;
683 u32 ctrl, mask;
684 u32 newvalue = 0;
685
686 switch (type) {
687 case IRQ_TYPE_EDGE_RISING:
688 newvalue = S5P_IRQ_TYPE_EDGE_RISING;
689 break;
690
691 case IRQ_TYPE_EDGE_FALLING:
692 newvalue = S5P_IRQ_TYPE_EDGE_FALLING;
693 break;
694
695 case IRQ_TYPE_EDGE_BOTH:
696 newvalue = S5P_IRQ_TYPE_EDGE_BOTH;
697 break;
698
699 case IRQ_TYPE_LEVEL_LOW:
700 newvalue = S5P_IRQ_TYPE_LEVEL_LOW;
701 break;
702
703 case IRQ_TYPE_LEVEL_HIGH:
704 newvalue = S5P_IRQ_TYPE_LEVEL_HIGH;
705 break;
706
707 default:
708 printk(KERN_ERR "No such irq type %d", type);
709 return -EINVAL;
710 }
711
712 shift = (offs & 0x7) * 4;
713 mask = 0x7 << shift;
714
715 spin_lock(&eint_lock);
Eunki Kim330c90a2012-03-14 01:43:31 -0700716 ctrl = __raw_readl(EINT_CON(exynos_eint_base, data->irq));
Kukjin Kimcc511b82011-12-27 08:18:36 +0100717 ctrl &= ~mask;
718 ctrl |= newvalue << shift;
Eunki Kim330c90a2012-03-14 01:43:31 -0700719 __raw_writel(ctrl, EINT_CON(exynos_eint_base, data->irq));
Kukjin Kimcc511b82011-12-27 08:18:36 +0100720 spin_unlock(&eint_lock);
721
Eunki Kim330c90a2012-03-14 01:43:31 -0700722 if (soc_is_exynos5250())
723 s3c_gpio_cfgpin(exynos5_irq_to_gpio(data->irq), S3C_GPIO_SFN(0xf));
724 else
725 s3c_gpio_cfgpin(exynos4_irq_to_gpio(data->irq), S3C_GPIO_SFN(0xf));
Kukjin Kimcc511b82011-12-27 08:18:36 +0100726
727 return 0;
728}
729
Eunki Kim330c90a2012-03-14 01:43:31 -0700730static struct irq_chip exynos_irq_eint = {
731 .name = "exynos-eint",
732 .irq_mask = exynos_irq_eint_mask,
733 .irq_unmask = exynos_irq_eint_unmask,
734 .irq_mask_ack = exynos_irq_eint_maskack,
735 .irq_ack = exynos_irq_eint_ack,
736 .irq_set_type = exynos_irq_eint_set_type,
Kukjin Kimcc511b82011-12-27 08:18:36 +0100737#ifdef CONFIG_PM
738 .irq_set_wake = s3c_irqext_wake,
739#endif
740};
741
742/*
743 * exynos4_irq_demux_eint
744 *
745 * This function demuxes the IRQ from from EINTs 16 to 31.
746 * It is designed to be inlined into the specific handler
747 * s5p_irq_demux_eintX_Y.
748 *
749 * Each EINT pend/mask registers handle eight of them.
750 */
Eunki Kim330c90a2012-03-14 01:43:31 -0700751static inline void exynos_irq_demux_eint(unsigned int start)
Kukjin Kimcc511b82011-12-27 08:18:36 +0100752{
753 unsigned int irq;
754
Eunki Kim330c90a2012-03-14 01:43:31 -0700755 u32 status = __raw_readl(EINT_PEND(exynos_eint_base, start));
756 u32 mask = __raw_readl(EINT_MASK(exynos_eint_base, start));
Kukjin Kimcc511b82011-12-27 08:18:36 +0100757
758 status &= ~mask;
759 status &= 0xff;
760
761 while (status) {
762 irq = fls(status) - 1;
763 generic_handle_irq(irq + start);
764 status &= ~(1 << irq);
765 }
766}
767
Eunki Kim330c90a2012-03-14 01:43:31 -0700768static void exynos_irq_demux_eint16_31(unsigned int irq, struct irq_desc *desc)
Kukjin Kimcc511b82011-12-27 08:18:36 +0100769{
770 struct irq_chip *chip = irq_get_chip(irq);
771 chained_irq_enter(chip, desc);
Eunki Kim330c90a2012-03-14 01:43:31 -0700772 exynos_irq_demux_eint(IRQ_EINT(16));
773 exynos_irq_demux_eint(IRQ_EINT(24));
Kukjin Kimcc511b82011-12-27 08:18:36 +0100774 chained_irq_exit(chip, desc);
775}
776
Kukjin Kimbb19a752012-01-25 13:48:11 +0900777static void exynos_irq_eint0_15(unsigned int irq, struct irq_desc *desc)
Kukjin Kimcc511b82011-12-27 08:18:36 +0100778{
779 u32 *irq_data = irq_get_handler_data(irq);
780 struct irq_chip *chip = irq_get_chip(irq);
781
782 chained_irq_enter(chip, desc);
Kukjin Kimcc511b82011-12-27 08:18:36 +0100783 generic_handle_irq(*irq_data);
Kukjin Kimcc511b82011-12-27 08:18:36 +0100784 chained_irq_exit(chip, desc);
785}
786
Eunki Kim330c90a2012-03-14 01:43:31 -0700787static int __init exynos_init_irq_eint(void)
Kukjin Kimcc511b82011-12-27 08:18:36 +0100788{
789 int irq;
790
Thomas Abrahamfef05c22012-09-07 06:07:40 +0900791#ifdef CONFIG_PINCTRL_SAMSUNG
792 /*
793 * The Samsung pinctrl driver provides an integrated gpio/pinmux/pinconf
794 * functionality along with support for external gpio and wakeup
795 * interrupts. If the samsung pinctrl driver is enabled and includes
796 * the wakeup interrupt support, then the setting up external wakeup
797 * interrupts here can be skipped. This check here is temporary to
798 * allow exynos4 platforms that do not use Samsung pinctrl driver to
799 * co-exist with platforms that do. When all of the Samsung Exynos4
800 * platforms switch over to using the pinctrl driver, the wakeup
801 * interrupt support code here can be completely removed.
802 */
Tomasz Figaab7b51f2012-11-07 08:44:51 +0900803 static const struct of_device_id exynos_pinctrl_ids[] = {
Kukjin Kimb533c862013-01-02 16:05:42 -0800804 { .compatible = "samsung,exynos4210-pinctrl", },
805 { .compatible = "samsung,exynos4x12-pinctrl", },
Thomas Abraham97916772012-12-28 10:37:27 -0800806 { .compatible = "samsung,exynos5250-pinctrl", },
Tomasz Figaab7b51f2012-11-07 08:44:51 +0900807 };
Thomas Abrahamfef05c22012-09-07 06:07:40 +0900808 struct device_node *pctrl_np, *wkup_np;
Thomas Abrahamfef05c22012-09-07 06:07:40 +0900809 const char *wkup_compat = "samsung,exynos4210-wakeup-eint";
810
Tomasz Figaab7b51f2012-11-07 08:44:51 +0900811 for_each_matching_node(pctrl_np, exynos_pinctrl_ids) {
Thomas Abrahamfef05c22012-09-07 06:07:40 +0900812 if (of_device_is_available(pctrl_np)) {
813 wkup_np = of_find_compatible_node(pctrl_np, NULL,
814 wkup_compat);
815 if (wkup_np)
816 return -ENODEV;
817 }
818 }
819#endif
Kukjin Kim2edb36c2012-11-15 15:48:56 +0900820 if (soc_is_exynos5440())
821 return 0;
Thomas Abrahamfef05c22012-09-07 06:07:40 +0900822
Kukjin Kim94c7ca72012-02-11 22:15:45 +0900823 if (soc_is_exynos5250())
Eunki Kim330c90a2012-03-14 01:43:31 -0700824 exynos_eint_base = ioremap(EXYNOS5_PA_GPIO1, SZ_4K);
825 else
826 exynos_eint_base = ioremap(EXYNOS4_PA_GPIO2, SZ_4K);
827
828 if (exynos_eint_base == NULL) {
829 pr_err("unable to ioremap for EINT base address\n");
830 return -ENOMEM;
831 }
Kukjin Kim94c7ca72012-02-11 22:15:45 +0900832
Kukjin Kimcc511b82011-12-27 08:18:36 +0100833 for (irq = 0 ; irq <= 31 ; irq++) {
Eunki Kim330c90a2012-03-14 01:43:31 -0700834 irq_set_chip_and_handler(IRQ_EINT(irq), &exynos_irq_eint,
Kukjin Kimcc511b82011-12-27 08:18:36 +0100835 handle_level_irq);
836 set_irq_flags(IRQ_EINT(irq), IRQF_VALID);
837 }
838
Eunki Kim330c90a2012-03-14 01:43:31 -0700839 irq_set_chained_handler(EXYNOS_IRQ_EINT16_31, exynos_irq_demux_eint16_31);
Kukjin Kimcc511b82011-12-27 08:18:36 +0100840
841 for (irq = 0 ; irq <= 15 ; irq++) {
842 eint0_15_data[irq] = IRQ_EINT(irq);
843
Kukjin Kimbb19a752012-01-25 13:48:11 +0900844 if (soc_is_exynos5250()) {
845 irq_set_handler_data(exynos5_eint0_15_src_int[irq],
846 &eint0_15_data[irq]);
847 irq_set_chained_handler(exynos5_eint0_15_src_int[irq],
848 exynos_irq_eint0_15);
849 } else {
850 irq_set_handler_data(exynos4_eint0_15_src_int[irq],
851 &eint0_15_data[irq]);
852 irq_set_chained_handler(exynos4_eint0_15_src_int[irq],
853 exynos_irq_eint0_15);
854 }
Kukjin Kimcc511b82011-12-27 08:18:36 +0100855 }
856
857 return 0;
858}
Eunki Kim330c90a2012-03-14 01:43:31 -0700859arch_initcall(exynos_init_irq_eint);
Arnd Bergmannbd51de52013-04-10 14:57:15 +0200860#endif
Chanho Parkb7bbdbe2012-12-12 14:03:54 +0900861
862static struct resource exynos4_pmu_resource[] = {
863 DEFINE_RES_IRQ(EXYNOS4_IRQ_PMU),
864 DEFINE_RES_IRQ(EXYNOS4_IRQ_PMU_CPU1),
865#if defined(CONFIG_SOC_EXYNOS4412)
866 DEFINE_RES_IRQ(EXYNOS4_IRQ_PMU_CPU2),
867 DEFINE_RES_IRQ(EXYNOS4_IRQ_PMU_CPU3),
868#endif
869};
870
871static struct platform_device exynos4_device_pmu = {
872 .name = "arm-pmu",
873 .num_resources = ARRAY_SIZE(exynos4_pmu_resource),
874 .resource = exynos4_pmu_resource,
875};
876
877static int __init exynos_armpmu_init(void)
878{
879 if (!of_have_populated_dt()) {
880 if (soc_is_exynos4210() || soc_is_exynos4212())
881 exynos4_device_pmu.num_resources = 2;
882 platform_device_register(&exynos4_device_pmu);
883 }
884
885 return 0;
886}
887arch_initcall(exynos_armpmu_init);