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 <clocksource/samsung_pwm.h>
23 #include <linux/platform_device.h>
24 #include <linux/sched.h>
25 #include <linux/dma-mapping.h>
26 #include <linux/serial_core.h>
28 #include <asm/proc-fns.h>
29 #include <asm/mach/arch.h>
30 #include <asm/mach/map.h>
31 #include <asm/mach/irq.h>
34 #include <mach/regs-clock.h>
37 #include <plat/clock.h>
38 #include <plat/devs.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/pwm-core.h>
47 #include <plat/tv-core.h>
48 #include <plat/spi-core.h>
49 #include <plat/regs-serial.h>
53 static const char name_s5pv210
[] = "S5PV210/S5PC110";
55 static struct cpu_table cpu_ids
[] __initdata
= {
57 .idcode
= S5PV210_CPU_ID
,
58 .idmask
= S5PV210_CPU_MASK
,
59 .map_io
= s5pv210_map_io
,
60 .init_clocks
= s5pv210_init_clocks
,
61 .init_uarts
= s5pv210_init_uarts
,
67 /* Initial IO mappings */
69 static struct map_desc s5pv210_iodesc
[] __initdata
= {
71 .virtual = (unsigned long)S5P_VA_CHIPID
,
72 .pfn
= __phys_to_pfn(S5PV210_PA_CHIPID
),
76 .virtual = (unsigned long)S3C_VA_SYS
,
77 .pfn
= __phys_to_pfn(S5PV210_PA_SYSCON
),
81 .virtual = (unsigned long)S3C_VA_TIMER
,
82 .pfn
= __phys_to_pfn(S5PV210_PA_TIMER
),
86 .virtual = (unsigned long)S3C_VA_WATCHDOG
,
87 .pfn
= __phys_to_pfn(S5PV210_PA_WATCHDOG
),
91 .virtual = (unsigned long)S5P_VA_SROMC
,
92 .pfn
= __phys_to_pfn(S5PV210_PA_SROMC
),
96 .virtual = (unsigned long)S5P_VA_SYSTIMER
,
97 .pfn
= __phys_to_pfn(S5PV210_PA_SYSTIMER
),
101 .virtual = (unsigned long)S5P_VA_GPIO
,
102 .pfn
= __phys_to_pfn(S5PV210_PA_GPIO
),
106 .virtual = (unsigned long)VA_VIC0
,
107 .pfn
= __phys_to_pfn(S5PV210_PA_VIC0
),
111 .virtual = (unsigned long)VA_VIC1
,
112 .pfn
= __phys_to_pfn(S5PV210_PA_VIC1
),
116 .virtual = (unsigned long)VA_VIC2
,
117 .pfn
= __phys_to_pfn(S5PV210_PA_VIC2
),
121 .virtual = (unsigned long)VA_VIC3
,
122 .pfn
= __phys_to_pfn(S5PV210_PA_VIC3
),
126 .virtual = (unsigned long)S3C_VA_UART
,
127 .pfn
= __phys_to_pfn(S3C_PA_UART
),
131 .virtual = (unsigned long)S5P_VA_DMC0
,
132 .pfn
= __phys_to_pfn(S5PV210_PA_DMC0
),
136 .virtual = (unsigned long)S5P_VA_DMC1
,
137 .pfn
= __phys_to_pfn(S5PV210_PA_DMC1
),
141 .virtual = (unsigned long)S3C_VA_USB_HSPHY
,
142 .pfn
=__phys_to_pfn(S5PV210_PA_HSPHY
),
148 void s5pv210_restart(enum reboot_mode mode
, const char *cmd
)
150 __raw_writel(0x1, S5P_SWRESET
);
153 static struct samsung_pwm_variant s5pv210_pwm_variant
= {
156 .has_tint_cstat
= true,
157 .tclk_mask
= (1 << 5),
160 void __init
samsung_set_timer_source(unsigned int event
, unsigned int source
)
162 s5pv210_pwm_variant
.output_mask
= BIT(SAMSUNG_PWM_NUM
) - 1;
163 s5pv210_pwm_variant
.output_mask
&= ~(BIT(event
) | BIT(source
));
166 void __init
samsung_timer_init(void)
168 unsigned int timer_irqs
[SAMSUNG_PWM_NUM
] = {
169 IRQ_TIMER0_VIC
, IRQ_TIMER1_VIC
, IRQ_TIMER2_VIC
,
170 IRQ_TIMER3_VIC
, IRQ_TIMER4_VIC
,
173 samsung_pwm_clocksource_init(S3C_VA_TIMER
,
174 timer_irqs
, &s5pv210_pwm_variant
);
180 * register the standard cpu IO areas
183 void __init
s5pv210_init_io(struct map_desc
*mach_desc
, int size
)
185 /* initialize the io descriptors we need for initialization */
186 iotable_init(s5pv210_iodesc
, ARRAY_SIZE(s5pv210_iodesc
));
188 iotable_init(mach_desc
, size
);
190 /* detect cpu id and rev. */
191 s5p_init_cpu(S5P_VA_CHIPID
);
193 s3c_init_cpu(samsung_cpu_id
, cpu_ids
, ARRAY_SIZE(cpu_ids
));
195 samsung_pwm_set_platdata(&s5pv210_pwm_variant
);
198 void __init
s5pv210_map_io(void)
200 /* initialise device information early */
201 s5pv210_default_sdhci0();
202 s5pv210_default_sdhci1();
203 s5pv210_default_sdhci2();
204 s5pv210_default_sdhci3();
206 s3c_adc_setname("samsung-adc-v3");
208 s3c_cfcon_setname("s5pv210-pata");
210 s3c_fimc_setname(0, "s5pv210-fimc");
211 s3c_fimc_setname(1, "s5pv210-fimc");
212 s3c_fimc_setname(2, "s5pv210-fimc");
214 /* the i2c devices are directly compatible with s3c2440 */
215 s3c_i2c0_setname("s3c2440-i2c");
216 s3c_i2c1_setname("s3c2440-i2c");
217 s3c_i2c2_setname("s3c2440-i2c");
219 s3c_fb_setname("s5pv210-fb");
221 /* Use s5pv210-keypad instead of samsung-keypad */
222 samsung_keypad_setname("s5pv210-keypad");
224 /* setup TV devices */
225 s5p_hdmi_setname("s5pv210-hdmi");
227 s3c64xx_spi_setname("s5pv210-spi");
230 void __init
s5pv210_init_clocks(int xtal
)
232 printk(KERN_DEBUG
"%s: initializing clocks\n", __func__
);
234 s3c24xx_register_baseclocks(xtal
);
235 s5p_register_clocks(xtal
);
236 s5pv210_register_clocks();
237 s5pv210_setup_clocks();
240 void __init
s5pv210_init_irq(void)
242 u32 vic
[4]; /* S5PV210 supports 4 VIC */
244 /* All the VICs are fully populated. */
250 s5p_init_irq(vic
, ARRAY_SIZE(vic
));
253 struct bus_type s5pv210_subsys
= {
254 .name
= "s5pv210-core",
255 .dev_name
= "s5pv210-core",
258 static struct device s5pv210_dev
= {
259 .bus
= &s5pv210_subsys
,
262 static int __init
s5pv210_core_init(void)
264 return subsys_system_register(&s5pv210_subsys
, NULL
);
266 core_initcall(s5pv210_core_init
);
268 int __init
s5pv210_init(void)
270 printk(KERN_INFO
"S5PV210: Initializing architecture\n");
271 return device_register(&s5pv210_dev
);
274 /* uart registration process */
276 void __init
s5pv210_init_uarts(struct s3c2410_uartcfg
*cfg
, int no
)
278 s3c24xx_init_uartdevs("s5pv210-uart", s5p_uart_resources
, cfg
, no
);