blob: 87ff55928d5a50ce974bc09ce2062092d5446503 [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>
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -070025#include "timer.h"
26#include "devices.h"
David Collinsfb88c432011-08-25 15:12:47 -070027#include "board-9615.h"
Maheshkumar Sivasubramanian4923db22011-09-15 09:28:15 -060028#include "cpuidle.h"
29#include "pm.h"
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -070030
Rohit Vaswani09666872011-08-23 17:41:54 -070031static struct platform_device *common_devices[] = {
Jeff Ohlsteind19bf442011-09-09 12:48:18 -070032 &msm9615_device_dmov,
Jeff Hugo56b933a2011-09-28 14:42:05 -060033 &msm_device_smd,
Rohit Vaswani09666872011-08-23 17:41:54 -070034 &msm9615_device_uart_gsbi4,
Kenneth Heitkeaf3d3cf2011-09-08 11:45:31 -070035 &msm9615_device_ssbi_pmic1,
Harini Jayaramaneba52672011-09-08 15:13:00 -060036 &msm9615_device_qup_i2c_gsbi5,
Harini Jayaraman738c9312011-09-08 15:22:38 -060037 &msm9615_device_qup_spi_gsbi3,
Yan He092b7272011-09-21 15:25:03 -070038 &msm_device_sps,
Siddartha Mohanadoss5d49cec2011-09-21 10:26:15 -070039 &msm9615_device_tsens,
Sahitya Tummala38295432011-09-29 10:08:45 +053040 &msm_device_nand,
Praveen Chidambaramab3b1c42011-08-25 08:44:05 -060041 &msm_rpm_device,
Ramesh Masavarapufa679d92011-10-13 23:42:59 -070042
43#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
44 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
45 &qcrypto_device,
46#endif
47
48#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
49 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
50 &qcedev_device,
51#endif
Rohit Vaswani09666872011-08-23 17:41:54 -070052};
53
David Collinsfb88c432011-08-25 15:12:47 -070054static struct pm8xxx_irq_platform_data pm8xxx_irq_pdata __devinitdata = {
55 .irq_base = PM8018_IRQ_BASE,
56 .devirq = MSM_GPIO_TO_INT(87),
57 .irq_trigger_flag = IRQF_TRIGGER_LOW,
58};
59
60static struct pm8xxx_gpio_platform_data pm8xxx_gpio_pdata __devinitdata = {
61 .gpio_base = PM8018_GPIO_PM_TO_SYS(1),
62};
63
64static struct pm8xxx_mpp_platform_data pm8xxx_mpp_pdata __devinitdata = {
65 .mpp_base = PM8018_MPP_PM_TO_SYS(1),
66};
67
68static struct pm8xxx_rtc_platform_data pm8xxx_rtc_pdata __devinitdata = {
69 .rtc_write_enable = false,
70};
71
72static struct pm8xxx_pwrkey_platform_data pm8xxx_pwrkey_pdata = {
73 .pull_up = 1,
74 .kpd_trigger_delay_us = 970,
75 .wakeup = 1,
76};
77
78static struct pm8xxx_misc_platform_data pm8xxx_misc_pdata = {
79 .priority = 0,
80};
81
82static struct pm8018_platform_data pm8018_platform_data __devinitdata = {
83 .irq_pdata = &pm8xxx_irq_pdata,
84 .gpio_pdata = &pm8xxx_gpio_pdata,
85 .mpp_pdata = &pm8xxx_mpp_pdata,
86 .rtc_pdata = &pm8xxx_rtc_pdata,
87 .pwrkey_pdata = &pm8xxx_pwrkey_pdata,
88 .misc_pdata = &pm8xxx_misc_pdata,
David Collins00b31e62011-08-31 20:00:10 -070089 .regulator_pdatas = msm_pm8018_regulator_pdata,
David Collinsfb88c432011-08-25 15:12:47 -070090};
91
Kenneth Heitkeaf3d3cf2011-09-08 11:45:31 -070092static struct msm_ssbi_platform_data msm9615_ssbi_pm8018_pdata __devinitdata = {
93 .controller_type = MSM_SBI_CTRL_PMIC_ARBITER,
94 .slave = {
David Collinsfb88c432011-08-25 15:12:47 -070095 .name = PM8018_CORE_DEV_NAME,
96 .platform_data = &pm8018_platform_data,
Kenneth Heitkeaf3d3cf2011-09-08 11:45:31 -070097 },
98};
99
Rohit Vaswanif688fa62011-10-13 18:13:10 -0700100static struct gpiomux_setting ps_hold = {
101 .func = GPIOMUX_FUNC_1,
102 .drv = GPIOMUX_DRV_8MA,
103 .pull = GPIOMUX_PULL_NONE,
104};
105
Rohit Vaswani09666872011-08-23 17:41:54 -0700106static struct gpiomux_setting gsbi4 = {
107 .func = GPIOMUX_FUNC_1,
108 .drv = GPIOMUX_DRV_8MA,
109 .pull = GPIOMUX_PULL_NONE,
110};
111
Harini Jayaramaneba52672011-09-08 15:13:00 -0600112static struct gpiomux_setting gsbi5 = {
113 .func = GPIOMUX_FUNC_1,
114 .drv = GPIOMUX_DRV_8MA,
115 .pull = GPIOMUX_PULL_NONE,
116};
117
Harini Jayaraman738c9312011-09-08 15:22:38 -0600118static struct gpiomux_setting gsbi3 = {
119 .func = GPIOMUX_FUNC_1,
120 .drv = GPIOMUX_DRV_8MA,
121 .pull = GPIOMUX_PULL_NONE,
122};
123
124static struct gpiomux_setting gsbi3_cs1_config = {
125 .func = GPIOMUX_FUNC_4,
126 .drv = GPIOMUX_DRV_8MA,
127 .pull = GPIOMUX_PULL_NONE,
128};
129
Rohit Vaswanif688fa62011-10-13 18:13:10 -0700130struct msm_gpiomux_config msm9615_ps_hold_config[] __initdata = {
131 {
132 .gpio = 83,
133 .settings = {
134 [GPIOMUX_SUSPENDED] = &ps_hold,
135 },
136 },
137};
138
Rohit Vaswani09666872011-08-23 17:41:54 -0700139struct msm_gpiomux_config msm9615_gsbi_configs[] __initdata = {
140 {
Harini Jayaraman738c9312011-09-08 15:22:38 -0600141 .gpio = 8, /* GSBI3 QUP SPI_CLK */
142 .settings = {
143 [GPIOMUX_SUSPENDED] = &gsbi3,
144 },
145 },
146 {
147 .gpio = 9, /* GSBI3 QUP SPI_CS_N */
148 .settings = {
149 [GPIOMUX_SUSPENDED] = &gsbi3,
150 },
151 },
152 {
153 .gpio = 10, /* GSBI3 QUP SPI_DATA_MISO */
154 .settings = {
155 [GPIOMUX_SUSPENDED] = &gsbi3,
156 },
157 },
158 {
159 .gpio = 11, /* GSBI3 QUP SPI_DATA_MOSI */
160 .settings = {
161 [GPIOMUX_SUSPENDED] = &gsbi3,
162 },
163 },
164 {
Rohit Vaswani09666872011-08-23 17:41:54 -0700165 .gpio = 12, /* GSBI4 UART */
166 .settings = {
167 [GPIOMUX_SUSPENDED] = &gsbi4,
168 },
169 },
170 {
171 .gpio = 13, /* GSBI4 UART */
172 .settings = {
173 [GPIOMUX_SUSPENDED] = &gsbi4,
174 },
175 },
176 {
177 .gpio = 14, /* GSBI4 UART */
178 .settings = {
179 [GPIOMUX_SUSPENDED] = &gsbi4,
180 },
181 },
182 {
183 .gpio = 15, /* GSBI4 UART */
184 .settings = {
185 [GPIOMUX_SUSPENDED] = &gsbi4,
186 },
187 },
Harini Jayaramaneba52672011-09-08 15:13:00 -0600188 {
189 .gpio = 16, /* GSBI5 I2C QUP SCL */
190 .settings = {
191 [GPIOMUX_SUSPENDED] = &gsbi5,
192 },
193 },
194 {
195 .gpio = 17, /* GSBI5 I2C QUP SDA */
196 .settings = {
197 [GPIOMUX_SUSPENDED] = &gsbi5,
198 },
199 },
Harini Jayaraman738c9312011-09-08 15:22:38 -0600200 {
201 /* GPIO 19 can be used for I2C/UART on GSBI5 */
202 .gpio = 19, /* GSBI3 QUP SPI_CS_1 */
203 .settings = {
204 [GPIOMUX_SUSPENDED] = &gsbi3_cs1_config,
205 },
206 },
Rohit Vaswani09666872011-08-23 17:41:54 -0700207};
208
Ramesh Masavarapufa679d92011-10-13 23:42:59 -0700209#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
210 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
211 defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
212 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
213
214#define QCE_SIZE 0x10000
215#define QCE_0_BASE 0x18500000
216
217#define QCE_HW_KEY_SUPPORT 0
218#define QCE_SHA_HMAC_SUPPORT 1
219#define QCE_SHARE_CE_RESOURCE 1
220#define QCE_CE_SHARED 0
221
222static struct resource qcrypto_resources[] = {
223 [0] = {
224 .start = QCE_0_BASE,
225 .end = QCE_0_BASE + QCE_SIZE - 1,
226 .flags = IORESOURCE_MEM,
227 },
228 [1] = {
229 .name = "crypto_channels",
230 .start = DMOV_CE_IN_CHAN,
231 .end = DMOV_CE_OUT_CHAN,
232 .flags = IORESOURCE_DMA,
233 },
234 [2] = {
235 .name = "crypto_crci_in",
236 .start = DMOV_CE_IN_CRCI,
237 .end = DMOV_CE_IN_CRCI,
238 .flags = IORESOURCE_DMA,
239 },
240 [3] = {
241 .name = "crypto_crci_out",
242 .start = DMOV_CE_OUT_CRCI,
243 .end = DMOV_CE_OUT_CRCI,
244 .flags = IORESOURCE_DMA,
245 },
246};
247
248static struct resource qcedev_resources[] = {
249 [0] = {
250 .start = QCE_0_BASE,
251 .end = QCE_0_BASE + QCE_SIZE - 1,
252 .flags = IORESOURCE_MEM,
253 },
254 [1] = {
255 .name = "crypto_channels",
256 .start = DMOV_CE_IN_CHAN,
257 .end = DMOV_CE_OUT_CHAN,
258 .flags = IORESOURCE_DMA,
259 },
260 [2] = {
261 .name = "crypto_crci_in",
262 .start = DMOV_CE_IN_CRCI,
263 .end = DMOV_CE_IN_CRCI,
264 .flags = IORESOURCE_DMA,
265 },
266 [3] = {
267 .name = "crypto_crci_out",
268 .start = DMOV_CE_OUT_CRCI,
269 .end = DMOV_CE_OUT_CRCI,
270 .flags = IORESOURCE_DMA,
271 },
272};
273
274#endif
275
276#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
277 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
278
279static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
280 .ce_shared = QCE_CE_SHARED,
281 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
282 .hw_key_support = QCE_HW_KEY_SUPPORT,
283 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
284};
285
286static struct platform_device qcrypto_device = {
287 .name = "qcrypto",
288 .id = 0,
289 .num_resources = ARRAY_SIZE(qcrypto_resources),
290 .resource = qcrypto_resources,
291 .dev = {
292 .coherent_dma_mask = DMA_BIT_MASK(32),
293 .platform_data = &qcrypto_ce_hw_suppport,
294 },
295};
296#endif
297
298#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
299 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
300
301static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
302 .ce_shared = QCE_CE_SHARED,
303 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
304 .hw_key_support = QCE_HW_KEY_SUPPORT,
305 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
306};
307
308static struct platform_device qcedev_device = {
309 .name = "qce",
310 .id = 0,
311 .num_resources = ARRAY_SIZE(qcedev_resources),
312 .resource = qcedev_resources,
313 .dev = {
314 .coherent_dma_mask = DMA_BIT_MASK(32),
315 .platform_data = &qcedev_ce_hw_suppport,
316 },
317};
318#endif
319
Krishna Kondadd794462011-10-01 00:19:29 -0700320#if (defined(CONFIG_MMC_MSM_SDC1_SUPPORT)\
321 || defined(CONFIG_MMC_MSM_SDC2_SUPPORT))
322
323#define GPIO_SDCARD_PWR_EN 18
324
325/* MDM9x15 have 2 SDCC controllers */
326enum sdcc_controllers {
327 SDCC1,
328 SDCC2,
329 MAX_SDCC_CONTROLLER
330};
331
332#ifdef CONFIG_MMC_MSM_SDC1_SUPPORT
333/* SDC1 pad data */
334static struct msm_mmc_pad_drv sdc1_pad_drv_on_cfg[] = {
335 {TLMM_HDRV_SDC1_CLK, GPIO_CFG_16MA},
336 {TLMM_HDRV_SDC1_CMD, GPIO_CFG_10MA},
337 {TLMM_HDRV_SDC1_DATA, GPIO_CFG_10MA}
338};
339
340static struct msm_mmc_pad_drv sdc1_pad_drv_off_cfg[] = {
341 {TLMM_HDRV_SDC1_CLK, GPIO_CFG_2MA},
342 {TLMM_HDRV_SDC1_CMD, GPIO_CFG_2MA},
343 {TLMM_HDRV_SDC1_DATA, GPIO_CFG_2MA}
344};
345
346static struct msm_mmc_pad_pull sdc1_pad_pull_on_cfg[] = {
347 {TLMM_PULL_SDC1_CLK, GPIO_CFG_NO_PULL},
348 {TLMM_PULL_SDC1_CMD, GPIO_CFG_PULL_UP},
349 {TLMM_PULL_SDC1_DATA, GPIO_CFG_PULL_UP}
350};
351
352static struct msm_mmc_pad_pull sdc1_pad_pull_off_cfg[] = {
353 {TLMM_PULL_SDC1_CLK, GPIO_CFG_NO_PULL},
354 {TLMM_PULL_SDC1_CMD, GPIO_CFG_PULL_DOWN},
355 {TLMM_PULL_SDC1_DATA, GPIO_CFG_PULL_DOWN}
356};
357
358static struct msm_mmc_pad_pull_data mmc_pad_pull_data[MAX_SDCC_CONTROLLER] = {
359 [SDCC1] = {
360 .on = sdc1_pad_pull_on_cfg,
361 .off = sdc1_pad_pull_off_cfg,
362 .size = ARRAY_SIZE(sdc1_pad_pull_on_cfg)
363 },
364};
365
366static struct msm_mmc_pad_drv_data mmc_pad_drv_data[MAX_SDCC_CONTROLLER] = {
367 [SDCC1] = {
368 .on = sdc1_pad_drv_on_cfg,
369 .off = sdc1_pad_drv_off_cfg,
370 .size = ARRAY_SIZE(sdc1_pad_drv_on_cfg)
371 },
372};
373
374static struct msm_mmc_pad_data mmc_pad_data[MAX_SDCC_CONTROLLER] = {
375 [SDCC1] = {
376 .pull = &mmc_pad_pull_data[SDCC1],
377 .drv = &mmc_pad_drv_data[SDCC1]
378 },
379};
380#endif
381
Krishna Konda71aef182011-10-01 02:27:51 -0700382#ifdef CONFIG_MMC_MSM_SDC2_SUPPORT
383static struct gpiomux_setting sdcc2_clk_actv_cfg = {
384 .func = GPIOMUX_FUNC_1,
385 .drv = GPIOMUX_DRV_16MA,
386 .pull = GPIOMUX_PULL_NONE,
387};
388
389static struct gpiomux_setting sdcc2_cmd_data_0_3_actv_cfg = {
390 .func = GPIOMUX_FUNC_1,
391 .drv = GPIOMUX_DRV_8MA,
392 .pull = GPIOMUX_PULL_UP,
393};
394
395static struct gpiomux_setting sdcc2_suspend_cfg = {
396 .func = GPIOMUX_FUNC_1,
397 .drv = GPIOMUX_DRV_2MA,
398 .pull = GPIOMUX_PULL_DOWN,
399};
400
401static struct msm_gpiomux_config msm9615_sdcc2_configs[] __initdata = {
402 {
403 /* SDC2_DATA_0 */
404 .gpio = 25,
405 .settings = {
406 [GPIOMUX_ACTIVE] = &sdcc2_cmd_data_0_3_actv_cfg,
407 [GPIOMUX_SUSPENDED] = &sdcc2_suspend_cfg,
408 },
409 },
410 {
411 /* SDC2_DATA_1 */
412 .gpio = 26,
413 .settings = {
414 [GPIOMUX_ACTIVE] = &sdcc2_cmd_data_0_3_actv_cfg,
415 [GPIOMUX_SUSPENDED] = &sdcc2_suspend_cfg,
416 },
417 },
418 {
419 /* SDC2_DATA_2 */
420 .gpio = 27,
421 .settings = {
422 [GPIOMUX_ACTIVE] = &sdcc2_cmd_data_0_3_actv_cfg,
423 [GPIOMUX_SUSPENDED] = &sdcc2_suspend_cfg,
424 },
425 },
426 {
427 /* SDC2_DATA_3 */
428 .gpio = 28,
429 .settings = {
430 [GPIOMUX_ACTIVE] = &sdcc2_cmd_data_0_3_actv_cfg,
431 [GPIOMUX_SUSPENDED] = &sdcc2_suspend_cfg,
432 },
433 },
434 {
435 /* SDC2_CMD GSBI1 */
436 .gpio = 29,
437 .settings = {
438 [GPIOMUX_ACTIVE] = &sdcc2_cmd_data_0_3_actv_cfg,
439 [GPIOMUX_SUSPENDED] = &sdcc2_suspend_cfg,
440 },
441 },
442 {
443 /* SDC2_CLK GSBI1 */
444 .gpio = 30,
445 .settings = {
446 [GPIOMUX_ACTIVE] = &sdcc2_clk_actv_cfg,
447 [GPIOMUX_SUSPENDED] = &sdcc2_suspend_cfg,
448 },
449 },
450};
451
452static struct msm_mmc_gpio sdc2_gpio_cfg[] = {
453 {25, "sdc2_dat_0"},
454 {26, "sdc2_dat_1"},
455 {27, "sdc2_dat_2"},
456 {28, "sdc2_dat_3"},
457 {29, "sdc2_cmd"},
458 {30, "sdc2_clk"},
459};
460
461static struct msm_mmc_gpio_data mmc_gpio_data[MAX_SDCC_CONTROLLER] = {
462 [SDCC2] = {
463 .gpio = sdc2_gpio_cfg,
464 .size = ARRAY_SIZE(sdc2_gpio_cfg),
465 },
466};
467#else
468static struct msm_gpiomux_config msm9615_sdcc2_configs[0];
469#endif
470
471static struct msm_mmc_pin_data mmc_slot_pin_data[MAX_SDCC_CONTROLLER] = {
Krishna Kondadd794462011-10-01 00:19:29 -0700472#ifdef CONFIG_MMC_MSM_SDC1_SUPPORT
473 [SDCC1] = {
474 .is_gpio = 0,
475 .pad_data = &mmc_pad_data[SDCC1],
476 },
477#endif
Krishna Konda71aef182011-10-01 02:27:51 -0700478#ifdef CONFIG_MMC_MSM_SDC2_SUPPORT
479 [SDCC2] = {
480 .is_gpio = 1,
481 .gpio_data = &mmc_gpio_data[SDCC2],
482 },
483#endif
Krishna Kondadd794462011-10-01 00:19:29 -0700484};
485
486#ifdef CONFIG_MMC_MSM_SDC1_SUPPORT
487static unsigned int sdc1_sup_clk_rates[] = {
488 400000, 24000000, 48000000
489};
490
491static struct mmc_platform_data sdc1_data = {
492 .ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29,
493 .mmc_bus_width = MMC_CAP_4_BIT_DATA,
494 .sup_clk_table = sdc1_sup_clk_rates,
495 .sup_clk_cnt = ARRAY_SIZE(sdc1_sup_clk_rates),
496 .sdcc_v4_sup = true,
497 .pin_data = &mmc_slot_pin_data[SDCC1],
498};
499static struct mmc_platform_data *msm9615_sdc1_pdata = &sdc1_data;
500#else
501static struct mmc_platform_data *msm9615_sdc1_pdata;
502#endif
503
Krishna Konda71aef182011-10-01 02:27:51 -0700504#ifdef CONFIG_MMC_MSM_SDC2_SUPPORT
505static unsigned int sdc2_sup_clk_rates[] = {
506 400000, 24000000, 48000000
507};
508
509static struct mmc_platform_data sdc2_data = {
510 .ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29,
511 .mmc_bus_width = MMC_CAP_4_BIT_DATA,
512 .sup_clk_table = sdc2_sup_clk_rates,
513 .sup_clk_cnt = ARRAY_SIZE(sdc2_sup_clk_rates),
514 .sdcc_v4_sup = true,
515 .pin_data = &mmc_slot_pin_data[SDCC2],
516};
517static struct mmc_platform_data *msm9615_sdc2_pdata = &sdc2_data;
518#else
519static struct mmc_platform_data *msm9615_sdc2_pdata;
520#endif
521
Krishna Kondadd794462011-10-01 00:19:29 -0700522static void __init msm9615_init_mmc(void)
523{
524 int ret;
525
526 if (msm9615_sdc1_pdata) {
527 ret = gpio_request(GPIO_SDCARD_PWR_EN, "SDCARD_PWR_EN");
528
529 if (ret) {
530 pr_err("%s: sdcc1: Error requesting GPIO "
531 "SDCARD_PWR_EN:%d\n", __func__, ret);
532 } else {
533 ret = gpio_direction_output(GPIO_SDCARD_PWR_EN, 1);
534 if (ret) {
535 pr_err("%s: sdcc1: Error setting o/p direction"
536 " for GPIO SDCARD_PWR_EN:%d\n",
537 __func__, ret);
538 gpio_free(GPIO_SDCARD_PWR_EN);
539 } else {
540 msm_add_sdcc(1, msm9615_sdc1_pdata);
541 }
542 }
543 }
Krishna Konda71aef182011-10-01 02:27:51 -0700544
545 if (msm9615_sdc2_pdata) {
546 msm_gpiomux_install(msm9615_sdcc2_configs,
547 ARRAY_SIZE(msm9615_sdcc2_configs));
548
549 /* SDC2: External card slot */
550 msm_add_sdcc(2, msm9615_sdc2_pdata);
551 }
Krishna Kondadd794462011-10-01 00:19:29 -0700552}
553#else
554static void __init msm9615_init_mmc(void) { }
555#endif
Maheshkumar Sivasubramanian4923db22011-09-15 09:28:15 -0600556static struct msm_cpuidle_state msm_cstates[] __initdata = {
557 {0, 0, "C0", "WFI",
558 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
559
560 {0, 1, "C1", "STANDALONE_POWER_COLLAPSE",
561 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
562
563 {0, 2, "C2", "POWER_COLLAPSE",
564 MSM_PM_SLEEP_MODE_POWER_COLLAPSE},
565};
566static struct msm_pm_platform_data msm_pm_data[MSM_PM_SLEEP_MODE_NR] = {
567 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
568 .idle_supported = 1,
569 .suspend_supported = 1,
570 .idle_enabled = 0,
571 .suspend_enabled = 0,
572 },
573 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
574 .idle_supported = 1,
575 .suspend_supported = 1,
576 .idle_enabled = 0,
577 .suspend_enabled = 0,
578 },
579 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
580 .idle_supported = 1,
581 .suspend_supported = 1,
582 .idle_enabled = 1,
583 .suspend_enabled = 1,
584 },
585};
Krishna Kondadd794462011-10-01 00:19:29 -0700586
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -0700587static int __init gpiomux_init(void)
588{
589 int rc;
590
591 rc = msm_gpiomux_init(NR_GPIO_IRQS);
592 if (rc) {
593 pr_err(KERN_ERR "msm_gpiomux_init failed %d\n", rc);
594 return rc;
595 }
Rohit Vaswani09666872011-08-23 17:41:54 -0700596 msm_gpiomux_install(msm9615_gsbi_configs,
597 ARRAY_SIZE(msm9615_gsbi_configs));
598
Rohit Vaswanif688fa62011-10-13 18:13:10 -0700599 msm_gpiomux_install(msm9615_ps_hold_config,
600 ARRAY_SIZE(msm9615_ps_hold_config));
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -0700601 return 0;
602}
603
Harini Jayaraman738c9312011-09-08 15:22:38 -0600604static struct msm_spi_platform_data msm9615_qup_spi_gsbi3_pdata = {
605 .max_clock_speed = 24000000,
606};
607
Harini Jayaramaneba52672011-09-08 15:13:00 -0600608static struct msm_i2c_platform_data msm9615_i2c_qup_gsbi5_pdata = {
609 .clk_freq = 100000,
610 .src_clk_rate = 24000000,
611};
612
613static void __init msm9615_i2c_init(void)
614{
615 msm9615_device_qup_i2c_gsbi5.dev.platform_data =
616 &msm9615_i2c_qup_gsbi5_pdata;
617}
618
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -0700619static void __init msm9615_common_init(void)
620{
621 msm9615_device_init();
622 gpiomux_init();
Harini Jayaramaneba52672011-09-08 15:13:00 -0600623 msm9615_i2c_init();
David Collins00b31e62011-08-31 20:00:10 -0700624 regulator_suppress_info_printing();
Harini Jayaraman738c9312011-09-08 15:22:38 -0600625 msm9615_device_qup_spi_gsbi3.dev.platform_data =
626 &msm9615_qup_spi_gsbi3_pdata;
Kenneth Heitkeaf3d3cf2011-09-08 11:45:31 -0700627 msm9615_device_ssbi_pmic1.dev.platform_data =
628 &msm9615_ssbi_pm8018_pdata;
David Collins00b31e62011-08-31 20:00:10 -0700629 pm8018_platform_data.num_regulators = msm_pm8018_regulator_pdata_len;
Rohit Vaswani09666872011-08-23 17:41:54 -0700630 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Krishna Kondadd794462011-10-01 00:19:29 -0700631
632 msm9615_init_mmc();
Maheshkumar Sivasubramanian4923db22011-09-15 09:28:15 -0600633 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
634 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
635 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
636 msm_pm_data);
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -0700637}
638
639static void __init msm9615_cdp_init(void)
640{
641 msm9615_common_init();
642}
643
644static void __init msm9615_mtp_init(void)
645{
646 msm9615_common_init();
647}
648
649MACHINE_START(MSM9615_CDP, "QCT MSM9615 CDP")
650 .map_io = msm9615_map_io,
651 .init_irq = msm9615_init_irq,
652 .timer = &msm_timer,
653 .init_machine = msm9615_cdp_init,
654MACHINE_END
655
656MACHINE_START(MSM9615_MTP, "QCT MSM9615 MTP")
657 .map_io = msm9615_map_io,
658 .init_irq = msm9615_init_irq,
659 .timer = &msm_timer,
660 .init_machine = msm9615_mtp_init,
661MACHINE_END