blob: 5b97900544218cba1e31ec0cbe2fe39e26a0814d [file] [log] [blame]
Changhwan Youn2b12b5c2010-07-26 21:08:52 +09001/* linux/arch/arm/mach-s5pv310/cpu.c
2 *
3 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com/
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9*/
10
11#include <linux/sched.h>
12#include <linux/sysdev.h>
13
14#include <asm/mach/map.h>
15#include <asm/mach/irq.h>
16
17#include <asm/proc-fns.h>
18
19#include <plat/cpu.h>
20#include <plat/clock.h>
21#include <plat/s5pv310.h>
Hyuk Lee1036c3a2010-10-05 19:07:41 +090022#include <plat/sdhci.h>
Changhwan Youn2b12b5c2010-07-26 21:08:52 +090023
24#include <mach/regs-irq.h>
25
26void __iomem *gic_cpu_base_addr;
27
28extern int combiner_init(unsigned int combiner_nr, void __iomem *base,
29 unsigned int irq_start);
30extern void combiner_cascade_irq(unsigned int combiner_nr, unsigned int irq);
31
32/* Initial IO mappings */
33static struct map_desc s5pv310_iodesc[] __initdata = {
34 {
Changhwan Youn766211e2010-08-27 17:57:44 +090035 .virtual = (unsigned long)S5P_VA_SYSRAM,
36 .pfn = __phys_to_pfn(S5PV310_PA_SYSRAM),
37 .length = SZ_4K,
38 .type = MT_DEVICE,
39 }, {
Kukjin Kimc598c472010-08-18 21:45:49 +090040 .virtual = (unsigned long)S5P_VA_CMU,
41 .pfn = __phys_to_pfn(S5PV310_PA_CMU),
42 .length = SZ_128K,
43 .type = MT_DEVICE,
Kukjin Kim19a2c062010-08-31 16:30:51 +090044 }, {
45 .virtual = (unsigned long)S5P_VA_COMBINER_BASE,
46 .pfn = __phys_to_pfn(S5PV310_PA_COMBINER),
47 .length = SZ_4K,
48 .type = MT_DEVICE,
49 }, {
50 .virtual = (unsigned long)S5P_VA_COREPERI_BASE,
51 .pfn = __phys_to_pfn(S5PV310_PA_COREPERI),
52 .length = SZ_8K,
53 .type = MT_DEVICE,
54 }, {
55 .virtual = (unsigned long)S5P_VA_L2CC,
56 .pfn = __phys_to_pfn(S5PV310_PA_L2CC),
57 .length = SZ_4K,
58 .type = MT_DEVICE,
59 }, {
Jongpill Lee37ea63b2010-10-14 15:46:18 +090060 .virtual = (unsigned long)S5P_VA_GPIO1,
Kukjin Kimfe0cdec2010-09-09 21:57:29 +090061 .pfn = __phys_to_pfn(S5PV310_PA_GPIO1),
Kukjin Kim19a2c062010-08-31 16:30:51 +090062 .length = SZ_4K,
63 .type = MT_DEVICE,
64 }, {
Jongpill Lee37ea63b2010-10-14 15:46:18 +090065 .virtual = (unsigned long)S5P_VA_GPIO2,
66 .pfn = __phys_to_pfn(S5PV310_PA_GPIO2),
67 .length = SZ_4K,
68 .type = MT_DEVICE,
69 }, {
70 .virtual = (unsigned long)S5P_VA_GPIO3,
71 .pfn = __phys_to_pfn(S5PV310_PA_GPIO3),
72 .length = SZ_256,
73 .type = MT_DEVICE,
74 }, {
Kukjin Kim19a2c062010-08-31 16:30:51 +090075 .virtual = (unsigned long)S3C_VA_UART,
76 .pfn = __phys_to_pfn(S3C_PA_UART),
77 .length = SZ_512K,
78 .type = MT_DEVICE,
Changhwan Youn766211e2010-08-27 17:57:44 +090079 },
Changhwan Youn2b12b5c2010-07-26 21:08:52 +090080};
81
82static void s5pv310_idle(void)
83{
84 if (!need_resched())
85 cpu_do_idle();
86
87 local_irq_enable();
88}
89
90/* s5pv310_map_io
91 *
92 * register the standard cpu IO areas
93*/
94void __init s5pv310_map_io(void)
95{
96 iotable_init(s5pv310_iodesc, ARRAY_SIZE(s5pv310_iodesc));
Hyuk Lee1036c3a2010-10-05 19:07:41 +090097
98 /* initialize device information early */
99 s5pv310_default_sdhci0();
100 s5pv310_default_sdhci1();
101 s5pv310_default_sdhci2();
102 s5pv310_default_sdhci3();
Changhwan Youn2b12b5c2010-07-26 21:08:52 +0900103}
104
105void __init s5pv310_init_clocks(int xtal)
106{
107 printk(KERN_DEBUG "%s: initializing clocks\n", __func__);
108
109 s3c24xx_register_baseclocks(xtal);
110 s5p_register_clocks(xtal);
111 s5pv310_register_clocks();
112 s5pv310_setup_clocks();
113}
114
115void __init s5pv310_init_irq(void)
116{
117 int irq;
118
119 gic_cpu_base_addr = S5P_VA_GIC_CPU;
120 gic_dist_init(0, S5P_VA_GIC_DIST, IRQ_LOCALTIMER);
121 gic_cpu_init(0, S5P_VA_GIC_CPU);
122
123 for (irq = 0; irq < MAX_COMBINER_NR; irq++) {
124 combiner_init(irq, (void __iomem *)S5P_VA_COMBINER(irq),
125 COMBINER_IRQ(irq, 0));
126 combiner_cascade_irq(irq, IRQ_SPI(irq));
127 }
128
129 /* The parameters of s5p_init_irq() are for VIC init.
130 * Theses parameters should be NULL and 0 because S5PV310
131 * uses GIC instead of VIC.
132 */
133 s5p_init_irq(NULL, 0);
134}
135
136struct sysdev_class s5pv310_sysclass = {
137 .name = "s5pv310-core",
138};
139
140static struct sys_device s5pv310_sysdev = {
141 .cls = &s5pv310_sysclass,
142};
143
144static int __init s5pv310_core_init(void)
145{
146 return sysdev_class_register(&s5pv310_sysclass);
147}
148
149core_initcall(s5pv310_core_init);
150
151int __init s5pv310_init(void)
152{
153 printk(KERN_INFO "S5PV310: Initializing architecture\n");
154
155 /* set idle function */
156 pm_idle = s5pv310_idle;
157
158 return sysdev_register(&s5pv310_sysdev);
159}