diff options
author | Kukjin Kim <kgene.kim@samsung.com> | 2011-12-22 17:28:28 -0500 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2011-12-23 14:11:05 -0500 |
commit | 95af214becab511b5ef76082688865d434dada1a (patch) | |
tree | dabef4884baac7d2d1a1dd154fd29e06032870cc /arch/arm | |
parent | b024043b6d0d3feecb1de350de9762a00a79eda1 (diff) |
ARM: 7246/1: S5P64X0: introduce arch/arm/mach-s5p64x0/common.[ch]
This patch introduces common.[ch] which are used only in the
arch/arm/mach-s5p64x0/ directory. The common.c file merges
the cpu.c, init.c and irq-eint.c files which are used commonly
on S5P64X0 SoCs and the common.h local header file replaces
with plat/s5p6440.h and plat/s5p6450.h files.
Cc: Ben Dooks <ben-linux@fluff.org>
Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm')
-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 | 459 | ||||
-rw-r--r-- | arch/arm/mach-s5p64x0/common.h | 55 | ||||
-rw-r--r-- | arch/arm/mach-s5p64x0/cpu.c | 215 | ||||
-rw-r--r-- | arch/arm/mach-s5p64x0/init.c | 73 | ||||
-rw-r--r-- | arch/arm/mach-s5p64x0/irq-eint.c | 155 | ||||
-rw-r--r-- | arch/arm/mach-s5p64x0/mach-smdk6440.c | 5 | ||||
-rw-r--r-- | arch/arm/mach-s5p64x0/mach-smdk6450.c | 5 | ||||
-rw-r--r-- | arch/arm/plat-s5p/cpu.c | 20 | ||||
-rw-r--r-- | arch/arm/plat-samsung/include/plat/s5p6440.h | 36 | ||||
-rw-r--r-- | arch/arm/plat-samsung/include/plat/s5p6450.h | 36 |
14 files changed, 532 insertions, 546 deletions
diff --git a/arch/arm/mach-s5p64x0/Makefile b/arch/arm/mach-s5p64x0/Makefile index a1324d8dc4e0..d3f7409999f2 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 |
@@ -28,5 +30,6 @@ obj-$(CONFIG_MACH_SMDK6450) += mach-smdk6450.o | |||
28 | obj-y += dev-audio.o | 30 | obj-y += dev-audio.o |
29 | obj-$(CONFIG_S3C64XX_DEV_SPI) += dev-spi.o | 31 | obj-$(CONFIG_S3C64XX_DEV_SPI) += dev-spi.o |
30 | 32 | ||
33 | obj-y += setup-i2c0.o | ||
31 | obj-$(CONFIG_S5P64X0_SETUP_I2C1) += setup-i2c1.o | 34 | obj-$(CONFIG_S5P64X0_SETUP_I2C1) += setup-i2c1.o |
32 | obj-$(CONFIG_S5P64X0_SETUP_FB_24BPP) += setup-fb-24bpp.o | 35 | obj-$(CONFIG_S5P64X0_SETUP_FB_24BPP) += setup-fb-24bpp.o |
diff --git a/arch/arm/mach-s5p64x0/clock-s5p6440.c b/arch/arm/mach-s5p64x0/clock-s5p6440.c index c54c65d511f0..dd2b8daef0cd 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 2d04abfba12e..328a224f0075 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..af02dc34769d --- /dev/null +++ b/arch/arm/mach-s5p64x0/common.c | |||
@@ -0,0 +1,459 @@ | |||
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/adc-core.h> | ||
44 | #include <plat/fb-core.h> | ||
45 | #include <plat/gpio-cfg.h> | ||
46 | #include <plat/regs-irqtype.h> | ||
47 | #include <plat/regs-serial.h> | ||
48 | |||
49 | #include "common.h" | ||
50 | |||
51 | static const char name_s5p6440[] = "S5P6440"; | ||
52 | static const char name_s5p6450[] = "S5P6450"; | ||
53 | |||
54 | static struct cpu_table cpu_ids[] __initdata = { | ||
55 | { | ||
56 | .idcode = S5P6440_CPU_ID, | ||
57 | .idmask = S5P64XX_CPU_MASK, | ||
58 | .map_io = s5p6440_map_io, | ||
59 | .init_clocks = s5p6440_init_clocks, | ||
60 | .init_uarts = s5p6440_init_uarts, | ||
61 | .init = s5p64x0_init, | ||
62 | .name = name_s5p6440, | ||
63 | }, { | ||
64 | .idcode = S5P6450_CPU_ID, | ||
65 | .idmask = S5P64XX_CPU_MASK, | ||
66 | .map_io = s5p6450_map_io, | ||
67 | .init_clocks = s5p6450_init_clocks, | ||
68 | .init_uarts = s5p6450_init_uarts, | ||
69 | .init = s5p64x0_init, | ||
70 | .name = name_s5p6450, | ||
71 | }, | ||
72 | }; | ||
73 | |||
74 | /* Initial IO mappings */ | ||
75 | |||
76 | static struct map_desc s5p64x0_iodesc[] __initdata = { | ||
77 | { | ||
78 | .virtual = (unsigned long)S5P_VA_CHIPID, | ||
79 | .pfn = __phys_to_pfn(S5P64X0_PA_CHIPID), | ||
80 | .length = SZ_4K, | ||
81 | .type = MT_DEVICE, | ||
82 | }, { | ||
83 | .virtual = (unsigned long)S3C_VA_SYS, | ||
84 | .pfn = __phys_to_pfn(S5P64X0_PA_SYSCON), | ||
85 | .length = SZ_64K, | ||
86 | .type = MT_DEVICE, | ||
87 | }, { | ||
88 | .virtual = (unsigned long)S3C_VA_TIMER, | ||
89 | .pfn = __phys_to_pfn(S5P64X0_PA_TIMER), | ||
90 | .length = SZ_16K, | ||
91 | .type = MT_DEVICE, | ||
92 | }, { | ||
93 | .virtual = (unsigned long)S3C_VA_WATCHDOG, | ||
94 | .pfn = __phys_to_pfn(S5P64X0_PA_WDT), | ||
95 | .length = SZ_4K, | ||
96 | .type = MT_DEVICE, | ||
97 | }, { | ||
98 | .virtual = (unsigned long)S5P_VA_SROMC, | ||
99 | .pfn = __phys_to_pfn(S5P64X0_PA_SROMC), | ||
100 | .length = SZ_4K, | ||
101 | .type = MT_DEVICE, | ||
102 | }, { | ||
103 | .virtual = (unsigned long)S5P_VA_GPIO, | ||
104 | .pfn = __phys_to_pfn(S5P64X0_PA_GPIO), | ||
105 | .length = SZ_4K, | ||
106 | .type = MT_DEVICE, | ||
107 | }, { | ||
108 | .virtual = (unsigned long)VA_VIC0, | ||
109 | .pfn = __phys_to_pfn(S5P64X0_PA_VIC0), | ||
110 | .length = SZ_16K, | ||
111 | .type = MT_DEVICE, | ||
112 | }, { | ||
113 | .virtual = (unsigned long)VA_VIC1, | ||
114 | .pfn = __phys_to_pfn(S5P64X0_PA_VIC1), | ||
115 | .length = SZ_16K, | ||
116 | .type = MT_DEVICE, | ||
117 | }, | ||
118 | }; | ||
119 | |||
120 | static struct map_desc s5p6440_iodesc[] __initdata = { | ||
121 | { | ||
122 | .virtual = (unsigned long)S3C_VA_UART, | ||
123 | .pfn = __phys_to_pfn(S5P6440_PA_UART(0)), | ||
124 | .length = SZ_4K, | ||
125 | .type = MT_DEVICE, | ||
126 | }, | ||
127 | }; | ||
128 | |||
129 | static struct map_desc s5p6450_iodesc[] __initdata = { | ||
130 | { | ||
131 | .virtual = (unsigned long)S3C_VA_UART, | ||
132 | .pfn = __phys_to_pfn(S5P6450_PA_UART(0)), | ||
133 | .length = SZ_512K, | ||
134 | .type = MT_DEVICE, | ||
135 | }, { | ||
136 | .virtual = (unsigned long)S3C_VA_UART + SZ_512K, | ||
137 | .pfn = __phys_to_pfn(S5P6450_PA_UART(5)), | ||
138 | .length = SZ_4K, | ||
139 | .type = MT_DEVICE, | ||
140 | }, | ||
141 | }; | ||
142 | |||
143 | static void s5p64x0_idle(void) | ||
144 | { | ||
145 | unsigned long val; | ||
146 | |||
147 | if (!need_resched()) { | ||
148 | val = __raw_readl(S5P64X0_PWR_CFG); | ||
149 | val &= ~(0x3 << 5); | ||
150 | val |= (0x1 << 5); | ||
151 | __raw_writel(val, S5P64X0_PWR_CFG); | ||
152 | |||
153 | cpu_do_idle(); | ||
154 | } | ||
155 | local_irq_enable(); | ||
156 | } | ||
157 | |||
158 | /* | ||
159 | * s5p64x0_map_io | ||
160 | * | ||
161 | * register the standard CPU IO areas | ||
162 | */ | ||
163 | |||
164 | void __init s5p64x0_init_io(struct map_desc *mach_desc, int size) | ||
165 | { | ||
166 | /* initialize the io descriptors we need for initialization */ | ||
167 | iotable_init(s5p64x0_iodesc, ARRAY_SIZE(s5p64x0_iodesc)); | ||
168 | if (mach_desc) | ||
169 | iotable_init(mach_desc, size); | ||
170 | |||
171 | /* detect cpu id and rev. */ | ||
172 | s5p_init_cpu(S5P64X0_SYS_ID); | ||
173 | |||
174 | s3c_init_cpu(samsung_cpu_id, cpu_ids, ARRAY_SIZE(cpu_ids)); | ||
175 | } | ||
176 | |||
177 | void __init s5p6440_map_io(void) | ||
178 | { | ||
179 | /* initialize any device information early */ | ||
180 | s3c_adc_setname("s3c64xx-adc"); | ||
181 | s3c_fb_setname("s5p64x0-fb"); | ||
182 | |||
183 | iotable_init(s5p6440_iodesc, ARRAY_SIZE(s5p6440_iodesc)); | ||
184 | init_consistent_dma_size(SZ_8M); | ||
185 | } | ||
186 | |||
187 | void __init s5p6450_map_io(void) | ||
188 | { | ||
189 | /* initialize any device information early */ | ||
190 | s3c_adc_setname("s3c64xx-adc"); | ||
191 | s3c_fb_setname("s5p64x0-fb"); | ||
192 | |||
193 | iotable_init(s5p6450_iodesc, ARRAY_SIZE(s5p6450_iodesc)); | ||
194 | init_consistent_dma_size(SZ_8M); | ||
195 | } | ||
196 | |||
197 | /* | ||
198 | * s5p64x0_init_clocks | ||
199 | * | ||
200 | * register and setup the CPU clocks | ||
201 | */ | ||
202 | |||
203 | void __init s5p6440_init_clocks(int xtal) | ||
204 | { | ||
205 | printk(KERN_DEBUG "%s: initializing clocks\n", __func__); | ||
206 | |||
207 | s3c24xx_register_baseclocks(xtal); | ||
208 | s5p_register_clocks(xtal); | ||
209 | s5p6440_register_clocks(); | ||
210 | s5p6440_setup_clocks(); | ||
211 | } | ||
212 | |||
213 | void __init s5p6450_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 | s5p6450_register_clocks(); | ||
220 | s5p6450_setup_clocks(); | ||
221 | } | ||
222 | |||
223 | /* | ||
224 | * s5p64x0_init_irq | ||
225 | * | ||
226 | * register the CPU interrupts | ||
227 | */ | ||
228 | |||
229 | void __init s5p6440_init_irq(void) | ||
230 | { | ||
231 | /* S5P6440 supports 2 VIC */ | ||
232 | u32 vic[2]; | ||
233 | |||
234 | /* | ||
235 | * VIC0 is missing IRQ_VIC0[3, 4, 8, 10, (12-22)] | ||
236 | * VIC1 is missing IRQ VIC1[1, 3, 4, 10, 11, 12, 14, 15, 22] | ||
237 | */ | ||
238 | vic[0] = 0xff800ae7; | ||
239 | vic[1] = 0xffbf23e5; | ||
240 | |||
241 | s5p_init_irq(vic, ARRAY_SIZE(vic)); | ||
242 | } | ||
243 | |||
244 | void __init s5p6450_init_irq(void) | ||
245 | { | ||
246 | /* S5P6450 supports only 2 VIC */ | ||
247 | u32 vic[2]; | ||
248 | |||
249 | /* | ||
250 | * VIC0 is missing IRQ_VIC0[(13-15), (21-22)] | ||
251 | * VIC1 is missing IRQ VIC1[12, 14, 23] | ||
252 | */ | ||
253 | vic[0] = 0xff9f1fff; | ||
254 | vic[1] = 0xff7fafff; | ||
255 | |||
256 | s5p_init_irq(vic, ARRAY_SIZE(vic)); | ||
257 | } | ||
258 | |||
259 | struct sysdev_class s5p64x0_sysclass = { | ||
260 | .name = "s5p64x0-core", | ||
261 | }; | ||
262 | |||
263 | static struct sys_device s5p64x0_sysdev = { | ||
264 | .cls = &s5p64x0_sysclass, | ||
265 | }; | ||
266 | |||
267 | static int __init s5p64x0_core_init(void) | ||
268 | { | ||
269 | return sysdev_class_register(&s5p64x0_sysclass); | ||
270 | } | ||
271 | core_initcall(s5p64x0_core_init); | ||
272 | |||
273 | int __init s5p64x0_init(void) | ||
274 | { | ||
275 | printk(KERN_INFO "S5P64X0(S5P6440/S5P6450): Initializing architecture\n"); | ||
276 | |||
277 | /* set idle function */ | ||
278 | pm_idle = s5p64x0_idle; | ||
279 | |||
280 | return sysdev_register(&s5p64x0_sysdev); | ||
281 | } | ||
282 | |||
283 | static struct s3c24xx_uart_clksrc s5p64x0_serial_clocks[] = { | ||
284 | [0] = { | ||
285 | .name = "pclk_low", | ||
286 | .divisor = 1, | ||
287 | .min_baud = 0, | ||
288 | .max_baud = 0, | ||
289 | }, | ||
290 | [1] = { | ||
291 | .name = "uclk1", | ||
292 | .divisor = 1, | ||
293 | .min_baud = 0, | ||
294 | .max_baud = 0, | ||
295 | }, | ||
296 | }; | ||
297 | |||
298 | /* uart registration process */ | ||
299 | |||
300 | void __init s5p64x0_common_init_uarts(struct s3c2410_uartcfg *cfg, int no) | ||
301 | { | ||
302 | struct s3c2410_uartcfg *tcfg = cfg; | ||
303 | u32 ucnt; | ||
304 | |||
305 | for (ucnt = 0; ucnt < no; ucnt++, tcfg++) { | ||
306 | if (!tcfg->clocks) { | ||
307 | tcfg->clocks = s5p64x0_serial_clocks; | ||
308 | tcfg->clocks_size = ARRAY_SIZE(s5p64x0_serial_clocks); | ||
309 | } | ||
310 | } | ||
311 | } | ||
312 | |||
313 | void __init s5p6440_init_uarts(struct s3c2410_uartcfg *cfg, int no) | ||
314 | { | ||
315 | int uart; | ||
316 | |||
317 | for (uart = 0; uart < no; uart++) { | ||
318 | s5p_uart_resources[uart].resources->start = S5P6440_PA_UART(uart); | ||
319 | s5p_uart_resources[uart].resources->end = S5P6440_PA_UART(uart) + S5P_SZ_UART; | ||
320 | } | ||
321 | |||
322 | s5p64x0_common_init_uarts(cfg, no); | ||
323 | s3c24xx_init_uartdevs("s3c6400-uart", s5p_uart_resources, cfg, no); | ||
324 | } | ||
325 | |||
326 | void __init s5p6450_init_uarts(struct s3c2410_uartcfg *cfg, int no) | ||
327 | { | ||
328 | s5p64x0_common_init_uarts(cfg, no); | ||
329 | s3c24xx_init_uartdevs("s3c6400-uart", s5p_uart_resources, cfg, no); | ||
330 | } | ||
331 | |||
332 | #define eint_offset(irq) ((irq) - IRQ_EINT(0)) | ||
333 | |||
334 | static int s5p64x0_irq_eint_set_type(struct irq_data *data, unsigned int type) | ||
335 | { | ||
336 | int offs = eint_offset(data->irq); | ||
337 | int shift; | ||
338 | u32 ctrl, mask; | ||
339 | u32 newvalue = 0; | ||
340 | |||
341 | if (offs > 15) | ||
342 | return -EINVAL; | ||
343 | |||
344 | switch (type) { | ||
345 | case IRQ_TYPE_NONE: | ||
346 | printk(KERN_WARNING "No edge setting!\n"); | ||
347 | break; | ||
348 | case IRQ_TYPE_EDGE_RISING: | ||
349 | newvalue = S3C2410_EXTINT_RISEEDGE; | ||
350 | break; | ||
351 | case IRQ_TYPE_EDGE_FALLING: | ||
352 | newvalue = S3C2410_EXTINT_FALLEDGE; | ||
353 | break; | ||
354 | case IRQ_TYPE_EDGE_BOTH: | ||
355 | newvalue = S3C2410_EXTINT_BOTHEDGE; | ||
356 | break; | ||
357 | case IRQ_TYPE_LEVEL_LOW: | ||
358 | newvalue = S3C2410_EXTINT_LOWLEV; | ||
359 | break; | ||
360 | case IRQ_TYPE_LEVEL_HIGH: | ||
361 | newvalue = S3C2410_EXTINT_HILEV; | ||
362 | break; | ||
363 | default: | ||
364 | printk(KERN_ERR "No such irq type %d", type); | ||
365 | return -EINVAL; | ||
366 | } | ||
367 | |||
368 | shift = (offs / 2) * 4; | ||
369 | mask = 0x7 << shift; | ||
370 | |||
371 | ctrl = __raw_readl(S5P64X0_EINT0CON0) & ~mask; | ||
372 | ctrl |= newvalue << shift; | ||
373 | __raw_writel(ctrl, S5P64X0_EINT0CON0); | ||
374 | |||
375 | /* Configure the GPIO pin for 6450 or 6440 based on CPU ID */ | ||
376 | if (soc_is_s5p6450()) | ||
377 | s3c_gpio_cfgpin(S5P6450_GPN(offs), S3C_GPIO_SFN(2)); | ||
378 | else | ||
379 | s3c_gpio_cfgpin(S5P6440_GPN(offs), S3C_GPIO_SFN(2)); | ||
380 | |||
381 | return 0; | ||
382 | } | ||
383 | |||
384 | /* | ||
385 | * s5p64x0_irq_demux_eint | ||
386 | * | ||
387 | * This function demuxes the IRQ from the group0 external interrupts, | ||
388 | * from IRQ_EINT(0) to IRQ_EINT(15). It is designed to be inlined into | ||
389 | * the specific handlers s5p64x0_irq_demux_eintX_Y. | ||
390 | */ | ||
391 | static inline void s5p64x0_irq_demux_eint(unsigned int start, unsigned int end) | ||
392 | { | ||
393 | u32 status = __raw_readl(S5P64X0_EINT0PEND); | ||
394 | u32 mask = __raw_readl(S5P64X0_EINT0MASK); | ||
395 | unsigned int irq; | ||
396 | |||
397 | status &= ~mask; | ||
398 | status >>= start; | ||
399 | status &= (1 << (end - start + 1)) - 1; | ||
400 | |||
401 | for (irq = IRQ_EINT(start); irq <= IRQ_EINT(end); irq++) { | ||
402 | if (status & 1) | ||
403 | generic_handle_irq(irq); | ||
404 | status >>= 1; | ||
405 | } | ||
406 | } | ||
407 | |||
408 | static void s5p64x0_irq_demux_eint0_3(unsigned int irq, struct irq_desc *desc) | ||
409 | { | ||
410 | s5p64x0_irq_demux_eint(0, 3); | ||
411 | } | ||
412 | |||
413 | static void s5p64x0_irq_demux_eint4_11(unsigned int irq, struct irq_desc *desc) | ||
414 | { | ||
415 | s5p64x0_irq_demux_eint(4, 11); | ||
416 | } | ||
417 | |||
418 | static void s5p64x0_irq_demux_eint12_15(unsigned int irq, | ||
419 | struct irq_desc *desc) | ||
420 | { | ||
421 | s5p64x0_irq_demux_eint(12, 15); | ||
422 | } | ||
423 | |||
424 | static int s5p64x0_alloc_gc(void) | ||
425 | { | ||
426 | struct irq_chip_generic *gc; | ||
427 | struct irq_chip_type *ct; | ||
428 | |||
429 | gc = irq_alloc_generic_chip("s5p64x0-eint", 1, S5P_IRQ_EINT_BASE, | ||
430 | S5P_VA_GPIO, handle_level_irq); | ||
431 | if (!gc) { | ||
432 | printk(KERN_ERR "%s: irq_alloc_generic_chip for group 0" | ||
433 | "external interrupts failed\n", __func__); | ||
434 | return -EINVAL; | ||
435 | } | ||
436 | |||
437 | ct = gc->chip_types; | ||
438 | ct->chip.irq_ack = irq_gc_ack_set_bit; | ||
439 | ct->chip.irq_mask = irq_gc_mask_set_bit; | ||
440 | ct->chip.irq_unmask = irq_gc_mask_clr_bit; | ||
441 | ct->chip.irq_set_type = s5p64x0_irq_eint_set_type; | ||
442 | ct->chip.irq_set_wake = s3c_irqext_wake; | ||
443 | ct->regs.ack = EINT0PEND_OFFSET; | ||
444 | ct->regs.mask = EINT0MASK_OFFSET; | ||
445 | irq_setup_generic_chip(gc, IRQ_MSK(16), IRQ_GC_INIT_MASK_CACHE, | ||
446 | IRQ_NOREQUEST | IRQ_NOPROBE, 0); | ||
447 | return 0; | ||
448 | } | ||
449 | |||
450 | static int __init s5p64x0_init_irq_eint(void) | ||
451 | { | ||
452 | int ret = s5p64x0_alloc_gc(); | ||
453 | irq_set_chained_handler(IRQ_EINT0_3, s5p64x0_irq_demux_eint0_3); | ||
454 | irq_set_chained_handler(IRQ_EINT4_11, s5p64x0_irq_demux_eint4_11); | ||
455 | irq_set_chained_handler(IRQ_EINT12_15, s5p64x0_irq_demux_eint12_15); | ||
456 | |||
457 | return ret; | ||
458 | } | ||
459 | arch_initcall(s5p64x0_init_irq_eint); | ||
diff --git a/arch/arm/mach-s5p64x0/common.h b/arch/arm/mach-s5p64x0/common.h new file mode 100644 index 000000000000..8a1eca5f4ec9 --- /dev/null +++ b/arch/arm/mach-s5p64x0/common.h | |||
@@ -0,0 +1,55 @@ | |||
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 | #ifdef CONFIG_CPU_S5P6440 | ||
26 | |||
27 | extern int s5p64x0_init(void); | ||
28 | extern void s5p6440_map_io(void); | ||
29 | extern void s5p6440_init_clocks(int xtal); | ||
30 | |||
31 | extern void s5p6440_init_uarts(struct s3c2410_uartcfg *cfg, int no); | ||
32 | |||
33 | #else | ||
34 | #define s5p6440_init_clocks NULL | ||
35 | #define s5p6440_init_uarts NULL | ||
36 | #define s5p6440_map_io NULL | ||
37 | #define s5p64x0_init NULL | ||
38 | #endif | ||
39 | |||
40 | #ifdef CONFIG_CPU_S5P6450 | ||
41 | |||
42 | extern int s5p64x0_init(void); | ||
43 | extern void s5p6450_map_io(void); | ||
44 | extern void s5p6450_init_clocks(int xtal); | ||
45 | |||
46 | extern void s5p6450_init_uarts(struct s3c2410_uartcfg *cfg, int no); | ||
47 | |||
48 | #else | ||
49 | #define s5p6450_init_clocks NULL | ||
50 | #define s5p6450_init_uarts NULL | ||
51 | #define s5p6450_map_io NULL | ||
52 | #define s5p64x0_init NULL | ||
53 | #endif | ||
54 | |||
55 | #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 ecab40cf19ab..000000000000 --- a/arch/arm/mach-s5p64x0/cpu.c +++ /dev/null | |||
@@ -1,215 +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 | |||
44 | /* Initial IO mappings */ | ||
45 | |||
46 | static struct map_desc s5p64x0_iodesc[] __initdata = { | ||
47 | { | ||
48 | .virtual = (unsigned long)S5P_VA_GPIO, | ||
49 | .pfn = __phys_to_pfn(S5P64X0_PA_GPIO), | ||
50 | .length = SZ_4K, | ||
51 | .type = MT_DEVICE, | ||
52 | }, { | ||
53 | .virtual = (unsigned long)VA_VIC0, | ||
54 | .pfn = __phys_to_pfn(S5P64X0_PA_VIC0), | ||
55 | .length = SZ_16K, | ||
56 | .type = MT_DEVICE, | ||
57 | }, { | ||
58 | .virtual = (unsigned long)VA_VIC1, | ||
59 | .pfn = __phys_to_pfn(S5P64X0_PA_VIC1), | ||
60 | .length = SZ_16K, | ||
61 | .type = MT_DEVICE, | ||
62 | }, | ||
63 | }; | ||
64 | |||
65 | static struct map_desc s5p6440_iodesc[] __initdata = { | ||
66 | { | ||
67 | .virtual = (unsigned long)S3C_VA_UART, | ||
68 | .pfn = __phys_to_pfn(S5P6440_PA_UART(0)), | ||
69 | .length = SZ_4K, | ||
70 | .type = MT_DEVICE, | ||
71 | }, | ||
72 | }; | ||
73 | |||
74 | static struct map_desc s5p6450_iodesc[] __initdata = { | ||
75 | { | ||
76 | .virtual = (unsigned long)S3C_VA_UART, | ||
77 | .pfn = __phys_to_pfn(S5P6450_PA_UART(0)), | ||
78 | .length = SZ_512K, | ||
79 | .type = MT_DEVICE, | ||
80 | }, { | ||
81 | .virtual = (unsigned long)S3C_VA_UART + SZ_512K, | ||
82 | .pfn = __phys_to_pfn(S5P6450_PA_UART(5)), | ||
83 | .length = SZ_4K, | ||
84 | .type = MT_DEVICE, | ||
85 | }, | ||
86 | }; | ||
87 | |||
88 | static void s5p64x0_idle(void) | ||
89 | { | ||
90 | unsigned long val; | ||
91 | |||
92 | if (!need_resched()) { | ||
93 | val = __raw_readl(S5P64X0_PWR_CFG); | ||
94 | val &= ~(0x3 << 5); | ||
95 | val |= (0x1 << 5); | ||
96 | __raw_writel(val, S5P64X0_PWR_CFG); | ||
97 | |||
98 | cpu_do_idle(); | ||
99 | } | ||
100 | local_irq_enable(); | ||
101 | } | ||
102 | |||
103 | /* | ||
104 | * s5p64x0_map_io | ||
105 | * | ||
106 | * register the standard CPU IO areas | ||
107 | */ | ||
108 | |||
109 | void __init s5p6440_map_io(void) | ||
110 | { | ||
111 | /* initialize any device information early */ | ||
112 | s3c_adc_setname("s3c64xx-adc"); | ||
113 | s3c_fb_setname("s5p64x0-fb"); | ||
114 | |||
115 | iotable_init(s5p64x0_iodesc, ARRAY_SIZE(s5p64x0_iodesc)); | ||
116 | iotable_init(s5p6440_iodesc, ARRAY_SIZE(s5p6440_iodesc)); | ||
117 | init_consistent_dma_size(SZ_8M); | ||
118 | } | ||
119 | |||
120 | void __init s5p6450_map_io(void) | ||
121 | { | ||
122 | /* initialize any device information early */ | ||
123 | s3c_adc_setname("s3c64xx-adc"); | ||
124 | s3c_fb_setname("s5p64x0-fb"); | ||
125 | |||
126 | iotable_init(s5p64x0_iodesc, ARRAY_SIZE(s5p64x0_iodesc)); | ||
127 | iotable_init(s5p6450_iodesc, ARRAY_SIZE(s5p6450_iodesc)); | ||
128 | init_consistent_dma_size(SZ_8M); | ||
129 | } | ||
130 | |||
131 | /* | ||
132 | * s5p64x0_init_clocks | ||
133 | * | ||
134 | * register and setup the CPU clocks | ||
135 | */ | ||
136 | |||
137 | void __init s5p6440_init_clocks(int xtal) | ||
138 | { | ||
139 | printk(KERN_DEBUG "%s: initializing clocks\n", __func__); | ||
140 | |||
141 | s3c24xx_register_baseclocks(xtal); | ||
142 | s5p_register_clocks(xtal); | ||
143 | s5p6440_register_clocks(); | ||
144 | s5p6440_setup_clocks(); | ||
145 | } | ||
146 | |||
147 | void __init s5p6450_init_clocks(int xtal) | ||
148 | { | ||
149 | printk(KERN_DEBUG "%s: initializing clocks\n", __func__); | ||
150 | |||
151 | s3c24xx_register_baseclocks(xtal); | ||
152 | s5p_register_clocks(xtal); | ||
153 | s5p6450_register_clocks(); | ||
154 | s5p6450_setup_clocks(); | ||
155 | } | ||
156 | |||
157 | /* | ||
158 | * s5p64x0_init_irq | ||
159 | * | ||
160 | * register the CPU interrupts | ||
161 | */ | ||
162 | |||
163 | void __init s5p6440_init_irq(void) | ||
164 | { | ||
165 | /* S5P6440 supports 2 VIC */ | ||
166 | u32 vic[2]; | ||
167 | |||
168 | /* | ||
169 | * VIC0 is missing IRQ_VIC0[3, 4, 8, 10, (12-22)] | ||
170 | * VIC1 is missing IRQ VIC1[1, 3, 4, 10, 11, 12, 14, 15, 22] | ||
171 | */ | ||
172 | vic[0] = 0xff800ae7; | ||
173 | vic[1] = 0xffbf23e5; | ||
174 | |||
175 | s5p_init_irq(vic, ARRAY_SIZE(vic)); | ||
176 | } | ||
177 | |||
178 | void __init s5p6450_init_irq(void) | ||
179 | { | ||
180 | /* S5P6450 supports only 2 VIC */ | ||
181 | u32 vic[2]; | ||
182 | |||
183 | /* | ||
184 | * VIC0 is missing IRQ_VIC0[(13-15), (21-22)] | ||
185 | * VIC1 is missing IRQ VIC1[12, 14, 23] | ||
186 | */ | ||
187 | vic[0] = 0xff9f1fff; | ||
188 | vic[1] = 0xff7fafff; | ||
189 | |||
190 | s5p_init_irq(vic, ARRAY_SIZE(vic)); | ||
191 | } | ||
192 | |||
193 | struct sysdev_class s5p64x0_sysclass = { | ||
194 | .name = "s5p64x0-core", | ||
195 | }; | ||
196 | |||
197 | static struct sys_device s5p64x0_sysdev = { | ||
198 | .cls = &s5p64x0_sysclass, | ||
199 | }; | ||
200 | |||
201 | static int __init s5p64x0_core_init(void) | ||
202 | { | ||
203 | return sysdev_class_register(&s5p64x0_sysclass); | ||
204 | } | ||
205 | core_initcall(s5p64x0_core_init); | ||
206 | |||
207 | int __init s5p64x0_init(void) | ||
208 | { | ||
209 | printk(KERN_INFO "S5P64X0(S5P6440/S5P6450): Initializing architecture\n"); | ||
210 | |||
211 | /* set idle function */ | ||
212 | pm_idle = s5p64x0_idle; | ||
213 | |||
214 | return sysdev_register(&s5p64x0_sysdev); | ||
215 | } | ||
diff --git a/arch/arm/mach-s5p64x0/init.c b/arch/arm/mach-s5p64x0/init.c deleted file mode 100644 index 79833caf8165..000000000000 --- a/arch/arm/mach-s5p64x0/init.c +++ /dev/null | |||
@@ -1,73 +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 | static struct s3c24xx_uart_clksrc s5p64x0_serial_clocks[] = { | ||
27 | [0] = { | ||
28 | .name = "pclk_low", | ||
29 | .divisor = 1, | ||
30 | .min_baud = 0, | ||
31 | .max_baud = 0, | ||
32 | }, | ||
33 | [1] = { | ||
34 | .name = "uclk1", | ||
35 | .divisor = 1, | ||
36 | .min_baud = 0, | ||
37 | .max_baud = 0, | ||
38 | }, | ||
39 | }; | ||
40 | |||
41 | /* uart registration process */ | ||
42 | |||
43 | void __init s5p64x0_common_init_uarts(struct s3c2410_uartcfg *cfg, int no) | ||
44 | { | ||
45 | struct s3c2410_uartcfg *tcfg = cfg; | ||
46 | u32 ucnt; | ||
47 | |||
48 | for (ucnt = 0; ucnt < no; ucnt++, tcfg++) { | ||
49 | if (!tcfg->clocks) { | ||
50 | tcfg->clocks = s5p64x0_serial_clocks; | ||
51 | tcfg->clocks_size = ARRAY_SIZE(s5p64x0_serial_clocks); | ||
52 | } | ||
53 | } | ||
54 | } | ||
55 | |||
56 | void __init s5p6440_init_uarts(struct s3c2410_uartcfg *cfg, int no) | ||
57 | { | ||
58 | int uart; | ||
59 | |||
60 | for (uart = 0; uart < no; uart++) { | ||
61 | s5p_uart_resources[uart].resources->start = S5P6440_PA_UART(uart); | ||
62 | s5p_uart_resources[uart].resources->end = S5P6440_PA_UART(uart) + S5P_SZ_UART; | ||
63 | } | ||
64 | |||
65 | s5p64x0_common_init_uarts(cfg, no); | ||
66 | s3c24xx_init_uartdevs("s3c6400-uart", s5p_uart_resources, cfg, no); | ||
67 | } | ||
68 | |||
69 | void __init s5p6450_init_uarts(struct s3c2410_uartcfg *cfg, int no) | ||
70 | { | ||
71 | s5p64x0_common_init_uarts(cfg, no); | ||
72 | s3c24xx_init_uartdevs("s3c6400-uart", s5p_uart_resources, cfg, no); | ||
73 | } | ||
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 4a1250cd1356..646fc995a109 100644 --- a/arch/arm/mach-s5p64x0/mach-smdk6440.c +++ b/arch/arm/mach-s5p64x0/mach-smdk6440.c | |||
@@ -40,7 +40,6 @@ | |||
40 | 40 | ||
41 | #include <plat/regs-serial.h> | 41 | #include <plat/regs-serial.h> |
42 | #include <plat/gpio-cfg.h> | 42 | #include <plat/gpio-cfg.h> |
43 | #include <plat/s5p6440.h> | ||
44 | #include <plat/clock.h> | 43 | #include <plat/clock.h> |
45 | #include <plat/devs.h> | 44 | #include <plat/devs.h> |
46 | #include <plat/cpu.h> | 45 | #include <plat/cpu.h> |
@@ -53,6 +52,8 @@ | |||
53 | #include <plat/fb.h> | 52 | #include <plat/fb.h> |
54 | #include <plat/regs-fb.h> | 53 | #include <plat/regs-fb.h> |
55 | 54 | ||
55 | #include "common.h" | ||
56 | |||
56 | #define SMDK6440_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \ | 57 | #define SMDK6440_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \ |
57 | S3C2410_UCON_RXILEVEL | \ | 58 | S3C2410_UCON_RXILEVEL | \ |
58 | S3C2410_UCON_TXIRQMODE | \ | 59 | S3C2410_UCON_TXIRQMODE | \ |
@@ -201,7 +202,7 @@ static struct platform_pwm_backlight_data smdk6440_bl_data = { | |||
201 | 202 | ||
202 | static void __init smdk6440_map_io(void) | 203 | static void __init smdk6440_map_io(void) |
203 | { | 204 | { |
204 | s5p_init_io(NULL, 0, S5P64X0_SYS_ID); | 205 | s5p64x0_init_io(NULL, 0); |
205 | s3c24xx_init_clocks(12000000); | 206 | s3c24xx_init_clocks(12000000); |
206 | s3c24xx_init_uarts(smdk6440_uartcfgs, ARRAY_SIZE(smdk6440_uartcfgs)); | 207 | s3c24xx_init_uarts(smdk6440_uartcfgs, ARRAY_SIZE(smdk6440_uartcfgs)); |
207 | s5p_set_timer_source(S5P_PWM3, S5P_PWM4); | 208 | s5p_set_timer_source(S5P_PWM3, S5P_PWM4); |
diff --git a/arch/arm/mach-s5p64x0/mach-smdk6450.c b/arch/arm/mach-s5p64x0/mach-smdk6450.c index 0ab129ecf009..90463ddcbe39 100644 --- a/arch/arm/mach-s5p64x0/mach-smdk6450.c +++ b/arch/arm/mach-s5p64x0/mach-smdk6450.c | |||
@@ -40,7 +40,6 @@ | |||
40 | 40 | ||
41 | #include <plat/regs-serial.h> | 41 | #include <plat/regs-serial.h> |
42 | #include <plat/gpio-cfg.h> | 42 | #include <plat/gpio-cfg.h> |
43 | #include <plat/s5p6450.h> | ||
44 | #include <plat/clock.h> | 43 | #include <plat/clock.h> |
45 | #include <plat/devs.h> | 44 | #include <plat/devs.h> |
46 | #include <plat/cpu.h> | 45 | #include <plat/cpu.h> |
@@ -53,6 +52,8 @@ | |||
53 | #include <plat/fb.h> | 52 | #include <plat/fb.h> |
54 | #include <plat/regs-fb.h> | 53 | #include <plat/regs-fb.h> |
55 | 54 | ||
55 | #include "common.h" | ||
56 | |||
56 | #define SMDK6450_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \ | 57 | #define SMDK6450_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \ |
57 | S3C2410_UCON_RXILEVEL | \ | 58 | S3C2410_UCON_RXILEVEL | \ |
58 | S3C2410_UCON_TXIRQMODE | \ | 59 | S3C2410_UCON_TXIRQMODE | \ |
@@ -221,7 +222,7 @@ static struct platform_pwm_backlight_data smdk6450_bl_data = { | |||
221 | 222 | ||
222 | static void __init smdk6450_map_io(void) | 223 | static void __init smdk6450_map_io(void) |
223 | { | 224 | { |
224 | s5p_init_io(NULL, 0, S5P64X0_SYS_ID); | 225 | s5p64x0_init_io(NULL, 0); |
225 | s3c24xx_init_clocks(19200000); | 226 | s3c24xx_init_clocks(19200000); |
226 | s3c24xx_init_uarts(smdk6450_uartcfgs, ARRAY_SIZE(smdk6450_uartcfgs)); | 227 | s3c24xx_init_uarts(smdk6450_uartcfgs, ARRAY_SIZE(smdk6450_uartcfgs)); |
227 | s5p_set_timer_source(S5P_PWM3, S5P_PWM4); | 228 | s5p_set_timer_source(S5P_PWM3, S5P_PWM4); |
diff --git a/arch/arm/plat-s5p/cpu.c b/arch/arm/plat-s5p/cpu.c index a56959e83516..2fb9a9c87ead 100644 --- a/arch/arm/plat-s5p/cpu.c +++ b/arch/arm/plat-s5p/cpu.c | |||
@@ -20,16 +20,12 @@ | |||
20 | #include <mach/regs-clock.h> | 20 | #include <mach/regs-clock.h> |
21 | 21 | ||
22 | #include <plat/cpu.h> | 22 | #include <plat/cpu.h> |
23 | #include <plat/s5p6440.h> | ||
24 | #include <plat/s5p6450.h> | ||
25 | #include <plat/s5pc100.h> | 23 | #include <plat/s5pc100.h> |
26 | #include <plat/s5pv210.h> | 24 | #include <plat/s5pv210.h> |
27 | #include <plat/exynos4.h> | 25 | #include <plat/exynos4.h> |
28 | 26 | ||
29 | /* table of supported CPUs */ | 27 | /* table of supported CPUs */ |
30 | 28 | ||
31 | static const char name_s5p6440[] = "S5P6440"; | ||
32 | static const char name_s5p6450[] = "S5P6450"; | ||
33 | static const char name_s5pc100[] = "S5PC100"; | 29 | static const char name_s5pc100[] = "S5PC100"; |
34 | static const char name_s5pv210[] = "S5PV210/S5PC110"; | 30 | static const char name_s5pv210[] = "S5PV210/S5PC110"; |
35 | static const char name_exynos4210[] = "EXYNOS4210"; | 31 | static const char name_exynos4210[] = "EXYNOS4210"; |
@@ -38,22 +34,6 @@ static const char name_exynos4412[] = "EXYNOS4412"; | |||
38 | 34 | ||
39 | static struct cpu_table cpu_ids[] __initdata = { | 35 | static struct cpu_table cpu_ids[] __initdata = { |
40 | { | 36 | { |
41 | .idcode = S5P6440_CPU_ID, | ||
42 | .idmask = S5P64XX_CPU_MASK, | ||
43 | .map_io = s5p6440_map_io, | ||
44 | .init_clocks = s5p6440_init_clocks, | ||
45 | .init_uarts = s5p6440_init_uarts, | ||
46 | .init = s5p64x0_init, | ||
47 | .name = name_s5p6440, | ||
48 | }, { | ||
49 | .idcode = S5P6450_CPU_ID, | ||
50 | .idmask = S5P64XX_CPU_MASK, | ||
51 | .map_io = s5p6450_map_io, | ||
52 | .init_clocks = s5p6450_init_clocks, | ||
53 | .init_uarts = s5p6450_init_uarts, | ||
54 | .init = s5p64x0_init, | ||
55 | .name = name_s5p6450, | ||
56 | }, { | ||
57 | .idcode = S5PC100_CPU_ID, | 37 | .idcode = S5PC100_CPU_ID, |
58 | .idmask = S5PC100_CPU_MASK, | 38 | .idmask = S5PC100_CPU_MASK, |
59 | .map_io = s5pc100_map_io, | 39 | .map_io = s5pc100_map_io, |
diff --git a/arch/arm/plat-samsung/include/plat/s5p6440.h b/arch/arm/plat-samsung/include/plat/s5p6440.h deleted file mode 100644 index bf85ebbb4fbc..000000000000 --- a/arch/arm/plat-samsung/include/plat/s5p6440.h +++ /dev/null | |||
@@ -1,36 +0,0 @@ | |||
1 | /* linux/arch/arm/plat-samsung/include/plat/s5p6440.h | ||
2 | * | ||
3 | * Copyright (c) 2009 Samsung Electronics Co., Ltd. | ||
4 | * http://www.samsung.com/ | ||
5 | * | ||
6 | * Header file for s5p6440 cpu 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 | /* Common init code for S5P6440 related SoCs */ | ||
14 | |||
15 | extern void s5p6440_register_clocks(void); | ||
16 | extern void s5p6440_setup_clocks(void); | ||
17 | |||
18 | #ifdef CONFIG_CPU_S5P6440 | ||
19 | |||
20 | extern int s5p64x0_init(void); | ||
21 | extern void s5p6440_init_irq(void); | ||
22 | extern void s5p6440_map_io(void); | ||
23 | extern void s5p6440_init_clocks(int xtal); | ||
24 | |||
25 | extern void s5p6440_init_uarts(struct s3c2410_uartcfg *cfg, int no); | ||
26 | |||
27 | #else | ||
28 | #define s5p6440_init_clocks NULL | ||
29 | #define s5p6440_init_uarts NULL | ||
30 | #define s5p6440_map_io NULL | ||
31 | #define s5p64x0_init NULL | ||
32 | #endif | ||
33 | |||
34 | /* S5P6440 timer */ | ||
35 | |||
36 | extern struct sys_timer s5p6440_timer; | ||
diff --git a/arch/arm/plat-samsung/include/plat/s5p6450.h b/arch/arm/plat-samsung/include/plat/s5p6450.h deleted file mode 100644 index da25f9a1c54a..000000000000 --- a/arch/arm/plat-samsung/include/plat/s5p6450.h +++ /dev/null | |||
@@ -1,36 +0,0 @@ | |||
1 | /* linux/arch/arm/plat-samsung/include/plat/s5p6450.h | ||
2 | * | ||
3 | * Copyright (c) 2010 Samsung Electronics Co., Ltd. | ||
4 | * http://www.samsung.com | ||
5 | * | ||
6 | * Header file for s5p6450 cpu 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 | /* Common init code for S5P6450 related SoCs */ | ||
14 | |||
15 | extern void s5p6450_register_clocks(void); | ||
16 | extern void s5p6450_setup_clocks(void); | ||
17 | |||
18 | #ifdef CONFIG_CPU_S5P6450 | ||
19 | |||
20 | extern int s5p64x0_init(void); | ||
21 | extern void s5p6450_init_irq(void); | ||
22 | extern void s5p6450_map_io(void); | ||
23 | extern void s5p6450_init_clocks(int xtal); | ||
24 | |||
25 | extern void s5p6450_init_uarts(struct s3c2410_uartcfg *cfg, int no); | ||
26 | |||
27 | #else | ||
28 | #define s5p6450_init_clocks NULL | ||
29 | #define s5p6450_init_uarts NULL | ||
30 | #define s5p6450_map_io NULL | ||
31 | #define s5p64x0_init NULL | ||
32 | #endif | ||
33 | |||
34 | /* S5P6450 timer */ | ||
35 | |||
36 | extern struct sys_timer s5p6450_timer; | ||