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/sysdev.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/reset.h>
39 #include <plat/sdhci.h>
40 #include <plat/adc-core.h>
41 #include <plat/ata-core.h>
42 #include <plat/fb-core.h>
43 #include <plat/fimc-core.h>
44 #include <plat/iic-core.h>
45 #include <plat/keypad-core.h>
46 #include <plat/tv-core.h>
47 #include <plat/regs-serial.h>
51 static const char name_s5pv210[] = "S5PV210/S5PC110";
53 static struct cpu_table cpu_ids[] __initdata = {
55 .idcode = S5PV210_CPU_ID,
56 .idmask = S5PV210_CPU_MASK,
57 .map_io = s5pv210_map_io,
58 .init_clocks = s5pv210_init_clocks,
59 .init_uarts = s5pv210_init_uarts,
65 /* Initial IO mappings */
67 static struct map_desc s5pv210_iodesc[] __initdata = {
69 .virtual = (unsigned long)S5P_VA_CHIPID,
70 .pfn = __phys_to_pfn(S5PV210_PA_CHIPID),
74 .virtual = (unsigned long)S3C_VA_SYS,
75 .pfn = __phys_to_pfn(S5PV210_PA_SYSCON),
79 .virtual = (unsigned long)S3C_VA_TIMER,
80 .pfn = __phys_to_pfn(S5PV210_PA_TIMER),
84 .virtual = (unsigned long)S3C_VA_WATCHDOG,
85 .pfn = __phys_to_pfn(S5PV210_PA_WATCHDOG),
89 .virtual = (unsigned long)S5P_VA_SROMC,
90 .pfn = __phys_to_pfn(S5PV210_PA_SROMC),
94 .virtual = (unsigned long)S5P_VA_SYSTIMER,
95 .pfn = __phys_to_pfn(S5PV210_PA_SYSTIMER),
99 .virtual = (unsigned long)S5P_VA_GPIO,
100 .pfn = __phys_to_pfn(S5PV210_PA_GPIO),
104 .virtual = (unsigned long)VA_VIC0,
105 .pfn = __phys_to_pfn(S5PV210_PA_VIC0),
109 .virtual = (unsigned long)VA_VIC1,
110 .pfn = __phys_to_pfn(S5PV210_PA_VIC1),
114 .virtual = (unsigned long)VA_VIC2,
115 .pfn = __phys_to_pfn(S5PV210_PA_VIC2),
119 .virtual = (unsigned long)VA_VIC3,
120 .pfn = __phys_to_pfn(S5PV210_PA_VIC3),
124 .virtual = (unsigned long)S3C_VA_UART,
125 .pfn = __phys_to_pfn(S3C_PA_UART),
129 .virtual = (unsigned long)S5P_VA_DMC0,
130 .pfn = __phys_to_pfn(S5PV210_PA_DMC0),
134 .virtual = (unsigned long)S5P_VA_DMC1,
135 .pfn = __phys_to_pfn(S5PV210_PA_DMC1),
139 .virtual = (unsigned long)S3C_VA_USB_HSPHY,
140 .pfn =__phys_to_pfn(S5PV210_PA_HSPHY),
146 static void s5pv210_idle(void)
154 static void s5pv210_sw_reset(void)
156 __raw_writel(0x1, S5P_SWRESET);
162 * register the standard cpu IO areas
165 void __init s5pv210_init_io(struct map_desc *mach_desc, int size)
167 /* initialize the io descriptors we need for initialization */
168 iotable_init(s5pv210_iodesc, ARRAY_SIZE(s5pv210_iodesc));
170 iotable_init(mach_desc, size);
172 /* detect cpu id and rev. */
173 s5p_init_cpu(S5P_VA_CHIPID);
175 s3c_init_cpu(samsung_cpu_id, cpu_ids, ARRAY_SIZE(cpu_ids));
178 void __init s5pv210_map_io(void)
180 init_consistent_dma_size(14 << 20);
182 /* initialise device information early */
183 s5pv210_default_sdhci0();
184 s5pv210_default_sdhci1();
185 s5pv210_default_sdhci2();
186 s5pv210_default_sdhci3();
188 s3c_adc_setname("samsung-adc-v3");
190 s3c_cfcon_setname("s5pv210-pata");
192 s3c_fimc_setname(0, "s5pv210-fimc");
193 s3c_fimc_setname(1, "s5pv210-fimc");
194 s3c_fimc_setname(2, "s5pv210-fimc");
196 /* the i2c devices are directly compatible with s3c2440 */
197 s3c_i2c0_setname("s3c2440-i2c");
198 s3c_i2c1_setname("s3c2440-i2c");
199 s3c_i2c2_setname("s3c2440-i2c");
201 s3c_fb_setname("s5pv210-fb");
203 /* Use s5pv210-keypad instead of samsung-keypad */
204 samsung_keypad_setname("s5pv210-keypad");
206 /* setup TV devices */
207 s5p_hdmi_setname("s5pv210-hdmi");
210 void __init s5pv210_init_clocks(int xtal)
212 printk(KERN_DEBUG "%s: initializing clocks\n", __func__);
214 s3c24xx_register_baseclocks(xtal);
215 s5p_register_clocks(xtal);
216 s5pv210_register_clocks();
217 s5pv210_setup_clocks();
220 void __init s5pv210_init_irq(void)
222 u32 vic[4]; /* S5PV210 supports 4 VIC */
224 /* All the VICs are fully populated. */
230 s5p_init_irq(vic, ARRAY_SIZE(vic));
233 struct sysdev_class s5pv210_sysclass = {
234 .name = "s5pv210-core",
237 static struct sys_device s5pv210_sysdev = {
238 .cls = &s5pv210_sysclass,
241 static int __init s5pv210_core_init(void)
243 return sysdev_class_register(&s5pv210_sysclass);
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 /* set sw_reset function */
255 s5p_reset_hook = s5pv210_sw_reset;
257 return sysdev_register(&s5pv210_sysdev);
260 static struct s3c24xx_uart_clksrc s5pv210_serial_clocks[] = {
269 /* uart registration process */
271 void __init s5pv210_init_uarts(struct s3c2410_uartcfg *cfg, int no)
273 struct s3c2410_uartcfg *tcfg = cfg;
276 for (ucnt = 0; ucnt < no; ucnt++, tcfg++) {
278 tcfg->clocks = s5pv210_serial_clocks;
279 tcfg->clocks_size = ARRAY_SIZE(s5pv210_serial_clocks);
283 s3c24xx_init_uartdevs("s5pv210-uart", s5p_uart_resources, cfg, no);