blob: 30006ce75c110ab6dea51a875d58f7ed3a22f146 [file] [log] [blame]
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001/* 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"
Joel King4ebccc62011-07-22 09:43:22 -070028#include <mach/msm_spi.h>
29#include <mach/gpio.h>
30#include <mach/gpiomux.h>
31
32static int __init gpiomux_init(void)
33{
34 int rc;
35
36 rc = msm_gpiomux_init(NR_GPIO_IRQS);
37 if (rc) {
38 pr_err(KERN_ERR "msm_gpiomux_init failed %d\n", rc);
39 return rc;
40 }
41 return 0;
42}
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070043
44static void __init apq8064_map_io(void)
45{
46 msm_map_apq8064_io();
47}
48
49static void __init apq8064_init_irq(void)
50{
51 unsigned int i;
52 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
53 (void *)MSM_QGIC_CPU_BASE);
54
55 /* Edge trigger PPIs except AVS_SVICINT and AVS_SVICINTSWDONE */
56 writel_relaxed(0xFFFFD7FF, MSM_QGIC_DIST_BASE + GIC_DIST_CONFIG + 4);
57
58 writel_relaxed(0x0000FFFF, MSM_QGIC_DIST_BASE + GIC_DIST_ENABLE_SET);
59 mb();
60
61 /*
62 * FIXME: Not installing AVS_SVICINT and AVS_SVICINTSWDONE yet
63 * as they are configured as level, which does not play nice with
64 * handle_percpu_irq.
65 */
66 for (i = GIC_PPI_START; i < GIC_SPI_START; i++) {
67 if (i != AVS_SVICINT && i != AVS_SVICINTSWDONE)
68 irq_set_handler(i, handle_percpu_irq);
69 }
70}
71
72static struct platform_device *common_devices[] __initdata = {
Joel King0581896d2011-07-19 16:43:28 -070073 &msm_device_dmov,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070074 &apq8064_device_uart_gsbi3
75};
76
77static struct msm_otg_platform_data msm_otg_pdata = {
78 .mode = USB_PERIPHERAL,
79 .otg_control = OTG_PHY_CONTROL,
80 .phy_type = SNPS_28NM_INTEGRATED_PHY,
81 .pclk_src_name = "dfab_usb_hs_clk",
82};
83
84static struct msm_ssbi_platform_data apq8064_ssbi_pm8921_pdata __devinitdata = {
85 .controller_type = MSM_SBI_CTRL_PMIC_ARBITER,
86 .slave = {
87 .name = "pm8921-core",
88 },
89};
90
91static struct msm_ssbi_platform_data apq8064_ssbi_pm8821_pdata __devinitdata = {
92 .controller_type = MSM_SBI_CTRL_PMIC_ARBITER,
93 .slave = {
94 .name = "pm8821-core",
95 },
96};
97
98static void __init apq8064_common_init(void)
99{
100 if (socinfo_init() < 0)
101 pr_err("socinfo_init() failed!\n");
102 msm_clock_init(msm_clocks_8064_dummy, msm_num_clocks_8064_dummy);
Joel King4ebccc62011-07-22 09:43:22 -0700103 gpiomux_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700104 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
105}
106
107static void __init apq8064_sim_init(void)
108{
109 apq8064_common_init();
110}
111
112MACHINE_START(APQ8064_SIM, "QCT APQ8064 SIMULATOR")
113 .map_io = apq8064_map_io,
114 .init_irq = apq8064_init_irq,
115 .timer = &msm_timer,
116 .init_machine = apq8064_sim_init,
117MACHINE_END
118