ARM: msm: Don't touch GIC registers outside of GIC code
[deliverable/linux.git] / arch / arm / mach-msm / board-msm8x60.c
CommitLineData
56e2d8a6 1/* Copyright (c) 2010, 2011, Code Aurora Forum. All rights reserved.
a55df6ed
SM
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
a55df6ed
SM
11 */
12
13#include <linux/kernel.h>
14#include <linux/platform_device.h>
15#include <linux/io.h>
9161d303 16#include <linux/irq.h>
56e2d8a6
DB
17#include <linux/irqdomain.h>
18#include <linux/of.h>
19#include <linux/of_address.h>
2b7b9a7d 20#include <linux/of_irq.h>
56e2d8a6 21#include <linux/of_platform.h>
9e775ad1 22#include <linux/memblock.h>
a55df6ed
SM
23
24#include <asm/mach-types.h>
25#include <asm/mach/arch.h>
26#include <asm/hardware/gic.h>
9e775ad1 27#include <asm/setup.h>
a55df6ed
SM
28
29#include <mach/board.h>
30#include <mach/msm_iomap.h>
31
47a6770a
SB
32static void __init msm8x60_fixup(struct tag *tag, char **cmdline,
33 struct meminfo *mi)
9e775ad1
SB
34{
35 for (; tag->hdr.size; tag = tag_next(tag))
36 if (tag->hdr.tag == ATAG_MEM &&
37 tag->u.mem.start == 0x40200000) {
38 tag->u.mem.start = 0x40000000;
39 tag->u.mem.size += SZ_2M;
40 }
41}
42
43static void __init msm8x60_reserve(void)
44{
45 memblock_remove(0x40000000, SZ_2M);
46}
a55df6ed
SM
47
48static void __init msm8x60_map_io(void)
49{
50 msm_map_msm8x60_io();
51}
52
2b7b9a7d
DB
53#ifdef CONFIG_OF
54static struct of_device_id msm_dt_gic_match[] __initdata = {
55 { .compatible = "qcom,msm-8660-qgic", .data = gic_of_init },
56 {}
57};
58#endif
59
a55df6ed
SM
60static void __init msm8x60_init_irq(void)
61{
2b7b9a7d
DB
62 if (!of_have_populated_dt())
63 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
64 (void *)MSM_QGIC_CPU_BASE);
65#ifdef CONFIG_OF
66 else
67 of_irq_init(msm_dt_gic_match);
68#endif
9161d303 69
9161d303
SM
70 /* RUMI does not adhere to GIC spec by enabling STIs by default.
71 * Enable/clear is supposed to be RO for STIs, but is RW on RUMI.
72 */
57bbf1cc
SM
73 if (!machine_is_msm8x60_sim())
74 writel(0x0000FFFF, MSM_QGIC_DIST_BASE + GIC_DIST_ENABLE_SET);
a55df6ed
SM
75}
76
77static void __init msm8x60_init(void)
78{
79}
80
c633c531
SG
81static void __init msm8x60_init_late(void)
82{
83 smd_debugfs_init();
84}
85
56e2d8a6
DB
86#ifdef CONFIG_OF
87static struct of_dev_auxdata msm_auxdata_lookup[] __initdata = {
88 {}
89};
90
56e2d8a6
DB
91static void __init msm8x60_dt_init(void)
92{
56e2d8a6
DB
93 if (of_machine_is_compatible("qcom,msm8660-surf")) {
94 printk(KERN_INFO "Init surf UART registers\n");
95 msm8x60_init_uart12dm();
96 }
97
98 of_platform_populate(NULL, of_default_bus_match_table,
99 msm_auxdata_lookup, NULL);
100}
101
102static const char *msm8x60_fluid_match[] __initdata = {
103 "qcom,msm8660-fluid",
104 "qcom,msm8660-surf",
105 NULL
106};
107#endif /* CONFIG_OF */
108
a55df6ed 109MACHINE_START(MSM8X60_RUMI3, "QCT MSM8X60 RUMI3")
9e775ad1
SB
110 .fixup = msm8x60_fixup,
111 .reserve = msm8x60_reserve,
a55df6ed
SM
112 .map_io = msm8x60_map_io,
113 .init_irq = msm8x60_init_irq,
041f777c 114 .handle_irq = gic_handle_irq,
a55df6ed 115 .init_machine = msm8x60_init,
c633c531 116 .init_late = msm8x60_init_late,
a55df6ed
SM
117 .timer = &msm_timer,
118MACHINE_END
49b76f71
SM
119
120MACHINE_START(MSM8X60_SURF, "QCT MSM8X60 SURF")
9e775ad1
SB
121 .fixup = msm8x60_fixup,
122 .reserve = msm8x60_reserve,
49b76f71
SM
123 .map_io = msm8x60_map_io,
124 .init_irq = msm8x60_init_irq,
041f777c 125 .handle_irq = gic_handle_irq,
49b76f71 126 .init_machine = msm8x60_init,
c633c531 127 .init_late = msm8x60_init_late,
49b76f71
SM
128 .timer = &msm_timer,
129MACHINE_END
57bbf1cc
SM
130
131MACHINE_START(MSM8X60_SIM, "QCT MSM8X60 SIMULATOR")
9e775ad1
SB
132 .fixup = msm8x60_fixup,
133 .reserve = msm8x60_reserve,
57bbf1cc
SM
134 .map_io = msm8x60_map_io,
135 .init_irq = msm8x60_init_irq,
041f777c 136 .handle_irq = gic_handle_irq,
57bbf1cc 137 .init_machine = msm8x60_init,
c633c531 138 .init_late = msm8x60_init_late,
57bbf1cc
SM
139 .timer = &msm_timer,
140MACHINE_END
69b7f6ff
GB
141
142MACHINE_START(MSM8X60_FFA, "QCT MSM8X60 FFA")
9e775ad1
SB
143 .fixup = msm8x60_fixup,
144 .reserve = msm8x60_reserve,
69b7f6ff
GB
145 .map_io = msm8x60_map_io,
146 .init_irq = msm8x60_init_irq,
041f777c 147 .handle_irq = gic_handle_irq,
69b7f6ff 148 .init_machine = msm8x60_init,
c633c531 149 .init_late = msm8x60_init_late,
69b7f6ff
GB
150 .timer = &msm_timer,
151MACHINE_END
56e2d8a6
DB
152
153#ifdef CONFIG_OF
154/* TODO: General device tree support for all MSM. */
155DT_MACHINE_START(MSM_DT, "Qualcomm MSM (Flattened Device Tree)")
156 .map_io = msm8x60_map_io,
157 .init_irq = msm8x60_init_irq,
63c86c95 158 .handle_irq = gic_handle_irq,
56e2d8a6 159 .init_machine = msm8x60_dt_init,
c633c531 160 .init_late = msm8x60_init_late,
56e2d8a6
DB
161 .timer = &msm_timer,
162 .dt_compat = msm8x60_fluid_match,
163MACHINE_END
164#endif /* CONFIG_OF */
This page took 0.114741 seconds and 5 git commands to generate.