blob: 8fa72ee1fd2b64c4da1b235e05d1bdbb0dcd566b [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>
Ramesh Masavarapu5ad37392011-10-10 10:44:10 -070017#include <linux/platform_data/qcom_crypto_device.h>
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -070018#include <asm/mach-types.h>
19#include <asm/mach/arch.h>
Krishna Kondadd794462011-10-01 00:19:29 -070020#include <asm/mach/mmc.h>
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -070021#include <mach/board.h>
22#include <mach/msm_iomap.h>
23#include <mach/gpio.h>
24#include <mach/gpiomux.h>
Harini Jayaraman738c9312011-09-08 15:22:38 -060025#include <mach/msm_spi.h>
Amit Blay5e4ec192011-10-20 09:16:54 +020026#include <linux/usb/android.h>
27#include <linux/usb/msm_hsusb.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"
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -070033
David Collinsfb88c432011-08-25 15:12:47 -070034static struct pm8xxx_irq_platform_data pm8xxx_irq_pdata __devinitdata = {
35 .irq_base = PM8018_IRQ_BASE,
36 .devirq = MSM_GPIO_TO_INT(87),
37 .irq_trigger_flag = IRQF_TRIGGER_LOW,
38};
39
40static struct pm8xxx_gpio_platform_data pm8xxx_gpio_pdata __devinitdata = {
41 .gpio_base = PM8018_GPIO_PM_TO_SYS(1),
42};
43
44static struct pm8xxx_mpp_platform_data pm8xxx_mpp_pdata __devinitdata = {
45 .mpp_base = PM8018_MPP_PM_TO_SYS(1),
46};
47
48static struct pm8xxx_rtc_platform_data pm8xxx_rtc_pdata __devinitdata = {
49 .rtc_write_enable = false,
50};
51
52static struct pm8xxx_pwrkey_platform_data pm8xxx_pwrkey_pdata = {
53 .pull_up = 1,
54 .kpd_trigger_delay_us = 970,
55 .wakeup = 1,
56};
57
58static struct pm8xxx_misc_platform_data pm8xxx_misc_pdata = {
59 .priority = 0,
60};
61
62static struct pm8018_platform_data pm8018_platform_data __devinitdata = {
63 .irq_pdata = &pm8xxx_irq_pdata,
64 .gpio_pdata = &pm8xxx_gpio_pdata,
65 .mpp_pdata = &pm8xxx_mpp_pdata,
66 .rtc_pdata = &pm8xxx_rtc_pdata,
67 .pwrkey_pdata = &pm8xxx_pwrkey_pdata,
68 .misc_pdata = &pm8xxx_misc_pdata,
David Collins00b31e62011-08-31 20:00:10 -070069 .regulator_pdatas = msm_pm8018_regulator_pdata,
David Collinsfb88c432011-08-25 15:12:47 -070070};
71
Kenneth Heitkeaf3d3cf2011-09-08 11:45:31 -070072static struct msm_ssbi_platform_data msm9615_ssbi_pm8018_pdata __devinitdata = {
73 .controller_type = MSM_SBI_CTRL_PMIC_ARBITER,
74 .slave = {
David Collinsfb88c432011-08-25 15:12:47 -070075 .name = PM8018_CORE_DEV_NAME,
76 .platform_data = &pm8018_platform_data,
Kenneth Heitkeaf3d3cf2011-09-08 11:45:31 -070077 },
78};
79
David Collinsbea297a2011-09-28 13:11:14 -070080static struct platform_device msm9615_device_rpm_regulator __devinitdata = {
81 .name = "rpm-regulator",
82 .id = -1,
83 .dev = {
84 .platform_data = &msm_rpm_regulator_9615_pdata,
85 },
86};
87
Rohit Vaswanif688fa62011-10-13 18:13:10 -070088static struct gpiomux_setting ps_hold = {
89 .func = GPIOMUX_FUNC_1,
90 .drv = GPIOMUX_DRV_8MA,
91 .pull = GPIOMUX_PULL_NONE,
92};
93
Rohit Vaswani09666872011-08-23 17:41:54 -070094static struct gpiomux_setting gsbi4 = {
95 .func = GPIOMUX_FUNC_1,
96 .drv = GPIOMUX_DRV_8MA,
97 .pull = GPIOMUX_PULL_NONE,
98};
99
Harini Jayaramaneba52672011-09-08 15:13:00 -0600100static struct gpiomux_setting gsbi5 = {
101 .func = GPIOMUX_FUNC_1,
102 .drv = GPIOMUX_DRV_8MA,
103 .pull = GPIOMUX_PULL_NONE,
104};
105
Harini Jayaraman738c9312011-09-08 15:22:38 -0600106static struct gpiomux_setting gsbi3 = {
107 .func = GPIOMUX_FUNC_1,
108 .drv = GPIOMUX_DRV_8MA,
109 .pull = GPIOMUX_PULL_NONE,
110};
111
112static struct gpiomux_setting gsbi3_cs1_config = {
113 .func = GPIOMUX_FUNC_4,
114 .drv = GPIOMUX_DRV_8MA,
115 .pull = GPIOMUX_PULL_NONE,
116};
117
Rohit Vaswanif688fa62011-10-13 18:13:10 -0700118struct msm_gpiomux_config msm9615_ps_hold_config[] __initdata = {
119 {
120 .gpio = 83,
121 .settings = {
122 [GPIOMUX_SUSPENDED] = &ps_hold,
123 },
124 },
125};
126
Rohit Vaswani09666872011-08-23 17:41:54 -0700127struct msm_gpiomux_config msm9615_gsbi_configs[] __initdata = {
128 {
Harini Jayaraman738c9312011-09-08 15:22:38 -0600129 .gpio = 8, /* GSBI3 QUP SPI_CLK */
130 .settings = {
131 [GPIOMUX_SUSPENDED] = &gsbi3,
132 },
133 },
134 {
135 .gpio = 9, /* GSBI3 QUP SPI_CS_N */
136 .settings = {
137 [GPIOMUX_SUSPENDED] = &gsbi3,
138 },
139 },
140 {
141 .gpio = 10, /* GSBI3 QUP SPI_DATA_MISO */
142 .settings = {
143 [GPIOMUX_SUSPENDED] = &gsbi3,
144 },
145 },
146 {
147 .gpio = 11, /* GSBI3 QUP SPI_DATA_MOSI */
148 .settings = {
149 [GPIOMUX_SUSPENDED] = &gsbi3,
150 },
151 },
152 {
Rohit Vaswani09666872011-08-23 17:41:54 -0700153 .gpio = 12, /* GSBI4 UART */
154 .settings = {
155 [GPIOMUX_SUSPENDED] = &gsbi4,
156 },
157 },
158 {
159 .gpio = 13, /* GSBI4 UART */
160 .settings = {
161 [GPIOMUX_SUSPENDED] = &gsbi4,
162 },
163 },
164 {
165 .gpio = 14, /* GSBI4 UART */
166 .settings = {
167 [GPIOMUX_SUSPENDED] = &gsbi4,
168 },
169 },
170 {
171 .gpio = 15, /* GSBI4 UART */
172 .settings = {
173 [GPIOMUX_SUSPENDED] = &gsbi4,
174 },
175 },
Harini Jayaramaneba52672011-09-08 15:13:00 -0600176 {
177 .gpio = 16, /* GSBI5 I2C QUP SCL */
178 .settings = {
179 [GPIOMUX_SUSPENDED] = &gsbi5,
180 },
181 },
182 {
183 .gpio = 17, /* GSBI5 I2C QUP SDA */
184 .settings = {
185 [GPIOMUX_SUSPENDED] = &gsbi5,
186 },
187 },
Harini Jayaraman738c9312011-09-08 15:22:38 -0600188 {
189 /* GPIO 19 can be used for I2C/UART on GSBI5 */
190 .gpio = 19, /* GSBI3 QUP SPI_CS_1 */
191 .settings = {
192 [GPIOMUX_SUSPENDED] = &gsbi3_cs1_config,
193 },
194 },
Rohit Vaswani09666872011-08-23 17:41:54 -0700195};
196
Ramesh Masavarapufa679d92011-10-13 23:42:59 -0700197#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
198 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
199 defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
200 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
201
202#define QCE_SIZE 0x10000
203#define QCE_0_BASE 0x18500000
204
205#define QCE_HW_KEY_SUPPORT 0
206#define QCE_SHA_HMAC_SUPPORT 1
207#define QCE_SHARE_CE_RESOURCE 1
208#define QCE_CE_SHARED 0
209
210static struct resource qcrypto_resources[] = {
211 [0] = {
212 .start = QCE_0_BASE,
213 .end = QCE_0_BASE + QCE_SIZE - 1,
214 .flags = IORESOURCE_MEM,
215 },
216 [1] = {
217 .name = "crypto_channels",
218 .start = DMOV_CE_IN_CHAN,
219 .end = DMOV_CE_OUT_CHAN,
220 .flags = IORESOURCE_DMA,
221 },
222 [2] = {
223 .name = "crypto_crci_in",
224 .start = DMOV_CE_IN_CRCI,
225 .end = DMOV_CE_IN_CRCI,
226 .flags = IORESOURCE_DMA,
227 },
228 [3] = {
229 .name = "crypto_crci_out",
230 .start = DMOV_CE_OUT_CRCI,
231 .end = DMOV_CE_OUT_CRCI,
232 .flags = IORESOURCE_DMA,
233 },
234};
235
236static struct resource qcedev_resources[] = {
237 [0] = {
238 .start = QCE_0_BASE,
239 .end = QCE_0_BASE + QCE_SIZE - 1,
240 .flags = IORESOURCE_MEM,
241 },
242 [1] = {
243 .name = "crypto_channels",
244 .start = DMOV_CE_IN_CHAN,
245 .end = DMOV_CE_OUT_CHAN,
246 .flags = IORESOURCE_DMA,
247 },
248 [2] = {
249 .name = "crypto_crci_in",
250 .start = DMOV_CE_IN_CRCI,
251 .end = DMOV_CE_IN_CRCI,
252 .flags = IORESOURCE_DMA,
253 },
254 [3] = {
255 .name = "crypto_crci_out",
256 .start = DMOV_CE_OUT_CRCI,
257 .end = DMOV_CE_OUT_CRCI,
258 .flags = IORESOURCE_DMA,
259 },
260};
261
262#endif
263
264#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
265 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
266
267static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
268 .ce_shared = QCE_CE_SHARED,
269 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
270 .hw_key_support = QCE_HW_KEY_SUPPORT,
271 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
272};
273
274static struct platform_device qcrypto_device = {
275 .name = "qcrypto",
276 .id = 0,
277 .num_resources = ARRAY_SIZE(qcrypto_resources),
278 .resource = qcrypto_resources,
279 .dev = {
280 .coherent_dma_mask = DMA_BIT_MASK(32),
281 .platform_data = &qcrypto_ce_hw_suppport,
282 },
283};
284#endif
285
286#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
287 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
288
289static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
290 .ce_shared = QCE_CE_SHARED,
291 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
292 .hw_key_support = QCE_HW_KEY_SUPPORT,
293 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
294};
295
296static struct platform_device qcedev_device = {
297 .name = "qce",
298 .id = 0,
299 .num_resources = ARRAY_SIZE(qcedev_resources),
300 .resource = qcedev_resources,
301 .dev = {
302 .coherent_dma_mask = DMA_BIT_MASK(32),
303 .platform_data = &qcedev_ce_hw_suppport,
304 },
305};
306#endif
307
Krishna Kondadd794462011-10-01 00:19:29 -0700308#if (defined(CONFIG_MMC_MSM_SDC1_SUPPORT)\
309 || defined(CONFIG_MMC_MSM_SDC2_SUPPORT))
310
311#define GPIO_SDCARD_PWR_EN 18
312
313/* MDM9x15 have 2 SDCC controllers */
314enum sdcc_controllers {
315 SDCC1,
316 SDCC2,
317 MAX_SDCC_CONTROLLER
318};
319
320#ifdef CONFIG_MMC_MSM_SDC1_SUPPORT
321/* SDC1 pad data */
322static struct msm_mmc_pad_drv sdc1_pad_drv_on_cfg[] = {
323 {TLMM_HDRV_SDC1_CLK, GPIO_CFG_16MA},
324 {TLMM_HDRV_SDC1_CMD, GPIO_CFG_10MA},
325 {TLMM_HDRV_SDC1_DATA, GPIO_CFG_10MA}
326};
327
328static struct msm_mmc_pad_drv sdc1_pad_drv_off_cfg[] = {
329 {TLMM_HDRV_SDC1_CLK, GPIO_CFG_2MA},
330 {TLMM_HDRV_SDC1_CMD, GPIO_CFG_2MA},
331 {TLMM_HDRV_SDC1_DATA, GPIO_CFG_2MA}
332};
333
334static struct msm_mmc_pad_pull sdc1_pad_pull_on_cfg[] = {
335 {TLMM_PULL_SDC1_CLK, GPIO_CFG_NO_PULL},
336 {TLMM_PULL_SDC1_CMD, GPIO_CFG_PULL_UP},
337 {TLMM_PULL_SDC1_DATA, GPIO_CFG_PULL_UP}
338};
339
340static struct msm_mmc_pad_pull sdc1_pad_pull_off_cfg[] = {
341 {TLMM_PULL_SDC1_CLK, GPIO_CFG_NO_PULL},
342 {TLMM_PULL_SDC1_CMD, GPIO_CFG_PULL_DOWN},
343 {TLMM_PULL_SDC1_DATA, GPIO_CFG_PULL_DOWN}
344};
345
346static struct msm_mmc_pad_pull_data mmc_pad_pull_data[MAX_SDCC_CONTROLLER] = {
347 [SDCC1] = {
348 .on = sdc1_pad_pull_on_cfg,
349 .off = sdc1_pad_pull_off_cfg,
350 .size = ARRAY_SIZE(sdc1_pad_pull_on_cfg)
351 },
352};
353
354static struct msm_mmc_pad_drv_data mmc_pad_drv_data[MAX_SDCC_CONTROLLER] = {
355 [SDCC1] = {
356 .on = sdc1_pad_drv_on_cfg,
357 .off = sdc1_pad_drv_off_cfg,
358 .size = ARRAY_SIZE(sdc1_pad_drv_on_cfg)
359 },
360};
361
362static struct msm_mmc_pad_data mmc_pad_data[MAX_SDCC_CONTROLLER] = {
363 [SDCC1] = {
364 .pull = &mmc_pad_pull_data[SDCC1],
365 .drv = &mmc_pad_drv_data[SDCC1]
366 },
367};
368#endif
369
Krishna Konda71aef182011-10-01 02:27:51 -0700370#ifdef CONFIG_MMC_MSM_SDC2_SUPPORT
371static struct gpiomux_setting sdcc2_clk_actv_cfg = {
372 .func = GPIOMUX_FUNC_1,
373 .drv = GPIOMUX_DRV_16MA,
374 .pull = GPIOMUX_PULL_NONE,
375};
376
377static struct gpiomux_setting sdcc2_cmd_data_0_3_actv_cfg = {
378 .func = GPIOMUX_FUNC_1,
379 .drv = GPIOMUX_DRV_8MA,
380 .pull = GPIOMUX_PULL_UP,
381};
382
383static struct gpiomux_setting sdcc2_suspend_cfg = {
384 .func = GPIOMUX_FUNC_1,
385 .drv = GPIOMUX_DRV_2MA,
386 .pull = GPIOMUX_PULL_DOWN,
387};
388
389static struct msm_gpiomux_config msm9615_sdcc2_configs[] __initdata = {
390 {
391 /* SDC2_DATA_0 */
392 .gpio = 25,
393 .settings = {
394 [GPIOMUX_ACTIVE] = &sdcc2_cmd_data_0_3_actv_cfg,
395 [GPIOMUX_SUSPENDED] = &sdcc2_suspend_cfg,
396 },
397 },
398 {
399 /* SDC2_DATA_1 */
400 .gpio = 26,
401 .settings = {
402 [GPIOMUX_ACTIVE] = &sdcc2_cmd_data_0_3_actv_cfg,
403 [GPIOMUX_SUSPENDED] = &sdcc2_suspend_cfg,
404 },
405 },
406 {
407 /* SDC2_DATA_2 */
408 .gpio = 27,
409 .settings = {
410 [GPIOMUX_ACTIVE] = &sdcc2_cmd_data_0_3_actv_cfg,
411 [GPIOMUX_SUSPENDED] = &sdcc2_suspend_cfg,
412 },
413 },
414 {
415 /* SDC2_DATA_3 */
416 .gpio = 28,
417 .settings = {
418 [GPIOMUX_ACTIVE] = &sdcc2_cmd_data_0_3_actv_cfg,
419 [GPIOMUX_SUSPENDED] = &sdcc2_suspend_cfg,
420 },
421 },
422 {
423 /* SDC2_CMD GSBI1 */
424 .gpio = 29,
425 .settings = {
426 [GPIOMUX_ACTIVE] = &sdcc2_cmd_data_0_3_actv_cfg,
427 [GPIOMUX_SUSPENDED] = &sdcc2_suspend_cfg,
428 },
429 },
430 {
431 /* SDC2_CLK GSBI1 */
432 .gpio = 30,
433 .settings = {
434 [GPIOMUX_ACTIVE] = &sdcc2_clk_actv_cfg,
435 [GPIOMUX_SUSPENDED] = &sdcc2_suspend_cfg,
436 },
437 },
438};
439
440static struct msm_mmc_gpio sdc2_gpio_cfg[] = {
441 {25, "sdc2_dat_0"},
442 {26, "sdc2_dat_1"},
443 {27, "sdc2_dat_2"},
444 {28, "sdc2_dat_3"},
445 {29, "sdc2_cmd"},
446 {30, "sdc2_clk"},
447};
448
449static struct msm_mmc_gpio_data mmc_gpio_data[MAX_SDCC_CONTROLLER] = {
450 [SDCC2] = {
451 .gpio = sdc2_gpio_cfg,
452 .size = ARRAY_SIZE(sdc2_gpio_cfg),
453 },
454};
455#else
456static struct msm_gpiomux_config msm9615_sdcc2_configs[0];
457#endif
458
459static struct msm_mmc_pin_data mmc_slot_pin_data[MAX_SDCC_CONTROLLER] = {
Krishna Kondadd794462011-10-01 00:19:29 -0700460#ifdef CONFIG_MMC_MSM_SDC1_SUPPORT
461 [SDCC1] = {
462 .is_gpio = 0,
463 .pad_data = &mmc_pad_data[SDCC1],
464 },
465#endif
Krishna Konda71aef182011-10-01 02:27:51 -0700466#ifdef CONFIG_MMC_MSM_SDC2_SUPPORT
467 [SDCC2] = {
468 .is_gpio = 1,
469 .gpio_data = &mmc_gpio_data[SDCC2],
470 },
471#endif
Krishna Kondadd794462011-10-01 00:19:29 -0700472};
473
474#ifdef CONFIG_MMC_MSM_SDC1_SUPPORT
475static unsigned int sdc1_sup_clk_rates[] = {
476 400000, 24000000, 48000000
477};
478
479static struct mmc_platform_data sdc1_data = {
480 .ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29,
481 .mmc_bus_width = MMC_CAP_4_BIT_DATA,
482 .sup_clk_table = sdc1_sup_clk_rates,
483 .sup_clk_cnt = ARRAY_SIZE(sdc1_sup_clk_rates),
484 .sdcc_v4_sup = true,
485 .pin_data = &mmc_slot_pin_data[SDCC1],
486};
487static struct mmc_platform_data *msm9615_sdc1_pdata = &sdc1_data;
488#else
489static struct mmc_platform_data *msm9615_sdc1_pdata;
490#endif
491
Krishna Konda71aef182011-10-01 02:27:51 -0700492#ifdef CONFIG_MMC_MSM_SDC2_SUPPORT
493static unsigned int sdc2_sup_clk_rates[] = {
494 400000, 24000000, 48000000
495};
496
497static struct mmc_platform_data sdc2_data = {
498 .ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29,
499 .mmc_bus_width = MMC_CAP_4_BIT_DATA,
500 .sup_clk_table = sdc2_sup_clk_rates,
501 .sup_clk_cnt = ARRAY_SIZE(sdc2_sup_clk_rates),
502 .sdcc_v4_sup = true,
503 .pin_data = &mmc_slot_pin_data[SDCC2],
504};
505static struct mmc_platform_data *msm9615_sdc2_pdata = &sdc2_data;
506#else
507static struct mmc_platform_data *msm9615_sdc2_pdata;
508#endif
509
Krishna Kondadd794462011-10-01 00:19:29 -0700510static void __init msm9615_init_mmc(void)
511{
512 int ret;
513
514 if (msm9615_sdc1_pdata) {
515 ret = gpio_request(GPIO_SDCARD_PWR_EN, "SDCARD_PWR_EN");
516
517 if (ret) {
518 pr_err("%s: sdcc1: Error requesting GPIO "
519 "SDCARD_PWR_EN:%d\n", __func__, ret);
520 } else {
521 ret = gpio_direction_output(GPIO_SDCARD_PWR_EN, 1);
522 if (ret) {
523 pr_err("%s: sdcc1: Error setting o/p direction"
524 " for GPIO SDCARD_PWR_EN:%d\n",
525 __func__, ret);
526 gpio_free(GPIO_SDCARD_PWR_EN);
527 } else {
528 msm_add_sdcc(1, msm9615_sdc1_pdata);
529 }
530 }
531 }
Krishna Konda71aef182011-10-01 02:27:51 -0700532
533 if (msm9615_sdc2_pdata) {
534 msm_gpiomux_install(msm9615_sdcc2_configs,
535 ARRAY_SIZE(msm9615_sdcc2_configs));
536
537 /* SDC2: External card slot */
538 msm_add_sdcc(2, msm9615_sdc2_pdata);
539 }
Krishna Kondadd794462011-10-01 00:19:29 -0700540}
541#else
542static void __init msm9615_init_mmc(void) { }
543#endif
Maheshkumar Sivasubramanian4923db22011-09-15 09:28:15 -0600544static struct msm_cpuidle_state msm_cstates[] __initdata = {
545 {0, 0, "C0", "WFI",
546 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
547
548 {0, 1, "C1", "STANDALONE_POWER_COLLAPSE",
549 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
550
551 {0, 2, "C2", "POWER_COLLAPSE",
552 MSM_PM_SLEEP_MODE_POWER_COLLAPSE},
553};
554static struct msm_pm_platform_data msm_pm_data[MSM_PM_SLEEP_MODE_NR] = {
555 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
556 .idle_supported = 1,
557 .suspend_supported = 1,
558 .idle_enabled = 0,
559 .suspend_enabled = 0,
560 },
561 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
562 .idle_supported = 1,
563 .suspend_supported = 1,
564 .idle_enabled = 0,
565 .suspend_enabled = 0,
566 },
567 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
568 .idle_supported = 1,
569 .suspend_supported = 1,
570 .idle_enabled = 1,
571 .suspend_enabled = 1,
572 },
573};
Krishna Kondadd794462011-10-01 00:19:29 -0700574
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -0700575static int __init gpiomux_init(void)
576{
577 int rc;
578
579 rc = msm_gpiomux_init(NR_GPIO_IRQS);
580 if (rc) {
581 pr_err(KERN_ERR "msm_gpiomux_init failed %d\n", rc);
582 return rc;
583 }
Rohit Vaswani09666872011-08-23 17:41:54 -0700584 msm_gpiomux_install(msm9615_gsbi_configs,
585 ARRAY_SIZE(msm9615_gsbi_configs));
586
Rohit Vaswanif688fa62011-10-13 18:13:10 -0700587 msm_gpiomux_install(msm9615_ps_hold_config,
588 ARRAY_SIZE(msm9615_ps_hold_config));
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -0700589 return 0;
590}
591
Harini Jayaraman738c9312011-09-08 15:22:38 -0600592static struct msm_spi_platform_data msm9615_qup_spi_gsbi3_pdata = {
593 .max_clock_speed = 24000000,
594};
595
Harini Jayaramaneba52672011-09-08 15:13:00 -0600596static struct msm_i2c_platform_data msm9615_i2c_qup_gsbi5_pdata = {
597 .clk_freq = 100000,
598 .src_clk_rate = 24000000,
599};
600
Amit Blay5e4ec192011-10-20 09:16:54 +0200601static struct msm_otg_platform_data msm_otg_pdata = {
602 .mode = USB_PERIPHERAL,
603 .otg_control = OTG_NO_CONTROL,
604 .phy_type = SNPS_28NM_INTEGRATED_PHY,
605 .pclk_src_name = "dfab_usb_hs_clk",
606};
607
608static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum)
609{
610 return 0;
611}
612
613static struct android_usb_platform_data android_usb_pdata = {
614 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
615};
616
617static struct platform_device android_usb_device = {
618 .name = "android_usb",
619 .id = -1,
620 .dev = {
621 .platform_data = &android_usb_pdata,
622 },
623};
624
625static struct platform_device *common_devices[] = {
626 &msm9615_device_dmov,
627 &msm_device_smd,
628 &msm_device_otg,
629 &msm_device_gadget_peripheral,
630 &android_usb_device,
631 &msm9615_device_uart_gsbi4,
632 &msm9615_device_ssbi_pmic1,
633 &msm9615_device_qup_i2c_gsbi5,
634 &msm9615_device_qup_spi_gsbi3,
635 &msm_device_sps,
636 &msm9615_device_tsens,
637 &msm_device_nand,
638 &msm_rpm_device,
639#ifdef CONFIG_HW_RANDOM_MSM
640 &msm_device_rng,
641#endif
642
643#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
644 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
645 &qcrypto_device,
646#endif
647
648#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
649 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
650 &qcedev_device,
651#endif
652};
653
Harini Jayaramaneba52672011-09-08 15:13:00 -0600654static void __init msm9615_i2c_init(void)
655{
656 msm9615_device_qup_i2c_gsbi5.dev.platform_data =
657 &msm9615_i2c_qup_gsbi5_pdata;
658}
659
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -0700660static void __init msm9615_common_init(void)
661{
662 msm9615_device_init();
663 gpiomux_init();
Harini Jayaramaneba52672011-09-08 15:13:00 -0600664 msm9615_i2c_init();
David Collins00b31e62011-08-31 20:00:10 -0700665 regulator_suppress_info_printing();
David Collinsbea297a2011-09-28 13:11:14 -0700666 platform_device_register(&msm9615_device_rpm_regulator);
Harini Jayaraman738c9312011-09-08 15:22:38 -0600667 msm9615_device_qup_spi_gsbi3.dev.platform_data =
668 &msm9615_qup_spi_gsbi3_pdata;
Kenneth Heitkeaf3d3cf2011-09-08 11:45:31 -0700669 msm9615_device_ssbi_pmic1.dev.platform_data =
670 &msm9615_ssbi_pm8018_pdata;
David Collins00b31e62011-08-31 20:00:10 -0700671 pm8018_platform_data.num_regulators = msm_pm8018_regulator_pdata_len;
Amit Blay5e4ec192011-10-20 09:16:54 +0200672
673 msm_device_otg.dev.platform_data = &msm_otg_pdata;
674 msm_device_gadget_peripheral.dev.parent = &msm_device_otg.dev;
Rohit Vaswani09666872011-08-23 17:41:54 -0700675 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Krishna Kondadd794462011-10-01 00:19:29 -0700676
677 msm9615_init_mmc();
Maheshkumar Sivasubramanian4923db22011-09-15 09:28:15 -0600678 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
679 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
680 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
681 msm_pm_data);
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -0700682}
683
684static void __init msm9615_cdp_init(void)
685{
686 msm9615_common_init();
687}
688
689static void __init msm9615_mtp_init(void)
690{
691 msm9615_common_init();
692}
693
694MACHINE_START(MSM9615_CDP, "QCT MSM9615 CDP")
695 .map_io = msm9615_map_io,
696 .init_irq = msm9615_init_irq,
697 .timer = &msm_timer,
698 .init_machine = msm9615_cdp_init,
699MACHINE_END
700
701MACHINE_START(MSM9615_MTP, "QCT MSM9615 MTP")
702 .map_io = msm9615_map_io,
703 .init_irq = msm9615_init_irq,
704 .timer = &msm_timer,
705 .init_machine = msm9615_mtp_init,
706MACHINE_END