blob: a28a20e2f118efa7084224a54c9c3fef918b9dd8 [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>
Stephen Boyd4312a7e2012-09-05 12:28:52 -070031#include "common.h"
Steve Mucklea55df6e2010-01-07 12:43:24 -080032
Stephen Boyd47a67702011-10-25 09:35:19 -070033static void __init msm8x60_fixup(struct tag *tag, char **cmdline,
34 struct meminfo *mi)
Stephen Boyd9e775ad2011-08-12 00:14:28 +010035{
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
44static void __init msm8x60_reserve(void)
45{
46 memblock_remove(0x40000000, SZ_2M);
47}
Steve Mucklea55df6e2010-01-07 12:43:24 -080048
49static void __init msm8x60_map_io(void)
50{
51 msm_map_msm8x60_io();
52}
53
David Brown2b7b9a72012-04-23 15:34:20 -070054#ifdef CONFIG_OF
55static struct of_device_id msm_dt_gic_match[] __initdata = {
56 { .compatible = "qcom,msm-8660-qgic", .data = gic_of_init },
57 {}
58};
59#endif
60
Steve Mucklea55df6e2010-01-07 12:43:24 -080061static void __init msm8x60_init_irq(void)
62{
David Brown2b7b9a72012-04-23 15:34:20 -070063 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
Steve Muckle9161d302010-02-11 11:50:40 -080070
Steve Muckle9161d302010-02-11 11:50:40 -080071 /* 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 */
Steve Muckle57bbf1c2010-01-07 12:51:10 -080074 if (!machine_is_msm8x60_sim())
75 writel(0x0000FFFF, MSM_QGIC_DIST_BASE + GIC_DIST_ENABLE_SET);
Steve Mucklea55df6e2010-01-07 12:43:24 -080076}
77
78static void __init msm8x60_init(void)
79{
80}
81
Shawn Guoc633c532012-05-02 15:53:20 +080082static void __init msm8x60_init_late(void)
83{
84 smd_debugfs_init();
85}
86
David Brown56e2d8a2011-08-04 02:01:02 -070087#ifdef CONFIG_OF
88static struct of_dev_auxdata msm_auxdata_lookup[] __initdata = {
89 {}
90};
91
David Brown56e2d8a2011-08-04 02:01:02 -070092static void __init msm8x60_dt_init(void)
93{
David Brown56e2d8a2011-08-04 02:01:02 -070094 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
103static const char *msm8x60_fluid_match[] __initdata = {
104 "qcom,msm8660-fluid",
105 "qcom,msm8660-surf",
106 NULL
107};
108#endif /* CONFIG_OF */
109
Steve Mucklea55df6e2010-01-07 12:43:24 -0800110MACHINE_START(MSM8X60_RUMI3, "QCT MSM8X60 RUMI3")
Stephen Boyd9e775ad2011-08-12 00:14:28 +0100111 .fixup = msm8x60_fixup,
112 .reserve = msm8x60_reserve,
Steve Mucklea55df6e2010-01-07 12:43:24 -0800113 .map_io = msm8x60_map_io,
114 .init_irq = msm8x60_init_irq,
Marc Zyngier041f7772011-09-06 10:23:45 +0100115 .handle_irq = gic_handle_irq,
Steve Mucklea55df6e2010-01-07 12:43:24 -0800116 .init_machine = msm8x60_init,
Shawn Guoc633c532012-05-02 15:53:20 +0800117 .init_late = msm8x60_init_late,
Stephen Boyd4312a7e2012-09-05 12:28:52 -0700118 .timer = &msm8x60_timer,
Steve Mucklea55df6e2010-01-07 12:43:24 -0800119MACHINE_END
Steve Muckle49b76f72010-03-19 17:00:08 -0700120
121MACHINE_START(MSM8X60_SURF, "QCT MSM8X60 SURF")
Stephen Boyd9e775ad2011-08-12 00:14:28 +0100122 .fixup = msm8x60_fixup,
123 .reserve = msm8x60_reserve,
Steve Muckle49b76f72010-03-19 17:00:08 -0700124 .map_io = msm8x60_map_io,
125 .init_irq = msm8x60_init_irq,
Marc Zyngier041f7772011-09-06 10:23:45 +0100126 .handle_irq = gic_handle_irq,
Steve Muckle49b76f72010-03-19 17:00:08 -0700127 .init_machine = msm8x60_init,
Shawn Guoc633c532012-05-02 15:53:20 +0800128 .init_late = msm8x60_init_late,
Stephen Boyd4312a7e2012-09-05 12:28:52 -0700129 .timer = &msm8x60_timer,
Steve Muckle49b76f72010-03-19 17:00:08 -0700130MACHINE_END
Steve Muckle57bbf1c2010-01-07 12:51:10 -0800131
132MACHINE_START(MSM8X60_SIM, "QCT MSM8X60 SIMULATOR")
Stephen Boyd9e775ad2011-08-12 00:14:28 +0100133 .fixup = msm8x60_fixup,
134 .reserve = msm8x60_reserve,
Steve Muckle57bbf1c2010-01-07 12:51:10 -0800135 .map_io = msm8x60_map_io,
136 .init_irq = msm8x60_init_irq,
Marc Zyngier041f7772011-09-06 10:23:45 +0100137 .handle_irq = gic_handle_irq,
Steve Muckle57bbf1c2010-01-07 12:51:10 -0800138 .init_machine = msm8x60_init,
Shawn Guoc633c532012-05-02 15:53:20 +0800139 .init_late = msm8x60_init_late,
Stephen Boyd4312a7e2012-09-05 12:28:52 -0700140 .timer = &msm8x60_timer,
Steve Muckle57bbf1c2010-01-07 12:51:10 -0800141MACHINE_END
Gregory Bean69b7f6f2010-04-04 22:29:02 -0700142
143MACHINE_START(MSM8X60_FFA, "QCT MSM8X60 FFA")
Stephen Boyd9e775ad2011-08-12 00:14:28 +0100144 .fixup = msm8x60_fixup,
145 .reserve = msm8x60_reserve,
Gregory Bean69b7f6f2010-04-04 22:29:02 -0700146 .map_io = msm8x60_map_io,
147 .init_irq = msm8x60_init_irq,
Marc Zyngier041f7772011-09-06 10:23:45 +0100148 .handle_irq = gic_handle_irq,
Gregory Bean69b7f6f2010-04-04 22:29:02 -0700149 .init_machine = msm8x60_init,
Shawn Guoc633c532012-05-02 15:53:20 +0800150 .init_late = msm8x60_init_late,
Stephen Boyd4312a7e2012-09-05 12:28:52 -0700151 .timer = &msm8x60_timer,
Gregory Bean69b7f6f2010-04-04 22:29:02 -0700152MACHINE_END
David Brown56e2d8a2011-08-04 02:01:02 -0700153
154#ifdef CONFIG_OF
155/* TODO: General device tree support for all MSM. */
156DT_MACHINE_START(MSM_DT, "Qualcomm MSM (Flattened Device Tree)")
157 .map_io = msm8x60_map_io,
158 .init_irq = msm8x60_init_irq,
Stephen Boyd63c86c92012-08-22 16:00:13 -0700159 .handle_irq = gic_handle_irq,
David Brown56e2d8a2011-08-04 02:01:02 -0700160 .init_machine = msm8x60_dt_init,
Shawn Guoc633c532012-05-02 15:53:20 +0800161 .init_late = msm8x60_init_late,
Stephen Boyd84071162012-09-05 12:28:54 -0700162 .timer = &msm_dt_timer,
David Brown56e2d8a2011-08-04 02:01:02 -0700163 .dt_compat = msm8x60_fluid_match,
164MACHINE_END
165#endif /* CONFIG_OF */