Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [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 | */ |
| 13 | #include <linux/kernel.h> |
| 14 | #include <linux/platform_device.h> |
| 15 | #include <linux/io.h> |
| 16 | #include <linux/irq.h> |
| 17 | #include <asm/mach-types.h> |
| 18 | #include <asm/mach/arch.h> |
| 19 | #include <asm/hardware/gic.h> |
| 20 | |
| 21 | #include <mach/board.h> |
| 22 | #include <mach/msm_iomap.h> |
| 23 | #include <linux/usb/msm_hsusb.h> |
| 24 | #include <linux/usb/android.h> |
| 25 | #include <mach/socinfo.h> |
| 26 | #include "timer.h" |
| 27 | #include "devices.h" |
| 28 | |
| 29 | static void __init apq8064_map_io(void) |
| 30 | { |
| 31 | msm_map_apq8064_io(); |
| 32 | } |
| 33 | |
| 34 | static void __init apq8064_init_irq(void) |
| 35 | { |
| 36 | unsigned int i; |
| 37 | gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE, |
| 38 | (void *)MSM_QGIC_CPU_BASE); |
| 39 | |
| 40 | /* Edge trigger PPIs except AVS_SVICINT and AVS_SVICINTSWDONE */ |
| 41 | writel_relaxed(0xFFFFD7FF, MSM_QGIC_DIST_BASE + GIC_DIST_CONFIG + 4); |
| 42 | |
| 43 | writel_relaxed(0x0000FFFF, MSM_QGIC_DIST_BASE + GIC_DIST_ENABLE_SET); |
| 44 | mb(); |
| 45 | |
| 46 | /* |
| 47 | * FIXME: Not installing AVS_SVICINT and AVS_SVICINTSWDONE yet |
| 48 | * as they are configured as level, which does not play nice with |
| 49 | * handle_percpu_irq. |
| 50 | */ |
| 51 | for (i = GIC_PPI_START; i < GIC_SPI_START; i++) { |
| 52 | if (i != AVS_SVICINT && i != AVS_SVICINTSWDONE) |
| 53 | irq_set_handler(i, handle_percpu_irq); |
| 54 | } |
| 55 | } |
| 56 | |
| 57 | static struct platform_device *common_devices[] __initdata = { |
Joel King | 0581896d | 2011-07-19 16:43:28 -0700 | [diff] [blame^] | 58 | &msm_device_dmov, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 59 | &apq8064_device_uart_gsbi3 |
| 60 | }; |
| 61 | |
| 62 | static struct msm_otg_platform_data msm_otg_pdata = { |
| 63 | .mode = USB_PERIPHERAL, |
| 64 | .otg_control = OTG_PHY_CONTROL, |
| 65 | .phy_type = SNPS_28NM_INTEGRATED_PHY, |
| 66 | .pclk_src_name = "dfab_usb_hs_clk", |
| 67 | }; |
| 68 | |
| 69 | static struct msm_ssbi_platform_data apq8064_ssbi_pm8921_pdata __devinitdata = { |
| 70 | .controller_type = MSM_SBI_CTRL_PMIC_ARBITER, |
| 71 | .slave = { |
| 72 | .name = "pm8921-core", |
| 73 | }, |
| 74 | }; |
| 75 | |
| 76 | static struct msm_ssbi_platform_data apq8064_ssbi_pm8821_pdata __devinitdata = { |
| 77 | .controller_type = MSM_SBI_CTRL_PMIC_ARBITER, |
| 78 | .slave = { |
| 79 | .name = "pm8821-core", |
| 80 | }, |
| 81 | }; |
| 82 | |
| 83 | static void __init apq8064_common_init(void) |
| 84 | { |
| 85 | if (socinfo_init() < 0) |
| 86 | pr_err("socinfo_init() failed!\n"); |
| 87 | msm_clock_init(msm_clocks_8064_dummy, msm_num_clocks_8064_dummy); |
| 88 | platform_add_devices(common_devices, ARRAY_SIZE(common_devices)); |
| 89 | } |
| 90 | |
| 91 | static void __init apq8064_sim_init(void) |
| 92 | { |
| 93 | apq8064_common_init(); |
| 94 | } |
| 95 | |
| 96 | MACHINE_START(APQ8064_SIM, "QCT APQ8064 SIMULATOR") |
| 97 | .map_io = apq8064_map_io, |
| 98 | .init_irq = apq8064_init_irq, |
| 99 | .timer = &msm_timer, |
| 100 | .init_machine = apq8064_sim_init, |
| 101 | MACHINE_END |
| 102 | |