Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wirel...
[pandora-kernel.git] / arch / arm / mach-s5p6442 / cpu.c
1 /* linux/arch/arm/mach-s5p6442/cpu.c
2  *
3  * Copyright (c) 2010 Samsung Electronics Co., Ltd.
4  *              http://www.samsung.com/
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 as
8  * published by the Free Software Foundation.
9 */
10
11 #include <linux/kernel.h>
12 #include <linux/types.h>
13 #include <linux/interrupt.h>
14 #include <linux/list.h>
15 #include <linux/timer.h>
16 #include <linux/init.h>
17 #include <linux/clk.h>
18 #include <linux/io.h>
19 #include <linux/sysdev.h>
20 #include <linux/serial_core.h>
21 #include <linux/platform_device.h>
22
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/s5p6442.h>
40
41 /* Initial IO mappings */
42
43 static struct map_desc s5p6442_iodesc[] __initdata = {
44         {
45                 .virtual        = (unsigned long)S5P_VA_SYSTIMER,
46                 .pfn            = __phys_to_pfn(S5P6442_PA_SYSTIMER),
47                 .length         = SZ_16K,
48                 .type           = MT_DEVICE,
49         }, {
50                 .virtual        = (unsigned long)VA_VIC2,
51                 .pfn            = __phys_to_pfn(S5P6442_PA_VIC2),
52                 .length         = SZ_16K,
53                 .type           = MT_DEVICE,
54         }
55 };
56
57 static void s5p6442_idle(void)
58 {
59         if (!need_resched())
60                 cpu_do_idle();
61
62         local_irq_enable();
63 }
64
65 /* s5p6442_map_io
66  *
67  * register the standard cpu IO areas
68 */
69
70 void __init s5p6442_map_io(void)
71 {
72         iotable_init(s5p6442_iodesc, ARRAY_SIZE(s5p6442_iodesc));
73 }
74
75 void __init s5p6442_init_clocks(int xtal)
76 {
77         printk(KERN_DEBUG "%s: initializing clocks\n", __func__);
78
79         s3c24xx_register_baseclocks(xtal);
80         s5p_register_clocks(xtal);
81         s5p6442_register_clocks();
82         s5p6442_setup_clocks();
83 }
84
85 void __init s5p6442_init_irq(void)
86 {
87         /* S5P6442 supports 3 VIC */
88         u32 vic[3];
89
90         /* VIC0, VIC1, and VIC2: some interrupt reserved */
91         vic[0] = 0x7fefffff;
92         vic[1] = 0X7f389c81;
93         vic[2] = 0X1bbbcfff;
94
95         s5p_init_irq(vic, ARRAY_SIZE(vic));
96 }
97
98 static struct sysdev_class s5p6442_sysclass = {
99         .name   = "s5p6442-core",
100 };
101
102 static struct sys_device s5p6442_sysdev = {
103         .cls    = &s5p6442_sysclass,
104 };
105
106 static int __init s5p6442_core_init(void)
107 {
108         return sysdev_class_register(&s5p6442_sysclass);
109 }
110
111 core_initcall(s5p6442_core_init);
112
113 int __init s5p6442_init(void)
114 {
115         printk(KERN_INFO "S5P6442: Initializing architecture\n");
116
117         /* set idle function */
118         pm_idle = s5p6442_idle;
119
120         return sysdev_register(&s5p6442_sysdev);
121 }