blob: 7b5bdbc9a5df32a1e182cf6864af2bf8620676e3 [file] [log] [blame]
Byungho Min8acd1ad2009-06-23 21:40:15 +09001/* linux/arch/arm/mach-s5pc100/cpu.c
2 *
3 * Copyright 2009 Samsung Electronics Co.
4 * Byungho Min <bhmin@samsung.com>
5 *
6 * Based on mach-s3c6410/cpu.c
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11*/
12
13#include <linux/kernel.h>
14#include <linux/types.h>
15#include <linux/interrupt.h>
16#include <linux/list.h>
17#include <linux/timer.h>
18#include <linux/init.h>
19#include <linux/clk.h>
20#include <linux/io.h>
21#include <linux/sysdev.h>
22#include <linux/serial_core.h>
23#include <linux/platform_device.h>
24
25#include <asm/mach/arch.h>
26#include <asm/mach/map.h>
27#include <asm/mach/irq.h>
28
Marek Szyprowskiacc84702010-05-20 07:51:08 +020029#include <asm/proc-fns.h>
30
Byungho Min8acd1ad2009-06-23 21:40:15 +090031#include <mach/hardware.h>
32#include <mach/map.h>
33#include <asm/irq.h>
34
Byungho Min8acd1ad2009-06-23 21:40:15 +090035#include <plat/regs-serial.h>
Marek Szyprowskiacc84702010-05-20 07:51:08 +020036#include <mach/regs-clock.h>
Byungho Min8acd1ad2009-06-23 21:40:15 +090037
38#include <plat/cpu.h>
39#include <plat/devs.h>
40#include <plat/clock.h>
Byungho Min8acd1ad2009-06-23 21:40:15 +090041#include <plat/iic-core.h>
Marek Szyprowskiacc84702010-05-20 07:51:08 +020042#include <plat/sdhci.h>
Marek Szyprowski999304b2010-05-20 08:59:05 +020043#include <plat/onenand-core.h>
44
Byungho Min8acd1ad2009-06-23 21:40:15 +090045#include <plat/s5pc100.h>
46
47/* Initial IO mappings */
48
49static struct map_desc s5pc100_iodesc[] __initdata = {
Marek Szyprowskiacc84702010-05-20 07:51:08 +020050 {
51 .virtual = (unsigned long)S5P_VA_SYSTIMER,
52 .pfn = __phys_to_pfn(S5PC100_PA_SYSTIMER),
53 .length = SZ_16K,
54 .type = MT_DEVICE,
55 }, {
56 .virtual = (unsigned long)VA_VIC2,
Ben Dooks45c79432010-05-23 16:17:10 +010057 .pfn = __phys_to_pfn(S5P_PA_VIC2),
Marek Szyprowskiacc84702010-05-20 07:51:08 +020058 .length = SZ_16K,
59 .type = MT_DEVICE,
60 }, {
61 .virtual = (unsigned long)S5PC100_VA_OTHERS,
62 .pfn = __phys_to_pfn(S5PC100_PA_OTHERS),
63 .length = SZ_4K,
64 .type = MT_DEVICE,
65 }
Byungho Min8acd1ad2009-06-23 21:40:15 +090066};
67
Kyungmin Parkc3fcf5d2009-11-17 08:41:17 +010068static void s5pc100_idle(void)
69{
Marek Szyprowskiacc84702010-05-20 07:51:08 +020070 if (!need_resched())
71 cpu_do_idle();
Kyungmin Parkc3fcf5d2009-11-17 08:41:17 +010072
Marek Szyprowskiacc84702010-05-20 07:51:08 +020073 local_irq_enable();
Kyungmin Parkc3fcf5d2009-11-17 08:41:17 +010074}
75
Byungho Min8acd1ad2009-06-23 21:40:15 +090076/* s5pc100_map_io
77 *
78 * register the standard cpu IO areas
79*/
80
81void __init s5pc100_map_io(void)
82{
83 iotable_init(s5pc100_iodesc, ARRAY_SIZE(s5pc100_iodesc));
84
85 /* initialise device information early */
Kyungmin Park86cd4f52009-11-17 08:41:23 +010086 s5pc100_default_sdhci0();
87 s5pc100_default_sdhci1();
88 s5pc100_default_sdhci2();
Kyungmin Park5eda2882009-11-17 08:41:21 +010089
90 /* the i2c devices are directly compatible with s3c2440 */
91 s3c_i2c0_setname("s3c2440-i2c");
92 s3c_i2c1_setname("s3c2440-i2c");
Marek Szyprowski999304b2010-05-20 08:59:05 +020093
94 s3c_onenand_setname("s5pc100-onenand");
Byungho Min8acd1ad2009-06-23 21:40:15 +090095}
96
97void __init s5pc100_init_clocks(int xtal)
98{
Marek Szyprowskiacc84702010-05-20 07:51:08 +020099 printk(KERN_DEBUG "%s: initializing clocks\n", __func__);
100
Byungho Min8acd1ad2009-06-23 21:40:15 +0900101 s3c24xx_register_baseclocks(xtal);
Marek Szyprowskiacc84702010-05-20 07:51:08 +0200102 s5p_register_clocks(xtal);
Byungho Min8acd1ad2009-06-23 21:40:15 +0900103 s5pc100_register_clocks();
104 s5pc100_setup_clocks();
105}
106
107void __init s5pc100_init_irq(void)
108{
Marek Szyprowskiacc84702010-05-20 07:51:08 +0200109 u32 vic[] = {~0, ~0, ~0};
Byungho Min8acd1ad2009-06-23 21:40:15 +0900110
111 /* VIC0, VIC1, and VIC2 are fully populated. */
Marek Szyprowskiacc84702010-05-20 07:51:08 +0200112 s5p_init_irq(vic, ARRAY_SIZE(vic));
Byungho Min8acd1ad2009-06-23 21:40:15 +0900113}
114
Marek Szyprowskiacc84702010-05-20 07:51:08 +0200115static struct sysdev_class s5pc100_sysclass = {
Byungho Min8acd1ad2009-06-23 21:40:15 +0900116 .name = "s5pc100-core",
117};
118
119static struct sys_device s5pc100_sysdev = {
120 .cls = &s5pc100_sysclass,
121};
122
123static int __init s5pc100_core_init(void)
124{
125 return sysdev_class_register(&s5pc100_sysclass);
126}
127
128core_initcall(s5pc100_core_init);
129
130int __init s5pc100_init(void)
131{
Marek Szyprowskiacc84702010-05-20 07:51:08 +0200132 printk(KERN_INFO "S5PC100: Initializing architecture\n");
Byungho Min8acd1ad2009-06-23 21:40:15 +0900133
Marek Szyprowskiacc84702010-05-20 07:51:08 +0200134 /* set idle function */
135 pm_idle = s5pc100_idle;
Kyungmin Parkc3fcf5d2009-11-17 08:41:17 +0100136
Byungho Min8acd1ad2009-06-23 21:40:15 +0900137 return sysdev_register(&s5pc100_sysdev);
138}