]> git.kernelconcepts.de Git - karo-tx-linux.git/blob - arch/arm/mach-msm/board-msm8x60.c
93f90410d0dd08947adde800a66cc9229577e9b0
[karo-tx-linux.git] / arch / arm / mach-msm / board-msm8x60.c
1 /* Copyright (c) 2010, 2011, Code Aurora Forum. All rights reserved.
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.
11  */
12
13 #include <linux/kernel.h>
14 #include <linux/platform_device.h>
15 #include <linux/io.h>
16 #include <linux/irq.h>
17 #include <linux/irqdomain.h>
18 #include <linux/of.h>
19 #include <linux/of_address.h>
20 #include <linux/of_irq.h>
21 #include <linux/of_platform.h>
22 #include <linux/memblock.h>
23
24 #include <asm/mach-types.h>
25 #include <asm/mach/arch.h>
26 #include <asm/hardware/gic.h>
27 #include <asm/setup.h>
28
29 #include <mach/board.h>
30 #include <mach/msm_iomap.h>
31 #include "common.h"
32
33 static void __init msm8x60_fixup(struct tag *tag, char **cmdline,
34                 struct meminfo *mi)
35 {
36         for (; tag->hdr.size; tag = tag_next(tag))
37                 if (tag->hdr.tag == ATAG_MEM &&
38                                 tag->u.mem.start == 0x40200000) {
39                         tag->u.mem.start = 0x40000000;
40                         tag->u.mem.size += SZ_2M;
41                 }
42 }
43
44 static void __init msm8x60_reserve(void)
45 {
46         memblock_remove(0x40000000, SZ_2M);
47 }
48
49 static void __init msm8x60_map_io(void)
50 {
51         msm_map_msm8x60_io();
52 }
53
54 #ifdef CONFIG_OF
55 static struct of_device_id msm_dt_gic_match[] __initdata = {
56         { .compatible = "qcom,msm-8660-qgic", .data = gic_of_init },
57         {}
58 };
59 #endif
60
61 static void __init msm8x60_init_irq(void)
62 {
63         if (!of_have_populated_dt())
64                 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
65                          (void *)MSM_QGIC_CPU_BASE);
66 #ifdef CONFIG_OF
67         else
68                 of_irq_init(msm_dt_gic_match);
69 #endif
70
71         /* RUMI does not adhere to GIC spec by enabling STIs by default.
72          * Enable/clear is supposed to be RO for STIs, but is RW on RUMI.
73          */
74         if (!machine_is_msm8x60_sim())
75                 writel(0x0000FFFF, MSM_QGIC_DIST_BASE + GIC_DIST_ENABLE_SET);
76 }
77
78 static void __init msm8x60_init(void)
79 {
80 }
81
82 static void __init msm8x60_init_late(void)
83 {
84         smd_debugfs_init();
85 }
86
87 #ifdef CONFIG_OF
88 static struct of_dev_auxdata msm_auxdata_lookup[] __initdata = {
89         {}
90 };
91
92 static void __init msm8x60_dt_init(void)
93 {
94         if (of_machine_is_compatible("qcom,msm8660-surf")) {
95                 printk(KERN_INFO "Init surf UART registers\n");
96                 msm8x60_init_uart12dm();
97         }
98
99         of_platform_populate(NULL, of_default_bus_match_table,
100                         msm_auxdata_lookup, NULL);
101 }
102
103 static const char *msm8x60_fluid_match[] __initdata = {
104         "qcom,msm8660-fluid",
105         "qcom,msm8660-surf",
106         NULL
107 };
108 #endif /* CONFIG_OF */
109
110 MACHINE_START(MSM8X60_RUMI3, "QCT MSM8X60 RUMI3")
111         .fixup = msm8x60_fixup,
112         .reserve = msm8x60_reserve,
113         .map_io = msm8x60_map_io,
114         .init_irq = msm8x60_init_irq,
115         .handle_irq = gic_handle_irq,
116         .init_machine = msm8x60_init,
117         .init_late = msm8x60_init_late,
118         .timer = &msm8x60_timer,
119 MACHINE_END
120
121 MACHINE_START(MSM8X60_SURF, "QCT MSM8X60 SURF")
122         .fixup = msm8x60_fixup,
123         .reserve = msm8x60_reserve,
124         .map_io = msm8x60_map_io,
125         .init_irq = msm8x60_init_irq,
126         .handle_irq = gic_handle_irq,
127         .init_machine = msm8x60_init,
128         .init_late = msm8x60_init_late,
129         .timer = &msm8x60_timer,
130 MACHINE_END
131
132 MACHINE_START(MSM8X60_SIM, "QCT MSM8X60 SIMULATOR")
133         .fixup = msm8x60_fixup,
134         .reserve = msm8x60_reserve,
135         .map_io = msm8x60_map_io,
136         .init_irq = msm8x60_init_irq,
137         .handle_irq = gic_handle_irq,
138         .init_machine = msm8x60_init,
139         .init_late = msm8x60_init_late,
140         .timer = &msm8x60_timer,
141 MACHINE_END
142
143 MACHINE_START(MSM8X60_FFA, "QCT MSM8X60 FFA")
144         .fixup = msm8x60_fixup,
145         .reserve = msm8x60_reserve,
146         .map_io = msm8x60_map_io,
147         .init_irq = msm8x60_init_irq,
148         .handle_irq = gic_handle_irq,
149         .init_machine = msm8x60_init,
150         .init_late = msm8x60_init_late,
151         .timer = &msm8x60_timer,
152 MACHINE_END
153
154 #ifdef CONFIG_OF
155 /* TODO: General device tree support for all MSM. */
156 DT_MACHINE_START(MSM_DT, "Qualcomm MSM (Flattened Device Tree)")
157         .map_io = msm8x60_map_io,
158         .init_irq = msm8x60_init_irq,
159         .handle_irq = gic_handle_irq,
160         .init_machine = msm8x60_dt_init,
161         .init_late = msm8x60_init_late,
162         .timer = &msm8x60_timer,
163         .dt_compat = msm8x60_fluid_match,
164 MACHINE_END
165 #endif /* CONFIG_OF */