2 * Copyright (c) 2009-2011 Samsung Electronics Co., Ltd.
3 * http://www.samsung.com
5 * Common Codes for S5PV210
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.
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>
21 #include <linux/device.h>
22 #include <linux/platform_device.h>
23 #include <linux/sched.h>
24 #include <linux/dma-mapping.h>
25 #include <linux/serial_core.h>
27 #include <asm/proc-fns.h>
28 #include <asm/mach/arch.h>
29 #include <asm/mach/map.h>
30 #include <asm/mach/irq.h>
33 #include <mach/regs-clock.h>
36 #include <plat/clock.h>
37 #include <plat/devs.h>
38 #include <plat/sdhci.h>
39 #include <plat/adc-core.h>
40 #include <plat/ata-core.h>
41 #include <plat/fb-core.h>
42 #include <plat/fimc-core.h>
43 #include <plat/iic-core.h>
44 #include <plat/keypad-core.h>
45 #include <plat/tv-core.h>
46 #include <plat/regs-serial.h>
50 static const char name_s5pv210
[] = "S5PV210/S5PC110";
52 static struct cpu_table cpu_ids
[] __initdata
= {
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
,
64 /* Initial IO mappings */
66 static struct map_desc s5pv210_iodesc
[] __initdata
= {
68 .virtual = (unsigned long)S5P_VA_CHIPID
,
69 .pfn
= __phys_to_pfn(S5PV210_PA_CHIPID
),
73 .virtual = (unsigned long)S3C_VA_SYS
,
74 .pfn
= __phys_to_pfn(S5PV210_PA_SYSCON
),
78 .virtual = (unsigned long)S3C_VA_TIMER
,
79 .pfn
= __phys_to_pfn(S5PV210_PA_TIMER
),
83 .virtual = (unsigned long)S3C_VA_WATCHDOG
,
84 .pfn
= __phys_to_pfn(S5PV210_PA_WATCHDOG
),
88 .virtual = (unsigned long)S5P_VA_SROMC
,
89 .pfn
= __phys_to_pfn(S5PV210_PA_SROMC
),
93 .virtual = (unsigned long)S5P_VA_SYSTIMER
,
94 .pfn
= __phys_to_pfn(S5PV210_PA_SYSTIMER
),
98 .virtual = (unsigned long)S5P_VA_GPIO
,
99 .pfn
= __phys_to_pfn(S5PV210_PA_GPIO
),
103 .virtual = (unsigned long)VA_VIC0
,
104 .pfn
= __phys_to_pfn(S5PV210_PA_VIC0
),
108 .virtual = (unsigned long)VA_VIC1
,
109 .pfn
= __phys_to_pfn(S5PV210_PA_VIC1
),
113 .virtual = (unsigned long)VA_VIC2
,
114 .pfn
= __phys_to_pfn(S5PV210_PA_VIC2
),
118 .virtual = (unsigned long)VA_VIC3
,
119 .pfn
= __phys_to_pfn(S5PV210_PA_VIC3
),
123 .virtual = (unsigned long)S3C_VA_UART
,
124 .pfn
= __phys_to_pfn(S3C_PA_UART
),
128 .virtual = (unsigned long)S5P_VA_DMC0
,
129 .pfn
= __phys_to_pfn(S5PV210_PA_DMC0
),
133 .virtual = (unsigned long)S5P_VA_DMC1
,
134 .pfn
= __phys_to_pfn(S5PV210_PA_DMC1
),
138 .virtual = (unsigned long)S3C_VA_USB_HSPHY
,
139 .pfn
=__phys_to_pfn(S5PV210_PA_HSPHY
),
145 static void s5pv210_idle(void)
153 void s5pv210_restart(char mode
, const char *cmd
)
155 __raw_writel(0x1, S5P_SWRESET
);
161 * register the standard cpu IO areas
164 void __init
s5pv210_init_io(struct map_desc
*mach_desc
, int size
)
166 /* initialize the io descriptors we need for initialization */
167 iotable_init(s5pv210_iodesc
, ARRAY_SIZE(s5pv210_iodesc
));
169 iotable_init(mach_desc
, size
);
171 /* detect cpu id and rev. */
172 s5p_init_cpu(S5P_VA_CHIPID
);
174 s3c_init_cpu(samsung_cpu_id
, cpu_ids
, ARRAY_SIZE(cpu_ids
));
177 void __init
s5pv210_map_io(void)
179 init_consistent_dma_size(14 << 20);
181 /* initialise device information early */
182 s5pv210_default_sdhci0();
183 s5pv210_default_sdhci1();
184 s5pv210_default_sdhci2();
185 s5pv210_default_sdhci3();
187 s3c_adc_setname("samsung-adc-v3");
189 s3c_cfcon_setname("s5pv210-pata");
191 s3c_fimc_setname(0, "s5pv210-fimc");
192 s3c_fimc_setname(1, "s5pv210-fimc");
193 s3c_fimc_setname(2, "s5pv210-fimc");
195 /* the i2c devices are directly compatible with s3c2440 */
196 s3c_i2c0_setname("s3c2440-i2c");
197 s3c_i2c1_setname("s3c2440-i2c");
198 s3c_i2c2_setname("s3c2440-i2c");
200 s3c_fb_setname("s5pv210-fb");
202 /* Use s5pv210-keypad instead of samsung-keypad */
203 samsung_keypad_setname("s5pv210-keypad");
205 /* setup TV devices */
206 s5p_hdmi_setname("s5pv210-hdmi");
209 void __init
s5pv210_init_clocks(int xtal
)
211 printk(KERN_DEBUG
"%s: initializing clocks\n", __func__
);
213 s3c24xx_register_baseclocks(xtal
);
214 s5p_register_clocks(xtal
);
215 s5pv210_register_clocks();
216 s5pv210_setup_clocks();
219 void __init
s5pv210_init_irq(void)
221 u32 vic
[4]; /* S5PV210 supports 4 VIC */
223 /* All the VICs are fully populated. */
229 s5p_init_irq(vic
, ARRAY_SIZE(vic
));
232 struct bus_type s5pv210_subsys
= {
233 .name
= "s5pv210-core",
234 .dev_name
= "s5pv210-core",
237 static struct device s5pv210_dev
= {
238 .bus
= &s5pv210_subsys
,
241 static int __init
s5pv210_core_init(void)
243 return subsys_system_register(&s5pv210_subsys
, NULL
);
245 core_initcall(s5pv210_core_init
);
247 int __init
s5pv210_init(void)
249 printk(KERN_INFO
"S5PV210: Initializing architecture\n");
251 /* set idle function */
252 pm_idle
= s5pv210_idle
;
254 return device_register(&s5pv210_dev
);
257 /* uart registration process */
259 void __init
s5pv210_init_uarts(struct s3c2410_uartcfg
*cfg
, int no
)
261 s3c24xx_init_uartdevs("s5pv210-uart", s5p_uart_resources
, cfg
, no
);