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