ARM: S5P64X0: Add S5P64X0(S5P6440 and S5P6450) initialization support
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / arch / arm / mach-s5p64x0 / cpu.c
blobfb90a3004e985059d56a1ace75ea6bb267934607
1 /* linux/arch/arm/mach-s5p64x0/cpu.c
3 * Copyright (c) 2009-2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
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 */
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>
23 #include <asm/mach/arch.h>
24 #include <asm/mach/map.h>
25 #include <asm/mach/irq.h>
26 #include <asm/proc-fns.h>
27 #include <asm/irq.h>
29 #include <mach/hardware.h>
30 #include <mach/map.h>
31 #include <mach/regs-clock.h>
33 #include <plat/regs-serial.h>
34 #include <plat/cpu.h>
35 #include <plat/devs.h>
36 #include <plat/clock.h>
37 #include <plat/s5p6440.h>
38 #include <plat/s5p6450.h>
39 #include <plat/adc-core.h>
41 /* Initial IO mappings */
43 static struct map_desc s5p64x0_iodesc[] __initdata = {
45 .virtual = (unsigned long)S5P_VA_GPIO,
46 .pfn = __phys_to_pfn(S5P64X0_PA_GPIO),
47 .length = SZ_4K,
48 .type = MT_DEVICE,
49 }, {
50 .virtual = (unsigned long)VA_VIC0,
51 .pfn = __phys_to_pfn(S5P64X0_PA_VIC0),
52 .length = SZ_16K,
53 .type = MT_DEVICE,
54 }, {
55 .virtual = (unsigned long)VA_VIC1,
56 .pfn = __phys_to_pfn(S5P64X0_PA_VIC1),
57 .length = SZ_16K,
58 .type = MT_DEVICE,
62 static struct map_desc s5p6440_iodesc[] __initdata = {
64 .virtual = (unsigned long)S3C_VA_UART,
65 .pfn = __phys_to_pfn(S5P6440_PA_UART(0)),
66 .length = SZ_4K,
67 .type = MT_DEVICE,
71 static struct map_desc s5p6450_iodesc[] __initdata = {
73 .virtual = (unsigned long)S3C_VA_UART,
74 .pfn = __phys_to_pfn(S5P6450_PA_UART(0)),
75 .length = SZ_512K,
76 .type = MT_DEVICE,
77 }, {
78 .virtual = (unsigned long)S3C_VA_UART + SZ_512K,
79 .pfn = __phys_to_pfn(S5P6450_PA_UART(5)),
80 .length = SZ_4K,
81 .type = MT_DEVICE,
85 static void s5p64x0_idle(void)
87 unsigned long val;
89 if (!need_resched()) {
90 val = __raw_readl(S5P64X0_PWR_CFG);
91 val &= ~(0x3 << 5);
92 val |= (0x1 << 5);
93 __raw_writel(val, S5P64X0_PWR_CFG);
95 cpu_do_idle();
97 local_irq_enable();
101 * s5p64x0_map_io
103 * register the standard CPU IO areas
106 void __init s5p6440_map_io(void)
108 /* initialize any device information early */
109 s3c_adc_setname("s3c64x0-adc");
111 iotable_init(s5p64x0_iodesc, ARRAY_SIZE(s5p64x0_iodesc));
112 iotable_init(s5p6440_iodesc, ARRAY_SIZE(s5p6440_iodesc));
115 void __init s5p6450_map_io(void)
117 /* initialize any device information early */
118 s3c_adc_setname("s3c64x0-adc");
120 iotable_init(s5p64x0_iodesc, ARRAY_SIZE(s5p64x0_iodesc));
121 iotable_init(s5p6450_iodesc, ARRAY_SIZE(s5p6440_iodesc));
125 * s5p64x0_init_clocks
127 * register and setup the CPU clocks
130 void __init s5p6440_init_clocks(int xtal)
132 printk(KERN_DEBUG "%s: initializing clocks\n", __func__);
134 s3c24xx_register_baseclocks(xtal);
135 s5p_register_clocks(xtal);
136 s5p6440_register_clocks();
137 s5p6440_setup_clocks();
140 void __init s5p6450_init_clocks(int xtal)
142 printk(KERN_DEBUG "%s: initializing clocks\n", __func__);
144 s3c24xx_register_baseclocks(xtal);
145 s5p_register_clocks(xtal);
146 s5p6450_register_clocks();
147 s5p6450_setup_clocks();
151 * s5p64x0_init_irq
153 * register the CPU interrupts
156 void __init s5p6440_init_irq(void)
158 /* S5P6440 supports 2 VIC */
159 u32 vic[2];
162 * VIC0 is missing IRQ_VIC0[3, 4, 8, 10, (12-22)]
163 * VIC1 is missing IRQ VIC1[1, 3, 4, 10, 11, 12, 14, 15, 22]
165 vic[0] = 0xff800ae7;
166 vic[1] = 0xffbf23e5;
168 s5p_init_irq(vic, ARRAY_SIZE(vic));
171 void __init s5p6450_init_irq(void)
173 /* S5P6450 supports only 2 VIC */
174 u32 vic[2];
177 * VIC0 is missing IRQ_VIC0[(13-15), (21-22)]
178 * VIC1 is missing IRQ VIC1[12, 14, 23]
180 vic[0] = 0xff9f1fff;
181 vic[1] = 0xff7fafff;
183 s5p_init_irq(vic, ARRAY_SIZE(vic));
186 struct sysdev_class s5p64x0_sysclass = {
187 .name = "s5p64x0-core",
190 static struct sys_device s5p64x0_sysdev = {
191 .cls = &s5p64x0_sysclass,
194 static int __init s5p64x0_core_init(void)
196 return sysdev_class_register(&s5p64x0_sysclass);
198 core_initcall(s5p64x0_core_init);
200 int __init s5p64x0_init(void)
202 printk(KERN_INFO "S5P64X0(S5P6440/S5P6450): Initializing architecture\n");
204 /* set idle function */
205 pm_idle = s5p64x0_idle;
207 return sysdev_register(&s5p64x0_sysdev);