blob: 5f0480b770577ba2e9f6cd8eeeb9f31ff2d94fd6 [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 Konda3b78ea72011-10-18 16:09:19 -0700238#define GPIO_SDC2_DAT1_WAKEUP 26
Krishna Kondadd794462011-10-01 00:19:29 -0700239
240/* MDM9x15 have 2 SDCC controllers */
241enum sdcc_controllers {
242 SDCC1,
243 SDCC2,
244 MAX_SDCC_CONTROLLER
245};
246
247#ifdef CONFIG_MMC_MSM_SDC1_SUPPORT
248/* SDC1 pad data */
249static struct msm_mmc_pad_drv sdc1_pad_drv_on_cfg[] = {
250 {TLMM_HDRV_SDC1_CLK, GPIO_CFG_16MA},
251 {TLMM_HDRV_SDC1_CMD, GPIO_CFG_10MA},
252 {TLMM_HDRV_SDC1_DATA, GPIO_CFG_10MA}
253};
254
255static struct msm_mmc_pad_drv sdc1_pad_drv_off_cfg[] = {
256 {TLMM_HDRV_SDC1_CLK, GPIO_CFG_2MA},
257 {TLMM_HDRV_SDC1_CMD, GPIO_CFG_2MA},
258 {TLMM_HDRV_SDC1_DATA, GPIO_CFG_2MA}
259};
260
261static struct msm_mmc_pad_pull sdc1_pad_pull_on_cfg[] = {
262 {TLMM_PULL_SDC1_CLK, GPIO_CFG_NO_PULL},
263 {TLMM_PULL_SDC1_CMD, GPIO_CFG_PULL_UP},
264 {TLMM_PULL_SDC1_DATA, GPIO_CFG_PULL_UP}
265};
266
267static struct msm_mmc_pad_pull sdc1_pad_pull_off_cfg[] = {
268 {TLMM_PULL_SDC1_CLK, GPIO_CFG_NO_PULL},
269 {TLMM_PULL_SDC1_CMD, GPIO_CFG_PULL_DOWN},
270 {TLMM_PULL_SDC1_DATA, GPIO_CFG_PULL_DOWN}
271};
272
273static struct msm_mmc_pad_pull_data mmc_pad_pull_data[MAX_SDCC_CONTROLLER] = {
274 [SDCC1] = {
275 .on = sdc1_pad_pull_on_cfg,
276 .off = sdc1_pad_pull_off_cfg,
277 .size = ARRAY_SIZE(sdc1_pad_pull_on_cfg)
278 },
279};
280
281static struct msm_mmc_pad_drv_data mmc_pad_drv_data[MAX_SDCC_CONTROLLER] = {
282 [SDCC1] = {
283 .on = sdc1_pad_drv_on_cfg,
284 .off = sdc1_pad_drv_off_cfg,
285 .size = ARRAY_SIZE(sdc1_pad_drv_on_cfg)
286 },
287};
288
289static struct msm_mmc_pad_data mmc_pad_data[MAX_SDCC_CONTROLLER] = {
290 [SDCC1] = {
291 .pull = &mmc_pad_pull_data[SDCC1],
292 .drv = &mmc_pad_drv_data[SDCC1]
293 },
294};
295#endif
296
Krishna Konda71aef182011-10-01 02:27:51 -0700297#ifdef CONFIG_MMC_MSM_SDC2_SUPPORT
298static struct gpiomux_setting sdcc2_clk_actv_cfg = {
299 .func = GPIOMUX_FUNC_1,
300 .drv = GPIOMUX_DRV_16MA,
301 .pull = GPIOMUX_PULL_NONE,
302};
303
304static struct gpiomux_setting sdcc2_cmd_data_0_3_actv_cfg = {
305 .func = GPIOMUX_FUNC_1,
306 .drv = GPIOMUX_DRV_8MA,
307 .pull = GPIOMUX_PULL_UP,
308};
309
310static struct gpiomux_setting sdcc2_suspend_cfg = {
311 .func = GPIOMUX_FUNC_1,
312 .drv = GPIOMUX_DRV_2MA,
313 .pull = GPIOMUX_PULL_DOWN,
314};
315
316static struct msm_gpiomux_config msm9615_sdcc2_configs[] __initdata = {
317 {
318 /* SDC2_DATA_0 */
319 .gpio = 25,
320 .settings = {
321 [GPIOMUX_ACTIVE] = &sdcc2_cmd_data_0_3_actv_cfg,
322 [GPIOMUX_SUSPENDED] = &sdcc2_suspend_cfg,
323 },
324 },
325 {
326 /* SDC2_DATA_1 */
327 .gpio = 26,
328 .settings = {
329 [GPIOMUX_ACTIVE] = &sdcc2_cmd_data_0_3_actv_cfg,
330 [GPIOMUX_SUSPENDED] = &sdcc2_suspend_cfg,
331 },
332 },
333 {
334 /* SDC2_DATA_2 */
335 .gpio = 27,
336 .settings = {
337 [GPIOMUX_ACTIVE] = &sdcc2_cmd_data_0_3_actv_cfg,
338 [GPIOMUX_SUSPENDED] = &sdcc2_suspend_cfg,
339 },
340 },
341 {
342 /* SDC2_DATA_3 */
343 .gpio = 28,
344 .settings = {
345 [GPIOMUX_ACTIVE] = &sdcc2_cmd_data_0_3_actv_cfg,
346 [GPIOMUX_SUSPENDED] = &sdcc2_suspend_cfg,
347 },
348 },
349 {
350 /* SDC2_CMD GSBI1 */
351 .gpio = 29,
352 .settings = {
353 [GPIOMUX_ACTIVE] = &sdcc2_cmd_data_0_3_actv_cfg,
354 [GPIOMUX_SUSPENDED] = &sdcc2_suspend_cfg,
355 },
356 },
357 {
358 /* SDC2_CLK GSBI1 */
359 .gpio = 30,
360 .settings = {
361 [GPIOMUX_ACTIVE] = &sdcc2_clk_actv_cfg,
362 [GPIOMUX_SUSPENDED] = &sdcc2_suspend_cfg,
363 },
364 },
365};
366
367static struct msm_mmc_gpio sdc2_gpio_cfg[] = {
368 {25, "sdc2_dat_0"},
369 {26, "sdc2_dat_1"},
370 {27, "sdc2_dat_2"},
371 {28, "sdc2_dat_3"},
372 {29, "sdc2_cmd"},
373 {30, "sdc2_clk"},
374};
375
376static struct msm_mmc_gpio_data mmc_gpio_data[MAX_SDCC_CONTROLLER] = {
377 [SDCC2] = {
378 .gpio = sdc2_gpio_cfg,
379 .size = ARRAY_SIZE(sdc2_gpio_cfg),
380 },
381};
382#else
383static struct msm_gpiomux_config msm9615_sdcc2_configs[0];
384#endif
385
386static struct msm_mmc_pin_data mmc_slot_pin_data[MAX_SDCC_CONTROLLER] = {
Krishna Kondadd794462011-10-01 00:19:29 -0700387#ifdef CONFIG_MMC_MSM_SDC1_SUPPORT
388 [SDCC1] = {
389 .is_gpio = 0,
390 .pad_data = &mmc_pad_data[SDCC1],
391 },
392#endif
Krishna Konda71aef182011-10-01 02:27:51 -0700393#ifdef CONFIG_MMC_MSM_SDC2_SUPPORT
394 [SDCC2] = {
395 .is_gpio = 1,
396 .gpio_data = &mmc_gpio_data[SDCC2],
397 },
398#endif
Krishna Kondadd794462011-10-01 00:19:29 -0700399};
400
401#ifdef CONFIG_MMC_MSM_SDC1_SUPPORT
402static unsigned int sdc1_sup_clk_rates[] = {
403 400000, 24000000, 48000000
404};
405
406static struct mmc_platform_data sdc1_data = {
407 .ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29,
408 .mmc_bus_width = MMC_CAP_4_BIT_DATA,
409 .sup_clk_table = sdc1_sup_clk_rates,
410 .sup_clk_cnt = ARRAY_SIZE(sdc1_sup_clk_rates),
Krishna Konda890b1d12011-10-18 16:05:37 -0700411 .pclk_src_dfab = 1,
Krishna Kondadd794462011-10-01 00:19:29 -0700412 .sdcc_v4_sup = true,
413 .pin_data = &mmc_slot_pin_data[SDCC1],
Krishna Konda7186bfe2011-10-17 15:36:54 -0700414#ifdef CONFIG_MMC_MSM_CARD_HW_DETECTION
415 .status_gpio = GPIO_SDC1_HW_DET,
416 .status_irq = MSM_GPIO_TO_INT(GPIO_SDC1_HW_DET),
417 .irq_flags = IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
418#endif
Krishna Kondadd794462011-10-01 00:19:29 -0700419};
420static struct mmc_platform_data *msm9615_sdc1_pdata = &sdc1_data;
421#else
422static struct mmc_platform_data *msm9615_sdc1_pdata;
423#endif
424
Krishna Konda71aef182011-10-01 02:27:51 -0700425#ifdef CONFIG_MMC_MSM_SDC2_SUPPORT
426static unsigned int sdc2_sup_clk_rates[] = {
427 400000, 24000000, 48000000
428};
429
430static struct mmc_platform_data sdc2_data = {
431 .ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29,
432 .mmc_bus_width = MMC_CAP_4_BIT_DATA,
433 .sup_clk_table = sdc2_sup_clk_rates,
434 .sup_clk_cnt = ARRAY_SIZE(sdc2_sup_clk_rates),
Krishna Konda890b1d12011-10-18 16:05:37 -0700435 .pclk_src_dfab = 1,
Krishna Konda71aef182011-10-01 02:27:51 -0700436 .sdcc_v4_sup = true,
437 .pin_data = &mmc_slot_pin_data[SDCC2],
Krishna Konda3b78ea72011-10-18 16:09:19 -0700438#ifdef CONFIG_MMC_MSM_SDIO_SUPPORT
439 .sdiowakeup_irq = MSM_GPIO_TO_INT(GPIO_SDC2_DAT1_WAKEUP),
440#endif
Krishna Konda71aef182011-10-01 02:27:51 -0700441};
442static struct mmc_platform_data *msm9615_sdc2_pdata = &sdc2_data;
443#else
444static struct mmc_platform_data *msm9615_sdc2_pdata;
445#endif
446
Krishna Kondadd794462011-10-01 00:19:29 -0700447static void __init msm9615_init_mmc(void)
448{
449 int ret;
450
451 if (msm9615_sdc1_pdata) {
452 ret = gpio_request(GPIO_SDCARD_PWR_EN, "SDCARD_PWR_EN");
453
454 if (ret) {
455 pr_err("%s: sdcc1: Error requesting GPIO "
456 "SDCARD_PWR_EN:%d\n", __func__, ret);
457 } else {
458 ret = gpio_direction_output(GPIO_SDCARD_PWR_EN, 1);
459 if (ret) {
460 pr_err("%s: sdcc1: Error setting o/p direction"
461 " for GPIO SDCARD_PWR_EN:%d\n",
462 __func__, ret);
463 gpio_free(GPIO_SDCARD_PWR_EN);
464 } else {
465 msm_add_sdcc(1, msm9615_sdc1_pdata);
466 }
467 }
468 }
Krishna Konda71aef182011-10-01 02:27:51 -0700469
470 if (msm9615_sdc2_pdata) {
471 msm_gpiomux_install(msm9615_sdcc2_configs,
472 ARRAY_SIZE(msm9615_sdcc2_configs));
473
474 /* SDC2: External card slot */
475 msm_add_sdcc(2, msm9615_sdc2_pdata);
476 }
Krishna Kondadd794462011-10-01 00:19:29 -0700477}
478#else
479static void __init msm9615_init_mmc(void) { }
480#endif
Maheshkumar Sivasubramanian4923db22011-09-15 09:28:15 -0600481static struct msm_cpuidle_state msm_cstates[] __initdata = {
482 {0, 0, "C0", "WFI",
483 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
484
485 {0, 1, "C1", "STANDALONE_POWER_COLLAPSE",
486 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
487
488 {0, 2, "C2", "POWER_COLLAPSE",
489 MSM_PM_SLEEP_MODE_POWER_COLLAPSE},
490};
491static struct msm_pm_platform_data msm_pm_data[MSM_PM_SLEEP_MODE_NR] = {
492 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
493 .idle_supported = 1,
494 .suspend_supported = 1,
495 .idle_enabled = 0,
496 .suspend_enabled = 0,
497 },
498 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
499 .idle_supported = 1,
500 .suspend_supported = 1,
501 .idle_enabled = 0,
502 .suspend_enabled = 0,
503 },
504 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
505 .idle_supported = 1,
506 .suspend_supported = 1,
507 .idle_enabled = 1,
508 .suspend_enabled = 1,
509 },
510};
Krishna Kondadd794462011-10-01 00:19:29 -0700511
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -0700512static int __init gpiomux_init(void)
513{
514 int rc;
515
516 rc = msm_gpiomux_init(NR_GPIO_IRQS);
517 if (rc) {
518 pr_err(KERN_ERR "msm_gpiomux_init failed %d\n", rc);
519 return rc;
520 }
Rohit Vaswani09666872011-08-23 17:41:54 -0700521 msm_gpiomux_install(msm9615_gsbi_configs,
522 ARRAY_SIZE(msm9615_gsbi_configs));
523
Rohit Vaswanif688fa62011-10-13 18:13:10 -0700524 msm_gpiomux_install(msm9615_ps_hold_config,
525 ARRAY_SIZE(msm9615_ps_hold_config));
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -0700526 return 0;
527}
528
Harini Jayaraman738c9312011-09-08 15:22:38 -0600529static struct msm_spi_platform_data msm9615_qup_spi_gsbi3_pdata = {
530 .max_clock_speed = 24000000,
531};
532
Harini Jayaramaneba52672011-09-08 15:13:00 -0600533static struct msm_i2c_platform_data msm9615_i2c_qup_gsbi5_pdata = {
534 .clk_freq = 100000,
535 .src_clk_rate = 24000000,
536};
537
Amit Blay5e4ec192011-10-20 09:16:54 +0200538static struct msm_otg_platform_data msm_otg_pdata = {
539 .mode = USB_PERIPHERAL,
540 .otg_control = OTG_NO_CONTROL,
541 .phy_type = SNPS_28NM_INTEGRATED_PHY,
542 .pclk_src_name = "dfab_usb_hs_clk",
543};
544
545static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum)
546{
547 return 0;
548}
549
550static struct android_usb_platform_data android_usb_pdata = {
551 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
552};
553
554static struct platform_device android_usb_device = {
555 .name = "android_usb",
556 .id = -1,
557 .dev = {
558 .platform_data = &android_usb_pdata,
559 },
560};
561
562static struct platform_device *common_devices[] = {
563 &msm9615_device_dmov,
564 &msm_device_smd,
565 &msm_device_otg,
566 &msm_device_gadget_peripheral,
567 &android_usb_device,
568 &msm9615_device_uart_gsbi4,
569 &msm9615_device_ssbi_pmic1,
570 &msm9615_device_qup_i2c_gsbi5,
571 &msm9615_device_qup_spi_gsbi3,
572 &msm_device_sps,
573 &msm9615_device_tsens,
574 &msm_device_nand,
575 &msm_rpm_device,
576#ifdef CONFIG_HW_RANDOM_MSM
577 &msm_device_rng,
578#endif
579
580#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
581 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
Ramesh Masavarapuaa28b5b2011-10-21 10:26:03 -0700582 &msm9615_qcrypto_device,
Amit Blay5e4ec192011-10-20 09:16:54 +0200583#endif
584
585#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
586 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
Ramesh Masavarapuaa28b5b2011-10-21 10:26:03 -0700587 &msm9615_qcedev_device,
Amit Blay5e4ec192011-10-20 09:16:54 +0200588#endif
589};
590
Harini Jayaramaneba52672011-09-08 15:13:00 -0600591static void __init msm9615_i2c_init(void)
592{
593 msm9615_device_qup_i2c_gsbi5.dev.platform_data =
594 &msm9615_i2c_qup_gsbi5_pdata;
595}
596
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -0700597static void __init msm9615_common_init(void)
598{
599 msm9615_device_init();
600 gpiomux_init();
Harini Jayaramaneba52672011-09-08 15:13:00 -0600601 msm9615_i2c_init();
David Collins00b31e62011-08-31 20:00:10 -0700602 regulator_suppress_info_printing();
David Collinsbea297a2011-09-28 13:11:14 -0700603 platform_device_register(&msm9615_device_rpm_regulator);
Harini Jayaraman738c9312011-09-08 15:22:38 -0600604 msm9615_device_qup_spi_gsbi3.dev.platform_data =
605 &msm9615_qup_spi_gsbi3_pdata;
Kenneth Heitkeaf3d3cf2011-09-08 11:45:31 -0700606 msm9615_device_ssbi_pmic1.dev.platform_data =
607 &msm9615_ssbi_pm8018_pdata;
David Collins00b31e62011-08-31 20:00:10 -0700608 pm8018_platform_data.num_regulators = msm_pm8018_regulator_pdata_len;
Amit Blay5e4ec192011-10-20 09:16:54 +0200609
610 msm_device_otg.dev.platform_data = &msm_otg_pdata;
611 msm_device_gadget_peripheral.dev.parent = &msm_device_otg.dev;
Rohit Vaswani09666872011-08-23 17:41:54 -0700612 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Krishna Kondadd794462011-10-01 00:19:29 -0700613
Vikram Mulukutlab5e1cda2011-10-04 16:17:22 -0700614 msm_clock_init(&msm9615_clock_init_data);
615 acpuclk_init(&acpuclk_9615_soc_data);
616
Krishna Kondadd794462011-10-01 00:19:29 -0700617 msm9615_init_mmc();
Maheshkumar Sivasubramanian4923db22011-09-15 09:28:15 -0600618 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
619 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
620 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
621 msm_pm_data);
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -0700622}
623
624static void __init msm9615_cdp_init(void)
625{
626 msm9615_common_init();
627}
628
629static void __init msm9615_mtp_init(void)
630{
631 msm9615_common_init();
632}
633
634MACHINE_START(MSM9615_CDP, "QCT MSM9615 CDP")
635 .map_io = msm9615_map_io,
636 .init_irq = msm9615_init_irq,
637 .timer = &msm_timer,
638 .init_machine = msm9615_cdp_init,
639MACHINE_END
640
641MACHINE_START(MSM9615_MTP, "QCT MSM9615 MTP")
642 .map_io = msm9615_map_io,
643 .init_irq = msm9615_init_irq,
644 .timer = &msm_timer,
645 .init_machine = msm9615_mtp_init,
646MACHINE_END