blob: 962e71169750a0243225b52c1ddda062779eb5e0 [file] [log] [blame]
David Brown56e2d8a2011-08-04 02:01:02 -07001/* Copyright (c) 2010, 2011, Code Aurora Forum. All rights reserved.
Steve Mucklea55df6e2010-01-07 12:43:24 -08002 *
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.
Steve Mucklea55df6e2010-01-07 12:43:24 -080011 */
12
13#include <linux/kernel.h>
14#include <linux/platform_device.h>
15#include <linux/io.h>
Steve Muckle9161d302010-02-11 11:50:40 -080016#include <linux/irq.h>
David Brown56e2d8a2011-08-04 02:01:02 -070017#include <linux/irqdomain.h>
18#include <linux/of.h>
19#include <linux/of_address.h>
20#include <linux/of_platform.h>
Stephen Boyd9e775ad2011-08-12 00:14:28 +010021#include <linux/memblock.h>
Steve Mucklea55df6e2010-01-07 12:43:24 -080022
23#include <asm/mach-types.h>
24#include <asm/mach/arch.h>
25#include <asm/hardware/gic.h>
Stephen Boyd9e775ad2011-08-12 00:14:28 +010026#include <asm/setup.h>
Steve Mucklea55df6e2010-01-07 12:43:24 -080027
28#include <mach/board.h>
29#include <mach/msm_iomap.h>
30
Stephen Boyd47a67702011-10-25 09:35:19 -070031static void __init msm8x60_fixup(struct tag *tag, char **cmdline,
32 struct meminfo *mi)
Stephen Boyd9e775ad2011-08-12 00:14:28 +010033{
34 for (; tag->hdr.size; tag = tag_next(tag))
35 if (tag->hdr.tag == ATAG_MEM &&
36 tag->u.mem.start == 0x40200000) {
37 tag->u.mem.start = 0x40000000;
38 tag->u.mem.size += SZ_2M;
39 }
40}
41
42static void __init msm8x60_reserve(void)
43{
44 memblock_remove(0x40000000, SZ_2M);
45}
Steve Mucklea55df6e2010-01-07 12:43:24 -080046
47static void __init msm8x60_map_io(void)
48{
49 msm_map_msm8x60_io();
50}
51
52static void __init msm8x60_init_irq(void)
53{
Russell Kingff2e27a2010-12-04 16:13:29 +000054 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
55 (void *)MSM_QGIC_CPU_BASE);
Steve Muckle9161d302010-02-11 11:50:40 -080056
57 /* Edge trigger PPIs except AVS_SVICINT and AVS_SVICINTSWDONE */
58 writel(0xFFFFD7FF, MSM_QGIC_DIST_BASE + GIC_DIST_CONFIG + 4);
59
60 /* RUMI does not adhere to GIC spec by enabling STIs by default.
61 * Enable/clear is supposed to be RO for STIs, but is RW on RUMI.
62 */
Steve Muckle57bbf1c2010-01-07 12:51:10 -080063 if (!machine_is_msm8x60_sim())
64 writel(0x0000FFFF, MSM_QGIC_DIST_BASE + GIC_DIST_ENABLE_SET);
Steve Mucklea55df6e2010-01-07 12:43:24 -080065}
66
67static void __init msm8x60_init(void)
68{
69}
70
David Brown56e2d8a2011-08-04 02:01:02 -070071#ifdef CONFIG_OF
72static struct of_dev_auxdata msm_auxdata_lookup[] __initdata = {
73 {}
74};
75
76static struct of_device_id msm_dt_gic_match[] __initdata = {
77 { .compatible = "qcom,msm-8660-qgic", },
78 {}
79};
80
81static void __init msm8x60_dt_init(void)
82{
Grant Likely6b783f72012-01-10 17:09:30 -070083 irq_domain_generate_simple(msm_dt_gic_match, MSM8X60_QGIC_DIST_PHYS,
84 GIC_SPI_START);
David Brown56e2d8a2011-08-04 02:01:02 -070085
86 if (of_machine_is_compatible("qcom,msm8660-surf")) {
87 printk(KERN_INFO "Init surf UART registers\n");
88 msm8x60_init_uart12dm();
89 }
90
91 of_platform_populate(NULL, of_default_bus_match_table,
92 msm_auxdata_lookup, NULL);
93}
94
95static const char *msm8x60_fluid_match[] __initdata = {
96 "qcom,msm8660-fluid",
97 "qcom,msm8660-surf",
98 NULL
99};
100#endif /* CONFIG_OF */
101
Steve Mucklea55df6e2010-01-07 12:43:24 -0800102MACHINE_START(MSM8X60_RUMI3, "QCT MSM8X60 RUMI3")
Stephen Boyd9e775ad2011-08-12 00:14:28 +0100103 .fixup = msm8x60_fixup,
104 .reserve = msm8x60_reserve,
Steve Mucklea55df6e2010-01-07 12:43:24 -0800105 .map_io = msm8x60_map_io,
106 .init_irq = msm8x60_init_irq,
Marc Zyngier041f7772011-09-06 10:23:45 +0100107 .handle_irq = gic_handle_irq,
Steve Mucklea55df6e2010-01-07 12:43:24 -0800108 .init_machine = msm8x60_init,
109 .timer = &msm_timer,
110MACHINE_END
Steve Muckle49b76f72010-03-19 17:00:08 -0700111
112MACHINE_START(MSM8X60_SURF, "QCT MSM8X60 SURF")
Stephen Boyd9e775ad2011-08-12 00:14:28 +0100113 .fixup = msm8x60_fixup,
114 .reserve = msm8x60_reserve,
Steve Muckle49b76f72010-03-19 17:00:08 -0700115 .map_io = msm8x60_map_io,
116 .init_irq = msm8x60_init_irq,
Marc Zyngier041f7772011-09-06 10:23:45 +0100117 .handle_irq = gic_handle_irq,
Steve Muckle49b76f72010-03-19 17:00:08 -0700118 .init_machine = msm8x60_init,
119 .timer = &msm_timer,
120MACHINE_END
Steve Muckle57bbf1c2010-01-07 12:51:10 -0800121
122MACHINE_START(MSM8X60_SIM, "QCT MSM8X60 SIMULATOR")
Stephen Boyd9e775ad2011-08-12 00:14:28 +0100123 .fixup = msm8x60_fixup,
124 .reserve = msm8x60_reserve,
Steve Muckle57bbf1c2010-01-07 12:51:10 -0800125 .map_io = msm8x60_map_io,
126 .init_irq = msm8x60_init_irq,
Marc Zyngier041f7772011-09-06 10:23:45 +0100127 .handle_irq = gic_handle_irq,
Steve Muckle57bbf1c2010-01-07 12:51:10 -0800128 .init_machine = msm8x60_init,
129 .timer = &msm_timer,
130MACHINE_END
Gregory Bean69b7f6f2010-04-04 22:29:02 -0700131
132MACHINE_START(MSM8X60_FFA, "QCT MSM8X60 FFA")
Stephen Boyd9e775ad2011-08-12 00:14:28 +0100133 .fixup = msm8x60_fixup,
134 .reserve = msm8x60_reserve,
Gregory Bean69b7f6f2010-04-04 22:29:02 -0700135 .map_io = msm8x60_map_io,
136 .init_irq = msm8x60_init_irq,
Marc Zyngier041f7772011-09-06 10:23:45 +0100137 .handle_irq = gic_handle_irq,
Gregory Bean69b7f6f2010-04-04 22:29:02 -0700138 .init_machine = msm8x60_init,
139 .timer = &msm_timer,
140MACHINE_END
David Brown56e2d8a2011-08-04 02:01:02 -0700141
142#ifdef CONFIG_OF
143/* TODO: General device tree support for all MSM. */
144DT_MACHINE_START(MSM_DT, "Qualcomm MSM (Flattened Device Tree)")
145 .map_io = msm8x60_map_io,
146 .init_irq = msm8x60_init_irq,
147 .init_machine = msm8x60_dt_init,
148 .timer = &msm_timer,
149 .dt_compat = msm8x60_fluid_match,
150MACHINE_END
151#endif /* CONFIG_OF */