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