blob: 617da3b3bfb716a8d7f8082acaccad28b517296d [file] [log] [blame]
Kukjin Kima2e0d622010-10-18 18:29:51 +09001/* linux/arch/arm/mach-s5p64x0/cpu.c
2 *
3 * Copyright (c) 2009-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>
SeungChull Suh138a6c72010-10-02 12:48:12 +090022#include <linux/sched.h>
Kukjin Kima2e0d622010-10-18 18:29:51 +090023
24#include <asm/mach/arch.h>
25#include <asm/mach/map.h>
26#include <asm/mach/irq.h>
27#include <asm/proc-fns.h>
28#include <asm/irq.h>
29
30#include <mach/hardware.h>
31#include <mach/map.h>
32#include <mach/regs-clock.h>
33
34#include <plat/regs-serial.h>
35#include <plat/cpu.h>
36#include <plat/devs.h>
37#include <plat/clock.h>
38#include <plat/s5p6440.h>
39#include <plat/s5p6450.h>
40#include <plat/adc-core.h>
Ajay Kumar43c46212011-09-27 07:46:50 +090041#include <plat/fb-core.h>
Kukjin Kima2e0d622010-10-18 18:29:51 +090042
43/* Initial IO mappings */
44
45static struct map_desc s5p64x0_iodesc[] __initdata = {
46 {
47 .virtual = (unsigned long)S5P_VA_GPIO,
48 .pfn = __phys_to_pfn(S5P64X0_PA_GPIO),
49 .length = SZ_4K,
50 .type = MT_DEVICE,
51 }, {
52 .virtual = (unsigned long)VA_VIC0,
53 .pfn = __phys_to_pfn(S5P64X0_PA_VIC0),
54 .length = SZ_16K,
55 .type = MT_DEVICE,
56 }, {
57 .virtual = (unsigned long)VA_VIC1,
58 .pfn = __phys_to_pfn(S5P64X0_PA_VIC1),
59 .length = SZ_16K,
60 .type = MT_DEVICE,
61 },
62};
63
64static struct map_desc s5p6440_iodesc[] __initdata = {
65 {
66 .virtual = (unsigned long)S3C_VA_UART,
67 .pfn = __phys_to_pfn(S5P6440_PA_UART(0)),
68 .length = SZ_4K,
69 .type = MT_DEVICE,
70 },
71};
72
73static struct map_desc s5p6450_iodesc[] __initdata = {
74 {
75 .virtual = (unsigned long)S3C_VA_UART,
76 .pfn = __phys_to_pfn(S5P6450_PA_UART(0)),
77 .length = SZ_512K,
78 .type = MT_DEVICE,
79 }, {
80 .virtual = (unsigned long)S3C_VA_UART + SZ_512K,
81 .pfn = __phys_to_pfn(S5P6450_PA_UART(5)),
82 .length = SZ_4K,
83 .type = MT_DEVICE,
84 },
85};
86
87static void s5p64x0_idle(void)
88{
89 unsigned long val;
90
91 if (!need_resched()) {
92 val = __raw_readl(S5P64X0_PWR_CFG);
93 val &= ~(0x3 << 5);
94 val |= (0x1 << 5);
95 __raw_writel(val, S5P64X0_PWR_CFG);
96
97 cpu_do_idle();
98 }
99 local_irq_enable();
100}
101
102/*
103 * s5p64x0_map_io
104 *
105 * register the standard CPU IO areas
106 */
107
108void __init s5p6440_map_io(void)
109{
110 /* initialize any device information early */
Naveen Krishna Ch6c6ad432010-10-08 20:53:08 +0900111 s3c_adc_setname("s3c64xx-adc");
Ajay Kumar43c46212011-09-27 07:46:50 +0900112 s3c_fb_setname("s5p64x0-fb");
Kukjin Kima2e0d622010-10-18 18:29:51 +0900113
114 iotable_init(s5p64x0_iodesc, ARRAY_SIZE(s5p64x0_iodesc));
115 iotable_init(s5p6440_iodesc, ARRAY_SIZE(s5p6440_iodesc));
116}
117
118void __init s5p6450_map_io(void)
119{
120 /* initialize any device information early */
Naveen Krishna Ch6c6ad432010-10-08 20:53:08 +0900121 s3c_adc_setname("s3c64xx-adc");
Ajay Kumar43c46212011-09-27 07:46:50 +0900122 s3c_fb_setname("s5p64x0-fb");
Kukjin Kima2e0d622010-10-18 18:29:51 +0900123
124 iotable_init(s5p64x0_iodesc, ARRAY_SIZE(s5p64x0_iodesc));
Banajit Goswami38145542011-03-18 17:15:22 +0530125 iotable_init(s5p6450_iodesc, ARRAY_SIZE(s5p6450_iodesc));
Kukjin Kima2e0d622010-10-18 18:29:51 +0900126}
127
128/*
129 * s5p64x0_init_clocks
130 *
131 * register and setup the CPU clocks
132 */
133
134void __init s5p6440_init_clocks(int xtal)
135{
136 printk(KERN_DEBUG "%s: initializing clocks\n", __func__);
137
138 s3c24xx_register_baseclocks(xtal);
139 s5p_register_clocks(xtal);
140 s5p6440_register_clocks();
141 s5p6440_setup_clocks();
142}
143
144void __init s5p6450_init_clocks(int xtal)
145{
146 printk(KERN_DEBUG "%s: initializing clocks\n", __func__);
147
148 s3c24xx_register_baseclocks(xtal);
149 s5p_register_clocks(xtal);
150 s5p6450_register_clocks();
151 s5p6450_setup_clocks();
152}
153
154/*
155 * s5p64x0_init_irq
156 *
157 * register the CPU interrupts
158 */
159
160void __init s5p6440_init_irq(void)
161{
162 /* S5P6440 supports 2 VIC */
163 u32 vic[2];
164
165 /*
166 * VIC0 is missing IRQ_VIC0[3, 4, 8, 10, (12-22)]
167 * VIC1 is missing IRQ VIC1[1, 3, 4, 10, 11, 12, 14, 15, 22]
168 */
169 vic[0] = 0xff800ae7;
170 vic[1] = 0xffbf23e5;
171
172 s5p_init_irq(vic, ARRAY_SIZE(vic));
173}
174
175void __init s5p6450_init_irq(void)
176{
177 /* S5P6450 supports only 2 VIC */
178 u32 vic[2];
179
180 /*
181 * VIC0 is missing IRQ_VIC0[(13-15), (21-22)]
182 * VIC1 is missing IRQ VIC1[12, 14, 23]
183 */
184 vic[0] = 0xff9f1fff;
185 vic[1] = 0xff7fafff;
186
187 s5p_init_irq(vic, ARRAY_SIZE(vic));
188}
189
190struct sysdev_class s5p64x0_sysclass = {
191 .name = "s5p64x0-core",
192};
193
194static struct sys_device s5p64x0_sysdev = {
195 .cls = &s5p64x0_sysclass,
196};
197
198static int __init s5p64x0_core_init(void)
199{
200 return sysdev_class_register(&s5p64x0_sysclass);
201}
202core_initcall(s5p64x0_core_init);
203
204int __init s5p64x0_init(void)
205{
206 printk(KERN_INFO "S5P64X0(S5P6440/S5P6450): Initializing architecture\n");
207
208 /* set idle function */
209 pm_idle = s5p64x0_idle;
210
211 return sysdev_register(&s5p64x0_sysdev);
212}