blob: fd2708e7d8a9f4aa61bf645abad7f644149720e7 [file] [log] [blame]
Byungho Min8acd1ad2009-06-23 21:40:15 +09001/* linux/arch/arm/mach-s5pc100/cpu.c
2 *
Kukjin Kim19a2c062010-08-31 16:30:51 +09003 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
5 *
Byungho Min8acd1ad2009-06-23 21:40:15 +09006 * Copyright 2009 Samsung Electronics Co.
7 * Byungho Min <bhmin@samsung.com>
8 *
9 * Based on mach-s3c6410/cpu.c
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2 as
13 * published by the Free Software Foundation.
14*/
15
16#include <linux/kernel.h>
17#include <linux/types.h>
18#include <linux/interrupt.h>
19#include <linux/list.h>
20#include <linux/timer.h>
21#include <linux/init.h>
22#include <linux/clk.h>
23#include <linux/io.h>
24#include <linux/sysdev.h>
25#include <linux/serial_core.h>
26#include <linux/platform_device.h>
SeungChull Suh4341f9b2010-10-02 12:48:12 +090027#include <linux/sched.h>
Byungho Min8acd1ad2009-06-23 21:40:15 +090028
29#include <asm/mach/arch.h>
30#include <asm/mach/map.h>
31#include <asm/mach/irq.h>
32
Marek Szyprowskiacc84702010-05-20 07:51:08 +020033#include <asm/proc-fns.h>
34
Byungho Min8acd1ad2009-06-23 21:40:15 +090035#include <mach/hardware.h>
36#include <mach/map.h>
37#include <asm/irq.h>
38
Byungho Min8acd1ad2009-06-23 21:40:15 +090039#include <plat/regs-serial.h>
Marek Szyprowskiacc84702010-05-20 07:51:08 +020040#include <mach/regs-clock.h>
Byungho Min8acd1ad2009-06-23 21:40:15 +090041
42#include <plat/cpu.h>
43#include <plat/devs.h>
44#include <plat/clock.h>
Abhilash Kesavan66194a72010-06-08 17:02:08 +090045#include <plat/ata-core.h>
Byungho Min8acd1ad2009-06-23 21:40:15 +090046#include <plat/iic-core.h>
Marek Szyprowskiacc84702010-05-20 07:51:08 +020047#include <plat/sdhci.h>
Naveen Krishna Ch327b9032010-06-30 21:50:24 +090048#include <plat/adc-core.h>
Marek Szyprowski999304b2010-05-20 08:59:05 +020049#include <plat/onenand-core.h>
Pawel Osciakeb42b042010-08-10 18:02:37 -070050#include <plat/fb-core.h>
Marek Szyprowski999304b2010-05-20 08:59:05 +020051
Byungho Min8acd1ad2009-06-23 21:40:15 +090052#include <plat/s5pc100.h>
53
54/* Initial IO mappings */
55
56static struct map_desc s5pc100_iodesc[] __initdata = {
Marek Szyprowskiacc84702010-05-20 07:51:08 +020057 {
58 .virtual = (unsigned long)S5P_VA_SYSTIMER,
59 .pfn = __phys_to_pfn(S5PC100_PA_SYSTIMER),
60 .length = SZ_16K,
61 .type = MT_DEVICE,
62 }, {
Kukjin Kim19a2c062010-08-31 16:30:51 +090063 .virtual = (unsigned long)S5P_VA_GPIO,
64 .pfn = __phys_to_pfn(S5PC100_PA_GPIO),
65 .length = SZ_4K,
66 .type = MT_DEVICE,
67 }, {
68 .virtual = (unsigned long)VA_VIC0,
69 .pfn = __phys_to_pfn(S5PC100_PA_VIC0),
Marek Szyprowskiacc84702010-05-20 07:51:08 +020070 .length = SZ_16K,
71 .type = MT_DEVICE,
72 }, {
Kukjin Kim19a2c062010-08-31 16:30:51 +090073 .virtual = (unsigned long)VA_VIC1,
74 .pfn = __phys_to_pfn(S5PC100_PA_VIC1),
75 .length = SZ_16K,
76 .type = MT_DEVICE,
77 }, {
78 .virtual = (unsigned long)VA_VIC2,
79 .pfn = __phys_to_pfn(S5PC100_PA_VIC2),
80 .length = SZ_16K,
81 .type = MT_DEVICE,
82 }, {
83 .virtual = (unsigned long)S3C_VA_UART,
84 .pfn = __phys_to_pfn(S3C_PA_UART),
85 .length = SZ_512K,
86 .type = MT_DEVICE,
87 }, {
Marek Szyprowskiacc84702010-05-20 07:51:08 +020088 .virtual = (unsigned long)S5PC100_VA_OTHERS,
89 .pfn = __phys_to_pfn(S5PC100_PA_OTHERS),
90 .length = SZ_4K,
91 .type = MT_DEVICE,
92 }
Byungho Min8acd1ad2009-06-23 21:40:15 +090093};
94
Kyungmin Parkc3fcf5d2009-11-17 08:41:17 +010095static void s5pc100_idle(void)
96{
Marek Szyprowskiacc84702010-05-20 07:51:08 +020097 if (!need_resched())
98 cpu_do_idle();
Kyungmin Parkc3fcf5d2009-11-17 08:41:17 +010099
Marek Szyprowskiacc84702010-05-20 07:51:08 +0200100 local_irq_enable();
Kyungmin Parkc3fcf5d2009-11-17 08:41:17 +0100101}
102
Byungho Min8acd1ad2009-06-23 21:40:15 +0900103/* s5pc100_map_io
104 *
105 * register the standard cpu IO areas
106*/
107
108void __init s5pc100_map_io(void)
109{
110 iotable_init(s5pc100_iodesc, ARRAY_SIZE(s5pc100_iodesc));
111
112 /* initialise device information early */
Kyungmin Park86cd4f52009-11-17 08:41:23 +0100113 s5pc100_default_sdhci0();
114 s5pc100_default_sdhci1();
115 s5pc100_default_sdhci2();
Kyungmin Park5eda2882009-11-17 08:41:21 +0100116
Naveen Krishna Ch327b9032010-06-30 21:50:24 +0900117 s3c_adc_setname("s3c64xx-adc");
118
Kyungmin Park5eda2882009-11-17 08:41:21 +0100119 /* the i2c devices are directly compatible with s3c2440 */
120 s3c_i2c0_setname("s3c2440-i2c");
121 s3c_i2c1_setname("s3c2440-i2c");
Marek Szyprowski999304b2010-05-20 08:59:05 +0200122
123 s3c_onenand_setname("s5pc100-onenand");
Pawel Osciakeb42b042010-08-10 18:02:37 -0700124 s3c_fb_setname("s5pc100-fb");
Abhilash Kesavan66194a72010-06-08 17:02:08 +0900125 s3c_cfcon_setname("s5pc100-pata");
Byungho Min8acd1ad2009-06-23 21:40:15 +0900126}
127
128void __init s5pc100_init_clocks(int xtal)
129{
Marek Szyprowskiacc84702010-05-20 07:51:08 +0200130 printk(KERN_DEBUG "%s: initializing clocks\n", __func__);
131
Byungho Min8acd1ad2009-06-23 21:40:15 +0900132 s3c24xx_register_baseclocks(xtal);
Marek Szyprowskiacc84702010-05-20 07:51:08 +0200133 s5p_register_clocks(xtal);
Byungho Min8acd1ad2009-06-23 21:40:15 +0900134 s5pc100_register_clocks();
135 s5pc100_setup_clocks();
136}
137
138void __init s5pc100_init_irq(void)
139{
Marek Szyprowskiacc84702010-05-20 07:51:08 +0200140 u32 vic[] = {~0, ~0, ~0};
Byungho Min8acd1ad2009-06-23 21:40:15 +0900141
142 /* VIC0, VIC1, and VIC2 are fully populated. */
Marek Szyprowskiacc84702010-05-20 07:51:08 +0200143 s5p_init_irq(vic, ARRAY_SIZE(vic));
Byungho Min8acd1ad2009-06-23 21:40:15 +0900144}
145
Marek Szyprowskiacc84702010-05-20 07:51:08 +0200146static struct sysdev_class s5pc100_sysclass = {
Byungho Min8acd1ad2009-06-23 21:40:15 +0900147 .name = "s5pc100-core",
148};
149
150static struct sys_device s5pc100_sysdev = {
151 .cls = &s5pc100_sysclass,
152};
153
154static int __init s5pc100_core_init(void)
155{
156 return sysdev_class_register(&s5pc100_sysclass);
157}
158
159core_initcall(s5pc100_core_init);
160
161int __init s5pc100_init(void)
162{
Marek Szyprowskiacc84702010-05-20 07:51:08 +0200163 printk(KERN_INFO "S5PC100: Initializing architecture\n");
Byungho Min8acd1ad2009-06-23 21:40:15 +0900164
Marek Szyprowskiacc84702010-05-20 07:51:08 +0200165 /* set idle function */
166 pm_idle = s5pc100_idle;
Kyungmin Parkc3fcf5d2009-11-17 08:41:17 +0100167
Byungho Min8acd1ad2009-06-23 21:40:15 +0900168 return sysdev_register(&s5pc100_sysdev);
169}