blob: 386e3b140a4cddeb0d567da0d6d13ac89d7eced1 [file] [log] [blame]
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001/* Copyright (c) 2011, Code Aurora Forum. All rights reserved.
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080012 */
13#include <linux/kernel.h>
14#include <linux/platform_device.h>
15#include <linux/io.h>
16#include <linux/irq.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070017#include <linux/i2c.h>
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -070018#include <linux/i2c/sx150x.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070019#include <linux/gpio.h>
20#include <linux/msm_ssbi.h>
21#include <linux/regulator/gpio-regulator.h>
22#include <linux/mfd/pm8xxx/pm8921.h>
23#include <linux/regulator/consumer.h>
24#include <linux/spi/spi.h>
25#include <linux/slimbus/slimbus.h>
26#include <linux/bootmem.h>
27#ifdef CONFIG_ANDROID_PMEM
28#include <linux/android_pmem.h>
29#endif
30#include <linux/cyttsp.h>
31#include <linux/dma-mapping.h>
32#include <linux/platform_data/qcom_crypto_device.h>
33#include <linux/leds.h>
34#include <linux/leds-pm8xxx.h>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080035
36#include <asm/mach-types.h>
37#include <asm/mach/arch.h>
Larry Basselb4126da2011-07-18 14:31:33 -070038#include <asm/setup.h>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080039#include <asm/hardware/gic.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070040#include <asm/mach/mmc.h>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080041
42#include <mach/board.h>
43#include <mach/msm_iomap.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070044#include <mach/msm_spi.h>
45#ifdef CONFIG_USB_MSM_OTG_72K
46#include <mach/msm_hsusb.h>
47#else
48#include <linux/usb/msm_hsusb.h>
49#endif
50#include <linux/usb/android.h>
51#include <mach/usbdiag.h>
52#include <mach/socinfo.h>
53#include <mach/rpm.h>
54#include <mach/gpio.h>
Rohit Vaswania513aa8d2011-07-18 15:14:28 -070055#include <mach/gpiomux.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070056#include <mach/msm_bus_board.h>
57#include <mach/msm_memtypes.h>
58#include <mach/dma.h>
59#include <mach/msm_dsps.h>
60#include <mach/msm_xo.h>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080061
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070062#ifdef CONFIG_WCD9310_CODEC
63#include <linux/slimbus/slimbus.h>
64#include <linux/mfd/wcd9310/core.h>
65#include <linux/mfd/wcd9310/pdata.h>
66#endif
67
68#include "timer.h"
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -080069#include "devices.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070070#include "devices-msm8x60.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070071#include "spm.h"
72#include "board-msm8960.h"
73#include "pm.h"
74#include "cpuidle.h"
75#include "rpm_resources.h"
76#include "mpm.h"
77
78static struct platform_device msm_fm_platform_init = {
79 .name = "iris_fm",
80 .id = -1,
81};
82
83struct pm8xxx_gpio_init {
84 unsigned gpio;
85 struct pm_gpio config;
86};
87
88struct pm8xxx_mpp_init {
89 unsigned mpp;
90 struct pm8xxx_mpp_config_data config;
91};
92
93#define PM8XXX_GPIO_INIT(_gpio, _dir, _buf, _val, _pull, _vin, _out_strength, \
94 _func, _inv, _disable) \
95{ \
96 .gpio = PM8921_GPIO_PM_TO_SYS(_gpio), \
97 .config = { \
98 .direction = _dir, \
99 .output_buffer = _buf, \
100 .output_value = _val, \
101 .pull = _pull, \
102 .vin_sel = _vin, \
103 .out_strength = _out_strength, \
104 .function = _func, \
105 .inv_int_pol = _inv, \
106 .disable_pin = _disable, \
107 } \
108}
109
110#define PM8XXX_MPP_INIT(_mpp, _type, _level, _control) \
111{ \
112 .mpp = PM8921_MPP_PM_TO_SYS(_mpp), \
113 .config = { \
114 .type = PM8XXX_MPP_TYPE_##_type, \
115 .level = _level, \
116 .control = PM8XXX_MPP_##_control, \
117 } \
118}
119
120#define PM8XXX_GPIO_DISABLE(_gpio) \
121 PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_IN, 0, 0, 0, PM_GPIO_VIN_S4, \
122 0, 0, 0, 1)
123
124#define PM8XXX_GPIO_OUTPUT(_gpio, _val) \
125 PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_OUT, PM_GPIO_OUT_BUF_CMOS, _val, \
126 PM_GPIO_PULL_NO, PM_GPIO_VIN_S4, \
127 PM_GPIO_STRENGTH_HIGH, \
128 PM_GPIO_FUNC_NORMAL, 0, 0)
129
130#define PM8XXX_GPIO_INPUT(_gpio, _pull) \
131 PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_IN, PM_GPIO_OUT_BUF_CMOS, 0, \
132 _pull, PM_GPIO_VIN_S4, \
133 PM_GPIO_STRENGTH_NO, \
134 PM_GPIO_FUNC_NORMAL, 0, 0)
135
136#define PM8XXX_GPIO_OUTPUT_FUNC(_gpio, _val, _func) \
137 PM8XXX_GPIO_INIT(_gpio, PM_GPIO_DIR_OUT, PM_GPIO_OUT_BUF_CMOS, _val, \
138 PM_GPIO_PULL_NO, PM_GPIO_VIN_S4, \
139 PM_GPIO_STRENGTH_HIGH, \
140 _func, 0, 0)
141
142/* Initial PM8921 GPIO configurations */
143static struct pm8xxx_gpio_init pm8921_gpios[] __initdata = {
144 PM8XXX_GPIO_DISABLE(6), /* Disable unused */
145 PM8XXX_GPIO_DISABLE(7), /* Disable NFC */
146 PM8XXX_GPIO_INPUT(16, PM_GPIO_PULL_UP_30), /* SD_CARD_WP */
147 PM8XXX_GPIO_DISABLE(22), /* Disable NFC */
Nagamalleswararao Ganjieac5dfa2011-07-23 17:31:16 -0700148 PM8XXX_GPIO_OUTPUT_FUNC(24, 0, PM_GPIO_FUNC_2), /* Bl: Off, PWM mode */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700149 PM8XXX_GPIO_INPUT(26, PM_GPIO_PULL_UP_30), /* SD_CARD_DET_N */
150 PM8XXX_GPIO_OUTPUT(43, 0), /* DISP_RESET_N */
151};
152
153/* Initial PM8921 MPP configurations */
154static struct pm8xxx_mpp_init pm8921_mpps[] __initdata = {
155 /* External 5V regulator enable; shared by HDMI and USB_OTG switches. */
156 PM8XXX_MPP_INIT(7, D_INPUT, PM8921_MPP_DIG_LEVEL_VPH, DIN_TO_INT),
157 PM8XXX_MPP_INIT(PM8921_AMUX_MPP_3, A_INPUT, PM8XXX_MPP_AIN_AMUX_CH6,
158 DOUT_CTRL_LOW),
159 PM8XXX_MPP_INIT(PM8921_AMUX_MPP_8, A_INPUT, PM8XXX_MPP_AIN_AMUX_CH8,
160 DOUT_CTRL_LOW),
161};
162
163static void __init pm8921_gpio_mpp_init(void)
164{
165 int i, rc;
166
167 for (i = 0; i < ARRAY_SIZE(pm8921_gpios); i++) {
168 rc = pm8xxx_gpio_config(pm8921_gpios[i].gpio,
169 &pm8921_gpios[i].config);
170 if (rc) {
171 pr_err("%s: pm8xxx_gpio_config: rc=%d\n", __func__, rc);
172 break;
173 }
174 }
175
176 for (i = 0; i < ARRAY_SIZE(pm8921_mpps); i++) {
177 rc = pm8xxx_mpp_config(pm8921_mpps[i].mpp,
178 &pm8921_mpps[i].config);
179 if (rc) {
180 pr_err("%s: pm8xxx_mpp_config: rc=%d\n", __func__, rc);
181 break;
182 }
183 }
184}
185
186#define FPGA_CS_GPIO 14
187#define KS8851_RST_GPIO 89
188#define KS8851_IRQ_GPIO 90
189
190/* Macros assume PMIC GPIOs and MPPs start at 1 */
191#define PM8921_GPIO_BASE NR_GPIO_IRQS
192#define PM8921_GPIO_PM_TO_SYS(pm_gpio) (pm_gpio - 1 + PM8921_GPIO_BASE)
193#define PM8921_MPP_BASE (PM8921_GPIO_BASE + PM8921_NR_GPIOS)
194#define PM8921_MPP_PM_TO_SYS(pm_gpio) (pm_gpio - 1 + PM8921_MPP_BASE)
195#define PM8921_IRQ_BASE (NR_MSM_IRQS + NR_GPIO_IRQS)
196#define PM8921_MPP_IRQ_BASE (PM8921_IRQ_BASE + NR_GPIO_IRQS)
197
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700198#if defined(CONFIG_GPIO_SX150X) || defined(CONFIG_GPIO_SX150X_MODULE)
199enum {
200 GPIO_EXPANDER_IRQ_BASE = (PM8921_MPP_IRQ_BASE + PM8921_NR_MPPS),
201 GPIO_EXPANDER_GPIO_BASE = (PM8921_MPP_BASE + PM8921_NR_MPPS),
202 /* CAM Expander */
203 GPIO_CAM_EXPANDER_BASE = GPIO_EXPANDER_GPIO_BASE,
204 GPIO_CAM_GP_STROBE_READY = GPIO_CAM_EXPANDER_BASE,
205 GPIO_CAM_GP_AFBUSY,
206 GPIO_CAM_GP_STROBE_CE,
207 GPIO_CAM_GP_CAM1MP_XCLR,
208 GPIO_CAM_GP_CAMIF_RESET_N,
209 GPIO_CAM_GP_XMT_FLASH_INT,
210 GPIO_CAM_GP_LED_EN1,
211 GPIO_CAM_GP_LED_EN2,
212
213};
214#endif
215
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700216static struct gpiomux_setting gsbi1 = {
217 .func = GPIOMUX_FUNC_1,
218 .drv = GPIOMUX_DRV_8MA,
219 .pull = GPIOMUX_PULL_NONE,
220};
221
222static struct gpiomux_setting gsbi3 = {
223 .func = GPIOMUX_FUNC_1,
224 .drv = GPIOMUX_DRV_8MA,
225 .pull = GPIOMUX_PULL_NONE,
226};
227
228static struct gpiomux_setting gsbi4 = {
229 .func = GPIOMUX_FUNC_1,
230 .drv = GPIOMUX_DRV_8MA,
231 .pull = GPIOMUX_PULL_NONE,
232};
233
234static struct gpiomux_setting gsbi5 = {
235 .func = GPIOMUX_FUNC_1,
236 .drv = GPIOMUX_DRV_8MA,
237 .pull = GPIOMUX_PULL_NONE,
238};
239
240static struct gpiomux_setting gsbi10 = {
241 .func = GPIOMUX_FUNC_2,
242 .drv = GPIOMUX_DRV_8MA,
243 .pull = GPIOMUX_PULL_NONE,
244};
245
246static struct gpiomux_setting gsbi12 = {
247 .func = GPIOMUX_FUNC_1,
248 .drv = GPIOMUX_DRV_8MA,
249 .pull = GPIOMUX_PULL_NONE,
250};
251
252static struct gpiomux_setting cdc_mclk = {
253 .func = GPIOMUX_FUNC_1,
254 .drv = GPIOMUX_DRV_8MA,
255 .pull = GPIOMUX_PULL_NONE,
256};
257
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;
Nagamalleswararao Ganjieac5dfa2011-07-23 17:31:16 -07001029 static int gpio43;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001030 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
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001044 pr_info("%s: state : %d\n", __func__, on);
1045
1046 if (!dsi_power_on) {
1047
1048 reg_l8 = regulator_get(&msm_mipi_dsi1_device.dev,
1049 "dsi_vdc");
1050 if (IS_ERR(reg_l8)) {
1051 pr_err("could not get 8921_l8, rc = %ld\n",
1052 PTR_ERR(reg_l8));
1053 return -ENODEV;
1054 }
1055
1056 reg_l23 = regulator_get(&msm_mipi_dsi1_device.dev,
1057 "dsi_vddio");
1058 if (IS_ERR(reg_l23)) {
1059 pr_err("could not get 8921_l23, rc = %ld\n",
1060 PTR_ERR(reg_l23));
1061 return -ENODEV;
1062 }
1063
1064 reg_l2 = regulator_get(&msm_mipi_dsi1_device.dev,
1065 "dsi_vdda");
1066 if (IS_ERR(reg_l2)) {
1067 pr_err("could not get 8921_l2, rc = %ld\n",
1068 PTR_ERR(reg_l2));
1069 return -ENODEV;
1070 }
1071
1072 rc = regulator_set_voltage(reg_l8, 2800000, 3000000);
1073 if (rc) {
1074 pr_err("set_voltage l8 failed, rc=%d\n", rc);
1075 return -EINVAL;
1076 }
1077 rc = regulator_set_voltage(reg_l23, 1800000, 1800000);
1078 if (rc) {
1079 pr_err("set_voltage l23 failed, rc=%d\n", rc);
1080 return -EINVAL;
1081 }
1082 rc = regulator_set_voltage(reg_l2, 1200000, 1200000);
1083 if (rc) {
1084 pr_err("set_voltage l2 failed, rc=%d\n", rc);
1085 return -EINVAL;
1086 }
1087
1088 gpio43 = PM8921_GPIO_PM_TO_SYS(43);
1089 rc = gpio_request(gpio43, "disp_rst_n");
1090 if (rc) {
1091 pr_err("request gpio 43 failed, rc=%d\n", rc);
1092 return -ENODEV;
1093 }
1094
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001095 dsi_power_on = true;
1096 }
1097
1098 if (on) {
1099 rc = regulator_set_optimum_mode(reg_l8, 100000);
1100 if (rc < 0) {
1101 pr_err("set_optimum_mode l8 failed, rc=%d\n", rc);
1102 return -EINVAL;
1103 }
1104 rc = regulator_set_optimum_mode(reg_l23, 100000);
1105 if (rc < 0) {
1106 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
1107 return -EINVAL;
1108 }
1109 rc = regulator_set_optimum_mode(reg_l2, 100000);
1110 if (rc < 0) {
1111 pr_err("set_optimum_mode l2 failed, rc=%d\n", rc);
1112 return -EINVAL;
1113 }
1114 rc = regulator_enable(reg_l8);
1115 if (rc) {
1116 pr_err("enable l8 failed, rc=%d\n", rc);
1117 return -ENODEV;
1118 }
1119 rc = regulator_enable(reg_l23);
1120 if (rc) {
1121 pr_err("enable l8 failed, rc=%d\n", rc);
1122 return -ENODEV;
1123 }
1124 rc = regulator_enable(reg_l2);
1125 if (rc) {
1126 pr_err("enable l2 failed, rc=%d\n", rc);
1127 return -ENODEV;
1128 }
1129
1130 gpio43_param.pull = PM_GPIO_PULL_NO;
1131 rc = pm8xxx_gpio_config(gpio43, &gpio43_param);
1132 if (rc) {
1133 pr_err("gpio_config 43 failed (1), rc=%d\n", rc);
1134 return -EINVAL;
1135 }
1136 gpio43_param.pull = PM_GPIO_PULL_UP_30;
1137 rc = pm8xxx_gpio_config(gpio43, &gpio43_param);
1138 if (rc) {
1139 pr_err("gpio_config 43 failed (2), rc=%d\n", rc);
1140 return -EINVAL;
1141 }
1142 gpio43_param.pull = PM_GPIO_PULL_NO;
1143 rc = pm8xxx_gpio_config(gpio43, &gpio43_param);
1144 if (rc) {
1145 pr_err("gpio_config 43 failed (3), rc=%d\n", rc);
1146 return -EINVAL;
1147 }
1148 gpio43_param.pull = PM_GPIO_PULL_UP_30;
1149 rc = pm8xxx_gpio_config(gpio43, &gpio43_param);
1150 if (rc) {
1151 pr_err("gpio_config 43 failed (4), rc=%d\n", rc);
1152 return -EINVAL;
1153 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001154 gpio_set_value_cansleep(gpio43, 1);
1155 } else {
1156 rc = regulator_set_optimum_mode(reg_l8, 100);
1157 if (rc < 0) {
1158 pr_err("set_optimum_mode l8 failed, rc=%d\n", rc);
1159 return -EINVAL;
1160 }
1161 rc = regulator_set_optimum_mode(reg_l23, 100);
1162 if (rc < 0) {
1163 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
1164 return -EINVAL;
1165 }
1166 rc = regulator_set_optimum_mode(reg_l2, 100);
1167 if (rc < 0) {
1168 pr_err("set_optimum_mode l2 failed, rc=%d\n", rc);
1169 return -EINVAL;
1170 }
1171 gpio_set_value_cansleep(gpio43, 0);
1172 }
1173 return 0;
1174}
1175
1176static struct mipi_dsi_platform_data mipi_dsi_pdata = {
1177 .vsync_gpio = MDP_VSYNC_GPIO,
1178 .dsi_power_save = mipi_dsi_panel_power,
1179};
1180
1181#ifdef CONFIG_MSM_BUS_SCALING
1182
1183static struct msm_bus_vectors mdp_init_vectors[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001184 {
1185 .src = MSM_BUS_MASTER_MDP_PORT0,
1186 .dst = MSM_BUS_SLAVE_EBI_CH0,
1187 .ab = 0,
1188 .ib = 0,
1189 },
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001190};
1191
1192static struct msm_bus_vectors mdp_ui_vectors[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001193 {
1194 .src = MSM_BUS_MASTER_MDP_PORT0,
1195 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001196 .ab = 216000000 * 2,
1197 .ib = 270000000 * 2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001198 },
1199};
1200
1201static struct msm_bus_vectors mdp_vga_vectors[] = {
1202 /* VGA and less video */
1203 {
1204 .src = MSM_BUS_MASTER_MDP_PORT0,
1205 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001206 .ab = 216000000 * 2,
1207 .ib = 270000000 * 2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001208 },
1209};
1210
1211static struct msm_bus_vectors mdp_720p_vectors[] = {
1212 /* 720p and less video */
1213 {
1214 .src = MSM_BUS_MASTER_MDP_PORT0,
1215 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001216 .ab = 230400000 * 2,
1217 .ib = 288000000 * 2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001218 },
1219};
1220
1221static struct msm_bus_vectors mdp_1080p_vectors[] = {
1222 /* 1080p and less video */
1223 {
1224 .src = MSM_BUS_MASTER_MDP_PORT0,
1225 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001226 .ab = 334080000 * 2,
1227 .ib = 417600000 * 2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001228 },
1229};
1230
1231static struct msm_bus_paths mdp_bus_scale_usecases[] = {
1232 {
1233 ARRAY_SIZE(mdp_init_vectors),
1234 mdp_init_vectors,
1235 },
1236 {
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001237 ARRAY_SIZE(mdp_ui_vectors),
1238 mdp_ui_vectors,
1239 },
1240 {
1241 ARRAY_SIZE(mdp_ui_vectors),
1242 mdp_ui_vectors,
1243 },
1244 {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001245 ARRAY_SIZE(mdp_vga_vectors),
1246 mdp_vga_vectors,
1247 },
1248 {
1249 ARRAY_SIZE(mdp_720p_vectors),
1250 mdp_720p_vectors,
1251 },
1252 {
1253 ARRAY_SIZE(mdp_1080p_vectors),
1254 mdp_1080p_vectors,
1255 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001256};
1257
1258static struct msm_bus_scale_pdata mdp_bus_scale_pdata = {
1259 mdp_bus_scale_usecases,
1260 ARRAY_SIZE(mdp_bus_scale_usecases),
1261 .name = "mdp",
1262};
1263
1264#endif
1265
1266int mdp_core_clk_rate_table[] = {
1267 85330000,
1268 85330000,
1269 128000000,
1270 200000000,
1271 200000000,
1272};
1273
1274static struct msm_panel_common_pdata mdp_pdata = {
1275 .gpio = MDP_VSYNC_GPIO,
1276 .mdp_core_clk_rate = 85330000,
1277 .mdp_core_clk_table = mdp_core_clk_rate_table,
1278 .num_mdp_clk = ARRAY_SIZE(mdp_core_clk_rate_table),
1279#ifdef CONFIG_MSM_BUS_SCALING
1280 .mdp_bus_scale_table = &mdp_bus_scale_pdata,
1281#endif
1282 .mdp_rev = MDP_REV_42,
1283};
1284
1285static struct platform_device mipi_dsi_renesas_panel_device = {
1286 .name = "mipi_renesas",
1287 .id = 0,
1288};
1289
1290static struct platform_device mipi_dsi_simulator_panel_device = {
1291 .name = "mipi_simulator",
1292 .id = 0,
1293};
1294
Nagamalleswararao Ganjieac5dfa2011-07-23 17:31:16 -07001295#define LPM_CHANNEL0 0
1296static int toshiba_gpio[] = {LPM_CHANNEL0};
1297
1298static struct mipi_dsi_panel_platform_data toshiba_pdata = {
1299 .gpio = toshiba_gpio,
1300};
1301
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001302static struct platform_device mipi_dsi_toshiba_panel_device = {
1303 .name = "mipi_toshiba",
1304 .id = 0,
Nagamalleswararao Ganjieac5dfa2011-07-23 17:31:16 -07001305 .dev = {
1306 .platform_data = &toshiba_pdata,
1307 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001308};
1309
1310#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
1311static struct resource hdmi_msm_resources[] = {
1312 {
1313 .name = "hdmi_msm_qfprom_addr",
1314 .start = 0x00700000,
1315 .end = 0x007060FF,
1316 .flags = IORESOURCE_MEM,
1317 },
1318 {
1319 .name = "hdmi_msm_hdmi_addr",
1320 .start = 0x04A00000,
1321 .end = 0x04A00FFF,
1322 .flags = IORESOURCE_MEM,
1323 },
1324 {
1325 .name = "hdmi_msm_irq",
1326 .start = HDMI_IRQ,
1327 .end = HDMI_IRQ,
1328 .flags = IORESOURCE_IRQ,
1329 },
1330};
1331
1332static int hdmi_enable_5v(int on);
1333static int hdmi_core_power(int on, int show);
1334static int hdmi_cec_power(int on);
1335
1336static struct msm_hdmi_platform_data hdmi_msm_data = {
1337 .irq = HDMI_IRQ,
1338 .enable_5v = hdmi_enable_5v,
1339 .core_power = hdmi_core_power,
1340 .cec_power = hdmi_cec_power,
1341};
1342
1343static struct platform_device hdmi_msm_device = {
1344 .name = "hdmi_msm",
1345 .id = 0,
1346 .num_resources = ARRAY_SIZE(hdmi_msm_resources),
1347 .resource = hdmi_msm_resources,
1348 .dev.platform_data = &hdmi_msm_data,
1349};
1350#endif /* CONFIG_FB_MSM_HDMI_MSM_PANEL */
1351
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001352#ifdef CONFIG_MSM_BUS_SCALING
1353static struct msm_bus_vectors dtv_bus_init_vectors[] = {
1354 {
1355 .src = MSM_BUS_MASTER_MDP_PORT0,
1356 .dst = MSM_BUS_SLAVE_EBI_CH0,
1357 .ab = 0,
1358 .ib = 0,
1359 },
1360};
1361static struct msm_bus_vectors dtv_bus_def_vectors[] = {
1362 {
1363 .src = MSM_BUS_MASTER_MDP_PORT0,
1364 .dst = MSM_BUS_SLAVE_EBI_CH0,
1365 .ab = 566092800 * 2,
1366 .ib = 707616000 * 2,
1367 },
1368};
1369static struct msm_bus_paths dtv_bus_scale_usecases[] = {
1370 {
1371 ARRAY_SIZE(dtv_bus_init_vectors),
1372 dtv_bus_init_vectors,
1373 },
1374 {
1375 ARRAY_SIZE(dtv_bus_def_vectors),
1376 dtv_bus_def_vectors,
1377 },
1378};
1379static struct msm_bus_scale_pdata dtv_bus_scale_pdata = {
1380 dtv_bus_scale_usecases,
1381 ARRAY_SIZE(dtv_bus_scale_usecases),
1382 .name = "dtv",
1383};
1384
1385static struct lcdc_platform_data dtv_pdata = {
1386 .bus_scale_table = &dtv_bus_scale_pdata,
1387};
1388#endif
1389
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001390static void __init msm_fb_add_devices(void)
1391{
1392 if (machine_is_msm8x60_rumi3()) {
1393 msm_fb_register_device("mdp", NULL);
1394 mipi_dsi_pdata.target_type = 1;
1395 } else
1396 msm_fb_register_device("mdp", &mdp_pdata);
1397 msm_fb_register_device("mipi_dsi", &mipi_dsi_pdata);
Ravishangar Kalyanam882930f2011-07-08 17:51:52 -07001398#ifdef CONFIG_MSM_BUS_SCALING
1399 msm_fb_register_device("dtv", &dtv_pdata);
1400#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001401}
1402
1403#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
1404static struct gpiomux_setting hdmi_suspend_cfg = {
1405 .func = GPIOMUX_FUNC_GPIO,
1406 .drv = GPIOMUX_DRV_2MA,
1407 .pull = GPIOMUX_PULL_DOWN,
1408};
1409
1410static struct gpiomux_setting hdmi_active_1_cfg = {
1411 .func = GPIOMUX_FUNC_1,
1412 .drv = GPIOMUX_DRV_2MA,
1413 .pull = GPIOMUX_PULL_UP,
1414};
1415
1416static struct gpiomux_setting hdmi_active_2_cfg = {
1417 .func = GPIOMUX_FUNC_1,
1418 .drv = GPIOMUX_DRV_2MA,
1419 .pull = GPIOMUX_PULL_DOWN,
1420};
1421
1422static struct msm_gpiomux_config msm8960_hdmi_configs[] __initdata = {
1423 {
1424 .gpio = 99,
1425 .settings = {
1426 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
1427 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
1428 },
1429 },
1430 {
1431 .gpio = 100,
1432 .settings = {
1433 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
1434 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
1435 },
1436 },
1437 {
1438 .gpio = 101,
1439 .settings = {
1440 [GPIOMUX_ACTIVE] = &hdmi_active_1_cfg,
1441 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
1442 },
1443 },
1444 {
1445 .gpio = 102,
1446 .settings = {
1447 [GPIOMUX_ACTIVE] = &hdmi_active_2_cfg,
1448 [GPIOMUX_SUSPENDED] = &hdmi_suspend_cfg,
1449 },
1450 },
1451};
1452
1453static int hdmi_enable_5v(int on)
1454{
1455 /* TBD: PM8921 regulator instead of 8901 */
1456 static struct regulator *reg_8921_hdmi_mvs; /* HDMI_5V */
1457 static int prev_on;
1458 int rc;
1459
1460 if (on == prev_on)
1461 return 0;
1462
1463 if (!reg_8921_hdmi_mvs)
1464 reg_8921_hdmi_mvs = regulator_get(&hdmi_msm_device.dev,
1465 "hdmi_mvs");
1466
1467 if (on) {
1468 rc = regulator_enable(reg_8921_hdmi_mvs);
1469 if (rc) {
1470 pr_err("'%s' regulator enable failed, rc=%d\n",
1471 "8921_hdmi_mvs", rc);
1472 return rc;
1473 }
1474 pr_debug("%s(on): success\n", __func__);
1475 } else {
1476 rc = regulator_disable(reg_8921_hdmi_mvs);
1477 if (rc)
1478 pr_warning("'%s' regulator disable failed, rc=%d\n",
1479 "8921_hdmi_mvs", rc);
1480 pr_debug("%s(off): success\n", __func__);
1481 }
1482
1483 prev_on = on;
1484
1485 return 0;
1486}
1487
1488static int hdmi_core_power(int on, int show)
1489{
1490 static struct regulator *reg_8921_l23, *reg_8921_s4;
1491 static int prev_on;
1492 int rc;
1493
1494 if (on == prev_on)
1495 return 0;
1496
1497 /* TBD: PM8921 regulator instead of 8901 */
1498 if (!reg_8921_l23)
1499 reg_8921_l23 = regulator_get(&hdmi_msm_device.dev, "hdmi_avdd");
1500
1501 if (!reg_8921_s4)
1502 reg_8921_s4 = regulator_get(&hdmi_msm_device.dev, "hdmi_vcc");
1503
1504 if (on) {
1505 rc = regulator_set_optimum_mode(reg_8921_l23, 100000);
1506 if (rc < 0) {
1507 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
1508 return -EINVAL;
1509 }
1510
1511 rc = regulator_set_voltage(reg_8921_l23, 1800000, 1800000);
1512 if (!rc)
1513 rc = regulator_enable(reg_8921_l23);
1514 if (rc) {
1515 pr_err("'%s' regulator enable failed, rc=%d\n",
1516 "hdmi_avdd", rc);
1517 return rc;
1518 }
1519 rc = regulator_set_voltage(reg_8921_s4, 1800000, 1800000);
1520 if (!rc)
1521 rc = regulator_enable(reg_8921_s4);
1522 if (rc) {
1523 pr_err("'%s' regulator enable failed, rc=%d\n",
1524 "hdmi_vcc", rc);
1525 return rc;
1526 }
1527
1528 rc = gpio_request(100, "HDMI_DDC_CLK");
1529 if (rc) {
1530 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
1531 "HDMI_DDC_CLK", 100, rc);
1532 goto error1;
1533 }
1534 rc = gpio_request(101, "HDMI_DDC_DATA");
1535 if (rc) {
1536 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
1537 "HDMI_DDC_DATA", 101, rc);
1538 goto error2;
1539 }
1540 rc = gpio_request(102, "HDMI_HPD");
1541 if (rc) {
1542 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
1543 "HDMI_HPD", 102, rc);
1544 goto error3;
1545 }
1546 pr_debug("%s(on): success\n", __func__);
1547 } else {
1548 gpio_free(100);
1549 gpio_free(101);
1550 gpio_free(102);
1551
1552 rc = regulator_set_optimum_mode(reg_8921_l23, 100);
1553 if (rc < 0) {
1554 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
1555 return -EINVAL;
1556 }
1557
1558 pr_debug("%s(off): success\n", __func__);
1559 }
1560
1561 prev_on = on;
1562
1563 return 0;
1564
1565error3:
1566 gpio_free(101);
1567error2:
1568 gpio_free(100);
1569error1:
1570 regulator_disable(reg_8921_l23);
1571 return rc;
1572}
1573
1574static int hdmi_cec_power(int on)
1575{
1576 static int prev_on;
1577 int rc;
1578
1579 if (on == prev_on)
1580 return 0;
1581
1582 if (on) {
1583 rc = gpio_request(99, "HDMI_CEC_VAR");
1584 if (rc) {
1585 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
1586 "HDMI_CEC_VAR", 99, rc);
1587 goto error;
1588 }
1589 pr_debug("%s(on): success\n", __func__);
1590 } else {
1591 gpio_free(99);
1592 pr_debug("%s(off): success\n", __func__);
1593 }
1594
1595 prev_on = on;
1596
1597 return 0;
1598error:
1599 return rc;
1600}
1601#endif /* CONFIG_FB_MSM_HDMI_MSM_PANEL */
1602
1603static void __init msm8960_allocate_memory_regions(void)
1604{
1605 void *addr;
1606 unsigned long size;
1607
1608 size = MSM_FB_SIZE;
1609 addr = alloc_bootmem_align(size, 0x1000);
1610 msm_fb_resources[0].start = __pa(addr);
1611 msm_fb_resources[0].end = msm_fb_resources[0].start + size - 1;
1612 pr_info("allocating %lu bytes at %p (%lx physical) for fb\n",
1613 size, addr, __pa(addr));
1614
1615}
1616#ifdef CONFIG_WCD9310_CODEC
1617
1618#define TABLA_INTERRUPT_BASE (NR_MSM_IRQS + NR_GPIO_IRQS + NR_PM8921_IRQS)
1619
1620static struct tabla_pdata tabla_platform_data = {
1621 .slimbus_slave_device = {
1622 .name = "tabla-slave",
1623 .e_addr = {0, 0, 0x10, 0, 0x17, 2},
1624 },
1625 .irq = MSM_GPIO_TO_INT(62),
1626 .irq_base = TABLA_INTERRUPT_BASE,
1627 .num_irqs = NR_TABLA_IRQS,
1628 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
1629};
1630
1631static struct slim_device msm_slim_tabla = {
1632 .name = "tabla-slim",
1633 .e_addr = {0, 1, 0x10, 0, 0x17, 2},
1634 .dev = {
1635 .platform_data = &tabla_platform_data,
1636 },
1637};
1638#endif
1639
1640static struct slim_boardinfo msm_slim_devices[] = {
1641#ifdef CONFIG_WCD9310_CODEC
1642 {
1643 .bus_num = 1,
1644 .slim_slave = &msm_slim_tabla,
1645 },
1646#endif
1647 /* add more slimbus slaves as needed */
1648};
1649
Yunsen Wang5c1a7392011-07-09 19:10:16 -07001650#define MSM_WCNSS_PHYS 0x03000000
1651#define MSM_WCNSS_SIZE 0x280000
1652
1653static struct resource resources_wcnss_wlan[] = {
1654 {
1655 .start = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
1656 .end = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
1657 .name = "wcnss_wlanrx_irq",
1658 .flags = IORESOURCE_IRQ,
1659 },
1660 {
1661 .start = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
1662 .end = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
1663 .name = "wcnss_wlantx_irq",
1664 .flags = IORESOURCE_IRQ,
1665 },
1666 {
1667 .start = MSM_WCNSS_PHYS,
1668 .end = MSM_WCNSS_PHYS + MSM_WCNSS_SIZE - 1,
1669 .name = "wcnss_mmio",
1670 .flags = IORESOURCE_MEM,
1671 },
1672};
1673
1674static struct platform_device msm_device_wcnss_wlan = {
1675 .name = "wcnss_wlan",
1676 .id = 0,
1677 .num_resources = ARRAY_SIZE(resources_wcnss_wlan),
1678 .resource = resources_wcnss_wlan,
1679};
1680
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001681#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1682 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
1683 defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1684 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1685
1686#define QCE_SIZE 0x10000
1687#define QCE_0_BASE 0x18500000
1688
1689#define QCE_HW_KEY_SUPPORT 0
1690#define QCE_SHA_HMAC_SUPPORT 1
1691#define QCE_SHARE_CE_RESOURCE 1
1692#define QCE_CE_SHARED 0
1693
1694static struct resource qcrypto_resources[] = {
1695 [0] = {
1696 .start = QCE_0_BASE,
1697 .end = QCE_0_BASE + QCE_SIZE - 1,
1698 .flags = IORESOURCE_MEM,
1699 },
1700 [1] = {
1701 .name = "crypto_channels",
1702 .start = DMOV_CE_IN_CHAN,
1703 .end = DMOV_CE_OUT_CHAN,
1704 .flags = IORESOURCE_DMA,
1705 },
1706 [2] = {
1707 .name = "crypto_crci_in",
1708 .start = DMOV_CE_IN_CRCI,
1709 .end = DMOV_CE_IN_CRCI,
1710 .flags = IORESOURCE_DMA,
1711 },
1712 [3] = {
1713 .name = "crypto_crci_out",
1714 .start = DMOV_CE_OUT_CRCI,
1715 .end = DMOV_CE_OUT_CRCI,
1716 .flags = IORESOURCE_DMA,
1717 },
1718};
1719
1720static struct resource qcedev_resources[] = {
1721 [0] = {
1722 .start = QCE_0_BASE,
1723 .end = QCE_0_BASE + QCE_SIZE - 1,
1724 .flags = IORESOURCE_MEM,
1725 },
1726 [1] = {
1727 .name = "crypto_channels",
1728 .start = DMOV_CE_IN_CHAN,
1729 .end = DMOV_CE_OUT_CHAN,
1730 .flags = IORESOURCE_DMA,
1731 },
1732 [2] = {
1733 .name = "crypto_crci_in",
1734 .start = DMOV_CE_IN_CRCI,
1735 .end = DMOV_CE_IN_CRCI,
1736 .flags = IORESOURCE_DMA,
1737 },
1738 [3] = {
1739 .name = "crypto_crci_out",
1740 .start = DMOV_CE_OUT_CRCI,
1741 .end = DMOV_CE_OUT_CRCI,
1742 .flags = IORESOURCE_DMA,
1743 },
1744};
1745
1746#endif
1747
1748#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1749 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
1750
1751static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
1752 .ce_shared = QCE_CE_SHARED,
1753 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
1754 .hw_key_support = QCE_HW_KEY_SUPPORT,
1755 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
1756};
1757
1758static struct platform_device qcrypto_device = {
1759 .name = "qcrypto",
1760 .id = 0,
1761 .num_resources = ARRAY_SIZE(qcrypto_resources),
1762 .resource = qcrypto_resources,
1763 .dev = {
1764 .coherent_dma_mask = DMA_BIT_MASK(32),
1765 .platform_data = &qcrypto_ce_hw_suppport,
1766 },
1767};
1768#endif
1769
1770#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1771 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1772
1773static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
1774 .ce_shared = QCE_CE_SHARED,
1775 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
1776 .hw_key_support = QCE_HW_KEY_SUPPORT,
1777 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
1778};
1779
1780static struct platform_device qcedev_device = {
1781 .name = "qce",
1782 .id = 0,
1783 .num_resources = ARRAY_SIZE(qcedev_resources),
1784 .resource = qcedev_resources,
1785 .dev = {
1786 .coherent_dma_mask = DMA_BIT_MASK(32),
1787 .platform_data = &qcedev_ce_hw_suppport,
1788 },
1789};
1790#endif
1791
1792
1793static int __init gpiomux_init(void)
1794{
1795 int rc;
1796
1797 rc = msm_gpiomux_init(NR_GPIO_IRQS);
1798 if (rc) {
1799 pr_err(KERN_ERR "msm_gpiomux_init failed %d\n", rc);
1800 return rc;
1801 }
1802
1803 msm_gpiomux_install(msm8960_cam_configs,
1804 ARRAY_SIZE(msm8960_cam_configs));
1805
1806 msm_gpiomux_install(msm8960_gpiomux_configs,
1807 ARRAY_SIZE(msm8960_gsbi_configs));
1808
1809 msm_gpiomux_install(msm8960_gsbi_configs,
1810 ARRAY_SIZE(msm8960_gsbi_configs));
1811
1812 msm_gpiomux_install(msm8960_cyts_configs,
1813 ARRAY_SIZE(msm8960_cyts_configs));
1814
1815 msm_gpiomux_install(msm8960_slimbus_config,
1816 ARRAY_SIZE(msm8960_slimbus_config));
1817
1818 msm_gpiomux_install(msm8960_audio_codec_configs,
1819 ARRAY_SIZE(msm8960_audio_codec_configs));
1820
1821#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
1822 msm_gpiomux_install(msm8960_hdmi_configs,
1823 ARRAY_SIZE(msm8960_hdmi_configs));
1824#endif
1825
1826 msm_gpiomux_install(wcnss_5wire_interface,
1827 ARRAY_SIZE(wcnss_5wire_interface));
1828
1829 return 0;
1830}
1831
1832static struct msm_acpu_clock_platform_data msm8960_acpu_clock_data = {
1833 .acpu_switch_time_us = 0,
1834 .vdd_switch_time_us = 0,
1835};
1836
1837#define MSM_SHARED_RAM_PHYS 0x80000000
1838
1839static struct pm8921_adc_amux pm8921_adc_channels_data[] = {
1840 {"vcoin", CHANNEL_VCOIN, CHAN_PATH_SCALING2, AMUX_RSV1,
1841 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
1842 {"vbat", CHANNEL_VBAT, CHAN_PATH_SCALING2, AMUX_RSV1,
1843 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
1844 {"dcin", CHANNEL_DCIN, CHAN_PATH_SCALING4, AMUX_RSV1,
1845 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
1846 {"ichg", CHANNEL_ICHG, CHAN_PATH_SCALING1, AMUX_RSV1,
1847 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
1848 {"vph_pwr", CHANNEL_VPH_PWR, CHAN_PATH_SCALING2, AMUX_RSV1,
1849 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
1850 {"ibat", CHANNEL_IBAT, CHAN_PATH_SCALING1, AMUX_RSV1,
1851 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
1852 {"m4", CHANNEL_MPP_1, CHAN_PATH_SCALING1, AMUX_RSV1,
1853 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
1854 {"m5", CHANNEL_MPP_2, CHAN_PATH_SCALING2, AMUX_RSV1,
1855 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
1856 {"batt_therm", CHANNEL_BATT_THERM, CHAN_PATH_SCALING1, AMUX_RSV2,
1857 ADC_DECIMATION_TYPE2, ADC_SCALE_BATT_THERM},
1858 {"batt_id", CHANNEL_BATT_ID, CHAN_PATH_SCALING1, AMUX_RSV1,
1859 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
1860 {"usbin", CHANNEL_USBIN, CHAN_PATH_SCALING3, AMUX_RSV1,
1861 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
1862 {"pmic_therm", CHANNEL_DIE_TEMP, CHAN_PATH_SCALING1, AMUX_RSV1,
1863 ADC_DECIMATION_TYPE2, ADC_SCALE_PMIC_THERM},
1864 {"625mv", CHANNEL_625MV, CHAN_PATH_SCALING1, AMUX_RSV1,
1865 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
1866 {"125v", CHANNEL_125V, CHAN_PATH_SCALING1, AMUX_RSV1,
1867 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
1868 {"chg_temp", CHANNEL_CHG_TEMP, CHAN_PATH_SCALING1, AMUX_RSV1,
1869 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
1870};
1871
1872static struct pm8921_adc_properties pm8921_adc_data = {
1873 .adc_vdd_reference = 1800, /* milli-voltage for this adc */
1874 .bitresolution = 15,
1875 .bipolar = 0,
1876};
1877
1878static struct pm8921_adc_platform_data pm8921_adc_pdata = {
1879 .adc_channel = pm8921_adc_channels_data,
1880 .adc_num_channel = ARRAY_SIZE(pm8921_adc_channels_data),
1881 .adc_prop = &pm8921_adc_data,
1882};
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08001883
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001884static void __init msm8960_map_io(void)
1885{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001886 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001887 msm_map_msm8960_io();
1888}
1889
1890static void __init msm8960_init_irq(void)
1891{
1892 unsigned int i;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001893
1894 msm_mpm_irq_extn_init();
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001895 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001896 (void *)MSM_QGIC_CPU_BASE);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001897
1898 /* Edge trigger PPIs except AVS_SVICINT and AVS_SVICINTSWDONE */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001899 writel_relaxed(0xFFFFD7FF, MSM_QGIC_DIST_BASE + GIC_DIST_CONFIG + 4);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001900
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001901 writel_relaxed(0x0000FFFF, MSM_QGIC_DIST_BASE + GIC_DIST_ENABLE_SET);
1902 mb();
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08001903
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001904 /* FIXME: Not installing AVS_SVICINT and AVS_SVICINTSWDONE yet
1905 * as they are configured as level, which does not play nice with
1906 * handle_percpu_irq.
1907 */
1908 for (i = GIC_PPI_START; i < GIC_SPI_START; i++) {
1909 if (i != AVS_SVICINT && i != AVS_SVICINTSWDONE)
Thomas Gleixner6845664a2011-03-24 13:25:22 +01001910 irq_set_handler(i, handle_percpu_irq);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001911 }
1912}
1913
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001914/* MSM8960 have 5 SDCC controllers */
1915enum sdcc_controllers {
1916 SDCC1,
1917 SDCC2,
1918 SDCC3,
1919 SDCC4,
1920 SDCC5,
1921 MAX_SDCC_CONTROLLER
1922};
1923
1924/* All SDCC controllers requires VDD/VCC voltage */
1925static struct msm_mmc_reg_data mmc_vdd_reg_data[MAX_SDCC_CONTROLLER] = {
1926 /* SDCC1 : eMMC card connected */
1927 [SDCC1] = {
1928 .name = "sdc_vdd",
1929 .set_voltage_sup = 1,
1930 .level = 2950000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001931 .hpm_uA = 200000, /* 200mA */
1932 },
1933 /* SDCC3 : External card slot connected */
1934 [SDCC3] = {
1935 .name = "sdc_vdd",
1936 .set_voltage_sup = 1,
1937 .level = 2950000,
1938 .hpm_uA = 600000, /* 600mA */
1939 }
1940};
1941
1942/* Only slots having eMMC card will require VCCQ voltage */
1943static struct msm_mmc_reg_data mmc_vccq_reg_data[1] = {
1944 /* SDCC1 : eMMC card connected */
1945 [SDCC1] = {
1946 .name = "sdc_vccq",
1947 .set_voltage_sup = 1,
1948 .always_on = 1,
1949 .level = 1800000,
1950 .hpm_uA = 200000, /* 200mA */
1951 }
1952};
1953
1954/* All SDCC controllers may require voting for VDD PAD voltage */
1955static struct msm_mmc_reg_data mmc_vddp_reg_data[MAX_SDCC_CONTROLLER] = {
1956 /* SDCC3 : External card slot connected */
1957 [SDCC3] = {
1958 .name = "sdc_vddp",
1959 .set_voltage_sup = 1,
1960 .level = 2950000,
1961 .always_on = 1,
1962 .lpm_sup = 1,
1963 /* Max. Active current required is 16 mA */
1964 .hpm_uA = 16000,
1965 /*
1966 * Sleep current required is ~300 uA. But min. vote can be
1967 * in terms of mA (min. 1 mA). So let's vote for 2 mA
1968 * during sleep.
1969 */
1970 .lpm_uA = 2000,
1971 }
1972};
1973
1974static struct msm_mmc_slot_reg_data mmc_slot_vreg_data[MAX_SDCC_CONTROLLER] = {
1975 /* SDCC1 : eMMC card connected */
1976 [SDCC1] = {
1977 .vdd_data = &mmc_vdd_reg_data[SDCC1],
1978 .vccq_data = &mmc_vccq_reg_data[SDCC1],
1979 },
1980 /* SDCC3 : External card slot connected */
1981 [SDCC3] = {
1982 .vdd_data = &mmc_vdd_reg_data[SDCC3],
1983 .vddp_data = &mmc_vddp_reg_data[SDCC3],
1984 }
1985};
1986
1987/* SDC1 pad data */
1988static struct msm_mmc_pad_drv sdc1_pad_drv_on_cfg[] = {
1989 {TLMM_HDRV_SDC1_CLK, GPIO_CFG_16MA},
1990 {TLMM_HDRV_SDC1_CMD, GPIO_CFG_10MA},
1991 {TLMM_HDRV_SDC1_DATA, GPIO_CFG_10MA}
1992};
1993
1994static struct msm_mmc_pad_drv sdc1_pad_drv_off_cfg[] = {
1995 {TLMM_HDRV_SDC1_CLK, GPIO_CFG_2MA},
1996 {TLMM_HDRV_SDC1_CMD, GPIO_CFG_2MA},
1997 {TLMM_HDRV_SDC1_DATA, GPIO_CFG_2MA}
1998};
1999
2000static struct msm_mmc_pad_pull sdc1_pad_pull_on_cfg[] = {
2001 {TLMM_PULL_SDC1_CMD, GPIO_CFG_PULL_UP},
2002 {TLMM_PULL_SDC1_DATA, GPIO_CFG_PULL_UP}
2003};
2004
2005static struct msm_mmc_pad_pull sdc1_pad_pull_off_cfg[] = {
2006 {TLMM_PULL_SDC1_CMD, GPIO_CFG_PULL_DOWN},
2007 {TLMM_PULL_SDC1_DATA, GPIO_CFG_PULL_DOWN}
2008};
2009
2010/* SDC3 pad data */
2011static struct msm_mmc_pad_drv sdc3_pad_drv_on_cfg[] = {
2012 {TLMM_HDRV_SDC3_CLK, GPIO_CFG_8MA},
2013 {TLMM_HDRV_SDC3_CMD, GPIO_CFG_8MA},
2014 {TLMM_HDRV_SDC3_DATA, GPIO_CFG_8MA}
2015};
2016
2017static struct msm_mmc_pad_drv sdc3_pad_drv_off_cfg[] = {
2018 {TLMM_HDRV_SDC3_CLK, GPIO_CFG_2MA},
2019 {TLMM_HDRV_SDC3_CMD, GPIO_CFG_2MA},
2020 {TLMM_HDRV_SDC3_DATA, GPIO_CFG_2MA}
2021};
2022
2023static struct msm_mmc_pad_pull sdc3_pad_pull_on_cfg[] = {
2024 {TLMM_PULL_SDC3_CMD, GPIO_CFG_PULL_UP},
2025 {TLMM_PULL_SDC3_DATA, GPIO_CFG_PULL_UP}
2026};
2027
2028static struct msm_mmc_pad_pull sdc3_pad_pull_off_cfg[] = {
2029 {TLMM_PULL_SDC3_CMD, GPIO_CFG_PULL_DOWN},
2030 {TLMM_PULL_SDC3_DATA, GPIO_CFG_PULL_DOWN}
2031};
2032
2033struct msm_mmc_pad_pull_data mmc_pad_pull_data[MAX_SDCC_CONTROLLER] = {
2034 [SDCC1] = {
2035 .on = sdc1_pad_pull_on_cfg,
2036 .off = sdc1_pad_pull_off_cfg,
2037 .size = ARRAY_SIZE(sdc1_pad_pull_on_cfg)
2038 },
2039 [SDCC3] = {
2040 .on = sdc3_pad_pull_on_cfg,
2041 .off = sdc3_pad_pull_off_cfg,
2042 .size = ARRAY_SIZE(sdc3_pad_pull_on_cfg)
2043 },
2044};
2045
2046struct msm_mmc_pad_drv_data mmc_pad_drv_data[MAX_SDCC_CONTROLLER] = {
2047 [SDCC1] = {
2048 .on = sdc1_pad_drv_on_cfg,
2049 .off = sdc1_pad_drv_off_cfg,
2050 .size = ARRAY_SIZE(sdc1_pad_drv_on_cfg)
2051 },
2052 [SDCC3] = {
2053 .on = sdc3_pad_drv_on_cfg,
2054 .off = sdc3_pad_drv_off_cfg,
2055 .size = ARRAY_SIZE(sdc3_pad_drv_on_cfg)
2056 },
2057};
2058
2059struct msm_mmc_pad_data mmc_pad_data[MAX_SDCC_CONTROLLER] = {
2060 [SDCC1] = {
2061 .pull = &mmc_pad_pull_data[SDCC1],
2062 .drv = &mmc_pad_drv_data[SDCC1]
2063 },
2064 [SDCC3] = {
2065 .pull = &mmc_pad_pull_data[SDCC3],
2066 .drv = &mmc_pad_drv_data[SDCC3]
2067 },
2068};
2069
2070struct msm_mmc_pin_data mmc_slot_pin_data[MAX_SDCC_CONTROLLER] = {
2071 [SDCC1] = {
2072 .pad_data = &mmc_pad_data[SDCC1],
2073 },
2074 [SDCC3] = {
2075 .pad_data = &mmc_pad_data[SDCC3],
2076 },
2077};
2078
2079static unsigned int sdc1_sup_clk_rates[] = {
Subhash Jadavanib808efac2011-06-27 15:14:07 -07002080 400000, 24000000, 48000000, 96000000
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002081};
2082
2083static unsigned int sdc3_sup_clk_rates[] = {
2084 400000, 24000000, 48000000, 96000000
2085};
2086
2087#ifdef CONFIG_MMC_MSM_SDC1_SUPPORT
2088static struct mmc_platform_data msm8960_sdc1_data = {
2089 .ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29,
2090#ifdef CONFIG_MMC_MSM_SDC1_8_BIT_SUPPORT
2091 .mmc_bus_width = MMC_CAP_8_BIT_DATA,
2092#else
2093 .mmc_bus_width = MMC_CAP_4_BIT_DATA,
2094#endif
2095 .sup_clk_table = sdc1_sup_clk_rates,
2096 .sup_clk_cnt = ARRAY_SIZE(sdc1_sup_clk_rates),
2097 .nonremovable = 1,
2098 .sdcc_v4_sup = true,
2099 .vreg_data = &mmc_slot_vreg_data[SDCC1],
Subhash Jadavanib808efac2011-06-27 15:14:07 -07002100 .pin_data = &mmc_slot_pin_data[SDCC1],
2101 .uhs_caps = MMC_CAP_1_8V_DDR
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002102};
2103#endif
2104
2105#ifdef CONFIG_MMC_MSM_SDC3_SUPPORT
2106static struct mmc_platform_data msm8960_sdc3_data = {
2107 .ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29,
2108 .mmc_bus_width = MMC_CAP_4_BIT_DATA,
2109 .sup_clk_table = sdc3_sup_clk_rates,
2110 .sup_clk_cnt = ARRAY_SIZE(sdc3_sup_clk_rates),
2111 .wpswitch_gpio = PM8921_GPIO_PM_TO_SYS(16),
2112 .sdcc_v4_sup = true,
2113 .vreg_data = &mmc_slot_vreg_data[SDCC3],
2114 .pin_data = &mmc_slot_pin_data[SDCC3],
2115#ifdef CONFIG_MMC_MSM_CARD_HW_DETECTION
2116 .status_gpio = PM8921_GPIO_PM_TO_SYS(26),
2117 .status_irq = PM8921_GPIO_IRQ(PM8921_IRQ_BASE, 26),
2118 .irq_flags = IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
2119#endif
2120 .xpc_cap = 1,
2121 .uhs_caps = (MMC_CAP_UHS_SDR12 | MMC_CAP_UHS_SDR25 |
2122 MMC_CAP_UHS_SDR50 | MMC_CAP_UHS_DDR50 |
Subhash Jadavanib808efac2011-06-27 15:14:07 -07002123 MMC_CAP_MAX_CURRENT_600 | MMC_CAP_1_8V_DDR)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002124};
2125#endif
2126
2127static void __init msm8960_init_mmc(void)
2128{
2129#ifdef CONFIG_MMC_MSM_SDC1_SUPPORT
2130 /* SDC1 : eMMC card connected */
2131 msm_add_sdcc(1, &msm8960_sdc1_data);
2132#endif
2133#ifdef CONFIG_MMC_MSM_SDC3_SUPPORT
2134 /* SDC3: External card slot */
2135 msm_add_sdcc(3, &msm8960_sdc3_data);
2136#endif
2137}
2138
2139static void __init msm8960_init_buses(void)
2140{
2141#ifdef CONFIG_MSM_BUS_SCALING
2142 msm_bus_apps_fabric_pdata.rpm_enabled = 1;
2143 msm_bus_sys_fabric_pdata.rpm_enabled = 1;
2144 msm_bus_mm_fabric_pdata.rpm_enabled = 1;
2145 msm_bus_sys_fpb_pdata.rpm_enabled = 1;
2146 msm_bus_cpss_fpb_pdata.rpm_enabled = 1;
2147 msm_bus_apps_fabric.dev.platform_data = &msm_bus_apps_fabric_pdata;
2148 msm_bus_sys_fabric.dev.platform_data = &msm_bus_sys_fabric_pdata;
2149 msm_bus_mm_fabric.dev.platform_data = &msm_bus_mm_fabric_pdata;
2150 msm_bus_sys_fpb.dev.platform_data = &msm_bus_sys_fpb_pdata;
2151 msm_bus_cpss_fpb.dev.platform_data = &msm_bus_cpss_fpb_pdata;
2152#endif
2153}
2154
2155static struct msm_spi_platform_data msm8960_qup_spi_gsbi1_pdata = {
2156 .max_clock_speed = 15060000,
2157};
2158
2159#ifdef CONFIG_USB_MSM_OTG_72K
2160static struct msm_otg_platform_data msm_otg_pdata;
2161#else
2162#define USB_5V_EN 42
2163static void msm_hsusb_vbus_power(bool on)
2164{
2165 int rc;
2166 static bool vbus_is_on;
2167 static struct regulator *mvs_otg_switch;
2168 struct pm_gpio param = {
2169 .direction = PM_GPIO_DIR_OUT,
2170 .output_buffer = PM_GPIO_OUT_BUF_CMOS,
2171 .output_value = 1,
2172 .pull = PM_GPIO_PULL_NO,
2173 .vin_sel = PM_GPIO_VIN_S4,
2174 .out_strength = PM_GPIO_STRENGTH_MED,
2175 .function = PM_GPIO_FUNC_NORMAL,
2176 };
2177
2178 if (vbus_is_on == on)
2179 return;
2180
2181 if (on) {
2182 mvs_otg_switch = regulator_get(&msm_device_otg.dev, "vbus_otg");
2183 if (IS_ERR(mvs_otg_switch)) {
2184 pr_err("Unable to get mvs_otg_switch\n");
2185 return;
2186 }
2187
2188 rc = gpio_request(PM8921_GPIO_PM_TO_SYS(USB_5V_EN),
2189 "usb_5v_en");
2190 if (rc < 0) {
2191 pr_err("failed to request usb_5v_en gpio\n");
2192 goto put_mvs_otg;
2193 }
2194
2195 if (regulator_enable(mvs_otg_switch)) {
2196 pr_err("unable to enable mvs_otg_switch\n");
2197 goto free_usb_5v_en;
2198 }
2199
2200 rc = pm8xxx_gpio_config(PM8921_GPIO_PM_TO_SYS(USB_5V_EN),
2201 &param);
2202 if (rc < 0) {
2203 pr_err("failed to configure usb_5v_en gpio\n");
2204 goto disable_mvs_otg;
2205 }
2206 vbus_is_on = true;
2207 return;
2208 }
2209disable_mvs_otg:
2210 regulator_disable(mvs_otg_switch);
2211free_usb_5v_en:
2212 gpio_free(PM8921_GPIO_PM_TO_SYS(USB_5V_EN));
2213put_mvs_otg:
2214 regulator_put(mvs_otg_switch);
2215 vbus_is_on = false;
2216}
2217
2218static struct msm_otg_platform_data msm_otg_pdata = {
2219 .mode = USB_OTG,
2220 .otg_control = OTG_PMIC_CONTROL,
2221 .phy_type = SNPS_28NM_INTEGRATED_PHY,
2222 .pclk_src_name = "dfab_usb_hs_clk",
2223 .pmic_id_irq = PM8921_USB_ID_IN_IRQ(PM8921_IRQ_BASE),
2224 .vbus_power = msm_hsusb_vbus_power,
2225};
2226#endif
2227
2228#define PID_MAGIC_ID 0x71432909
2229#define SERIAL_NUM_MAGIC_ID 0x61945374
2230#define SERIAL_NUMBER_LENGTH 127
2231#define DLOAD_USB_BASE_ADD 0x2A03F0C8
2232
2233struct magic_num_struct {
2234 uint32_t pid;
2235 uint32_t serial_num;
2236};
2237
2238struct dload_struct {
2239 uint32_t reserved1;
2240 uint32_t reserved2;
2241 uint32_t reserved3;
2242 uint16_t reserved4;
2243 uint16_t pid;
2244 char serial_number[SERIAL_NUMBER_LENGTH];
2245 uint16_t reserved5;
2246 struct magic_num_struct magic_struct;
2247};
2248
2249static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum)
2250{
2251 struct dload_struct __iomem *dload = 0;
2252
2253 dload = ioremap(DLOAD_USB_BASE_ADD, sizeof(*dload));
2254 if (!dload) {
2255 pr_err("%s: cannot remap I/O memory region: %08x\n",
2256 __func__, DLOAD_USB_BASE_ADD);
2257 return -ENXIO;
2258 }
2259
2260 pr_debug("%s: dload:%p pid:%x serial_num:%s\n",
2261 __func__, dload, pid, snum);
2262 /* update pid */
2263 dload->magic_struct.pid = PID_MAGIC_ID;
2264 dload->pid = pid;
2265
2266 /* update serial number */
2267 dload->magic_struct.serial_num = 0;
2268 if (!snum) {
2269 memset(dload->serial_number, 0, SERIAL_NUMBER_LENGTH);
2270 goto out;
2271 }
2272
2273 dload->magic_struct.serial_num = SERIAL_NUM_MAGIC_ID;
2274 strncpy(dload->serial_number, snum, SERIAL_NUMBER_LENGTH);
2275 dload->serial_number[SERIAL_NUMBER_LENGTH - 1] = '\0';
2276out:
2277 iounmap(dload);
2278 return 0;
2279}
2280
2281static struct android_usb_platform_data android_usb_pdata = {
2282 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
2283};
2284
2285struct platform_device android_usb_device = {
2286 .name = "android_usb",
2287 .id = -1,
2288 .dev = {
2289 .platform_data = &android_usb_pdata,
2290 },
2291};
2292
2293static uint8_t spm_wfi_cmd_sequence[] __initdata = {
2294 0x03, 0x0f,
2295};
2296
2297static uint8_t spm_power_collapse_without_rpm[] __initdata = {
2298 0x00, 0x24, 0x54, 0x10,
2299 0x09, 0x03, 0x01,
2300 0x10, 0x54, 0x30, 0x0C,
2301 0x24, 0x30, 0x0f,
2302};
2303
2304static uint8_t spm_power_collapse_with_rpm[] __initdata = {
2305 0x00, 0x24, 0x54, 0x10,
2306 0x09, 0x07, 0x01, 0x0B,
2307 0x10, 0x54, 0x30, 0x0C,
2308 0x24, 0x30, 0x0f,
2309};
2310
2311static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = {
2312 [0] = {
2313 .mode = MSM_SPM_MODE_CLOCK_GATING,
2314 .notify_rpm = false,
2315 .cmd = spm_wfi_cmd_sequence,
2316 },
2317 [1] = {
2318 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
2319 .notify_rpm = false,
2320 .cmd = spm_power_collapse_without_rpm,
2321 },
2322 [2] = {
2323 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
2324 .notify_rpm = true,
2325 .cmd = spm_power_collapse_with_rpm,
2326 },
2327};
2328
2329static struct msm_spm_platform_data msm_spm_data[] __initdata = {
2330 [0] = {
2331 .reg_base_addr = MSM_SAW0_BASE,
2332 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
2333 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
2334 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0x9C,
2335#if defined(CONFIG_MSM_AVS_HW)
2336 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
2337 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
2338#endif
2339 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
2340 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
2341 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
2342 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
2343 .vctl_timeout_us = 50,
2344 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
2345 .modes = msm_spm_seq_list,
2346 },
2347 [1] = {
2348 .reg_base_addr = MSM_SAW1_BASE,
2349 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
2350 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
2351 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0x9C,
2352#if defined(CONFIG_MSM_AVS_HW)
2353 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
2354 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
2355#endif
2356 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
2357 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
2358 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
2359 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
2360 .vctl_timeout_us = 50,
2361 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
2362 .modes = msm_spm_seq_list,
2363 },
2364};
2365
2366static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = {
2367 0x00, 0x20, 0x03, 0x20,
2368 0x00, 0x0f,
2369};
2370
2371static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = {
2372 0x00, 0x20, 0x34, 0x64,
2373 0x48, 0x07, 0x48, 0x20,
2374 0x50, 0x64, 0x04, 0x34,
2375 0x50, 0x0f,
2376};
2377static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = {
2378 0x00, 0x10, 0x34, 0x64,
2379 0x48, 0x07, 0x48, 0x10,
2380 0x50, 0x64, 0x04, 0x34,
2381 0x50, 0x0F,
2382};
2383
2384static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = {
2385 [0] = {
2386 .mode = MSM_SPM_L2_MODE_RETENTION,
2387 .notify_rpm = false,
2388 .cmd = l2_spm_wfi_cmd_sequence,
2389 },
2390 [1] = {
2391 .mode = MSM_SPM_L2_MODE_GDHS,
2392 .notify_rpm = true,
2393 .cmd = l2_spm_gdhs_cmd_sequence,
2394 },
2395 [2] = {
2396 .mode = MSM_SPM_L2_MODE_POWER_COLLAPSE,
2397 .notify_rpm = true,
2398 .cmd = l2_spm_power_off_cmd_sequence,
2399 },
2400};
2401
2402
2403static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = {
2404 [0] = {
2405 .reg_base_addr = MSM_SAW_L2_BASE,
2406 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
2407 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00,
2408 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
2409 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE,
2410 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020,
2411 .modes = msm_spm_l2_seq_list,
2412 .num_modes = ARRAY_SIZE(msm_spm_l2_seq_list),
2413 },
2414};
2415
2416#define CYTTSP_TS_GPIO_IRQ 11
2417#define CYTTSP_TS_SLEEP_GPIO 50
2418#define CYTTSP_TS_RESOUT_N_GPIO 52
2419
2420/*virtual key support */
2421static ssize_t tma340_vkeys_show(struct kobject *kobj,
2422 struct kobj_attribute *attr, char *buf)
2423{
2424 return snprintf(buf, 200,
2425 __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":73:1120:97:97"
2426 ":" __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":230:1120:97:97"
2427 ":" __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":389:1120:97:97"
2428 ":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":544:1120:97:97"
2429 "\n");
2430}
2431
2432static struct kobj_attribute tma340_vkeys_attr = {
2433 .attr = {
2434 .mode = S_IRUGO,
2435 },
2436 .show = &tma340_vkeys_show,
2437};
2438
2439static struct attribute *tma340_properties_attrs[] = {
2440 &tma340_vkeys_attr.attr,
2441 NULL
2442};
2443
2444static struct attribute_group tma340_properties_attr_group = {
2445 .attrs = tma340_properties_attrs,
2446};
2447
2448
2449static int cyttsp_platform_init(struct i2c_client *client)
2450{
2451 int rc = 0;
2452 static struct kobject *tma340_properties_kobj;
2453
2454 tma340_vkeys_attr.attr.name = "virtualkeys.cyttsp-i2c";
2455 tma340_properties_kobj = kobject_create_and_add("board_properties",
2456 NULL);
2457 if (tma340_properties_kobj)
2458 rc = sysfs_create_group(tma340_properties_kobj,
2459 &tma340_properties_attr_group);
2460 if (!tma340_properties_kobj || rc)
2461 pr_err("%s: failed to create board_properties\n",
2462 __func__);
2463
2464 return 0;
2465}
2466
2467static struct cyttsp_regulator regulator_data[] = {
2468 {
2469 .name = "vdd",
2470 .min_uV = CY_TMA300_VTG_MIN_UV,
2471 .max_uV = CY_TMA300_VTG_MAX_UV,
2472 .load_uA = CY_TMA300_CURR_24HZ_UA,
2473 },
2474 /* TODO: Remove after runtime PM is enabled in I2C driver */
2475 {
2476 .name = "vcc_i2c",
2477 .min_uV = CY_I2C_VTG_MIN_UV,
2478 .max_uV = CY_I2C_VTG_MAX_UV,
2479 .load_uA = CY_I2C_CURR_UA,
2480 },
2481};
2482
2483static struct cyttsp_platform_data cyttsp_pdata = {
2484 .panel_maxx = 634,
2485 .panel_maxy = 1166,
2486 .disp_maxx = 616,
2487 .disp_maxy = 1023,
2488 .disp_minx = 0,
2489 .disp_miny = 16,
2490 .flags = 0x01,
2491 .gen = CY_GEN3, /* or */
2492 .use_st = CY_USE_ST,
2493 .use_mt = CY_USE_MT,
2494 .use_hndshk = CY_SEND_HNDSHK,
2495 .use_trk_id = CY_USE_TRACKING_ID,
Anirudh Ghayal15187772011-06-22 17:39:41 +05302496 .use_sleep = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002497 .use_gestures = CY_USE_GESTURES,
2498 .fw_fname = "cyttsp_8960_cdp.hex",
2499 /* activate up to 4 groups
2500 * and set active distance
2501 */
2502 .gest_set = CY_GEST_GRP1 | CY_GEST_GRP2 |
2503 CY_GEST_GRP3 | CY_GEST_GRP4 |
2504 CY_ACT_DIST,
2505 /* change act_intrvl to customize the Active power state
2506 * scanning/processing refresh interval for Operating mode
2507 */
2508 .act_intrvl = CY_ACT_INTRVL_DFLT,
2509 /* change tch_tmout to customize the touch timeout for the
2510 * Active power state for Operating mode
2511 */
2512 .tch_tmout = CY_TCH_TMOUT_DFLT,
2513 /* change lp_intrvl to customize the Low Power power state
2514 * scanning/processing refresh interval for Operating mode
2515 */
2516 .lp_intrvl = CY_LP_INTRVL_DFLT,
2517 .sleep_gpio = CYTTSP_TS_SLEEP_GPIO,
2518 .resout_gpio = CYTTSP_TS_RESOUT_N_GPIO,
2519 .irq_gpio = CYTTSP_TS_GPIO_IRQ,
2520 .regulator_info = regulator_data,
2521 .num_regulators = ARRAY_SIZE(regulator_data),
2522 .init = cyttsp_platform_init,
Mohan Pallaka49c37d62011-08-01 11:52:00 +05302523 .correct_fw_ver = 9,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002524};
2525
2526static struct i2c_board_info cyttsp_info[] __initdata = {
2527 {
2528 I2C_BOARD_INFO(CY_I2C_NAME, 0x24),
2529 .platform_data = &cyttsp_pdata,
2530#ifndef CY_USE_TIMER
2531 .irq = MSM_GPIO_TO_INT(CYTTSP_TS_GPIO_IRQ),
2532#endif /* CY_USE_TIMER */
2533 },
2534};
2535
2536static void gsbi_qup_i2c_gpio_config(int adap_id, int config_type)
2537{
2538}
2539
2540static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi4_pdata = {
2541 .clk_freq = 100000,
2542 .src_clk_rate = 24000000,
2543 .clk = "gsbi_qup_clk",
2544 .pclk = "gsbi_pclk",
2545 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
2546};
2547
2548static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi3_pdata = {
2549 .clk_freq = 100000,
2550 .src_clk_rate = 24000000,
2551 .clk = "gsbi_qup_clk",
2552 .pclk = "gsbi_pclk",
2553 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
2554};
2555
2556static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi10_pdata = {
2557 .clk_freq = 100000,
2558 .src_clk_rate = 24000000,
2559 .clk = "gsbi_qup_clk",
2560 .pclk = "gsbi_pclk",
2561 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
2562};
2563
2564static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi12_pdata = {
2565 .clk_freq = 100000,
2566 .src_clk_rate = 24000000,
2567 .clk = "gsbi_qup_clk",
2568 .pclk = "gsbi_pclk",
2569 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
2570};
2571
2572static struct msm_rpm_platform_data msm_rpm_data = {
2573 .reg_base_addrs = {
2574 [MSM_RPM_PAGE_STATUS] = MSM_RPM_BASE,
2575 [MSM_RPM_PAGE_CTRL] = MSM_RPM_BASE + 0x400,
2576 [MSM_RPM_PAGE_REQ] = MSM_RPM_BASE + 0x600,
2577 [MSM_RPM_PAGE_ACK] = MSM_RPM_BASE + 0xa00,
2578 },
2579
2580 .irq_ack = RPM_APCC_CPU0_GP_HIGH_IRQ,
2581 .irq_err = RPM_APCC_CPU0_GP_LOW_IRQ,
2582 .irq_vmpm = RPM_APCC_CPU0_GP_MEDIUM_IRQ,
2583 .msm_apps_ipc_rpm_reg = MSM_APCS_GCC_BASE + 0x008,
2584 .msm_apps_ipc_rpm_val = 4,
2585};
2586
2587static struct spi_board_info spi_board_info[] __initdata = {
2588 {
2589 .modalias = "ks8851",
2590 .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO),
2591 .max_speed_hz = 19200000,
2592 .bus_num = 0,
2593 .chip_select = 0,
2594 .mode = SPI_MODE_0,
2595 },
2596};
2597
2598static struct platform_device msm_device_saw_core0 = {
2599 .name = "saw-regulator",
2600 .id = 0,
2601 .dev = {
2602 .platform_data = &msm_saw_regulator_pdata_s5,
2603 },
2604};
2605
2606static struct platform_device msm_device_saw_core1 = {
2607 .name = "saw-regulator",
2608 .id = 1,
2609 .dev = {
2610 .platform_data = &msm_saw_regulator_pdata_s6,
2611 },
2612};
2613
2614#ifdef CONFIG_MSM_FAKE_BATTERY
2615static struct platform_device fish_battery_device = {
2616 .name = "fish_battery",
2617};
2618#endif
2619
2620struct platform_device msm8960_device_ext_5v_vreg __devinitdata = {
2621 .name = GPIO_REGULATOR_DEV_NAME,
2622 .id = PM8921_MPP_PM_TO_SYS(7),
2623 .dev = {
2624 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V],
2625 },
2626};
2627
2628struct platform_device msm8960_device_ext_l2_vreg __devinitdata = {
2629 .name = GPIO_REGULATOR_DEV_NAME,
2630 .id = 91,
2631 .dev = {
2632 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_L2],
2633 },
2634};
2635
2636static struct platform_device *common_devices[] __initdata = {
2637 &msm_device_dmov,
2638 &msm_device_smd,
2639 &msm8960_device_uart_gsbi5,
2640 &msm_device_saw_core0,
2641 &msm_device_saw_core1,
2642 &msm8960_device_ext_5v_vreg,
2643 &msm8960_device_ext_l2_vreg,
2644 &msm8960_device_ssbi_pm8921,
2645 &msm8960_device_qup_spi_gsbi1,
2646 &msm8960_device_qup_i2c_gsbi3,
2647 &msm8960_device_qup_i2c_gsbi4,
2648 &msm8960_device_qup_i2c_gsbi10,
2649#ifndef CONFIG_MSM_DSPS
2650 &msm8960_device_qup_i2c_gsbi12,
2651#endif
2652 &msm_slim_ctrl,
2653 &msm_device_wcnss_wlan,
2654#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
2655 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
2656 &qcrypto_device,
2657#endif
2658
2659#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
2660 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
2661 &qcedev_device,
2662#endif
2663#ifdef CONFIG_MSM_ROTATOR
2664 &msm_rotator_device,
2665#endif
2666 &msm_device_sps,
2667#ifdef CONFIG_MSM_FAKE_BATTERY
2668 &fish_battery_device,
2669#endif
2670#ifdef CONFIG_ANDROID_PMEM
2671 &android_pmem_device,
2672 &android_pmem_adsp_device,
2673 &android_pmem_audio_device,
2674#endif
2675 &msm_fb_device,
2676 &msm_device_vidc,
2677 &msm_device_bam_dmux,
2678 &msm_fm_platform_init,
Mona Hossain9c430e32011-07-27 11:04:47 -07002679
2680#ifdef CONFIG_HW_RANDOM_MSM
2681 &msm_device_rng,
2682#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002683};
2684
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002685static struct platform_device *sim_devices[] __initdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002686 &msm_device_otg,
2687 &msm_device_gadget_peripheral,
2688 &msm_device_hsusb_host,
2689 &android_usb_device,
2690 &msm_device_vidc,
2691 &mipi_dsi_simulator_panel_device,
2692 &msm_bus_apps_fabric,
2693 &msm_bus_sys_fabric,
2694 &msm_bus_mm_fabric,
2695 &msm_bus_sys_fpb,
2696 &msm_bus_cpss_fpb,
2697 &msm_pcm,
2698 &msm_pcm_routing,
2699 &msm_cpudai0,
2700 &msm_cpudai1,
2701 &msm_cpudai_hdmi_rx,
2702 &msm_cpudai_bt_rx,
2703 &msm_cpudai_bt_tx,
2704 &msm_cpudai_fm_rx,
2705 &msm_cpudai_fm_tx,
2706 &msm_cpu_fe,
2707 &msm_stub_codec,
2708 &msm_voice,
2709 &msm_voip,
2710 &msm_lpa_pcm,
2711
2712#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
2713 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
2714 &qcrypto_device,
2715#endif
2716
2717#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
2718 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
2719 &qcedev_device,
2720#endif
2721
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002722};
2723
2724static struct platform_device *rumi3_devices[] __initdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002725 &msm_kgsl_3d0,
2726 &msm_kgsl_2d0,
2727 &msm_kgsl_2d1,
2728 &mipi_dsi_renesas_panel_device,
2729#ifdef CONFIG_MSM_GEMINI
2730 &msm8960_gemini_device,
2731#endif
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002732};
2733
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002734static struct platform_device *cdp_devices[] __initdata = {
2735 &msm_device_otg,
2736 &msm_device_gadget_peripheral,
2737 &msm_device_hsusb_host,
2738 &android_usb_device,
2739 &msm_pcm,
2740 &msm_pcm_routing,
2741 &msm_cpudai0,
2742 &msm_cpudai1,
2743 &msm_cpudai_hdmi_rx,
2744 &msm_cpudai_bt_rx,
2745 &msm_cpudai_bt_tx,
2746 &msm_cpudai_fm_rx,
2747 &msm_cpudai_fm_tx,
2748 &msm_cpu_fe,
2749 &msm_stub_codec,
2750 &msm_kgsl_3d0,
2751#ifdef CONFIG_MSM_KGSL_2D
2752 &msm_kgsl_2d0,
2753 &msm_kgsl_2d1,
2754#endif
2755 &mipi_dsi_toshiba_panel_device,
2756#ifdef CONFIG_MSM_GEMINI
2757 &msm8960_gemini_device,
2758#endif
2759 &msm_voice,
2760 &msm_voip,
2761 &msm_lpa_pcm,
2762#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
2763 &hdmi_msm_device,
2764#endif
2765 &msm_pcm_hostless,
2766 &msm_bus_apps_fabric,
2767 &msm_bus_sys_fabric,
2768 &msm_bus_mm_fabric,
2769 &msm_bus_sys_fpb,
2770 &msm_bus_cpss_fpb,
2771};
2772
2773static void __init msm8960_i2c_init(void)
2774{
2775 msm8960_device_qup_i2c_gsbi4.dev.platform_data =
2776 &msm8960_i2c_qup_gsbi4_pdata;
2777
2778 msm8960_device_qup_i2c_gsbi3.dev.platform_data =
2779 &msm8960_i2c_qup_gsbi3_pdata;
2780
2781 msm8960_device_qup_i2c_gsbi10.dev.platform_data =
2782 &msm8960_i2c_qup_gsbi10_pdata;
2783
2784 msm8960_device_qup_i2c_gsbi12.dev.platform_data =
2785 &msm8960_i2c_qup_gsbi12_pdata;
2786}
2787
2788static struct pm8xxx_irq_platform_data pm8xxx_irq_pdata __devinitdata = {
2789 .irq_base = PM8921_IRQ_BASE,
2790 .devirq = MSM_GPIO_TO_INT(104),
2791 .irq_trigger_flag = IRQF_TRIGGER_LOW,
2792};
2793
2794static struct pm8xxx_gpio_platform_data pm8xxx_gpio_pdata __devinitdata = {
2795 .gpio_base = PM8921_GPIO_PM_TO_SYS(1),
2796};
2797
2798static struct pm8xxx_mpp_platform_data pm8xxx_mpp_pdata __devinitdata = {
2799 .mpp_base = PM8921_MPP_PM_TO_SYS(1),
2800};
2801
2802static struct pm8xxx_rtc_platform_data pm8xxx_rtc_pdata __devinitdata = {
2803 .rtc_write_enable = false,
2804};
2805
2806static struct pm8xxx_pwrkey_platform_data pm8xxx_pwrkey_pdata = {
2807 .pull_up = 1,
2808 .kpd_trigger_delay_us = 970,
2809 .wakeup = 1,
2810};
2811
2812static const unsigned int keymap[] = {
2813 KEY(0, 0, KEY_VOLUMEUP),
2814 KEY(0, 1, KEY_VOLUMEDOWN),
2815 KEY(0, 2, KEY_CAMERA_SNAPSHOT),
2816 KEY(0, 3, KEY_CAMERA_FOCUS),
2817};
2818
2819static struct matrix_keymap_data keymap_data = {
2820 .keymap_size = ARRAY_SIZE(keymap),
2821 .keymap = keymap,
2822};
2823
2824static struct pm8xxx_keypad_platform_data keypad_data = {
2825 .input_name = "keypad_8960",
2826 .input_phys_device = "keypad_8960/input0",
2827 .num_rows = 1,
2828 .num_cols = 5,
2829 .rows_gpio_start = PM8921_GPIO_PM_TO_SYS(9),
2830 .cols_gpio_start = PM8921_GPIO_PM_TO_SYS(1),
2831 .debounce_ms = 15,
2832 .scan_delay_ms = 32,
2833 .row_hold_ns = 91500,
2834 .wakeup = 1,
2835 .keymap_data = &keymap_data,
2836};
2837
2838static const unsigned int keymap_sim[] = {
2839 KEY(0, 0, KEY_7),
2840 KEY(0, 1, KEY_DOWN),
2841 KEY(0, 2, KEY_UP),
2842 KEY(0, 3, KEY_RIGHT),
2843 KEY(0, 4, KEY_ENTER),
2844 KEY(0, 5, KEY_L),
2845 KEY(0, 6, KEY_BACK),
2846 KEY(0, 7, KEY_M),
2847
2848 KEY(1, 0, KEY_LEFT),
2849 KEY(1, 1, KEY_SEND),
2850 KEY(1, 2, KEY_1),
2851 KEY(1, 3, KEY_4),
2852 KEY(1, 4, KEY_CLEAR),
2853 KEY(1, 5, KEY_MSDOS),
2854 KEY(1, 6, KEY_SPACE),
2855 KEY(1, 7, KEY_COMMA),
2856
2857 KEY(2, 0, KEY_6),
2858 KEY(2, 1, KEY_5),
2859 KEY(2, 2, KEY_8),
2860 KEY(2, 3, KEY_3),
2861 KEY(2, 4, KEY_NUMERIC_STAR),
2862 KEY(2, 5, KEY_UP),
2863 KEY(2, 6, KEY_DOWN),
2864 KEY(2, 7, KEY_LEFTSHIFT),
2865
2866 KEY(3, 0, KEY_9),
2867 KEY(3, 1, KEY_NUMERIC_POUND),
2868 KEY(3, 2, KEY_0),
2869 KEY(3, 3, KEY_2),
2870 KEY(3, 4, KEY_SLEEP),
2871 KEY(3, 5, KEY_F1),
2872 KEY(3, 6, KEY_F2),
2873 KEY(3, 7, KEY_F3),
2874
2875 KEY(4, 0, KEY_BACK),
2876 KEY(4, 1, KEY_HOME),
2877 KEY(4, 2, KEY_MENU),
2878 KEY(4, 3, KEY_VOLUMEUP),
2879 KEY(4, 4, KEY_VOLUMEDOWN),
2880 KEY(4, 5, KEY_F4),
2881 KEY(4, 6, KEY_F5),
2882 KEY(4, 7, KEY_F6),
2883
2884 KEY(5, 0, KEY_R),
2885 KEY(5, 1, KEY_T),
2886 KEY(5, 2, KEY_Y),
2887 KEY(5, 3, KEY_LEFTALT),
2888 KEY(5, 4, KEY_KPENTER),
2889 KEY(5, 5, KEY_Q),
2890 KEY(5, 6, KEY_W),
2891 KEY(5, 7, KEY_E),
2892
2893 KEY(6, 0, KEY_F),
2894 KEY(6, 1, KEY_G),
2895 KEY(6, 2, KEY_H),
2896 KEY(6, 3, KEY_CAPSLOCK),
2897 KEY(6, 4, KEY_PAGEUP),
2898 KEY(6, 5, KEY_A),
2899 KEY(6, 6, KEY_S),
2900 KEY(6, 7, KEY_D),
2901
2902 KEY(7, 0, KEY_V),
2903 KEY(7, 1, KEY_B),
2904 KEY(7, 2, KEY_N),
2905 KEY(7, 3, KEY_MENU),
2906 KEY(7, 4, KEY_PAGEDOWN),
2907 KEY(7, 5, KEY_Z),
2908 KEY(7, 6, KEY_X),
2909 KEY(7, 7, KEY_C),
2910
2911 KEY(8, 0, KEY_P),
2912 KEY(8, 1, KEY_J),
2913 KEY(8, 2, KEY_K),
2914 KEY(8, 3, KEY_INSERT),
2915 KEY(8, 4, KEY_LINEFEED),
2916 KEY(8, 5, KEY_U),
2917 KEY(8, 6, KEY_I),
2918 KEY(8, 7, KEY_O),
2919
2920 KEY(9, 0, KEY_4),
2921 KEY(9, 1, KEY_5),
2922 KEY(9, 2, KEY_6),
2923 KEY(9, 3, KEY_7),
2924 KEY(9, 4, KEY_8),
2925 KEY(9, 5, KEY_1),
2926 KEY(9, 6, KEY_2),
2927 KEY(9, 7, KEY_3),
2928
2929 KEY(10, 0, KEY_F7),
2930 KEY(10, 1, KEY_F8),
2931 KEY(10, 2, KEY_F9),
2932 KEY(10, 3, KEY_F10),
2933 KEY(10, 4, KEY_FN),
2934 KEY(10, 5, KEY_9),
2935 KEY(10, 6, KEY_0),
2936 KEY(10, 7, KEY_DOT),
2937
2938 KEY(11, 0, KEY_LEFTCTRL),
2939 KEY(11, 1, KEY_F11),
2940 KEY(11, 2, KEY_ENTER),
2941 KEY(11, 3, KEY_SEARCH),
2942 KEY(11, 4, KEY_DELETE),
2943 KEY(11, 5, KEY_RIGHT),
2944 KEY(11, 6, KEY_LEFT),
2945 KEY(11, 7, KEY_RIGHTSHIFT),
2946 KEY(0, 0, KEY_VOLUMEUP),
2947 KEY(0, 1, KEY_VOLUMEDOWN),
2948 KEY(0, 2, KEY_CAMERA_SNAPSHOT),
2949 KEY(0, 3, KEY_CAMERA_FOCUS),
2950};
2951
2952static struct matrix_keymap_data keymap_data_sim = {
2953 .keymap_size = ARRAY_SIZE(keymap_sim),
2954 .keymap = keymap_sim,
2955};
2956
2957static struct pm8xxx_keypad_platform_data keypad_data_sim = {
2958 .input_name = "keypad_8960",
2959 .input_phys_device = "keypad_8960/input0",
2960 .num_rows = 12,
2961 .num_cols = 8,
2962 .rows_gpio_start = PM8921_GPIO_PM_TO_SYS(9),
2963 .cols_gpio_start = PM8921_GPIO_PM_TO_SYS(1),
2964 .debounce_ms = 15,
2965 .scan_delay_ms = 32,
2966 .row_hold_ns = 91500,
2967 .wakeup = 1,
2968 .keymap_data = &keymap_data_sim,
2969};
2970
2971static struct pm8921_charger_platform_data pm8921_chg_pdata __devinitdata = {
2972 .safety_time = 180,
2973 .update_time = 1,
2974 .max_voltage = 4200,
2975 .min_voltage = 3200,
2976 .resume_voltage = 4100,
2977 .term_current = 100,
2978};
2979
2980static struct pm8xxx_misc_platform_data pm8xxx_misc_pdata = {
2981 .priority = 0,
2982};
2983
2984static struct pm8921_bms_platform_data pm8921_bms_pdata __devinitdata = {
2985 .r_sense = 10,
2986 .i_test = 2500,
2987 .v_failure = 3000,
2988 .calib_delay_ms = 600000,
2989 .batt_data = &palladium_1500_data,
2990};
2991
2992static struct led_info pm8921_led_info[] = {
2993 [0] = {
2994 .name = "led:drv1",
2995 .flags = PM8XXX_ID_LED_1,
2996 },
2997};
2998
2999static struct led_platform_data pm8xxx_leds_pdata = {
3000 .num_leds = ARRAY_SIZE(pm8921_led_info),
3001 .leds = pm8921_led_info,
3002};
3003
3004static struct pm8921_platform_data pm8921_platform_data __devinitdata = {
3005 .irq_pdata = &pm8xxx_irq_pdata,
3006 .gpio_pdata = &pm8xxx_gpio_pdata,
3007 .mpp_pdata = &pm8xxx_mpp_pdata,
3008 .rtc_pdata = &pm8xxx_rtc_pdata,
3009 .pwrkey_pdata = &pm8xxx_pwrkey_pdata,
3010 .keypad_pdata = &keypad_data,
3011 .misc_pdata = &pm8xxx_misc_pdata,
3012 .regulator_pdatas = msm_pm8921_regulator_pdata,
3013 .charger_pdata = &pm8921_chg_pdata,
3014 .bms_pdata = &pm8921_bms_pdata,
3015 .adc_pdata = &pm8921_adc_pdata,
3016 .leds_pdata = &pm8xxx_leds_pdata,
3017};
3018
3019static struct msm_ssbi_platform_data msm8960_ssbi_pm8921_pdata __devinitdata = {
3020 .controller_type = MSM_SBI_CTRL_PMIC_ARBITER,
3021 .slave = {
3022 .name = "pm8921-core",
3023 .platform_data = &pm8921_platform_data,
3024 },
3025};
3026
3027static void msm8960_wcnss_init(void)
3028{
3029 int i, ret, j;
3030
3031 for (i = 0; i < ARRAY_SIZE(wcnss_5wire_interface); i++) {
3032 ret = gpio_request(wcnss_5wire_interface[i].gpio,
3033 "wcnss_5_wire");
3034 if (ret) {
3035 pr_err("wcnss_5_wire gpio %d failed: %d\n",
3036 wcnss_5wire_interface[i].gpio, ret);
3037 goto fail;
3038 }
3039 }
3040
3041 pr_info("%s: Iris 5-wire gpios configured\n", __func__);
3042
3043 return;
3044
3045fail:
3046 for (j = 0; j < i; j++)
3047 gpio_free(wcnss_5wire_interface[j].gpio);
3048}
3049
3050static int ethernet_init(void)
3051{
3052 int ret;
3053 ret = gpio_request(KS8851_IRQ_GPIO, "ks8851_irq");
3054 if (ret) {
3055 pr_err("ks8851 gpio_request failed: %d\n", ret);
3056 goto fail;
3057 }
3058
3059 ret = gpio_request(KS8851_RST_GPIO, "ks8851_rst");
3060 if (ret) {
3061 pr_err("ks8851 gpio_request failed: %d\n", ret);
3062 goto fail_rst;
3063 }
3064
3065 ret = gpio_request(FPGA_CS_GPIO, "fpga_cs");
3066 if (ret) {
3067 pr_err("ks8851 gpio_request failed: %d\n", ret);
3068 goto fail_cs;
3069 }
3070
3071 gpio_direction_output(FPGA_CS_GPIO, 1);
3072 gpio_direction_output(KS8851_RST_GPIO, 1);
3073 return 0;
3074fail_cs:
3075 gpio_free(KS8851_RST_GPIO);
3076fail_rst:
3077 gpio_free(KS8851_IRQ_GPIO);
3078fail:
3079 return ret;
3080}
3081
3082static struct msm_cpuidle_state msm_cstates[] __initdata = {
3083 {0, 0, "C0", "WFI",
3084 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
3085
3086 {0, 1, "C1", "STANDALONE_POWER_COLLAPSE",
3087 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
3088
3089 {0, 2, "C2", "POWER_COLLAPSE",
3090 MSM_PM_SLEEP_MODE_POWER_COLLAPSE},
3091
3092 {1, 0, "C0", "WFI",
3093 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
3094
3095 {1, 1, "C1", "STANDALONE_POWER_COLLAPSE",
3096 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
3097};
3098
3099static struct msm_pm_platform_data msm_pm_data[MSM_PM_SLEEP_MODE_NR * 2] = {
3100 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
3101 .idle_supported = 1,
3102 .suspend_supported = 1,
3103 .idle_enabled = 0,
3104 .suspend_enabled = 0,
3105 .latency = 4000,
3106 .residency = 13000,
3107 },
3108
3109 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
3110 .idle_supported = 1,
3111 .suspend_supported = 1,
3112 .idle_enabled = 0,
3113 .suspend_enabled = 0,
3114 .latency = 500,
3115 .residency = 6000,
3116 },
3117
3118 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
3119 .idle_supported = 1,
3120 .suspend_supported = 1,
3121 .idle_enabled = 1,
3122 .suspend_enabled = 1,
3123 .latency = 2,
3124 .residency = 0,
3125 },
3126
3127 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
3128 .idle_supported = 0,
3129 .suspend_supported = 1,
3130 .idle_enabled = 0,
3131 .suspend_enabled = 0,
3132 .latency = 600,
3133 .residency = 7200,
3134 },
3135
3136 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
3137 .idle_supported = 1,
3138 .suspend_supported = 1,
3139 .idle_enabled = 0,
3140 .suspend_enabled = 0,
3141 .latency = 500,
3142 .residency = 6000,
3143 },
3144
3145 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
3146 .idle_supported = 1,
3147 .suspend_supported = 0,
3148 .idle_enabled = 1,
3149 .suspend_enabled = 0,
3150 .latency = 2,
3151 .residency = 0,
3152 },
3153};
3154
3155static struct msm_rpmrs_level msm_rpmrs_levels[] __initdata = {
3156 {
3157 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
3158 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
3159 true,
3160 1, 8000, 100000, 1,
3161 },
3162
3163 {
3164 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
3165 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
3166 true,
3167 1500, 5000, 60100000, 3000,
3168 },
3169
3170 {
3171 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
3172 MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE),
3173 false,
3174 1800, 5000, 60350000, 3500,
3175 },
3176
3177 {
3178 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
3179 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, MAX, ACTIVE),
3180 false,
3181 2800, 2500, 65350000, 4800,
3182 },
3183
3184 {
3185 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
3186 MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE),
3187 false,
3188 3800, 4500, 67850000, 5500,
3189 },
3190
3191 {
3192 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
3193 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
3194 false,
3195 4800, 2000, 71850000, 6800,
3196 },
3197
3198 {
3199 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
3200 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH),
3201 false,
3202 6800, 500, 75850000, 8800,
3203 },
3204
3205 {
3206 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
3207 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
3208 false,
3209 7800, 0, 76350000, 9800,
3210 },
3211};
3212
3213#ifdef CONFIG_I2C
3214#define I2C_SURF 1
3215#define I2C_FFA (1 << 1)
3216#define I2C_RUMI (1 << 2)
3217#define I2C_SIM (1 << 3)
3218#define I2C_FLUID (1 << 4)
3219#define MSM_8960_GSBI4_QUP_I2C_BUS_ID 4
3220#define MSM_8960_GSBI3_QUP_I2C_BUS_ID 3
3221
3222struct i2c_registry {
3223 u8 machs;
3224 int bus;
3225 struct i2c_board_info *info;
3226 int len;
3227};
3228
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -07003229#if defined(CONFIG_GPIO_SX150X) || defined(CONFIG_GPIO_SX150X_MODULE)
3230static struct i2c_board_info cam_expander_i2c_info[] __initdata = {
3231 {
3232 I2C_BOARD_INFO("sx1508q", 0x22),
3233 .platform_data = &sx150x_data[SX150X_CAM]
3234 },
3235};
3236#endif
3237
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003238#ifdef CONFIG_MSM_CAMERA
3239static struct i2c_board_info msm_camera_boardinfo[] __initdata = {
3240#ifdef CONFIG_IMX074
3241 {
3242 I2C_BOARD_INFO("imx074", 0x1A),
3243 },
3244#endif
3245#ifdef CONFIG_OV2720
3246 {
3247 I2C_BOARD_INFO("ov2720", 0x6C),
3248 },
3249#endif
Kevin Chandfecce22011-07-13 10:52:41 -07003250 {
3251 I2C_BOARD_INFO("qs_mt9p017", 0x6C >> 1),
3252 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003253};
3254#endif
3255
3256/* Sensors DSPS platform data */
3257#ifdef CONFIG_MSM_DSPS
3258#define DSPS_PIL_GENERIC_NAME "dsps"
3259#endif /* CONFIG_MSM_DSPS */
3260
3261static void __init msm8960_init_dsps(void)
3262{
3263#ifdef CONFIG_MSM_DSPS
3264 struct msm_dsps_platform_data *pdata =
3265 msm_dsps_device.dev.platform_data;
3266 pdata->pil_name = DSPS_PIL_GENERIC_NAME;
3267 pdata->gpios = NULL;
3268 pdata->gpios_num = 0;
3269
3270 platform_device_register(&msm_dsps_device);
3271#endif /* CONFIG_MSM_DSPS */
3272}
3273
3274static struct i2c_registry msm8960_i2c_devices[] __initdata = {
3275#ifdef CONFIG_MSM_CAMERA
3276 {
3277 I2C_SURF | I2C_FFA | I2C_FLUID | I2C_RUMI,
3278 MSM_8960_GSBI4_QUP_I2C_BUS_ID,
3279 msm_camera_boardinfo,
3280 ARRAY_SIZE(msm_camera_boardinfo),
3281 },
3282#endif
3283 {
3284 I2C_SURF | I2C_FFA | I2C_FLUID,
3285 MSM_8960_GSBI3_QUP_I2C_BUS_ID,
3286 cyttsp_info,
3287 ARRAY_SIZE(cyttsp_info),
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -07003288 },
3289#if defined(CONFIG_GPIO_SX150X) || defined(CONFIG_GPIO_SX150X_MODULE)
3290 {
3291 I2C_SURF | I2C_FFA,
3292 MSM_8960_GSBI4_QUP_I2C_BUS_ID,
3293 cam_expander_i2c_info,
3294 ARRAY_SIZE(cam_expander_i2c_info),
3295 },
3296#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003297};
3298#endif /* CONFIG_I2C */
3299
3300static void __init register_i2c_devices(void)
3301{
3302#ifdef CONFIG_I2C
3303 u8 mach_mask = 0;
3304 int i;
3305
3306 /* Build the matching 'supported_machs' bitmask */
3307 if (machine_is_msm8960_cdp())
3308 mach_mask = I2C_SURF;
3309 else if (machine_is_msm8960_rumi3())
3310 mach_mask = I2C_RUMI;
3311 else if (machine_is_msm8960_sim())
3312 mach_mask = I2C_SIM;
Amy Maloche2d028032011-07-20 14:08:06 -07003313 else if (machine_is_msm8960_fluid())
3314 mach_mask = I2C_FLUID;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003315 else
3316 pr_err("unmatched machine ID in register_i2c_devices\n");
3317
3318 /* Run the array and install devices as appropriate */
3319 for (i = 0; i < ARRAY_SIZE(msm8960_i2c_devices); ++i) {
3320 if (msm8960_i2c_devices[i].machs & mach_mask)
3321 i2c_register_board_info(msm8960_i2c_devices[i].bus,
3322 msm8960_i2c_devices[i].info,
3323 msm8960_i2c_devices[i].len);
3324 }
3325#endif
3326}
3327
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003328static void __init msm8960_sim_init(void)
3329{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003330 if (socinfo_init() < 0)
3331 pr_err("socinfo_init() failed!\n");
3332
3333 BUG_ON(msm_rpm_init(&msm_rpm_data));
3334 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
3335 ARRAY_SIZE(msm_rpmrs_levels)));
3336 regulator_suppress_info_printing();
3337 msm8960_clock_init();
3338 msm8960_device_ssbi_pm8921.dev.platform_data =
3339 &msm8960_ssbi_pm8921_pdata;
3340 pm8921_platform_data.num_regulators = msm_pm8921_regulator_pdata_len;
3341 msm8960_device_qup_spi_gsbi1.dev.platform_data =
3342 &msm8960_qup_spi_gsbi1_pdata;
3343
3344 /* Simulator supports a QWERTY keypad */
3345 pm8921_platform_data.keypad_pdata = &keypad_data_sim;
3346
3347 msm_device_otg.dev.platform_data = &msm_otg_pdata;
3348 msm_device_gadget_peripheral.dev.parent = &msm_device_otg.dev;
3349 msm_device_hsusb_host.dev.parent = &msm_device_otg.dev;
3350 gpiomux_init();
3351 ethernet_init();
3352 msm8960_i2c_init();
3353 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
3354 msm_spm_l2_init(msm_spm_l2_data);
3355 msm8960_init_buses();
3356 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
3357 pm8921_gpio_mpp_init();
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003358 platform_add_devices(sim_devices, ARRAY_SIZE(sim_devices));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003359 msm_acpu_clock_init(&msm8960_acpu_clock_data);
3360
3361 msm8960_device_qup_spi_gsbi1.dev.platform_data =
3362 &msm8960_qup_spi_gsbi1_pdata;
3363 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
3364
3365 msm8960_init_mmc();
3366 msm_fb_add_devices();
3367 slim_register_board_info(msm_slim_devices,
3368 ARRAY_SIZE(msm_slim_devices));
3369 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
3370 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
3371 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
3372 msm_pm_data);
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003373}
3374
3375static void __init msm8960_rumi3_init(void)
3376{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003377 if (socinfo_init() < 0)
3378 pr_err("socinfo_init() failed!\n");
3379
3380 BUG_ON(msm_rpm_init(&msm_rpm_data));
3381 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
3382 ARRAY_SIZE(msm_rpmrs_levels)));
3383 regulator_suppress_info_printing();
3384 msm8960_clock_init_dummy();
3385 gpiomux_init();
3386 ethernet_init();
3387 msm8960_device_ssbi_pm8921.dev.platform_data =
3388 &msm8960_ssbi_pm8921_pdata;
3389 pm8921_platform_data.num_regulators = msm_pm8921_regulator_pdata_len;
3390 msm8960_device_qup_spi_gsbi1.dev.platform_data =
3391 &msm8960_qup_spi_gsbi1_pdata;
3392 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
3393 msm8960_i2c_init();
3394 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
3395 msm_spm_l2_init(msm_spm_l2_data);
3396 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
3397 pm8921_gpio_mpp_init();
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003398 platform_add_devices(rumi3_devices, ARRAY_SIZE(rumi3_devices));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003399 msm8960_init_mmc();
3400
3401 register_i2c_devices();
3402 msm_fb_add_devices();
3403 slim_register_board_info(msm_slim_devices,
3404 ARRAY_SIZE(msm_slim_devices));
3405 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
3406 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
3407 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
3408 msm_pm_data);
3409}
3410
3411static void __init msm8960_cdp_init(void)
3412{
3413 if (socinfo_init() < 0)
3414 pr_err("socinfo_init() failed!\n");
3415
3416 BUG_ON(msm_rpm_init(&msm_rpm_data));
3417 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
3418 ARRAY_SIZE(msm_rpmrs_levels)));
3419 regulator_suppress_info_printing();
3420 if (msm_xo_init())
3421 pr_err("Failed to initialize XO votes\n");
3422 msm8960_clock_init();
3423 msm_device_otg.dev.platform_data = &msm_otg_pdata;
3424 msm_device_gadget_peripheral.dev.parent = &msm_device_otg.dev;
3425 msm_device_hsusb_host.dev.parent = &msm_device_otg.dev;
3426 gpiomux_init();
3427 ethernet_init();
3428 msm8960_device_qup_spi_gsbi1.dev.platform_data =
3429 &msm8960_qup_spi_gsbi1_pdata;
3430 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
3431 msm8960_device_ssbi_pm8921.dev.platform_data =
3432 &msm8960_ssbi_pm8921_pdata;
3433 pm8921_platform_data.num_regulators = msm_pm8921_regulator_pdata_len;
3434 msm8960_i2c_init();
3435 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
3436 msm_spm_l2_init(msm_spm_l2_data);
3437 msm8960_init_buses();
3438 platform_add_devices(msm_footswitch_devices,
3439 msm_num_footswitch_devices);
3440 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
3441 pm8921_gpio_mpp_init();
3442 platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices));
3443 msm8960_init_cam();
3444 msm8960_init_mmc();
3445 msm_acpu_clock_init(&msm8960_acpu_clock_data);
3446 register_i2c_devices();
3447 msm8960_wcnss_init();
3448 msm_fb_add_devices();
3449 slim_register_board_info(msm_slim_devices,
3450 ARRAY_SIZE(msm_slim_devices));
3451 msm8960_init_dsps();
3452 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
3453 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
3454 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
3455 msm_pm_data);
Larry Bassela7eadea2011-07-14 10:46:00 -07003456 change_memory_power = &msm8960_change_memory_power;
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003457}
3458
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08003459MACHINE_START(MSM8960_SIM, "QCT MSM8960 SIMULATOR")
3460 .map_io = msm8960_map_io,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003461 .reserve = msm8960_reserve,
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08003462 .init_irq = msm8960_init_irq,
3463 .timer = &msm_timer,
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003464 .init_machine = msm8960_sim_init,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003465 .init_early = msm8960_allocate_memory_regions,
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08003466MACHINE_END
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08003467
3468MACHINE_START(MSM8960_RUMI3, "QCT MSM8960 RUMI3")
3469 .map_io = msm8960_map_io,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003470 .reserve = msm8960_reserve,
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08003471 .init_irq = msm8960_init_irq,
3472 .timer = &msm_timer,
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08003473 .init_machine = msm8960_rumi3_init,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003474 .init_early = msm8960_allocate_memory_regions,
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08003475MACHINE_END
3476
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003477MACHINE_START(MSM8960_CDP, "QCT MSM8960 CDP")
3478 .map_io = msm8960_map_io,
3479 .reserve = msm8960_reserve,
3480 .init_irq = msm8960_init_irq,
3481 .timer = &msm_timer,
3482 .init_machine = msm8960_cdp_init,
3483 .init_early = msm8960_allocate_memory_regions,
3484MACHINE_END
3485
3486MACHINE_START(MSM8960_MTP, "QCT MSM8960 MTP")
3487 .map_io = msm8960_map_io,
3488 .reserve = msm8960_reserve,
3489 .init_irq = msm8960_init_irq,
3490 .timer = &msm_timer,
3491 .init_machine = msm8960_cdp_init,
3492 .init_early = msm8960_allocate_memory_regions,
3493MACHINE_END
3494
3495MACHINE_START(MSM8960_FLUID, "QCT MSM8960 FLUID")
3496 .map_io = msm8960_map_io,
3497 .reserve = msm8960_reserve,
3498 .init_irq = msm8960_init_irq,
3499 .timer = &msm_timer,
3500 .init_machine = msm8960_cdp_init,
3501 .init_early = msm8960_allocate_memory_regions,
3502MACHINE_END
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03003503
3504MACHINE_START(MSM8960_LIQUID, "QCT MSM8960 LIQUID")
3505 .map_io = msm8960_map_io,
3506 .reserve = msm8960_reserve,
3507 .init_irq = msm8960_init_irq,
3508 .timer = &msm_timer,
3509 .init_machine = msm8960_cdp_init,
3510 .init_early = msm8960_allocate_memory_regions,
3511MACHINE_END