blob: 99c16107d009c3f42e4b292d2cfef5e921f42d2b [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>
Harini Jayaramanc4c58692011-07-19 14:50:10 -060026#include <mach/msm_spi.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070027#include "timer.h"
28#include "devices.h"
Joel King4ebccc62011-07-22 09:43:22 -070029#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,
Harini Jayaramanc4c58692011-07-19 14:50:10 -060074 &apq8064_device_uart_gsbi3,
75 &apq8064_device_qup_spi_gsbi5,
76};
77
78static struct msm_spi_platform_data apq8064_qup_spi_gsbi5_pdata = {
79 .max_clock_speed = 26000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070080};
81
82static struct msm_otg_platform_data msm_otg_pdata = {
83 .mode = USB_PERIPHERAL,
84 .otg_control = OTG_PHY_CONTROL,
85 .phy_type = SNPS_28NM_INTEGRATED_PHY,
86 .pclk_src_name = "dfab_usb_hs_clk",
87};
88
89static struct msm_ssbi_platform_data apq8064_ssbi_pm8921_pdata __devinitdata = {
90 .controller_type = MSM_SBI_CTRL_PMIC_ARBITER,
91 .slave = {
92 .name = "pm8921-core",
93 },
94};
95
96static struct msm_ssbi_platform_data apq8064_ssbi_pm8821_pdata __devinitdata = {
97 .controller_type = MSM_SBI_CTRL_PMIC_ARBITER,
98 .slave = {
99 .name = "pm8821-core",
100 },
101};
102
103static void __init apq8064_common_init(void)
104{
105 if (socinfo_init() < 0)
106 pr_err("socinfo_init() failed!\n");
107 msm_clock_init(msm_clocks_8064_dummy, msm_num_clocks_8064_dummy);
Joel King4ebccc62011-07-22 09:43:22 -0700108 gpiomux_init();
Harini Jayaramanc4c58692011-07-19 14:50:10 -0600109 apq8064_device_qup_spi_gsbi5.dev.platform_data =
110 &apq8064_qup_spi_gsbi5_pdata;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700111 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
112}
113
114static void __init apq8064_sim_init(void)
115{
116 apq8064_common_init();
117}
118
119MACHINE_START(APQ8064_SIM, "QCT APQ8064 SIMULATOR")
120 .map_io = apq8064_map_io,
121 .init_irq = apq8064_init_irq,
122 .timer = &msm_timer,
123 .init_machine = apq8064_sim_init,
124MACHINE_END
125