blob: 82de1be13700258e666a30ba0c6951d442ae8e0b [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
Jay Chokshiea67c622011-07-29 17:12:26 -070033#include "board-apq8064.h"
34
Joel King4ebccc62011-07-22 09:43:22 -070035static int __init gpiomux_init(void)
36{
37 int rc;
38
39 rc = msm_gpiomux_init(NR_GPIO_IRQS);
40 if (rc) {
41 pr_err(KERN_ERR "msm_gpiomux_init failed %d\n", rc);
42 return rc;
43 }
44 return 0;
45}
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070046
47static void __init apq8064_map_io(void)
48{
49 msm_map_apq8064_io();
50}
51
52static void __init apq8064_init_irq(void)
53{
54 unsigned int i;
55 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
56 (void *)MSM_QGIC_CPU_BASE);
57
58 /* Edge trigger PPIs except AVS_SVICINT and AVS_SVICINTSWDONE */
59 writel_relaxed(0xFFFFD7FF, MSM_QGIC_DIST_BASE + GIC_DIST_CONFIG + 4);
60
61 writel_relaxed(0x0000FFFF, MSM_QGIC_DIST_BASE + GIC_DIST_ENABLE_SET);
62 mb();
63
64 /*
65 * FIXME: Not installing AVS_SVICINT and AVS_SVICINTSWDONE yet
66 * as they are configured as level, which does not play nice with
67 * handle_percpu_irq.
68 */
69 for (i = GIC_PPI_START; i < GIC_SPI_START; i++) {
70 if (i != AVS_SVICINT && i != AVS_SVICINTSWDONE)
71 irq_set_handler(i, handle_percpu_irq);
72 }
73}
74
75static struct platform_device *common_devices[] __initdata = {
Stepan Moskovchenkodf13d342011-08-03 19:01:25 -070076 &apq8064_device_dmov,
Harini Jayaramanc4c58692011-07-19 14:50:10 -060077 &apq8064_device_uart_gsbi3,
78 &apq8064_device_qup_spi_gsbi5,
Kenneth Heitke36920d32011-07-20 16:44:30 -060079 &apq8064_device_ssbi_pmic1,
80 &apq8064_device_ssbi_pmic2,
Harini Jayaramanc4c58692011-07-19 14:50:10 -060081};
82
83static struct msm_spi_platform_data apq8064_qup_spi_gsbi5_pdata = {
84 .max_clock_speed = 26000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070085};
86
87static struct msm_otg_platform_data msm_otg_pdata = {
88 .mode = USB_PERIPHERAL,
89 .otg_control = OTG_PHY_CONTROL,
90 .phy_type = SNPS_28NM_INTEGRATED_PHY,
91 .pclk_src_name = "dfab_usb_hs_clk",
92};
93
Jay Chokshiea67c622011-07-29 17:12:26 -070094static struct pm8921_platform_data pm8921_platform_data __devinitdata = {
95 .regulator_pdatas = msm8064_pm8921_regulator_pdata,
96};
97
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070098static struct msm_ssbi_platform_data apq8064_ssbi_pm8921_pdata __devinitdata = {
99 .controller_type = MSM_SBI_CTRL_PMIC_ARBITER,
100 .slave = {
Jay Chokshiea67c622011-07-29 17:12:26 -0700101 .name = "pm8921-core",
102 .platform_data = &pm8921_platform_data,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700103 },
104};
105
106static struct msm_ssbi_platform_data apq8064_ssbi_pm8821_pdata __devinitdata = {
107 .controller_type = MSM_SBI_CTRL_PMIC_ARBITER,
108 .slave = {
Jay Chokshiea67c622011-07-29 17:12:26 -0700109 .name = "pm8821-core",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700110 },
111};
112
113static void __init apq8064_common_init(void)
114{
115 if (socinfo_init() < 0)
116 pr_err("socinfo_init() failed!\n");
Stephen Boydbb600ae2011-08-02 20:11:40 -0700117 msm_clock_init(&apq8064_dummy_clock_init_data);
Joel King4ebccc62011-07-22 09:43:22 -0700118 gpiomux_init();
Kenneth Heitke36920d32011-07-20 16:44:30 -0600119
Harini Jayaramanc4c58692011-07-19 14:50:10 -0600120 apq8064_device_qup_spi_gsbi5.dev.platform_data =
121 &apq8064_qup_spi_gsbi5_pdata;
Kenneth Heitke36920d32011-07-20 16:44:30 -0600122 apq8064_device_ssbi_pmic1.dev.platform_data =
Jay Chokshiea67c622011-07-29 17:12:26 -0700123 &apq8064_ssbi_pm8921_pdata;
Kenneth Heitke36920d32011-07-20 16:44:30 -0600124 apq8064_device_ssbi_pmic2.dev.platform_data =
125 &apq8064_ssbi_pm8821_pdata;
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -0700126 apq8064_device_otg.dev.platform_data = &msm_otg_pdata;
127 apq8064_device_gadget_peripheral.dev.parent = &apq8064_device_otg.dev;
Jay Chokshiea67c622011-07-29 17:12:26 -0700128 pm8921_platform_data.num_regulators =
129 msm8064_pm8921_regulator_pdata_len;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700130 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
131}
132
133static void __init apq8064_sim_init(void)
134{
135 apq8064_common_init();
136}
137
138MACHINE_START(APQ8064_SIM, "QCT APQ8064 SIMULATOR")
139 .map_io = apq8064_map_io,
140 .init_irq = apq8064_init_irq,
141 .timer = &msm_timer,
142 .init_machine = apq8064_sim_init,
143MACHINE_END
144