David Brown | 56e2d8a | 2011-08-04 02:01:02 -0700 | [diff] [blame^] | 1 | /* Copyright (c) 2010, 2011, Code Aurora Forum. All rights reserved. |
Steve Muckle | a55df6e | 2010-01-07 12:43:24 -0800 | [diff] [blame] | 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. |
Steve Muckle | a55df6e | 2010-01-07 12:43:24 -0800 | [diff] [blame] | 11 | */ |
| 12 | |
| 13 | #include <linux/kernel.h> |
| 14 | #include <linux/platform_device.h> |
| 15 | #include <linux/io.h> |
Steve Muckle | 9161d30 | 2010-02-11 11:50:40 -0800 | [diff] [blame] | 16 | #include <linux/irq.h> |
David Brown | 56e2d8a | 2011-08-04 02:01:02 -0700 | [diff] [blame^] | 17 | #include <linux/irqdomain.h> |
| 18 | #include <linux/of.h> |
| 19 | #include <linux/of_address.h> |
| 20 | #include <linux/of_platform.h> |
Steve Muckle | a55df6e | 2010-01-07 12:43:24 -0800 | [diff] [blame] | 21 | |
| 22 | #include <asm/mach-types.h> |
| 23 | #include <asm/mach/arch.h> |
| 24 | #include <asm/hardware/gic.h> |
| 25 | |
| 26 | #include <mach/board.h> |
| 27 | #include <mach/msm_iomap.h> |
| 28 | |
Steve Muckle | a55df6e | 2010-01-07 12:43:24 -0800 | [diff] [blame] | 29 | |
| 30 | static void __init msm8x60_map_io(void) |
| 31 | { |
| 32 | msm_map_msm8x60_io(); |
| 33 | } |
| 34 | |
| 35 | static void __init msm8x60_init_irq(void) |
| 36 | { |
Steve Muckle | 9161d30 | 2010-02-11 11:50:40 -0800 | [diff] [blame] | 37 | unsigned int i; |
| 38 | |
Russell King | ff2e27a | 2010-12-04 16:13:29 +0000 | [diff] [blame] | 39 | gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE, |
| 40 | (void *)MSM_QGIC_CPU_BASE); |
Steve Muckle | 9161d30 | 2010-02-11 11:50:40 -0800 | [diff] [blame] | 41 | |
| 42 | /* Edge trigger PPIs except AVS_SVICINT and AVS_SVICINTSWDONE */ |
| 43 | writel(0xFFFFD7FF, MSM_QGIC_DIST_BASE + GIC_DIST_CONFIG + 4); |
| 44 | |
| 45 | /* RUMI does not adhere to GIC spec by enabling STIs by default. |
| 46 | * Enable/clear is supposed to be RO for STIs, but is RW on RUMI. |
| 47 | */ |
Steve Muckle | 57bbf1c | 2010-01-07 12:51:10 -0800 | [diff] [blame] | 48 | if (!machine_is_msm8x60_sim()) |
| 49 | writel(0x0000FFFF, MSM_QGIC_DIST_BASE + GIC_DIST_ENABLE_SET); |
Steve Muckle | 9161d30 | 2010-02-11 11:50:40 -0800 | [diff] [blame] | 50 | |
| 51 | /* FIXME: Not installing AVS_SVICINT and AVS_SVICINTSWDONE yet |
| 52 | * as they are configured as level, which does not play nice with |
| 53 | * handle_percpu_irq. |
| 54 | */ |
| 55 | for (i = GIC_PPI_START; i < GIC_SPI_START; i++) { |
| 56 | if (i != AVS_SVICINT && i != AVS_SVICINTSWDONE) |
Thomas Gleixner | 6845664a | 2011-03-24 13:25:22 +0100 | [diff] [blame] | 57 | irq_set_handler(i, handle_percpu_irq); |
Steve Muckle | 9161d30 | 2010-02-11 11:50:40 -0800 | [diff] [blame] | 58 | } |
Steve Muckle | a55df6e | 2010-01-07 12:43:24 -0800 | [diff] [blame] | 59 | } |
| 60 | |
| 61 | static void __init msm8x60_init(void) |
| 62 | { |
| 63 | } |
| 64 | |
David Brown | 56e2d8a | 2011-08-04 02:01:02 -0700 | [diff] [blame^] | 65 | #ifdef CONFIG_OF |
| 66 | static struct of_dev_auxdata msm_auxdata_lookup[] __initdata = { |
| 67 | {} |
| 68 | }; |
| 69 | |
| 70 | static struct of_device_id msm_dt_gic_match[] __initdata = { |
| 71 | { .compatible = "qcom,msm-8660-qgic", }, |
| 72 | {} |
| 73 | }; |
| 74 | |
| 75 | static void __init msm8x60_dt_init(void) |
| 76 | { |
| 77 | struct device_node *node; |
| 78 | |
| 79 | node = of_find_matching_node_by_address(NULL, msm_dt_gic_match, |
| 80 | MSM8X60_QGIC_DIST_PHYS); |
| 81 | if (node) |
| 82 | irq_domain_add_simple(node, GIC_SPI_START); |
| 83 | |
| 84 | if (of_machine_is_compatible("qcom,msm8660-surf")) { |
| 85 | printk(KERN_INFO "Init surf UART registers\n"); |
| 86 | msm8x60_init_uart12dm(); |
| 87 | } |
| 88 | |
| 89 | of_platform_populate(NULL, of_default_bus_match_table, |
| 90 | msm_auxdata_lookup, NULL); |
| 91 | } |
| 92 | |
| 93 | static const char *msm8x60_fluid_match[] __initdata = { |
| 94 | "qcom,msm8660-fluid", |
| 95 | "qcom,msm8660-surf", |
| 96 | NULL |
| 97 | }; |
| 98 | #endif /* CONFIG_OF */ |
| 99 | |
Steve Muckle | a55df6e | 2010-01-07 12:43:24 -0800 | [diff] [blame] | 100 | MACHINE_START(MSM8X60_RUMI3, "QCT MSM8X60 RUMI3") |
| 101 | .map_io = msm8x60_map_io, |
| 102 | .init_irq = msm8x60_init_irq, |
| 103 | .init_machine = msm8x60_init, |
| 104 | .timer = &msm_timer, |
| 105 | MACHINE_END |
Steve Muckle | 49b76f7 | 2010-03-19 17:00:08 -0700 | [diff] [blame] | 106 | |
| 107 | MACHINE_START(MSM8X60_SURF, "QCT MSM8X60 SURF") |
| 108 | .map_io = msm8x60_map_io, |
| 109 | .init_irq = msm8x60_init_irq, |
| 110 | .init_machine = msm8x60_init, |
| 111 | .timer = &msm_timer, |
| 112 | MACHINE_END |
Steve Muckle | 57bbf1c | 2010-01-07 12:51:10 -0800 | [diff] [blame] | 113 | |
| 114 | MACHINE_START(MSM8X60_SIM, "QCT MSM8X60 SIMULATOR") |
| 115 | .map_io = msm8x60_map_io, |
| 116 | .init_irq = msm8x60_init_irq, |
| 117 | .init_machine = msm8x60_init, |
| 118 | .timer = &msm_timer, |
| 119 | MACHINE_END |
Gregory Bean | 69b7f6f | 2010-04-04 22:29:02 -0700 | [diff] [blame] | 120 | |
| 121 | MACHINE_START(MSM8X60_FFA, "QCT MSM8X60 FFA") |
| 122 | .map_io = msm8x60_map_io, |
| 123 | .init_irq = msm8x60_init_irq, |
| 124 | .init_machine = msm8x60_init, |
| 125 | .timer = &msm_timer, |
| 126 | MACHINE_END |
David Brown | 56e2d8a | 2011-08-04 02:01:02 -0700 | [diff] [blame^] | 127 | |
| 128 | #ifdef CONFIG_OF |
| 129 | /* TODO: General device tree support for all MSM. */ |
| 130 | DT_MACHINE_START(MSM_DT, "Qualcomm MSM (Flattened Device Tree)") |
| 131 | .map_io = msm8x60_map_io, |
| 132 | .init_irq = msm8x60_init_irq, |
| 133 | .init_machine = msm8x60_dt_init, |
| 134 | .timer = &msm_timer, |
| 135 | .dt_compat = msm8x60_fluid_match, |
| 136 | MACHINE_END |
| 137 | #endif /* CONFIG_OF */ |