35cf88e1fa83ad406da3cf6599e28ed390cead22
[firefly-linux-kernel-4.4.55.git] / arch / arm / mach-s3c24xx / common.c
1 /* linux/arch/arm/plat-s3c24xx/cpu.c
2  *
3  * Copyright (c) 2004-2005 Simtec Electronics
4  *      http://www.simtec.co.uk/products/SWLINUX/
5  *      Ben Dooks <ben@simtec.co.uk>
6  *
7  * Common code for S3C24XX machines
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
22 */
23
24
25 #include <linux/init.h>
26 #include <linux/module.h>
27 #include <linux/interrupt.h>
28 #include <linux/ioport.h>
29 #include <linux/serial_core.h>
30 #include <linux/serial_s3c.h>
31 #include <clocksource/samsung_pwm.h>
32 #include <linux/platform_device.h>
33 #include <linux/delay.h>
34 #include <linux/io.h>
35 #include <linux/platform_data/dma-s3c24xx.h>
36
37 #include <mach/hardware.h>
38 #include <mach/regs-clock.h>
39 #include <asm/irq.h>
40 #include <asm/cacheflush.h>
41 #include <asm/system_info.h>
42 #include <asm/system_misc.h>
43
44 #include <asm/mach/arch.h>
45 #include <asm/mach/map.h>
46
47 #include <mach/regs-gpio.h>
48 #include <mach/dma.h>
49
50 #include <plat/cpu.h>
51 #include <plat/devs.h>
52 #include <plat/clock.h>
53 #include <plat/cpu-freq.h>
54 #include <plat/pll.h>
55 #include <plat/pwm-core.h>
56 #include <plat/watchdog-reset.h>
57
58 #include "common.h"
59
60 /* table of supported CPUs */
61
62 static const char name_s3c2410[]  = "S3C2410";
63 static const char name_s3c2412[]  = "S3C2412";
64 static const char name_s3c2416[]  = "S3C2416/S3C2450";
65 static const char name_s3c2440[]  = "S3C2440";
66 static const char name_s3c2442[]  = "S3C2442";
67 static const char name_s3c2442b[]  = "S3C2442B";
68 static const char name_s3c2443[]  = "S3C2443";
69 static const char name_s3c2410a[] = "S3C2410A";
70 static const char name_s3c2440a[] = "S3C2440A";
71
72 static struct cpu_table cpu_ids[] __initdata = {
73         {
74                 .idcode         = 0x32410000,
75                 .idmask         = 0xffffffff,
76                 .map_io         = s3c2410_map_io,
77                 .init_clocks    = s3c2410_init_clocks,
78                 .init_uarts     = s3c2410_init_uarts,
79                 .init           = s3c2410_init,
80                 .name           = name_s3c2410
81         },
82         {
83                 .idcode         = 0x32410002,
84                 .idmask         = 0xffffffff,
85                 .map_io         = s3c2410_map_io,
86                 .init_clocks    = s3c2410_init_clocks,
87                 .init_uarts     = s3c2410_init_uarts,
88                 .init           = s3c2410a_init,
89                 .name           = name_s3c2410a
90         },
91         {
92                 .idcode         = 0x32440000,
93                 .idmask         = 0xffffffff,
94                 .map_io         = s3c2440_map_io,
95                 .init_clocks    = s3c244x_init_clocks,
96                 .init_uarts     = s3c244x_init_uarts,
97                 .init           = s3c2440_init,
98                 .name           = name_s3c2440
99         },
100         {
101                 .idcode         = 0x32440001,
102                 .idmask         = 0xffffffff,
103                 .map_io         = s3c2440_map_io,
104                 .init_clocks    = s3c244x_init_clocks,
105                 .init_uarts     = s3c244x_init_uarts,
106                 .init           = s3c2440_init,
107                 .name           = name_s3c2440a
108         },
109         {
110                 .idcode         = 0x32440aaa,
111                 .idmask         = 0xffffffff,
112                 .map_io         = s3c2442_map_io,
113                 .init_clocks    = s3c244x_init_clocks,
114                 .init_uarts     = s3c244x_init_uarts,
115                 .init           = s3c2442_init,
116                 .name           = name_s3c2442
117         },
118         {
119                 .idcode         = 0x32440aab,
120                 .idmask         = 0xffffffff,
121                 .map_io         = s3c2442_map_io,
122                 .init_clocks    = s3c244x_init_clocks,
123                 .init_uarts     = s3c244x_init_uarts,
124                 .init           = s3c2442_init,
125                 .name           = name_s3c2442b
126         },
127         {
128                 .idcode         = 0x32412001,
129                 .idmask         = 0xffffffff,
130                 .map_io         = s3c2412_map_io,
131                 .init_uarts     = s3c2412_init_uarts,
132                 .init           = s3c2412_init,
133                 .name           = name_s3c2412,
134         },
135         {                       /* a newer version of the s3c2412 */
136                 .idcode         = 0x32412003,
137                 .idmask         = 0xffffffff,
138                 .map_io         = s3c2412_map_io,
139                 .init_uarts     = s3c2412_init_uarts,
140                 .init           = s3c2412_init,
141                 .name           = name_s3c2412,
142         },
143         {                       /* a strange version of the s3c2416 */
144                 .idcode         = 0x32450003,
145                 .idmask         = 0xffffffff,
146                 .map_io         = s3c2416_map_io,
147                 .init_uarts     = s3c2416_init_uarts,
148                 .init           = s3c2416_init,
149                 .name           = name_s3c2416,
150         },
151         {
152                 .idcode         = 0x32443001,
153                 .idmask         = 0xffffffff,
154                 .map_io         = s3c2443_map_io,
155                 .init_uarts     = s3c2443_init_uarts,
156                 .init           = s3c2443_init,
157                 .name           = name_s3c2443,
158         },
159 };
160
161 /* minimal IO mapping */
162
163 static struct map_desc s3c_iodesc[] __initdata = {
164         IODESC_ENT(GPIO),
165         IODESC_ENT(IRQ),
166         IODESC_ENT(MEMCTRL),
167         IODESC_ENT(UART)
168 };
169
170 /* read cpu identificaiton code */
171
172 static unsigned long s3c24xx_read_idcode_v5(void)
173 {
174 #if defined(CONFIG_CPU_S3C2416)
175         /* s3c2416 is v5, with S3C24XX_GSTATUS1 instead of S3C2412_GSTATUS1 */
176
177         u32 gs = __raw_readl(S3C24XX_GSTATUS1);
178
179         /* test for s3c2416 or similar device */
180         if ((gs >> 16) == 0x3245)
181                 return gs;
182 #endif
183
184 #if defined(CONFIG_CPU_S3C2412) || defined(CONFIG_CPU_S3C2413)
185         return __raw_readl(S3C2412_GSTATUS1);
186 #else
187         return 1UL;     /* don't look like an 2400 */
188 #endif
189 }
190
191 static unsigned long s3c24xx_read_idcode_v4(void)
192 {
193         return __raw_readl(S3C2410_GSTATUS1);
194 }
195
196 static void s3c24xx_default_idle(void)
197 {
198         unsigned long tmp = 0;
199         int i;
200
201         /* idle the system by using the idle mode which will wait for an
202          * interrupt to happen before restarting the system.
203          */
204
205         /* Warning: going into idle state upsets jtag scanning */
206
207         __raw_writel(__raw_readl(S3C2410_CLKCON) | S3C2410_CLKCON_IDLE,
208                      S3C2410_CLKCON);
209
210         /* the samsung port seems to do a loop and then unset idle.. */
211         for (i = 0; i < 50; i++)
212                 tmp += __raw_readl(S3C2410_CLKCON); /* ensure loop not optimised out */
213
214         /* this bit is not cleared on re-start... */
215
216         __raw_writel(__raw_readl(S3C2410_CLKCON) & ~S3C2410_CLKCON_IDLE,
217                      S3C2410_CLKCON);
218 }
219
220 static struct samsung_pwm_variant s3c24xx_pwm_variant = {
221         .bits           = 16,
222         .div_base       = 1,
223         .has_tint_cstat = false,
224         .tclk_mask      = (1 << 4),
225 };
226
227 void __init s3c24xx_init_io(struct map_desc *mach_desc, int size)
228 {
229         arm_pm_idle = s3c24xx_default_idle;
230
231         /* initialise the io descriptors we need for initialisation */
232         iotable_init(mach_desc, size);
233         iotable_init(s3c_iodesc, ARRAY_SIZE(s3c_iodesc));
234
235         if (cpu_architecture() >= CPU_ARCH_ARMv5) {
236                 samsung_cpu_id = s3c24xx_read_idcode_v5();
237         } else {
238                 samsung_cpu_id = s3c24xx_read_idcode_v4();
239         }
240
241         s3c_init_cpu(samsung_cpu_id, cpu_ids, ARRAY_SIZE(cpu_ids));
242
243         samsung_pwm_set_platdata(&s3c24xx_pwm_variant);
244 }
245
246 void __init samsung_set_timer_source(unsigned int event, unsigned int source)
247 {
248         s3c24xx_pwm_variant.output_mask = BIT(SAMSUNG_PWM_NUM) - 1;
249         s3c24xx_pwm_variant.output_mask &= ~(BIT(event) | BIT(source));
250 }
251
252 void __init samsung_timer_init(void)
253 {
254         unsigned int timer_irqs[SAMSUNG_PWM_NUM] = {
255                 IRQ_TIMER0, IRQ_TIMER1, IRQ_TIMER2, IRQ_TIMER3, IRQ_TIMER4,
256         };
257
258         samsung_pwm_clocksource_init(S3C_VA_TIMER,
259                                         timer_irqs, &s3c24xx_pwm_variant);
260 }
261
262 /* Serial port registrations */
263
264 #define S3C2410_PA_UART0      (S3C24XX_PA_UART)
265 #define S3C2410_PA_UART1      (S3C24XX_PA_UART + 0x4000 )
266 #define S3C2410_PA_UART2      (S3C24XX_PA_UART + 0x8000 )
267 #define S3C2443_PA_UART3      (S3C24XX_PA_UART + 0xC000 )
268
269 static struct resource s3c2410_uart0_resource[] = {
270         [0] = DEFINE_RES_MEM(S3C2410_PA_UART0, SZ_16K),
271         [1] = DEFINE_RES_NAMED(IRQ_S3CUART_RX0, \
272                         IRQ_S3CUART_ERR0 - IRQ_S3CUART_RX0 + 1, \
273                         NULL, IORESOURCE_IRQ)
274 };
275
276 static struct resource s3c2410_uart1_resource[] = {
277         [0] = DEFINE_RES_MEM(S3C2410_PA_UART1, SZ_16K),
278         [1] = DEFINE_RES_NAMED(IRQ_S3CUART_RX1, \
279                         IRQ_S3CUART_ERR1 - IRQ_S3CUART_RX1 + 1, \
280                         NULL, IORESOURCE_IRQ)
281 };
282
283 static struct resource s3c2410_uart2_resource[] = {
284         [0] = DEFINE_RES_MEM(S3C2410_PA_UART2, SZ_16K),
285         [1] = DEFINE_RES_NAMED(IRQ_S3CUART_RX2, \
286                         IRQ_S3CUART_ERR2 - IRQ_S3CUART_RX2 + 1, \
287                         NULL, IORESOURCE_IRQ)
288 };
289
290 static struct resource s3c2410_uart3_resource[] = {
291         [0] = DEFINE_RES_MEM(S3C2443_PA_UART3, SZ_16K),
292         [1] = DEFINE_RES_NAMED(IRQ_S3CUART_RX3, \
293                         IRQ_S3CUART_ERR3 - IRQ_S3CUART_RX3 + 1, \
294                         NULL, IORESOURCE_IRQ)
295 };
296
297 struct s3c24xx_uart_resources s3c2410_uart_resources[] __initdata = {
298         [0] = {
299                 .resources      = s3c2410_uart0_resource,
300                 .nr_resources   = ARRAY_SIZE(s3c2410_uart0_resource),
301         },
302         [1] = {
303                 .resources      = s3c2410_uart1_resource,
304                 .nr_resources   = ARRAY_SIZE(s3c2410_uart1_resource),
305         },
306         [2] = {
307                 .resources      = s3c2410_uart2_resource,
308                 .nr_resources   = ARRAY_SIZE(s3c2410_uart2_resource),
309         },
310         [3] = {
311                 .resources      = s3c2410_uart3_resource,
312                 .nr_resources   = ARRAY_SIZE(s3c2410_uart3_resource),
313         },
314 };
315
316 /* initialise all the clocks */
317
318 #ifdef CONFIG_SAMSUNG_CLOCK
319 void __init_or_cpufreq s3c24xx_setup_clocks(unsigned long fclk,
320                                            unsigned long hclk,
321                                            unsigned long pclk)
322 {
323         clk_upll.rate = s3c24xx_get_pll(__raw_readl(S3C2410_UPLLCON),
324                                         clk_xtal.rate);
325
326         clk_mpll.rate = fclk;
327         clk_h.rate = hclk;
328         clk_p.rate = pclk;
329         clk_f.rate = fclk;
330 }
331 #endif
332
333 #if defined(CONFIG_CPU_S3C2410) || defined(CONFIG_CPU_S3C2412) || \
334         defined(CONFIG_CPU_S3C2440) || defined(CONFIG_CPU_S3C2442)
335 static struct resource s3c2410_dma_resource[] = {
336         [0] = DEFINE_RES_MEM(S3C24XX_PA_DMA, S3C24XX_SZ_DMA),
337         [1] = DEFINE_RES_IRQ(IRQ_DMA0),
338         [2] = DEFINE_RES_IRQ(IRQ_DMA1),
339         [3] = DEFINE_RES_IRQ(IRQ_DMA2),
340         [4] = DEFINE_RES_IRQ(IRQ_DMA3),
341 };
342 #endif
343
344 #if defined(CONFIG_CPU_S3C2410) || defined(CONFIG_CPU_S3C2442)
345 static struct s3c24xx_dma_channel s3c2410_dma_channels[DMACH_MAX] = {
346         [DMACH_XD0] = { S3C24XX_DMA_AHB, true, S3C24XX_DMA_CHANREQ(0, 0), },
347         [DMACH_XD1] = { S3C24XX_DMA_AHB, true, S3C24XX_DMA_CHANREQ(0, 1), },
348         [DMACH_SDI] = { S3C24XX_DMA_APB, false, S3C24XX_DMA_CHANREQ(2, 0) |
349                                                 S3C24XX_DMA_CHANREQ(2, 2) |
350                                                 S3C24XX_DMA_CHANREQ(1, 3),
351         },
352         [DMACH_SPI0] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(3, 1), },
353         [DMACH_SPI1] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(2, 3), },
354         [DMACH_UART0] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(1, 0), },
355         [DMACH_UART1] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(1, 1), },
356         [DMACH_UART2] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(0, 3), },
357         [DMACH_TIMER] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(3, 0) |
358                                                  S3C24XX_DMA_CHANREQ(3, 2) |
359                                                  S3C24XX_DMA_CHANREQ(3, 3),
360         },
361         [DMACH_I2S_IN] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(2, 1) |
362                                                   S3C24XX_DMA_CHANREQ(1, 2),
363         },
364         [DMACH_I2S_OUT] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(0, 2), },
365         [DMACH_USB_EP1] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(4, 0), },
366         [DMACH_USB_EP2] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(4, 1), },
367         [DMACH_USB_EP3] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(4, 2), },
368         [DMACH_USB_EP4] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(4, 3), },
369 };
370
371 static struct s3c24xx_dma_platdata s3c2410_dma_platdata = {
372         .num_phy_channels = 4,
373         .channels = s3c2410_dma_channels,
374         .num_channels = DMACH_MAX,
375 };
376
377 struct platform_device s3c2410_device_dma = {
378         .name           = "s3c2410-dma",
379         .id             = 0,
380         .num_resources  = ARRAY_SIZE(s3c2410_dma_resource),
381         .resource       = s3c2410_dma_resource,
382         .dev    = {
383                 .platform_data  = &s3c2410_dma_platdata,
384         },
385 };
386 #endif
387
388 #ifdef CONFIG_CPU_S3C2412
389 static struct s3c24xx_dma_channel s3c2412_dma_channels[DMACH_MAX] = {
390         [DMACH_XD0] = { S3C24XX_DMA_AHB, true, 17 },
391         [DMACH_XD1] = { S3C24XX_DMA_AHB, true, 18 },
392         [DMACH_SDI] = { S3C24XX_DMA_APB, false, 10 },
393         [DMACH_SPI0_RX] = { S3C24XX_DMA_APB, true, 1 },
394         [DMACH_SPI0_TX] = { S3C24XX_DMA_APB, true, 0 },
395         [DMACH_SPI1_RX] = { S3C24XX_DMA_APB, true, 3 },
396         [DMACH_SPI1_TX] = { S3C24XX_DMA_APB, true, 2 },
397         [DMACH_UART0] = { S3C24XX_DMA_APB, true, 19 },
398         [DMACH_UART1] = { S3C24XX_DMA_APB, true, 21 },
399         [DMACH_UART2] = { S3C24XX_DMA_APB, true, 23 },
400         [DMACH_UART0_SRC2] = { S3C24XX_DMA_APB, true, 20 },
401         [DMACH_UART1_SRC2] = { S3C24XX_DMA_APB, true, 22 },
402         [DMACH_UART2_SRC2] = { S3C24XX_DMA_APB, true, 24 },
403         [DMACH_TIMER] = { S3C24XX_DMA_APB, true, 9 },
404         [DMACH_I2S_IN] = { S3C24XX_DMA_APB, true, 5 },
405         [DMACH_I2S_OUT] = { S3C24XX_DMA_APB, true, 4 },
406         [DMACH_USB_EP1] = { S3C24XX_DMA_APB, true, 13 },
407         [DMACH_USB_EP2] = { S3C24XX_DMA_APB, true, 14 },
408         [DMACH_USB_EP3] = { S3C24XX_DMA_APB, true, 15 },
409         [DMACH_USB_EP4] = { S3C24XX_DMA_APB, true, 16 },
410 };
411
412 static struct s3c24xx_dma_platdata s3c2412_dma_platdata = {
413         .num_phy_channels = 4,
414         .channels = s3c2412_dma_channels,
415         .num_channels = DMACH_MAX,
416 };
417
418 struct platform_device s3c2412_device_dma = {
419         .name           = "s3c2412-dma",
420         .id             = 0,
421         .num_resources  = ARRAY_SIZE(s3c2410_dma_resource),
422         .resource       = s3c2410_dma_resource,
423         .dev    = {
424                 .platform_data  = &s3c2412_dma_platdata,
425         },
426 };
427 #endif
428
429 #if defined(CONFIG_CPU_S3C2440)
430 static struct s3c24xx_dma_channel s3c2440_dma_channels[DMACH_MAX] = {
431         [DMACH_XD0] = { S3C24XX_DMA_AHB, true, S3C24XX_DMA_CHANREQ(0, 0), },
432         [DMACH_XD1] = { S3C24XX_DMA_AHB, true, S3C24XX_DMA_CHANREQ(0, 1), },
433         [DMACH_SDI] = { S3C24XX_DMA_APB, false, S3C24XX_DMA_CHANREQ(2, 0) |
434                                                 S3C24XX_DMA_CHANREQ(6, 1) |
435                                                 S3C24XX_DMA_CHANREQ(2, 2) |
436                                                 S3C24XX_DMA_CHANREQ(1, 3),
437         },
438         [DMACH_SPI0] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(3, 1), },
439         [DMACH_SPI1] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(2, 3), },
440         [DMACH_UART0] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(1, 0), },
441         [DMACH_UART1] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(1, 1), },
442         [DMACH_UART2] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(0, 3), },
443         [DMACH_TIMER] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(3, 0) |
444                                                  S3C24XX_DMA_CHANREQ(3, 2) |
445                                                  S3C24XX_DMA_CHANREQ(3, 3),
446         },
447         [DMACH_I2S_IN] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(2, 1) |
448                                                   S3C24XX_DMA_CHANREQ(1, 2),
449         },
450         [DMACH_I2S_OUT] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(5, 0) |
451                                                    S3C24XX_DMA_CHANREQ(0, 2),
452         },
453         [DMACH_PCM_IN] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(6, 0) |
454                                                   S3C24XX_DMA_CHANREQ(5, 2),
455         },
456         [DMACH_PCM_OUT] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(5, 1) |
457                                                   S3C24XX_DMA_CHANREQ(6, 3),
458         },
459         [DMACH_MIC_IN] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(6, 2) |
460                                                   S3C24XX_DMA_CHANREQ(5, 3),
461         },
462         [DMACH_USB_EP1] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(4, 0), },
463         [DMACH_USB_EP2] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(4, 1), },
464         [DMACH_USB_EP3] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(4, 2), },
465         [DMACH_USB_EP4] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(4, 3), },
466 };
467
468 static struct s3c24xx_dma_platdata s3c2440_dma_platdata = {
469         .num_phy_channels = 4,
470         .channels = s3c2440_dma_channels,
471         .num_channels = DMACH_MAX,
472 };
473
474 struct platform_device s3c2440_device_dma = {
475         .name           = "s3c2410-dma",
476         .id             = 0,
477         .num_resources  = ARRAY_SIZE(s3c2410_dma_resource),
478         .resource       = s3c2410_dma_resource,
479         .dev    = {
480                 .platform_data  = &s3c2440_dma_platdata,
481         },
482 };
483 #endif
484
485 #if defined(CONFIG_CPU_S3C2443) || defined(CONFIG_CPU_S3C2416)
486 static struct resource s3c2443_dma_resource[] = {
487         [0] = DEFINE_RES_MEM(S3C24XX_PA_DMA, S3C24XX_SZ_DMA),
488         [1] = DEFINE_RES_IRQ(IRQ_S3C2443_DMA0),
489         [2] = DEFINE_RES_IRQ(IRQ_S3C2443_DMA1),
490         [3] = DEFINE_RES_IRQ(IRQ_S3C2443_DMA2),
491         [4] = DEFINE_RES_IRQ(IRQ_S3C2443_DMA3),
492         [5] = DEFINE_RES_IRQ(IRQ_S3C2443_DMA4),
493         [6] = DEFINE_RES_IRQ(IRQ_S3C2443_DMA5),
494 };
495
496 static struct s3c24xx_dma_channel s3c2443_dma_channels[DMACH_MAX] = {
497         [DMACH_XD0] = { S3C24XX_DMA_AHB, true, 17 },
498         [DMACH_XD1] = { S3C24XX_DMA_AHB, true, 18 },
499         [DMACH_SDI] = { S3C24XX_DMA_APB, false, 10 },
500         [DMACH_SPI0_RX] = { S3C24XX_DMA_APB, true, 1 },
501         [DMACH_SPI0_TX] = { S3C24XX_DMA_APB, true, 0 },
502         [DMACH_SPI1_RX] = { S3C24XX_DMA_APB, true, 3 },
503         [DMACH_SPI1_TX] = { S3C24XX_DMA_APB, true, 2 },
504         [DMACH_UART0] = { S3C24XX_DMA_APB, true, 19 },
505         [DMACH_UART1] = { S3C24XX_DMA_APB, true, 21 },
506         [DMACH_UART2] = { S3C24XX_DMA_APB, true, 23 },
507         [DMACH_UART3] = { S3C24XX_DMA_APB, true, 25 },
508         [DMACH_UART0_SRC2] = { S3C24XX_DMA_APB, true, 20 },
509         [DMACH_UART1_SRC2] = { S3C24XX_DMA_APB, true, 22 },
510         [DMACH_UART2_SRC2] = { S3C24XX_DMA_APB, true, 24 },
511         [DMACH_UART3_SRC2] = { S3C24XX_DMA_APB, true, 26 },
512         [DMACH_TIMER] = { S3C24XX_DMA_APB, true, 9 },
513         [DMACH_I2S_IN] = { S3C24XX_DMA_APB, true, 5 },
514         [DMACH_I2S_OUT] = { S3C24XX_DMA_APB, true, 4 },
515         [DMACH_PCM_IN] = { S3C24XX_DMA_APB, true, 28 },
516         [DMACH_PCM_OUT] = { S3C24XX_DMA_APB, true, 27 },
517         [DMACH_MIC_IN] = { S3C24XX_DMA_APB, true, 29 },
518 };
519
520 static struct s3c24xx_dma_platdata s3c2443_dma_platdata = {
521         .num_phy_channels = 6,
522         .channels = s3c2443_dma_channels,
523         .num_channels = DMACH_MAX,
524 };
525
526 struct platform_device s3c2443_device_dma = {
527         .name           = "s3c2443-dma",
528         .id             = 0,
529         .num_resources  = ARRAY_SIZE(s3c2443_dma_resource),
530         .resource       = s3c2443_dma_resource,
531         .dev    = {
532                 .platform_data  = &s3c2443_dma_platdata,
533         },
534 };
535 #endif
536
537 #if defined(CONFIG_COMMON_CLK) && defined(CONFIG_CPU_S3C2410)
538 void __init s3c2410_init_clocks(int xtal)
539 {
540         s3c2410_common_clk_init(NULL, xtal, 0, S3C24XX_VA_CLKPWR);
541         samsung_wdt_reset_init(S3C24XX_VA_WATCHDOG);
542 }
543 #endif
544
545 #ifdef CONFIG_CPU_S3C2412
546 void __init s3c2412_init_clocks(int xtal)
547 {
548         s3c2412_common_clk_init(NULL, xtal, 0, S3C24XX_VA_CLKPWR);
549 }
550 #endif
551
552 #ifdef CONFIG_CPU_S3C2416
553 void __init s3c2416_init_clocks(int xtal)
554 {
555         s3c2443_common_clk_init(NULL, xtal, 0, S3C24XX_VA_CLKPWR);
556 }
557 #endif
558
559 #if defined(CONFIG_COMMON_CLK) && defined(CONFIG_CPU_S3C2440)
560 void __init s3c2440_init_clocks(int xtal)
561 {
562         s3c2410_common_clk_init(NULL, xtal, 1, S3C24XX_VA_CLKPWR);
563         samsung_wdt_reset_init(S3C24XX_VA_WATCHDOG);
564 }
565 #endif
566
567 #if defined(CONFIG_COMMON_CLK) && defined(CONFIG_CPU_S3C2442)
568 void __init s3c2442_init_clocks(int xtal)
569 {
570         s3c2410_common_clk_init(NULL, xtal, 2, S3C24XX_VA_CLKPWR);
571         samsung_wdt_reset_init(S3C24XX_VA_WATCHDOG);
572 }
573 #endif
574
575 #ifdef CONFIG_CPU_S3C2443
576 void __init s3c2443_init_clocks(int xtal)
577 {
578         s3c2443_common_clk_init(NULL, xtal, 1, S3C24XX_VA_CLKPWR);
579 }
580 #endif
581
582 #if defined(CONFIG_CPU_S3C2410) || defined(CONFIG_CPU_S3C2440) || \
583         defined(CONFIG_CPU_S3C2442)
584 static struct resource s3c2410_dclk_resource[] = {
585         [0] = DEFINE_RES_MEM(0x56000084, 0x4),
586 };
587
588 struct platform_device s3c2410_device_dclk = {
589         .name           = "s3c2410-dclk",
590         .id             = 0,
591         .num_resources  = ARRAY_SIZE(s3c2410_dclk_resource),
592         .resource       = s3c2410_dclk_resource,
593 };
594 #endif