blob: 66beac424e40a896458ccfd9f4180ba9eb1ef19e [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 }, {
60 .virtual = (unsigned long)S5P_VA_GPIO,
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 }, {
65 .virtual = (unsigned long)S3C_VA_UART,
66 .pfn = __phys_to_pfn(S3C_PA_UART),
67 .length = SZ_512K,
68 .type = MT_DEVICE,
Changhwan Youn766211e2010-08-27 17:57:44 +090069 },
Changhwan Youn2b12b5c2010-07-26 21:08:52 +090070};
71
72static void s5pv310_idle(void)
73{
74 if (!need_resched())
75 cpu_do_idle();
76
77 local_irq_enable();
78}
79
80/* s5pv310_map_io
81 *
82 * register the standard cpu IO areas
83*/
84void __init s5pv310_map_io(void)
85{
86 iotable_init(s5pv310_iodesc, ARRAY_SIZE(s5pv310_iodesc));
Hyuk Lee1036c3a2010-10-05 19:07:41 +090087
88 /* initialize device information early */
89 s5pv310_default_sdhci0();
90 s5pv310_default_sdhci1();
91 s5pv310_default_sdhci2();
92 s5pv310_default_sdhci3();
Changhwan Youn2b12b5c2010-07-26 21:08:52 +090093}
94
95void __init s5pv310_init_clocks(int xtal)
96{
97 printk(KERN_DEBUG "%s: initializing clocks\n", __func__);
98
99 s3c24xx_register_baseclocks(xtal);
100 s5p_register_clocks(xtal);
101 s5pv310_register_clocks();
102 s5pv310_setup_clocks();
103}
104
105void __init s5pv310_init_irq(void)
106{
107 int irq;
108
109 gic_cpu_base_addr = S5P_VA_GIC_CPU;
110 gic_dist_init(0, S5P_VA_GIC_DIST, IRQ_LOCALTIMER);
111 gic_cpu_init(0, S5P_VA_GIC_CPU);
112
113 for (irq = 0; irq < MAX_COMBINER_NR; irq++) {
114 combiner_init(irq, (void __iomem *)S5P_VA_COMBINER(irq),
115 COMBINER_IRQ(irq, 0));
116 combiner_cascade_irq(irq, IRQ_SPI(irq));
117 }
118
119 /* The parameters of s5p_init_irq() are for VIC init.
120 * Theses parameters should be NULL and 0 because S5PV310
121 * uses GIC instead of VIC.
122 */
123 s5p_init_irq(NULL, 0);
124}
125
126struct sysdev_class s5pv310_sysclass = {
127 .name = "s5pv310-core",
128};
129
130static struct sys_device s5pv310_sysdev = {
131 .cls = &s5pv310_sysclass,
132};
133
134static int __init s5pv310_core_init(void)
135{
136 return sysdev_class_register(&s5pv310_sysclass);
137}
138
139core_initcall(s5pv310_core_init);
140
141int __init s5pv310_init(void)
142{
143 printk(KERN_INFO "S5PV310: Initializing architecture\n");
144
145 /* set idle function */
146 pm_idle = s5pv310_idle;
147
148 return sysdev_register(&s5pv310_sysdev);
149}