]> bbs.cooldavid.org Git - net-next-2.6.git/blame - arch/arm/mach-s5pv310/cpu.c
ARM: S5PV310: Fix on Secondary CPU startup
[net-next-2.6.git] / arch / arm / mach-s5pv310 / cpu.c
CommitLineData
2b12b5c4
CY
1/* 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>
22
23#include <mach/regs-irq.h>
24
25void __iomem *gic_cpu_base_addr;
26
27extern int combiner_init(unsigned int combiner_nr, void __iomem *base,
28 unsigned int irq_start);
29extern void combiner_cascade_irq(unsigned int combiner_nr, unsigned int irq);
30
31/* Initial IO mappings */
32static struct map_desc s5pv310_iodesc[] __initdata = {
33 {
34 .virtual = (unsigned long)S5P_VA_COREPERI_BASE,
35 .pfn = __phys_to_pfn(S5PV310_PA_COREPERI),
36 .length = SZ_8K,
37 .type = MT_DEVICE,
38 }, {
39 .virtual = (unsigned long)S5P_VA_COMBINER_BASE,
40 .pfn = __phys_to_pfn(S5PV310_PA_COMBINER),
41 .length = SZ_4K,
42 .type = MT_DEVICE,
43 }, {
44 .virtual = (unsigned long)S5P_VA_L2CC,
45 .pfn = __phys_to_pfn(S5PV310_PA_L2CC),
46 .length = SZ_4K,
47 .type = MT_DEVICE,
766211e7
CY
48 }, {
49 .virtual = (unsigned long)S5P_VA_SYSRAM,
50 .pfn = __phys_to_pfn(S5PV310_PA_SYSRAM),
51 .length = SZ_4K,
52 .type = MT_DEVICE,
c598c47d
KK
53 }, {
54 .virtual = (unsigned long)S5P_VA_CMU,
55 .pfn = __phys_to_pfn(S5PV310_PA_CMU),
56 .length = SZ_128K,
57 .type = MT_DEVICE,
766211e7 58 },
2b12b5c4
CY
59};
60
61static void s5pv310_idle(void)
62{
63 if (!need_resched())
64 cpu_do_idle();
65
66 local_irq_enable();
67}
68
69/* s5pv310_map_io
70 *
71 * register the standard cpu IO areas
72*/
73void __init s5pv310_map_io(void)
74{
75 iotable_init(s5pv310_iodesc, ARRAY_SIZE(s5pv310_iodesc));
76}
77
78void __init s5pv310_init_clocks(int xtal)
79{
80 printk(KERN_DEBUG "%s: initializing clocks\n", __func__);
81
82 s3c24xx_register_baseclocks(xtal);
83 s5p_register_clocks(xtal);
84 s5pv310_register_clocks();
85 s5pv310_setup_clocks();
86}
87
88void __init s5pv310_init_irq(void)
89{
90 int irq;
91
92 gic_cpu_base_addr = S5P_VA_GIC_CPU;
93 gic_dist_init(0, S5P_VA_GIC_DIST, IRQ_LOCALTIMER);
94 gic_cpu_init(0, S5P_VA_GIC_CPU);
95
96 for (irq = 0; irq < MAX_COMBINER_NR; irq++) {
97 combiner_init(irq, (void __iomem *)S5P_VA_COMBINER(irq),
98 COMBINER_IRQ(irq, 0));
99 combiner_cascade_irq(irq, IRQ_SPI(irq));
100 }
101
102 /* The parameters of s5p_init_irq() are for VIC init.
103 * Theses parameters should be NULL and 0 because S5PV310
104 * uses GIC instead of VIC.
105 */
106 s5p_init_irq(NULL, 0);
107}
108
109struct sysdev_class s5pv310_sysclass = {
110 .name = "s5pv310-core",
111};
112
113static struct sys_device s5pv310_sysdev = {
114 .cls = &s5pv310_sysclass,
115};
116
117static int __init s5pv310_core_init(void)
118{
119 return sysdev_class_register(&s5pv310_sysclass);
120}
121
122core_initcall(s5pv310_core_init);
123
124int __init s5pv310_init(void)
125{
126 printk(KERN_INFO "S5PV310: Initializing architecture\n");
127
128 /* set idle function */
129 pm_idle = s5pv310_idle;
130
131 return sysdev_register(&s5pv310_sysdev);
132}