diff options
Diffstat (limited to 'arch/arm/mach-s5p6440')
25 files changed, 2086 insertions, 0 deletions
diff --git a/arch/arm/mach-s5p6440/Kconfig b/arch/arm/mach-s5p6440/Kconfig new file mode 100644 index 000000000000..4c29ff8b07de --- /dev/null +++ b/arch/arm/mach-s5p6440/Kconfig | |||
@@ -0,0 +1,21 @@ | |||
1 | # arch/arm/mach-s5p6440/Kconfig | ||
2 | # | ||
3 | # Copyright (c) 2009 Samsung Electronics Co., Ltd. | ||
4 | # http://www.samsung.com/ | ||
5 | # | ||
6 | # Licensed under GPLv2 | ||
7 | |||
8 | if ARCH_S5P6440 | ||
9 | |||
10 | config CPU_S5P6440 | ||
11 | bool | ||
12 | help | ||
13 | Enable S5P6440 CPU support | ||
14 | |||
15 | config MACH_SMDK6440 | ||
16 | bool "SMDK6440" | ||
17 | select CPU_S5P6440 | ||
18 | help | ||
19 | Machine support for the Samsung SMDK6440 | ||
20 | |||
21 | endif | ||
diff --git a/arch/arm/mach-s5p6440/Makefile b/arch/arm/mach-s5p6440/Makefile new file mode 100644 index 000000000000..1ad894b1d3ab --- /dev/null +++ b/arch/arm/mach-s5p6440/Makefile | |||
@@ -0,0 +1,19 @@ | |||
1 | # arch/arm/mach-s5p6440/Makefile | ||
2 | # | ||
3 | # Copyright (c) 2009 Samsung Electronics Co., Ltd. | ||
4 | # http://www.samsung.com/ | ||
5 | # | ||
6 | # Licensed under GPLv2 | ||
7 | |||
8 | obj-y := | ||
9 | obj-m := | ||
10 | obj-n := | ||
11 | obj- := | ||
12 | |||
13 | # Core support for S5P6440 system | ||
14 | |||
15 | obj-$(CONFIG_CPU_S5P6440) += cpu.o init.o clock.o gpio.o | ||
16 | |||
17 | # machine support | ||
18 | |||
19 | obj-$(CONFIG_MACH_SMDK6440) += mach-smdk6440.o | ||
diff --git a/arch/arm/mach-s5p6440/Makefile.boot b/arch/arm/mach-s5p6440/Makefile.boot new file mode 100644 index 000000000000..ff90aa13bd67 --- /dev/null +++ b/arch/arm/mach-s5p6440/Makefile.boot | |||
@@ -0,0 +1,2 @@ | |||
1 | zreladdr-y := 0x20008000 | ||
2 | params_phys-y := 0x20000100 | ||
diff --git a/arch/arm/mach-s5p6440/clock.c b/arch/arm/mach-s5p6440/clock.c new file mode 100644 index 000000000000..b2672e16e7aa --- /dev/null +++ b/arch/arm/mach-s5p6440/clock.c | |||
@@ -0,0 +1,698 @@ | |||
1 | /* linux/arch/arm/mach-s5p6440/clock.c | ||
2 | * | ||
3 | * Copyright (c) 2009 Samsung Electronics Co., Ltd. | ||
4 | * http://www.samsung.com/ | ||
5 | * | ||
6 | * S5P6440 - Clock 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/init.h> | ||
14 | #include <linux/module.h> | ||
15 | #include <linux/kernel.h> | ||
16 | #include <linux/list.h> | ||
17 | #include <linux/errno.h> | ||
18 | #include <linux/err.h> | ||
19 | #include <linux/clk.h> | ||
20 | #include <linux/sysdev.h> | ||
21 | #include <linux/io.h> | ||
22 | |||
23 | #include <mach/hardware.h> | ||
24 | #include <mach/map.h> | ||
25 | |||
26 | #include <plat/cpu-freq.h> | ||
27 | #include <mach/regs-clock.h> | ||
28 | #include <plat/clock.h> | ||
29 | #include <plat/cpu.h> | ||
30 | #include <plat/clock-clksrc.h> | ||
31 | #include <plat/s5p-clock.h> | ||
32 | #include <plat/pll.h> | ||
33 | #include <plat/s5p6440.h> | ||
34 | |||
35 | /* APLL Mux output clock */ | ||
36 | static struct clksrc_clk clk_mout_apll = { | ||
37 | .clk = { | ||
38 | .name = "mout_apll", | ||
39 | .id = -1, | ||
40 | }, | ||
41 | .sources = &clk_src_apll, | ||
42 | .reg_src = { .reg = S5P_CLK_SRC0, .shift = 0, .size = 1 }, | ||
43 | }; | ||
44 | |||
45 | static int s5p6440_epll_enable(struct clk *clk, int enable) | ||
46 | { | ||
47 | unsigned int ctrlbit = clk->ctrlbit; | ||
48 | unsigned int epll_con = __raw_readl(S5P_EPLL_CON) & ~ctrlbit; | ||
49 | |||
50 | if (enable) | ||
51 | __raw_writel(epll_con | ctrlbit, S5P_EPLL_CON); | ||
52 | else | ||
53 | __raw_writel(epll_con, S5P_EPLL_CON); | ||
54 | |||
55 | return 0; | ||
56 | } | ||
57 | |||
58 | static unsigned long s5p6440_epll_get_rate(struct clk *clk) | ||
59 | { | ||
60 | return clk->rate; | ||
61 | } | ||
62 | |||
63 | static u32 epll_div[][5] = { | ||
64 | { 36000000, 0, 48, 1, 4 }, | ||
65 | { 48000000, 0, 32, 1, 3 }, | ||
66 | { 60000000, 0, 40, 1, 3 }, | ||
67 | { 72000000, 0, 48, 1, 3 }, | ||
68 | { 84000000, 0, 28, 1, 2 }, | ||
69 | { 96000000, 0, 32, 1, 2 }, | ||
70 | { 32768000, 45264, 43, 1, 4 }, | ||
71 | { 45158000, 6903, 30, 1, 3 }, | ||
72 | { 49152000, 50332, 32, 1, 3 }, | ||
73 | { 67738000, 10398, 45, 1, 3 }, | ||
74 | { 73728000, 9961, 49, 1, 3 } | ||
75 | }; | ||
76 | |||
77 | static int s5p6440_epll_set_rate(struct clk *clk, unsigned long rate) | ||
78 | { | ||
79 | unsigned int epll_con, epll_con_k; | ||
80 | unsigned int i; | ||
81 | |||
82 | if (clk->rate == rate) /* Return if nothing changed */ | ||
83 | return 0; | ||
84 | |||
85 | epll_con = __raw_readl(S5P_EPLL_CON); | ||
86 | epll_con_k = __raw_readl(S5P_EPLL_CON_K); | ||
87 | |||
88 | epll_con_k &= ~(PLL90XX_KDIV_MASK); | ||
89 | epll_con &= ~(PLL90XX_MDIV_MASK | PLL90XX_PDIV_MASK | PLL90XX_SDIV_MASK); | ||
90 | |||
91 | for (i = 0; i < ARRAY_SIZE(epll_div); i++) { | ||
92 | if (epll_div[i][0] == rate) { | ||
93 | epll_con_k |= (epll_div[i][1] << PLL90XX_KDIV_SHIFT); | ||
94 | epll_con |= (epll_div[i][2] << PLL90XX_MDIV_SHIFT) | | ||
95 | (epll_div[i][3] << PLL90XX_PDIV_SHIFT) | | ||
96 | (epll_div[i][4] << PLL90XX_SDIV_SHIFT); | ||
97 | break; | ||
98 | } | ||
99 | } | ||
100 | |||
101 | if (i == ARRAY_SIZE(epll_div)) { | ||
102 | printk(KERN_ERR "%s: Invalid Clock EPLL Frequency\n", __func__); | ||
103 | return -EINVAL; | ||
104 | } | ||
105 | |||
106 | __raw_writel(epll_con, S5P_EPLL_CON); | ||
107 | __raw_writel(epll_con_k, S5P_EPLL_CON_K); | ||
108 | |||
109 | clk->rate = rate; | ||
110 | |||
111 | return 0; | ||
112 | } | ||
113 | |||
114 | static struct clk_ops s5p6440_epll_ops = { | ||
115 | .get_rate = s5p6440_epll_get_rate, | ||
116 | .set_rate = s5p6440_epll_set_rate, | ||
117 | }; | ||
118 | |||
119 | static struct clksrc_clk clk_mout_epll = { | ||
120 | .clk = { | ||
121 | .name = "mout_epll", | ||
122 | .id = -1, | ||
123 | }, | ||
124 | .sources = &clk_src_epll, | ||
125 | .reg_src = { .reg = S5P_CLK_SRC0, .shift = 2, .size = 1 }, | ||
126 | }; | ||
127 | |||
128 | static struct clksrc_clk clk_mout_mpll = { | ||
129 | .clk = { | ||
130 | .name = "mout_mpll", | ||
131 | .id = -1, | ||
132 | }, | ||
133 | .sources = &clk_src_mpll, | ||
134 | .reg_src = { .reg = S5P_CLK_SRC0, .shift = 1, .size = 1 }, | ||
135 | }; | ||
136 | |||
137 | static struct clk clk_h_low = { | ||
138 | .name = "hclk_low", | ||
139 | .id = -1, | ||
140 | .rate = 0, | ||
141 | .parent = NULL, | ||
142 | .ctrlbit = 0, | ||
143 | .ops = &clk_ops_def_setrate, | ||
144 | }; | ||
145 | |||
146 | static struct clk clk_p_low = { | ||
147 | .name = "pclk_low", | ||
148 | .id = -1, | ||
149 | .rate = 0, | ||
150 | .parent = NULL, | ||
151 | .ctrlbit = 0, | ||
152 | .ops = &clk_ops_def_setrate, | ||
153 | }; | ||
154 | |||
155 | enum perf_level { | ||
156 | L0 = 532*1000, | ||
157 | L1 = 266*1000, | ||
158 | L2 = 133*1000, | ||
159 | }; | ||
160 | |||
161 | static const u32 clock_table[][3] = { | ||
162 | /*{ARM_CLK, DIVarm, DIVhclk}*/ | ||
163 | {L0 * 1000, (0 << ARM_DIV_RATIO_SHIFT), (3 << S5P_CLKDIV0_HCLK_SHIFT)}, | ||
164 | {L1 * 1000, (1 << ARM_DIV_RATIO_SHIFT), (1 << S5P_CLKDIV0_HCLK_SHIFT)}, | ||
165 | {L2 * 1000, (3 << ARM_DIV_RATIO_SHIFT), (0 << S5P_CLKDIV0_HCLK_SHIFT)}, | ||
166 | }; | ||
167 | |||
168 | static unsigned long s5p6440_armclk_get_rate(struct clk *clk) | ||
169 | { | ||
170 | unsigned long rate = clk_get_rate(clk->parent); | ||
171 | u32 clkdiv; | ||
172 | |||
173 | /* divisor mask starts at bit0, so no need to shift */ | ||
174 | clkdiv = __raw_readl(ARM_CLK_DIV) & ARM_DIV_MASK; | ||
175 | |||
176 | return rate / (clkdiv + 1); | ||
177 | } | ||
178 | |||
179 | static unsigned long s5p6440_armclk_round_rate(struct clk *clk, | ||
180 | unsigned long rate) | ||
181 | { | ||
182 | u32 iter; | ||
183 | |||
184 | for (iter = 1 ; iter < ARRAY_SIZE(clock_table) ; iter++) { | ||
185 | if (rate > clock_table[iter][0]) | ||
186 | return clock_table[iter-1][0]; | ||
187 | } | ||
188 | |||
189 | return clock_table[ARRAY_SIZE(clock_table) - 1][0]; | ||
190 | } | ||
191 | |||
192 | static int s5p6440_armclk_set_rate(struct clk *clk, unsigned long rate) | ||
193 | { | ||
194 | u32 round_tmp; | ||
195 | u32 iter; | ||
196 | u32 clk_div0_tmp; | ||
197 | u32 cur_rate = clk->ops->get_rate(clk); | ||
198 | unsigned long flags; | ||
199 | |||
200 | round_tmp = clk->ops->round_rate(clk, rate); | ||
201 | if (round_tmp == cur_rate) | ||
202 | return 0; | ||
203 | |||
204 | |||
205 | for (iter = 0 ; iter < ARRAY_SIZE(clock_table) ; iter++) { | ||
206 | if (round_tmp == clock_table[iter][0]) | ||
207 | break; | ||
208 | } | ||
209 | |||
210 | if (iter >= ARRAY_SIZE(clock_table)) | ||
211 | iter = ARRAY_SIZE(clock_table) - 1; | ||
212 | |||
213 | local_irq_save(flags); | ||
214 | if (cur_rate > round_tmp) { | ||
215 | /* Frequency Down */ | ||
216 | clk_div0_tmp = __raw_readl(ARM_CLK_DIV) & ~(ARM_DIV_MASK); | ||
217 | clk_div0_tmp |= clock_table[iter][1]; | ||
218 | __raw_writel(clk_div0_tmp, ARM_CLK_DIV); | ||
219 | |||
220 | clk_div0_tmp = __raw_readl(ARM_CLK_DIV) & | ||
221 | ~(S5P_CLKDIV0_HCLK_MASK); | ||
222 | clk_div0_tmp |= clock_table[iter][2]; | ||
223 | __raw_writel(clk_div0_tmp, ARM_CLK_DIV); | ||
224 | |||
225 | |||
226 | } else { | ||
227 | /* Frequency Up */ | ||
228 | clk_div0_tmp = __raw_readl(ARM_CLK_DIV) & | ||
229 | ~(S5P_CLKDIV0_HCLK_MASK); | ||
230 | clk_div0_tmp |= clock_table[iter][2]; | ||
231 | __raw_writel(clk_div0_tmp, ARM_CLK_DIV); | ||
232 | |||
233 | clk_div0_tmp = __raw_readl(ARM_CLK_DIV) & ~(ARM_DIV_MASK); | ||
234 | clk_div0_tmp |= clock_table[iter][1]; | ||
235 | __raw_writel(clk_div0_tmp, ARM_CLK_DIV); | ||
236 | } | ||
237 | local_irq_restore(flags); | ||
238 | |||
239 | clk->rate = clock_table[iter][0]; | ||
240 | |||
241 | return 0; | ||
242 | } | ||
243 | |||
244 | static struct clk_ops s5p6440_clkarm_ops = { | ||
245 | .get_rate = s5p6440_armclk_get_rate, | ||
246 | .set_rate = s5p6440_armclk_set_rate, | ||
247 | .round_rate = s5p6440_armclk_round_rate, | ||
248 | }; | ||
249 | |||
250 | static unsigned long s5p6440_clk_doutmpll_get_rate(struct clk *clk) | ||
251 | { | ||
252 | unsigned long rate = clk_get_rate(clk->parent); | ||
253 | |||
254 | if (__raw_readl(S5P_CLK_DIV0) & S5P_CLKDIV0_MPLL_MASK) | ||
255 | rate /= 2; | ||
256 | |||
257 | return rate; | ||
258 | } | ||
259 | |||
260 | static struct clk clk_dout_mpll = { | ||
261 | .name = "dout_mpll", | ||
262 | .id = -1, | ||
263 | .parent = &clk_mout_mpll.clk, | ||
264 | .ops = &(struct clk_ops) { | ||
265 | .get_rate = s5p6440_clk_doutmpll_get_rate, | ||
266 | }, | ||
267 | }; | ||
268 | |||
269 | int s5p6440_clk48m_ctrl(struct clk *clk, int enable) | ||
270 | { | ||
271 | unsigned long flags; | ||
272 | u32 val; | ||
273 | |||
274 | /* can't rely on clock lock, this register has other usages */ | ||
275 | local_irq_save(flags); | ||
276 | |||
277 | val = __raw_readl(S5P_OTHERS); | ||
278 | if (enable) | ||
279 | val |= S5P_OTHERS_USB_SIG_MASK; | ||
280 | else | ||
281 | val &= ~S5P_OTHERS_USB_SIG_MASK; | ||
282 | |||
283 | __raw_writel(val, S5P_OTHERS); | ||
284 | |||
285 | local_irq_restore(flags); | ||
286 | |||
287 | return 0; | ||
288 | } | ||
289 | |||
290 | static int s5p6440_pclk_ctrl(struct clk *clk, int enable) | ||
291 | { | ||
292 | return s5p_gatectrl(S5P_CLK_GATE_PCLK, clk, enable); | ||
293 | } | ||
294 | |||
295 | static int s5p6440_hclk0_ctrl(struct clk *clk, int enable) | ||
296 | { | ||
297 | return s5p_gatectrl(S5P_CLK_GATE_HCLK0, clk, enable); | ||
298 | } | ||
299 | |||
300 | static int s5p6440_hclk1_ctrl(struct clk *clk, int enable) | ||
301 | { | ||
302 | return s5p_gatectrl(S5P_CLK_GATE_HCLK1, clk, enable); | ||
303 | } | ||
304 | |||
305 | static int s5p6440_sclk_ctrl(struct clk *clk, int enable) | ||
306 | { | ||
307 | return s5p_gatectrl(S5P_CLK_GATE_SCLK0, clk, enable); | ||
308 | } | ||
309 | |||
310 | static int s5p6440_mem_ctrl(struct clk *clk, int enable) | ||
311 | { | ||
312 | return s5p_gatectrl(S5P_CLK_GATE_MEM0, clk, enable); | ||
313 | } | ||
314 | |||
315 | /* | ||
316 | * The following clocks will be disabled during clock initialization. It is | ||
317 | * recommended to keep the following clocks disabled until the driver requests | ||
318 | * for enabling the clock. | ||
319 | */ | ||
320 | static struct clk init_clocks_disable[] = { | ||
321 | { | ||
322 | .name = "nand", | ||
323 | .id = -1, | ||
324 | .parent = &clk_h, | ||
325 | .enable = s5p6440_mem_ctrl, | ||
326 | .ctrlbit = S5P_CLKCON_MEM0_HCLK_NFCON, | ||
327 | }, { | ||
328 | .name = "adc", | ||
329 | .id = -1, | ||
330 | .parent = &clk_p_low, | ||
331 | .enable = s5p6440_pclk_ctrl, | ||
332 | .ctrlbit = S5P_CLKCON_PCLK_TSADC, | ||
333 | }, { | ||
334 | .name = "i2c", | ||
335 | .id = -1, | ||
336 | .parent = &clk_p_low, | ||
337 | .enable = s5p6440_pclk_ctrl, | ||
338 | .ctrlbit = S5P_CLKCON_PCLK_IIC0, | ||
339 | }, { | ||
340 | .name = "i2s_v40", | ||
341 | .id = 0, | ||
342 | .parent = &clk_p_low, | ||
343 | .enable = s5p6440_pclk_ctrl, | ||
344 | .ctrlbit = S5P_CLKCON_PCLK_IIS2, | ||
345 | }, { | ||
346 | .name = "spi", | ||
347 | .id = 0, | ||
348 | .parent = &clk_p_low, | ||
349 | .enable = s5p6440_pclk_ctrl, | ||
350 | .ctrlbit = S5P_CLKCON_PCLK_SPI0, | ||
351 | }, { | ||
352 | .name = "spi", | ||
353 | .id = 1, | ||
354 | .parent = &clk_p_low, | ||
355 | .enable = s5p6440_pclk_ctrl, | ||
356 | .ctrlbit = S5P_CLKCON_PCLK_SPI1, | ||
357 | }, { | ||
358 | .name = "sclk_spi_48", | ||
359 | .id = 0, | ||
360 | .parent = &clk_48m, | ||
361 | .enable = s5p6440_sclk_ctrl, | ||
362 | .ctrlbit = S5P_CLKCON_SCLK0_SPI0_48, | ||
363 | }, { | ||
364 | .name = "sclk_spi_48", | ||
365 | .id = 1, | ||
366 | .parent = &clk_48m, | ||
367 | .enable = s5p6440_sclk_ctrl, | ||
368 | .ctrlbit = S5P_CLKCON_SCLK0_SPI1_48, | ||
369 | }, { | ||
370 | .name = "mmc_48m", | ||
371 | .id = 0, | ||
372 | .parent = &clk_48m, | ||
373 | .enable = s5p6440_sclk_ctrl, | ||
374 | .ctrlbit = S5P_CLKCON_SCLK0_MMC0_48, | ||
375 | }, { | ||
376 | .name = "mmc_48m", | ||
377 | .id = 1, | ||
378 | .parent = &clk_48m, | ||
379 | .enable = s5p6440_sclk_ctrl, | ||
380 | .ctrlbit = S5P_CLKCON_SCLK0_MMC1_48, | ||
381 | }, { | ||
382 | .name = "mmc_48m", | ||
383 | .id = 2, | ||
384 | .parent = &clk_48m, | ||
385 | .enable = s5p6440_sclk_ctrl, | ||
386 | .ctrlbit = S5P_CLKCON_SCLK0_MMC2_48, | ||
387 | }, { | ||
388 | .name = "otg", | ||
389 | .id = -1, | ||
390 | .parent = &clk_h_low, | ||
391 | .enable = s5p6440_hclk0_ctrl, | ||
392 | .ctrlbit = S5P_CLKCON_HCLK0_USB | ||
393 | }, { | ||
394 | .name = "post", | ||
395 | .id = -1, | ||
396 | .parent = &clk_h_low, | ||
397 | .enable = s5p6440_hclk0_ctrl, | ||
398 | .ctrlbit = S5P_CLKCON_HCLK0_POST0 | ||
399 | }, { | ||
400 | .name = "lcd", | ||
401 | .id = -1, | ||
402 | .parent = &clk_h_low, | ||
403 | .enable = s5p6440_hclk1_ctrl, | ||
404 | .ctrlbit = S5P_CLKCON_HCLK1_DISPCON, | ||
405 | }, { | ||
406 | .name = "hsmmc", | ||
407 | .id = 0, | ||
408 | .parent = &clk_h_low, | ||
409 | .enable = s5p6440_hclk0_ctrl, | ||
410 | .ctrlbit = S5P_CLKCON_HCLK0_HSMMC0, | ||
411 | }, { | ||
412 | .name = "hsmmc", | ||
413 | .id = 1, | ||
414 | .parent = &clk_h_low, | ||
415 | .enable = s5p6440_hclk0_ctrl, | ||
416 | .ctrlbit = S5P_CLKCON_HCLK0_HSMMC1, | ||
417 | }, { | ||
418 | .name = "hsmmc", | ||
419 | .id = 2, | ||
420 | .parent = &clk_h_low, | ||
421 | .enable = s5p6440_hclk0_ctrl, | ||
422 | .ctrlbit = S5P_CLKCON_HCLK0_HSMMC2, | ||
423 | }, { | ||
424 | .name = "rtc", | ||
425 | .id = -1, | ||
426 | .parent = &clk_p_low, | ||
427 | .enable = s5p6440_pclk_ctrl, | ||
428 | .ctrlbit = S5P_CLKCON_PCLK_RTC, | ||
429 | }, { | ||
430 | .name = "watchdog", | ||
431 | .id = -1, | ||
432 | .parent = &clk_p_low, | ||
433 | .enable = s5p6440_pclk_ctrl, | ||
434 | .ctrlbit = S5P_CLKCON_PCLK_WDT, | ||
435 | }, { | ||
436 | .name = "timers", | ||
437 | .id = -1, | ||
438 | .parent = &clk_p_low, | ||
439 | .enable = s5p6440_pclk_ctrl, | ||
440 | .ctrlbit = S5P_CLKCON_PCLK_PWM, | ||
441 | } | ||
442 | }; | ||
443 | |||
444 | /* | ||
445 | * The following clocks will be enabled during clock initialization. | ||
446 | */ | ||
447 | static struct clk init_clocks[] = { | ||
448 | { | ||
449 | .name = "gpio", | ||
450 | .id = -1, | ||
451 | .parent = &clk_p_low, | ||
452 | .enable = s5p6440_pclk_ctrl, | ||
453 | .ctrlbit = S5P_CLKCON_PCLK_GPIO, | ||
454 | }, { | ||
455 | .name = "uart", | ||
456 | .id = 0, | ||
457 | .parent = &clk_p_low, | ||
458 | .enable = s5p6440_pclk_ctrl, | ||
459 | .ctrlbit = S5P_CLKCON_PCLK_UART0, | ||
460 | }, { | ||
461 | .name = "uart", | ||
462 | .id = 1, | ||
463 | .parent = &clk_p_low, | ||
464 | .enable = s5p6440_pclk_ctrl, | ||
465 | .ctrlbit = S5P_CLKCON_PCLK_UART1, | ||
466 | }, { | ||
467 | .name = "uart", | ||
468 | .id = 2, | ||
469 | .parent = &clk_p_low, | ||
470 | .enable = s5p6440_pclk_ctrl, | ||
471 | .ctrlbit = S5P_CLKCON_PCLK_UART2, | ||
472 | }, { | ||
473 | .name = "uart", | ||
474 | .id = 3, | ||
475 | .parent = &clk_p_low, | ||
476 | .enable = s5p6440_pclk_ctrl, | ||
477 | .ctrlbit = S5P_CLKCON_PCLK_UART3, | ||
478 | } | ||
479 | }; | ||
480 | |||
481 | static struct clk clk_iis_cd_v40 = { | ||
482 | .name = "iis_cdclk_v40", | ||
483 | .id = -1, | ||
484 | }; | ||
485 | |||
486 | static struct clk clk_pcm_cd = { | ||
487 | .name = "pcm_cdclk", | ||
488 | .id = -1, | ||
489 | }; | ||
490 | |||
491 | static struct clk *clkset_spi_mmc_list[] = { | ||
492 | &clk_mout_epll.clk, | ||
493 | &clk_dout_mpll, | ||
494 | &clk_fin_epll, | ||
495 | }; | ||
496 | |||
497 | static struct clksrc_sources clkset_spi_mmc = { | ||
498 | .sources = clkset_spi_mmc_list, | ||
499 | .nr_sources = ARRAY_SIZE(clkset_spi_mmc_list), | ||
500 | }; | ||
501 | |||
502 | static struct clk *clkset_uart_list[] = { | ||
503 | &clk_mout_epll.clk, | ||
504 | &clk_dout_mpll | ||
505 | }; | ||
506 | |||
507 | static struct clksrc_sources clkset_uart = { | ||
508 | .sources = clkset_uart_list, | ||
509 | .nr_sources = ARRAY_SIZE(clkset_uart_list), | ||
510 | }; | ||
511 | |||
512 | static struct clksrc_clk clksrcs[] = { | ||
513 | { | ||
514 | .clk = { | ||
515 | .name = "mmc_bus", | ||
516 | .id = 0, | ||
517 | .ctrlbit = S5P_CLKCON_SCLK0_MMC0, | ||
518 | .enable = s5p6440_sclk_ctrl, | ||
519 | }, | ||
520 | .sources = &clkset_spi_mmc, | ||
521 | .reg_src = { .reg = S5P_CLK_SRC0, .shift = 18, .size = 2 }, | ||
522 | .reg_div = { .reg = S5P_CLK_DIV1, .shift = 0, .size = 4 }, | ||
523 | }, { | ||
524 | .clk = { | ||
525 | .name = "mmc_bus", | ||
526 | .id = 1, | ||
527 | .ctrlbit = S5P_CLKCON_SCLK0_MMC1, | ||
528 | .enable = s5p6440_sclk_ctrl, | ||
529 | }, | ||
530 | .sources = &clkset_spi_mmc, | ||
531 | .reg_src = { .reg = S5P_CLK_SRC0, .shift = 20, .size = 2 }, | ||
532 | .reg_div = { .reg = S5P_CLK_DIV1, .shift = 4, .size = 4 }, | ||
533 | }, { | ||
534 | .clk = { | ||
535 | .name = "mmc_bus", | ||
536 | .id = 2, | ||
537 | .ctrlbit = S5P_CLKCON_SCLK0_MMC2, | ||
538 | .enable = s5p6440_sclk_ctrl, | ||
539 | }, | ||
540 | .sources = &clkset_spi_mmc, | ||
541 | .reg_src = { .reg = S5P_CLK_SRC0, .shift = 22, .size = 2 }, | ||
542 | .reg_div = { .reg = S5P_CLK_DIV1, .shift = 8, .size = 4 }, | ||
543 | }, { | ||
544 | .clk = { | ||
545 | .name = "uclk1", | ||
546 | .id = -1, | ||
547 | .ctrlbit = S5P_CLKCON_SCLK0_UART, | ||
548 | .enable = s5p6440_sclk_ctrl, | ||
549 | }, | ||
550 | .sources = &clkset_uart, | ||
551 | .reg_src = { .reg = S5P_CLK_SRC0, .shift = 13, .size = 1 }, | ||
552 | .reg_div = { .reg = S5P_CLK_DIV2, .shift = 16, .size = 4 }, | ||
553 | }, { | ||
554 | .clk = { | ||
555 | .name = "spi_epll", | ||
556 | .id = 0, | ||
557 | .ctrlbit = S5P_CLKCON_SCLK0_SPI0, | ||
558 | .enable = s5p6440_sclk_ctrl, | ||
559 | }, | ||
560 | .sources = &clkset_spi_mmc, | ||
561 | .reg_src = { .reg = S5P_CLK_SRC0, .shift = 14, .size = 2 }, | ||
562 | .reg_div = { .reg = S5P_CLK_DIV2, .shift = 0, .size = 4 }, | ||
563 | }, { | ||
564 | .clk = { | ||
565 | .name = "spi_epll", | ||
566 | .id = 1, | ||
567 | .ctrlbit = S5P_CLKCON_SCLK0_SPI1, | ||
568 | .enable = s5p6440_sclk_ctrl, | ||
569 | }, | ||
570 | .sources = &clkset_spi_mmc, | ||
571 | .reg_src = { .reg = S5P_CLK_SRC0, .shift = 16, .size = 2 }, | ||
572 | .reg_div = { .reg = S5P_CLK_DIV2, .shift = 4, .size = 4 }, | ||
573 | } | ||
574 | }; | ||
575 | |||
576 | /* Clock initialisation code */ | ||
577 | static struct clksrc_clk *init_parents[] = { | ||
578 | &clk_mout_apll, | ||
579 | &clk_mout_epll, | ||
580 | &clk_mout_mpll, | ||
581 | }; | ||
582 | |||
583 | void __init_or_cpufreq s5p6440_setup_clocks(void) | ||
584 | { | ||
585 | struct clk *xtal_clk; | ||
586 | unsigned long xtal; | ||
587 | unsigned long fclk; | ||
588 | unsigned long hclk; | ||
589 | unsigned long hclk_low; | ||
590 | unsigned long pclk; | ||
591 | unsigned long pclk_low; | ||
592 | unsigned long epll; | ||
593 | unsigned long apll; | ||
594 | unsigned long mpll; | ||
595 | unsigned int ptr; | ||
596 | u32 clkdiv0; | ||
597 | u32 clkdiv3; | ||
598 | |||
599 | /* Set S5P6440 functions for clk_fout_epll */ | ||
600 | clk_fout_epll.enable = s5p6440_epll_enable; | ||
601 | clk_fout_epll.ops = &s5p6440_epll_ops; | ||
602 | |||
603 | /* Set S5P6440 functions for arm clock */ | ||
604 | clk_arm.parent = &clk_mout_apll.clk; | ||
605 | clk_arm.ops = &s5p6440_clkarm_ops; | ||
606 | clk_48m.enable = s5p6440_clk48m_ctrl; | ||
607 | |||
608 | clkdiv0 = __raw_readl(S5P_CLK_DIV0); | ||
609 | clkdiv3 = __raw_readl(S5P_CLK_DIV3); | ||
610 | |||
611 | xtal_clk = clk_get(NULL, "ext_xtal"); | ||
612 | BUG_ON(IS_ERR(xtal_clk)); | ||
613 | |||
614 | xtal = clk_get_rate(xtal_clk); | ||
615 | clk_put(xtal_clk); | ||
616 | |||
617 | epll = s5p_get_pll90xx(xtal, __raw_readl(S5P_EPLL_CON), | ||
618 | __raw_readl(S5P_EPLL_CON_K)); | ||
619 | mpll = s5p_get_pll45xx(xtal, __raw_readl(S5P_MPLL_CON), pll_4502); | ||
620 | apll = s5p_get_pll45xx(xtal, __raw_readl(S5P_APLL_CON), pll_4502); | ||
621 | |||
622 | printk(KERN_INFO "S5P6440: PLL settings, A=%ld.%ldMHz, M=%ld.%ldMHz," \ | ||
623 | " E=%ld.%ldMHz\n", | ||
624 | print_mhz(apll), print_mhz(mpll), print_mhz(epll)); | ||
625 | |||
626 | fclk = apll / GET_DIV(clkdiv0, S5P_CLKDIV0_ARM); | ||
627 | hclk = fclk / GET_DIV(clkdiv0, S5P_CLKDIV0_HCLK); | ||
628 | pclk = hclk / GET_DIV(clkdiv0, S5P_CLKDIV0_PCLK); | ||
629 | |||
630 | if (__raw_readl(S5P_OTHERS) & S5P_OTHERS_HCLK_LOW_SEL_MPLL) { | ||
631 | /* Asynchronous mode */ | ||
632 | hclk_low = mpll / GET_DIV(clkdiv3, S5P_CLKDIV3_HCLK_LOW); | ||
633 | } else { | ||
634 | /* Synchronous mode */ | ||
635 | hclk_low = apll / GET_DIV(clkdiv3, S5P_CLKDIV3_HCLK_LOW); | ||
636 | } | ||
637 | |||
638 | pclk_low = hclk_low / GET_DIV(clkdiv3, S5P_CLKDIV3_PCLK_LOW); | ||
639 | |||
640 | printk(KERN_INFO "S5P6440: HCLK=%ld.%ldMHz, HCLK_LOW=%ld.%ldMHz," \ | ||
641 | " PCLK=%ld.%ldMHz, PCLK_LOW=%ld.%ldMHz\n", | ||
642 | print_mhz(hclk), print_mhz(hclk_low), | ||
643 | print_mhz(pclk), print_mhz(pclk_low)); | ||
644 | |||
645 | clk_fout_mpll.rate = mpll; | ||
646 | clk_fout_epll.rate = epll; | ||
647 | clk_fout_apll.rate = apll; | ||
648 | |||
649 | clk_f.rate = fclk; | ||
650 | clk_h.rate = hclk; | ||
651 | clk_p.rate = pclk; | ||
652 | clk_h_low.rate = hclk_low; | ||
653 | clk_p_low.rate = pclk_low; | ||
654 | |||
655 | for (ptr = 0; ptr < ARRAY_SIZE(init_parents); ptr++) | ||
656 | s3c_set_clksrc(init_parents[ptr], true); | ||
657 | |||
658 | for (ptr = 0; ptr < ARRAY_SIZE(clksrcs); ptr++) | ||
659 | s3c_set_clksrc(&clksrcs[ptr], true); | ||
660 | } | ||
661 | |||
662 | static struct clk *clks[] __initdata = { | ||
663 | &clk_ext, | ||
664 | &clk_mout_epll.clk, | ||
665 | &clk_mout_mpll.clk, | ||
666 | &clk_dout_mpll, | ||
667 | &clk_iis_cd_v40, | ||
668 | &clk_pcm_cd, | ||
669 | &clk_p_low, | ||
670 | &clk_h_low, | ||
671 | }; | ||
672 | |||
673 | void __init s5p6440_register_clocks(void) | ||
674 | { | ||
675 | struct clk *clkp; | ||
676 | int ret; | ||
677 | int ptr; | ||
678 | |||
679 | ret = s3c24xx_register_clocks(clks, ARRAY_SIZE(clks)); | ||
680 | if (ret > 0) | ||
681 | printk(KERN_ERR "Failed to register %u clocks\n", ret); | ||
682 | |||
683 | s3c_register_clksrc(clksrcs, ARRAY_SIZE(clksrcs)); | ||
684 | s3c_register_clocks(init_clocks, ARRAY_SIZE(init_clocks)); | ||
685 | |||
686 | clkp = init_clocks_disable; | ||
687 | for (ptr = 0; ptr < ARRAY_SIZE(init_clocks_disable); ptr++, clkp++) { | ||
688 | |||
689 | ret = s3c24xx_register_clock(clkp); | ||
690 | if (ret < 0) { | ||
691 | printk(KERN_ERR "Failed to register clock %s (%d)\n", | ||
692 | clkp->name, ret); | ||
693 | } | ||
694 | (clkp->enable)(clkp, 0); | ||
695 | } | ||
696 | |||
697 | s3c_pwmclk_init(); | ||
698 | } | ||
diff --git a/arch/arm/mach-s5p6440/cpu.c b/arch/arm/mach-s5p6440/cpu.c new file mode 100644 index 000000000000..1794131aeacb --- /dev/null +++ b/arch/arm/mach-s5p6440/cpu.c | |||
@@ -0,0 +1,114 @@ | |||
1 | /* linux/arch/arm/mach-s5p6440/cpu.c | ||
2 | * | ||
3 | * Copyright (c) 2009 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 | |||
23 | #include <asm/mach/arch.h> | ||
24 | #include <asm/mach/map.h> | ||
25 | #include <asm/mach/irq.h> | ||
26 | |||
27 | #include <asm/proc-fns.h> | ||
28 | |||
29 | #include <mach/hardware.h> | ||
30 | #include <mach/map.h> | ||
31 | #include <asm/irq.h> | ||
32 | |||
33 | #include <plat/regs-serial.h> | ||
34 | #include <mach/regs-clock.h> | ||
35 | |||
36 | #include <plat/cpu.h> | ||
37 | #include <plat/devs.h> | ||
38 | #include <plat/clock.h> | ||
39 | #include <plat/s5p6440.h> | ||
40 | |||
41 | static void s5p6440_idle(void) | ||
42 | { | ||
43 | unsigned long val; | ||
44 | |||
45 | if (!need_resched()) { | ||
46 | val = __raw_readl(S5P_PWR_CFG); | ||
47 | val &= ~(0x3<<5); | ||
48 | val |= (0x1<<5); | ||
49 | __raw_writel(val, S5P_PWR_CFG); | ||
50 | |||
51 | cpu_do_idle(); | ||
52 | } | ||
53 | local_irq_enable(); | ||
54 | } | ||
55 | |||
56 | /* s5p6440_map_io | ||
57 | * | ||
58 | * register the standard cpu IO areas | ||
59 | */ | ||
60 | |||
61 | void __init s5p6440_map_io(void) | ||
62 | { | ||
63 | /* initialize any device information early */ | ||
64 | } | ||
65 | |||
66 | void __init s5p6440_init_clocks(int xtal) | ||
67 | { | ||
68 | printk(KERN_DEBUG "%s: initializing clocks\n", __func__); | ||
69 | |||
70 | s3c24xx_register_baseclocks(xtal); | ||
71 | s5p_register_clocks(xtal); | ||
72 | s5p6440_register_clocks(); | ||
73 | s5p6440_setup_clocks(); | ||
74 | } | ||
75 | |||
76 | void __init s5p6440_init_irq(void) | ||
77 | { | ||
78 | /* S5P6440 supports only 2 VIC */ | ||
79 | u32 vic[2]; | ||
80 | |||
81 | /* | ||
82 | * VIC0 is missing IRQ_VIC0[3, 4, 8, 10, (12-22)] | ||
83 | * VIC1 is missing IRQ VIC1[1, 3, 4, 10, 11, 12, 14, 15, 22] | ||
84 | */ | ||
85 | vic[0] = 0xff800ae7; | ||
86 | vic[1] = 0xffbf23e5; | ||
87 | |||
88 | s5p_init_irq(vic, ARRAY_SIZE(vic)); | ||
89 | } | ||
90 | |||
91 | static struct sysdev_class s5p6440_sysclass = { | ||
92 | .name = "s5p6440-core", | ||
93 | }; | ||
94 | |||
95 | static struct sys_device s5p6440_sysdev = { | ||
96 | .cls = &s5p6440_sysclass, | ||
97 | }; | ||
98 | |||
99 | static int __init s5p6440_core_init(void) | ||
100 | { | ||
101 | return sysdev_class_register(&s5p6440_sysclass); | ||
102 | } | ||
103 | |||
104 | core_initcall(s5p6440_core_init); | ||
105 | |||
106 | int __init s5p6440_init(void) | ||
107 | { | ||
108 | printk(KERN_INFO "S5P6440: Initializing architecture\n"); | ||
109 | |||
110 | /* set idle function */ | ||
111 | pm_idle = s5p6440_idle; | ||
112 | |||
113 | return sysdev_register(&s5p6440_sysdev); | ||
114 | } | ||
diff --git a/arch/arm/mach-s5p6440/gpio.c b/arch/arm/mach-s5p6440/gpio.c new file mode 100644 index 000000000000..b0ea741177ad --- /dev/null +++ b/arch/arm/mach-s5p6440/gpio.c | |||
@@ -0,0 +1,322 @@ | |||
1 | /* arch/arm/mach-s5p6440/gpio.c | ||
2 | * | ||
3 | * Copyright (c) 2009 Samsung Electronics Co., Ltd. | ||
4 | * http://www.samsung.com/ | ||
5 | * | ||
6 | * S5P6440 - GPIOlib 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/irq.h> | ||
15 | #include <linux/io.h> | ||
16 | #include <mach/map.h> | ||
17 | #include <mach/gpio.h> | ||
18 | #include <mach/regs-gpio.h> | ||
19 | #include <plat/gpio-core.h> | ||
20 | #include <plat/gpio-cfg.h> | ||
21 | #include <plat/gpio-cfg-helpers.h> | ||
22 | |||
23 | /* GPIO bank summary: | ||
24 | * | ||
25 | * Bank GPIOs Style SlpCon ExtInt Group | ||
26 | * A 6 4Bit Yes 1 | ||
27 | * B 7 4Bit Yes 1 | ||
28 | * C 8 4Bit Yes 2 | ||
29 | * F 2 2Bit Yes 4 [1] | ||
30 | * G 7 4Bit Yes 5 | ||
31 | * H 10 4Bit[2] Yes 6 | ||
32 | * I 16 2Bit Yes None | ||
33 | * J 12 2Bit Yes None | ||
34 | * N 16 2Bit No IRQ_EINT | ||
35 | * P 8 2Bit Yes 8 | ||
36 | * R 15 4Bit[2] Yes 8 | ||
37 | * | ||
38 | * [1] BANKF pins 14,15 do not form part of the external interrupt sources | ||
39 | * [2] BANK has two control registers, GPxCON0 and GPxCON1 | ||
40 | */ | ||
41 | |||
42 | static int s5p6440_gpiolib_rbank_4bit2_input(struct gpio_chip *chip, | ||
43 | unsigned int offset) | ||
44 | { | ||
45 | struct s3c_gpio_chip *ourchip = to_s3c_gpio(chip); | ||
46 | void __iomem *base = ourchip->base; | ||
47 | void __iomem *regcon = base; | ||
48 | unsigned long con; | ||
49 | |||
50 | switch (offset) { | ||
51 | case 6: | ||
52 | offset += 1; | ||
53 | case 0: | ||
54 | case 1: | ||
55 | case 2: | ||
56 | case 3: | ||
57 | case 4: | ||
58 | case 5: | ||
59 | regcon -= 4; | ||
60 | break; | ||
61 | default: | ||
62 | offset -= 7; | ||
63 | break; | ||
64 | } | ||
65 | |||
66 | con = __raw_readl(regcon); | ||
67 | con &= ~(0xf << con_4bit_shift(offset)); | ||
68 | __raw_writel(con, regcon); | ||
69 | |||
70 | return 0; | ||
71 | } | ||
72 | |||
73 | static int s5p6440_gpiolib_rbank_4bit2_output(struct gpio_chip *chip, | ||
74 | unsigned int offset, int value) | ||
75 | { | ||
76 | struct s3c_gpio_chip *ourchip = to_s3c_gpio(chip); | ||
77 | void __iomem *base = ourchip->base; | ||
78 | void __iomem *regcon = base; | ||
79 | unsigned long con; | ||
80 | unsigned long dat; | ||
81 | unsigned con_offset = offset; | ||
82 | |||
83 | switch (con_offset) { | ||
84 | case 6: | ||
85 | con_offset += 1; | ||
86 | case 0: | ||
87 | case 1: | ||
88 | case 2: | ||
89 | case 3: | ||
90 | case 4: | ||
91 | case 5: | ||
92 | regcon -= 4; | ||
93 | break; | ||
94 | default: | ||
95 | con_offset -= 7; | ||
96 | break; | ||
97 | } | ||
98 | |||
99 | con = __raw_readl(regcon); | ||
100 | con &= ~(0xf << con_4bit_shift(con_offset)); | ||
101 | con |= 0x1 << con_4bit_shift(con_offset); | ||
102 | |||
103 | dat = __raw_readl(base + GPIODAT_OFF); | ||
104 | if (value) | ||
105 | dat |= 1 << offset; | ||
106 | else | ||
107 | dat &= ~(1 << offset); | ||
108 | |||
109 | __raw_writel(con, regcon); | ||
110 | __raw_writel(dat, base + GPIODAT_OFF); | ||
111 | |||
112 | return 0; | ||
113 | } | ||
114 | |||
115 | int s5p6440_gpio_setcfg_4bit_rbank(struct s3c_gpio_chip *chip, | ||
116 | unsigned int off, unsigned int cfg) | ||
117 | { | ||
118 | void __iomem *reg = chip->base; | ||
119 | unsigned int shift; | ||
120 | u32 con; | ||
121 | |||
122 | switch (off) { | ||
123 | case 0: | ||
124 | case 1: | ||
125 | case 2: | ||
126 | case 3: | ||
127 | case 4: | ||
128 | case 5: | ||
129 | shift = (off & 7) * 4; | ||
130 | reg -= 4; | ||
131 | break; | ||
132 | case 6: | ||
133 | shift = ((off + 1) & 7) * 4; | ||
134 | reg -= 4; | ||
135 | default: | ||
136 | shift = ((off + 1) & 7) * 4; | ||
137 | break; | ||
138 | } | ||
139 | |||
140 | if (s3c_gpio_is_cfg_special(cfg)) { | ||
141 | cfg &= 0xf; | ||
142 | cfg <<= shift; | ||
143 | } | ||
144 | |||
145 | con = __raw_readl(reg); | ||
146 | con &= ~(0xf << shift); | ||
147 | con |= cfg; | ||
148 | __raw_writel(con, reg); | ||
149 | |||
150 | return 0; | ||
151 | } | ||
152 | |||
153 | static struct s3c_gpio_cfg s5p6440_gpio_cfgs[] = { | ||
154 | { | ||
155 | .cfg_eint = 0, | ||
156 | }, { | ||
157 | .cfg_eint = 7, | ||
158 | }, { | ||
159 | .cfg_eint = 3, | ||
160 | .set_config = s5p6440_gpio_setcfg_4bit_rbank, | ||
161 | }, { | ||
162 | .cfg_eint = 0, | ||
163 | .set_config = s3c_gpio_setcfg_s3c24xx, | ||
164 | }, { | ||
165 | .cfg_eint = 2, | ||
166 | .set_config = s3c_gpio_setcfg_s3c24xx, | ||
167 | }, { | ||
168 | .cfg_eint = 3, | ||
169 | .set_config = s3c_gpio_setcfg_s3c24xx, | ||
170 | }, | ||
171 | }; | ||
172 | |||
173 | static struct s3c_gpio_chip s5p6440_gpio_4bit[] = { | ||
174 | { | ||
175 | .base = S5P6440_GPA_BASE, | ||
176 | .config = &s5p6440_gpio_cfgs[1], | ||
177 | .chip = { | ||
178 | .base = S5P6440_GPA(0), | ||
179 | .ngpio = S5P6440_GPIO_A_NR, | ||
180 | .label = "GPA", | ||
181 | }, | ||
182 | }, { | ||
183 | .base = S5P6440_GPB_BASE, | ||
184 | .config = &s5p6440_gpio_cfgs[1], | ||
185 | .chip = { | ||
186 | .base = S5P6440_GPB(0), | ||
187 | .ngpio = S5P6440_GPIO_B_NR, | ||
188 | .label = "GPB", | ||
189 | }, | ||
190 | }, { | ||
191 | .base = S5P6440_GPC_BASE, | ||
192 | .config = &s5p6440_gpio_cfgs[1], | ||
193 | .chip = { | ||
194 | .base = S5P6440_GPC(0), | ||
195 | .ngpio = S5P6440_GPIO_C_NR, | ||
196 | .label = "GPC", | ||
197 | }, | ||
198 | }, { | ||
199 | .base = S5P6440_GPG_BASE, | ||
200 | .config = &s5p6440_gpio_cfgs[1], | ||
201 | .chip = { | ||
202 | .base = S5P6440_GPG(0), | ||
203 | .ngpio = S5P6440_GPIO_G_NR, | ||
204 | .label = "GPG", | ||
205 | }, | ||
206 | }, | ||
207 | }; | ||
208 | |||
209 | static struct s3c_gpio_chip s5p6440_gpio_4bit2[] = { | ||
210 | { | ||
211 | .base = S5P6440_GPH_BASE + 0x4, | ||
212 | .config = &s5p6440_gpio_cfgs[1], | ||
213 | .chip = { | ||
214 | .base = S5P6440_GPH(0), | ||
215 | .ngpio = S5P6440_GPIO_H_NR, | ||
216 | .label = "GPH", | ||
217 | }, | ||
218 | }, | ||
219 | }; | ||
220 | |||
221 | static struct s3c_gpio_chip gpio_rbank_4bit2[] = { | ||
222 | { | ||
223 | .base = S5P6440_GPR_BASE + 0x4, | ||
224 | .config = &s5p6440_gpio_cfgs[2], | ||
225 | .chip = { | ||
226 | .base = S5P6440_GPR(0), | ||
227 | .ngpio = S5P6440_GPIO_R_NR, | ||
228 | .label = "GPR", | ||
229 | }, | ||
230 | }, | ||
231 | }; | ||
232 | |||
233 | static struct s3c_gpio_chip s5p6440_gpio_2bit[] = { | ||
234 | { | ||
235 | .base = S5P6440_GPF_BASE, | ||
236 | .config = &s5p6440_gpio_cfgs[5], | ||
237 | .chip = { | ||
238 | .base = S5P6440_GPF(0), | ||
239 | .ngpio = S5P6440_GPIO_F_NR, | ||
240 | .label = "GPF", | ||
241 | }, | ||
242 | }, { | ||
243 | .base = S5P6440_GPI_BASE, | ||
244 | .config = &s5p6440_gpio_cfgs[3], | ||
245 | .chip = { | ||
246 | .base = S5P6440_GPI(0), | ||
247 | .ngpio = S5P6440_GPIO_I_NR, | ||
248 | .label = "GPI", | ||
249 | }, | ||
250 | }, { | ||
251 | .base = S5P6440_GPJ_BASE, | ||
252 | .config = &s5p6440_gpio_cfgs[3], | ||
253 | .chip = { | ||
254 | .base = S5P6440_GPJ(0), | ||
255 | .ngpio = S5P6440_GPIO_J_NR, | ||
256 | .label = "GPJ", | ||
257 | }, | ||
258 | }, { | ||
259 | .base = S5P6440_GPN_BASE, | ||
260 | .config = &s5p6440_gpio_cfgs[4], | ||
261 | .chip = { | ||
262 | .base = S5P6440_GPN(0), | ||
263 | .ngpio = S5P6440_GPIO_N_NR, | ||
264 | .label = "GPN", | ||
265 | }, | ||
266 | }, { | ||
267 | .base = S5P6440_GPP_BASE, | ||
268 | .config = &s5p6440_gpio_cfgs[5], | ||
269 | .chip = { | ||
270 | .base = S5P6440_GPP(0), | ||
271 | .ngpio = S5P6440_GPIO_P_NR, | ||
272 | .label = "GPP", | ||
273 | }, | ||
274 | }, | ||
275 | }; | ||
276 | |||
277 | void __init s5p6440_gpiolib_set_cfg(struct s3c_gpio_cfg *chipcfg, int nr_chips) | ||
278 | { | ||
279 | for (; nr_chips > 0; nr_chips--, chipcfg++) { | ||
280 | if (!chipcfg->set_config) | ||
281 | chipcfg->set_config = s3c_gpio_setcfg_s3c64xx_4bit; | ||
282 | if (!chipcfg->set_pull) | ||
283 | chipcfg->set_pull = s3c_gpio_setpull_updown; | ||
284 | if (!chipcfg->get_pull) | ||
285 | chipcfg->get_pull = s3c_gpio_getpull_updown; | ||
286 | } | ||
287 | } | ||
288 | |||
289 | static void __init s5p6440_gpio_add_rbank_4bit2(struct s3c_gpio_chip *chip, | ||
290 | int nr_chips) | ||
291 | { | ||
292 | for (; nr_chips > 0; nr_chips--, chip++) { | ||
293 | chip->chip.direction_input = s5p6440_gpiolib_rbank_4bit2_input; | ||
294 | chip->chip.direction_output = | ||
295 | s5p6440_gpiolib_rbank_4bit2_output; | ||
296 | s3c_gpiolib_add(chip); | ||
297 | } | ||
298 | } | ||
299 | |||
300 | static int __init s5p6440_gpiolib_init(void) | ||
301 | { | ||
302 | struct s3c_gpio_chip *chips = s5p6440_gpio_2bit; | ||
303 | int nr_chips = ARRAY_SIZE(s5p6440_gpio_2bit); | ||
304 | |||
305 | s5p6440_gpiolib_set_cfg(s5p6440_gpio_cfgs, | ||
306 | ARRAY_SIZE(s5p6440_gpio_cfgs)); | ||
307 | |||
308 | for (; nr_chips > 0; nr_chips--, chips++) | ||
309 | s3c_gpiolib_add(chips); | ||
310 | |||
311 | samsung_gpiolib_add_4bit_chips(s5p6440_gpio_4bit, | ||
312 | ARRAY_SIZE(s5p6440_gpio_4bit)); | ||
313 | |||
314 | samsung_gpiolib_add_4bit2_chips(s5p6440_gpio_4bit2, | ||
315 | ARRAY_SIZE(s5p6440_gpio_4bit2)); | ||
316 | |||
317 | s5p6440_gpio_add_rbank_4bit2(gpio_rbank_4bit2, | ||
318 | ARRAY_SIZE(gpio_rbank_4bit2)); | ||
319 | |||
320 | return 0; | ||
321 | } | ||
322 | arch_initcall(s5p6440_gpiolib_init); | ||
diff --git a/arch/arm/mach-s5p6440/include/mach/debug-macro.S b/arch/arm/mach-s5p6440/include/mach/debug-macro.S new file mode 100644 index 000000000000..1347d7f99079 --- /dev/null +++ b/arch/arm/mach-s5p6440/include/mach/debug-macro.S | |||
@@ -0,0 +1,37 @@ | |||
1 | /* linux/arch/arm/mach-s5p6440/include/mach/debug-macro.S | ||
2 | * | ||
3 | * Copyright (c) 2009 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 | /* pull in the relevant register and map files. */ | ||
12 | |||
13 | #include <mach/map.h> | ||
14 | #include <plat/regs-serial.h> | ||
15 | |||
16 | /* note, for the boot process to work we have to keep the UART | ||
17 | * virtual address aligned to an 1MiB boundary for the L1 | ||
18 | * mapping the head code makes. We keep the UART virtual address | ||
19 | * aligned and add in the offset when we load the value here. | ||
20 | */ | ||
21 | |||
22 | .macro addruart, rx, rtmp | ||
23 | mrc p15, 0, \rx, c1, c0 | ||
24 | tst \rx, #1 | ||
25 | ldreq \rx, = S3C_PA_UART | ||
26 | ldrne \rx, = S3C_VA_UART | ||
27 | #if CONFIG_DEBUG_S3C_UART != 0 | ||
28 | add \rx, \rx, #(0x400 * CONFIG_DEBUG_S3C_UART) | ||
29 | #endif | ||
30 | .endm | ||
31 | |||
32 | /* include the reset of the code which will do the work, we're only | ||
33 | * compiling for a single cpu processor type so the default of s3c2440 | ||
34 | * will be fine with us. | ||
35 | */ | ||
36 | |||
37 | #include <plat/debug-macro.S> | ||
diff --git a/arch/arm/mach-s5p6440/include/mach/entry-macro.S b/arch/arm/mach-s5p6440/include/mach/entry-macro.S new file mode 100644 index 000000000000..e65f1b967262 --- /dev/null +++ b/arch/arm/mach-s5p6440/include/mach/entry-macro.S | |||
@@ -0,0 +1,16 @@ | |||
1 | /* linux/arch/arm/mach-s5p6440/include/mach/entry-macro.S | ||
2 | * | ||
3 | * Copyright (c) 2009 Samsung Electronics Co., Ltd. | ||
4 | * http://www.samsung.com/ | ||
5 | * | ||
6 | * Low-level IRQ helper macros for the Samsung S5P6440 | ||
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 <mach/map.h> | ||
14 | #include <plat/irqs.h> | ||
15 | |||
16 | #include <asm/entry-macro-vic2.S> | ||
diff --git a/arch/arm/mach-s5p6440/include/mach/gpio.h b/arch/arm/mach-s5p6440/include/mach/gpio.h new file mode 100644 index 000000000000..21783834f2a2 --- /dev/null +++ b/arch/arm/mach-s5p6440/include/mach/gpio.h | |||
@@ -0,0 +1,80 @@ | |||
1 | /* linux/arch/arm/mach-s5p6440/include/mach/gpio.h | ||
2 | * | ||
3 | * Copyright (c) 2009 Samsung Electronics Co., Ltd. | ||
4 | * http://www.samsung.com/ | ||
5 | * | ||
6 | * S5P6440 - GPIO lib 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 | #ifndef __ASM_ARCH_GPIO_H | ||
14 | #define __ASM_ARCH_GPIO_H __FILE__ | ||
15 | |||
16 | #define gpio_get_value __gpio_get_value | ||
17 | #define gpio_set_value __gpio_set_value | ||
18 | #define gpio_cansleep __gpio_cansleep | ||
19 | #define gpio_to_irq __gpio_to_irq | ||
20 | |||
21 | /* GPIO bank sizes */ | ||
22 | #define S5P6440_GPIO_A_NR (6) | ||
23 | #define S5P6440_GPIO_B_NR (7) | ||
24 | #define S5P6440_GPIO_C_NR (8) | ||
25 | #define S5P6440_GPIO_F_NR (2) | ||
26 | #define S5P6440_GPIO_G_NR (7) | ||
27 | #define S5P6440_GPIO_H_NR (10) | ||
28 | #define S5P6440_GPIO_I_NR (16) | ||
29 | #define S5P6440_GPIO_J_NR (12) | ||
30 | #define S5P6440_GPIO_N_NR (16) | ||
31 | #define S5P6440_GPIO_P_NR (8) | ||
32 | #define S5P6440_GPIO_R_NR (15) | ||
33 | |||
34 | /* GPIO bank numbers */ | ||
35 | |||
36 | /* CONFIG_S3C_GPIO_SPACE allows the user to select extra | ||
37 | * space for debugging purposes so that any accidental | ||
38 | * change from one gpio bank to another can be caught. | ||
39 | */ | ||
40 | #define S5P6440_GPIO_NEXT(__gpio) \ | ||
41 | ((__gpio##_START) + (__gpio##_NR) + CONFIG_S3C_GPIO_SPACE + 1) | ||
42 | |||
43 | enum s5p_gpio_number { | ||
44 | S5P6440_GPIO_A_START = 0, | ||
45 | S5P6440_GPIO_B_START = S5P6440_GPIO_NEXT(S5P6440_GPIO_A), | ||
46 | S5P6440_GPIO_C_START = S5P6440_GPIO_NEXT(S5P6440_GPIO_B), | ||
47 | S5P6440_GPIO_F_START = S5P6440_GPIO_NEXT(S5P6440_GPIO_C), | ||
48 | S5P6440_GPIO_G_START = S5P6440_GPIO_NEXT(S5P6440_GPIO_F), | ||
49 | S5P6440_GPIO_H_START = S5P6440_GPIO_NEXT(S5P6440_GPIO_G), | ||
50 | S5P6440_GPIO_I_START = S5P6440_GPIO_NEXT(S5P6440_GPIO_H), | ||
51 | S5P6440_GPIO_J_START = S5P6440_GPIO_NEXT(S5P6440_GPIO_I), | ||
52 | S5P6440_GPIO_N_START = S5P6440_GPIO_NEXT(S5P6440_GPIO_J), | ||
53 | S5P6440_GPIO_P_START = S5P6440_GPIO_NEXT(S5P6440_GPIO_N), | ||
54 | S5P6440_GPIO_R_START = S5P6440_GPIO_NEXT(S5P6440_GPIO_P), | ||
55 | }; | ||
56 | |||
57 | /* S5P6440 GPIO number definitions. */ | ||
58 | #define S5P6440_GPA(_nr) (S5P6440_GPIO_A_START + (_nr)) | ||
59 | #define S5P6440_GPB(_nr) (S5P6440_GPIO_B_START + (_nr)) | ||
60 | #define S5P6440_GPC(_nr) (S5P6440_GPIO_C_START + (_nr)) | ||
61 | #define S5P6440_GPF(_nr) (S5P6440_GPIO_F_START + (_nr)) | ||
62 | #define S5P6440_GPG(_nr) (S5P6440_GPIO_G_START + (_nr)) | ||
63 | #define S5P6440_GPH(_nr) (S5P6440_GPIO_H_START + (_nr)) | ||
64 | #define S5P6440_GPI(_nr) (S5P6440_GPIO_I_START + (_nr)) | ||
65 | #define S5P6440_GPJ(_nr) (S5P6440_GPIO_J_START + (_nr)) | ||
66 | #define S5P6440_GPN(_nr) (S5P6440_GPIO_N_START + (_nr)) | ||
67 | #define S5P6440_GPP(_nr) (S5P6440_GPIO_P_START + (_nr)) | ||
68 | #define S5P6440_GPR(_nr) (S5P6440_GPIO_R_START + (_nr)) | ||
69 | |||
70 | /* the end of the S5P6440 specific gpios */ | ||
71 | #define S5P6440_GPIO_END (S5P6440_GPR(S5P6440_GPIO_R_NR) + 1) | ||
72 | #define S3C_GPIO_END S5P6440_GPIO_END | ||
73 | |||
74 | /* define the number of gpios we need to the one after the GPR() range */ | ||
75 | #define ARCH_NR_GPIOS (S5P6440_GPR(S5P6440_GPIO_R_NR) + \ | ||
76 | CONFIG_SAMSUNG_GPIO_EXTRA + 1) | ||
77 | |||
78 | #include <asm-generic/gpio.h> | ||
79 | |||
80 | #endif /* __ASM_ARCH_GPIO_H */ | ||
diff --git a/arch/arm/mach-s5p6440/include/mach/hardware.h b/arch/arm/mach-s5p6440/include/mach/hardware.h new file mode 100644 index 000000000000..be8b26e875db --- /dev/null +++ b/arch/arm/mach-s5p6440/include/mach/hardware.h | |||
@@ -0,0 +1,18 @@ | |||
1 | /* linux/arch/arm/mach-s5p6440/include/mach/hardware.h | ||
2 | * | ||
3 | * Copyright (c) 2009 Samsung Electronics Co., Ltd. | ||
4 | * http://www.samsung.com/ | ||
5 | * | ||
6 | * S5P6440 - Hardware 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 | #ifndef __ASM_ARCH_HARDWARE_H | ||
14 | #define __ASM_ARCH_HARDWARE_H __FILE__ | ||
15 | |||
16 | /* currently nothing here, placeholder */ | ||
17 | |||
18 | #endif /* __ASM_ARCH_HARDWARE_H */ | ||
diff --git a/arch/arm/mach-s5p6440/include/mach/io.h b/arch/arm/mach-s5p6440/include/mach/io.h new file mode 100644 index 000000000000..fa2d69cb1ad7 --- /dev/null +++ b/arch/arm/mach-s5p6440/include/mach/io.h | |||
@@ -0,0 +1,18 @@ | |||
1 | /* arch/arm/mach-s5p6440/include/mach/io.h | ||
2 | * | ||
3 | * Copyright 2008 Simtec Electronics | ||
4 | * Ben Dooks <ben-linux@fluff.org> | ||
5 | * | ||
6 | * Default IO routines for S3C64XX based | ||
7 | */ | ||
8 | |||
9 | #ifndef __ASM_ARM_ARCH_IO_H | ||
10 | #define __ASM_ARM_ARCH_IO_H | ||
11 | |||
12 | /* No current ISA/PCI bus support. */ | ||
13 | #define __io(a) __typesafe_io(a) | ||
14 | #define __mem_pci(a) (a) | ||
15 | |||
16 | #define IO_SPACE_LIMIT (0xFFFFFFFF) | ||
17 | |||
18 | #endif | ||
diff --git a/arch/arm/mach-s5p6440/include/mach/irqs.h b/arch/arm/mach-s5p6440/include/mach/irqs.h new file mode 100644 index 000000000000..a4b9b40d18f2 --- /dev/null +++ b/arch/arm/mach-s5p6440/include/mach/irqs.h | |||
@@ -0,0 +1,111 @@ | |||
1 | /* linux/arch/arm/mach-s5p6440/include/mach/irqs.h | ||
2 | * | ||
3 | * Copyright 2009 Samsung Electronics Co., Ltd. | ||
4 | * http://www.samsung.com/ | ||
5 | * | ||
6 | * S5P6440 - IRQ definitions | ||
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 | #ifndef __ASM_ARCH_S5P_IRQS_H | ||
14 | #define __ASM_ARCH_S5P_IRQS_H __FILE__ | ||
15 | |||
16 | #include <plat/irqs.h> | ||
17 | |||
18 | /* VIC0 */ | ||
19 | |||
20 | #define IRQ_EINT0_3 S5P_IRQ_VIC0(0) | ||
21 | #define IRQ_EINT4_11 S5P_IRQ_VIC0(1) | ||
22 | #define IRQ_RTC_TIC S5P_IRQ_VIC0(2) | ||
23 | #define IRQ_IIC1 S5P_IRQ_VIC0(5) | ||
24 | #define IRQ_I2SV40 S5P_IRQ_VIC0(6) | ||
25 | #define IRQ_GPS S5P_IRQ_VIC0(7) | ||
26 | #define IRQ_POST0 S5P_IRQ_VIC0(9) | ||
27 | #define IRQ_2D S5P_IRQ_VIC0(11) | ||
28 | #define IRQ_TIMER0_VIC S5P_IRQ_VIC0(23) | ||
29 | #define IRQ_TIMER1_VIC S5P_IRQ_VIC0(24) | ||
30 | #define IRQ_TIMER2_VIC S5P_IRQ_VIC0(25) | ||
31 | #define IRQ_WDT S5P_IRQ_VIC0(26) | ||
32 | #define IRQ_TIMER3_VIC S5P_IRQ_VIC0(27) | ||
33 | #define IRQ_TIMER4_VIC S5P_IRQ_VIC0(28) | ||
34 | #define IRQ_DISPCON0 S5P_IRQ_VIC0(29) | ||
35 | #define IRQ_DISPCON1 S5P_IRQ_VIC0(30) | ||
36 | #define IRQ_DISPCON2 S5P_IRQ_VIC0(31) | ||
37 | |||
38 | /* VIC1 */ | ||
39 | |||
40 | #define IRQ_EINT12_15 S5P_IRQ_VIC1(0) | ||
41 | #define IRQ_PCM0 S5P_IRQ_VIC1(2) | ||
42 | #define IRQ_UART0 S5P_IRQ_VIC1(5) | ||
43 | #define IRQ_UART1 S5P_IRQ_VIC1(6) | ||
44 | #define IRQ_UART2 S5P_IRQ_VIC1(7) | ||
45 | #define IRQ_UART3 S5P_IRQ_VIC1(8) | ||
46 | #define IRQ_DMA0 S5P_IRQ_VIC1(9) | ||
47 | #define IRQ_NFC S5P_IRQ_VIC1(13) | ||
48 | #define IRQ_SPI0 S5P_IRQ_VIC1(16) | ||
49 | #define IRQ_SPI1 S5P_IRQ_VIC1(17) | ||
50 | #define IRQ_IIC S5P_IRQ_VIC1(18) | ||
51 | #define IRQ_DISPCON3 S5P_IRQ_VIC1(19) | ||
52 | #define IRQ_FIMGVG S5P_IRQ_VIC1(20) | ||
53 | #define IRQ_EINT_GROUPS S5P_IRQ_VIC1(21) | ||
54 | #define IRQ_PMUIRQ S5P_IRQ_VIC1(23) | ||
55 | #define IRQ_HSMMC0 S5P_IRQ_VIC1(24) | ||
56 | #define IRQ_HSMMC1 S5P_IRQ_VIC1(25) | ||
57 | #define IRQ_HSMMC2 IRQ_SPI1 /* shared with SPI1 */ | ||
58 | #define IRQ_OTG S5P_IRQ_VIC1(26) | ||
59 | #define IRQ_DSI S5P_IRQ_VIC1(27) | ||
60 | #define IRQ_RTC_ALARM S5P_IRQ_VIC1(28) | ||
61 | #define IRQ_TSI S5P_IRQ_VIC1(29) | ||
62 | #define IRQ_PENDN S5P_IRQ_VIC1(30) | ||
63 | #define IRQ_TC IRQ_PENDN | ||
64 | #define IRQ_ADC S5P_IRQ_VIC1(31) | ||
65 | |||
66 | /* | ||
67 | * Since the IRQ_EINT(x) are a linear mapping on s5p6440 we just defined | ||
68 | * them as an IRQ_EINT(x) macro from S5P_IRQ_EINT_BASE which we place | ||
69 | * after the pair of VICs. | ||
70 | */ | ||
71 | |||
72 | #define S5P_IRQ_EINT_BASE (S5P_IRQ_VIC1(31) + 6) | ||
73 | |||
74 | #define S5P_EINT(x) ((x) + S5P_IRQ_EINT_BASE) | ||
75 | #define IRQ_EINT(x) S5P_EINT(x) | ||
76 | |||
77 | /* | ||
78 | * Next the external interrupt groups. These are similar to the IRQ_EINT(x) | ||
79 | * that they are sourced from the GPIO pins but with a different scheme for | ||
80 | * priority and source indication. | ||
81 | * | ||
82 | * The IRQ_EINT(x) can be thought of as 'group 0' of the available GPIO | ||
83 | * interrupts, but for historical reasons they are kept apart from these | ||
84 | * next interrupts. | ||
85 | * | ||
86 | * Use IRQ_EINT_GROUP(group, offset) to get the number for use in the | ||
87 | * machine specific support files. | ||
88 | */ | ||
89 | |||
90 | /* Actually, #6 and #7 are missing in the EINT_GROUP1 */ | ||
91 | #define IRQ_EINT_GROUP1_NR (15) | ||
92 | #define IRQ_EINT_GROUP2_NR (8) | ||
93 | #define IRQ_EINT_GROUP5_NR (7) | ||
94 | #define IRQ_EINT_GROUP6_NR (10) | ||
95 | /* Actually, #0, #1 and #2 are missing in the EINT_GROUP8 */ | ||
96 | #define IRQ_EINT_GROUP8_NR (11) | ||
97 | |||
98 | #define IRQ_EINT_GROUP_BASE S5P_EINT(16) | ||
99 | #define IRQ_EINT_GROUP1_BASE (IRQ_EINT_GROUP_BASE + 0) | ||
100 | #define IRQ_EINT_GROUP2_BASE (IRQ_EINT_GROUP1_BASE + IRQ_EINT_GROUP1_NR) | ||
101 | #define IRQ_EINT_GROUP5_BASE (IRQ_EINT_GROUP2_BASE + IRQ_EINT_GROUP2_NR) | ||
102 | #define IRQ_EINT_GROUP6_BASE (IRQ_EINT_GROUP5_BASE + IRQ_EINT_GROUP5_NR) | ||
103 | #define IRQ_EINT_GROUP8_BASE (IRQ_EINT_GROUP6_BASE + IRQ_EINT_GROUP6_NR) | ||
104 | |||
105 | #define IRQ_EINT_GROUP(grp, x) (IRQ_EINT_GROUP##grp##_BASE + (x)) | ||
106 | |||
107 | /* Set the default NR_IRQS */ | ||
108 | |||
109 | #define NR_IRQS (IRQ_EINT_GROUP8_BASE + IRQ_EINT_GROUP8_NR + 1) | ||
110 | |||
111 | #endif /* __ASM_ARCH_S5P_IRQS_H */ | ||
diff --git a/arch/arm/mach-s5p6440/include/mach/map.h b/arch/arm/mach-s5p6440/include/mach/map.h new file mode 100644 index 000000000000..8924e5a4d6a6 --- /dev/null +++ b/arch/arm/mach-s5p6440/include/mach/map.h | |||
@@ -0,0 +1,68 @@ | |||
1 | /* linux/arch/arm/mach-s5p6440/include/mach/map.h | ||
2 | * | ||
3 | * Copyright (c) 2009 Samsung Electronics Co., Ltd. | ||
4 | * http://www.samsung.com/ | ||
5 | * | ||
6 | * S5P6440 - Memory map definitions | ||
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 | #ifndef __ASM_ARCH_MAP_H | ||
14 | #define __ASM_ARCH_MAP_H __FILE__ | ||
15 | |||
16 | #include <plat/map-base.h> | ||
17 | #include <plat/map-s5p.h> | ||
18 | |||
19 | #define S5P6440_PA_CHIPID (0xE0000000) | ||
20 | #define S5P_PA_CHIPID S5P6440_PA_CHIPID | ||
21 | |||
22 | #define S5P6440_PA_SYSCON (0xE0100000) | ||
23 | #define S5P6440_PA_CLK (S5P6440_PA_SYSCON + 0x0) | ||
24 | #define S5P_PA_SYSCON S5P6440_PA_SYSCON | ||
25 | |||
26 | #define S5P6440_PA_GPIO (0xE0308000) | ||
27 | #define S5P_PA_GPIO S5P6440_PA_GPIO | ||
28 | |||
29 | #define S5P6440_PA_VIC0 (0xE4000000) | ||
30 | #define S5P_PA_VIC0 S5P6440_PA_VIC0 | ||
31 | |||
32 | #define S5P6440_PA_VIC1 (0xE4100000) | ||
33 | #define S5P_PA_VIC1 S5P6440_PA_VIC1 | ||
34 | |||
35 | #define S5P6440_PA_TIMER (0xEA000000) | ||
36 | #define S5P_PA_TIMER S5P6440_PA_TIMER | ||
37 | |||
38 | #define S5P6440_PA_RTC (0xEA100000) | ||
39 | #define S5P_PA_RTC S5P6440_PA_RTC | ||
40 | |||
41 | #define S5P6440_PA_WDT (0xEA200000) | ||
42 | #define S5P_PA_WDT S5P6440_PA_WDT | ||
43 | |||
44 | #define S5P6440_PA_UART (0xEC000000) | ||
45 | |||
46 | #define S5P_PA_UART0 (S5P6440_PA_UART + 0x0) | ||
47 | #define S5P_PA_UART1 (S5P6440_PA_UART + 0x400) | ||
48 | #define S5P_PA_UART2 (S5P6440_PA_UART + 0x800) | ||
49 | #define S5P_PA_UART3 (S5P6440_PA_UART + 0xC00) | ||
50 | |||
51 | #define S5P_SZ_UART SZ_256 | ||
52 | |||
53 | #define S5P6440_PA_IIC0 (0xEC104000) | ||
54 | |||
55 | #define S5P6440_PA_HSOTG (0xED100000) | ||
56 | |||
57 | #define S5P6440_PA_HSMMC0 (0xED800000) | ||
58 | #define S5P6440_PA_HSMMC1 (0xED900000) | ||
59 | #define S5P6440_PA_HSMMC2 (0xEDA00000) | ||
60 | |||
61 | #define S5P6440_PA_SDRAM (0x20000000) | ||
62 | #define S5P_PA_SDRAM S5P6440_PA_SDRAM | ||
63 | |||
64 | /* compatibiltiy defines. */ | ||
65 | #define S3C_PA_UART S5P6440_PA_UART | ||
66 | #define S3C_PA_IIC S5P6440_PA_IIC0 | ||
67 | |||
68 | #endif /* __ASM_ARCH_MAP_H */ | ||
diff --git a/arch/arm/mach-s5p6440/include/mach/memory.h b/arch/arm/mach-s5p6440/include/mach/memory.h new file mode 100644 index 000000000000..d62910c71b56 --- /dev/null +++ b/arch/arm/mach-s5p6440/include/mach/memory.h | |||
@@ -0,0 +1,19 @@ | |||
1 | /* linux/arch/arm/mach-s5p6440/include/mach/memory.h | ||
2 | * | ||
3 | * Copyright (c) 2009 Samsung Electronics Co., Ltd. | ||
4 | * http://www.samsung.com/ | ||
5 | * | ||
6 | * S5P6440 - Memory definitions | ||
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 | #ifndef __ASM_ARCH_MEMORY_H | ||
14 | #define __ASM_ARCH_MEMORY_H | ||
15 | |||
16 | #define PHYS_OFFSET UL(0x20000000) | ||
17 | #define CONSISTENT_DMA_SIZE SZ_8M | ||
18 | |||
19 | #endif /* __ASM_ARCH_MEMORY_H */ | ||
diff --git a/arch/arm/mach-s5p6440/include/mach/pwm-clock.h b/arch/arm/mach-s5p6440/include/mach/pwm-clock.h new file mode 100644 index 000000000000..c4bb7c555477 --- /dev/null +++ b/arch/arm/mach-s5p6440/include/mach/pwm-clock.h | |||
@@ -0,0 +1,62 @@ | |||
1 | /* linux/arch/arm/mach-s5p6440/include/mach/pwm-clock.h | ||
2 | * | ||
3 | * Copyright 2008 Simtec Electronics | ||
4 | * Ben Dooks <ben@simtec.co.uk> | ||
5 | * http://armlinux.simtec.co.uk/ | ||
6 | * | ||
7 | * Copyright 2009 Samsung Electronics Co., Ltd. | ||
8 | * http://www.samsung.com/ | ||
9 | * | ||
10 | * S5P6440 - pwm clock and timer support | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or modify | ||
13 | * it under the terms of the GNU General Public License version 2 as | ||
14 | * published by the Free Software Foundation. | ||
15 | */ | ||
16 | |||
17 | /** | ||
18 | * pwm_cfg_src_is_tclk() - return whether the given mux config is a tclk | ||
19 | * @cfg: The timer TCFG1 register bits shifted down to 0. | ||
20 | * | ||
21 | * Return true if the given configuration from TCFG1 is a TCLK instead | ||
22 | * any of the TDIV clocks. | ||
23 | */ | ||
24 | static inline int pwm_cfg_src_is_tclk(unsigned long tcfg) | ||
25 | { | ||
26 | return tcfg == S3C2410_TCFG1_MUX_TCLK; | ||
27 | } | ||
28 | |||
29 | /** | ||
30 | * tcfg_to_divisor() - convert tcfg1 setting to a divisor | ||
31 | * @tcfg1: The tcfg1 setting, shifted down. | ||
32 | * | ||
33 | * Get the divisor value for the given tcfg1 setting. We assume the | ||
34 | * caller has already checked to see if this is not a TCLK source. | ||
35 | */ | ||
36 | static inline unsigned long tcfg_to_divisor(unsigned long tcfg1) | ||
37 | { | ||
38 | return 1 << (1 + tcfg1); | ||
39 | } | ||
40 | |||
41 | /** | ||
42 | * pwm_tdiv_has_div1() - does the tdiv setting have a /1 | ||
43 | * | ||
44 | * Return true if we have a /1 in the tdiv setting. | ||
45 | */ | ||
46 | static inline unsigned int pwm_tdiv_has_div1(void) | ||
47 | { | ||
48 | return 0; | ||
49 | } | ||
50 | |||
51 | /** | ||
52 | * pwm_tdiv_div_bits() - calculate TCFG1 divisor value. | ||
53 | * @div: The divisor to calculate the bit information for. | ||
54 | * | ||
55 | * Turn a divisor into the necessary bit field for TCFG1. | ||
56 | */ | ||
57 | static inline unsigned long pwm_tdiv_div_bits(unsigned int div) | ||
58 | { | ||
59 | return ilog2(div) - 1; | ||
60 | } | ||
61 | |||
62 | #define S3C_TCFG1_MUX_TCLK S3C2410_TCFG1_MUX_TCLK | ||
diff --git a/arch/arm/mach-s5p6440/include/mach/regs-clock.h b/arch/arm/mach-s5p6440/include/mach/regs-clock.h new file mode 100644 index 000000000000..c783ecc9f193 --- /dev/null +++ b/arch/arm/mach-s5p6440/include/mach/regs-clock.h | |||
@@ -0,0 +1,130 @@ | |||
1 | /* linux/arch/arm/mach-s5p6440/include/mach/regs-clock.h | ||
2 | * | ||
3 | * Copyright (c) 2009 Samsung Electronics Co., Ltd. | ||
4 | * http://www.samsung.com/ | ||
5 | * | ||
6 | * S5P6440 - Clock register definitions | ||
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 | #ifndef __ASM_ARCH_REGS_CLOCK_H | ||
14 | #define __ASM_ARCH_REGS_CLOCK_H __FILE__ | ||
15 | |||
16 | #include <mach/map.h> | ||
17 | |||
18 | #define S5P_CLKREG(x) (S3C_VA_SYS + (x)) | ||
19 | |||
20 | #define S5P_APLL_LOCK S5P_CLKREG(0x00) | ||
21 | #define S5P_MPLL_LOCK S5P_CLKREG(0x04) | ||
22 | #define S5P_EPLL_LOCK S5P_CLKREG(0x08) | ||
23 | #define S5P_APLL_CON S5P_CLKREG(0x0C) | ||
24 | #define S5P_MPLL_CON S5P_CLKREG(0x10) | ||
25 | #define S5P_EPLL_CON S5P_CLKREG(0x14) | ||
26 | #define S5P_EPLL_CON_K S5P_CLKREG(0x18) | ||
27 | #define S5P_CLK_SRC0 S5P_CLKREG(0x1C) | ||
28 | #define S5P_CLK_DIV0 S5P_CLKREG(0x20) | ||
29 | #define S5P_CLK_DIV1 S5P_CLKREG(0x24) | ||
30 | #define S5P_CLK_DIV2 S5P_CLKREG(0x28) | ||
31 | #define S5P_CLK_OUT S5P_CLKREG(0x2C) | ||
32 | #define S5P_CLK_GATE_HCLK0 S5P_CLKREG(0x30) | ||
33 | #define S5P_CLK_GATE_PCLK S5P_CLKREG(0x34) | ||
34 | #define S5P_CLK_GATE_SCLK0 S5P_CLKREG(0x38) | ||
35 | #define S5P_CLK_GATE_MEM0 S5P_CLKREG(0x3C) | ||
36 | #define S5P_CLK_DIV3 S5P_CLKREG(0x40) | ||
37 | #define S5P_CLK_GATE_HCLK1 S5P_CLKREG(0x44) | ||
38 | #define S5P_CLK_GATE_SCLK1 S5P_CLKREG(0x48) | ||
39 | #define S5P_AHB_CON0 S5P_CLKREG(0x100) | ||
40 | #define S5P_CLK_SRC1 S5P_CLKREG(0x10C) | ||
41 | #define S5P_SWRESET S5P_CLKREG(0x114) | ||
42 | #define S5P_SYS_ID S5P_CLKREG(0x118) | ||
43 | #define S5P_SYS_OTHERS S5P_CLKREG(0x11C) | ||
44 | #define S5P_MEM_CFG_STAT S5P_CLKREG(0x12C) | ||
45 | #define S5P_PWR_CFG S5P_CLKREG(0x804) | ||
46 | #define S5P_EINT_WAKEUP_MASK S5P_CLKREG(0x808) | ||
47 | #define S5P_NORMAL_CFG S5P_CLKREG(0x810) | ||
48 | #define S5P_STOP_CFG S5P_CLKREG(0x814) | ||
49 | #define S5P_SLEEP_CFG S5P_CLKREG(0x818) | ||
50 | #define S5P_OSC_FREQ S5P_CLKREG(0x820) | ||
51 | #define S5P_OSC_STABLE S5P_CLKREG(0x824) | ||
52 | #define S5P_PWR_STABLE S5P_CLKREG(0x828) | ||
53 | #define S5P_MTC_STABLE S5P_CLKREG(0x830) | ||
54 | #define S5P_OTHERS S5P_CLKREG(0x900) | ||
55 | #define S5P_RST_STAT S5P_CLKREG(0x904) | ||
56 | #define S5P_WAKEUP_STAT S5P_CLKREG(0x908) | ||
57 | #define S5P_SLPEN S5P_CLKREG(0x930) | ||
58 | #define S5P_INFORM0 S5P_CLKREG(0xA00) | ||
59 | #define S5P_INFORM1 S5P_CLKREG(0xA04) | ||
60 | #define S5P_INFORM2 S5P_CLKREG(0xA08) | ||
61 | #define S5P_INFORM3 S5P_CLKREG(0xA0C) | ||
62 | |||
63 | /* CLKDIV0 */ | ||
64 | #define S5P_CLKDIV0_PCLK_MASK (0xf << 12) | ||
65 | #define S5P_CLKDIV0_PCLK_SHIFT (12) | ||
66 | #define S5P_CLKDIV0_HCLK_MASK (0xf << 8) | ||
67 | #define S5P_CLKDIV0_HCLK_SHIFT (8) | ||
68 | #define S5P_CLKDIV0_MPLL_MASK (0x1 << 4) | ||
69 | #define S5P_CLKDIV0_ARM_MASK (0xf << 0) | ||
70 | #define S5P_CLKDIV0_ARM_SHIFT (0) | ||
71 | |||
72 | /* CLKDIV3 */ | ||
73 | #define S5P_CLKDIV3_PCLK_LOW_MASK (0xf << 12) | ||
74 | #define S5P_CLKDIV3_PCLK_LOW_SHIFT (12) | ||
75 | #define S5P_CLKDIV3_HCLK_LOW_MASK (0xf << 8) | ||
76 | #define S5P_CLKDIV3_HCLK_LOW_SHIFT (8) | ||
77 | |||
78 | /* HCLK0 GATE Registers */ | ||
79 | #define S5P_CLKCON_HCLK0_USB (1<<20) | ||
80 | #define S5P_CLKCON_HCLK0_HSMMC2 (1<<19) | ||
81 | #define S5P_CLKCON_HCLK0_HSMMC1 (1<<18) | ||
82 | #define S5P_CLKCON_HCLK0_HSMMC0 (1<<17) | ||
83 | #define S5P_CLKCON_HCLK0_POST0 (1<<5) | ||
84 | |||
85 | /* HCLK1 GATE Registers */ | ||
86 | #define S5P_CLKCON_HCLK1_DISPCON (1<<1) | ||
87 | |||
88 | /* PCLK GATE Registers */ | ||
89 | #define S5P_CLKCON_PCLK_IIS2 (1<<26) | ||
90 | #define S5P_CLKCON_PCLK_SPI1 (1<<22) | ||
91 | #define S5P_CLKCON_PCLK_SPI0 (1<<21) | ||
92 | #define S5P_CLKCON_PCLK_GPIO (1<<18) | ||
93 | #define S5P_CLKCON_PCLK_IIC0 (1<<17) | ||
94 | #define S5P_CLKCON_PCLK_TSADC (1<<12) | ||
95 | #define S5P_CLKCON_PCLK_PWM (1<<7) | ||
96 | #define S5P_CLKCON_PCLK_RTC (1<<6) | ||
97 | #define S5P_CLKCON_PCLK_WDT (1<<5) | ||
98 | #define S5P_CLKCON_PCLK_UART3 (1<<4) | ||
99 | #define S5P_CLKCON_PCLK_UART2 (1<<3) | ||
100 | #define S5P_CLKCON_PCLK_UART1 (1<<2) | ||
101 | #define S5P_CLKCON_PCLK_UART0 (1<<1) | ||
102 | |||
103 | /* SCLK0 GATE Registers */ | ||
104 | #define S5P_CLKCON_SCLK0_MMC2_48 (1<<29) | ||
105 | #define S5P_CLKCON_SCLK0_MMC1_48 (1<<28) | ||
106 | #define S5P_CLKCON_SCLK0_MMC0_48 (1<<27) | ||
107 | #define S5P_CLKCON_SCLK0_MMC2 (1<<26) | ||
108 | #define S5P_CLKCON_SCLK0_MMC1 (1<<25) | ||
109 | #define S5P_CLKCON_SCLK0_MMC0 (1<<24) | ||
110 | #define S5P_CLKCON_SCLK0_SPI1_48 (1<<23) | ||
111 | #define S5P_CLKCON_SCLK0_SPI0_48 (1<<22) | ||
112 | #define S5P_CLKCON_SCLK0_SPI1 (1<<21) | ||
113 | #define S5P_CLKCON_SCLK0_SPI0 (1<<20) | ||
114 | #define S5P_CLKCON_SCLK0_UART (1<<5) | ||
115 | |||
116 | /* SCLK1 GATE Registers */ | ||
117 | |||
118 | /* MEM0 GATE Registers */ | ||
119 | #define S5P_CLKCON_MEM0_HCLK_NFCON (1<<2) | ||
120 | |||
121 | /*OTHERS Resgister */ | ||
122 | #define S5P_OTHERS_USB_SIG_MASK (1<<16) | ||
123 | #define S5P_OTHERS_HCLK_LOW_SEL_MPLL (1<<6) | ||
124 | |||
125 | /* Compatibility defines */ | ||
126 | #define ARM_CLK_DIV S5P_CLK_DIV0 | ||
127 | #define ARM_DIV_RATIO_SHIFT 0 | ||
128 | #define ARM_DIV_MASK (0xf << ARM_DIV_RATIO_SHIFT) | ||
129 | |||
130 | #endif /* __ASM_ARCH_REGS_CLOCK_H */ | ||
diff --git a/arch/arm/mach-s5p6440/include/mach/regs-gpio.h b/arch/arm/mach-s5p6440/include/mach/regs-gpio.h new file mode 100644 index 000000000000..82ff753913da --- /dev/null +++ b/arch/arm/mach-s5p6440/include/mach/regs-gpio.h | |||
@@ -0,0 +1,54 @@ | |||
1 | /* linux/arch/arm/mach-s5p6440/include/mach/regs-gpio.h | ||
2 | * | ||
3 | * Copyright (c) 2009 Samsung Electronics Co., Ltd. | ||
4 | * http://www.samsung.com/ | ||
5 | * | ||
6 | * S5P6440 - GPIO register definitions | ||
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 | #ifndef __ASM_ARCH_REGS_GPIO_H | ||
14 | #define __ASM_ARCH_REGS_GPIO_H __FILE__ | ||
15 | |||
16 | #include <mach/map.h> | ||
17 | |||
18 | /* Base addresses for each of the banks */ | ||
19 | #define S5P6440_GPA_BASE (S5P_VA_GPIO + 0x0000) | ||
20 | #define S5P6440_GPB_BASE (S5P_VA_GPIO + 0x0020) | ||
21 | #define S5P6440_GPC_BASE (S5P_VA_GPIO + 0x0040) | ||
22 | #define S5P6440_GPF_BASE (S5P_VA_GPIO + 0x00A0) | ||
23 | #define S5P6440_GPG_BASE (S5P_VA_GPIO + 0x00C0) | ||
24 | #define S5P6440_GPH_BASE (S5P_VA_GPIO + 0x00E0) | ||
25 | #define S5P6440_GPI_BASE (S5P_VA_GPIO + 0x0100) | ||
26 | #define S5P6440_GPJ_BASE (S5P_VA_GPIO + 0x0120) | ||
27 | #define S5P6440_GPN_BASE (S5P_VA_GPIO + 0x0830) | ||
28 | #define S5P6440_GPP_BASE (S5P_VA_GPIO + 0x0160) | ||
29 | #define S5P6440_GPR_BASE (S5P_VA_GPIO + 0x0290) | ||
30 | #define S5P6440_EINT0CON0 (S5P_VA_GPIO + 0x900) | ||
31 | #define S5P6440_EINT0FLTCON0 (S5P_VA_GPIO + 0x910) | ||
32 | #define S5P6440_EINT0FLTCON1 (S5P_VA_GPIO + 0x914) | ||
33 | #define S5P6440_EINT0MASK (S5P_VA_GPIO + 0x920) | ||
34 | #define S5P6440_EINT0PEND (S5P_VA_GPIO + 0x924) | ||
35 | |||
36 | /* for LCD */ | ||
37 | #define S5P6440_SPCON_LCD_SEL_RGB (1 << 0) | ||
38 | #define S5P6440_SPCON_LCD_SEL_MASK (3 << 0) | ||
39 | |||
40 | /* These set of macros are not really useful for the | ||
41 | * GPF/GPI/GPJ/GPN/GPP, | ||
42 | * useful for others set of GPIO's (4 bit) | ||
43 | */ | ||
44 | #define S5P6440_GPIO_CONMASK(__gpio) (0xf << ((__gpio) * 4)) | ||
45 | #define S5P6440_GPIO_INPUT(__gpio) (0x0 << ((__gpio) * 4)) | ||
46 | #define S5P6440_GPIO_OUTPUT(__gpio) (0x1 << ((__gpio) * 4)) | ||
47 | |||
48 | /* Use these macros for GPF/GPI/GPJ/GPN/GPP set of GPIO (2 bit) | ||
49 | * */ | ||
50 | #define S5P6440_GPIO2_CONMASK(__gpio) (0x3 << ((__gpio) * 2)) | ||
51 | #define S5P6440_GPIO2_INPUT(__gpio) (0x0 << ((__gpio) * 2)) | ||
52 | #define S5P6440_GPIO2_OUTPUT(__gpio) (0x1 << ((__gpio) * 2)) | ||
53 | |||
54 | #endif /* __ASM_ARCH_REGS_GPIO_H */ | ||
diff --git a/arch/arm/mach-s5p6440/include/mach/regs-irq.h b/arch/arm/mach-s5p6440/include/mach/regs-irq.h new file mode 100644 index 000000000000..a961f4beeb0c --- /dev/null +++ b/arch/arm/mach-s5p6440/include/mach/regs-irq.h | |||
@@ -0,0 +1,19 @@ | |||
1 | /* linux/arch/arm/mach-s5p6440/include/mach/regs-irq.h | ||
2 | * | ||
3 | * Copyright (c) 2009 Samsung Electronics Co., Ltd. | ||
4 | * http://www.samsung.com/ | ||
5 | * | ||
6 | * S5P6440 - IRQ register definitions | ||
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 | #ifndef __ASM_ARCH_REGS_IRQ_H | ||
14 | #define __ASM_ARCH_REGS_IRQ_H __FILE__ | ||
15 | |||
16 | #include <asm/hardware/vic.h> | ||
17 | #include <mach/map.h> | ||
18 | |||
19 | #endif /* __ASM_ARCH_REGS_IRQ_H */ | ||
diff --git a/arch/arm/mach-s5p6440/include/mach/system.h b/arch/arm/mach-s5p6440/include/mach/system.h new file mode 100644 index 000000000000..d2dd817da66a --- /dev/null +++ b/arch/arm/mach-s5p6440/include/mach/system.h | |||
@@ -0,0 +1,26 @@ | |||
1 | /* linux/arch/arm/mach-s5p6440/include/mach/system.h | ||
2 | * | ||
3 | * Copyright (c) 2009 Samsung Electronics Co., Ltd. | ||
4 | * http://www.samsung.com/ | ||
5 | * | ||
6 | * S5P6440 - system support header | ||
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 | #ifndef __ASM_ARCH_SYSTEM_H | ||
14 | #define __ASM_ARCH_SYSTEM_H __FILE__ | ||
15 | |||
16 | static void arch_idle(void) | ||
17 | { | ||
18 | /* nothing here yet */ | ||
19 | } | ||
20 | |||
21 | static void arch_reset(char mode, const char *cmd) | ||
22 | { | ||
23 | /* nothing here yet */ | ||
24 | } | ||
25 | |||
26 | #endif /* __ASM_ARCH_SYSTEM_H */ | ||
diff --git a/arch/arm/mach-s5p6440/include/mach/tick.h b/arch/arm/mach-s5p6440/include/mach/tick.h new file mode 100644 index 000000000000..2f25c7f07970 --- /dev/null +++ b/arch/arm/mach-s5p6440/include/mach/tick.h | |||
@@ -0,0 +1,24 @@ | |||
1 | /* linux/arch/arm/mach-s5p6440/include/mach/tick.h | ||
2 | * | ||
3 | * Copyright (c) 2009 Samsung Electronics Co., Ltd. | ||
4 | * http://www.samsung.com/ | ||
5 | * | ||
6 | * S5P6440 - Timer tick support definitions | ||
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 | #ifndef __ASM_ARCH_TICK_H | ||
14 | #define __ASM_ARCH_TICK_H __FILE__ | ||
15 | |||
16 | static inline u32 s3c24xx_ostimer_pending(void) | ||
17 | { | ||
18 | u32 pend = __raw_readl(VA_VIC0 + VIC_RAW_STATUS); | ||
19 | return pend & (1 << (IRQ_TIMER4_VIC - S5P_IRQ_VIC0(0))); | ||
20 | } | ||
21 | |||
22 | #define TICK_MAX (0xffffffff) | ||
23 | |||
24 | #endif /* __ASM_ARCH_TICK_H */ | ||
diff --git a/arch/arm/mach-s5p6440/include/mach/timex.h b/arch/arm/mach-s5p6440/include/mach/timex.h new file mode 100644 index 000000000000..fb2e8cd40829 --- /dev/null +++ b/arch/arm/mach-s5p6440/include/mach/timex.h | |||
@@ -0,0 +1,24 @@ | |||
1 | /* arch/arm/mach-s3c64xx/include/mach/timex.h | ||
2 | * | ||
3 | * Copyright (c) 2003-2005 Simtec Electronics | ||
4 | * Ben Dooks <ben@simtec.co.uk> | ||
5 | * | ||
6 | * S3C6400 - time parameters | ||
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 | #ifndef __ASM_ARCH_TIMEX_H | ||
14 | #define __ASM_ARCH_TIMEX_H | ||
15 | |||
16 | /* CLOCK_TICK_RATE needs to be evaluatable by the cpp, so making it | ||
17 | * a variable is useless. It seems as long as we make our timers an | ||
18 | * exact multiple of HZ, any value that makes a 1->1 correspondence | ||
19 | * for the time conversion functions to/from jiffies is acceptable. | ||
20 | */ | ||
21 | |||
22 | #define CLOCK_TICK_RATE 12000000 | ||
23 | |||
24 | #endif /* __ASM_ARCH_TIMEX_H */ | ||
diff --git a/arch/arm/mach-s5p6440/include/mach/uncompress.h b/arch/arm/mach-s5p6440/include/mach/uncompress.h new file mode 100644 index 000000000000..7c1f600d65c0 --- /dev/null +++ b/arch/arm/mach-s5p6440/include/mach/uncompress.h | |||
@@ -0,0 +1,24 @@ | |||
1 | /* linux/arch/arm/mach-s5p6440/include/mach/uncompress.h | ||
2 | * | ||
3 | * Copyright (c) 2009 Samsung Electronics Co., Ltd. | ||
4 | * http://www.samsung.com/ | ||
5 | * | ||
6 | * S5P6440 - uncompress code | ||
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 | #ifndef __ASM_ARCH_UNCOMPRESS_H | ||
14 | #define __ASM_ARCH_UNCOMPRESS_H | ||
15 | |||
16 | #include <mach/map.h> | ||
17 | #include <plat/uncompress.h> | ||
18 | |||
19 | static void arch_detect_cpu(void) | ||
20 | { | ||
21 | /* we do not need to do any cpu detection here at the moment. */ | ||
22 | } | ||
23 | |||
24 | #endif /* __ASM_ARCH_UNCOMPRESS_H */ | ||
diff --git a/arch/arm/mach-s5p6440/include/mach/vmalloc.h b/arch/arm/mach-s5p6440/include/mach/vmalloc.h new file mode 100644 index 000000000000..16df257b1dce --- /dev/null +++ b/arch/arm/mach-s5p6440/include/mach/vmalloc.h | |||
@@ -0,0 +1,17 @@ | |||
1 | /* arch/arm/mach-s5p6440/include/mach/vmalloc.h | ||
2 | * | ||
3 | * Copyright 2010 Ben Dooks <ben-linux@fluff.org> | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify | ||
6 | * it under the terms of the GNU General Public License version 2 as | ||
7 | * published by the Free Software Foundation. | ||
8 | * | ||
9 | * S3C6400 vmalloc definition | ||
10 | */ | ||
11 | |||
12 | #ifndef __ASM_ARCH_VMALLOC_H | ||
13 | #define __ASM_ARCH_VMALLOC_H | ||
14 | |||
15 | #define VMALLOC_END (0xE0000000) | ||
16 | |||
17 | #endif /* __ASM_ARCH_VMALLOC_H */ | ||
diff --git a/arch/arm/mach-s5p6440/init.c b/arch/arm/mach-s5p6440/init.c new file mode 100644 index 000000000000..a1f3727e4021 --- /dev/null +++ b/arch/arm/mach-s5p6440/init.c | |||
@@ -0,0 +1,52 @@ | |||
1 | /* linux/arch/arm/mach-s5p6440/init.c | ||
2 | * | ||
3 | * Copyright (c) 2009 Samsung Electronics Co., Ltd. | ||
4 | * http://www.samsung.com/ | ||
5 | * | ||
6 | * S5P6440 - 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 <plat/cpu.h> | ||
19 | #include <plat/devs.h> | ||
20 | #include <plat/s5p6440.h> | ||
21 | #include <plat/regs-serial.h> | ||
22 | |||
23 | static struct s3c24xx_uart_clksrc s5p6440_serial_clocks[] = { | ||
24 | [0] = { | ||
25 | .name = "pclk_low", | ||
26 | .divisor = 1, | ||
27 | .min_baud = 0, | ||
28 | .max_baud = 0, | ||
29 | }, | ||
30 | [1] = { | ||
31 | .name = "uclk1", | ||
32 | .divisor = 1, | ||
33 | .min_baud = 0, | ||
34 | .max_baud = 0, | ||
35 | }, | ||
36 | }; | ||
37 | |||
38 | /* uart registration process */ | ||
39 | void __init s5p6440_common_init_uarts(struct s3c2410_uartcfg *cfg, int no) | ||
40 | { | ||
41 | struct s3c2410_uartcfg *tcfg = cfg; | ||
42 | u32 ucnt; | ||
43 | |||
44 | for (ucnt = 0; ucnt < no; ucnt++, tcfg++) { | ||
45 | if (!tcfg->clocks) { | ||
46 | tcfg->clocks = s5p6440_serial_clocks; | ||
47 | tcfg->clocks_size = ARRAY_SIZE(s5p6440_serial_clocks); | ||
48 | } | ||
49 | } | ||
50 | |||
51 | s3c24xx_init_uartdevs("s3c6400-uart", s5p_uart_resources, cfg, no); | ||
52 | } | ||
diff --git a/arch/arm/mach-s5p6440/mach-smdk6440.c b/arch/arm/mach-s5p6440/mach-smdk6440.c new file mode 100644 index 000000000000..3ae88f2c7c77 --- /dev/null +++ b/arch/arm/mach-s5p6440/mach-smdk6440.c | |||
@@ -0,0 +1,111 @@ | |||
1 | /* linux/arch/arm/mach-s5p6440/mach-smdk6440.c | ||
2 | * | ||
3 | * Copyright (c) 2009 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/delay.h> | ||
17 | #include <linux/init.h> | ||
18 | #include <linux/serial_core.h> | ||
19 | #include <linux/platform_device.h> | ||
20 | #include <linux/io.h> | ||
21 | #include <linux/module.h> | ||
22 | #include <linux/clk.h> | ||
23 | |||
24 | #include <asm/mach/arch.h> | ||
25 | #include <asm/mach/map.h> | ||
26 | |||
27 | #include <mach/hardware.h> | ||
28 | #include <mach/map.h> | ||
29 | |||
30 | #include <asm/irq.h> | ||
31 | #include <asm/mach-types.h> | ||
32 | |||
33 | #include <plat/regs-serial.h> | ||
34 | |||
35 | #include <plat/s5p6440.h> | ||
36 | #include <plat/clock.h> | ||
37 | #include <mach/regs-clock.h> | ||
38 | #include <plat/devs.h> | ||
39 | #include <plat/cpu.h> | ||
40 | #include <plat/pll.h> | ||
41 | |||
42 | #define S5P6440_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \ | ||
43 | S3C2410_UCON_RXILEVEL | \ | ||
44 | S3C2410_UCON_TXIRQMODE | \ | ||
45 | S3C2410_UCON_RXIRQMODE | \ | ||
46 | S3C2410_UCON_RXFIFO_TOI | \ | ||
47 | S3C2443_UCON_RXERR_IRQEN) | ||
48 | |||
49 | #define S5P6440_ULCON_DEFAULT S3C2410_LCON_CS8 | ||
50 | |||
51 | #define S5P6440_UFCON_DEFAULT (S3C2410_UFCON_FIFOMODE | \ | ||
52 | S3C2440_UFCON_TXTRIG16 | \ | ||
53 | S3C2410_UFCON_RXTRIG8) | ||
54 | |||
55 | static struct s3c2410_uartcfg smdk6440_uartcfgs[] __initdata = { | ||
56 | [0] = { | ||
57 | .hwport = 0, | ||
58 | .flags = 0, | ||
59 | .ucon = S5P6440_UCON_DEFAULT, | ||
60 | .ulcon = S5P6440_ULCON_DEFAULT, | ||
61 | .ufcon = S5P6440_UFCON_DEFAULT, | ||
62 | }, | ||
63 | [1] = { | ||
64 | .hwport = 1, | ||
65 | .flags = 0, | ||
66 | .ucon = S5P6440_UCON_DEFAULT, | ||
67 | .ulcon = S5P6440_ULCON_DEFAULT, | ||
68 | .ufcon = S5P6440_UFCON_DEFAULT, | ||
69 | }, | ||
70 | [2] = { | ||
71 | .hwport = 2, | ||
72 | .flags = 0, | ||
73 | .ucon = S5P6440_UCON_DEFAULT, | ||
74 | .ulcon = S5P6440_ULCON_DEFAULT, | ||
75 | .ufcon = S5P6440_UFCON_DEFAULT, | ||
76 | }, | ||
77 | [3] = { | ||
78 | .hwport = 3, | ||
79 | .flags = 0, | ||
80 | .ucon = S5P6440_UCON_DEFAULT, | ||
81 | .ulcon = S5P6440_ULCON_DEFAULT, | ||
82 | .ufcon = S5P6440_UFCON_DEFAULT, | ||
83 | }, | ||
84 | }; | ||
85 | |||
86 | static struct platform_device *smdk6440_devices[] __initdata = { | ||
87 | }; | ||
88 | |||
89 | static void __init smdk6440_map_io(void) | ||
90 | { | ||
91 | s5p_init_io(NULL, 0, S5P_SYS_ID); | ||
92 | s3c24xx_init_clocks(12000000); | ||
93 | s3c24xx_init_uarts(smdk6440_uartcfgs, ARRAY_SIZE(smdk6440_uartcfgs)); | ||
94 | } | ||
95 | |||
96 | static void __init smdk6440_machine_init(void) | ||
97 | { | ||
98 | platform_add_devices(smdk6440_devices, ARRAY_SIZE(smdk6440_devices)); | ||
99 | } | ||
100 | |||
101 | MACHINE_START(SMDK6440, "SMDK6440") | ||
102 | /* Maintainer: Kukjin Kim <kgene.kim@samsung.com> */ | ||
103 | .phys_io = S3C_PA_UART & 0xfff00000, | ||
104 | .io_pg_offst = (((u32)S3C_VA_UART) >> 18) & 0xfffc, | ||
105 | .boot_params = S5P_PA_SDRAM + 0x100, | ||
106 | |||
107 | .init_irq = s5p6440_init_irq, | ||
108 | .map_io = smdk6440_map_io, | ||
109 | .init_machine = smdk6440_machine_init, | ||
110 | .timer = &s3c24xx_timer, | ||
111 | MACHINE_END | ||