Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/cooloney...
[deliverable/linux.git] / arch / arm / mach-s5pv210 / common.c
CommitLineData
3fa754c2
KK
1/*
2 * Copyright (c) 2009-2011 Samsung Electronics Co., Ltd.
19a2c065 3 * http://www.samsung.com
939d28aa 4 *
3fa754c2
KK
5 * Common Codes for S5PV210
6 *
939d28aa
KK
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
3fa754c2 10 */
939d28aa
KK
11
12#include <linux/kernel.h>
13#include <linux/types.h>
14#include <linux/interrupt.h>
15#include <linux/list.h>
16#include <linux/timer.h>
17#include <linux/init.h>
18#include <linux/module.h>
19#include <linux/clk.h>
20#include <linux/io.h>
4a858cfc 21#include <linux/device.h>
939d28aa 22#include <linux/platform_device.h>
4341f9b3 23#include <linux/sched.h>
a06a58ab 24#include <linux/dma-mapping.h>
3fa754c2 25#include <linux/serial_core.h>
939d28aa 26
3fa754c2 27#include <asm/proc-fns.h>
939d28aa
KK
28#include <asm/mach/arch.h>
29#include <asm/mach/map.h>
30#include <asm/mach/irq.h>
31
939d28aa
KK
32#include <mach/map.h>
33#include <mach/regs-clock.h>
34
35#include <plat/cpu.h>
939d28aa 36#include <plat/clock.h>
3fa754c2 37#include <plat/devs.h>
3fa754c2 38#include <plat/sdhci.h>
50e9769a 39#include <plat/adc-core.h>
4b9a5ad5 40#include <plat/ata-core.h>
3fa754c2 41#include <plat/fb-core.h>
33c14ff8 42#include <plat/fimc-core.h>
c8d833bf 43#include <plat/iic-core.h>
e7d0628c 44#include <plat/keypad-core.h>
fbf05563 45#include <plat/tv-core.h>
3fa754c2
KK
46#include <plat/regs-serial.h>
47
48#include "common.h"
49
50static const char name_s5pv210[] = "S5PV210/S5PC110";
51
52static struct cpu_table cpu_ids[] __initdata = {
53 {
54 .idcode = S5PV210_CPU_ID,
55 .idmask = S5PV210_CPU_MASK,
56 .map_io = s5pv210_map_io,
57 .init_clocks = s5pv210_init_clocks,
58 .init_uarts = s5pv210_init_uarts,
59 .init = s5pv210_init,
60 .name = name_s5pv210,
61 },
62};
939d28aa
KK
63
64/* Initial IO mappings */
65
66static struct map_desc s5pv210_iodesc[] __initdata = {
67 {
3fa754c2
KK
68 .virtual = (unsigned long)S5P_VA_CHIPID,
69 .pfn = __phys_to_pfn(S5PV210_PA_CHIPID),
70 .length = SZ_4K,
71 .type = MT_DEVICE,
72 }, {
73 .virtual = (unsigned long)S3C_VA_SYS,
74 .pfn = __phys_to_pfn(S5PV210_PA_SYSCON),
75 .length = SZ_64K,
76 .type = MT_DEVICE,
77 }, {
78 .virtual = (unsigned long)S3C_VA_TIMER,
79 .pfn = __phys_to_pfn(S5PV210_PA_TIMER),
80 .length = SZ_16K,
81 .type = MT_DEVICE,
82 }, {
83 .virtual = (unsigned long)S3C_VA_WATCHDOG,
84 .pfn = __phys_to_pfn(S5PV210_PA_WATCHDOG),
85 .length = SZ_4K,
86 .type = MT_DEVICE,
87 }, {
88 .virtual = (unsigned long)S5P_VA_SROMC,
89 .pfn = __phys_to_pfn(S5PV210_PA_SROMC),
90 .length = SZ_4K,
91 .type = MT_DEVICE,
92 }, {
939d28aa
KK
93 .virtual = (unsigned long)S5P_VA_SYSTIMER,
94 .pfn = __phys_to_pfn(S5PV210_PA_SYSTIMER),
a203a13a 95 .length = SZ_4K,
939d28aa 96 .type = MT_DEVICE,
19a2c065
KK
97 }, {
98 .virtual = (unsigned long)S5P_VA_GPIO,
99 .pfn = __phys_to_pfn(S5PV210_PA_GPIO),
100 .length = SZ_4K,
101 .type = MT_DEVICE,
102 }, {
103 .virtual = (unsigned long)VA_VIC0,
104 .pfn = __phys_to_pfn(S5PV210_PA_VIC0),
105 .length = SZ_16K,
106 .type = MT_DEVICE,
107 }, {
108 .virtual = (unsigned long)VA_VIC1,
109 .pfn = __phys_to_pfn(S5PV210_PA_VIC1),
110 .length = SZ_16K,
111 .type = MT_DEVICE,
939d28aa
KK
112 }, {
113 .virtual = (unsigned long)VA_VIC2,
114 .pfn = __phys_to_pfn(S5PV210_PA_VIC2),
115 .length = SZ_16K,
116 .type = MT_DEVICE,
117 }, {
118 .virtual = (unsigned long)VA_VIC3,
119 .pfn = __phys_to_pfn(S5PV210_PA_VIC3),
120 .length = SZ_16K,
121 .type = MT_DEVICE,
19a2c065
KK
122 }, {
123 .virtual = (unsigned long)S3C_VA_UART,
124 .pfn = __phys_to_pfn(S3C_PA_UART),
125 .length = SZ_512K,
126 .type = MT_DEVICE,
1d826d14
JL
127 }, {
128 .virtual = (unsigned long)S5P_VA_DMC0,
129 .pfn = __phys_to_pfn(S5PV210_PA_DMC0),
130 .length = SZ_4K,
131 .type = MT_DEVICE,
132 }, {
133 .virtual = (unsigned long)S5P_VA_DMC1,
134 .pfn = __phys_to_pfn(S5PV210_PA_DMC1),
135 .length = SZ_4K,
136 .type = MT_DEVICE,
ca1931ca
MS
137 }, {
138 .virtual = (unsigned long)S3C_VA_USB_HSPHY,
139 .pfn =__phys_to_pfn(S5PV210_PA_HSPHY),
140 .length = SZ_4K,
141 .type = MT_DEVICE,
939d28aa
KK
142 }
143};
144
1f34f0e2 145void s5pv210_restart(char mode, const char *cmd)
4550ee20
JL
146{
147 __raw_writel(0x1, S5P_SWRESET);
148}
149
3fa754c2
KK
150/*
151 * s5pv210_map_io
939d28aa
KK
152 *
153 * register the standard cpu IO areas
3fa754c2 154 */
939d28aa 155
3fa754c2 156void __init s5pv210_init_io(struct map_desc *mach_desc, int size)
939d28aa 157{
3fa754c2 158 /* initialize the io descriptors we need for initialization */
939d28aa 159 iotable_init(s5pv210_iodesc, ARRAY_SIZE(s5pv210_iodesc));
3fa754c2
KK
160 if (mach_desc)
161 iotable_init(mach_desc, size);
162
163 /* detect cpu id and rev. */
164 s5p_init_cpu(S5P_VA_CHIPID);
165
166 s3c_init_cpu(samsung_cpu_id, cpu_ids, ARRAY_SIZE(cpu_ids));
167}
168
169void __init s5pv210_map_io(void)
170{
a06a58ab 171 init_consistent_dma_size(14 << 20);
c8d833bf 172
e6f66a9f
MS
173 /* initialise device information early */
174 s5pv210_default_sdhci0();
175 s5pv210_default_sdhci1();
176 s5pv210_default_sdhci2();
976a62f2 177 s5pv210_default_sdhci3();
e6f66a9f 178
a0428f3a 179 s3c_adc_setname("samsung-adc-v3");
50e9769a 180
4b9a5ad5
AK
181 s3c_cfcon_setname("s5pv210-pata");
182
d61bd77f
KK
183 s3c_fimc_setname(0, "s5pv210-fimc");
184 s3c_fimc_setname(1, "s5pv210-fimc");
185 s3c_fimc_setname(2, "s5pv210-fimc");
e6f66a9f 186
c8d833bf
MS
187 /* the i2c devices are directly compatible with s3c2440 */
188 s3c_i2c0_setname("s3c2440-i2c");
189 s3c_i2c1_setname("s3c2440-i2c");
190 s3c_i2c2_setname("s3c2440-i2c");
eb42b044
PO
191
192 s3c_fb_setname("s5pv210-fb");
636d1742 193
e7d0628c
JS
194 /* Use s5pv210-keypad instead of samsung-keypad */
195 samsung_keypad_setname("s5pv210-keypad");
fbf05563
TS
196
197 /* setup TV devices */
198 s5p_hdmi_setname("s5pv210-hdmi");
939d28aa
KK
199}
200
201void __init s5pv210_init_clocks(int xtal)
202{
203 printk(KERN_DEBUG "%s: initializing clocks\n", __func__);
204
205 s3c24xx_register_baseclocks(xtal);
206 s5p_register_clocks(xtal);
207 s5pv210_register_clocks();
208 s5pv210_setup_clocks();
209}
210
211void __init s5pv210_init_irq(void)
212{
213 u32 vic[4]; /* S5PV210 supports 4 VIC */
214
215 /* All the VICs are fully populated. */
216 vic[0] = ~0;
217 vic[1] = ~0;
218 vic[2] = ~0;
219 vic[3] = ~0;
220
221 s5p_init_irq(vic, ARRAY_SIZE(vic));
222}
223
4a858cfc
KS
224struct bus_type s5pv210_subsys = {
225 .name = "s5pv210-core",
226 .dev_name = "s5pv210-core",
939d28aa
KK
227};
228
4a858cfc
KS
229static struct device s5pv210_dev = {
230 .bus = &s5pv210_subsys,
939d28aa
KK
231};
232
233static int __init s5pv210_core_init(void)
234{
4a858cfc 235 return subsys_system_register(&s5pv210_subsys, NULL);
939d28aa 236}
939d28aa
KK
237core_initcall(s5pv210_core_init);
238
239int __init s5pv210_init(void)
240{
241 printk(KERN_INFO "S5PV210: Initializing architecture\n");
4a858cfc 242 return device_register(&s5pv210_dev);
939d28aa 243}
3fa754c2 244
3fa754c2
KK
245/* uart registration process */
246
247void __init s5pv210_init_uarts(struct s3c2410_uartcfg *cfg, int no)
248{
3fa754c2
KK
249 s3c24xx_init_uartdevs("s5pv210-uart", s5p_uart_resources, cfg, no);
250}
This page took 0.27049 seconds and 5 git commands to generate.