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.
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>
19 #include <linux/sysdev.h>
20 #include <linux/serial_core.h>
21 #include <linux/platform_device.h>
22 #include <linux/sched.h>
23 #include <linux/dma-mapping.h>
25 #include <asm/mach/arch.h>
26 #include <asm/mach/map.h>
27 #include <asm/mach/irq.h>
28 #include <asm/proc-fns.h>
31 #include <mach/hardware.h>
33 #include <mach/regs-clock.h>
35 #include <plat/regs-serial.h>
37 #include <plat/devs.h>
38 #include <plat/clock.h>
39 #include <plat/s5p6440.h>
40 #include <plat/s5p6450.h>
41 #include <plat/adc-core.h>
42 #include <plat/fb-core.h>
44 /* Initial IO mappings */
46 static struct map_desc s5p64x0_iodesc
[] __initdata
= {
48 .virtual = (unsigned long)S5P_VA_GPIO
,
49 .pfn
= __phys_to_pfn(S5P64X0_PA_GPIO
),
53 .virtual = (unsigned long)VA_VIC0
,
54 .pfn
= __phys_to_pfn(S5P64X0_PA_VIC0
),
58 .virtual = (unsigned long)VA_VIC1
,
59 .pfn
= __phys_to_pfn(S5P64X0_PA_VIC1
),
65 static struct map_desc s5p6440_iodesc
[] __initdata
= {
67 .virtual = (unsigned long)S3C_VA_UART
,
68 .pfn
= __phys_to_pfn(S5P6440_PA_UART(0)),
74 static struct map_desc s5p6450_iodesc
[] __initdata
= {
76 .virtual = (unsigned long)S3C_VA_UART
,
77 .pfn
= __phys_to_pfn(S5P6450_PA_UART(0)),
81 .virtual = (unsigned long)S3C_VA_UART
+ SZ_512K
,
82 .pfn
= __phys_to_pfn(S5P6450_PA_UART(5)),
88 static void s5p64x0_idle(void)
92 if (!need_resched()) {
93 val
= __raw_readl(S5P64X0_PWR_CFG
);
96 __raw_writel(val
, S5P64X0_PWR_CFG
);
106 * register the standard CPU IO areas
109 void __init
s5p6440_map_io(void)
111 /* initialize any device information early */
112 s3c_adc_setname("s3c64xx-adc");
113 s3c_fb_setname("s5p64x0-fb");
115 iotable_init(s5p64x0_iodesc
, ARRAY_SIZE(s5p64x0_iodesc
));
116 iotable_init(s5p6440_iodesc
, ARRAY_SIZE(s5p6440_iodesc
));
117 init_consistent_dma_size(SZ_8M
);
120 void __init
s5p6450_map_io(void)
122 /* initialize any device information early */
123 s3c_adc_setname("s3c64xx-adc");
124 s3c_fb_setname("s5p64x0-fb");
126 iotable_init(s5p64x0_iodesc
, ARRAY_SIZE(s5p64x0_iodesc
));
127 iotable_init(s5p6450_iodesc
, ARRAY_SIZE(s5p6450_iodesc
));
128 init_consistent_dma_size(SZ_8M
);
132 * s5p64x0_init_clocks
134 * register and setup the CPU clocks
137 void __init
s5p6440_init_clocks(int xtal
)
139 printk(KERN_DEBUG
"%s: initializing clocks\n", __func__
);
141 s3c24xx_register_baseclocks(xtal
);
142 s5p_register_clocks(xtal
);
143 s5p6440_register_clocks();
144 s5p6440_setup_clocks();
147 void __init
s5p6450_init_clocks(int xtal
)
149 printk(KERN_DEBUG
"%s: initializing clocks\n", __func__
);
151 s3c24xx_register_baseclocks(xtal
);
152 s5p_register_clocks(xtal
);
153 s5p6450_register_clocks();
154 s5p6450_setup_clocks();
160 * register the CPU interrupts
163 void __init
s5p6440_init_irq(void)
165 /* S5P6440 supports 2 VIC */
169 * VIC0 is missing IRQ_VIC0[3, 4, 8, 10, (12-22)]
170 * VIC1 is missing IRQ VIC1[1, 3, 4, 10, 11, 12, 14, 15, 22]
175 s5p_init_irq(vic
, ARRAY_SIZE(vic
));
178 void __init
s5p6450_init_irq(void)
180 /* S5P6450 supports only 2 VIC */
184 * VIC0 is missing IRQ_VIC0[(13-15), (21-22)]
185 * VIC1 is missing IRQ VIC1[12, 14, 23]
190 s5p_init_irq(vic
, ARRAY_SIZE(vic
));
193 struct sysdev_class s5p64x0_sysclass
= {
194 .name
= "s5p64x0-core",
197 static struct sys_device s5p64x0_sysdev
= {
198 .cls
= &s5p64x0_sysclass
,
201 static int __init
s5p64x0_core_init(void)
203 return sysdev_class_register(&s5p64x0_sysclass
);
205 core_initcall(s5p64x0_core_init
);
207 int __init
s5p64x0_init(void)
209 printk(KERN_INFO
"S5P64X0(S5P6440/S5P6450): Initializing architecture\n");
211 /* set idle function */
212 pm_idle
= s5p64x0_idle
;
214 return sysdev_register(&s5p64x0_sysdev
);