blob: 230c88784c6a9a2d8543c4fe3d42e2ccdb3b454a [file] [log] [blame]
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -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>
Harini Jayaramaneba52672011-09-08 15:13:00 -060015#include <linux/i2c.h>
Kenneth Heitkeaf3d3cf2011-09-08 11:45:31 -070016#include <linux/msm_ssbi.h>
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -070017#include <asm/mach-types.h>
18#include <asm/mach/arch.h>
19#include <mach/board.h>
20#include <mach/msm_iomap.h>
21#include <mach/gpio.h>
22#include <mach/gpiomux.h>
Harini Jayaraman738c9312011-09-08 15:22:38 -060023#include <mach/msm_spi.h>
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -070024#include "timer.h"
25#include "devices.h"
David Collinsfb88c432011-08-25 15:12:47 -070026#include "board-9615.h"
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -070027
Rohit Vaswani09666872011-08-23 17:41:54 -070028static struct platform_device *common_devices[] = {
Jeff Ohlsteind19bf442011-09-09 12:48:18 -070029 &msm9615_device_dmov,
Jeff Hugo56b933a2011-09-28 14:42:05 -060030 &msm_device_smd,
Rohit Vaswani09666872011-08-23 17:41:54 -070031 &msm9615_device_uart_gsbi4,
Kenneth Heitkeaf3d3cf2011-09-08 11:45:31 -070032 &msm9615_device_ssbi_pmic1,
Harini Jayaramaneba52672011-09-08 15:13:00 -060033 &msm9615_device_qup_i2c_gsbi5,
Harini Jayaraman738c9312011-09-08 15:22:38 -060034 &msm9615_device_qup_spi_gsbi3,
Yan He092b7272011-09-21 15:25:03 -070035 &msm_device_sps,
Siddartha Mohanadoss5d49cec2011-09-21 10:26:15 -070036 &msm9615_device_tsens,
Sahitya Tummala38295432011-09-29 10:08:45 +053037 &msm_device_nand,
Rohit Vaswani09666872011-08-23 17:41:54 -070038};
39
David Collinsfb88c432011-08-25 15:12:47 -070040static struct pm8xxx_irq_platform_data pm8xxx_irq_pdata __devinitdata = {
41 .irq_base = PM8018_IRQ_BASE,
42 .devirq = MSM_GPIO_TO_INT(87),
43 .irq_trigger_flag = IRQF_TRIGGER_LOW,
44};
45
46static struct pm8xxx_gpio_platform_data pm8xxx_gpio_pdata __devinitdata = {
47 .gpio_base = PM8018_GPIO_PM_TO_SYS(1),
48};
49
50static struct pm8xxx_mpp_platform_data pm8xxx_mpp_pdata __devinitdata = {
51 .mpp_base = PM8018_MPP_PM_TO_SYS(1),
52};
53
54static struct pm8xxx_rtc_platform_data pm8xxx_rtc_pdata __devinitdata = {
55 .rtc_write_enable = false,
56};
57
58static struct pm8xxx_pwrkey_platform_data pm8xxx_pwrkey_pdata = {
59 .pull_up = 1,
60 .kpd_trigger_delay_us = 970,
61 .wakeup = 1,
62};
63
64static struct pm8xxx_misc_platform_data pm8xxx_misc_pdata = {
65 .priority = 0,
66};
67
68static struct pm8018_platform_data pm8018_platform_data __devinitdata = {
69 .irq_pdata = &pm8xxx_irq_pdata,
70 .gpio_pdata = &pm8xxx_gpio_pdata,
71 .mpp_pdata = &pm8xxx_mpp_pdata,
72 .rtc_pdata = &pm8xxx_rtc_pdata,
73 .pwrkey_pdata = &pm8xxx_pwrkey_pdata,
74 .misc_pdata = &pm8xxx_misc_pdata,
David Collins00b31e62011-08-31 20:00:10 -070075 .regulator_pdatas = msm_pm8018_regulator_pdata,
David Collinsfb88c432011-08-25 15:12:47 -070076};
77
Kenneth Heitkeaf3d3cf2011-09-08 11:45:31 -070078static struct msm_ssbi_platform_data msm9615_ssbi_pm8018_pdata __devinitdata = {
79 .controller_type = MSM_SBI_CTRL_PMIC_ARBITER,
80 .slave = {
David Collinsfb88c432011-08-25 15:12:47 -070081 .name = PM8018_CORE_DEV_NAME,
82 .platform_data = &pm8018_platform_data,
Kenneth Heitkeaf3d3cf2011-09-08 11:45:31 -070083 },
84};
85
Rohit Vaswani09666872011-08-23 17:41:54 -070086static struct gpiomux_setting gsbi4 = {
87 .func = GPIOMUX_FUNC_1,
88 .drv = GPIOMUX_DRV_8MA,
89 .pull = GPIOMUX_PULL_NONE,
90};
91
Harini Jayaramaneba52672011-09-08 15:13:00 -060092static struct gpiomux_setting gsbi5 = {
93 .func = GPIOMUX_FUNC_1,
94 .drv = GPIOMUX_DRV_8MA,
95 .pull = GPIOMUX_PULL_NONE,
96};
97
Harini Jayaraman738c9312011-09-08 15:22:38 -060098static struct gpiomux_setting gsbi3 = {
99 .func = GPIOMUX_FUNC_1,
100 .drv = GPIOMUX_DRV_8MA,
101 .pull = GPIOMUX_PULL_NONE,
102};
103
104static struct gpiomux_setting gsbi3_cs1_config = {
105 .func = GPIOMUX_FUNC_4,
106 .drv = GPIOMUX_DRV_8MA,
107 .pull = GPIOMUX_PULL_NONE,
108};
109
Rohit Vaswani09666872011-08-23 17:41:54 -0700110struct msm_gpiomux_config msm9615_gsbi_configs[] __initdata = {
111 {
Harini Jayaraman738c9312011-09-08 15:22:38 -0600112 .gpio = 8, /* GSBI3 QUP SPI_CLK */
113 .settings = {
114 [GPIOMUX_SUSPENDED] = &gsbi3,
115 },
116 },
117 {
118 .gpio = 9, /* GSBI3 QUP SPI_CS_N */
119 .settings = {
120 [GPIOMUX_SUSPENDED] = &gsbi3,
121 },
122 },
123 {
124 .gpio = 10, /* GSBI3 QUP SPI_DATA_MISO */
125 .settings = {
126 [GPIOMUX_SUSPENDED] = &gsbi3,
127 },
128 },
129 {
130 .gpio = 11, /* GSBI3 QUP SPI_DATA_MOSI */
131 .settings = {
132 [GPIOMUX_SUSPENDED] = &gsbi3,
133 },
134 },
135 {
Rohit Vaswani09666872011-08-23 17:41:54 -0700136 .gpio = 12, /* GSBI4 UART */
137 .settings = {
138 [GPIOMUX_SUSPENDED] = &gsbi4,
139 },
140 },
141 {
142 .gpio = 13, /* GSBI4 UART */
143 .settings = {
144 [GPIOMUX_SUSPENDED] = &gsbi4,
145 },
146 },
147 {
148 .gpio = 14, /* GSBI4 UART */
149 .settings = {
150 [GPIOMUX_SUSPENDED] = &gsbi4,
151 },
152 },
153 {
154 .gpio = 15, /* GSBI4 UART */
155 .settings = {
156 [GPIOMUX_SUSPENDED] = &gsbi4,
157 },
158 },
Harini Jayaramaneba52672011-09-08 15:13:00 -0600159 {
160 .gpio = 16, /* GSBI5 I2C QUP SCL */
161 .settings = {
162 [GPIOMUX_SUSPENDED] = &gsbi5,
163 },
164 },
165 {
166 .gpio = 17, /* GSBI5 I2C QUP SDA */
167 .settings = {
168 [GPIOMUX_SUSPENDED] = &gsbi5,
169 },
170 },
Harini Jayaraman738c9312011-09-08 15:22:38 -0600171 {
172 /* GPIO 19 can be used for I2C/UART on GSBI5 */
173 .gpio = 19, /* GSBI3 QUP SPI_CS_1 */
174 .settings = {
175 [GPIOMUX_SUSPENDED] = &gsbi3_cs1_config,
176 },
177 },
Rohit Vaswani09666872011-08-23 17:41:54 -0700178};
179
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -0700180static int __init gpiomux_init(void)
181{
182 int rc;
183
184 rc = msm_gpiomux_init(NR_GPIO_IRQS);
185 if (rc) {
186 pr_err(KERN_ERR "msm_gpiomux_init failed %d\n", rc);
187 return rc;
188 }
Rohit Vaswani09666872011-08-23 17:41:54 -0700189 msm_gpiomux_install(msm9615_gsbi_configs,
190 ARRAY_SIZE(msm9615_gsbi_configs));
191
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -0700192 return 0;
193}
194
Harini Jayaraman738c9312011-09-08 15:22:38 -0600195static struct msm_spi_platform_data msm9615_qup_spi_gsbi3_pdata = {
196 .max_clock_speed = 24000000,
197};
198
Harini Jayaramaneba52672011-09-08 15:13:00 -0600199static struct msm_i2c_platform_data msm9615_i2c_qup_gsbi5_pdata = {
200 .clk_freq = 100000,
201 .src_clk_rate = 24000000,
202};
203
204static void __init msm9615_i2c_init(void)
205{
206 msm9615_device_qup_i2c_gsbi5.dev.platform_data =
207 &msm9615_i2c_qup_gsbi5_pdata;
208}
209
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -0700210static void __init msm9615_common_init(void)
211{
212 msm9615_device_init();
213 gpiomux_init();
Harini Jayaramaneba52672011-09-08 15:13:00 -0600214 msm9615_i2c_init();
David Collins00b31e62011-08-31 20:00:10 -0700215 regulator_suppress_info_printing();
Harini Jayaraman738c9312011-09-08 15:22:38 -0600216 msm9615_device_qup_spi_gsbi3.dev.platform_data =
217 &msm9615_qup_spi_gsbi3_pdata;
Kenneth Heitkeaf3d3cf2011-09-08 11:45:31 -0700218 msm9615_device_ssbi_pmic1.dev.platform_data =
219 &msm9615_ssbi_pm8018_pdata;
David Collins00b31e62011-08-31 20:00:10 -0700220 pm8018_platform_data.num_regulators = msm_pm8018_regulator_pdata_len;
Rohit Vaswani09666872011-08-23 17:41:54 -0700221 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -0700222}
223
224static void __init msm9615_cdp_init(void)
225{
226 msm9615_common_init();
227}
228
229static void __init msm9615_mtp_init(void)
230{
231 msm9615_common_init();
232}
233
234MACHINE_START(MSM9615_CDP, "QCT MSM9615 CDP")
235 .map_io = msm9615_map_io,
236 .init_irq = msm9615_init_irq,
237 .timer = &msm_timer,
238 .init_machine = msm9615_cdp_init,
239MACHINE_END
240
241MACHINE_START(MSM9615_MTP, "QCT MSM9615 MTP")
242 .map_io = msm9615_map_io,
243 .init_irq = msm9615_init_irq,
244 .timer = &msm_timer,
245 .init_machine = msm9615_mtp_init,
246MACHINE_END