ARM: Merge for-2635-4/ts-machines
[pandora-kernel.git] / arch / arm / mach-s5pc100 / cpu.c
1 /* linux/arch/arm/mach-s5pc100/cpu.c
2  *
3  * Copyright 2009 Samsung Electronics Co.
4  *      Byungho Min <bhmin@samsung.com>
5  *
6  * Based on mach-s3c6410/cpu.c
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/interrupt.h>
16 #include <linux/list.h>
17 #include <linux/timer.h>
18 #include <linux/init.h>
19 #include <linux/clk.h>
20 #include <linux/io.h>
21 #include <linux/sysdev.h>
22 #include <linux/serial_core.h>
23 #include <linux/platform_device.h>
24
25 #include <asm/mach/arch.h>
26 #include <asm/mach/map.h>
27 #include <asm/mach/irq.h>
28
29 #include <asm/proc-fns.h>
30
31 #include <mach/hardware.h>
32 #include <mach/map.h>
33 #include <asm/irq.h>
34
35 #include <plat/regs-serial.h>
36 #include <mach/regs-clock.h>
37
38 #include <plat/cpu.h>
39 #include <plat/devs.h>
40 #include <plat/clock.h>
41 #include <plat/iic-core.h>
42 #include <plat/sdhci.h>
43 #include <plat/s5pc100.h>
44
45 /* Initial IO mappings */
46
47 static struct map_desc s5pc100_iodesc[] __initdata = {
48         {
49                 .virtual        = (unsigned long)S5P_VA_SYSTIMER,
50                 .pfn            = __phys_to_pfn(S5PC100_PA_SYSTIMER),
51                 .length         = SZ_16K,
52                 .type           = MT_DEVICE,
53         }, {
54                 .virtual        = (unsigned long)VA_VIC2,
55                 .pfn            = __phys_to_pfn(S5PC100_PA_VIC2),
56                 .length         = SZ_16K,
57                 .type           = MT_DEVICE,
58         }, {
59                 .virtual        = (unsigned long)S5PC100_VA_OTHERS,
60                 .pfn            = __phys_to_pfn(S5PC100_PA_OTHERS),
61                 .length         = SZ_4K,
62                 .type           = MT_DEVICE,
63         }
64 };
65
66 static void s5pc100_idle(void)
67 {
68         if (!need_resched())
69                 cpu_do_idle();
70
71         local_irq_enable();
72 }
73
74 /* s5pc100_map_io
75  *
76  * register the standard cpu IO areas
77 */
78
79 void __init s5pc100_map_io(void)
80 {
81         iotable_init(s5pc100_iodesc, ARRAY_SIZE(s5pc100_iodesc));
82
83         /* initialise device information early */
84         s5pc100_default_sdhci0();
85         s5pc100_default_sdhci1();
86         s5pc100_default_sdhci2();
87
88         /* the i2c devices are directly compatible with s3c2440 */
89         s3c_i2c0_setname("s3c2440-i2c");
90         s3c_i2c1_setname("s3c2440-i2c");
91 }
92
93 void __init s5pc100_init_clocks(int xtal)
94 {
95         printk(KERN_DEBUG "%s: initializing clocks\n", __func__);
96
97         s3c24xx_register_baseclocks(xtal);
98         s5p_register_clocks(xtal);
99         s5pc100_register_clocks();
100         s5pc100_setup_clocks();
101 }
102
103 void __init s5pc100_init_irq(void)
104 {
105         u32 vic[] = {~0, ~0, ~0};
106
107         /* VIC0, VIC1, and VIC2 are fully populated. */
108         s5p_init_irq(vic, ARRAY_SIZE(vic));
109 }
110
111 static struct sysdev_class s5pc100_sysclass = {
112         .name   = "s5pc100-core",
113 };
114
115 static struct sys_device s5pc100_sysdev = {
116         .cls    = &s5pc100_sysclass,
117 };
118
119 static int __init s5pc100_core_init(void)
120 {
121         return sysdev_class_register(&s5pc100_sysclass);
122 }
123
124 core_initcall(s5pc100_core_init);
125
126 int __init s5pc100_init(void)
127 {
128         printk(KERN_INFO "S5PC100: Initializing architecture\n");
129
130         /* set idle function */
131         pm_idle = s5pc100_idle;
132
133         return sysdev_register(&s5pc100_sysdev);
134 }