blob: d1d848c7ef3bf82ad15f01371ac683cadcdb7a1a [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>
Krishna Kondadd794462011-10-01 00:19:29 -070019#include <asm/mach/mmc.h>
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -070020#include <mach/board.h>
21#include <mach/msm_iomap.h>
22#include <mach/gpio.h>
23#include <mach/gpiomux.h>
Harini Jayaraman738c9312011-09-08 15:22:38 -060024#include <mach/msm_spi.h>
Amit Blay5e4ec192011-10-20 09:16:54 +020025#include <linux/usb/android.h>
26#include <linux/usb/msm_hsusb.h>
Siddartha Mohanadoss5f60b452011-10-05 11:49:00 -070027#include <linux/mfd/pm8xxx/pm8xxx-adc.h>
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -070028#include "timer.h"
29#include "devices.h"
David Collinsfb88c432011-08-25 15:12:47 -070030#include "board-9615.h"
Maheshkumar Sivasubramanian4923db22011-09-15 09:28:15 -060031#include "cpuidle.h"
32#include "pm.h"
Vikram Mulukutlab5e1cda2011-10-04 16:17:22 -070033#include "acpuclock.h"
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -070034
Siddartha Mohanadoss5f60b452011-10-05 11:49:00 -070035static struct pm8xxx_adc_amux pm8018_adc_channels_data[] = {
36 {"vcoin", CHANNEL_VCOIN, CHAN_PATH_SCALING2, AMUX_RSV1,
37 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
38 {"vbat", CHANNEL_VBAT, CHAN_PATH_SCALING2, AMUX_RSV1,
39 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
40 {"vph_pwr", CHANNEL_VPH_PWR, CHAN_PATH_SCALING2, AMUX_RSV1,
41 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
42 {"batt_therm", CHANNEL_BATT_THERM, CHAN_PATH_SCALING1, AMUX_RSV2,
43 ADC_DECIMATION_TYPE2, ADC_SCALE_BATT_THERM},
44 {"batt_id", CHANNEL_BATT_ID, CHAN_PATH_SCALING1, AMUX_RSV2,
45 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
46 {"pmic_therm", CHANNEL_DIE_TEMP, CHAN_PATH_SCALING1, AMUX_RSV1,
47 ADC_DECIMATION_TYPE2, ADC_SCALE_PMIC_THERM},
48 {"625mv", CHANNEL_625MV, CHAN_PATH_SCALING1, AMUX_RSV1,
49 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
50 {"125v", CHANNEL_125V, CHAN_PATH_SCALING1, AMUX_RSV1,
51 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
52 {"pa_therm0", ADC_MPP_1_AMUX3, CHAN_PATH_SCALING1, AMUX_RSV1,
53 ADC_DECIMATION_TYPE2, ADC_SCALE_PA_THERM},
54};
55
56static struct pm8xxx_adc_properties pm8018_adc_data = {
57 .adc_vdd_reference = 1800, /* milli-voltage for this adc */
58 .bitresolution = 15,
59 .bipolar = 0,
60};
61
62static struct pm8xxx_adc_platform_data pm8018_adc_pdata = {
63 .adc_channel = pm8018_adc_channels_data,
64 .adc_num_board_channel = ARRAY_SIZE(pm8018_adc_channels_data),
65 .adc_prop = &pm8018_adc_data,
66};
67
David Collinsfb88c432011-08-25 15:12:47 -070068static struct pm8xxx_irq_platform_data pm8xxx_irq_pdata __devinitdata = {
69 .irq_base = PM8018_IRQ_BASE,
70 .devirq = MSM_GPIO_TO_INT(87),
71 .irq_trigger_flag = IRQF_TRIGGER_LOW,
72};
73
74static struct pm8xxx_gpio_platform_data pm8xxx_gpio_pdata __devinitdata = {
75 .gpio_base = PM8018_GPIO_PM_TO_SYS(1),
76};
77
78static struct pm8xxx_mpp_platform_data pm8xxx_mpp_pdata __devinitdata = {
79 .mpp_base = PM8018_MPP_PM_TO_SYS(1),
80};
81
82static struct pm8xxx_rtc_platform_data pm8xxx_rtc_pdata __devinitdata = {
83 .rtc_write_enable = false,
Ashay Jaiswaldb5e6dc2011-10-12 11:02:47 +053084 .rtc_alarm_powerup = false,
David Collinsfb88c432011-08-25 15:12:47 -070085};
86
87static struct pm8xxx_pwrkey_platform_data pm8xxx_pwrkey_pdata = {
88 .pull_up = 1,
89 .kpd_trigger_delay_us = 970,
90 .wakeup = 1,
91};
92
93static struct pm8xxx_misc_platform_data pm8xxx_misc_pdata = {
94 .priority = 0,
95};
96
97static struct pm8018_platform_data pm8018_platform_data __devinitdata = {
98 .irq_pdata = &pm8xxx_irq_pdata,
99 .gpio_pdata = &pm8xxx_gpio_pdata,
100 .mpp_pdata = &pm8xxx_mpp_pdata,
101 .rtc_pdata = &pm8xxx_rtc_pdata,
102 .pwrkey_pdata = &pm8xxx_pwrkey_pdata,
103 .misc_pdata = &pm8xxx_misc_pdata,
David Collins00b31e62011-08-31 20:00:10 -0700104 .regulator_pdatas = msm_pm8018_regulator_pdata,
Siddartha Mohanadoss5f60b452011-10-05 11:49:00 -0700105 .adc_pdata = &pm8018_adc_pdata,
David Collinsfb88c432011-08-25 15:12:47 -0700106};
107
Kenneth Heitkeaf3d3cf2011-09-08 11:45:31 -0700108static struct msm_ssbi_platform_data msm9615_ssbi_pm8018_pdata __devinitdata = {
109 .controller_type = MSM_SBI_CTRL_PMIC_ARBITER,
110 .slave = {
David Collinsfb88c432011-08-25 15:12:47 -0700111 .name = PM8018_CORE_DEV_NAME,
112 .platform_data = &pm8018_platform_data,
Kenneth Heitkeaf3d3cf2011-09-08 11:45:31 -0700113 },
114};
115
David Collinsbea297a2011-09-28 13:11:14 -0700116static struct platform_device msm9615_device_rpm_regulator __devinitdata = {
117 .name = "rpm-regulator",
118 .id = -1,
119 .dev = {
120 .platform_data = &msm_rpm_regulator_9615_pdata,
121 },
122};
123
Rohit Vaswanif688fa62011-10-13 18:13:10 -0700124static struct gpiomux_setting ps_hold = {
125 .func = GPIOMUX_FUNC_1,
126 .drv = GPIOMUX_DRV_8MA,
127 .pull = GPIOMUX_PULL_NONE,
128};
129
Rohit Vaswani09666872011-08-23 17:41:54 -0700130static struct gpiomux_setting gsbi4 = {
131 .func = GPIOMUX_FUNC_1,
132 .drv = GPIOMUX_DRV_8MA,
133 .pull = GPIOMUX_PULL_NONE,
134};
135
Harini Jayaramaneba52672011-09-08 15:13:00 -0600136static struct gpiomux_setting gsbi5 = {
137 .func = GPIOMUX_FUNC_1,
138 .drv = GPIOMUX_DRV_8MA,
139 .pull = GPIOMUX_PULL_NONE,
140};
141
Harini Jayaraman738c9312011-09-08 15:22:38 -0600142static struct gpiomux_setting gsbi3 = {
143 .func = GPIOMUX_FUNC_1,
144 .drv = GPIOMUX_DRV_8MA,
145 .pull = GPIOMUX_PULL_NONE,
146};
147
148static struct gpiomux_setting gsbi3_cs1_config = {
149 .func = GPIOMUX_FUNC_4,
150 .drv = GPIOMUX_DRV_8MA,
151 .pull = GPIOMUX_PULL_NONE,
152};
153
Rohit Vaswanif688fa62011-10-13 18:13:10 -0700154struct msm_gpiomux_config msm9615_ps_hold_config[] __initdata = {
155 {
156 .gpio = 83,
157 .settings = {
158 [GPIOMUX_SUSPENDED] = &ps_hold,
159 },
160 },
161};
162
Rohit Vaswani09666872011-08-23 17:41:54 -0700163struct msm_gpiomux_config msm9615_gsbi_configs[] __initdata = {
164 {
Harini Jayaraman738c9312011-09-08 15:22:38 -0600165 .gpio = 8, /* GSBI3 QUP SPI_CLK */
166 .settings = {
167 [GPIOMUX_SUSPENDED] = &gsbi3,
168 },
169 },
170 {
171 .gpio = 9, /* GSBI3 QUP SPI_CS_N */
172 .settings = {
173 [GPIOMUX_SUSPENDED] = &gsbi3,
174 },
175 },
176 {
177 .gpio = 10, /* GSBI3 QUP SPI_DATA_MISO */
178 .settings = {
179 [GPIOMUX_SUSPENDED] = &gsbi3,
180 },
181 },
182 {
183 .gpio = 11, /* GSBI3 QUP SPI_DATA_MOSI */
184 .settings = {
185 [GPIOMUX_SUSPENDED] = &gsbi3,
186 },
187 },
188 {
Rohit Vaswani09666872011-08-23 17:41:54 -0700189 .gpio = 12, /* GSBI4 UART */
190 .settings = {
191 [GPIOMUX_SUSPENDED] = &gsbi4,
192 },
193 },
194 {
195 .gpio = 13, /* GSBI4 UART */
196 .settings = {
197 [GPIOMUX_SUSPENDED] = &gsbi4,
198 },
199 },
200 {
201 .gpio = 14, /* GSBI4 UART */
202 .settings = {
203 [GPIOMUX_SUSPENDED] = &gsbi4,
204 },
205 },
206 {
207 .gpio = 15, /* GSBI4 UART */
208 .settings = {
209 [GPIOMUX_SUSPENDED] = &gsbi4,
210 },
211 },
Harini Jayaramaneba52672011-09-08 15:13:00 -0600212 {
213 .gpio = 16, /* GSBI5 I2C QUP SCL */
214 .settings = {
215 [GPIOMUX_SUSPENDED] = &gsbi5,
216 },
217 },
218 {
219 .gpio = 17, /* GSBI5 I2C QUP SDA */
220 .settings = {
221 [GPIOMUX_SUSPENDED] = &gsbi5,
222 },
223 },
Harini Jayaraman738c9312011-09-08 15:22:38 -0600224 {
225 /* GPIO 19 can be used for I2C/UART on GSBI5 */
226 .gpio = 19, /* GSBI3 QUP SPI_CS_1 */
227 .settings = {
228 [GPIOMUX_SUSPENDED] = &gsbi3_cs1_config,
229 },
230 },
Rohit Vaswani09666872011-08-23 17:41:54 -0700231};
232
Krishna Kondadd794462011-10-01 00:19:29 -0700233#if (defined(CONFIG_MMC_MSM_SDC1_SUPPORT)\
234 || defined(CONFIG_MMC_MSM_SDC2_SUPPORT))
235
Krishna Konda7186bfe2011-10-17 15:36:54 -0700236#define GPIO_SDCARD_PWR_EN 18
237#define GPIO_SDC1_HW_DET 80
Krishna Kondadd794462011-10-01 00:19:29 -0700238
239/* MDM9x15 have 2 SDCC controllers */
240enum sdcc_controllers {
241 SDCC1,
242 SDCC2,
243 MAX_SDCC_CONTROLLER
244};
245
246#ifdef CONFIG_MMC_MSM_SDC1_SUPPORT
247/* SDC1 pad data */
248static struct msm_mmc_pad_drv sdc1_pad_drv_on_cfg[] = {
249 {TLMM_HDRV_SDC1_CLK, GPIO_CFG_16MA},
250 {TLMM_HDRV_SDC1_CMD, GPIO_CFG_10MA},
251 {TLMM_HDRV_SDC1_DATA, GPIO_CFG_10MA}
252};
253
254static struct msm_mmc_pad_drv sdc1_pad_drv_off_cfg[] = {
255 {TLMM_HDRV_SDC1_CLK, GPIO_CFG_2MA},
256 {TLMM_HDRV_SDC1_CMD, GPIO_CFG_2MA},
257 {TLMM_HDRV_SDC1_DATA, GPIO_CFG_2MA}
258};
259
260static struct msm_mmc_pad_pull sdc1_pad_pull_on_cfg[] = {
261 {TLMM_PULL_SDC1_CLK, GPIO_CFG_NO_PULL},
262 {TLMM_PULL_SDC1_CMD, GPIO_CFG_PULL_UP},
263 {TLMM_PULL_SDC1_DATA, GPIO_CFG_PULL_UP}
264};
265
266static struct msm_mmc_pad_pull sdc1_pad_pull_off_cfg[] = {
267 {TLMM_PULL_SDC1_CLK, GPIO_CFG_NO_PULL},
268 {TLMM_PULL_SDC1_CMD, GPIO_CFG_PULL_DOWN},
269 {TLMM_PULL_SDC1_DATA, GPIO_CFG_PULL_DOWN}
270};
271
272static struct msm_mmc_pad_pull_data mmc_pad_pull_data[MAX_SDCC_CONTROLLER] = {
273 [SDCC1] = {
274 .on = sdc1_pad_pull_on_cfg,
275 .off = sdc1_pad_pull_off_cfg,
276 .size = ARRAY_SIZE(sdc1_pad_pull_on_cfg)
277 },
278};
279
280static struct msm_mmc_pad_drv_data mmc_pad_drv_data[MAX_SDCC_CONTROLLER] = {
281 [SDCC1] = {
282 .on = sdc1_pad_drv_on_cfg,
283 .off = sdc1_pad_drv_off_cfg,
284 .size = ARRAY_SIZE(sdc1_pad_drv_on_cfg)
285 },
286};
287
288static struct msm_mmc_pad_data mmc_pad_data[MAX_SDCC_CONTROLLER] = {
289 [SDCC1] = {
290 .pull = &mmc_pad_pull_data[SDCC1],
291 .drv = &mmc_pad_drv_data[SDCC1]
292 },
293};
294#endif
295
Krishna Konda71aef182011-10-01 02:27:51 -0700296#ifdef CONFIG_MMC_MSM_SDC2_SUPPORT
297static struct gpiomux_setting sdcc2_clk_actv_cfg = {
298 .func = GPIOMUX_FUNC_1,
299 .drv = GPIOMUX_DRV_16MA,
300 .pull = GPIOMUX_PULL_NONE,
301};
302
303static struct gpiomux_setting sdcc2_cmd_data_0_3_actv_cfg = {
304 .func = GPIOMUX_FUNC_1,
305 .drv = GPIOMUX_DRV_8MA,
306 .pull = GPIOMUX_PULL_UP,
307};
308
309static struct gpiomux_setting sdcc2_suspend_cfg = {
310 .func = GPIOMUX_FUNC_1,
311 .drv = GPIOMUX_DRV_2MA,
312 .pull = GPIOMUX_PULL_DOWN,
313};
314
315static struct msm_gpiomux_config msm9615_sdcc2_configs[] __initdata = {
316 {
317 /* SDC2_DATA_0 */
318 .gpio = 25,
319 .settings = {
320 [GPIOMUX_ACTIVE] = &sdcc2_cmd_data_0_3_actv_cfg,
321 [GPIOMUX_SUSPENDED] = &sdcc2_suspend_cfg,
322 },
323 },
324 {
325 /* SDC2_DATA_1 */
326 .gpio = 26,
327 .settings = {
328 [GPIOMUX_ACTIVE] = &sdcc2_cmd_data_0_3_actv_cfg,
329 [GPIOMUX_SUSPENDED] = &sdcc2_suspend_cfg,
330 },
331 },
332 {
333 /* SDC2_DATA_2 */
334 .gpio = 27,
335 .settings = {
336 [GPIOMUX_ACTIVE] = &sdcc2_cmd_data_0_3_actv_cfg,
337 [GPIOMUX_SUSPENDED] = &sdcc2_suspend_cfg,
338 },
339 },
340 {
341 /* SDC2_DATA_3 */
342 .gpio = 28,
343 .settings = {
344 [GPIOMUX_ACTIVE] = &sdcc2_cmd_data_0_3_actv_cfg,
345 [GPIOMUX_SUSPENDED] = &sdcc2_suspend_cfg,
346 },
347 },
348 {
349 /* SDC2_CMD GSBI1 */
350 .gpio = 29,
351 .settings = {
352 [GPIOMUX_ACTIVE] = &sdcc2_cmd_data_0_3_actv_cfg,
353 [GPIOMUX_SUSPENDED] = &sdcc2_suspend_cfg,
354 },
355 },
356 {
357 /* SDC2_CLK GSBI1 */
358 .gpio = 30,
359 .settings = {
360 [GPIOMUX_ACTIVE] = &sdcc2_clk_actv_cfg,
361 [GPIOMUX_SUSPENDED] = &sdcc2_suspend_cfg,
362 },
363 },
364};
365
366static struct msm_mmc_gpio sdc2_gpio_cfg[] = {
367 {25, "sdc2_dat_0"},
368 {26, "sdc2_dat_1"},
369 {27, "sdc2_dat_2"},
370 {28, "sdc2_dat_3"},
371 {29, "sdc2_cmd"},
372 {30, "sdc2_clk"},
373};
374
375static struct msm_mmc_gpio_data mmc_gpio_data[MAX_SDCC_CONTROLLER] = {
376 [SDCC2] = {
377 .gpio = sdc2_gpio_cfg,
378 .size = ARRAY_SIZE(sdc2_gpio_cfg),
379 },
380};
381#else
382static struct msm_gpiomux_config msm9615_sdcc2_configs[0];
383#endif
384
385static struct msm_mmc_pin_data mmc_slot_pin_data[MAX_SDCC_CONTROLLER] = {
Krishna Kondadd794462011-10-01 00:19:29 -0700386#ifdef CONFIG_MMC_MSM_SDC1_SUPPORT
387 [SDCC1] = {
388 .is_gpio = 0,
389 .pad_data = &mmc_pad_data[SDCC1],
390 },
391#endif
Krishna Konda71aef182011-10-01 02:27:51 -0700392#ifdef CONFIG_MMC_MSM_SDC2_SUPPORT
393 [SDCC2] = {
394 .is_gpio = 1,
395 .gpio_data = &mmc_gpio_data[SDCC2],
396 },
397#endif
Krishna Kondadd794462011-10-01 00:19:29 -0700398};
399
400#ifdef CONFIG_MMC_MSM_SDC1_SUPPORT
401static unsigned int sdc1_sup_clk_rates[] = {
402 400000, 24000000, 48000000
403};
404
405static struct mmc_platform_data sdc1_data = {
406 .ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29,
407 .mmc_bus_width = MMC_CAP_4_BIT_DATA,
408 .sup_clk_table = sdc1_sup_clk_rates,
409 .sup_clk_cnt = ARRAY_SIZE(sdc1_sup_clk_rates),
Krishna Konda890b1d12011-10-18 16:05:37 -0700410 .pclk_src_dfab = 1,
Krishna Kondadd794462011-10-01 00:19:29 -0700411 .sdcc_v4_sup = true,
412 .pin_data = &mmc_slot_pin_data[SDCC1],
Krishna Konda7186bfe2011-10-17 15:36:54 -0700413#ifdef CONFIG_MMC_MSM_CARD_HW_DETECTION
414 .status_gpio = GPIO_SDC1_HW_DET,
415 .status_irq = MSM_GPIO_TO_INT(GPIO_SDC1_HW_DET),
416 .irq_flags = IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
417#endif
Krishna Kondadd794462011-10-01 00:19:29 -0700418};
419static struct mmc_platform_data *msm9615_sdc1_pdata = &sdc1_data;
420#else
421static struct mmc_platform_data *msm9615_sdc1_pdata;
422#endif
423
Krishna Konda71aef182011-10-01 02:27:51 -0700424#ifdef CONFIG_MMC_MSM_SDC2_SUPPORT
425static unsigned int sdc2_sup_clk_rates[] = {
426 400000, 24000000, 48000000
427};
428
429static struct mmc_platform_data sdc2_data = {
430 .ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29,
431 .mmc_bus_width = MMC_CAP_4_BIT_DATA,
432 .sup_clk_table = sdc2_sup_clk_rates,
433 .sup_clk_cnt = ARRAY_SIZE(sdc2_sup_clk_rates),
Krishna Konda890b1d12011-10-18 16:05:37 -0700434 .pclk_src_dfab = 1,
Krishna Konda71aef182011-10-01 02:27:51 -0700435 .sdcc_v4_sup = true,
436 .pin_data = &mmc_slot_pin_data[SDCC2],
437};
438static struct mmc_platform_data *msm9615_sdc2_pdata = &sdc2_data;
439#else
440static struct mmc_platform_data *msm9615_sdc2_pdata;
441#endif
442
Krishna Kondadd794462011-10-01 00:19:29 -0700443static void __init msm9615_init_mmc(void)
444{
445 int ret;
446
447 if (msm9615_sdc1_pdata) {
448 ret = gpio_request(GPIO_SDCARD_PWR_EN, "SDCARD_PWR_EN");
449
450 if (ret) {
451 pr_err("%s: sdcc1: Error requesting GPIO "
452 "SDCARD_PWR_EN:%d\n", __func__, ret);
453 } else {
454 ret = gpio_direction_output(GPIO_SDCARD_PWR_EN, 1);
455 if (ret) {
456 pr_err("%s: sdcc1: Error setting o/p direction"
457 " for GPIO SDCARD_PWR_EN:%d\n",
458 __func__, ret);
459 gpio_free(GPIO_SDCARD_PWR_EN);
460 } else {
461 msm_add_sdcc(1, msm9615_sdc1_pdata);
462 }
463 }
464 }
Krishna Konda71aef182011-10-01 02:27:51 -0700465
466 if (msm9615_sdc2_pdata) {
467 msm_gpiomux_install(msm9615_sdcc2_configs,
468 ARRAY_SIZE(msm9615_sdcc2_configs));
469
470 /* SDC2: External card slot */
471 msm_add_sdcc(2, msm9615_sdc2_pdata);
472 }
Krishna Kondadd794462011-10-01 00:19:29 -0700473}
474#else
475static void __init msm9615_init_mmc(void) { }
476#endif
Maheshkumar Sivasubramanian4923db22011-09-15 09:28:15 -0600477static struct msm_cpuidle_state msm_cstates[] __initdata = {
478 {0, 0, "C0", "WFI",
479 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
480
481 {0, 1, "C1", "STANDALONE_POWER_COLLAPSE",
482 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
483
484 {0, 2, "C2", "POWER_COLLAPSE",
485 MSM_PM_SLEEP_MODE_POWER_COLLAPSE},
486};
487static struct msm_pm_platform_data msm_pm_data[MSM_PM_SLEEP_MODE_NR] = {
488 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
489 .idle_supported = 1,
490 .suspend_supported = 1,
491 .idle_enabled = 0,
492 .suspend_enabled = 0,
493 },
494 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
495 .idle_supported = 1,
496 .suspend_supported = 1,
497 .idle_enabled = 0,
498 .suspend_enabled = 0,
499 },
500 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
501 .idle_supported = 1,
502 .suspend_supported = 1,
503 .idle_enabled = 1,
504 .suspend_enabled = 1,
505 },
506};
Krishna Kondadd794462011-10-01 00:19:29 -0700507
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -0700508static int __init gpiomux_init(void)
509{
510 int rc;
511
512 rc = msm_gpiomux_init(NR_GPIO_IRQS);
513 if (rc) {
514 pr_err(KERN_ERR "msm_gpiomux_init failed %d\n", rc);
515 return rc;
516 }
Rohit Vaswani09666872011-08-23 17:41:54 -0700517 msm_gpiomux_install(msm9615_gsbi_configs,
518 ARRAY_SIZE(msm9615_gsbi_configs));
519
Rohit Vaswanif688fa62011-10-13 18:13:10 -0700520 msm_gpiomux_install(msm9615_ps_hold_config,
521 ARRAY_SIZE(msm9615_ps_hold_config));
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -0700522 return 0;
523}
524
Harini Jayaraman738c9312011-09-08 15:22:38 -0600525static struct msm_spi_platform_data msm9615_qup_spi_gsbi3_pdata = {
526 .max_clock_speed = 24000000,
527};
528
Harini Jayaramaneba52672011-09-08 15:13:00 -0600529static struct msm_i2c_platform_data msm9615_i2c_qup_gsbi5_pdata = {
530 .clk_freq = 100000,
531 .src_clk_rate = 24000000,
532};
533
Amit Blay5e4ec192011-10-20 09:16:54 +0200534static struct msm_otg_platform_data msm_otg_pdata = {
535 .mode = USB_PERIPHERAL,
536 .otg_control = OTG_NO_CONTROL,
537 .phy_type = SNPS_28NM_INTEGRATED_PHY,
538 .pclk_src_name = "dfab_usb_hs_clk",
539};
540
541static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum)
542{
543 return 0;
544}
545
546static struct android_usb_platform_data android_usb_pdata = {
547 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
548};
549
550static struct platform_device android_usb_device = {
551 .name = "android_usb",
552 .id = -1,
553 .dev = {
554 .platform_data = &android_usb_pdata,
555 },
556};
557
558static struct platform_device *common_devices[] = {
559 &msm9615_device_dmov,
560 &msm_device_smd,
561 &msm_device_otg,
562 &msm_device_gadget_peripheral,
563 &android_usb_device,
564 &msm9615_device_uart_gsbi4,
565 &msm9615_device_ssbi_pmic1,
566 &msm9615_device_qup_i2c_gsbi5,
567 &msm9615_device_qup_spi_gsbi3,
568 &msm_device_sps,
569 &msm9615_device_tsens,
570 &msm_device_nand,
571 &msm_rpm_device,
572#ifdef CONFIG_HW_RANDOM_MSM
573 &msm_device_rng,
574#endif
575
576#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
577 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
Ramesh Masavarapuaa28b5b2011-10-21 10:26:03 -0700578 &msm9615_qcrypto_device,
Amit Blay5e4ec192011-10-20 09:16:54 +0200579#endif
580
581#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
582 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
Ramesh Masavarapuaa28b5b2011-10-21 10:26:03 -0700583 &msm9615_qcedev_device,
Amit Blay5e4ec192011-10-20 09:16:54 +0200584#endif
585};
586
Harini Jayaramaneba52672011-09-08 15:13:00 -0600587static void __init msm9615_i2c_init(void)
588{
589 msm9615_device_qup_i2c_gsbi5.dev.platform_data =
590 &msm9615_i2c_qup_gsbi5_pdata;
591}
592
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -0700593static void __init msm9615_common_init(void)
594{
595 msm9615_device_init();
596 gpiomux_init();
Harini Jayaramaneba52672011-09-08 15:13:00 -0600597 msm9615_i2c_init();
David Collins00b31e62011-08-31 20:00:10 -0700598 regulator_suppress_info_printing();
David Collinsbea297a2011-09-28 13:11:14 -0700599 platform_device_register(&msm9615_device_rpm_regulator);
Harini Jayaraman738c9312011-09-08 15:22:38 -0600600 msm9615_device_qup_spi_gsbi3.dev.platform_data =
601 &msm9615_qup_spi_gsbi3_pdata;
Kenneth Heitkeaf3d3cf2011-09-08 11:45:31 -0700602 msm9615_device_ssbi_pmic1.dev.platform_data =
603 &msm9615_ssbi_pm8018_pdata;
David Collins00b31e62011-08-31 20:00:10 -0700604 pm8018_platform_data.num_regulators = msm_pm8018_regulator_pdata_len;
Amit Blay5e4ec192011-10-20 09:16:54 +0200605
606 msm_device_otg.dev.platform_data = &msm_otg_pdata;
607 msm_device_gadget_peripheral.dev.parent = &msm_device_otg.dev;
Rohit Vaswani09666872011-08-23 17:41:54 -0700608 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Krishna Kondadd794462011-10-01 00:19:29 -0700609
Vikram Mulukutlab5e1cda2011-10-04 16:17:22 -0700610 msm_clock_init(&msm9615_clock_init_data);
611 acpuclk_init(&acpuclk_9615_soc_data);
612
Krishna Kondadd794462011-10-01 00:19:29 -0700613 msm9615_init_mmc();
Maheshkumar Sivasubramanian4923db22011-09-15 09:28:15 -0600614 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
615 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
616 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
617 msm_pm_data);
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -0700618}
619
620static void __init msm9615_cdp_init(void)
621{
622 msm9615_common_init();
623}
624
625static void __init msm9615_mtp_init(void)
626{
627 msm9615_common_init();
628}
629
630MACHINE_START(MSM9615_CDP, "QCT MSM9615 CDP")
631 .map_io = msm9615_map_io,
632 .init_irq = msm9615_init_irq,
633 .timer = &msm_timer,
634 .init_machine = msm9615_cdp_init,
635MACHINE_END
636
637MACHINE_START(MSM9615_MTP, "QCT MSM9615 MTP")
638 .map_io = msm9615_map_io,
639 .init_irq = msm9615_init_irq,
640 .timer = &msm_timer,
641 .init_machine = msm9615_mtp_init,
642MACHINE_END