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