blob: e37a724cd1eb5c1e2703571deb84f0adfc3d28f9 [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>
David Brown2b7b9a72012-04-23 15:34:20 -070020#include <linux/of_irq.h>
David Brown56e2d8a2011-08-04 02:01:02 -070021#include <linux/of_platform.h>
Stephen Boyd9e775ad2011-08-12 00:14:28 +010022#include <linux/memblock.h>
Steve Mucklea55df6e2010-01-07 12:43:24 -080023
24#include <asm/mach-types.h>
25#include <asm/mach/arch.h>
26#include <asm/hardware/gic.h>
Stephen Boyd9e775ad2011-08-12 00:14:28 +010027#include <asm/setup.h>
Steve Mucklea55df6e2010-01-07 12:43:24 -080028
29#include <mach/board.h>
30#include <mach/msm_iomap.h>
31
Stephen Boyd47a67702011-10-25 09:35:19 -070032static void __init msm8x60_fixup(struct tag *tag, char **cmdline,
33 struct meminfo *mi)
Stephen Boyd9e775ad2011-08-12 00:14:28 +010034{
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}
Steve Mucklea55df6e2010-01-07 12:43:24 -080047
48static void __init msm8x60_map_io(void)
49{
50 msm_map_msm8x60_io();
51}
52
David Brown2b7b9a72012-04-23 15:34:20 -070053#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
Steve Mucklea55df6e2010-01-07 12:43:24 -080060static void __init msm8x60_init_irq(void)
61{
David Brown2b7b9a72012-04-23 15:34:20 -070062 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
Steve Muckle9161d302010-02-11 11:50:40 -080069
70 /* Edge trigger PPIs except AVS_SVICINT and AVS_SVICINTSWDONE */
71 writel(0xFFFFD7FF, MSM_QGIC_DIST_BASE + GIC_DIST_CONFIG + 4);
72
73 /* RUMI does not adhere to GIC spec by enabling STIs by default.
74 * Enable/clear is supposed to be RO for STIs, but is RW on RUMI.
75 */
Steve Muckle57bbf1c2010-01-07 12:51:10 -080076 if (!machine_is_msm8x60_sim())
77 writel(0x0000FFFF, MSM_QGIC_DIST_BASE + GIC_DIST_ENABLE_SET);
Steve Mucklea55df6e2010-01-07 12:43:24 -080078}
79
80static void __init msm8x60_init(void)
81{
82}
83
Shawn Guoc633c532012-05-02 15:53:20 +080084static void __init msm8x60_init_late(void)
85{
86 smd_debugfs_init();
87}
88
David Brown56e2d8a2011-08-04 02:01:02 -070089#ifdef CONFIG_OF
90static struct of_dev_auxdata msm_auxdata_lookup[] __initdata = {
91 {}
92};
93
David Brown56e2d8a2011-08-04 02:01:02 -070094static void __init msm8x60_dt_init(void)
95{
David Brown56e2d8a2011-08-04 02:01:02 -070096 if (of_machine_is_compatible("qcom,msm8660-surf")) {
97 printk(KERN_INFO "Init surf UART registers\n");
98 msm8x60_init_uart12dm();
99 }
100
101 of_platform_populate(NULL, of_default_bus_match_table,
102 msm_auxdata_lookup, NULL);
103}
104
105static const char *msm8x60_fluid_match[] __initdata = {
106 "qcom,msm8660-fluid",
107 "qcom,msm8660-surf",
108 NULL
109};
110#endif /* CONFIG_OF */
111
Steve Mucklea55df6e2010-01-07 12:43:24 -0800112MACHINE_START(MSM8X60_RUMI3, "QCT MSM8X60 RUMI3")
Stephen Boyd9e775ad2011-08-12 00:14:28 +0100113 .fixup = msm8x60_fixup,
114 .reserve = msm8x60_reserve,
Steve Mucklea55df6e2010-01-07 12:43:24 -0800115 .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 Mucklea55df6e2010-01-07 12:43:24 -0800118 .init_machine = msm8x60_init,
Shawn Guoc633c532012-05-02 15:53:20 +0800119 .init_late = msm8x60_init_late,
Steve Mucklea55df6e2010-01-07 12:43:24 -0800120 .timer = &msm_timer,
121MACHINE_END
Steve Muckle49b76f72010-03-19 17:00:08 -0700122
123MACHINE_START(MSM8X60_SURF, "QCT MSM8X60 SURF")
Stephen Boyd9e775ad2011-08-12 00:14:28 +0100124 .fixup = msm8x60_fixup,
125 .reserve = msm8x60_reserve,
Steve Muckle49b76f72010-03-19 17:00:08 -0700126 .map_io = msm8x60_map_io,
127 .init_irq = msm8x60_init_irq,
Marc Zyngier041f7772011-09-06 10:23:45 +0100128 .handle_irq = gic_handle_irq,
Steve Muckle49b76f72010-03-19 17:00:08 -0700129 .init_machine = msm8x60_init,
Shawn Guoc633c532012-05-02 15:53:20 +0800130 .init_late = msm8x60_init_late,
Steve Muckle49b76f72010-03-19 17:00:08 -0700131 .timer = &msm_timer,
132MACHINE_END
Steve Muckle57bbf1c2010-01-07 12:51:10 -0800133
134MACHINE_START(MSM8X60_SIM, "QCT MSM8X60 SIMULATOR")
Stephen Boyd9e775ad2011-08-12 00:14:28 +0100135 .fixup = msm8x60_fixup,
136 .reserve = msm8x60_reserve,
Steve Muckle57bbf1c2010-01-07 12:51:10 -0800137 .map_io = msm8x60_map_io,
138 .init_irq = msm8x60_init_irq,
Marc Zyngier041f7772011-09-06 10:23:45 +0100139 .handle_irq = gic_handle_irq,
Steve Muckle57bbf1c2010-01-07 12:51:10 -0800140 .init_machine = msm8x60_init,
Shawn Guoc633c532012-05-02 15:53:20 +0800141 .init_late = msm8x60_init_late,
Steve Muckle57bbf1c2010-01-07 12:51:10 -0800142 .timer = &msm_timer,
143MACHINE_END
Gregory Bean69b7f6f2010-04-04 22:29:02 -0700144
145MACHINE_START(MSM8X60_FFA, "QCT MSM8X60 FFA")
Stephen Boyd9e775ad2011-08-12 00:14:28 +0100146 .fixup = msm8x60_fixup,
147 .reserve = msm8x60_reserve,
Gregory Bean69b7f6f2010-04-04 22:29:02 -0700148 .map_io = msm8x60_map_io,
149 .init_irq = msm8x60_init_irq,
Marc Zyngier041f7772011-09-06 10:23:45 +0100150 .handle_irq = gic_handle_irq,
Gregory Bean69b7f6f2010-04-04 22:29:02 -0700151 .init_machine = msm8x60_init,
Shawn Guoc633c532012-05-02 15:53:20 +0800152 .init_late = msm8x60_init_late,
Gregory Bean69b7f6f2010-04-04 22:29:02 -0700153 .timer = &msm_timer,
154MACHINE_END
David Brown56e2d8a2011-08-04 02:01:02 -0700155
156#ifdef CONFIG_OF
157/* TODO: General device tree support for all MSM. */
158DT_MACHINE_START(MSM_DT, "Qualcomm MSM (Flattened Device Tree)")
159 .map_io = msm8x60_map_io,
160 .init_irq = msm8x60_init_irq,
161 .init_machine = msm8x60_dt_init,
Shawn Guoc633c532012-05-02 15:53:20 +0800162 .init_late = msm8x60_init_late,
David Brown56e2d8a2011-08-04 02:01:02 -0700163 .timer = &msm_timer,
164 .dt_compat = msm8x60_fluid_match,
165MACHINE_END
166#endif /* CONFIG_OF */