Stepan Moskovchenko | f441ca2d | 2010-12-01 19:31:16 -0800 | [diff] [blame] | 1 | /* Copyright (c) 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 | * You should have received a copy of the GNU General Public License |
| 13 | * along with this program; if not, write to the Free Software |
| 14 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
| 15 | * 02110-1301, USA. |
| 16 | * |
| 17 | */ |
| 18 | #include <linux/kernel.h> |
| 19 | #include <linux/platform_device.h> |
| 20 | #include <linux/io.h> |
| 21 | #include <linux/irq.h> |
Stephen Boyd | bd32344 | 2011-02-23 09:37:42 -0800 | [diff] [blame] | 22 | #include <linux/clkdev.h> |
Stephen Boyd | 9e775ad | 2011-08-12 00:14:28 +0100 | [diff] [blame] | 23 | #include <linux/memblock.h> |
Stepan Moskovchenko | f441ca2d | 2010-12-01 19:31:16 -0800 | [diff] [blame] | 24 | |
| 25 | #include <asm/mach-types.h> |
| 26 | #include <asm/mach/arch.h> |
| 27 | #include <asm/hardware/gic.h> |
Stephen Boyd | 9e775ad | 2011-08-12 00:14:28 +0100 | [diff] [blame] | 28 | #include <asm/setup.h> |
Stepan Moskovchenko | f441ca2d | 2010-12-01 19:31:16 -0800 | [diff] [blame] | 29 | |
| 30 | #include <mach/board.h> |
| 31 | #include <mach/msm_iomap.h> |
| 32 | |
Stepan Moskovchenko | d056fca | 2011-01-27 12:12:07 -0800 | [diff] [blame] | 33 | #include "devices.h" |
| 34 | |
Stephen Boyd | 9e775ad | 2011-08-12 00:14:28 +0100 | [diff] [blame] | 35 | static void __init msm8960_fixup(struct machine_desc *desc, struct tag *tag, |
| 36 | char **cmdline, struct meminfo *mi) |
| 37 | { |
| 38 | for (; tag->hdr.size; tag = tag_next(tag)) |
| 39 | if (tag->hdr.tag == ATAG_MEM && |
| 40 | tag->u.mem.start == 0x40200000) { |
| 41 | tag->u.mem.start = 0x40000000; |
| 42 | tag->u.mem.size += SZ_2M; |
| 43 | } |
| 44 | } |
| 45 | |
| 46 | static void __init msm8960_reserve(void) |
| 47 | { |
| 48 | memblock_remove(0x40000000, SZ_2M); |
| 49 | } |
| 50 | |
Stepan Moskovchenko | f441ca2d | 2010-12-01 19:31:16 -0800 | [diff] [blame] | 51 | static void __init msm8960_map_io(void) |
| 52 | { |
| 53 | msm_map_msm8960_io(); |
| 54 | } |
| 55 | |
| 56 | static void __init msm8960_init_irq(void) |
| 57 | { |
| 58 | unsigned int i; |
| 59 | gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE, |
| 60 | (void *)MSM_QGIC_CPU_BASE); |
| 61 | |
| 62 | /* Edge trigger PPIs except AVS_SVICINT and AVS_SVICINTSWDONE */ |
| 63 | writel(0xFFFFD7FF, MSM_QGIC_DIST_BASE + GIC_DIST_CONFIG + 4); |
| 64 | |
Stepan Moskovchenko | 50ede4e | 2010-12-13 18:12:19 -0800 | [diff] [blame] | 65 | if (machine_is_msm8960_rumi3()) |
| 66 | writel(0x0000FFFF, MSM_QGIC_DIST_BASE + GIC_DIST_ENABLE_SET); |
| 67 | |
Stepan Moskovchenko | f441ca2d | 2010-12-01 19:31:16 -0800 | [diff] [blame] | 68 | /* FIXME: Not installing AVS_SVICINT and AVS_SVICINTSWDONE yet |
| 69 | * as they are configured as level, which does not play nice with |
| 70 | * handle_percpu_irq. |
| 71 | */ |
| 72 | for (i = GIC_PPI_START; i < GIC_SPI_START; i++) { |
| 73 | if (i != AVS_SVICINT && i != AVS_SVICINTSWDONE) |
Thomas Gleixner | 6845664a | 2011-03-24 13:25:22 +0100 | [diff] [blame] | 74 | irq_set_handler(i, handle_percpu_irq); |
Stepan Moskovchenko | f441ca2d | 2010-12-01 19:31:16 -0800 | [diff] [blame] | 75 | } |
| 76 | } |
| 77 | |
Stepan Moskovchenko | d056fca | 2011-01-27 12:12:07 -0800 | [diff] [blame] | 78 | static struct platform_device *sim_devices[] __initdata = { |
| 79 | &msm8960_device_uart_gsbi2, |
| 80 | }; |
| 81 | |
| 82 | static struct platform_device *rumi3_devices[] __initdata = { |
| 83 | &msm8960_device_uart_gsbi5, |
| 84 | }; |
| 85 | |
| 86 | static void __init msm8960_sim_init(void) |
| 87 | { |
| 88 | platform_add_devices(sim_devices, ARRAY_SIZE(sim_devices)); |
| 89 | } |
| 90 | |
| 91 | static void __init msm8960_rumi3_init(void) |
| 92 | { |
| 93 | platform_add_devices(rumi3_devices, ARRAY_SIZE(rumi3_devices)); |
| 94 | } |
| 95 | |
Stepan Moskovchenko | f441ca2d | 2010-12-01 19:31:16 -0800 | [diff] [blame] | 96 | MACHINE_START(MSM8960_SIM, "QCT MSM8960 SIMULATOR") |
Stephen Boyd | 9e775ad | 2011-08-12 00:14:28 +0100 | [diff] [blame] | 97 | .fixup = msm8960_fixup, |
| 98 | .reserve = msm8960_reserve, |
Stepan Moskovchenko | f441ca2d | 2010-12-01 19:31:16 -0800 | [diff] [blame] | 99 | .map_io = msm8960_map_io, |
| 100 | .init_irq = msm8960_init_irq, |
| 101 | .timer = &msm_timer, |
Stepan Moskovchenko | d056fca | 2011-01-27 12:12:07 -0800 | [diff] [blame] | 102 | .init_machine = msm8960_sim_init, |
Stepan Moskovchenko | f441ca2d | 2010-12-01 19:31:16 -0800 | [diff] [blame] | 103 | MACHINE_END |
Stepan Moskovchenko | 50ede4e | 2010-12-13 18:12:19 -0800 | [diff] [blame] | 104 | |
| 105 | MACHINE_START(MSM8960_RUMI3, "QCT MSM8960 RUMI3") |
Stephen Boyd | 9e775ad | 2011-08-12 00:14:28 +0100 | [diff] [blame] | 106 | .fixup = msm8960_fixup, |
| 107 | .reserve = msm8960_reserve, |
Stepan Moskovchenko | 50ede4e | 2010-12-13 18:12:19 -0800 | [diff] [blame] | 108 | .map_io = msm8960_map_io, |
| 109 | .init_irq = msm8960_init_irq, |
| 110 | .timer = &msm_timer, |
Stepan Moskovchenko | d056fca | 2011-01-27 12:12:07 -0800 | [diff] [blame] | 111 | .init_machine = msm8960_rumi3_init, |
Stepan Moskovchenko | 50ede4e | 2010-12-13 18:12:19 -0800 | [diff] [blame] | 112 | MACHINE_END |
| 113 | |