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