blob: 1c4e78e0c1d507934229c88d0ad695838c93d501 [file] [log] [blame]
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001/* 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 *
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080012 */
13#include <linux/kernel.h>
14#include <linux/platform_device.h>
15#include <linux/io.h>
16#include <linux/irq.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070017#include <linux/i2c.h>
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -070018#include <linux/i2c/sx150x.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070019#include <linux/gpio.h>
20#include <linux/msm_ssbi.h>
21#include <linux/regulator/gpio-regulator.h>
22#include <linux/mfd/pm8xxx/pm8921.h>
23#include <linux/regulator/consumer.h>
24#include <linux/spi/spi.h>
25#include <linux/slimbus/slimbus.h>
26#include <linux/bootmem.h>
27#ifdef CONFIG_ANDROID_PMEM
28#include <linux/android_pmem.h>
29#endif
30#include <linux/cyttsp.h>
31#include <linux/dma-mapping.h>
32#include <linux/platform_data/qcom_crypto_device.h>
33#include <linux/leds.h>
34#include <linux/leds-pm8xxx.h>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080035
36#include <asm/mach-types.h>
37#include <asm/mach/arch.h>
Larry Basselb4126da2011-07-18 14:31:33 -070038#include <asm/setup.h>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080039#include <asm/hardware/gic.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070040#include <asm/mach/mmc.h>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080041
42#include <mach/board.h>
43#include <mach/msm_iomap.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070044#include <mach/msm_spi.h>
45#ifdef CONFIG_USB_MSM_OTG_72K
46#include <mach/msm_hsusb.h>
47#else
48#include <linux/usb/msm_hsusb.h>
49#endif
50#include <linux/usb/android.h>
51#include <mach/usbdiag.h>
52#include <mach/socinfo.h>
53#include <mach/rpm.h>
54#include <mach/gpio.h>
Rohit Vaswania513aa8d2011-07-18 15:14:28 -070055#include <mach/gpiomux.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070056#include <mach/msm_bus_board.h>
57#include <mach/msm_memtypes.h>
58#include <mach/dma.h>
59#include <mach/msm_dsps.h>
60#include <mach/msm_xo.h>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080061
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070062#ifdef CONFIG_WCD9310_CODEC
63#include <linux/slimbus/slimbus.h>
64#include <linux/mfd/wcd9310/core.h>
65#include <linux/mfd/wcd9310/pdata.h>
66#endif
67
68#include "timer.h"
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -080069#include "devices.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070070#include "devices-msm8x60.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070071#include "spm.h"
72#include "board-msm8960.h"
73#include "pm.h"
74#include "cpuidle.h"
75#include "rpm_resources.h"
76#include "mpm.h"
77
78static struct platform_device msm_fm_platform_init = {
79 .name = "iris_fm",
80 .id = -1,
81};
82
83struct pm8xxx_gpio_init {
84 unsigned gpio;
85 struct pm_gpio config;
86};
87
88struct pm8xxx_mpp_init {
89 unsigned mpp;
90 struct pm8xxx_mpp_config_data config;
91};
92
93#define PM8XXX_GPIO_INIT(_gpio, _dir, _buf, _val, _pull, _vin, _out_strength, \
94 _func, _inv, _disable) \
95{ \
96 .gpio = PM8921_GPIO_PM_TO_SYS(_gpio), \
97 .config = { \
98 .direction = _dir, \
99 .output_buffer = _buf, \
100 .output_value = _val, \
101 .pull = _pull, \
102 .vin_sel = _vin, \
103 .out_strength = _out_strength, \
104 .function = _func, \
105 .inv_int_pol = _inv, \
106 .disable_pin = _disable, \
107 } \
108}
109
110#define PM8XXX_MPP_INIT(_mpp, _type, _level, _control) \
111{ \
112 .mpp = PM8921_MPP_PM_TO_SYS(_mpp), \
113 .config = { \
114 .type = PM8XXX_MPP_TYPE_##_type, \
115 .level = _level, \
116 .control = PM8XXX_MPP_##_control, \
117 } \
118}
119
120#define PM8XXX_GPIO_DISABLE(_gpio) \
121 PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_IN, 0, 0, 0, PM_GPIO_VIN_S4, \
122 0, 0, 0, 1)
123
124#define PM8XXX_GPIO_OUTPUT(_gpio, _val) \
125 PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_OUT, PM_GPIO_OUT_BUF_CMOS, _val, \
126 PM_GPIO_PULL_NO, PM_GPIO_VIN_S4, \
127 PM_GPIO_STRENGTH_HIGH, \
128 PM_GPIO_FUNC_NORMAL, 0, 0)
129
130#define PM8XXX_GPIO_INPUT(_gpio, _pull) \
131 PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_IN, PM_GPIO_OUT_BUF_CMOS, 0, \
132 _pull, PM_GPIO_VIN_S4, \
133 PM_GPIO_STRENGTH_NO, \
134 PM_GPIO_FUNC_NORMAL, 0, 0)
135
136#define PM8XXX_GPIO_OUTPUT_FUNC(_gpio, _val, _func) \
137 PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_OUT, PM_GPIO_OUT_BUF_CMOS, _val, \
138 PM_GPIO_PULL_NO, PM_GPIO_VIN_S4, \
139 PM_GPIO_STRENGTH_HIGH, \
140 _func, 0, 0)
141
142/* Initial PM8921 GPIO configurations */
143static struct pm8xxx_gpio_init pm8921_gpios[] __initdata = {
144 PM8XXX_GPIO_DISABLE(6), /* Disable unused */
145 PM8XXX_GPIO_DISABLE(7), /* Disable NFC */
146 PM8XXX_GPIO_INPUT(16, PM_GPIO_PULL_UP_30), /* SD_CARD_WP */
147 PM8XXX_GPIO_DISABLE(22), /* Disable NFC */
Nagamalleswararao Ganjieac5dfa2011-07-23 17:31:16 -0700148 PM8XXX_GPIO_OUTPUT_FUNC(24, 0, PM_GPIO_FUNC_2), /* Bl: Off, PWM mode */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700149 PM8XXX_GPIO_INPUT(26, PM_GPIO_PULL_UP_30), /* SD_CARD_DET_N */
150 PM8XXX_GPIO_OUTPUT(43, 0), /* DISP_RESET_N */
151};
152
153/* Initial PM8921 MPP configurations */
154static struct pm8xxx_mpp_init pm8921_mpps[] __initdata = {
155 /* External 5V regulator enable; shared by HDMI and USB_OTG switches. */
156 PM8XXX_MPP_INIT(7, D_INPUT, PM8921_MPP_DIG_LEVEL_VPH, DIN_TO_INT),
157 PM8XXX_MPP_INIT(PM8921_AMUX_MPP_3, A_INPUT, PM8XXX_MPP_AIN_AMUX_CH6,
158 DOUT_CTRL_LOW),
159 PM8XXX_MPP_INIT(PM8921_AMUX_MPP_8, A_INPUT, PM8XXX_MPP_AIN_AMUX_CH8,
160 DOUT_CTRL_LOW),
161};
162
163static void __init pm8921_gpio_mpp_init(void)
164{
165 int i, rc;
166
167 for (i = 0; i < ARRAY_SIZE(pm8921_gpios); i++) {
168 rc = pm8xxx_gpio_config(pm8921_gpios[i].gpio,
169 &pm8921_gpios[i].config);
170 if (rc) {
171 pr_err("%s: pm8xxx_gpio_config: rc=%d\n", __func__, rc);
172 break;
173 }
174 }
175
176 for (i = 0; i < ARRAY_SIZE(pm8921_mpps); i++) {
177 rc = pm8xxx_mpp_config(pm8921_mpps[i].mpp,
178 &pm8921_mpps[i].config);
179 if (rc) {
180 pr_err("%s: pm8xxx_mpp_config: rc=%d\n", __func__, rc);
181 break;
182 }
183 }
184}
185
186#define FPGA_CS_GPIO 14
187#define KS8851_RST_GPIO 89
188#define KS8851_IRQ_GPIO 90
189
190/* Macros assume PMIC GPIOs and MPPs start at 1 */
191#define PM8921_GPIO_BASE NR_GPIO_IRQS
192#define PM8921_GPIO_PM_TO_SYS(pm_gpio) (pm_gpio - 1 + PM8921_GPIO_BASE)
193#define PM8921_MPP_BASE (PM8921_GPIO_BASE + PM8921_NR_GPIOS)
194#define PM8921_MPP_PM_TO_SYS(pm_gpio) (pm_gpio - 1 + PM8921_MPP_BASE)
195#define PM8921_IRQ_BASE (NR_MSM_IRQS + NR_GPIO_IRQS)
196#define PM8921_MPP_IRQ_BASE (PM8921_IRQ_BASE + NR_GPIO_IRQS)
197
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700198#if defined(CONFIG_GPIO_SX150X) || defined(CONFIG_GPIO_SX150X_MODULE)
199enum {
200 GPIO_EXPANDER_IRQ_BASE = (PM8921_MPP_IRQ_BASE + PM8921_NR_MPPS),
201 GPIO_EXPANDER_GPIO_BASE = (PM8921_MPP_BASE + PM8921_NR_MPPS),
202 /* CAM Expander */
203 GPIO_CAM_EXPANDER_BASE = GPIO_EXPANDER_GPIO_BASE,
204 GPIO_CAM_GP_STROBE_READY = GPIO_CAM_EXPANDER_BASE,
205 GPIO_CAM_GP_AFBUSY,
206 GPIO_CAM_GP_STROBE_CE,
207 GPIO_CAM_GP_CAM1MP_XCLR,
208 GPIO_CAM_GP_CAMIF_RESET_N,
209 GPIO_CAM_GP_XMT_FLASH_INT,
210 GPIO_CAM_GP_LED_EN1,
211 GPIO_CAM_GP_LED_EN2,
212
213};
214#endif
215
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700216static struct gpiomux_setting gsbi1 = {
217 .func = GPIOMUX_FUNC_1,
218 .drv = GPIOMUX_DRV_8MA,
219 .pull = GPIOMUX_PULL_NONE,
220};
221
222static struct gpiomux_setting gsbi3 = {
223 .func = GPIOMUX_FUNC_1,
224 .drv = GPIOMUX_DRV_8MA,
225 .pull = GPIOMUX_PULL_NONE,
226};
227
228static struct gpiomux_setting gsbi4 = {
229 .func = GPIOMUX_FUNC_1,
230 .drv = GPIOMUX_DRV_8MA,
231 .pull = GPIOMUX_PULL_NONE,
232};
233
234static struct gpiomux_setting gsbi5 = {
235 .func = GPIOMUX_FUNC_1,
236 .drv = GPIOMUX_DRV_8MA,
237 .pull = GPIOMUX_PULL_NONE,
238};
239
240static struct gpiomux_setting gsbi10 = {
241 .func = GPIOMUX_FUNC_2,
242 .drv = GPIOMUX_DRV_8MA,
243 .pull = GPIOMUX_PULL_NONE,
244};
245
246static struct gpiomux_setting gsbi12 = {
247 .func = GPIOMUX_FUNC_1,
248 .drv = GPIOMUX_DRV_8MA,
249 .pull = GPIOMUX_PULL_NONE,
250};
251
252static struct gpiomux_setting cdc_mclk = {
253 .func = GPIOMUX_FUNC_1,
254 .drv = GPIOMUX_DRV_8MA,
255 .pull = GPIOMUX_PULL_NONE,
256};
257
Stepan Moskovchenko41d168272011-08-09 17:09:42 -0700258#ifdef CONFIG_KS8851
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700259static struct gpiomux_setting gpio_eth_config = {
260 .pull = GPIOMUX_PULL_NONE,
261 .drv = GPIOMUX_DRV_8MA,
262 .func = GPIOMUX_FUNC_GPIO,
263};
Stepan Moskovchenko41d168272011-08-09 17:09:42 -0700264#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700265
266static struct gpiomux_setting slimbus = {
267 .func = GPIOMUX_FUNC_1,
268 .drv = GPIOMUX_DRV_8MA,
269 .pull = GPIOMUX_PULL_KEEPER,
270};
271
272struct msm_gpiomux_config msm8960_gpiomux_configs[NR_GPIO_IRQS] = {
Stepan Moskovchenko41d168272011-08-09 17:09:42 -0700273#ifdef CONFIG_KS8851
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700274 {
275 .gpio = KS8851_IRQ_GPIO,
276 .settings = {
277 [GPIOMUX_SUSPENDED] = &gpio_eth_config,
278 }
279 },
280 {
281 .gpio = KS8851_RST_GPIO,
282 .settings = {
283 [GPIOMUX_SUSPENDED] = &gpio_eth_config,
284 }
285 },
286 {
287 .gpio = FPGA_CS_GPIO,
288 .settings = {
289 [GPIOMUX_SUSPENDED] = &gpio_eth_config,
290 }
291 },
Stepan Moskovchenko41d168272011-08-09 17:09:42 -0700292#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700293};
294
295static struct msm_gpiomux_config msm8960_gsbi_configs[] __initdata = {
296 {
297 .gpio = 6, /* GSBI1 QUP SPI_DATA_MOSI */
298 .settings = {
299 [GPIOMUX_SUSPENDED] = &gsbi1,
300 },
301 },
302 {
303 .gpio = 7, /* GSBI1 QUP SPI_DATA_MISO */
304 .settings = {
305 [GPIOMUX_SUSPENDED] = &gsbi1,
306 },
307 },
308 {
309 .gpio = 8, /* GSBI1 QUP SPI_CS_N */
310 .settings = {
311 [GPIOMUX_SUSPENDED] = &gsbi1,
312 },
313 },
314 {
315 .gpio = 9, /* GSBI1 QUP SPI_CLK */
316 .settings = {
317 [GPIOMUX_SUSPENDED] = &gsbi1,
318 },
319 },
320 {
321 .gpio = 16, /* GSBI3 I2C QUP SDA */
322 .settings = {
323 [GPIOMUX_SUSPENDED] = &gsbi3,
324 },
325 },
326 {
327 .gpio = 17, /* GSBI3 I2C QUP SCL */
328 .settings = {
329 [GPIOMUX_SUSPENDED] = &gsbi3,
330 },
331 },
332 {
333 .gpio = 20, /* GSBI4 I2C QUP SDA */
334 .settings = {
335 [GPIOMUX_SUSPENDED] = &gsbi4,
336 },
337 },
338 {
339 .gpio = 21, /* GSBI4 I2C QUP SCL */
340 .settings = {
341 [GPIOMUX_SUSPENDED] = &gsbi4,
342 },
343 },
344 {
345 .gpio = 22, /* GSBI5 UART2 */
346 .settings = {
347 [GPIOMUX_SUSPENDED] = &gsbi5,
348 },
349 },
350 {
351 .gpio = 23, /* GSBI5 UART2 */
352 .settings = {
353 [GPIOMUX_SUSPENDED] = &gsbi5,
354 },
355 },
356 {
357 .gpio = 24, /* GSBI5 UART2 */
358 .settings = {
359 [GPIOMUX_SUSPENDED] = &gsbi5,
360 },
361 },
362 {
363 .gpio = 25, /* GSBI5 UART2 */
364 .settings = {
365 [GPIOMUX_SUSPENDED] = &gsbi5,
366 },
367 },
368 {
369 .gpio = 44, /* GSBI12 I2C QUP SDA */
370 .settings = {
371 [GPIOMUX_SUSPENDED] = &gsbi12,
372 },
373 },
374 {
375 .gpio = 45, /* GSBI12 I2C QUP SCL */
376 .settings = {
377 [GPIOMUX_SUSPENDED] = &gsbi12,
378 },
379 },
380 {
381 .gpio = 73, /* GSBI10 I2C QUP SDA */
382 .settings = {
383 [GPIOMUX_SUSPENDED] = &gsbi10,
384 },
385 },
386 {
387 .gpio = 74, /* GSBI10 I2C QUP SCL */
388 .settings = {
389 [GPIOMUX_SUSPENDED] = &gsbi10,
390 },
391 },
392};
393
394static struct msm_gpiomux_config msm8960_slimbus_config[] __initdata = {
395 {
396 .gpio = 60, /* slimbus data */
397 .settings = {
398 [GPIOMUX_SUSPENDED] = &slimbus,
399 },
400 },
401 {
402 .gpio = 61, /* slimbus clk */
403 .settings = {
404 [GPIOMUX_SUSPENDED] = &slimbus,
405 },
406 },
407};
408
409static struct msm_gpiomux_config msm8960_audio_codec_configs[] __initdata = {
410 {
411 .gpio = 59,
412 .settings = {
413 [GPIOMUX_SUSPENDED] = &cdc_mclk,
414 },
415 },
416};
417static struct gpiomux_setting wcnss_5wire_suspend_cfg = {
418 .func = GPIOMUX_FUNC_GPIO,
419 .drv = GPIOMUX_DRV_2MA,
420 .pull = GPIOMUX_PULL_NONE,
421};
422
423static struct gpiomux_setting wcnss_5wire_active_cfg = {
424 .func = GPIOMUX_FUNC_1,
425 .drv = GPIOMUX_DRV_6MA,
426 .pull = GPIOMUX_PULL_DOWN,
427};
428
429static struct msm_gpiomux_config wcnss_5wire_interface[] = {
430 {
431 .gpio = 84,
432 .settings = {
433 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
434 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
435 },
436 },
437 {
438 .gpio = 85,
439 .settings = {
440 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
441 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
442 },
443 },
444 {
445 .gpio = 86,
446 .settings = {
447 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
448 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
449 },
450 },
451 {
452 .gpio = 87,
453 .settings = {
454 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
455 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
456 },
457 },
458 {
459 .gpio = 88,
460 .settings = {
461 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
462 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
463 },
464 },
465};
Nishant Pandit474f2252011-07-23 23:17:56 +0530466static struct gpiomux_setting cam_settings[4] = {
467 {
468 .func = GPIOMUX_FUNC_GPIO, /*suspend*/
469 .drv = GPIOMUX_DRV_2MA,
470 .pull = GPIOMUX_PULL_DOWN,
471 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700472
Nishant Pandit474f2252011-07-23 23:17:56 +0530473 {
474 .func = GPIOMUX_FUNC_1, /*active 1*/
475 .drv = GPIOMUX_DRV_2MA,
476 .pull = GPIOMUX_PULL_NONE,
477 },
478
479 {
480 .func = GPIOMUX_FUNC_GPIO, /*active 2*/
481 .drv = GPIOMUX_DRV_2MA,
482 .pull = GPIOMUX_PULL_NONE,
483 },
484
485 {
486 .func = GPIOMUX_FUNC_1, /*active 3*/
487 .drv = GPIOMUX_DRV_8MA,
488 .pull = GPIOMUX_PULL_UP,
489 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700490};
491
Nishant Pandit474f2252011-07-23 23:17:56 +0530492static struct msm_gpiomux_config msm8960_cam_configs[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700493 {
494 .gpio = 2,
495 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530496 [GPIOMUX_ACTIVE] = &cam_settings[2],
497 [GPIOMUX_SUSPENDED] = &cam_settings[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700498 },
499 },
500 {
501 .gpio = 3,
502 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530503 [GPIOMUX_ACTIVE] = &cam_settings[1],
504 [GPIOMUX_SUSPENDED] = &cam_settings[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700505 },
506 },
507 {
508 .gpio = 4,
509 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530510 [GPIOMUX_ACTIVE] = &cam_settings[1],
511 [GPIOMUX_SUSPENDED] = &cam_settings[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700512 },
513 },
514 {
515 .gpio = 5,
516 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530517 [GPIOMUX_ACTIVE] = &cam_settings[1],
518 [GPIOMUX_SUSPENDED] = &cam_settings[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700519 },
520 },
521 {
522 .gpio = 18,
523 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530524 [GPIOMUX_ACTIVE] = &cam_settings[3],
525 [GPIOMUX_SUSPENDED] = &cam_settings[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700526 },
527 },
528 {
529 .gpio = 19,
530 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530531 [GPIOMUX_ACTIVE] = &cam_settings[3],
532 [GPIOMUX_SUSPENDED] = &cam_settings[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700533 },
534 },
535 {
536 .gpio = 20,
537 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530538 [GPIOMUX_ACTIVE] = &cam_settings[3],
539 [GPIOMUX_SUSPENDED] = &cam_settings[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700540 },
541 },
542 {
543 .gpio = 21,
544 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530545 [GPIOMUX_ACTIVE] = &cam_settings[3],
546 [GPIOMUX_SUSPENDED] = &cam_settings[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700547 },
548 },
549 {
550 .gpio = 76,
551 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530552 [GPIOMUX_ACTIVE] = &cam_settings[2],
553 [GPIOMUX_SUSPENDED] = &cam_settings[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700554 },
555 },
556 {
557 .gpio = 107,
558 .settings = {
Nishant Pandit474f2252011-07-23 23:17:56 +0530559 [GPIOMUX_ACTIVE] = &cam_settings[2],
560 [GPIOMUX_SUSPENDED] = &cam_settings[0],
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700561 },
562 },
563};
564
565static struct gpiomux_setting cyts_resout_sus_cfg = {
566 .func = GPIOMUX_FUNC_GPIO,
567 .drv = GPIOMUX_DRV_6MA,
568 .pull = GPIOMUX_PULL_UP,
569};
570
571static struct gpiomux_setting cyts_resout_act_cfg = {
572 .func = GPIOMUX_FUNC_GPIO,
573 .drv = GPIOMUX_DRV_6MA,
574 .pull = GPIOMUX_PULL_UP,
575};
576
577static struct gpiomux_setting cyts_sleep_sus_cfg = {
578 .func = GPIOMUX_FUNC_GPIO,
579 .drv = GPIOMUX_DRV_6MA,
580 .pull = GPIOMUX_PULL_DOWN,
581};
582
583static struct gpiomux_setting cyts_sleep_act_cfg = {
584 .func = GPIOMUX_FUNC_GPIO,
585 .drv = GPIOMUX_DRV_6MA,
586 .pull = GPIOMUX_PULL_DOWN,
587};
588
589static struct gpiomux_setting cyts_int_act_cfg = {
590 .func = GPIOMUX_FUNC_GPIO,
591 .drv = GPIOMUX_DRV_8MA,
592 .pull = GPIOMUX_PULL_UP,
593};
594
595static struct gpiomux_setting cyts_int_sus_cfg = {
596 .func = GPIOMUX_FUNC_GPIO,
597 .drv = GPIOMUX_DRV_2MA,
598 .pull = GPIOMUX_PULL_UP,
599};
600
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700601static struct msm_gpiomux_config msm8960_cyts_configs[] __initdata = {
602 { /* TS INTERRUPT */
603 .gpio = 11,
604 .settings = {
605 [GPIOMUX_ACTIVE] = &cyts_int_act_cfg,
606 [GPIOMUX_SUSPENDED] = &cyts_int_sus_cfg,
607 },
608 },
609 { /* TS SLEEP */
610 .gpio = 50,
611 .settings = {
612 [GPIOMUX_ACTIVE] = &cyts_sleep_act_cfg,
613 [GPIOMUX_SUSPENDED] = &cyts_sleep_sus_cfg,
614 },
615 },
616 { /* TS RESOUT */
617 .gpio = 52,
618 .settings = {
619 [GPIOMUX_ACTIVE] = &cyts_resout_act_cfg,
620 [GPIOMUX_SUSPENDED] = &cyts_resout_sus_cfg,
621 },
622 },
623};
624
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700625#if defined(CONFIG_GPIO_SX150X) || defined(CONFIG_GPIO_SX150X_MODULE)
626enum {
627 SX150X_CAM,
628};
629
Nishant Pandit474f2252011-07-23 23:17:56 +0530630static struct sx150x_platform_data sx150x_data[] = {
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700631 [SX150X_CAM] = {
632 .gpio_base = GPIO_CAM_EXPANDER_BASE,
633 .oscio_is_gpo = false,
634 .io_pullup_ena = 0x0,
Nishant Pandit474f2252011-07-23 23:17:56 +0530635 .io_pulldn_ena = 0xc0,
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700636 .io_open_drain_ena = 0x0,
637 .irq_summary = -1,
638 },
639};
Nishant Pandit474f2252011-07-23 23:17:56 +0530640
641#endif
642
643#ifdef CONFIG_I2C
644
645#define MSM_8960_GSBI4_QUP_I2C_BUS_ID 4
646#define MSM_8960_GSBI3_QUP_I2C_BUS_ID 3
647
648#if defined(CONFIG_GPIO_SX150X) || defined(CONFIG_GPIO_SX150X_MODULE)
649
650static struct i2c_board_info cam_expander_i2c_info[] = {
651 {
652 I2C_BOARD_INFO("sx1508q", 0x22),
653 .platform_data = &sx150x_data[SX150X_CAM]
654 },
655};
656
657static struct msm_cam_expander_info cam_expander_info[] = {
658 {
659 cam_expander_i2c_info,
660 MSM_8960_GSBI4_QUP_I2C_BUS_ID,
661 },
662};
663#endif
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700664#endif
665
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700666#define MSM_PMEM_KERNEL_EBI1_SIZE 0x110C000
667#define MSM_PMEM_ADSP_SIZE 0x3800000
668#define MSM_PMEM_AUDIO_SIZE 0x279000
669#define MSM_PMEM_SIZE 0x1800000 /* 24 Mbytes */
670
671#ifdef CONFIG_KERNEL_PMEM_EBI_REGION
672static unsigned pmem_kernel_ebi1_size = MSM_PMEM_KERNEL_EBI1_SIZE;
673static int __init pmem_kernel_ebi1_size_setup(char *p)
674{
675 pmem_kernel_ebi1_size = memparse(p, NULL);
676 return 0;
677}
678early_param("pmem_kernel_ebi1_size", pmem_kernel_ebi1_size_setup);
679#endif
680
681#ifdef CONFIG_ANDROID_PMEM
682static unsigned pmem_size = MSM_PMEM_SIZE;
683static int __init pmem_size_setup(char *p)
684{
685 pmem_size = memparse(p, NULL);
686 return 0;
687}
688early_param("pmem_size", pmem_size_setup);
689
690static unsigned pmem_adsp_size = MSM_PMEM_ADSP_SIZE;
691
692static int __init pmem_adsp_size_setup(char *p)
693{
694 pmem_adsp_size = memparse(p, NULL);
695 return 0;
696}
697early_param("pmem_adsp_size", pmem_adsp_size_setup);
698
699static unsigned pmem_audio_size = MSM_PMEM_AUDIO_SIZE;
700
701static int __init pmem_audio_size_setup(char *p)
702{
703 pmem_audio_size = memparse(p, NULL);
704 return 0;
705}
706early_param("pmem_audio_size", pmem_audio_size_setup);
707#endif
708
709#ifdef CONFIG_ANDROID_PMEM
710static struct android_pmem_platform_data android_pmem_pdata = {
711 .name = "pmem",
712 .allocator_type = PMEM_ALLOCATORTYPE_ALLORNOTHING,
713 .cached = 1,
714 .memory_type = MEMTYPE_EBI1,
715};
716
717static struct platform_device android_pmem_device = {
718 .name = "android_pmem",
719 .id = 0,
720 .dev = {.platform_data = &android_pmem_pdata},
721};
722
723static struct android_pmem_platform_data android_pmem_adsp_pdata = {
724 .name = "pmem_adsp",
725 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
726 .cached = 0,
727 .memory_type = MEMTYPE_EBI1,
728};
729static struct platform_device android_pmem_adsp_device = {
730 .name = "android_pmem",
731 .id = 2,
732 .dev = { .platform_data = &android_pmem_adsp_pdata },
733};
734
735static struct android_pmem_platform_data android_pmem_audio_pdata = {
736 .name = "pmem_audio",
737 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
738 .cached = 0,
739 .memory_type = MEMTYPE_EBI1,
740};
741
742static struct platform_device android_pmem_audio_device = {
743 .name = "android_pmem",
744 .id = 4,
745 .dev = { .platform_data = &android_pmem_audio_pdata },
746};
747#endif
748
749static struct memtype_reserve msm8960_reserve_table[] __initdata = {
750 [MEMTYPE_SMI] = {
751 },
752 [MEMTYPE_EBI0] = {
753 .flags = MEMTYPE_FLAGS_1M_ALIGN,
754 },
755 [MEMTYPE_EBI1] = {
756 .flags = MEMTYPE_FLAGS_1M_ALIGN,
757 },
758};
759
760static void __init size_pmem_devices(void)
761{
762#ifdef CONFIG_ANDROID_PMEM
763 android_pmem_adsp_pdata.size = pmem_adsp_size;
764 android_pmem_pdata.size = pmem_size;
765 android_pmem_audio_pdata.size = MSM_PMEM_AUDIO_SIZE;
766#endif
767}
768
769static void __init reserve_memory_for(struct android_pmem_platform_data *p)
770{
771 msm8960_reserve_table[p->memory_type].size += p->size;
772}
773
774static void __init reserve_pmem_memory(void)
775{
776#ifdef CONFIG_ANDROID_PMEM
777 reserve_memory_for(&android_pmem_adsp_pdata);
778 reserve_memory_for(&android_pmem_pdata);
779 reserve_memory_for(&android_pmem_audio_pdata);
780 msm8960_reserve_table[MEMTYPE_EBI1].size += pmem_kernel_ebi1_size;
781#endif
782}
783
Larry Basselb4126da2011-07-18 14:31:33 -0700784static int msm8960_paddr_to_memtype(unsigned int paddr)
785{
786 return MEMTYPE_EBI1;
787}
788
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700789static void __init msm8960_calculate_reserve_sizes(void)
790{
791 size_pmem_devices();
792 reserve_pmem_memory();
793}
794
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700795static struct reserve_info msm8960_reserve_info __initdata = {
796 .memtype_reserve_table = msm8960_reserve_table,
797 .calculate_reserve_sizes = msm8960_calculate_reserve_sizes,
798 .paddr_to_memtype = msm8960_paddr_to_memtype,
799};
800
Larry Basselb4126da2011-07-18 14:31:33 -0700801static int msm8960_memory_bank_size(void)
802{
803 return 1<<29;
804}
805
806static void __init locate_unstable_memory(void)
807{
808 struct membank *mb = &meminfo.bank[meminfo.nr_banks - 1];
809 unsigned long bank_size;
810 unsigned long low, high;
811
812 bank_size = msm8960_memory_bank_size();
813 low = meminfo.bank[0].start;
814 high = mb->start + mb->size;
815 low &= ~(bank_size - 1);
816
817 if (high - low <= bank_size)
818 return;
819 msm8960_reserve_info.low_unstable_address = low + bank_size;
820 msm8960_reserve_info.max_unstable_size = high - low - bank_size;
821 msm8960_reserve_info.bank_size = bank_size;
822 pr_info("low unstable address %lx max size %lx bank size %lx\n",
823 msm8960_reserve_info.low_unstable_address,
824 msm8960_reserve_info.max_unstable_size,
825 msm8960_reserve_info.bank_size);
826}
827
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700828static void __init msm8960_reserve(void)
829{
830 reserve_info = &msm8960_reserve_info;
Larry Basselb4126da2011-07-18 14:31:33 -0700831 locate_unstable_memory();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700832 msm_reserve();
833}
834
Larry Bassela7eadea2011-07-14 10:46:00 -0700835static int msm8960_change_memory_power(unsigned long start_pfn,
836 unsigned long nr_pages, int change_type)
837{
838 return 1;
839}
840
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700841#ifdef CONFIG_MSM_CAMERA
842
843static int msm_cam_gpio_tbl[] = {
844 5, /*CAMIF_MCLK*/
845 20, /*CAMIF_I2C_DATA*/
846 21, /*CAMIF_I2C_CLK*/
847};
848
849#define VFE_CAMIF_TIMER1_GPIO 2
850#define VFE_CAMIF_TIMER2_GPIO 3
851#define VFE_CAMIF_TIMER3_GPIO_INT 4
852struct msm_camera_sensor_strobe_flash_data strobe_flash_xenon = {
853 .flash_trigger = VFE_CAMIF_TIMER2_GPIO,
854 .flash_charge = VFE_CAMIF_TIMER1_GPIO,
855 .flash_charge_done = VFE_CAMIF_TIMER3_GPIO_INT,
856 .flash_recharge_duration = 50000,
857 .irq = MSM_GPIO_TO_INT(VFE_CAMIF_TIMER3_GPIO_INT),
858};
859
Nishant Pandit474f2252011-07-23 23:17:56 +0530860#ifdef CONFIG_MSM_CAMERA_FLASH
861static struct msm_camera_sensor_flash_src msm_flash_src = {
862 .flash_sr_type = MSM_CAMERA_FLASH_SRC_EXT,
863 ._fsrc.ext_driver_src.led_en = GPIO_CAM_GP_LED_EN1,
864 ._fsrc.ext_driver_src.led_flash_en = GPIO_CAM_GP_LED_EN2,
865#if defined(CONFIG_I2C) && (defined(CONFIG_GPIO_SX150X) || \
866 defined(CONFIG_GPIO_SX150X_MODULE))
867 ._fsrc.ext_driver_src.expander_info = cam_expander_info,
868#endif
869};
870#endif
871
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700872#ifdef CONFIG_IMX074
873static struct msm_camera_sensor_platform_info sensor_board_info = {
Mansoor Aftab6d6ff5e2011-07-20 17:25:36 -0700874 .mount_angle = 90
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700875};
876#endif
877
878static int config_gpio_table(int gpio_en)
879{
880 int rc = 0, i = 0;
881 if (gpio_en) {
882 for (i = 0; i < ARRAY_SIZE(msm_cam_gpio_tbl); i++) {
883 rc = gpio_request(msm_cam_gpio_tbl[i], "CAM_GPIO");
884 if (rc < 0) {
885 pr_err("%s not able to get gpio\n", __func__);
886 for (i--; i >= 0; i--)
887 gpio_free(msm_cam_gpio_tbl[i]);
888 break;
889 }
890 }
891 } else {
892 for (i = 0; i < ARRAY_SIZE(msm_cam_gpio_tbl); i++)
893 gpio_free(msm_cam_gpio_tbl[i]);
894 }
895 return rc;
896}
897
898static int config_camera_on_gpios(void)
899{
900 int rc = 0;
901
902 rc = config_gpio_table(1);
903 if (rc < 0) {
904 printk(KERN_ERR "%s: CAMSENSOR gpio table request"
905 "failed\n", __func__);
906 return rc;
907 }
908 return rc;
909}
910
911static void config_camera_off_gpios(void)
912{
913 config_gpio_table(0);
914}
915
916struct msm_camera_device_platform_data msm_camera_csi0_device_data = {
917 .camera_gpio_on = config_camera_on_gpios,
918 .camera_gpio_off = config_camera_off_gpios,
919 .ioclk.mclk_clk_rate = 24000000,
920 .ioclk.vfe_clk_rate = 228570000,
921 .csid_core = 0,
922};
923
924struct msm_camera_device_platform_data msm_camera_csi1_device_data = {
925 .camera_gpio_on = config_camera_on_gpios,
926 .camera_gpio_off = config_camera_off_gpios,
927 .ioclk.mclk_clk_rate = 24000000,
928 .ioclk.vfe_clk_rate = 228570000,
929 .csid_core = 1,
930};
931
932#ifdef CONFIG_IMX074
933static struct msm_camera_sensor_flash_data flash_imx074 = {
934 .flash_type = MSM_CAMERA_FLASH_LED,
Nishant Pandit474f2252011-07-23 23:17:56 +0530935#ifdef CONFIG_MSM_CAMERA_FLASH
936 .flash_src = &msm_flash_src
937#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700938};
939
940static struct msm_camera_sensor_info msm_camera_sensor_imx074_data = {
941 .sensor_name = "imx074",
942 .sensor_reset = 107,
943 .sensor_pwd = 85,
944 .vcm_pwd = 0,
945 .vcm_enable = 1,
946 .pdata = &msm_camera_csi0_device_data,
947 .flash_data = &flash_imx074,
948 .strobe_flash_data = &strobe_flash_xenon,
949 .sensor_platform_info = &sensor_board_info,
950 .csi_if = 1
951};
952
953struct platform_device msm8960_camera_sensor_imx074 = {
954 .name = "msm_camera_imx074",
955 .dev = {
956 .platform_data = &msm_camera_sensor_imx074_data,
957 },
958};
959#endif
960#ifdef CONFIG_OV2720
961static struct msm_camera_sensor_flash_data flash_ov2720 = {
Kevin Chan1a990332011-07-26 20:31:23 -0700962 .flash_type = MSM_CAMERA_FLASH_NONE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700963};
964
965static struct msm_camera_sensor_info msm_camera_sensor_ov2720_data = {
966 .sensor_name = "ov2720",
967 .sensor_reset = 76,
968 .sensor_pwd = 85,
969 .vcm_pwd = 0,
970 .vcm_enable = 1,
971 .pdata = &msm_camera_csi1_device_data,
972 .flash_data = &flash_ov2720,
973 .csi_if = 1
974};
975
976struct platform_device msm8960_camera_sensor_ov2720 = {
977 .name = "msm_camera_ov2720",
978 .dev = {
979 .platform_data = &msm_camera_sensor_ov2720_data,
980 },
981};
982#endif
Kevin Chandfecce22011-07-13 10:52:41 -0700983
984static struct msm_camera_sensor_flash_data flash_qs_mt9p017 = {
985 .flash_type = MSM_CAMERA_FLASH_LED,
986};
987
988static struct msm_camera_sensor_info msm_camera_sensor_qs_mt9p017_data = {
989 .sensor_name = "qs_mt9p017",
990 .sensor_reset = 107,
991 .sensor_pwd = 85,
992 .vcm_pwd = 0,
993 .vcm_enable = 1,
994 .pdata = &msm_camera_csi0_device_data,
995 .flash_data = &flash_qs_mt9p017,
996 .sensor_platform_info = &sensor_board_info,
997 .csi_if = 1
998};
999
1000struct platform_device msm8960_camera_sensor_qs_mt9p017 = {
1001 .name = "msm_camera_qs_mt9p017",
1002 .dev = {
1003 .platform_data = &msm_camera_sensor_qs_mt9p017_data,
1004 },
1005};
1006
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001007static void __init msm8960_init_cam(void)
1008{
1009 int i;
1010 struct platform_device *cam_dev[] = {
1011 &msm8960_camera_sensor_imx074,
1012 &msm8960_camera_sensor_ov2720,
Kevin Chandfecce22011-07-13 10:52:41 -07001013 &msm8960_camera_sensor_qs_mt9p017,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001014 };
1015
1016 for (i = 0; i < ARRAY_SIZE(cam_dev); i++) {
1017 struct msm_camera_sensor_info *s_info;
1018 s_info = cam_dev[i]->dev.platform_data;
1019 msm_get_cam_resources(s_info);
1020 platform_device_register(cam_dev[i]);
1021 }
1022}
1023#endif
1024
1025#ifdef CONFIG_FB_MSM_TRIPLE_BUFFER
1026/* prim = 608 x 1024 x 4(bpp) x 3(pages) */
1027#define MSM_FB_PRIM_BUF_SIZE 0x720000
1028#else
1029/* prim = 608 x 1024 x 4(bpp) x 2(pages) */
1030#define MSM_FB_PRIM_BUF_SIZE 0x4C0000
1031#endif
1032
1033#ifdef CONFIG_FB_MSM_MIPI_DSI
1034/* 960 x 540 x 3 x 2 */
1035#define MIPI_DSI_WRITEBACK_SIZE 0x300000
1036#else
1037#define MIPI_DSI_WRITEBACK_SIZE 0
1038#endif
1039
1040#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
1041/* hdmi = 1920 x 1088 x 2(bpp) x 1(page) */
1042#define MSM_FB_EXT_BUF_SIZE 0x3FC000
1043#elif defined(CONFIG_FB_MSM_TVOUT)
1044/* tvout = 720 x 576 x 2(bpp) x 2(pages) */
1045#define MSM_FB_EXT_BUF_SIZE 0x195000
1046#else /* CONFIG_FB_MSM_HDMI_MSM_PANEL */
1047#define MSM_FB_EXT_BUF_SIZE 0
1048#endif /* CONFIG_FB_MSM_HDMI_MSM_PANEL */
1049
1050#define MSM_FB_SIZE roundup(MSM_FB_PRIM_BUF_SIZE + MSM_FB_EXT_BUF_SIZE +\
1051 MIPI_DSI_WRITEBACK_SIZE, 4096)
1052
1053#define MDP_VSYNC_GPIO 0
1054
1055static struct resource msm_fb_resources[] = {
1056 {
1057 .flags = IORESOURCE_DMA,
1058 }
1059};
1060
1061static struct platform_device msm_fb_device = {
1062 .name = "msm_fb",
1063 .id = 0,
1064 .num_resources = ARRAY_SIZE(msm_fb_resources),
1065 .resource = msm_fb_resources,
1066};
1067
1068static bool dsi_power_on;
1069
1070static int mipi_dsi_panel_power(int on)
1071{
1072 static struct regulator *reg_l8, *reg_l23, *reg_l2;
Nagamalleswararao Ganjieac5dfa2011-07-23 17:31:16 -07001073 static int gpio43;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001074 int rc;
1075
1076 struct pm_gpio gpio43_param = {
1077 .direction = PM_GPIO_DIR_OUT,
1078 .output_buffer = PM_GPIO_OUT_BUF_CMOS,
1079 .output_value = 0,
1080 .pull = PM_GPIO_PULL_NO,
1081 .vin_sel = 2,
1082 .out_strength = PM_GPIO_STRENGTH_HIGH,
1083 .function = PM_GPIO_FUNC_PAIRED,
1084 .inv_int_pol = 0,
1085 .disable_pin = 0,
1086 };
1087
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001088 pr_info("%s: state : %d\n", __func__, on);
1089
1090 if (!dsi_power_on) {
1091
1092 reg_l8 = regulator_get(&msm_mipi_dsi1_device.dev,
1093 "dsi_vdc");
1094 if (IS_ERR(reg_l8)) {
1095 pr_err("could not get 8921_l8, rc = %ld\n",
1096 PTR_ERR(reg_l8));
1097 return -ENODEV;
1098 }
1099
1100 reg_l23 = regulator_get(&msm_mipi_dsi1_device.dev,
1101 "dsi_vddio");
1102 if (IS_ERR(reg_l23)) {
1103 pr_err("could not get 8921_l23, rc = %ld\n",
1104 PTR_ERR(reg_l23));
1105 return -ENODEV;
1106 }
1107
1108 reg_l2 = regulator_get(&msm_mipi_dsi1_device.dev,
1109 "dsi_vdda");
1110 if (IS_ERR(reg_l2)) {
1111 pr_err("could not get 8921_l2, rc = %ld\n",
1112 PTR_ERR(reg_l2));
1113 return -ENODEV;
1114 }
1115
1116 rc = regulator_set_voltage(reg_l8, 2800000, 3000000);
1117 if (rc) {
1118 pr_err("set_voltage l8 failed, rc=%d\n", rc);
1119 return -EINVAL;
1120 }
1121 rc = regulator_set_voltage(reg_l23, 1800000, 1800000);
1122 if (rc) {
1123 pr_err("set_voltage l23 failed, rc=%d\n", rc);
1124 return -EINVAL;
1125 }
1126 rc = regulator_set_voltage(reg_l2, 1200000, 1200000);
1127 if (rc) {
1128 pr_err("set_voltage l2 failed, rc=%d\n", rc);
1129 return -EINVAL;
1130 }
1131
1132 gpio43 = PM8921_GPIO_PM_TO_SYS(43);
1133 rc = gpio_request(gpio43, "disp_rst_n");
1134 if (rc) {
1135 pr_err("request gpio 43 failed, rc=%d\n", rc);
1136 return -ENODEV;
1137 }
1138
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001139 dsi_power_on = true;
1140 }
1141
1142 if (on) {
1143 rc = regulator_set_optimum_mode(reg_l8, 100000);
1144 if (rc < 0) {
1145 pr_err("set_optimum_mode l8 failed, rc=%d\n", rc);
1146 return -EINVAL;
1147 }
1148 rc = regulator_set_optimum_mode(reg_l23, 100000);
1149 if (rc < 0) {
1150 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
1151 return -EINVAL;
1152 }
1153 rc = regulator_set_optimum_mode(reg_l2, 100000);
1154 if (rc < 0) {
1155 pr_err("set_optimum_mode l2 failed, rc=%d\n", rc);
1156 return -EINVAL;
1157 }
1158 rc = regulator_enable(reg_l8);
1159 if (rc) {
1160 pr_err("enable l8 failed, rc=%d\n", rc);
1161 return -ENODEV;
1162 }
1163 rc = regulator_enable(reg_l23);
1164 if (rc) {
1165 pr_err("enable l8 failed, rc=%d\n", rc);
1166 return -ENODEV;
1167 }
1168 rc = regulator_enable(reg_l2);
1169 if (rc) {
1170 pr_err("enable l2 failed, rc=%d\n", rc);
1171 return -ENODEV;
1172 }
1173
1174 gpio43_param.pull = PM_GPIO_PULL_NO;
1175 rc = pm8xxx_gpio_config(gpio43, &gpio43_param);
1176 if (rc) {
1177 pr_err("gpio_config 43 failed (1), rc=%d\n", rc);
1178 return -EINVAL;
1179 }
1180 gpio43_param.pull = PM_GPIO_PULL_UP_30;
1181 rc = pm8xxx_gpio_config(gpio43, &gpio43_param);
1182 if (rc) {
1183 pr_err("gpio_config 43 failed (2), rc=%d\n", rc);
1184 return -EINVAL;
1185 }
1186 gpio43_param.pull = PM_GPIO_PULL_NO;
1187 rc = pm8xxx_gpio_config(gpio43, &gpio43_param);
1188 if (rc) {
1189 pr_err("gpio_config 43 failed (3), rc=%d\n", rc);
1190 return -EINVAL;
1191 }
1192 gpio43_param.pull = PM_GPIO_PULL_UP_30;
1193 rc = pm8xxx_gpio_config(gpio43, &gpio43_param);
1194 if (rc) {
1195 pr_err("gpio_config 43 failed (4), rc=%d\n", rc);
1196 return -EINVAL;
1197 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001198 gpio_set_value_cansleep(gpio43, 1);
1199 } else {
1200 rc = regulator_set_optimum_mode(reg_l8, 100);
1201 if (rc < 0) {
1202 pr_err("set_optimum_mode l8 failed, rc=%d\n", rc);
1203 return -EINVAL;
1204 }
1205 rc = regulator_set_optimum_mode(reg_l23, 100);
1206 if (rc < 0) {
1207 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
1208 return -EINVAL;
1209 }
1210 rc = regulator_set_optimum_mode(reg_l2, 100);
1211 if (rc < 0) {
1212 pr_err("set_optimum_mode l2 failed, rc=%d\n", rc);
1213 return -EINVAL;
1214 }
1215 gpio_set_value_cansleep(gpio43, 0);
1216 }
1217 return 0;
1218}
1219
1220static struct mipi_dsi_platform_data mipi_dsi_pdata = {
1221 .vsync_gpio = MDP_VSYNC_GPIO,
1222 .dsi_power_save = mipi_dsi_panel_power,
1223};
1224
1225#ifdef CONFIG_MSM_BUS_SCALING
1226
1227static struct msm_bus_vectors mdp_init_vectors[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001228 {
1229 .src = MSM_BUS_MASTER_MDP_PORT0,
1230 .dst = MSM_BUS_SLAVE_EBI_CH0,
1231 .ab = 0,
1232 .ib = 0,
1233 },
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001234};
1235
1236static struct msm_bus_vectors mdp_ui_vectors[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001237 {
1238 .src = MSM_BUS_MASTER_MDP_PORT0,
1239 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001240 .ab = 216000000 * 2,
1241 .ib = 270000000 * 2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001242 },
1243};
1244
1245static struct msm_bus_vectors mdp_vga_vectors[] = {
1246 /* VGA and less video */
1247 {
1248 .src = MSM_BUS_MASTER_MDP_PORT0,
1249 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001250 .ab = 216000000 * 2,
1251 .ib = 270000000 * 2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001252 },
1253};
1254
1255static struct msm_bus_vectors mdp_720p_vectors[] = {
1256 /* 720p and less video */
1257 {
1258 .src = MSM_BUS_MASTER_MDP_PORT0,
1259 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001260 .ab = 230400000 * 2,
1261 .ib = 288000000 * 2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001262 },
1263};
1264
1265static struct msm_bus_vectors mdp_1080p_vectors[] = {
1266 /* 1080p and less video */
1267 {
1268 .src = MSM_BUS_MASTER_MDP_PORT0,
1269 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001270 .ab = 334080000 * 2,
1271 .ib = 417600000 * 2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001272 },
1273};
1274
1275static struct msm_bus_paths mdp_bus_scale_usecases[] = {
1276 {
1277 ARRAY_SIZE(mdp_init_vectors),
1278 mdp_init_vectors,
1279 },
1280 {
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001281 ARRAY_SIZE(mdp_ui_vectors),
1282 mdp_ui_vectors,
1283 },
1284 {
1285 ARRAY_SIZE(mdp_ui_vectors),
1286 mdp_ui_vectors,
1287 },
1288 {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001289 ARRAY_SIZE(mdp_vga_vectors),
1290 mdp_vga_vectors,
1291 },
1292 {
1293 ARRAY_SIZE(mdp_720p_vectors),
1294 mdp_720p_vectors,
1295 },
1296 {
1297 ARRAY_SIZE(mdp_1080p_vectors),
1298 mdp_1080p_vectors,
1299 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001300};
1301
1302static struct msm_bus_scale_pdata mdp_bus_scale_pdata = {
1303 mdp_bus_scale_usecases,
1304 ARRAY_SIZE(mdp_bus_scale_usecases),
1305 .name = "mdp",
1306};
1307
1308#endif
1309
1310int mdp_core_clk_rate_table[] = {
1311 85330000,
1312 85330000,
1313 128000000,
1314 200000000,
1315 200000000,
1316};
1317
1318static struct msm_panel_common_pdata mdp_pdata = {
1319 .gpio = MDP_VSYNC_GPIO,
1320 .mdp_core_clk_rate = 85330000,
1321 .mdp_core_clk_table = mdp_core_clk_rate_table,
1322 .num_mdp_clk = ARRAY_SIZE(mdp_core_clk_rate_table),
1323#ifdef CONFIG_MSM_BUS_SCALING
1324 .mdp_bus_scale_table = &mdp_bus_scale_pdata,
1325#endif
1326 .mdp_rev = MDP_REV_42,
1327};
1328
1329static struct platform_device mipi_dsi_renesas_panel_device = {
1330 .name = "mipi_renesas",
1331 .id = 0,
1332};
1333
1334static struct platform_device mipi_dsi_simulator_panel_device = {
1335 .name = "mipi_simulator",
1336 .id = 0,
1337};
1338
Nagamalleswararao Ganjieac5dfa2011-07-23 17:31:16 -07001339#define LPM_CHANNEL0 0
1340static int toshiba_gpio[] = {LPM_CHANNEL0};
1341
1342static struct mipi_dsi_panel_platform_data toshiba_pdata = {
1343 .gpio = toshiba_gpio,
1344};
1345
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001346static struct platform_device mipi_dsi_toshiba_panel_device = {
1347 .name = "mipi_toshiba",
1348 .id = 0,
Nagamalleswararao Ganjieac5dfa2011-07-23 17:31:16 -07001349 .dev = {
1350 .platform_data = &toshiba_pdata,
1351 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001352};
1353
1354#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
1355static struct resource hdmi_msm_resources[] = {
1356 {
1357 .name = "hdmi_msm_qfprom_addr",
1358 .start = 0x00700000,
1359 .end = 0x007060FF,
1360 .flags = IORESOURCE_MEM,
1361 },
1362 {
1363 .name = "hdmi_msm_hdmi_addr",
1364 .start = 0x04A00000,
1365 .end = 0x04A00FFF,
1366 .flags = IORESOURCE_MEM,
1367 },
1368 {
1369 .name = "hdmi_msm_irq",
1370 .start = HDMI_IRQ,
1371 .end = HDMI_IRQ,
1372 .flags = IORESOURCE_IRQ,
1373 },
1374};
1375
1376static int hdmi_enable_5v(int on);
1377static int hdmi_core_power(int on, int show);
1378static int hdmi_cec_power(int on);
1379
1380static struct msm_hdmi_platform_data hdmi_msm_data = {
1381 .irq = HDMI_IRQ,
1382 .enable_5v = hdmi_enable_5v,
1383 .core_power = hdmi_core_power,
1384 .cec_power = hdmi_cec_power,
1385};
1386
1387static struct platform_device hdmi_msm_device = {
1388 .name = "hdmi_msm",
1389 .id = 0,
1390 .num_resources = ARRAY_SIZE(hdmi_msm_resources),
1391 .resource = hdmi_msm_resources,
1392 .dev.platform_data = &hdmi_msm_data,
1393};
1394#endif /* CONFIG_FB_MSM_HDMI_MSM_PANEL */
1395
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001396#ifdef CONFIG_MSM_BUS_SCALING
1397static struct msm_bus_vectors dtv_bus_init_vectors[] = {
1398 {
1399 .src = MSM_BUS_MASTER_MDP_PORT0,
1400 .dst = MSM_BUS_SLAVE_EBI_CH0,
1401 .ab = 0,
1402 .ib = 0,
1403 },
1404};
1405static struct msm_bus_vectors dtv_bus_def_vectors[] = {
1406 {
1407 .src = MSM_BUS_MASTER_MDP_PORT0,
1408 .dst = MSM_BUS_SLAVE_EBI_CH0,
1409 .ab = 566092800 * 2,
1410 .ib = 707616000 * 2,
1411 },
1412};
1413static struct msm_bus_paths dtv_bus_scale_usecases[] = {
1414 {
1415 ARRAY_SIZE(dtv_bus_init_vectors),
1416 dtv_bus_init_vectors,
1417 },
1418 {
1419 ARRAY_SIZE(dtv_bus_def_vectors),
1420 dtv_bus_def_vectors,
1421 },
1422};
1423static struct msm_bus_scale_pdata dtv_bus_scale_pdata = {
1424 dtv_bus_scale_usecases,
1425 ARRAY_SIZE(dtv_bus_scale_usecases),
1426 .name = "dtv",
1427};
1428
1429static struct lcdc_platform_data dtv_pdata = {
1430 .bus_scale_table = &dtv_bus_scale_pdata,
1431};
1432#endif
1433
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001434static void __init msm_fb_add_devices(void)
1435{
1436 if (machine_is_msm8x60_rumi3()) {
1437 msm_fb_register_device("mdp", NULL);
1438 mipi_dsi_pdata.target_type = 1;
1439 } else
1440 msm_fb_register_device("mdp", &mdp_pdata);
1441 msm_fb_register_device("mipi_dsi", &mipi_dsi_pdata);
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001442#ifdef CONFIG_MSM_BUS_SCALING
1443 msm_fb_register_device("dtv", &dtv_pdata);
1444#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001445}
1446
Ravishangar Kalyanamba99e512011-07-20 12:57:19 -07001447static struct gpiomux_setting mdp_vsync_suspend_cfg = {
1448 .func = GPIOMUX_FUNC_GPIO,
1449 .drv = GPIOMUX_DRV_2MA,
1450 .pull = GPIOMUX_PULL_DOWN,
1451};
1452
1453static struct gpiomux_setting mdp_vsync_active_cfg = {
1454 .func = GPIOMUX_FUNC_1,
1455 .drv = GPIOMUX_DRV_2MA,
1456 .pull = GPIOMUX_PULL_DOWN,
1457};
1458
1459static struct msm_gpiomux_config msm8960_mdp_vsync_configs[] __initdata = {
1460 {
1461 .gpio = MDP_VSYNC_GPIO,
1462 .settings = {
1463 [GPIOMUX_ACTIVE] = &mdp_vsync_active_cfg,
1464 [GPIOMUX_SUSPENDED] = &mdp_vsync_suspend_cfg,
1465 },
1466 }
1467};
1468
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001469#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
1470static struct gpiomux_setting hdmi_suspend_cfg = {
1471 .func = GPIOMUX_FUNC_GPIO,
1472 .drv = GPIOMUX_DRV_2MA,
1473 .pull = GPIOMUX_PULL_DOWN,
1474};
1475
1476static struct gpiomux_setting hdmi_active_1_cfg = {
1477 .func = GPIOMUX_FUNC_1,
1478 .drv = GPIOMUX_DRV_2MA,
1479 .pull = GPIOMUX_PULL_UP,
1480};
1481
1482static struct gpiomux_setting hdmi_active_2_cfg = {
1483 .func = GPIOMUX_FUNC_1,
1484 .drv = GPIOMUX_DRV_2MA,
1485 .pull = GPIOMUX_PULL_DOWN,
1486};
1487
1488static struct msm_gpiomux_config msm8960_hdmi_configs[] __initdata = {
1489 {
1490 .gpio = 99,
1491 .settings = {
1492 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
1493 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
1494 },
1495 },
1496 {
1497 .gpio = 100,
1498 .settings = {
1499 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
1500 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
1501 },
1502 },
1503 {
1504 .gpio = 101,
1505 .settings = {
1506 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
1507 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
1508 },
1509 },
1510 {
1511 .gpio = 102,
1512 .settings = {
1513 [GPIOMUX_ACTIVE] = &hdmi_active_2_cfg,
1514 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
1515 },
1516 },
1517};
1518
1519static int hdmi_enable_5v(int on)
1520{
1521 /* TBD: PM8921 regulator instead of 8901 */
1522 static struct regulator *reg_8921_hdmi_mvs; /* HDMI_5V */
1523 static int prev_on;
1524 int rc;
1525
1526 if (on == prev_on)
1527 return 0;
1528
1529 if (!reg_8921_hdmi_mvs)
1530 reg_8921_hdmi_mvs = regulator_get(&hdmi_msm_device.dev,
1531 "hdmi_mvs");
1532
1533 if (on) {
1534 rc = regulator_enable(reg_8921_hdmi_mvs);
1535 if (rc) {
1536 pr_err("'%s' regulator enable failed, rc=%d\n",
1537 "8921_hdmi_mvs", rc);
1538 return rc;
1539 }
1540 pr_debug("%s(on): success\n", __func__);
1541 } else {
1542 rc = regulator_disable(reg_8921_hdmi_mvs);
1543 if (rc)
1544 pr_warning("'%s' regulator disable failed, rc=%d\n",
1545 "8921_hdmi_mvs", rc);
1546 pr_debug("%s(off): success\n", __func__);
1547 }
1548
1549 prev_on = on;
1550
1551 return 0;
1552}
1553
1554static int hdmi_core_power(int on, int show)
1555{
1556 static struct regulator *reg_8921_l23, *reg_8921_s4;
1557 static int prev_on;
1558 int rc;
1559
1560 if (on == prev_on)
1561 return 0;
1562
1563 /* TBD: PM8921 regulator instead of 8901 */
1564 if (!reg_8921_l23)
1565 reg_8921_l23 = regulator_get(&hdmi_msm_device.dev, "hdmi_avdd");
1566
1567 if (!reg_8921_s4)
1568 reg_8921_s4 = regulator_get(&hdmi_msm_device.dev, "hdmi_vcc");
1569
1570 if (on) {
1571 rc = regulator_set_optimum_mode(reg_8921_l23, 100000);
1572 if (rc < 0) {
1573 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
1574 return -EINVAL;
1575 }
1576
1577 rc = regulator_set_voltage(reg_8921_l23, 1800000, 1800000);
1578 if (!rc)
1579 rc = regulator_enable(reg_8921_l23);
1580 if (rc) {
1581 pr_err("'%s' regulator enable failed, rc=%d\n",
1582 "hdmi_avdd", rc);
1583 return rc;
1584 }
1585 rc = regulator_set_voltage(reg_8921_s4, 1800000, 1800000);
1586 if (!rc)
1587 rc = regulator_enable(reg_8921_s4);
1588 if (rc) {
1589 pr_err("'%s' regulator enable failed, rc=%d\n",
1590 "hdmi_vcc", rc);
1591 return rc;
1592 }
1593
1594 rc = gpio_request(100, "HDMI_DDC_CLK");
1595 if (rc) {
1596 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
1597 "HDMI_DDC_CLK", 100, rc);
1598 goto error1;
1599 }
1600 rc = gpio_request(101, "HDMI_DDC_DATA");
1601 if (rc) {
1602 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
1603 "HDMI_DDC_DATA", 101, rc);
1604 goto error2;
1605 }
1606 rc = gpio_request(102, "HDMI_HPD");
1607 if (rc) {
1608 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
1609 "HDMI_HPD", 102, rc);
1610 goto error3;
1611 }
1612 pr_debug("%s(on): success\n", __func__);
1613 } else {
1614 gpio_free(100);
1615 gpio_free(101);
1616 gpio_free(102);
1617
1618 rc = regulator_set_optimum_mode(reg_8921_l23, 100);
1619 if (rc < 0) {
1620 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
1621 return -EINVAL;
1622 }
1623
1624 pr_debug("%s(off): success\n", __func__);
1625 }
1626
1627 prev_on = on;
1628
1629 return 0;
1630
1631error3:
1632 gpio_free(101);
1633error2:
1634 gpio_free(100);
1635error1:
1636 regulator_disable(reg_8921_l23);
1637 return rc;
1638}
1639
1640static int hdmi_cec_power(int on)
1641{
1642 static int prev_on;
1643 int rc;
1644
1645 if (on == prev_on)
1646 return 0;
1647
1648 if (on) {
1649 rc = gpio_request(99, "HDMI_CEC_VAR");
1650 if (rc) {
1651 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
1652 "HDMI_CEC_VAR", 99, rc);
1653 goto error;
1654 }
1655 pr_debug("%s(on): success\n", __func__);
1656 } else {
1657 gpio_free(99);
1658 pr_debug("%s(off): success\n", __func__);
1659 }
1660
1661 prev_on = on;
1662
1663 return 0;
1664error:
1665 return rc;
1666}
1667#endif /* CONFIG_FB_MSM_HDMI_MSM_PANEL */
1668
1669static void __init msm8960_allocate_memory_regions(void)
1670{
1671 void *addr;
1672 unsigned long size;
1673
1674 size = MSM_FB_SIZE;
1675 addr = alloc_bootmem_align(size, 0x1000);
1676 msm_fb_resources[0].start = __pa(addr);
1677 msm_fb_resources[0].end = msm_fb_resources[0].start + size - 1;
1678 pr_info("allocating %lu bytes at %p (%lx physical) for fb\n",
1679 size, addr, __pa(addr));
1680
1681}
1682#ifdef CONFIG_WCD9310_CODEC
1683
1684#define TABLA_INTERRUPT_BASE (NR_MSM_IRQS + NR_GPIO_IRQS + NR_PM8921_IRQS)
1685
1686static struct tabla_pdata tabla_platform_data = {
1687 .slimbus_slave_device = {
1688 .name = "tabla-slave",
1689 .e_addr = {0, 0, 0x10, 0, 0x17, 2},
1690 },
1691 .irq = MSM_GPIO_TO_INT(62),
1692 .irq_base = TABLA_INTERRUPT_BASE,
1693 .num_irqs = NR_TABLA_IRQS,
1694 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
1695};
1696
1697static struct slim_device msm_slim_tabla = {
1698 .name = "tabla-slim",
1699 .e_addr = {0, 1, 0x10, 0, 0x17, 2},
1700 .dev = {
1701 .platform_data = &tabla_platform_data,
1702 },
1703};
1704#endif
1705
1706static struct slim_boardinfo msm_slim_devices[] = {
1707#ifdef CONFIG_WCD9310_CODEC
1708 {
1709 .bus_num = 1,
1710 .slim_slave = &msm_slim_tabla,
1711 },
1712#endif
1713 /* add more slimbus slaves as needed */
1714};
1715
Yunsen Wang5c1a7392011-07-09 19:10:16 -07001716#define MSM_WCNSS_PHYS 0x03000000
1717#define MSM_WCNSS_SIZE 0x280000
1718
1719static struct resource resources_wcnss_wlan[] = {
1720 {
1721 .start = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
1722 .end = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
1723 .name = "wcnss_wlanrx_irq",
1724 .flags = IORESOURCE_IRQ,
1725 },
1726 {
1727 .start = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
1728 .end = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
1729 .name = "wcnss_wlantx_irq",
1730 .flags = IORESOURCE_IRQ,
1731 },
1732 {
1733 .start = MSM_WCNSS_PHYS,
1734 .end = MSM_WCNSS_PHYS + MSM_WCNSS_SIZE - 1,
1735 .name = "wcnss_mmio",
1736 .flags = IORESOURCE_MEM,
1737 },
1738};
1739
1740static struct platform_device msm_device_wcnss_wlan = {
1741 .name = "wcnss_wlan",
1742 .id = 0,
1743 .num_resources = ARRAY_SIZE(resources_wcnss_wlan),
1744 .resource = resources_wcnss_wlan,
1745};
1746
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001747#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1748 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
1749 defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1750 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1751
1752#define QCE_SIZE 0x10000
1753#define QCE_0_BASE 0x18500000
1754
1755#define QCE_HW_KEY_SUPPORT 0
1756#define QCE_SHA_HMAC_SUPPORT 1
1757#define QCE_SHARE_CE_RESOURCE 1
1758#define QCE_CE_SHARED 0
1759
1760static struct resource qcrypto_resources[] = {
1761 [0] = {
1762 .start = QCE_0_BASE,
1763 .end = QCE_0_BASE + QCE_SIZE - 1,
1764 .flags = IORESOURCE_MEM,
1765 },
1766 [1] = {
1767 .name = "crypto_channels",
1768 .start = DMOV_CE_IN_CHAN,
1769 .end = DMOV_CE_OUT_CHAN,
1770 .flags = IORESOURCE_DMA,
1771 },
1772 [2] = {
1773 .name = "crypto_crci_in",
1774 .start = DMOV_CE_IN_CRCI,
1775 .end = DMOV_CE_IN_CRCI,
1776 .flags = IORESOURCE_DMA,
1777 },
1778 [3] = {
1779 .name = "crypto_crci_out",
1780 .start = DMOV_CE_OUT_CRCI,
1781 .end = DMOV_CE_OUT_CRCI,
1782 .flags = IORESOURCE_DMA,
1783 },
1784};
1785
1786static struct resource qcedev_resources[] = {
1787 [0] = {
1788 .start = QCE_0_BASE,
1789 .end = QCE_0_BASE + QCE_SIZE - 1,
1790 .flags = IORESOURCE_MEM,
1791 },
1792 [1] = {
1793 .name = "crypto_channels",
1794 .start = DMOV_CE_IN_CHAN,
1795 .end = DMOV_CE_OUT_CHAN,
1796 .flags = IORESOURCE_DMA,
1797 },
1798 [2] = {
1799 .name = "crypto_crci_in",
1800 .start = DMOV_CE_IN_CRCI,
1801 .end = DMOV_CE_IN_CRCI,
1802 .flags = IORESOURCE_DMA,
1803 },
1804 [3] = {
1805 .name = "crypto_crci_out",
1806 .start = DMOV_CE_OUT_CRCI,
1807 .end = DMOV_CE_OUT_CRCI,
1808 .flags = IORESOURCE_DMA,
1809 },
1810};
1811
1812#endif
1813
1814#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1815 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
1816
1817static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
1818 .ce_shared = QCE_CE_SHARED,
1819 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
1820 .hw_key_support = QCE_HW_KEY_SUPPORT,
1821 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
1822};
1823
1824static struct platform_device qcrypto_device = {
1825 .name = "qcrypto",
1826 .id = 0,
1827 .num_resources = ARRAY_SIZE(qcrypto_resources),
1828 .resource = qcrypto_resources,
1829 .dev = {
1830 .coherent_dma_mask = DMA_BIT_MASK(32),
1831 .platform_data = &qcrypto_ce_hw_suppport,
1832 },
1833};
1834#endif
1835
1836#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1837 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1838
1839static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
1840 .ce_shared = QCE_CE_SHARED,
1841 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
1842 .hw_key_support = QCE_HW_KEY_SUPPORT,
1843 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
1844};
1845
1846static struct platform_device qcedev_device = {
1847 .name = "qce",
1848 .id = 0,
1849 .num_resources = ARRAY_SIZE(qcedev_resources),
1850 .resource = qcedev_resources,
1851 .dev = {
1852 .coherent_dma_mask = DMA_BIT_MASK(32),
1853 .platform_data = &qcedev_ce_hw_suppport,
1854 },
1855};
1856#endif
1857
1858
1859static int __init gpiomux_init(void)
1860{
1861 int rc;
1862
1863 rc = msm_gpiomux_init(NR_GPIO_IRQS);
1864 if (rc) {
1865 pr_err(KERN_ERR "msm_gpiomux_init failed %d\n", rc);
1866 return rc;
1867 }
1868
1869 msm_gpiomux_install(msm8960_cam_configs,
1870 ARRAY_SIZE(msm8960_cam_configs));
1871
1872 msm_gpiomux_install(msm8960_gpiomux_configs,
Stepan Moskovchenkod2a45a82011-08-09 17:02:57 -07001873 ARRAY_SIZE(msm8960_gpiomux_configs));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001874
1875 msm_gpiomux_install(msm8960_gsbi_configs,
1876 ARRAY_SIZE(msm8960_gsbi_configs));
1877
1878 msm_gpiomux_install(msm8960_cyts_configs,
1879 ARRAY_SIZE(msm8960_cyts_configs));
1880
1881 msm_gpiomux_install(msm8960_slimbus_config,
1882 ARRAY_SIZE(msm8960_slimbus_config));
1883
1884 msm_gpiomux_install(msm8960_audio_codec_configs,
1885 ARRAY_SIZE(msm8960_audio_codec_configs));
1886
1887#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
1888 msm_gpiomux_install(msm8960_hdmi_configs,
1889 ARRAY_SIZE(msm8960_hdmi_configs));
1890#endif
1891
Ravishangar Kalyanamba99e512011-07-20 12:57:19 -07001892 msm_gpiomux_install(msm8960_mdp_vsync_configs,
1893 ARRAY_SIZE(msm8960_mdp_vsync_configs));
1894
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001895 msm_gpiomux_install(wcnss_5wire_interface,
1896 ARRAY_SIZE(wcnss_5wire_interface));
1897
1898 return 0;
1899}
1900
1901static struct msm_acpu_clock_platform_data msm8960_acpu_clock_data = {
1902 .acpu_switch_time_us = 0,
1903 .vdd_switch_time_us = 0,
1904};
1905
1906#define MSM_SHARED_RAM_PHYS 0x80000000
1907
1908static struct pm8921_adc_amux pm8921_adc_channels_data[] = {
1909 {"vcoin", CHANNEL_VCOIN, CHAN_PATH_SCALING2, AMUX_RSV1,
1910 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
1911 {"vbat", CHANNEL_VBAT, CHAN_PATH_SCALING2, AMUX_RSV1,
1912 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
1913 {"dcin", CHANNEL_DCIN, CHAN_PATH_SCALING4, AMUX_RSV1,
1914 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
1915 {"ichg", CHANNEL_ICHG, CHAN_PATH_SCALING1, AMUX_RSV1,
1916 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
1917 {"vph_pwr", CHANNEL_VPH_PWR, CHAN_PATH_SCALING2, AMUX_RSV1,
1918 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
1919 {"ibat", CHANNEL_IBAT, CHAN_PATH_SCALING1, AMUX_RSV1,
1920 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
1921 {"m4", CHANNEL_MPP_1, CHAN_PATH_SCALING1, AMUX_RSV1,
1922 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
1923 {"m5", CHANNEL_MPP_2, CHAN_PATH_SCALING2, AMUX_RSV1,
1924 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
1925 {"batt_therm", CHANNEL_BATT_THERM, CHAN_PATH_SCALING1, AMUX_RSV2,
1926 ADC_DECIMATION_TYPE2, ADC_SCALE_BATT_THERM},
1927 {"batt_id", CHANNEL_BATT_ID, CHAN_PATH_SCALING1, AMUX_RSV1,
1928 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
1929 {"usbin", CHANNEL_USBIN, CHAN_PATH_SCALING3, AMUX_RSV1,
1930 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
1931 {"pmic_therm", CHANNEL_DIE_TEMP, CHAN_PATH_SCALING1, AMUX_RSV1,
1932 ADC_DECIMATION_TYPE2, ADC_SCALE_PMIC_THERM},
1933 {"625mv", CHANNEL_625MV, CHAN_PATH_SCALING1, AMUX_RSV1,
1934 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
1935 {"125v", CHANNEL_125V, CHAN_PATH_SCALING1, AMUX_RSV1,
1936 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
1937 {"chg_temp", CHANNEL_CHG_TEMP, CHAN_PATH_SCALING1, AMUX_RSV1,
1938 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
1939};
1940
1941static struct pm8921_adc_properties pm8921_adc_data = {
1942 .adc_vdd_reference = 1800, /* milli-voltage for this adc */
1943 .bitresolution = 15,
1944 .bipolar = 0,
1945};
1946
1947static struct pm8921_adc_platform_data pm8921_adc_pdata = {
1948 .adc_channel = pm8921_adc_channels_data,
1949 .adc_num_channel = ARRAY_SIZE(pm8921_adc_channels_data),
1950 .adc_prop = &pm8921_adc_data,
1951};
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08001952
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001953static void __init msm8960_map_io(void)
1954{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001955 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001956 msm_map_msm8960_io();
1957}
1958
1959static void __init msm8960_init_irq(void)
1960{
1961 unsigned int i;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001962
1963 msm_mpm_irq_extn_init();
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001964 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001965 (void *)MSM_QGIC_CPU_BASE);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001966
1967 /* Edge trigger PPIs except AVS_SVICINT and AVS_SVICINTSWDONE */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001968 writel_relaxed(0xFFFFD7FF, MSM_QGIC_DIST_BASE + GIC_DIST_CONFIG + 4);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001969
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001970 writel_relaxed(0x0000FFFF, MSM_QGIC_DIST_BASE + GIC_DIST_ENABLE_SET);
1971 mb();
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08001972
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001973 /* FIXME: Not installing AVS_SVICINT and AVS_SVICINTSWDONE yet
1974 * as they are configured as level, which does not play nice with
1975 * handle_percpu_irq.
1976 */
1977 for (i = GIC_PPI_START; i < GIC_SPI_START; i++) {
1978 if (i != AVS_SVICINT && i != AVS_SVICINTSWDONE)
Thomas Gleixner6845664a2011-03-24 13:25:22 +01001979 irq_set_handler(i, handle_percpu_irq);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001980 }
1981}
1982
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001983/* MSM8960 have 5 SDCC controllers */
1984enum sdcc_controllers {
1985 SDCC1,
1986 SDCC2,
1987 SDCC3,
1988 SDCC4,
1989 SDCC5,
1990 MAX_SDCC_CONTROLLER
1991};
1992
1993/* All SDCC controllers requires VDD/VCC voltage */
1994static struct msm_mmc_reg_data mmc_vdd_reg_data[MAX_SDCC_CONTROLLER] = {
1995 /* SDCC1 : eMMC card connected */
1996 [SDCC1] = {
1997 .name = "sdc_vdd",
1998 .set_voltage_sup = 1,
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05301999 .high_vol_level = 2950000,
2000 .low_vol_level = 2950000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002001 .hpm_uA = 200000, /* 200mA */
2002 },
2003 /* SDCC3 : External card slot connected */
2004 [SDCC3] = {
2005 .name = "sdc_vdd",
2006 .set_voltage_sup = 1,
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05302007 .high_vol_level = 2950000,
2008 .low_vol_level = 2950000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002009 .hpm_uA = 600000, /* 600mA */
2010 }
2011};
2012
2013/* Only slots having eMMC card will require VCCQ voltage */
2014static struct msm_mmc_reg_data mmc_vccq_reg_data[1] = {
2015 /* SDCC1 : eMMC card connected */
2016 [SDCC1] = {
2017 .name = "sdc_vccq",
2018 .set_voltage_sup = 1,
2019 .always_on = 1,
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05302020 .high_vol_level = 1800000,
2021 .low_vol_level = 1800000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002022 .hpm_uA = 200000, /* 200mA */
2023 }
2024};
2025
2026/* All SDCC controllers may require voting for VDD PAD voltage */
2027static struct msm_mmc_reg_data mmc_vddp_reg_data[MAX_SDCC_CONTROLLER] = {
2028 /* SDCC3 : External card slot connected */
2029 [SDCC3] = {
2030 .name = "sdc_vddp",
2031 .set_voltage_sup = 1,
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05302032 .high_vol_level = 2950000,
2033 .low_vol_level = 1850000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002034 .always_on = 1,
2035 .lpm_sup = 1,
2036 /* Max. Active current required is 16 mA */
2037 .hpm_uA = 16000,
2038 /*
2039 * Sleep current required is ~300 uA. But min. vote can be
2040 * in terms of mA (min. 1 mA). So let's vote for 2 mA
2041 * during sleep.
2042 */
2043 .lpm_uA = 2000,
2044 }
2045};
2046
2047static struct msm_mmc_slot_reg_data mmc_slot_vreg_data[MAX_SDCC_CONTROLLER] = {
2048 /* SDCC1 : eMMC card connected */
2049 [SDCC1] = {
2050 .vdd_data = &mmc_vdd_reg_data[SDCC1],
2051 .vccq_data = &mmc_vccq_reg_data[SDCC1],
2052 },
2053 /* SDCC3 : External card slot connected */
2054 [SDCC3] = {
2055 .vdd_data = &mmc_vdd_reg_data[SDCC3],
2056 .vddp_data = &mmc_vddp_reg_data[SDCC3],
2057 }
2058};
2059
2060/* SDC1 pad data */
2061static struct msm_mmc_pad_drv sdc1_pad_drv_on_cfg[] = {
2062 {TLMM_HDRV_SDC1_CLK, GPIO_CFG_16MA},
2063 {TLMM_HDRV_SDC1_CMD, GPIO_CFG_10MA},
2064 {TLMM_HDRV_SDC1_DATA, GPIO_CFG_10MA}
2065};
2066
2067static struct msm_mmc_pad_drv sdc1_pad_drv_off_cfg[] = {
2068 {TLMM_HDRV_SDC1_CLK, GPIO_CFG_2MA},
2069 {TLMM_HDRV_SDC1_CMD, GPIO_CFG_2MA},
2070 {TLMM_HDRV_SDC1_DATA, GPIO_CFG_2MA}
2071};
2072
2073static struct msm_mmc_pad_pull sdc1_pad_pull_on_cfg[] = {
2074 {TLMM_PULL_SDC1_CMD, GPIO_CFG_PULL_UP},
2075 {TLMM_PULL_SDC1_DATA, GPIO_CFG_PULL_UP}
2076};
2077
2078static struct msm_mmc_pad_pull sdc1_pad_pull_off_cfg[] = {
2079 {TLMM_PULL_SDC1_CMD, GPIO_CFG_PULL_DOWN},
2080 {TLMM_PULL_SDC1_DATA, GPIO_CFG_PULL_DOWN}
2081};
2082
2083/* SDC3 pad data */
2084static struct msm_mmc_pad_drv sdc3_pad_drv_on_cfg[] = {
2085 {TLMM_HDRV_SDC3_CLK, GPIO_CFG_8MA},
2086 {TLMM_HDRV_SDC3_CMD, GPIO_CFG_8MA},
2087 {TLMM_HDRV_SDC3_DATA, GPIO_CFG_8MA}
2088};
2089
2090static struct msm_mmc_pad_drv sdc3_pad_drv_off_cfg[] = {
2091 {TLMM_HDRV_SDC3_CLK, GPIO_CFG_2MA},
2092 {TLMM_HDRV_SDC3_CMD, GPIO_CFG_2MA},
2093 {TLMM_HDRV_SDC3_DATA, GPIO_CFG_2MA}
2094};
2095
2096static struct msm_mmc_pad_pull sdc3_pad_pull_on_cfg[] = {
2097 {TLMM_PULL_SDC3_CMD, GPIO_CFG_PULL_UP},
2098 {TLMM_PULL_SDC3_DATA, GPIO_CFG_PULL_UP}
2099};
2100
2101static struct msm_mmc_pad_pull sdc3_pad_pull_off_cfg[] = {
2102 {TLMM_PULL_SDC3_CMD, GPIO_CFG_PULL_DOWN},
2103 {TLMM_PULL_SDC3_DATA, GPIO_CFG_PULL_DOWN}
2104};
2105
2106struct msm_mmc_pad_pull_data mmc_pad_pull_data[MAX_SDCC_CONTROLLER] = {
2107 [SDCC1] = {
2108 .on = sdc1_pad_pull_on_cfg,
2109 .off = sdc1_pad_pull_off_cfg,
2110 .size = ARRAY_SIZE(sdc1_pad_pull_on_cfg)
2111 },
2112 [SDCC3] = {
2113 .on = sdc3_pad_pull_on_cfg,
2114 .off = sdc3_pad_pull_off_cfg,
2115 .size = ARRAY_SIZE(sdc3_pad_pull_on_cfg)
2116 },
2117};
2118
2119struct msm_mmc_pad_drv_data mmc_pad_drv_data[MAX_SDCC_CONTROLLER] = {
2120 [SDCC1] = {
2121 .on = sdc1_pad_drv_on_cfg,
2122 .off = sdc1_pad_drv_off_cfg,
2123 .size = ARRAY_SIZE(sdc1_pad_drv_on_cfg)
2124 },
2125 [SDCC3] = {
2126 .on = sdc3_pad_drv_on_cfg,
2127 .off = sdc3_pad_drv_off_cfg,
2128 .size = ARRAY_SIZE(sdc3_pad_drv_on_cfg)
2129 },
2130};
2131
2132struct msm_mmc_pad_data mmc_pad_data[MAX_SDCC_CONTROLLER] = {
2133 [SDCC1] = {
2134 .pull = &mmc_pad_pull_data[SDCC1],
2135 .drv = &mmc_pad_drv_data[SDCC1]
2136 },
2137 [SDCC3] = {
2138 .pull = &mmc_pad_pull_data[SDCC3],
2139 .drv = &mmc_pad_drv_data[SDCC3]
2140 },
2141};
2142
2143struct msm_mmc_pin_data mmc_slot_pin_data[MAX_SDCC_CONTROLLER] = {
2144 [SDCC1] = {
2145 .pad_data = &mmc_pad_data[SDCC1],
2146 },
2147 [SDCC3] = {
2148 .pad_data = &mmc_pad_data[SDCC3],
2149 },
2150};
2151
2152static unsigned int sdc1_sup_clk_rates[] = {
Subhash Jadavanib808efac2011-06-27 15:14:07 -07002153 400000, 24000000, 48000000, 96000000
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002154};
2155
2156static unsigned int sdc3_sup_clk_rates[] = {
2157 400000, 24000000, 48000000, 96000000
2158};
2159
2160#ifdef CONFIG_MMC_MSM_SDC1_SUPPORT
2161static struct mmc_platform_data msm8960_sdc1_data = {
2162 .ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29,
2163#ifdef CONFIG_MMC_MSM_SDC1_8_BIT_SUPPORT
2164 .mmc_bus_width = MMC_CAP_8_BIT_DATA,
2165#else
2166 .mmc_bus_width = MMC_CAP_4_BIT_DATA,
2167#endif
2168 .sup_clk_table = sdc1_sup_clk_rates,
2169 .sup_clk_cnt = ARRAY_SIZE(sdc1_sup_clk_rates),
2170 .nonremovable = 1,
2171 .sdcc_v4_sup = true,
2172 .vreg_data = &mmc_slot_vreg_data[SDCC1],
Subhash Jadavanib808efac2011-06-27 15:14:07 -07002173 .pin_data = &mmc_slot_pin_data[SDCC1],
2174 .uhs_caps = MMC_CAP_1_8V_DDR
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002175};
2176#endif
2177
2178#ifdef CONFIG_MMC_MSM_SDC3_SUPPORT
2179static struct mmc_platform_data msm8960_sdc3_data = {
2180 .ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29,
2181 .mmc_bus_width = MMC_CAP_4_BIT_DATA,
2182 .sup_clk_table = sdc3_sup_clk_rates,
2183 .sup_clk_cnt = ARRAY_SIZE(sdc3_sup_clk_rates),
2184 .wpswitch_gpio = PM8921_GPIO_PM_TO_SYS(16),
2185 .sdcc_v4_sup = true,
2186 .vreg_data = &mmc_slot_vreg_data[SDCC3],
2187 .pin_data = &mmc_slot_pin_data[SDCC3],
2188#ifdef CONFIG_MMC_MSM_CARD_HW_DETECTION
2189 .status_gpio = PM8921_GPIO_PM_TO_SYS(26),
2190 .status_irq = PM8921_GPIO_IRQ(PM8921_IRQ_BASE, 26),
2191 .irq_flags = IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
2192#endif
2193 .xpc_cap = 1,
2194 .uhs_caps = (MMC_CAP_UHS_SDR12 | MMC_CAP_UHS_SDR25 |
2195 MMC_CAP_UHS_SDR50 | MMC_CAP_UHS_DDR50 |
Subhash Jadavanib808efac2011-06-27 15:14:07 -07002196 MMC_CAP_MAX_CURRENT_600 | MMC_CAP_1_8V_DDR)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002197};
2198#endif
2199
2200static void __init msm8960_init_mmc(void)
2201{
2202#ifdef CONFIG_MMC_MSM_SDC1_SUPPORT
2203 /* SDC1 : eMMC card connected */
2204 msm_add_sdcc(1, &msm8960_sdc1_data);
2205#endif
2206#ifdef CONFIG_MMC_MSM_SDC3_SUPPORT
2207 /* SDC3: External card slot */
2208 msm_add_sdcc(3, &msm8960_sdc3_data);
2209#endif
2210}
2211
2212static void __init msm8960_init_buses(void)
2213{
2214#ifdef CONFIG_MSM_BUS_SCALING
2215 msm_bus_apps_fabric_pdata.rpm_enabled = 1;
2216 msm_bus_sys_fabric_pdata.rpm_enabled = 1;
2217 msm_bus_mm_fabric_pdata.rpm_enabled = 1;
2218 msm_bus_sys_fpb_pdata.rpm_enabled = 1;
2219 msm_bus_cpss_fpb_pdata.rpm_enabled = 1;
2220 msm_bus_apps_fabric.dev.platform_data = &msm_bus_apps_fabric_pdata;
2221 msm_bus_sys_fabric.dev.platform_data = &msm_bus_sys_fabric_pdata;
2222 msm_bus_mm_fabric.dev.platform_data = &msm_bus_mm_fabric_pdata;
2223 msm_bus_sys_fpb.dev.platform_data = &msm_bus_sys_fpb_pdata;
2224 msm_bus_cpss_fpb.dev.platform_data = &msm_bus_cpss_fpb_pdata;
2225#endif
2226}
2227
2228static struct msm_spi_platform_data msm8960_qup_spi_gsbi1_pdata = {
2229 .max_clock_speed = 15060000,
2230};
2231
2232#ifdef CONFIG_USB_MSM_OTG_72K
2233static struct msm_otg_platform_data msm_otg_pdata;
2234#else
2235#define USB_5V_EN 42
2236static void msm_hsusb_vbus_power(bool on)
2237{
2238 int rc;
2239 static bool vbus_is_on;
2240 static struct regulator *mvs_otg_switch;
2241 struct pm_gpio param = {
2242 .direction = PM_GPIO_DIR_OUT,
2243 .output_buffer = PM_GPIO_OUT_BUF_CMOS,
2244 .output_value = 1,
2245 .pull = PM_GPIO_PULL_NO,
2246 .vin_sel = PM_GPIO_VIN_S4,
2247 .out_strength = PM_GPIO_STRENGTH_MED,
2248 .function = PM_GPIO_FUNC_NORMAL,
2249 };
2250
2251 if (vbus_is_on == on)
2252 return;
2253
2254 if (on) {
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07002255 mvs_otg_switch = regulator_get(&msm8960_device_otg.dev,
2256 "vbus_otg");
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002257 if (IS_ERR(mvs_otg_switch)) {
2258 pr_err("Unable to get mvs_otg_switch\n");
2259 return;
2260 }
2261
2262 rc = gpio_request(PM8921_GPIO_PM_TO_SYS(USB_5V_EN),
2263 "usb_5v_en");
2264 if (rc < 0) {
2265 pr_err("failed to request usb_5v_en gpio\n");
2266 goto put_mvs_otg;
2267 }
2268
2269 if (regulator_enable(mvs_otg_switch)) {
2270 pr_err("unable to enable mvs_otg_switch\n");
2271 goto free_usb_5v_en;
2272 }
2273
2274 rc = pm8xxx_gpio_config(PM8921_GPIO_PM_TO_SYS(USB_5V_EN),
2275 &param);
2276 if (rc < 0) {
2277 pr_err("failed to configure usb_5v_en gpio\n");
2278 goto disable_mvs_otg;
2279 }
2280 vbus_is_on = true;
2281 return;
2282 }
2283disable_mvs_otg:
2284 regulator_disable(mvs_otg_switch);
2285free_usb_5v_en:
2286 gpio_free(PM8921_GPIO_PM_TO_SYS(USB_5V_EN));
2287put_mvs_otg:
2288 regulator_put(mvs_otg_switch);
2289 vbus_is_on = false;
2290}
2291
2292static struct msm_otg_platform_data msm_otg_pdata = {
2293 .mode = USB_OTG,
2294 .otg_control = OTG_PMIC_CONTROL,
2295 .phy_type = SNPS_28NM_INTEGRATED_PHY,
2296 .pclk_src_name = "dfab_usb_hs_clk",
2297 .pmic_id_irq = PM8921_USB_ID_IN_IRQ(PM8921_IRQ_BASE),
2298 .vbus_power = msm_hsusb_vbus_power,
2299};
2300#endif
2301
2302#define PID_MAGIC_ID 0x71432909
2303#define SERIAL_NUM_MAGIC_ID 0x61945374
2304#define SERIAL_NUMBER_LENGTH 127
2305#define DLOAD_USB_BASE_ADD 0x2A03F0C8
2306
2307struct magic_num_struct {
2308 uint32_t pid;
2309 uint32_t serial_num;
2310};
2311
2312struct dload_struct {
2313 uint32_t reserved1;
2314 uint32_t reserved2;
2315 uint32_t reserved3;
2316 uint16_t reserved4;
2317 uint16_t pid;
2318 char serial_number[SERIAL_NUMBER_LENGTH];
2319 uint16_t reserved5;
2320 struct magic_num_struct magic_struct;
2321};
2322
2323static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum)
2324{
2325 struct dload_struct __iomem *dload = 0;
2326
2327 dload = ioremap(DLOAD_USB_BASE_ADD, sizeof(*dload));
2328 if (!dload) {
2329 pr_err("%s: cannot remap I/O memory region: %08x\n",
2330 __func__, DLOAD_USB_BASE_ADD);
2331 return -ENXIO;
2332 }
2333
2334 pr_debug("%s: dload:%p pid:%x serial_num:%s\n",
2335 __func__, dload, pid, snum);
2336 /* update pid */
2337 dload->magic_struct.pid = PID_MAGIC_ID;
2338 dload->pid = pid;
2339
2340 /* update serial number */
2341 dload->magic_struct.serial_num = 0;
2342 if (!snum) {
2343 memset(dload->serial_number, 0, SERIAL_NUMBER_LENGTH);
2344 goto out;
2345 }
2346
2347 dload->magic_struct.serial_num = SERIAL_NUM_MAGIC_ID;
2348 strncpy(dload->serial_number, snum, SERIAL_NUMBER_LENGTH);
2349 dload->serial_number[SERIAL_NUMBER_LENGTH - 1] = '\0';
2350out:
2351 iounmap(dload);
2352 return 0;
2353}
2354
2355static struct android_usb_platform_data android_usb_pdata = {
2356 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
2357};
2358
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07002359static struct platform_device android_usb_device = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002360 .name = "android_usb",
2361 .id = -1,
2362 .dev = {
2363 .platform_data = &android_usb_pdata,
2364 },
2365};
2366
2367static uint8_t spm_wfi_cmd_sequence[] __initdata = {
2368 0x03, 0x0f,
2369};
2370
2371static uint8_t spm_power_collapse_without_rpm[] __initdata = {
2372 0x00, 0x24, 0x54, 0x10,
2373 0x09, 0x03, 0x01,
2374 0x10, 0x54, 0x30, 0x0C,
2375 0x24, 0x30, 0x0f,
2376};
2377
2378static uint8_t spm_power_collapse_with_rpm[] __initdata = {
2379 0x00, 0x24, 0x54, 0x10,
2380 0x09, 0x07, 0x01, 0x0B,
2381 0x10, 0x54, 0x30, 0x0C,
2382 0x24, 0x30, 0x0f,
2383};
2384
2385static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = {
2386 [0] = {
2387 .mode = MSM_SPM_MODE_CLOCK_GATING,
2388 .notify_rpm = false,
2389 .cmd = spm_wfi_cmd_sequence,
2390 },
2391 [1] = {
2392 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
2393 .notify_rpm = false,
2394 .cmd = spm_power_collapse_without_rpm,
2395 },
2396 [2] = {
2397 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
2398 .notify_rpm = true,
2399 .cmd = spm_power_collapse_with_rpm,
2400 },
2401};
2402
2403static struct msm_spm_platform_data msm_spm_data[] __initdata = {
2404 [0] = {
2405 .reg_base_addr = MSM_SAW0_BASE,
2406 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
2407 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
2408 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0x9C,
2409#if defined(CONFIG_MSM_AVS_HW)
2410 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
2411 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
2412#endif
2413 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
2414 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
2415 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
2416 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
2417 .vctl_timeout_us = 50,
2418 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
2419 .modes = msm_spm_seq_list,
2420 },
2421 [1] = {
2422 .reg_base_addr = MSM_SAW1_BASE,
2423 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
2424 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
2425 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0x9C,
2426#if defined(CONFIG_MSM_AVS_HW)
2427 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
2428 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
2429#endif
2430 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
2431 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
2432 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
2433 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
2434 .vctl_timeout_us = 50,
2435 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
2436 .modes = msm_spm_seq_list,
2437 },
2438};
2439
2440static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = {
2441 0x00, 0x20, 0x03, 0x20,
2442 0x00, 0x0f,
2443};
2444
2445static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = {
2446 0x00, 0x20, 0x34, 0x64,
2447 0x48, 0x07, 0x48, 0x20,
2448 0x50, 0x64, 0x04, 0x34,
2449 0x50, 0x0f,
2450};
2451static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = {
2452 0x00, 0x10, 0x34, 0x64,
2453 0x48, 0x07, 0x48, 0x10,
2454 0x50, 0x64, 0x04, 0x34,
2455 0x50, 0x0F,
2456};
2457
2458static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = {
2459 [0] = {
2460 .mode = MSM_SPM_L2_MODE_RETENTION,
2461 .notify_rpm = false,
2462 .cmd = l2_spm_wfi_cmd_sequence,
2463 },
2464 [1] = {
2465 .mode = MSM_SPM_L2_MODE_GDHS,
2466 .notify_rpm = true,
2467 .cmd = l2_spm_gdhs_cmd_sequence,
2468 },
2469 [2] = {
2470 .mode = MSM_SPM_L2_MODE_POWER_COLLAPSE,
2471 .notify_rpm = true,
2472 .cmd = l2_spm_power_off_cmd_sequence,
2473 },
2474};
2475
2476
2477static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = {
2478 [0] = {
2479 .reg_base_addr = MSM_SAW_L2_BASE,
2480 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
2481 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00,
2482 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
2483 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE,
2484 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020,
2485 .modes = msm_spm_l2_seq_list,
2486 .num_modes = ARRAY_SIZE(msm_spm_l2_seq_list),
2487 },
2488};
2489
2490#define CYTTSP_TS_GPIO_IRQ 11
2491#define CYTTSP_TS_SLEEP_GPIO 50
2492#define CYTTSP_TS_RESOUT_N_GPIO 52
2493
2494/*virtual key support */
2495static ssize_t tma340_vkeys_show(struct kobject *kobj,
2496 struct kobj_attribute *attr, char *buf)
2497{
2498 return snprintf(buf, 200,
2499 __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":73:1120:97:97"
2500 ":" __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":230:1120:97:97"
2501 ":" __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":389:1120:97:97"
2502 ":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":544:1120:97:97"
2503 "\n");
2504}
2505
2506static struct kobj_attribute tma340_vkeys_attr = {
2507 .attr = {
2508 .mode = S_IRUGO,
2509 },
2510 .show = &tma340_vkeys_show,
2511};
2512
2513static struct attribute *tma340_properties_attrs[] = {
2514 &tma340_vkeys_attr.attr,
2515 NULL
2516};
2517
2518static struct attribute_group tma340_properties_attr_group = {
2519 .attrs = tma340_properties_attrs,
2520};
2521
2522
2523static int cyttsp_platform_init(struct i2c_client *client)
2524{
2525 int rc = 0;
2526 static struct kobject *tma340_properties_kobj;
2527
2528 tma340_vkeys_attr.attr.name = "virtualkeys.cyttsp-i2c";
2529 tma340_properties_kobj = kobject_create_and_add("board_properties",
2530 NULL);
2531 if (tma340_properties_kobj)
2532 rc = sysfs_create_group(tma340_properties_kobj,
2533 &tma340_properties_attr_group);
2534 if (!tma340_properties_kobj || rc)
2535 pr_err("%s: failed to create board_properties\n",
2536 __func__);
2537
2538 return 0;
2539}
2540
2541static struct cyttsp_regulator regulator_data[] = {
2542 {
2543 .name = "vdd",
2544 .min_uV = CY_TMA300_VTG_MIN_UV,
2545 .max_uV = CY_TMA300_VTG_MAX_UV,
2546 .load_uA = CY_TMA300_CURR_24HZ_UA,
2547 },
2548 /* TODO: Remove after runtime PM is enabled in I2C driver */
2549 {
2550 .name = "vcc_i2c",
2551 .min_uV = CY_I2C_VTG_MIN_UV,
2552 .max_uV = CY_I2C_VTG_MAX_UV,
2553 .load_uA = CY_I2C_CURR_UA,
2554 },
2555};
2556
2557static struct cyttsp_platform_data cyttsp_pdata = {
2558 .panel_maxx = 634,
2559 .panel_maxy = 1166,
2560 .disp_maxx = 616,
2561 .disp_maxy = 1023,
2562 .disp_minx = 0,
2563 .disp_miny = 16,
2564 .flags = 0x01,
2565 .gen = CY_GEN3, /* or */
2566 .use_st = CY_USE_ST,
2567 .use_mt = CY_USE_MT,
2568 .use_hndshk = CY_SEND_HNDSHK,
2569 .use_trk_id = CY_USE_TRACKING_ID,
Anirudh Ghayal15187772011-06-22 17:39:41 +05302570 .use_sleep = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002571 .use_gestures = CY_USE_GESTURES,
2572 .fw_fname = "cyttsp_8960_cdp.hex",
2573 /* activate up to 4 groups
2574 * and set active distance
2575 */
2576 .gest_set = CY_GEST_GRP1 | CY_GEST_GRP2 |
2577 CY_GEST_GRP3 | CY_GEST_GRP4 |
2578 CY_ACT_DIST,
2579 /* change act_intrvl to customize the Active power state
2580 * scanning/processing refresh interval for Operating mode
2581 */
2582 .act_intrvl = CY_ACT_INTRVL_DFLT,
2583 /* change tch_tmout to customize the touch timeout for the
2584 * Active power state for Operating mode
2585 */
2586 .tch_tmout = CY_TCH_TMOUT_DFLT,
2587 /* change lp_intrvl to customize the Low Power power state
2588 * scanning/processing refresh interval for Operating mode
2589 */
2590 .lp_intrvl = CY_LP_INTRVL_DFLT,
2591 .sleep_gpio = CYTTSP_TS_SLEEP_GPIO,
2592 .resout_gpio = CYTTSP_TS_RESOUT_N_GPIO,
2593 .irq_gpio = CYTTSP_TS_GPIO_IRQ,
2594 .regulator_info = regulator_data,
2595 .num_regulators = ARRAY_SIZE(regulator_data),
2596 .init = cyttsp_platform_init,
Mohan Pallaka49c37d62011-08-01 11:52:00 +05302597 .correct_fw_ver = 9,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002598};
2599
2600static struct i2c_board_info cyttsp_info[] __initdata = {
2601 {
2602 I2C_BOARD_INFO(CY_I2C_NAME, 0x24),
2603 .platform_data = &cyttsp_pdata,
2604#ifndef CY_USE_TIMER
2605 .irq = MSM_GPIO_TO_INT(CYTTSP_TS_GPIO_IRQ),
2606#endif /* CY_USE_TIMER */
2607 },
2608};
2609
2610static void gsbi_qup_i2c_gpio_config(int adap_id, int config_type)
2611{
2612}
2613
2614static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi4_pdata = {
2615 .clk_freq = 100000,
2616 .src_clk_rate = 24000000,
2617 .clk = "gsbi_qup_clk",
2618 .pclk = "gsbi_pclk",
2619 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
2620};
2621
2622static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi3_pdata = {
2623 .clk_freq = 100000,
2624 .src_clk_rate = 24000000,
2625 .clk = "gsbi_qup_clk",
2626 .pclk = "gsbi_pclk",
2627 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
2628};
2629
2630static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi10_pdata = {
2631 .clk_freq = 100000,
2632 .src_clk_rate = 24000000,
2633 .clk = "gsbi_qup_clk",
2634 .pclk = "gsbi_pclk",
2635 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
2636};
2637
2638static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi12_pdata = {
2639 .clk_freq = 100000,
2640 .src_clk_rate = 24000000,
2641 .clk = "gsbi_qup_clk",
2642 .pclk = "gsbi_pclk",
2643 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
2644};
2645
2646static struct msm_rpm_platform_data msm_rpm_data = {
2647 .reg_base_addrs = {
2648 [MSM_RPM_PAGE_STATUS] = MSM_RPM_BASE,
2649 [MSM_RPM_PAGE_CTRL] = MSM_RPM_BASE + 0x400,
2650 [MSM_RPM_PAGE_REQ] = MSM_RPM_BASE + 0x600,
2651 [MSM_RPM_PAGE_ACK] = MSM_RPM_BASE + 0xa00,
2652 },
2653
2654 .irq_ack = RPM_APCC_CPU0_GP_HIGH_IRQ,
2655 .irq_err = RPM_APCC_CPU0_GP_LOW_IRQ,
2656 .irq_vmpm = RPM_APCC_CPU0_GP_MEDIUM_IRQ,
2657 .msm_apps_ipc_rpm_reg = MSM_APCS_GCC_BASE + 0x008,
2658 .msm_apps_ipc_rpm_val = 4,
2659};
2660
Praveen Chidambaram043f4ce2011-08-02 09:37:59 -06002661static struct platform_device msm_rpm_device = {
2662 .name = "msm_rpm",
2663 .id = -1,
2664};
2665
2666
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002667static struct spi_board_info spi_board_info[] __initdata = {
2668 {
2669 .modalias = "ks8851",
2670 .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO),
2671 .max_speed_hz = 19200000,
2672 .bus_num = 0,
2673 .chip_select = 0,
2674 .mode = SPI_MODE_0,
2675 },
2676};
2677
2678static struct platform_device msm_device_saw_core0 = {
2679 .name = "saw-regulator",
2680 .id = 0,
2681 .dev = {
2682 .platform_data = &msm_saw_regulator_pdata_s5,
2683 },
2684};
2685
2686static struct platform_device msm_device_saw_core1 = {
2687 .name = "saw-regulator",
2688 .id = 1,
2689 .dev = {
2690 .platform_data = &msm_saw_regulator_pdata_s6,
2691 },
2692};
2693
2694#ifdef CONFIG_MSM_FAKE_BATTERY
2695static struct platform_device fish_battery_device = {
2696 .name = "fish_battery",
2697};
2698#endif
2699
2700struct platform_device msm8960_device_ext_5v_vreg __devinitdata = {
2701 .name = GPIO_REGULATOR_DEV_NAME,
2702 .id = PM8921_MPP_PM_TO_SYS(7),
2703 .dev = {
2704 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V],
2705 },
2706};
2707
2708struct platform_device msm8960_device_ext_l2_vreg __devinitdata = {
2709 .name = GPIO_REGULATOR_DEV_NAME,
2710 .id = 91,
2711 .dev = {
2712 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_L2],
2713 },
2714};
2715
2716static struct platform_device *common_devices[] __initdata = {
Stepan Moskovchenkodf13d342011-08-03 19:01:25 -07002717 &msm8960_device_dmov,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002718 &msm_device_smd,
2719 &msm8960_device_uart_gsbi5,
Mayank Rana9f51f582011-08-04 18:35:59 +05302720 &msm_device_uart_dm6,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002721 &msm_device_saw_core0,
2722 &msm_device_saw_core1,
2723 &msm8960_device_ext_5v_vreg,
2724 &msm8960_device_ext_l2_vreg,
2725 &msm8960_device_ssbi_pm8921,
2726 &msm8960_device_qup_spi_gsbi1,
2727 &msm8960_device_qup_i2c_gsbi3,
2728 &msm8960_device_qup_i2c_gsbi4,
2729 &msm8960_device_qup_i2c_gsbi10,
2730#ifndef CONFIG_MSM_DSPS
2731 &msm8960_device_qup_i2c_gsbi12,
2732#endif
2733 &msm_slim_ctrl,
2734 &msm_device_wcnss_wlan,
2735#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
2736 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
2737 &qcrypto_device,
2738#endif
2739
2740#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
2741 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
2742 &qcedev_device,
2743#endif
2744#ifdef CONFIG_MSM_ROTATOR
2745 &msm_rotator_device,
2746#endif
2747 &msm_device_sps,
2748#ifdef CONFIG_MSM_FAKE_BATTERY
2749 &fish_battery_device,
2750#endif
2751#ifdef CONFIG_ANDROID_PMEM
2752 &android_pmem_device,
2753 &android_pmem_adsp_device,
2754 &android_pmem_audio_device,
2755#endif
2756 &msm_fb_device,
2757 &msm_device_vidc,
2758 &msm_device_bam_dmux,
2759 &msm_fm_platform_init,
Mona Hossain9c430e32011-07-27 11:04:47 -07002760
2761#ifdef CONFIG_HW_RANDOM_MSM
2762 &msm_device_rng,
2763#endif
Praveen Chidambaram043f4ce2011-08-02 09:37:59 -06002764 &msm_rpm_device,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002765};
2766
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002767static struct platform_device *sim_devices[] __initdata = {
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07002768 &msm8960_device_otg,
2769 &msm8960_device_gadget_peripheral,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002770 &msm_device_hsusb_host,
2771 &android_usb_device,
2772 &msm_device_vidc,
2773 &mipi_dsi_simulator_panel_device,
2774 &msm_bus_apps_fabric,
2775 &msm_bus_sys_fabric,
2776 &msm_bus_mm_fabric,
2777 &msm_bus_sys_fpb,
2778 &msm_bus_cpss_fpb,
2779 &msm_pcm,
2780 &msm_pcm_routing,
2781 &msm_cpudai0,
2782 &msm_cpudai1,
2783 &msm_cpudai_hdmi_rx,
2784 &msm_cpudai_bt_rx,
2785 &msm_cpudai_bt_tx,
2786 &msm_cpudai_fm_rx,
2787 &msm_cpudai_fm_tx,
2788 &msm_cpu_fe,
2789 &msm_stub_codec,
2790 &msm_voice,
2791 &msm_voip,
2792 &msm_lpa_pcm,
2793
2794#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
2795 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
2796 &qcrypto_device,
2797#endif
2798
2799#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
2800 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
2801 &qcedev_device,
2802#endif
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002803};
2804
2805static struct platform_device *rumi3_devices[] __initdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002806 &msm_kgsl_3d0,
2807 &msm_kgsl_2d0,
2808 &msm_kgsl_2d1,
2809 &mipi_dsi_renesas_panel_device,
2810#ifdef CONFIG_MSM_GEMINI
2811 &msm8960_gemini_device,
2812#endif
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002813};
2814
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002815static struct platform_device *cdp_devices[] __initdata = {
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07002816 &msm8960_device_otg,
2817 &msm8960_device_gadget_peripheral,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002818 &msm_device_hsusb_host,
2819 &android_usb_device,
2820 &msm_pcm,
2821 &msm_pcm_routing,
2822 &msm_cpudai0,
2823 &msm_cpudai1,
2824 &msm_cpudai_hdmi_rx,
2825 &msm_cpudai_bt_rx,
2826 &msm_cpudai_bt_tx,
2827 &msm_cpudai_fm_rx,
2828 &msm_cpudai_fm_tx,
2829 &msm_cpu_fe,
2830 &msm_stub_codec,
2831 &msm_kgsl_3d0,
2832#ifdef CONFIG_MSM_KGSL_2D
2833 &msm_kgsl_2d0,
2834 &msm_kgsl_2d1,
2835#endif
2836 &mipi_dsi_toshiba_panel_device,
2837#ifdef CONFIG_MSM_GEMINI
2838 &msm8960_gemini_device,
2839#endif
2840 &msm_voice,
2841 &msm_voip,
2842 &msm_lpa_pcm,
2843#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
2844 &hdmi_msm_device,
2845#endif
2846 &msm_pcm_hostless,
2847 &msm_bus_apps_fabric,
2848 &msm_bus_sys_fabric,
2849 &msm_bus_mm_fabric,
2850 &msm_bus_sys_fpb,
2851 &msm_bus_cpss_fpb,
2852};
2853
2854static void __init msm8960_i2c_init(void)
2855{
2856 msm8960_device_qup_i2c_gsbi4.dev.platform_data =
2857 &msm8960_i2c_qup_gsbi4_pdata;
2858
2859 msm8960_device_qup_i2c_gsbi3.dev.platform_data =
2860 &msm8960_i2c_qup_gsbi3_pdata;
2861
2862 msm8960_device_qup_i2c_gsbi10.dev.platform_data =
2863 &msm8960_i2c_qup_gsbi10_pdata;
2864
2865 msm8960_device_qup_i2c_gsbi12.dev.platform_data =
2866 &msm8960_i2c_qup_gsbi12_pdata;
2867}
2868
2869static struct pm8xxx_irq_platform_data pm8xxx_irq_pdata __devinitdata = {
2870 .irq_base = PM8921_IRQ_BASE,
2871 .devirq = MSM_GPIO_TO_INT(104),
2872 .irq_trigger_flag = IRQF_TRIGGER_LOW,
2873};
2874
2875static struct pm8xxx_gpio_platform_data pm8xxx_gpio_pdata __devinitdata = {
2876 .gpio_base = PM8921_GPIO_PM_TO_SYS(1),
2877};
2878
2879static struct pm8xxx_mpp_platform_data pm8xxx_mpp_pdata __devinitdata = {
2880 .mpp_base = PM8921_MPP_PM_TO_SYS(1),
2881};
2882
2883static struct pm8xxx_rtc_platform_data pm8xxx_rtc_pdata __devinitdata = {
2884 .rtc_write_enable = false,
2885};
2886
2887static struct pm8xxx_pwrkey_platform_data pm8xxx_pwrkey_pdata = {
2888 .pull_up = 1,
2889 .kpd_trigger_delay_us = 970,
2890 .wakeup = 1,
2891};
2892
2893static const unsigned int keymap[] = {
2894 KEY(0, 0, KEY_VOLUMEUP),
2895 KEY(0, 1, KEY_VOLUMEDOWN),
2896 KEY(0, 2, KEY_CAMERA_SNAPSHOT),
2897 KEY(0, 3, KEY_CAMERA_FOCUS),
2898};
2899
2900static struct matrix_keymap_data keymap_data = {
2901 .keymap_size = ARRAY_SIZE(keymap),
2902 .keymap = keymap,
2903};
2904
2905static struct pm8xxx_keypad_platform_data keypad_data = {
2906 .input_name = "keypad_8960",
2907 .input_phys_device = "keypad_8960/input0",
2908 .num_rows = 1,
2909 .num_cols = 5,
2910 .rows_gpio_start = PM8921_GPIO_PM_TO_SYS(9),
2911 .cols_gpio_start = PM8921_GPIO_PM_TO_SYS(1),
2912 .debounce_ms = 15,
2913 .scan_delay_ms = 32,
2914 .row_hold_ns = 91500,
2915 .wakeup = 1,
2916 .keymap_data = &keymap_data,
2917};
2918
2919static const unsigned int keymap_sim[] = {
2920 KEY(0, 0, KEY_7),
2921 KEY(0, 1, KEY_DOWN),
2922 KEY(0, 2, KEY_UP),
2923 KEY(0, 3, KEY_RIGHT),
2924 KEY(0, 4, KEY_ENTER),
2925 KEY(0, 5, KEY_L),
2926 KEY(0, 6, KEY_BACK),
2927 KEY(0, 7, KEY_M),
2928
2929 KEY(1, 0, KEY_LEFT),
2930 KEY(1, 1, KEY_SEND),
2931 KEY(1, 2, KEY_1),
2932 KEY(1, 3, KEY_4),
2933 KEY(1, 4, KEY_CLEAR),
2934 KEY(1, 5, KEY_MSDOS),
2935 KEY(1, 6, KEY_SPACE),
2936 KEY(1, 7, KEY_COMMA),
2937
2938 KEY(2, 0, KEY_6),
2939 KEY(2, 1, KEY_5),
2940 KEY(2, 2, KEY_8),
2941 KEY(2, 3, KEY_3),
2942 KEY(2, 4, KEY_NUMERIC_STAR),
2943 KEY(2, 5, KEY_UP),
2944 KEY(2, 6, KEY_DOWN),
2945 KEY(2, 7, KEY_LEFTSHIFT),
2946
2947 KEY(3, 0, KEY_9),
2948 KEY(3, 1, KEY_NUMERIC_POUND),
2949 KEY(3, 2, KEY_0),
2950 KEY(3, 3, KEY_2),
2951 KEY(3, 4, KEY_SLEEP),
2952 KEY(3, 5, KEY_F1),
2953 KEY(3, 6, KEY_F2),
2954 KEY(3, 7, KEY_F3),
2955
2956 KEY(4, 0, KEY_BACK),
2957 KEY(4, 1, KEY_HOME),
2958 KEY(4, 2, KEY_MENU),
2959 KEY(4, 3, KEY_VOLUMEUP),
2960 KEY(4, 4, KEY_VOLUMEDOWN),
2961 KEY(4, 5, KEY_F4),
2962 KEY(4, 6, KEY_F5),
2963 KEY(4, 7, KEY_F6),
2964
2965 KEY(5, 0, KEY_R),
2966 KEY(5, 1, KEY_T),
2967 KEY(5, 2, KEY_Y),
2968 KEY(5, 3, KEY_LEFTALT),
2969 KEY(5, 4, KEY_KPENTER),
2970 KEY(5, 5, KEY_Q),
2971 KEY(5, 6, KEY_W),
2972 KEY(5, 7, KEY_E),
2973
2974 KEY(6, 0, KEY_F),
2975 KEY(6, 1, KEY_G),
2976 KEY(6, 2, KEY_H),
2977 KEY(6, 3, KEY_CAPSLOCK),
2978 KEY(6, 4, KEY_PAGEUP),
2979 KEY(6, 5, KEY_A),
2980 KEY(6, 6, KEY_S),
2981 KEY(6, 7, KEY_D),
2982
2983 KEY(7, 0, KEY_V),
2984 KEY(7, 1, KEY_B),
2985 KEY(7, 2, KEY_N),
2986 KEY(7, 3, KEY_MENU),
2987 KEY(7, 4, KEY_PAGEDOWN),
2988 KEY(7, 5, KEY_Z),
2989 KEY(7, 6, KEY_X),
2990 KEY(7, 7, KEY_C),
2991
2992 KEY(8, 0, KEY_P),
2993 KEY(8, 1, KEY_J),
2994 KEY(8, 2, KEY_K),
2995 KEY(8, 3, KEY_INSERT),
2996 KEY(8, 4, KEY_LINEFEED),
2997 KEY(8, 5, KEY_U),
2998 KEY(8, 6, KEY_I),
2999 KEY(8, 7, KEY_O),
3000
3001 KEY(9, 0, KEY_4),
3002 KEY(9, 1, KEY_5),
3003 KEY(9, 2, KEY_6),
3004 KEY(9, 3, KEY_7),
3005 KEY(9, 4, KEY_8),
3006 KEY(9, 5, KEY_1),
3007 KEY(9, 6, KEY_2),
3008 KEY(9, 7, KEY_3),
3009
3010 KEY(10, 0, KEY_F7),
3011 KEY(10, 1, KEY_F8),
3012 KEY(10, 2, KEY_F9),
3013 KEY(10, 3, KEY_F10),
3014 KEY(10, 4, KEY_FN),
3015 KEY(10, 5, KEY_9),
3016 KEY(10, 6, KEY_0),
3017 KEY(10, 7, KEY_DOT),
3018
3019 KEY(11, 0, KEY_LEFTCTRL),
3020 KEY(11, 1, KEY_F11),
3021 KEY(11, 2, KEY_ENTER),
3022 KEY(11, 3, KEY_SEARCH),
3023 KEY(11, 4, KEY_DELETE),
3024 KEY(11, 5, KEY_RIGHT),
3025 KEY(11, 6, KEY_LEFT),
3026 KEY(11, 7, KEY_RIGHTSHIFT),
3027 KEY(0, 0, KEY_VOLUMEUP),
3028 KEY(0, 1, KEY_VOLUMEDOWN),
3029 KEY(0, 2, KEY_CAMERA_SNAPSHOT),
3030 KEY(0, 3, KEY_CAMERA_FOCUS),
3031};
3032
3033static struct matrix_keymap_data keymap_data_sim = {
3034 .keymap_size = ARRAY_SIZE(keymap_sim),
3035 .keymap = keymap_sim,
3036};
3037
3038static struct pm8xxx_keypad_platform_data keypad_data_sim = {
3039 .input_name = "keypad_8960",
3040 .input_phys_device = "keypad_8960/input0",
3041 .num_rows = 12,
3042 .num_cols = 8,
3043 .rows_gpio_start = PM8921_GPIO_PM_TO_SYS(9),
3044 .cols_gpio_start = PM8921_GPIO_PM_TO_SYS(1),
3045 .debounce_ms = 15,
3046 .scan_delay_ms = 32,
3047 .row_hold_ns = 91500,
3048 .wakeup = 1,
3049 .keymap_data = &keymap_data_sim,
3050};
3051
3052static struct pm8921_charger_platform_data pm8921_chg_pdata __devinitdata = {
3053 .safety_time = 180,
3054 .update_time = 1,
3055 .max_voltage = 4200,
3056 .min_voltage = 3200,
3057 .resume_voltage = 4100,
3058 .term_current = 100,
3059};
3060
3061static struct pm8xxx_misc_platform_data pm8xxx_misc_pdata = {
3062 .priority = 0,
3063};
3064
3065static struct pm8921_bms_platform_data pm8921_bms_pdata __devinitdata = {
3066 .r_sense = 10,
3067 .i_test = 2500,
3068 .v_failure = 3000,
3069 .calib_delay_ms = 600000,
3070 .batt_data = &palladium_1500_data,
3071};
3072
3073static struct led_info pm8921_led_info[] = {
3074 [0] = {
3075 .name = "led:drv1",
3076 .flags = PM8XXX_ID_LED_1,
3077 },
3078};
3079
3080static struct led_platform_data pm8xxx_leds_pdata = {
3081 .num_leds = ARRAY_SIZE(pm8921_led_info),
3082 .leds = pm8921_led_info,
3083};
3084
3085static struct pm8921_platform_data pm8921_platform_data __devinitdata = {
3086 .irq_pdata = &pm8xxx_irq_pdata,
3087 .gpio_pdata = &pm8xxx_gpio_pdata,
3088 .mpp_pdata = &pm8xxx_mpp_pdata,
3089 .rtc_pdata = &pm8xxx_rtc_pdata,
3090 .pwrkey_pdata = &pm8xxx_pwrkey_pdata,
3091 .keypad_pdata = &keypad_data,
3092 .misc_pdata = &pm8xxx_misc_pdata,
3093 .regulator_pdatas = msm_pm8921_regulator_pdata,
3094 .charger_pdata = &pm8921_chg_pdata,
3095 .bms_pdata = &pm8921_bms_pdata,
3096 .adc_pdata = &pm8921_adc_pdata,
3097 .leds_pdata = &pm8xxx_leds_pdata,
3098};
3099
3100static struct msm_ssbi_platform_data msm8960_ssbi_pm8921_pdata __devinitdata = {
3101 .controller_type = MSM_SBI_CTRL_PMIC_ARBITER,
3102 .slave = {
3103 .name = "pm8921-core",
3104 .platform_data = &pm8921_platform_data,
3105 },
3106};
3107
3108static void msm8960_wcnss_init(void)
3109{
3110 int i, ret, j;
3111
3112 for (i = 0; i < ARRAY_SIZE(wcnss_5wire_interface); i++) {
3113 ret = gpio_request(wcnss_5wire_interface[i].gpio,
3114 "wcnss_5_wire");
3115 if (ret) {
3116 pr_err("wcnss_5_wire gpio %d failed: %d\n",
3117 wcnss_5wire_interface[i].gpio, ret);
3118 goto fail;
3119 }
3120 }
3121
3122 pr_info("%s: Iris 5-wire gpios configured\n", __func__);
3123
3124 return;
3125
3126fail:
3127 for (j = 0; j < i; j++)
3128 gpio_free(wcnss_5wire_interface[j].gpio);
3129}
3130
Stepan Moskovchenko41d168272011-08-09 17:09:42 -07003131#ifdef CONFIG_KS8851
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003132static int ethernet_init(void)
3133{
3134 int ret;
3135 ret = gpio_request(KS8851_IRQ_GPIO, "ks8851_irq");
3136 if (ret) {
3137 pr_err("ks8851 gpio_request failed: %d\n", ret);
3138 goto fail;
3139 }
3140
3141 ret = gpio_request(KS8851_RST_GPIO, "ks8851_rst");
3142 if (ret) {
3143 pr_err("ks8851 gpio_request failed: %d\n", ret);
3144 goto fail_rst;
3145 }
3146
3147 ret = gpio_request(FPGA_CS_GPIO, "fpga_cs");
3148 if (ret) {
3149 pr_err("ks8851 gpio_request failed: %d\n", ret);
3150 goto fail_cs;
3151 }
3152
3153 gpio_direction_output(FPGA_CS_GPIO, 1);
3154 gpio_direction_output(KS8851_RST_GPIO, 1);
3155 return 0;
3156fail_cs:
3157 gpio_free(KS8851_RST_GPIO);
3158fail_rst:
3159 gpio_free(KS8851_IRQ_GPIO);
3160fail:
3161 return ret;
3162}
Stepan Moskovchenko41d168272011-08-09 17:09:42 -07003163#else
3164static int ethernet_init(void)
3165{
3166 return 0;
3167}
3168#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003169
3170static struct msm_cpuidle_state msm_cstates[] __initdata = {
3171 {0, 0, "C0", "WFI",
3172 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
3173
3174 {0, 1, "C1", "STANDALONE_POWER_COLLAPSE",
3175 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
3176
3177 {0, 2, "C2", "POWER_COLLAPSE",
3178 MSM_PM_SLEEP_MODE_POWER_COLLAPSE},
3179
3180 {1, 0, "C0", "WFI",
3181 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
3182
3183 {1, 1, "C1", "STANDALONE_POWER_COLLAPSE",
3184 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
3185};
3186
3187static struct msm_pm_platform_data msm_pm_data[MSM_PM_SLEEP_MODE_NR * 2] = {
3188 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
3189 .idle_supported = 1,
3190 .suspend_supported = 1,
3191 .idle_enabled = 0,
3192 .suspend_enabled = 0,
3193 .latency = 4000,
3194 .residency = 13000,
3195 },
3196
3197 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
3198 .idle_supported = 1,
3199 .suspend_supported = 1,
3200 .idle_enabled = 0,
3201 .suspend_enabled = 0,
3202 .latency = 500,
3203 .residency = 6000,
3204 },
3205
3206 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
3207 .idle_supported = 1,
3208 .suspend_supported = 1,
3209 .idle_enabled = 1,
3210 .suspend_enabled = 1,
3211 .latency = 2,
3212 .residency = 0,
3213 },
3214
3215 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
3216 .idle_supported = 0,
3217 .suspend_supported = 1,
3218 .idle_enabled = 0,
3219 .suspend_enabled = 0,
3220 .latency = 600,
3221 .residency = 7200,
3222 },
3223
3224 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
3225 .idle_supported = 1,
3226 .suspend_supported = 1,
3227 .idle_enabled = 0,
3228 .suspend_enabled = 0,
3229 .latency = 500,
3230 .residency = 6000,
3231 },
3232
3233 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
3234 .idle_supported = 1,
3235 .suspend_supported = 0,
3236 .idle_enabled = 1,
3237 .suspend_enabled = 0,
3238 .latency = 2,
3239 .residency = 0,
3240 },
3241};
3242
3243static struct msm_rpmrs_level msm_rpmrs_levels[] __initdata = {
3244 {
3245 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
3246 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
3247 true,
3248 1, 8000, 100000, 1,
3249 },
3250
3251 {
3252 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
3253 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
3254 true,
3255 1500, 5000, 60100000, 3000,
3256 },
3257
3258 {
3259 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
3260 MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE),
3261 false,
3262 1800, 5000, 60350000, 3500,
3263 },
3264
3265 {
3266 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
3267 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, MAX, ACTIVE),
3268 false,
3269 2800, 2500, 65350000, 4800,
3270 },
3271
3272 {
3273 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
3274 MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE),
3275 false,
3276 3800, 4500, 67850000, 5500,
3277 },
3278
3279 {
3280 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
3281 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
3282 false,
3283 4800, 2000, 71850000, 6800,
3284 },
3285
3286 {
3287 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
3288 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH),
3289 false,
3290 6800, 500, 75850000, 8800,
3291 },
3292
3293 {
3294 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
3295 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
3296 false,
3297 7800, 0, 76350000, 9800,
3298 },
3299};
3300
3301#ifdef CONFIG_I2C
3302#define I2C_SURF 1
3303#define I2C_FFA (1 << 1)
3304#define I2C_RUMI (1 << 2)
3305#define I2C_SIM (1 << 3)
3306#define I2C_FLUID (1 << 4)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003307
3308struct i2c_registry {
3309 u8 machs;
3310 int bus;
3311 struct i2c_board_info *info;
3312 int len;
3313};
3314
3315#ifdef CONFIG_MSM_CAMERA
3316static struct i2c_board_info msm_camera_boardinfo[] __initdata = {
3317#ifdef CONFIG_IMX074
3318 {
3319 I2C_BOARD_INFO("imx074", 0x1A),
3320 },
3321#endif
3322#ifdef CONFIG_OV2720
3323 {
3324 I2C_BOARD_INFO("ov2720", 0x6C),
3325 },
3326#endif
Kevin Chandfecce22011-07-13 10:52:41 -07003327 {
3328 I2C_BOARD_INFO("qs_mt9p017", 0x6C >> 1),
3329 },
Nishant Pandit474f2252011-07-23 23:17:56 +05303330#ifdef CONFIG_MSM_CAMERA_FLASH_SC628A
3331 {
3332 I2C_BOARD_INFO("sc628a", 0x6E),
3333 },
3334#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003335};
3336#endif
3337
3338/* Sensors DSPS platform data */
3339#ifdef CONFIG_MSM_DSPS
3340#define DSPS_PIL_GENERIC_NAME "dsps"
3341#endif /* CONFIG_MSM_DSPS */
3342
3343static void __init msm8960_init_dsps(void)
3344{
3345#ifdef CONFIG_MSM_DSPS
3346 struct msm_dsps_platform_data *pdata =
3347 msm_dsps_device.dev.platform_data;
3348 pdata->pil_name = DSPS_PIL_GENERIC_NAME;
3349 pdata->gpios = NULL;
3350 pdata->gpios_num = 0;
3351
3352 platform_device_register(&msm_dsps_device);
3353#endif /* CONFIG_MSM_DSPS */
3354}
3355
3356static struct i2c_registry msm8960_i2c_devices[] __initdata = {
3357#ifdef CONFIG_MSM_CAMERA
3358 {
3359 I2C_SURF | I2C_FFA | I2C_FLUID | I2C_RUMI,
3360 MSM_8960_GSBI4_QUP_I2C_BUS_ID,
3361 msm_camera_boardinfo,
3362 ARRAY_SIZE(msm_camera_boardinfo),
3363 },
3364#endif
3365 {
3366 I2C_SURF | I2C_FFA | I2C_FLUID,
3367 MSM_8960_GSBI3_QUP_I2C_BUS_ID,
3368 cyttsp_info,
3369 ARRAY_SIZE(cyttsp_info),
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -07003370 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003371};
3372#endif /* CONFIG_I2C */
3373
3374static void __init register_i2c_devices(void)
3375{
3376#ifdef CONFIG_I2C
3377 u8 mach_mask = 0;
3378 int i;
3379
3380 /* Build the matching 'supported_machs' bitmask */
3381 if (machine_is_msm8960_cdp())
3382 mach_mask = I2C_SURF;
3383 else if (machine_is_msm8960_rumi3())
3384 mach_mask = I2C_RUMI;
3385 else if (machine_is_msm8960_sim())
3386 mach_mask = I2C_SIM;
Amy Maloche2d028032011-07-20 14:08:06 -07003387 else if (machine_is_msm8960_fluid())
3388 mach_mask = I2C_FLUID;
Amy Maloche1b0663f2011-08-02 16:46:22 -07003389 else if (machine_is_msm8960_mtp())
3390 mach_mask = I2C_FFA;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003391 else
3392 pr_err("unmatched machine ID in register_i2c_devices\n");
3393
3394 /* Run the array and install devices as appropriate */
3395 for (i = 0; i < ARRAY_SIZE(msm8960_i2c_devices); ++i) {
3396 if (msm8960_i2c_devices[i].machs & mach_mask)
3397 i2c_register_board_info(msm8960_i2c_devices[i].bus,
3398 msm8960_i2c_devices[i].info,
3399 msm8960_i2c_devices[i].len);
3400 }
3401#endif
3402}
3403
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003404static void __init msm8960_sim_init(void)
3405{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003406 if (socinfo_init() < 0)
3407 pr_err("socinfo_init() failed!\n");
3408
3409 BUG_ON(msm_rpm_init(&msm_rpm_data));
3410 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
3411 ARRAY_SIZE(msm_rpmrs_levels)));
3412 regulator_suppress_info_printing();
Stephen Boydbb600ae2011-08-02 20:11:40 -07003413 msm_clock_init(&msm8960_clock_init_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003414 msm8960_device_ssbi_pm8921.dev.platform_data =
3415 &msm8960_ssbi_pm8921_pdata;
3416 pm8921_platform_data.num_regulators = msm_pm8921_regulator_pdata_len;
3417 msm8960_device_qup_spi_gsbi1.dev.platform_data =
3418 &msm8960_qup_spi_gsbi1_pdata;
3419
3420 /* Simulator supports a QWERTY keypad */
3421 pm8921_platform_data.keypad_pdata = &keypad_data_sim;
3422
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07003423 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
3424 msm8960_device_gadget_peripheral.dev.parent = &msm8960_device_otg.dev;
3425 msm_device_hsusb_host.dev.parent = &msm8960_device_otg.dev;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003426 gpiomux_init();
3427 ethernet_init();
3428 msm8960_i2c_init();
3429 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
3430 msm_spm_l2_init(msm_spm_l2_data);
3431 msm8960_init_buses();
3432 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
3433 pm8921_gpio_mpp_init();
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003434 platform_add_devices(sim_devices, ARRAY_SIZE(sim_devices));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003435 msm_acpu_clock_init(&msm8960_acpu_clock_data);
3436
3437 msm8960_device_qup_spi_gsbi1.dev.platform_data =
3438 &msm8960_qup_spi_gsbi1_pdata;
3439 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
3440
3441 msm8960_init_mmc();
3442 msm_fb_add_devices();
3443 slim_register_board_info(msm_slim_devices,
3444 ARRAY_SIZE(msm_slim_devices));
3445 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
3446 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
3447 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
3448 msm_pm_data);
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003449}
3450
3451static void __init msm8960_rumi3_init(void)
3452{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003453 if (socinfo_init() < 0)
3454 pr_err("socinfo_init() failed!\n");
3455
3456 BUG_ON(msm_rpm_init(&msm_rpm_data));
3457 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
3458 ARRAY_SIZE(msm_rpmrs_levels)));
3459 regulator_suppress_info_printing();
Stephen Boydbb600ae2011-08-02 20:11:40 -07003460 msm_clock_init(&msm8960_dummy_clock_init_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003461 gpiomux_init();
3462 ethernet_init();
3463 msm8960_device_ssbi_pm8921.dev.platform_data =
3464 &msm8960_ssbi_pm8921_pdata;
3465 pm8921_platform_data.num_regulators = msm_pm8921_regulator_pdata_len;
3466 msm8960_device_qup_spi_gsbi1.dev.platform_data =
3467 &msm8960_qup_spi_gsbi1_pdata;
3468 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
3469 msm8960_i2c_init();
3470 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
3471 msm_spm_l2_init(msm_spm_l2_data);
3472 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
3473 pm8921_gpio_mpp_init();
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003474 platform_add_devices(rumi3_devices, ARRAY_SIZE(rumi3_devices));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003475 msm8960_init_mmc();
3476
3477 register_i2c_devices();
3478 msm_fb_add_devices();
3479 slim_register_board_info(msm_slim_devices,
3480 ARRAY_SIZE(msm_slim_devices));
3481 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
3482 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
3483 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
3484 msm_pm_data);
3485}
3486
3487static void __init msm8960_cdp_init(void)
3488{
3489 if (socinfo_init() < 0)
3490 pr_err("socinfo_init() failed!\n");
3491
3492 BUG_ON(msm_rpm_init(&msm_rpm_data));
3493 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
3494 ARRAY_SIZE(msm_rpmrs_levels)));
3495 regulator_suppress_info_printing();
3496 if (msm_xo_init())
3497 pr_err("Failed to initialize XO votes\n");
Stephen Boydbb600ae2011-08-02 20:11:40 -07003498 msm_clock_init(&msm8960_clock_init_data);
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07003499 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
3500 msm8960_device_gadget_peripheral.dev.parent = &msm8960_device_otg.dev;
3501 msm_device_hsusb_host.dev.parent = &msm8960_device_otg.dev;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003502 gpiomux_init();
3503 ethernet_init();
3504 msm8960_device_qup_spi_gsbi1.dev.platform_data =
3505 &msm8960_qup_spi_gsbi1_pdata;
3506 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
3507 msm8960_device_ssbi_pm8921.dev.platform_data =
3508 &msm8960_ssbi_pm8921_pdata;
3509 pm8921_platform_data.num_regulators = msm_pm8921_regulator_pdata_len;
3510 msm8960_i2c_init();
3511 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
3512 msm_spm_l2_init(msm_spm_l2_data);
3513 msm8960_init_buses();
3514 platform_add_devices(msm_footswitch_devices,
3515 msm_num_footswitch_devices);
3516 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
3517 pm8921_gpio_mpp_init();
3518 platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices));
3519 msm8960_init_cam();
3520 msm8960_init_mmc();
3521 msm_acpu_clock_init(&msm8960_acpu_clock_data);
3522 register_i2c_devices();
3523 msm8960_wcnss_init();
3524 msm_fb_add_devices();
3525 slim_register_board_info(msm_slim_devices,
3526 ARRAY_SIZE(msm_slim_devices));
3527 msm8960_init_dsps();
3528 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
3529 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
3530 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
3531 msm_pm_data);
Larry Bassela7eadea2011-07-14 10:46:00 -07003532 change_memory_power = &msm8960_change_memory_power;
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003533}
3534
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08003535MACHINE_START(MSM8960_SIM, "QCT MSM8960 SIMULATOR")
3536 .map_io = msm8960_map_io,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003537 .reserve = msm8960_reserve,
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08003538 .init_irq = msm8960_init_irq,
3539 .timer = &msm_timer,
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003540 .init_machine = msm8960_sim_init,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003541 .init_early = msm8960_allocate_memory_regions,
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08003542MACHINE_END
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08003543
3544MACHINE_START(MSM8960_RUMI3, "QCT MSM8960 RUMI3")
3545 .map_io = msm8960_map_io,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003546 .reserve = msm8960_reserve,
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08003547 .init_irq = msm8960_init_irq,
3548 .timer = &msm_timer,
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003549 .init_machine = msm8960_rumi3_init,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003550 .init_early = msm8960_allocate_memory_regions,
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08003551MACHINE_END
3552
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003553MACHINE_START(MSM8960_CDP, "QCT MSM8960 CDP")
3554 .map_io = msm8960_map_io,
3555 .reserve = msm8960_reserve,
3556 .init_irq = msm8960_init_irq,
3557 .timer = &msm_timer,
3558 .init_machine = msm8960_cdp_init,
3559 .init_early = msm8960_allocate_memory_regions,
3560MACHINE_END
3561
3562MACHINE_START(MSM8960_MTP, "QCT MSM8960 MTP")
3563 .map_io = msm8960_map_io,
3564 .reserve = msm8960_reserve,
3565 .init_irq = msm8960_init_irq,
3566 .timer = &msm_timer,
3567 .init_machine = msm8960_cdp_init,
3568 .init_early = msm8960_allocate_memory_regions,
3569MACHINE_END
3570
3571MACHINE_START(MSM8960_FLUID, "QCT MSM8960 FLUID")
3572 .map_io = msm8960_map_io,
3573 .reserve = msm8960_reserve,
3574 .init_irq = msm8960_init_irq,
3575 .timer = &msm_timer,
3576 .init_machine = msm8960_cdp_init,
3577 .init_early = msm8960_allocate_memory_regions,
3578MACHINE_END
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03003579
3580MACHINE_START(MSM8960_LIQUID, "QCT MSM8960 LIQUID")
3581 .map_io = msm8960_map_io,
3582 .reserve = msm8960_reserve,
3583 .init_irq = msm8960_init_irq,
3584 .timer = &msm_timer,
3585 .init_machine = msm8960_cdp_init,
3586 .init_early = msm8960_allocate_memory_regions,
3587MACHINE_END