diff options
author | Arnd Bergmann <arnd@arndb.de> | 2012-01-09 11:14:07 -0500 |
---|---|---|
committer | Arnd Bergmann <arnd@arndb.de> | 2012-01-09 11:14:07 -0500 |
commit | 142f2101a86ade2d6c9dfbedf82e1b5b31c8fce6 (patch) | |
tree | 8cced517382b7087df4e89a9e2a00ccac9676a92 /arch/arm/mach-s5p64x0 | |
parent | 155bc27fdfbdf65a07a4f8ef3eafa25e57d8b511 (diff) | |
parent | a07613a54d700a974f3a4a657da78ef5d097315d (diff) |
Merge branch 'samsung/cleanup' into samsung/driver
Conflicts:
arch/arm/mach-s5p64x0/cpu.c -> common.c
More changes to a file that got moved into common.c,
see previous conflict resolutions.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Diffstat (limited to 'arch/arm/mach-s5p64x0')
-rw-r--r-- | arch/arm/mach-s5p64x0/Makefile | 9 | ||||
-rw-r--r-- | arch/arm/mach-s5p64x0/clock-s5p6440.c | 3 | ||||
-rw-r--r-- | arch/arm/mach-s5p64x0/clock-s5p6450.c | 3 | ||||
-rw-r--r-- | arch/arm/mach-s5p64x0/clock.c | 4 | ||||
-rw-r--r-- | arch/arm/mach-s5p64x0/common.c | 446 | ||||
-rw-r--r-- | arch/arm/mach-s5p64x0/common.h | 57 | ||||
-rw-r--r-- | arch/arm/mach-s5p64x0/cpu.c | 224 | ||||
-rw-r--r-- | arch/arm/mach-s5p64x0/include/mach/entry-macro.S | 7 | ||||
-rw-r--r-- | arch/arm/mach-s5p64x0/include/mach/system.h | 2 | ||||
-rw-r--r-- | arch/arm/mach-s5p64x0/include/mach/vmalloc.h | 20 | ||||
-rw-r--r-- | arch/arm/mach-s5p64x0/init.c | 42 | ||||
-rw-r--r-- | arch/arm/mach-s5p64x0/irq-eint.c | 155 | ||||
-rw-r--r-- | arch/arm/mach-s5p64x0/mach-smdk6440.c | 8 | ||||
-rw-r--r-- | arch/arm/mach-s5p64x0/mach-smdk6450.c | 8 |
14 files changed, 531 insertions, 457 deletions
diff --git a/arch/arm/mach-s5p64x0/Makefile b/arch/arm/mach-s5p64x0/Makefile index b44cc044b3c3..12bb951187a4 100644 --- a/arch/arm/mach-s5p64x0/Makefile +++ b/arch/arm/mach-s5p64x0/Makefile | |||
@@ -10,14 +10,16 @@ obj-m := | |||
10 | obj-n := | 10 | obj-n := |
11 | obj- := | 11 | obj- := |
12 | 12 | ||
13 | # Core support for S5P64X0 system | 13 | # Core |
14 | 14 | ||
15 | obj-$(CONFIG_ARCH_S5P64X0) += cpu.o init.o clock.o dma.o | 15 | obj-y += common.o clock.o |
16 | obj-$(CONFIG_ARCH_S5P64X0) += setup-i2c0.o irq-eint.o | ||
17 | obj-$(CONFIG_CPU_S5P6440) += clock-s5p6440.o | 16 | obj-$(CONFIG_CPU_S5P6440) += clock-s5p6440.o |
18 | obj-$(CONFIG_CPU_S5P6450) += clock-s5p6450.o | 17 | obj-$(CONFIG_CPU_S5P6450) += clock-s5p6450.o |
18 | |||
19 | obj-$(CONFIG_PM) += pm.o irq-pm.o | 19 | obj-$(CONFIG_PM) += pm.o irq-pm.o |
20 | 20 | ||
21 | obj-y += dma.o | ||
22 | |||
21 | # machine support | 23 | # machine support |
22 | 24 | ||
23 | obj-$(CONFIG_MACH_SMDK6440) += mach-smdk6440.o | 25 | obj-$(CONFIG_MACH_SMDK6440) += mach-smdk6440.o |
@@ -27,6 +29,7 @@ obj-$(CONFIG_MACH_SMDK6450) += mach-smdk6450.o | |||
27 | 29 | ||
28 | obj-y += dev-audio.o | 30 | obj-y += dev-audio.o |
29 | 31 | ||
32 | obj-y += setup-i2c0.o | ||
30 | obj-$(CONFIG_S5P64X0_SETUP_I2C1) += setup-i2c1.o | 33 | obj-$(CONFIG_S5P64X0_SETUP_I2C1) += setup-i2c1.o |
31 | obj-$(CONFIG_S5P64X0_SETUP_FB_24BPP) += setup-fb-24bpp.o | 34 | obj-$(CONFIG_S5P64X0_SETUP_FB_24BPP) += setup-fb-24bpp.o |
32 | obj-$(CONFIG_S5P64X0_SETUP_SPI) += setup-spi.o | 35 | obj-$(CONFIG_S5P64X0_SETUP_SPI) += setup-spi.o |
diff --git a/arch/arm/mach-s5p64x0/clock-s5p6440.c b/arch/arm/mach-s5p64x0/clock-s5p6440.c index c041ad7fbd60..4b3023e8423a 100644 --- a/arch/arm/mach-s5p64x0/clock-s5p6440.c +++ b/arch/arm/mach-s5p64x0/clock-s5p6440.c | |||
@@ -31,7 +31,8 @@ | |||
31 | #include <plat/pll.h> | 31 | #include <plat/pll.h> |
32 | #include <plat/s5p-clock.h> | 32 | #include <plat/s5p-clock.h> |
33 | #include <plat/clock-clksrc.h> | 33 | #include <plat/clock-clksrc.h> |
34 | #include <plat/s5p6440.h> | 34 | |
35 | #include "common.h" | ||
35 | 36 | ||
36 | static u32 epll_div[][5] = { | 37 | static u32 epll_div[][5] = { |
37 | { 36000000, 0, 48, 1, 4 }, | 38 | { 36000000, 0, 48, 1, 4 }, |
diff --git a/arch/arm/mach-s5p64x0/clock-s5p6450.c b/arch/arm/mach-s5p64x0/clock-s5p6450.c index b5087cb6e818..5bf607ccbaf7 100644 --- a/arch/arm/mach-s5p64x0/clock-s5p6450.c +++ b/arch/arm/mach-s5p64x0/clock-s5p6450.c | |||
@@ -31,7 +31,8 @@ | |||
31 | #include <plat/pll.h> | 31 | #include <plat/pll.h> |
32 | #include <plat/s5p-clock.h> | 32 | #include <plat/s5p-clock.h> |
33 | #include <plat/clock-clksrc.h> | 33 | #include <plat/clock-clksrc.h> |
34 | #include <plat/s5p6450.h> | 34 | |
35 | #include "common.h" | ||
35 | 36 | ||
36 | static struct clksrc_clk clk_mout_dpll = { | 37 | static struct clksrc_clk clk_mout_dpll = { |
37 | .clk = { | 38 | .clk = { |
diff --git a/arch/arm/mach-s5p64x0/clock.c b/arch/arm/mach-s5p64x0/clock.c index b52c6e2f37a6..b289b726a7d6 100644 --- a/arch/arm/mach-s5p64x0/clock.c +++ b/arch/arm/mach-s5p64x0/clock.c | |||
@@ -30,8 +30,8 @@ | |||
30 | #include <plat/pll.h> | 30 | #include <plat/pll.h> |
31 | #include <plat/s5p-clock.h> | 31 | #include <plat/s5p-clock.h> |
32 | #include <plat/clock-clksrc.h> | 32 | #include <plat/clock-clksrc.h> |
33 | #include <plat/s5p6440.h> | 33 | |
34 | #include <plat/s5p6450.h> | 34 | #include "common.h" |
35 | 35 | ||
36 | struct clksrc_clk clk_mout_apll = { | 36 | struct clksrc_clk clk_mout_apll = { |
37 | .clk = { | 37 | .clk = { |
diff --git a/arch/arm/mach-s5p64x0/common.c b/arch/arm/mach-s5p64x0/common.c new file mode 100644 index 000000000000..146fae18ef4d --- /dev/null +++ b/arch/arm/mach-s5p64x0/common.c | |||
@@ -0,0 +1,446 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2009-2011 Samsung Electronics Co., Ltd. | ||
3 | * http://www.samsung.com | ||
4 | * | ||
5 | * Common Codes for S5P64X0 machines | ||
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/types.h> | ||
14 | #include <linux/interrupt.h> | ||
15 | #include <linux/list.h> | ||
16 | #include <linux/timer.h> | ||
17 | #include <linux/init.h> | ||
18 | #include <linux/clk.h> | ||
19 | #include <linux/io.h> | ||
20 | #include <linux/sysdev.h> | ||
21 | #include <linux/serial_core.h> | ||
22 | #include <linux/platform_device.h> | ||
23 | #include <linux/sched.h> | ||
24 | #include <linux/dma-mapping.h> | ||
25 | #include <linux/gpio.h> | ||
26 | #include <linux/irq.h> | ||
27 | |||
28 | #include <asm/irq.h> | ||
29 | #include <asm/proc-fns.h> | ||
30 | #include <asm/mach/arch.h> | ||
31 | #include <asm/mach/map.h> | ||
32 | #include <asm/mach/irq.h> | ||
33 | |||
34 | #include <mach/map.h> | ||
35 | #include <mach/hardware.h> | ||
36 | #include <mach/regs-clock.h> | ||
37 | #include <mach/regs-gpio.h> | ||
38 | |||
39 | #include <plat/cpu.h> | ||
40 | #include <plat/clock.h> | ||
41 | #include <plat/devs.h> | ||
42 | #include <plat/pm.h> | ||
43 | #include <plat/sdhci.h> | ||
44 | #include <plat/adc-core.h> | ||
45 | #include <plat/fb-core.h> | ||
46 | #include <plat/gpio-cfg.h> | ||
47 | #include <plat/regs-irqtype.h> | ||
48 | #include <plat/regs-serial.h> | ||
49 | #include <plat/watchdog-reset.h> | ||
50 | |||
51 | #include "common.h" | ||
52 | |||
53 | static const char name_s5p6440[] = "S5P6440"; | ||
54 | static const char name_s5p6450[] = "S5P6450"; | ||
55 | |||
56 | static struct cpu_table cpu_ids[] __initdata = { | ||
57 | { | ||
58 | .idcode = S5P6440_CPU_ID, | ||
59 | .idmask = S5P64XX_CPU_MASK, | ||
60 | .map_io = s5p6440_map_io, | ||
61 | .init_clocks = s5p6440_init_clocks, | ||
62 | .init_uarts = s5p6440_init_uarts, | ||
63 | .init = s5p64x0_init, | ||
64 | .name = name_s5p6440, | ||
65 | }, { | ||
66 | .idcode = S5P6450_CPU_ID, | ||
67 | .idmask = S5P64XX_CPU_MASK, | ||
68 | .map_io = s5p6450_map_io, | ||
69 | .init_clocks = s5p6450_init_clocks, | ||
70 | .init_uarts = s5p6450_init_uarts, | ||
71 | .init = s5p64x0_init, | ||
72 | .name = name_s5p6450, | ||
73 | }, | ||
74 | }; | ||
75 | |||
76 | /* Initial IO mappings */ | ||
77 | |||
78 | static struct map_desc s5p64x0_iodesc[] __initdata = { | ||
79 | { | ||
80 | .virtual = (unsigned long)S5P_VA_CHIPID, | ||
81 | .pfn = __phys_to_pfn(S5P64X0_PA_CHIPID), | ||
82 | .length = SZ_4K, | ||
83 | .type = MT_DEVICE, | ||
84 | }, { | ||
85 | .virtual = (unsigned long)S3C_VA_SYS, | ||
86 | .pfn = __phys_to_pfn(S5P64X0_PA_SYSCON), | ||
87 | .length = SZ_64K, | ||
88 | .type = MT_DEVICE, | ||
89 | }, { | ||
90 | .virtual = (unsigned long)S3C_VA_TIMER, | ||
91 | .pfn = __phys_to_pfn(S5P64X0_PA_TIMER), | ||
92 | .length = SZ_16K, | ||
93 | .type = MT_DEVICE, | ||
94 | }, { | ||
95 | .virtual = (unsigned long)S3C_VA_WATCHDOG, | ||
96 | .pfn = __phys_to_pfn(S5P64X0_PA_WDT), | ||
97 | .length = SZ_4K, | ||
98 | .type = MT_DEVICE, | ||
99 | }, { | ||
100 | .virtual = (unsigned long)S5P_VA_SROMC, | ||
101 | .pfn = __phys_to_pfn(S5P64X0_PA_SROMC), | ||
102 | .length = SZ_4K, | ||
103 | .type = MT_DEVICE, | ||
104 | }, { | ||
105 | .virtual = (unsigned long)S5P_VA_GPIO, | ||
106 | .pfn = __phys_to_pfn(S5P64X0_PA_GPIO), | ||
107 | .length = SZ_4K, | ||
108 | .type = MT_DEVICE, | ||
109 | }, { | ||
110 | .virtual = (unsigned long)VA_VIC0, | ||
111 | .pfn = __phys_to_pfn(S5P64X0_PA_VIC0), | ||
112 | .length = SZ_16K, | ||
113 | .type = MT_DEVICE, | ||
114 | }, { | ||
115 | .virtual = (unsigned long)VA_VIC1, | ||
116 | .pfn = __phys_to_pfn(S5P64X0_PA_VIC1), | ||
117 | .length = SZ_16K, | ||
118 | .type = MT_DEVICE, | ||
119 | }, | ||
120 | }; | ||
121 | |||
122 | static struct map_desc s5p6440_iodesc[] __initdata = { | ||
123 | { | ||
124 | .virtual = (unsigned long)S3C_VA_UART, | ||
125 | .pfn = __phys_to_pfn(S5P6440_PA_UART(0)), | ||
126 | .length = SZ_4K, | ||
127 | .type = MT_DEVICE, | ||
128 | }, | ||
129 | }; | ||
130 | |||
131 | static struct map_desc s5p6450_iodesc[] __initdata = { | ||
132 | { | ||
133 | .virtual = (unsigned long)S3C_VA_UART, | ||
134 | .pfn = __phys_to_pfn(S5P6450_PA_UART(0)), | ||
135 | .length = SZ_512K, | ||
136 | .type = MT_DEVICE, | ||
137 | }, { | ||
138 | .virtual = (unsigned long)S3C_VA_UART + SZ_512K, | ||
139 | .pfn = __phys_to_pfn(S5P6450_PA_UART(5)), | ||
140 | .length = SZ_4K, | ||
141 | .type = MT_DEVICE, | ||
142 | }, | ||
143 | }; | ||
144 | |||
145 | static void s5p64x0_idle(void) | ||
146 | { | ||
147 | unsigned long val; | ||
148 | |||
149 | if (!need_resched()) { | ||
150 | val = __raw_readl(S5P64X0_PWR_CFG); | ||
151 | val &= ~(0x3 << 5); | ||
152 | val |= (0x1 << 5); | ||
153 | __raw_writel(val, S5P64X0_PWR_CFG); | ||
154 | |||
155 | cpu_do_idle(); | ||
156 | } | ||
157 | local_irq_enable(); | ||
158 | } | ||
159 | |||
160 | /* | ||
161 | * s5p64x0_map_io | ||
162 | * | ||
163 | * register the standard CPU IO areas | ||
164 | */ | ||
165 | |||
166 | void __init s5p64x0_init_io(struct map_desc *mach_desc, int size) | ||
167 | { | ||
168 | /* initialize the io descriptors we need for initialization */ | ||
169 | iotable_init(s5p64x0_iodesc, ARRAY_SIZE(s5p64x0_iodesc)); | ||
170 | if (mach_desc) | ||
171 | iotable_init(mach_desc, size); | ||
172 | |||
173 | /* detect cpu id and rev. */ | ||
174 | s5p_init_cpu(S5P64X0_SYS_ID); | ||
175 | |||
176 | s3c_init_cpu(samsung_cpu_id, cpu_ids, ARRAY_SIZE(cpu_ids)); | ||
177 | } | ||
178 | |||
179 | void __init s5p6440_map_io(void) | ||
180 | { | ||
181 | /* initialize any device information early */ | ||
182 | s3c_adc_setname("s3c64xx-adc"); | ||
183 | s3c_fb_setname("s5p64x0-fb"); | ||
184 | |||
185 | s5p64x0_default_sdhci0(); | ||
186 | s5p64x0_default_sdhci1(); | ||
187 | s5p6440_default_sdhci2(); | ||
188 | |||
189 | iotable_init(s5p6440_iodesc, ARRAY_SIZE(s5p6440_iodesc)); | ||
190 | init_consistent_dma_size(SZ_8M); | ||
191 | } | ||
192 | |||
193 | void __init s5p6450_map_io(void) | ||
194 | { | ||
195 | /* initialize any device information early */ | ||
196 | s3c_adc_setname("s3c64xx-adc"); | ||
197 | s3c_fb_setname("s5p64x0-fb"); | ||
198 | |||
199 | s5p64x0_default_sdhci0(); | ||
200 | s5p64x0_default_sdhci1(); | ||
201 | s5p6450_default_sdhci2(); | ||
202 | |||
203 | iotable_init(s5p6450_iodesc, ARRAY_SIZE(s5p6450_iodesc)); | ||
204 | init_consistent_dma_size(SZ_8M); | ||
205 | } | ||
206 | |||
207 | /* | ||
208 | * s5p64x0_init_clocks | ||
209 | * | ||
210 | * register and setup the CPU clocks | ||
211 | */ | ||
212 | |||
213 | void __init s5p6440_init_clocks(int xtal) | ||
214 | { | ||
215 | printk(KERN_DEBUG "%s: initializing clocks\n", __func__); | ||
216 | |||
217 | s3c24xx_register_baseclocks(xtal); | ||
218 | s5p_register_clocks(xtal); | ||
219 | s5p6440_register_clocks(); | ||
220 | s5p6440_setup_clocks(); | ||
221 | } | ||
222 | |||
223 | void __init s5p6450_init_clocks(int xtal) | ||
224 | { | ||
225 | printk(KERN_DEBUG "%s: initializing clocks\n", __func__); | ||
226 | |||
227 | s3c24xx_register_baseclocks(xtal); | ||
228 | s5p_register_clocks(xtal); | ||
229 | s5p6450_register_clocks(); | ||
230 | s5p6450_setup_clocks(); | ||
231 | } | ||
232 | |||
233 | /* | ||
234 | * s5p64x0_init_irq | ||
235 | * | ||
236 | * register the CPU interrupts | ||
237 | */ | ||
238 | |||
239 | void __init s5p6440_init_irq(void) | ||
240 | { | ||
241 | /* S5P6440 supports 2 VIC */ | ||
242 | u32 vic[2]; | ||
243 | |||
244 | /* | ||
245 | * VIC0 is missing IRQ_VIC0[3, 4, 8, 10, (12-22)] | ||
246 | * VIC1 is missing IRQ VIC1[1, 3, 4, 10, 11, 12, 14, 15, 22] | ||
247 | */ | ||
248 | vic[0] = 0xff800ae7; | ||
249 | vic[1] = 0xffbf23e5; | ||
250 | |||
251 | s5p_init_irq(vic, ARRAY_SIZE(vic)); | ||
252 | } | ||
253 | |||
254 | void __init s5p6450_init_irq(void) | ||
255 | { | ||
256 | /* S5P6450 supports only 2 VIC */ | ||
257 | u32 vic[2]; | ||
258 | |||
259 | /* | ||
260 | * VIC0 is missing IRQ_VIC0[(13-15), (21-22)] | ||
261 | * VIC1 is missing IRQ VIC1[12, 14, 23] | ||
262 | */ | ||
263 | vic[0] = 0xff9f1fff; | ||
264 | vic[1] = 0xff7fafff; | ||
265 | |||
266 | s5p_init_irq(vic, ARRAY_SIZE(vic)); | ||
267 | } | ||
268 | |||
269 | struct sysdev_class s5p64x0_sysclass = { | ||
270 | .name = "s5p64x0-core", | ||
271 | }; | ||
272 | |||
273 | static struct sys_device s5p64x0_sysdev = { | ||
274 | .cls = &s5p64x0_sysclass, | ||
275 | }; | ||
276 | |||
277 | static int __init s5p64x0_core_init(void) | ||
278 | { | ||
279 | return sysdev_class_register(&s5p64x0_sysclass); | ||
280 | } | ||
281 | core_initcall(s5p64x0_core_init); | ||
282 | |||
283 | int __init s5p64x0_init(void) | ||
284 | { | ||
285 | printk(KERN_INFO "S5P64X0(S5P6440/S5P6450): Initializing architecture\n"); | ||
286 | |||
287 | /* set idle function */ | ||
288 | pm_idle = s5p64x0_idle; | ||
289 | |||
290 | return sysdev_register(&s5p64x0_sysdev); | ||
291 | } | ||
292 | |||
293 | /* uart registration process */ | ||
294 | void __init s5p6440_init_uarts(struct s3c2410_uartcfg *cfg, int no) | ||
295 | { | ||
296 | int uart; | ||
297 | |||
298 | for (uart = 0; uart < no; uart++) { | ||
299 | s5p_uart_resources[uart].resources->start = S5P6440_PA_UART(uart); | ||
300 | s5p_uart_resources[uart].resources->end = S5P6440_PA_UART(uart) + S5P_SZ_UART; | ||
301 | } | ||
302 | |||
303 | s3c24xx_init_uartdevs("s3c6400-uart", s5p_uart_resources, cfg, no); | ||
304 | } | ||
305 | |||
306 | void __init s5p6450_init_uarts(struct s3c2410_uartcfg *cfg, int no) | ||
307 | { | ||
308 | s3c24xx_init_uartdevs("s3c6400-uart", s5p_uart_resources, cfg, no); | ||
309 | } | ||
310 | |||
311 | #define eint_offset(irq) ((irq) - IRQ_EINT(0)) | ||
312 | |||
313 | static int s5p64x0_irq_eint_set_type(struct irq_data *data, unsigned int type) | ||
314 | { | ||
315 | int offs = eint_offset(data->irq); | ||
316 | int shift; | ||
317 | u32 ctrl, mask; | ||
318 | u32 newvalue = 0; | ||
319 | |||
320 | if (offs > 15) | ||
321 | return -EINVAL; | ||
322 | |||
323 | switch (type) { | ||
324 | case IRQ_TYPE_NONE: | ||
325 | printk(KERN_WARNING "No edge setting!\n"); | ||
326 | break; | ||
327 | case IRQ_TYPE_EDGE_RISING: | ||
328 | newvalue = S3C2410_EXTINT_RISEEDGE; | ||
329 | break; | ||
330 | case IRQ_TYPE_EDGE_FALLING: | ||
331 | newvalue = S3C2410_EXTINT_FALLEDGE; | ||
332 | break; | ||
333 | case IRQ_TYPE_EDGE_BOTH: | ||
334 | newvalue = S3C2410_EXTINT_BOTHEDGE; | ||
335 | break; | ||
336 | case IRQ_TYPE_LEVEL_LOW: | ||
337 | newvalue = S3C2410_EXTINT_LOWLEV; | ||
338 | break; | ||
339 | case IRQ_TYPE_LEVEL_HIGH: | ||
340 | newvalue = S3C2410_EXTINT_HILEV; | ||
341 | break; | ||
342 | default: | ||
343 | printk(KERN_ERR "No such irq type %d", type); | ||
344 | return -EINVAL; | ||
345 | } | ||
346 | |||
347 | shift = (offs / 2) * 4; | ||
348 | mask = 0x7 << shift; | ||
349 | |||
350 | ctrl = __raw_readl(S5P64X0_EINT0CON0) & ~mask; | ||
351 | ctrl |= newvalue << shift; | ||
352 | __raw_writel(ctrl, S5P64X0_EINT0CON0); | ||
353 | |||
354 | /* Configure the GPIO pin for 6450 or 6440 based on CPU ID */ | ||
355 | if (soc_is_s5p6450()) | ||
356 | s3c_gpio_cfgpin(S5P6450_GPN(offs), S3C_GPIO_SFN(2)); | ||
357 | else | ||
358 | s3c_gpio_cfgpin(S5P6440_GPN(offs), S3C_GPIO_SFN(2)); | ||
359 | |||
360 | return 0; | ||
361 | } | ||
362 | |||
363 | /* | ||
364 | * s5p64x0_irq_demux_eint | ||
365 | * | ||
366 | * This function demuxes the IRQ from the group0 external interrupts, | ||
367 | * from IRQ_EINT(0) to IRQ_EINT(15). It is designed to be inlined into | ||
368 | * the specific handlers s5p64x0_irq_demux_eintX_Y. | ||
369 | */ | ||
370 | static inline void s5p64x0_irq_demux_eint(unsigned int start, unsigned int end) | ||
371 | { | ||
372 | u32 status = __raw_readl(S5P64X0_EINT0PEND); | ||
373 | u32 mask = __raw_readl(S5P64X0_EINT0MASK); | ||
374 | unsigned int irq; | ||
375 | |||
376 | status &= ~mask; | ||
377 | status >>= start; | ||
378 | status &= (1 << (end - start + 1)) - 1; | ||
379 | |||
380 | for (irq = IRQ_EINT(start); irq <= IRQ_EINT(end); irq++) { | ||
381 | if (status & 1) | ||
382 | generic_handle_irq(irq); | ||
383 | status >>= 1; | ||
384 | } | ||
385 | } | ||
386 | |||
387 | static void s5p64x0_irq_demux_eint0_3(unsigned int irq, struct irq_desc *desc) | ||
388 | { | ||
389 | s5p64x0_irq_demux_eint(0, 3); | ||
390 | } | ||
391 | |||
392 | static void s5p64x0_irq_demux_eint4_11(unsigned int irq, struct irq_desc *desc) | ||
393 | { | ||
394 | s5p64x0_irq_demux_eint(4, 11); | ||
395 | } | ||
396 | |||
397 | static void s5p64x0_irq_demux_eint12_15(unsigned int irq, | ||
398 | struct irq_desc *desc) | ||
399 | { | ||
400 | s5p64x0_irq_demux_eint(12, 15); | ||
401 | } | ||
402 | |||
403 | static int s5p64x0_alloc_gc(void) | ||
404 | { | ||
405 | struct irq_chip_generic *gc; | ||
406 | struct irq_chip_type *ct; | ||
407 | |||
408 | gc = irq_alloc_generic_chip("s5p64x0-eint", 1, S5P_IRQ_EINT_BASE, | ||
409 | S5P_VA_GPIO, handle_level_irq); | ||
410 | if (!gc) { | ||
411 | printk(KERN_ERR "%s: irq_alloc_generic_chip for group 0" | ||
412 | "external interrupts failed\n", __func__); | ||
413 | return -EINVAL; | ||
414 | } | ||
415 | |||
416 | ct = gc->chip_types; | ||
417 | ct->chip.irq_ack = irq_gc_ack_set_bit; | ||
418 | ct->chip.irq_mask = irq_gc_mask_set_bit; | ||
419 | ct->chip.irq_unmask = irq_gc_mask_clr_bit; | ||
420 | ct->chip.irq_set_type = s5p64x0_irq_eint_set_type; | ||
421 | ct->chip.irq_set_wake = s3c_irqext_wake; | ||
422 | ct->regs.ack = EINT0PEND_OFFSET; | ||
423 | ct->regs.mask = EINT0MASK_OFFSET; | ||
424 | irq_setup_generic_chip(gc, IRQ_MSK(16), IRQ_GC_INIT_MASK_CACHE, | ||
425 | IRQ_NOREQUEST | IRQ_NOPROBE, 0); | ||
426 | return 0; | ||
427 | } | ||
428 | |||
429 | static int __init s5p64x0_init_irq_eint(void) | ||
430 | { | ||
431 | int ret = s5p64x0_alloc_gc(); | ||
432 | irq_set_chained_handler(IRQ_EINT0_3, s5p64x0_irq_demux_eint0_3); | ||
433 | irq_set_chained_handler(IRQ_EINT4_11, s5p64x0_irq_demux_eint4_11); | ||
434 | irq_set_chained_handler(IRQ_EINT12_15, s5p64x0_irq_demux_eint12_15); | ||
435 | |||
436 | return ret; | ||
437 | } | ||
438 | arch_initcall(s5p64x0_init_irq_eint); | ||
439 | |||
440 | void s5p64x0_restart(char mode, const char *cmd) | ||
441 | { | ||
442 | if (mode != 's') | ||
443 | arch_wdt_reset(); | ||
444 | |||
445 | soft_restart(0); | ||
446 | } | ||
diff --git a/arch/arm/mach-s5p64x0/common.h b/arch/arm/mach-s5p64x0/common.h new file mode 100644 index 000000000000..f8a60fdc5884 --- /dev/null +++ b/arch/arm/mach-s5p64x0/common.h | |||
@@ -0,0 +1,57 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2011 Samsung Electronics Co., Ltd. | ||
3 | * http://www.samsung.com | ||
4 | * | ||
5 | * Common Header for S5P64X0 machines | ||
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 | #ifndef __ARCH_ARM_MACH_S5P64X0_COMMON_H | ||
13 | #define __ARCH_ARM_MACH_S5P64X0_COMMON_H | ||
14 | |||
15 | void s5p6440_init_irq(void); | ||
16 | void s5p6450_init_irq(void); | ||
17 | void s5p64x0_init_io(struct map_desc *mach_desc, int size); | ||
18 | |||
19 | void s5p6440_register_clocks(void); | ||
20 | void s5p6440_setup_clocks(void); | ||
21 | |||
22 | void s5p6450_register_clocks(void); | ||
23 | void s5p6450_setup_clocks(void); | ||
24 | |||
25 | void s5p64x0_restart(char mode, const char *cmd); | ||
26 | |||
27 | #ifdef CONFIG_CPU_S5P6440 | ||
28 | |||
29 | extern int s5p64x0_init(void); | ||
30 | extern void s5p6440_map_io(void); | ||
31 | extern void s5p6440_init_clocks(int xtal); | ||
32 | |||
33 | extern void s5p6440_init_uarts(struct s3c2410_uartcfg *cfg, int no); | ||
34 | |||
35 | #else | ||
36 | #define s5p6440_init_clocks NULL | ||
37 | #define s5p6440_init_uarts NULL | ||
38 | #define s5p6440_map_io NULL | ||
39 | #define s5p64x0_init NULL | ||
40 | #endif | ||
41 | |||
42 | #ifdef CONFIG_CPU_S5P6450 | ||
43 | |||
44 | extern int s5p64x0_init(void); | ||
45 | extern void s5p6450_map_io(void); | ||
46 | extern void s5p6450_init_clocks(int xtal); | ||
47 | |||
48 | extern void s5p6450_init_uarts(struct s3c2410_uartcfg *cfg, int no); | ||
49 | |||
50 | #else | ||
51 | #define s5p6450_init_clocks NULL | ||
52 | #define s5p6450_init_uarts NULL | ||
53 | #define s5p6450_map_io NULL | ||
54 | #define s5p64x0_init NULL | ||
55 | #endif | ||
56 | |||
57 | #endif /* __ARCH_ARM_MACH_S5P64X0_COMMON_H */ | ||
diff --git a/arch/arm/mach-s5p64x0/cpu.c b/arch/arm/mach-s5p64x0/cpu.c deleted file mode 100644 index f6e24f3ef760..000000000000 --- a/arch/arm/mach-s5p64x0/cpu.c +++ /dev/null | |||
@@ -1,224 +0,0 @@ | |||
1 | /* linux/arch/arm/mach-s5p64x0/cpu.c | ||
2 | * | ||
3 | * Copyright (c) 2009-2010 Samsung Electronics Co., Ltd. | ||
4 | * http://www.samsung.com | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License version 2 as | ||
8 | * published by the Free Software Foundation. | ||
9 | */ | ||
10 | |||
11 | #include <linux/kernel.h> | ||
12 | #include <linux/types.h> | ||
13 | #include <linux/interrupt.h> | ||
14 | #include <linux/list.h> | ||
15 | #include <linux/timer.h> | ||
16 | #include <linux/init.h> | ||
17 | #include <linux/clk.h> | ||
18 | #include <linux/io.h> | ||
19 | #include <linux/sysdev.h> | ||
20 | #include <linux/serial_core.h> | ||
21 | #include <linux/platform_device.h> | ||
22 | #include <linux/sched.h> | ||
23 | #include <linux/dma-mapping.h> | ||
24 | |||
25 | #include <asm/mach/arch.h> | ||
26 | #include <asm/mach/map.h> | ||
27 | #include <asm/mach/irq.h> | ||
28 | #include <asm/proc-fns.h> | ||
29 | #include <asm/irq.h> | ||
30 | |||
31 | #include <mach/hardware.h> | ||
32 | #include <mach/map.h> | ||
33 | #include <mach/regs-clock.h> | ||
34 | |||
35 | #include <plat/regs-serial.h> | ||
36 | #include <plat/cpu.h> | ||
37 | #include <plat/devs.h> | ||
38 | #include <plat/clock.h> | ||
39 | #include <plat/s5p6440.h> | ||
40 | #include <plat/s5p6450.h> | ||
41 | #include <plat/adc-core.h> | ||
42 | #include <plat/fb-core.h> | ||
43 | #include <plat/sdhci.h> | ||
44 | |||
45 | /* Initial IO mappings */ | ||
46 | |||
47 | static struct map_desc s5p64x0_iodesc[] __initdata = { | ||
48 | { | ||
49 | .virtual = (unsigned long)S5P_VA_GPIO, | ||
50 | .pfn = __phys_to_pfn(S5P64X0_PA_GPIO), | ||
51 | .length = SZ_4K, | ||
52 | .type = MT_DEVICE, | ||
53 | }, { | ||
54 | .virtual = (unsigned long)VA_VIC0, | ||
55 | .pfn = __phys_to_pfn(S5P64X0_PA_VIC0), | ||
56 | .length = SZ_16K, | ||
57 | .type = MT_DEVICE, | ||
58 | }, { | ||
59 | .virtual = (unsigned long)VA_VIC1, | ||
60 | .pfn = __phys_to_pfn(S5P64X0_PA_VIC1), | ||
61 | .length = SZ_16K, | ||
62 | .type = MT_DEVICE, | ||
63 | }, | ||
64 | }; | ||
65 | |||
66 | static struct map_desc s5p6440_iodesc[] __initdata = { | ||
67 | { | ||
68 | .virtual = (unsigned long)S3C_VA_UART, | ||
69 | .pfn = __phys_to_pfn(S5P6440_PA_UART(0)), | ||
70 | .length = SZ_4K, | ||
71 | .type = MT_DEVICE, | ||
72 | }, | ||
73 | }; | ||
74 | |||
75 | static struct map_desc s5p6450_iodesc[] __initdata = { | ||
76 | { | ||
77 | .virtual = (unsigned long)S3C_VA_UART, | ||
78 | .pfn = __phys_to_pfn(S5P6450_PA_UART(0)), | ||
79 | .length = SZ_512K, | ||
80 | .type = MT_DEVICE, | ||
81 | }, { | ||
82 | .virtual = (unsigned long)S3C_VA_UART + SZ_512K, | ||
83 | .pfn = __phys_to_pfn(S5P6450_PA_UART(5)), | ||
84 | .length = SZ_4K, | ||
85 | .type = MT_DEVICE, | ||
86 | }, | ||
87 | }; | ||
88 | |||
89 | static void s5p64x0_idle(void) | ||
90 | { | ||
91 | unsigned long val; | ||
92 | |||
93 | if (!need_resched()) { | ||
94 | val = __raw_readl(S5P64X0_PWR_CFG); | ||
95 | val &= ~(0x3 << 5); | ||
96 | val |= (0x1 << 5); | ||
97 | __raw_writel(val, S5P64X0_PWR_CFG); | ||
98 | |||
99 | cpu_do_idle(); | ||
100 | } | ||
101 | local_irq_enable(); | ||
102 | } | ||
103 | |||
104 | /* | ||
105 | * s5p64x0_map_io | ||
106 | * | ||
107 | * register the standard CPU IO areas | ||
108 | */ | ||
109 | |||
110 | void __init s5p6440_map_io(void) | ||
111 | { | ||
112 | /* initialize any device information early */ | ||
113 | s3c_adc_setname("s3c64xx-adc"); | ||
114 | s3c_fb_setname("s5p64x0-fb"); | ||
115 | |||
116 | s5p64x0_default_sdhci0(); | ||
117 | s5p64x0_default_sdhci1(); | ||
118 | s5p6440_default_sdhci2(); | ||
119 | |||
120 | iotable_init(s5p64x0_iodesc, ARRAY_SIZE(s5p64x0_iodesc)); | ||
121 | iotable_init(s5p6440_iodesc, ARRAY_SIZE(s5p6440_iodesc)); | ||
122 | init_consistent_dma_size(SZ_8M); | ||
123 | } | ||
124 | |||
125 | void __init s5p6450_map_io(void) | ||
126 | { | ||
127 | /* initialize any device information early */ | ||
128 | s3c_adc_setname("s3c64xx-adc"); | ||
129 | s3c_fb_setname("s5p64x0-fb"); | ||
130 | |||
131 | s5p64x0_default_sdhci0(); | ||
132 | s5p64x0_default_sdhci1(); | ||
133 | s5p6450_default_sdhci2(); | ||
134 | |||
135 | iotable_init(s5p64x0_iodesc, ARRAY_SIZE(s5p64x0_iodesc)); | ||
136 | iotable_init(s5p6450_iodesc, ARRAY_SIZE(s5p6450_iodesc)); | ||
137 | init_consistent_dma_size(SZ_8M); | ||
138 | } | ||
139 | |||
140 | /* | ||
141 | * s5p64x0_init_clocks | ||
142 | * | ||
143 | * register and setup the CPU clocks | ||
144 | */ | ||
145 | |||
146 | void __init s5p6440_init_clocks(int xtal) | ||
147 | { | ||
148 | printk(KERN_DEBUG "%s: initializing clocks\n", __func__); | ||
149 | |||
150 | s3c24xx_register_baseclocks(xtal); | ||
151 | s5p_register_clocks(xtal); | ||
152 | s5p6440_register_clocks(); | ||
153 | s5p6440_setup_clocks(); | ||
154 | } | ||
155 | |||
156 | void __init s5p6450_init_clocks(int xtal) | ||
157 | { | ||
158 | printk(KERN_DEBUG "%s: initializing clocks\n", __func__); | ||
159 | |||
160 | s3c24xx_register_baseclocks(xtal); | ||
161 | s5p_register_clocks(xtal); | ||
162 | s5p6450_register_clocks(); | ||
163 | s5p6450_setup_clocks(); | ||
164 | } | ||
165 | |||
166 | /* | ||
167 | * s5p64x0_init_irq | ||
168 | * | ||
169 | * register the CPU interrupts | ||
170 | */ | ||
171 | |||
172 | void __init s5p6440_init_irq(void) | ||
173 | { | ||
174 | /* S5P6440 supports 2 VIC */ | ||
175 | u32 vic[2]; | ||
176 | |||
177 | /* | ||
178 | * VIC0 is missing IRQ_VIC0[3, 4, 8, 10, (12-22)] | ||
179 | * VIC1 is missing IRQ VIC1[1, 3, 4, 10, 11, 12, 14, 15, 22] | ||
180 | */ | ||
181 | vic[0] = 0xff800ae7; | ||
182 | vic[1] = 0xffbf23e5; | ||
183 | |||
184 | s5p_init_irq(vic, ARRAY_SIZE(vic)); | ||
185 | } | ||
186 | |||
187 | void __init s5p6450_init_irq(void) | ||
188 | { | ||
189 | /* S5P6450 supports only 2 VIC */ | ||
190 | u32 vic[2]; | ||
191 | |||
192 | /* | ||
193 | * VIC0 is missing IRQ_VIC0[(13-15), (21-22)] | ||
194 | * VIC1 is missing IRQ VIC1[12, 14, 23] | ||
195 | */ | ||
196 | vic[0] = 0xff9f1fff; | ||
197 | vic[1] = 0xff7fafff; | ||
198 | |||
199 | s5p_init_irq(vic, ARRAY_SIZE(vic)); | ||
200 | } | ||
201 | |||
202 | struct sysdev_class s5p64x0_sysclass = { | ||
203 | .name = "s5p64x0-core", | ||
204 | }; | ||
205 | |||
206 | static struct sys_device s5p64x0_sysdev = { | ||
207 | .cls = &s5p64x0_sysclass, | ||
208 | }; | ||
209 | |||
210 | static int __init s5p64x0_core_init(void) | ||
211 | { | ||
212 | return sysdev_class_register(&s5p64x0_sysclass); | ||
213 | } | ||
214 | core_initcall(s5p64x0_core_init); | ||
215 | |||
216 | int __init s5p64x0_init(void) | ||
217 | { | ||
218 | printk(KERN_INFO "S5P64X0(S5P6440/S5P6450): Initializing architecture\n"); | ||
219 | |||
220 | /* set idle function */ | ||
221 | pm_idle = s5p64x0_idle; | ||
222 | |||
223 | return sysdev_register(&s5p64x0_sysdev); | ||
224 | } | ||
diff --git a/arch/arm/mach-s5p64x0/include/mach/entry-macro.S b/arch/arm/mach-s5p64x0/include/mach/entry-macro.S index 10b62b4f8211..fbb246d0a3df 100644 --- a/arch/arm/mach-s5p64x0/include/mach/entry-macro.S +++ b/arch/arm/mach-s5p64x0/include/mach/entry-macro.S | |||
@@ -10,7 +10,8 @@ | |||
10 | * published by the Free Software Foundation. | 10 | * published by the Free Software Foundation. |
11 | */ | 11 | */ |
12 | 12 | ||
13 | #include <mach/map.h> | 13 | .macro disable_fiq |
14 | #include <plat/irqs.h> | 14 | .endm |
15 | 15 | ||
16 | #include <asm/entry-macro-vic2.S> | 16 | .macro arch_ret_to_user, tmp1, tmp2 |
17 | .endm | ||
diff --git a/arch/arm/mach-s5p64x0/include/mach/system.h b/arch/arm/mach-s5p64x0/include/mach/system.h index 60f57532c970..cf26e0954a2f 100644 --- a/arch/arm/mach-s5p64x0/include/mach/system.h +++ b/arch/arm/mach-s5p64x0/include/mach/system.h | |||
@@ -13,8 +13,6 @@ | |||
13 | #ifndef __ASM_ARCH_SYSTEM_H | 13 | #ifndef __ASM_ARCH_SYSTEM_H |
14 | #define __ASM_ARCH_SYSTEM_H __FILE__ | 14 | #define __ASM_ARCH_SYSTEM_H __FILE__ |
15 | 15 | ||
16 | #include <plat/system-reset.h> | ||
17 | |||
18 | static void arch_idle(void) | 16 | static void arch_idle(void) |
19 | { | 17 | { |
20 | /* nothing here yet */ | 18 | /* nothing here yet */ |
diff --git a/arch/arm/mach-s5p64x0/include/mach/vmalloc.h b/arch/arm/mach-s5p64x0/include/mach/vmalloc.h deleted file mode 100644 index 38dcc71a03cc..000000000000 --- a/arch/arm/mach-s5p64x0/include/mach/vmalloc.h +++ /dev/null | |||
@@ -1,20 +0,0 @@ | |||
1 | /* linux/arch/arm/mach-s5p64x0/include/mach/vmalloc.h | ||
2 | * | ||
3 | * Copyright (c) 2010 Samsung Electronics Co., Ltd. | ||
4 | * http://www.samsung.com | ||
5 | * | ||
6 | * Copyright 2010 Ben Dooks <ben-linux@fluff.org> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | * | ||
12 | * S3C6400 vmalloc definition | ||
13 | */ | ||
14 | |||
15 | #ifndef __ASM_ARCH_VMALLOC_H | ||
16 | #define __ASM_ARCH_VMALLOC_H | ||
17 | |||
18 | #define VMALLOC_END 0xF6000000UL | ||
19 | |||
20 | #endif /* __ASM_ARCH_VMALLOC_H */ | ||
diff --git a/arch/arm/mach-s5p64x0/init.c b/arch/arm/mach-s5p64x0/init.c deleted file mode 100644 index 659a66c131a1..000000000000 --- a/arch/arm/mach-s5p64x0/init.c +++ /dev/null | |||
@@ -1,42 +0,0 @@ | |||
1 | /* linux/arch/arm/mach-s5p64x0/init.c | ||
2 | * | ||
3 | * Copyright (c) 2009-2010 Samsung Electronics Co., Ltd. | ||
4 | * http://www.samsung.com | ||
5 | * | ||
6 | * S5P64X0 - Init support | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | */ | ||
12 | |||
13 | #include <linux/kernel.h> | ||
14 | #include <linux/types.h> | ||
15 | #include <linux/init.h> | ||
16 | #include <linux/serial_core.h> | ||
17 | |||
18 | #include <mach/map.h> | ||
19 | |||
20 | #include <plat/cpu.h> | ||
21 | #include <plat/devs.h> | ||
22 | #include <plat/s5p6440.h> | ||
23 | #include <plat/s5p6450.h> | ||
24 | #include <plat/regs-serial.h> | ||
25 | |||
26 | /* uart registration process */ | ||
27 | void __init s5p6440_init_uarts(struct s3c2410_uartcfg *cfg, int no) | ||
28 | { | ||
29 | int uart; | ||
30 | |||
31 | for (uart = 0; uart < no; uart++) { | ||
32 | s5p_uart_resources[uart].resources->start = S5P6440_PA_UART(uart); | ||
33 | s5p_uart_resources[uart].resources->end = S5P6440_PA_UART(uart) + S5P_SZ_UART; | ||
34 | } | ||
35 | |||
36 | s3c24xx_init_uartdevs("s3c6400-uart", s5p_uart_resources, cfg, no); | ||
37 | } | ||
38 | |||
39 | void __init s5p6450_init_uarts(struct s3c2410_uartcfg *cfg, int no) | ||
40 | { | ||
41 | s3c24xx_init_uartdevs("s3c6400-uart", s5p_uart_resources, cfg, no); | ||
42 | } | ||
diff --git a/arch/arm/mach-s5p64x0/irq-eint.c b/arch/arm/mach-s5p64x0/irq-eint.c deleted file mode 100644 index 275dc74f4a7b..000000000000 --- a/arch/arm/mach-s5p64x0/irq-eint.c +++ /dev/null | |||
@@ -1,155 +0,0 @@ | |||
1 | /* arch/arm/mach-s5p64x0/irq-eint.c | ||
2 | * | ||
3 | * Copyright (c) 2011 Samsung Electronics Co., Ltd | ||
4 | * http://www.samsung.com/ | ||
5 | * | ||
6 | * Based on linux/arch/arm/mach-s3c64xx/irq-eint.c | ||
7 | * | ||
8 | * S5P64X0 - Interrupt handling for External Interrupts. | ||
9 | * | ||
10 | * This program is free software; you can redistribute it and/or modify | ||
11 | * it under the terms of the GNU General Public License version 2 as | ||
12 | * published by the Free Software Foundation. | ||
13 | */ | ||
14 | |||
15 | #include <linux/kernel.h> | ||
16 | #include <linux/gpio.h> | ||
17 | #include <linux/irq.h> | ||
18 | #include <linux/io.h> | ||
19 | |||
20 | #include <plat/cpu.h> | ||
21 | #include <plat/regs-irqtype.h> | ||
22 | #include <plat/gpio-cfg.h> | ||
23 | #include <plat/pm.h> | ||
24 | |||
25 | #include <mach/regs-gpio.h> | ||
26 | #include <mach/regs-clock.h> | ||
27 | |||
28 | #define eint_offset(irq) ((irq) - IRQ_EINT(0)) | ||
29 | |||
30 | static int s5p64x0_irq_eint_set_type(struct irq_data *data, unsigned int type) | ||
31 | { | ||
32 | int offs = eint_offset(data->irq); | ||
33 | int shift; | ||
34 | u32 ctrl, mask; | ||
35 | u32 newvalue = 0; | ||
36 | |||
37 | if (offs > 15) | ||
38 | return -EINVAL; | ||
39 | |||
40 | switch (type) { | ||
41 | case IRQ_TYPE_NONE: | ||
42 | printk(KERN_WARNING "No edge setting!\n"); | ||
43 | break; | ||
44 | case IRQ_TYPE_EDGE_RISING: | ||
45 | newvalue = S3C2410_EXTINT_RISEEDGE; | ||
46 | break; | ||
47 | case IRQ_TYPE_EDGE_FALLING: | ||
48 | newvalue = S3C2410_EXTINT_FALLEDGE; | ||
49 | break; | ||
50 | case IRQ_TYPE_EDGE_BOTH: | ||
51 | newvalue = S3C2410_EXTINT_BOTHEDGE; | ||
52 | break; | ||
53 | case IRQ_TYPE_LEVEL_LOW: | ||
54 | newvalue = S3C2410_EXTINT_LOWLEV; | ||
55 | break; | ||
56 | case IRQ_TYPE_LEVEL_HIGH: | ||
57 | newvalue = S3C2410_EXTINT_HILEV; | ||
58 | break; | ||
59 | default: | ||
60 | printk(KERN_ERR "No such irq type %d", type); | ||
61 | return -EINVAL; | ||
62 | } | ||
63 | |||
64 | shift = (offs / 2) * 4; | ||
65 | mask = 0x7 << shift; | ||
66 | |||
67 | ctrl = __raw_readl(S5P64X0_EINT0CON0) & ~mask; | ||
68 | ctrl |= newvalue << shift; | ||
69 | __raw_writel(ctrl, S5P64X0_EINT0CON0); | ||
70 | |||
71 | /* Configure the GPIO pin for 6450 or 6440 based on CPU ID */ | ||
72 | if (soc_is_s5p6450()) | ||
73 | s3c_gpio_cfgpin(S5P6450_GPN(offs), S3C_GPIO_SFN(2)); | ||
74 | else | ||
75 | s3c_gpio_cfgpin(S5P6440_GPN(offs), S3C_GPIO_SFN(2)); | ||
76 | |||
77 | return 0; | ||
78 | } | ||
79 | |||
80 | /* | ||
81 | * s5p64x0_irq_demux_eint | ||
82 | * | ||
83 | * This function demuxes the IRQ from the group0 external interrupts, | ||
84 | * from IRQ_EINT(0) to IRQ_EINT(15). It is designed to be inlined into | ||
85 | * the specific handlers s5p64x0_irq_demux_eintX_Y. | ||
86 | */ | ||
87 | static inline void s5p64x0_irq_demux_eint(unsigned int start, unsigned int end) | ||
88 | { | ||
89 | u32 status = __raw_readl(S5P64X0_EINT0PEND); | ||
90 | u32 mask = __raw_readl(S5P64X0_EINT0MASK); | ||
91 | unsigned int irq; | ||
92 | |||
93 | status &= ~mask; | ||
94 | status >>= start; | ||
95 | status &= (1 << (end - start + 1)) - 1; | ||
96 | |||
97 | for (irq = IRQ_EINT(start); irq <= IRQ_EINT(end); irq++) { | ||
98 | if (status & 1) | ||
99 | generic_handle_irq(irq); | ||
100 | status >>= 1; | ||
101 | } | ||
102 | } | ||
103 | |||
104 | static void s5p64x0_irq_demux_eint0_3(unsigned int irq, struct irq_desc *desc) | ||
105 | { | ||
106 | s5p64x0_irq_demux_eint(0, 3); | ||
107 | } | ||
108 | |||
109 | static void s5p64x0_irq_demux_eint4_11(unsigned int irq, struct irq_desc *desc) | ||
110 | { | ||
111 | s5p64x0_irq_demux_eint(4, 11); | ||
112 | } | ||
113 | |||
114 | static void s5p64x0_irq_demux_eint12_15(unsigned int irq, | ||
115 | struct irq_desc *desc) | ||
116 | { | ||
117 | s5p64x0_irq_demux_eint(12, 15); | ||
118 | } | ||
119 | |||
120 | static int s5p64x0_alloc_gc(void) | ||
121 | { | ||
122 | struct irq_chip_generic *gc; | ||
123 | struct irq_chip_type *ct; | ||
124 | |||
125 | gc = irq_alloc_generic_chip("s5p64x0-eint", 1, S5P_IRQ_EINT_BASE, | ||
126 | S5P_VA_GPIO, handle_level_irq); | ||
127 | if (!gc) { | ||
128 | printk(KERN_ERR "%s: irq_alloc_generic_chip for group 0" | ||
129 | "external interrupts failed\n", __func__); | ||
130 | return -EINVAL; | ||
131 | } | ||
132 | |||
133 | ct = gc->chip_types; | ||
134 | ct->chip.irq_ack = irq_gc_ack_set_bit; | ||
135 | ct->chip.irq_mask = irq_gc_mask_set_bit; | ||
136 | ct->chip.irq_unmask = irq_gc_mask_clr_bit; | ||
137 | ct->chip.irq_set_type = s5p64x0_irq_eint_set_type; | ||
138 | ct->chip.irq_set_wake = s3c_irqext_wake; | ||
139 | ct->regs.ack = EINT0PEND_OFFSET; | ||
140 | ct->regs.mask = EINT0MASK_OFFSET; | ||
141 | irq_setup_generic_chip(gc, IRQ_MSK(16), IRQ_GC_INIT_MASK_CACHE, | ||
142 | IRQ_NOREQUEST | IRQ_NOPROBE, 0); | ||
143 | return 0; | ||
144 | } | ||
145 | |||
146 | static int __init s5p64x0_init_irq_eint(void) | ||
147 | { | ||
148 | int ret = s5p64x0_alloc_gc(); | ||
149 | irq_set_chained_handler(IRQ_EINT0_3, s5p64x0_irq_demux_eint0_3); | ||
150 | irq_set_chained_handler(IRQ_EINT4_11, s5p64x0_irq_demux_eint4_11); | ||
151 | irq_set_chained_handler(IRQ_EINT12_15, s5p64x0_irq_demux_eint12_15); | ||
152 | |||
153 | return ret; | ||
154 | } | ||
155 | arch_initcall(s5p64x0_init_irq_eint); | ||
diff --git a/arch/arm/mach-s5p64x0/mach-smdk6440.c b/arch/arm/mach-s5p64x0/mach-smdk6440.c index fe168a087531..a40e325d62c8 100644 --- a/arch/arm/mach-s5p64x0/mach-smdk6440.c +++ b/arch/arm/mach-s5p64x0/mach-smdk6440.c | |||
@@ -28,6 +28,7 @@ | |||
28 | 28 | ||
29 | #include <video/platform_lcd.h> | 29 | #include <video/platform_lcd.h> |
30 | 30 | ||
31 | #include <asm/hardware/vic.h> | ||
31 | #include <asm/mach/arch.h> | 32 | #include <asm/mach/arch.h> |
32 | #include <asm/mach/map.h> | 33 | #include <asm/mach/map.h> |
33 | #include <asm/irq.h> | 34 | #include <asm/irq.h> |
@@ -41,7 +42,6 @@ | |||
41 | 42 | ||
42 | #include <plat/regs-serial.h> | 43 | #include <plat/regs-serial.h> |
43 | #include <plat/gpio-cfg.h> | 44 | #include <plat/gpio-cfg.h> |
44 | #include <plat/s5p6440.h> | ||
45 | #include <plat/clock.h> | 45 | #include <plat/clock.h> |
46 | #include <plat/devs.h> | 46 | #include <plat/devs.h> |
47 | #include <plat/cpu.h> | 47 | #include <plat/cpu.h> |
@@ -55,6 +55,8 @@ | |||
55 | #include <plat/regs-fb.h> | 55 | #include <plat/regs-fb.h> |
56 | #include <plat/sdhci.h> | 56 | #include <plat/sdhci.h> |
57 | 57 | ||
58 | #include "common.h" | ||
59 | |||
58 | #define SMDK6440_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \ | 60 | #define SMDK6440_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \ |
59 | S3C2410_UCON_RXILEVEL | \ | 61 | S3C2410_UCON_RXILEVEL | \ |
60 | S3C2410_UCON_TXIRQMODE | \ | 62 | S3C2410_UCON_TXIRQMODE | \ |
@@ -222,7 +224,7 @@ static struct platform_pwm_backlight_data smdk6440_bl_data = { | |||
222 | 224 | ||
223 | static void __init smdk6440_map_io(void) | 225 | static void __init smdk6440_map_io(void) |
224 | { | 226 | { |
225 | s5p_init_io(NULL, 0, S5P64X0_SYS_ID); | 227 | s5p64x0_init_io(NULL, 0); |
226 | s3c24xx_init_clocks(12000000); | 228 | s3c24xx_init_clocks(12000000); |
227 | s3c24xx_init_uarts(smdk6440_uartcfgs, ARRAY_SIZE(smdk6440_uartcfgs)); | 229 | s3c24xx_init_uarts(smdk6440_uartcfgs, ARRAY_SIZE(smdk6440_uartcfgs)); |
228 | s5p_set_timer_source(S5P_PWM3, S5P_PWM4); | 230 | s5p_set_timer_source(S5P_PWM3, S5P_PWM4); |
@@ -267,7 +269,9 @@ MACHINE_START(SMDK6440, "SMDK6440") | |||
267 | .atag_offset = 0x100, | 269 | .atag_offset = 0x100, |
268 | 270 | ||
269 | .init_irq = s5p6440_init_irq, | 271 | .init_irq = s5p6440_init_irq, |
272 | .handle_irq = vic_handle_irq, | ||
270 | .map_io = smdk6440_map_io, | 273 | .map_io = smdk6440_map_io, |
271 | .init_machine = smdk6440_machine_init, | 274 | .init_machine = smdk6440_machine_init, |
272 | .timer = &s5p_timer, | 275 | .timer = &s5p_timer, |
276 | .restart = s5p64x0_restart, | ||
273 | MACHINE_END | 277 | MACHINE_END |
diff --git a/arch/arm/mach-s5p64x0/mach-smdk6450.c b/arch/arm/mach-s5p64x0/mach-smdk6450.c index 242a415dcf6b..efb69e2f2afe 100644 --- a/arch/arm/mach-s5p64x0/mach-smdk6450.c +++ b/arch/arm/mach-s5p64x0/mach-smdk6450.c | |||
@@ -28,6 +28,7 @@ | |||
28 | 28 | ||
29 | #include <video/platform_lcd.h> | 29 | #include <video/platform_lcd.h> |
30 | 30 | ||
31 | #include <asm/hardware/vic.h> | ||
31 | #include <asm/mach/arch.h> | 32 | #include <asm/mach/arch.h> |
32 | #include <asm/mach/map.h> | 33 | #include <asm/mach/map.h> |
33 | #include <asm/irq.h> | 34 | #include <asm/irq.h> |
@@ -41,7 +42,6 @@ | |||
41 | 42 | ||
42 | #include <plat/regs-serial.h> | 43 | #include <plat/regs-serial.h> |
43 | #include <plat/gpio-cfg.h> | 44 | #include <plat/gpio-cfg.h> |
44 | #include <plat/s5p6450.h> | ||
45 | #include <plat/clock.h> | 45 | #include <plat/clock.h> |
46 | #include <plat/devs.h> | 46 | #include <plat/devs.h> |
47 | #include <plat/cpu.h> | 47 | #include <plat/cpu.h> |
@@ -55,6 +55,8 @@ | |||
55 | #include <plat/regs-fb.h> | 55 | #include <plat/regs-fb.h> |
56 | #include <plat/sdhci.h> | 56 | #include <plat/sdhci.h> |
57 | 57 | ||
58 | #include "common.h" | ||
59 | |||
58 | #define SMDK6450_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \ | 60 | #define SMDK6450_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \ |
59 | S3C2410_UCON_RXILEVEL | \ | 61 | S3C2410_UCON_RXILEVEL | \ |
60 | S3C2410_UCON_TXIRQMODE | \ | 62 | S3C2410_UCON_TXIRQMODE | \ |
@@ -241,7 +243,7 @@ static struct platform_pwm_backlight_data smdk6450_bl_data = { | |||
241 | 243 | ||
242 | static void __init smdk6450_map_io(void) | 244 | static void __init smdk6450_map_io(void) |
243 | { | 245 | { |
244 | s5p_init_io(NULL, 0, S5P64X0_SYS_ID); | 246 | s5p64x0_init_io(NULL, 0); |
245 | s3c24xx_init_clocks(19200000); | 247 | s3c24xx_init_clocks(19200000); |
246 | s3c24xx_init_uarts(smdk6450_uartcfgs, ARRAY_SIZE(smdk6450_uartcfgs)); | 248 | s3c24xx_init_uarts(smdk6450_uartcfgs, ARRAY_SIZE(smdk6450_uartcfgs)); |
247 | s5p_set_timer_source(S5P_PWM3, S5P_PWM4); | 249 | s5p_set_timer_source(S5P_PWM3, S5P_PWM4); |
@@ -286,7 +288,9 @@ MACHINE_START(SMDK6450, "SMDK6450") | |||
286 | .atag_offset = 0x100, | 288 | .atag_offset = 0x100, |
287 | 289 | ||
288 | .init_irq = s5p6450_init_irq, | 290 | .init_irq = s5p6450_init_irq, |
291 | .handle_irq = vic_handle_irq, | ||
289 | .map_io = smdk6450_map_io, | 292 | .map_io = smdk6450_map_io, |
290 | .init_machine = smdk6450_machine_init, | 293 | .init_machine = smdk6450_machine_init, |
291 | .timer = &s5p_timer, | 294 | .timer = &s5p_timer, |
295 | .restart = s5p64x0_restart, | ||
292 | MACHINE_END | 296 | MACHINE_END |