blob: 751b70d4a0f58ff162ea3f0cb397037e0c8b2360 [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>
Kenneth Heitke36920d32011-07-20 16:44:30 -060017#include <linux/msm_ssbi.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070018#include <asm/mach-types.h>
19#include <asm/mach/arch.h>
20#include <asm/hardware/gic.h>
21
22#include <mach/board.h>
23#include <mach/msm_iomap.h>
24#include <linux/usb/msm_hsusb.h>
25#include <linux/usb/android.h>
26#include <mach/socinfo.h>
Harini Jayaramanc4c58692011-07-19 14:50:10 -060027#include <mach/msm_spi.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070028#include "timer.h"
29#include "devices.h"
Joel King4ebccc62011-07-22 09:43:22 -070030#include <mach/gpio.h>
31#include <mach/gpiomux.h>
32
33static int __init gpiomux_init(void)
34{
35 int rc;
36
37 rc = msm_gpiomux_init(NR_GPIO_IRQS);
38 if (rc) {
39 pr_err(KERN_ERR "msm_gpiomux_init failed %d\n", rc);
40 return rc;
41 }
42 return 0;
43}
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070044
45static void __init apq8064_map_io(void)
46{
47 msm_map_apq8064_io();
48}
49
50static void __init apq8064_init_irq(void)
51{
52 unsigned int i;
53 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
54 (void *)MSM_QGIC_CPU_BASE);
55
56 /* Edge trigger PPIs except AVS_SVICINT and AVS_SVICINTSWDONE */
57 writel_relaxed(0xFFFFD7FF, MSM_QGIC_DIST_BASE + GIC_DIST_CONFIG + 4);
58
59 writel_relaxed(0x0000FFFF, MSM_QGIC_DIST_BASE + GIC_DIST_ENABLE_SET);
60 mb();
61
62 /*
63 * FIXME: Not installing AVS_SVICINT and AVS_SVICINTSWDONE yet
64 * as they are configured as level, which does not play nice with
65 * handle_percpu_irq.
66 */
67 for (i = GIC_PPI_START; i < GIC_SPI_START; i++) {
68 if (i != AVS_SVICINT && i != AVS_SVICINTSWDONE)
69 irq_set_handler(i, handle_percpu_irq);
70 }
71}
72
73static struct platform_device *common_devices[] __initdata = {
Joel King0581896d2011-07-19 16:43:28 -070074 &msm_device_dmov,
Harini Jayaramanc4c58692011-07-19 14:50:10 -060075 &apq8064_device_uart_gsbi3,
76 &apq8064_device_qup_spi_gsbi5,
Kenneth Heitke36920d32011-07-20 16:44:30 -060077 &apq8064_device_ssbi_pmic1,
78 &apq8064_device_ssbi_pmic2,
Harini Jayaramanc4c58692011-07-19 14:50:10 -060079};
80
81static struct msm_spi_platform_data apq8064_qup_spi_gsbi5_pdata = {
82 .max_clock_speed = 26000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070083};
84
85static struct msm_otg_platform_data msm_otg_pdata = {
86 .mode = USB_PERIPHERAL,
87 .otg_control = OTG_PHY_CONTROL,
88 .phy_type = SNPS_28NM_INTEGRATED_PHY,
89 .pclk_src_name = "dfab_usb_hs_clk",
90};
91
92static struct msm_ssbi_platform_data apq8064_ssbi_pm8921_pdata __devinitdata = {
93 .controller_type = MSM_SBI_CTRL_PMIC_ARBITER,
94 .slave = {
95 .name = "pm8921-core",
96 },
97};
98
99static struct msm_ssbi_platform_data apq8064_ssbi_pm8821_pdata __devinitdata = {
100 .controller_type = MSM_SBI_CTRL_PMIC_ARBITER,
101 .slave = {
102 .name = "pm8821-core",
103 },
104};
105
106static void __init apq8064_common_init(void)
107{
108 if (socinfo_init() < 0)
109 pr_err("socinfo_init() failed!\n");
110 msm_clock_init(msm_clocks_8064_dummy, msm_num_clocks_8064_dummy);
Joel King4ebccc62011-07-22 09:43:22 -0700111 gpiomux_init();
Kenneth Heitke36920d32011-07-20 16:44:30 -0600112
Harini Jayaramanc4c58692011-07-19 14:50:10 -0600113 apq8064_device_qup_spi_gsbi5.dev.platform_data =
114 &apq8064_qup_spi_gsbi5_pdata;
Kenneth Heitke36920d32011-07-20 16:44:30 -0600115 apq8064_device_ssbi_pmic1.dev.platform_data =
116 &apq8064_ssbi_pm8921_pdata;
117 apq8064_device_ssbi_pmic2.dev.platform_data =
118 &apq8064_ssbi_pm8821_pdata;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700119 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
120}
121
122static void __init apq8064_sim_init(void)
123{
124 apq8064_common_init();
125}
126
127MACHINE_START(APQ8064_SIM, "QCT APQ8064 SIMULATOR")
128 .map_io = apq8064_map_io,
129 .init_irq = apq8064_init_irq,
130 .timer = &msm_timer,
131 .init_machine = apq8064_sim_init,
132MACHINE_END
133