blob: 89bdcf8a56f89caf3fd63b22b29fe916b8fea633 [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>
Amir Samuelov5137e392011-09-21 17:31:25 +030019#include <linux/i2c/isl9519.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070020#include <linux/gpio.h>
21#include <linux/msm_ssbi.h>
22#include <linux/regulator/gpio-regulator.h>
23#include <linux/mfd/pm8xxx/pm8921.h>
Siddartha Mohanadossaf91d902011-10-20 10:23:34 -070024#include <linux/mfd/pm8xxx/pm8xxx-adc.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070025#include <linux/regulator/consumer.h>
26#include <linux/spi/spi.h>
27#include <linux/slimbus/slimbus.h>
28#include <linux/bootmem.h>
Lucille Sylvester34ec3692011-08-16 16:28:04 -060029#include <linux/msm_kgsl.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070030#ifdef CONFIG_ANDROID_PMEM
31#include <linux/android_pmem.h>
32#endif
33#include <linux/cyttsp.h>
34#include <linux/dma-mapping.h>
35#include <linux/platform_data/qcom_crypto_device.h>
Ankur Nandwanib0039b02011-08-09 14:00:45 -070036#include <linux/platform_data/qcom_wcnss_device.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070037#include <linux/leds.h>
38#include <linux/leds-pm8xxx.h>
Mohan Pallaka50837382011-09-07 11:00:57 +053039#include <linux/i2c/atmel_mxt_ts.h>
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -070040#include <linux/msm_tsens.h>
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -070041#include <linux/ks8851.h>
Mohan Pallaka5e490392011-09-09 15:18:41 +053042#include <linux/i2c/isa1200.h>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080043
44#include <asm/mach-types.h>
45#include <asm/mach/arch.h>
Larry Basselb4126da2011-07-18 14:31:33 -070046#include <asm/setup.h>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080047#include <asm/hardware/gic.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070048#include <asm/mach/mmc.h>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080049
50#include <mach/board.h>
51#include <mach/msm_iomap.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070052#include <mach/msm_spi.h>
53#ifdef CONFIG_USB_MSM_OTG_72K
54#include <mach/msm_hsusb.h>
55#else
56#include <linux/usb/msm_hsusb.h>
57#endif
58#include <linux/usb/android.h>
59#include <mach/usbdiag.h>
60#include <mach/socinfo.h>
61#include <mach/rpm.h>
62#include <mach/gpio.h>
Rohit Vaswania513aa8d2011-07-18 15:14:28 -070063#include <mach/gpiomux.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070064#include <mach/msm_bus_board.h>
65#include <mach/msm_memtypes.h>
66#include <mach/dma.h>
67#include <mach/msm_dsps.h>
68#include <mach/msm_xo.h>
Abhijeet Dharmapurikar6d565fd2011-09-15 18:49:56 -070069#include <mach/restart.h>
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -080070
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070071#ifdef CONFIG_WCD9310_CODEC
72#include <linux/slimbus/slimbus.h>
73#include <linux/mfd/wcd9310/core.h>
74#include <linux/mfd/wcd9310/pdata.h>
75#endif
76
Laura Abbottd6183792011-08-19 13:42:24 -070077#include <linux/ion.h>
78#include <mach/ion.h>
Joel Kingb8352a12011-11-15 18:46:24 -080079#include <mach/mdm2.h>
Laura Abbottd6183792011-08-19 13:42:24 -070080
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070081#include "timer.h"
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -080082#include "devices.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070083#include "devices-msm8x60.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070084#include "spm.h"
85#include "board-msm8960.h"
86#include "pm.h"
87#include "cpuidle.h"
88#include "rpm_resources.h"
89#include "mpm.h"
Matt Wagantall6d9ebee2011-08-26 12:15:24 -070090#include "acpuclock.h"
David Collins4c31a872011-08-31 10:07:10 -070091#include "rpm_log.h"
Naveen Ramaraj76483ad2011-09-06 14:25:44 -070092#include "smd_private.h"
Maheshkumar Sivasubramanian8ccc16e2011-10-25 15:59:57 -060093#include "pm-boot.h"
Jeff Ohlstein7e668552011-10-06 16:17:25 -070094#include "msm_watchdog.h"
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -080095#include "board-msm8960.h"
96
Joel Kingb8352a12011-11-15 18:46:24 -080097#define PLATFORM_IS_CHARM25() \
98 (machine_is_msm8960_cdp() && \
99 (socinfo_get_platform_subtype() == 1) \
100 )
101
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700102static struct platform_device msm_fm_platform_init = {
103 .name = "iris_fm",
104 .id = -1,
105};
106
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700107#define KS8851_RST_GPIO 89
108#define KS8851_IRQ_GPIO 90
109
Harini Jayaraman608d0462011-08-09 19:10:03 -0600110/* The SPI configurations apply to GSBI 1*/
111static struct gpiomux_setting spi_active = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700112 .func = GPIOMUX_FUNC_1,
Stepan Moskovchenkoa69f9052011-10-26 17:47:18 -0700113 .drv = GPIOMUX_DRV_12MA,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700114 .pull = GPIOMUX_PULL_NONE,
115};
116
Harini Jayaraman608d0462011-08-09 19:10:03 -0600117static struct gpiomux_setting spi_suspended_config = {
118 .func = GPIOMUX_FUNC_GPIO,
119 .drv = GPIOMUX_DRV_2MA,
120 .pull = GPIOMUX_PULL_DOWN,
121};
122
Chandan Uddaraju15e54b92011-09-12 10:52:36 -0700123static struct gpiomux_setting spi_active_config2 = {
124 .func = GPIOMUX_FUNC_2,
125 .drv = GPIOMUX_DRV_8MA,
126 .pull = GPIOMUX_PULL_NONE,
127};
128
129static struct gpiomux_setting spi_suspended_config2 = {
130 .func = GPIOMUX_FUNC_GPIO,
131 .drv = GPIOMUX_DRV_2MA,
132 .pull = GPIOMUX_PULL_UP,
133};
134
Mohan Pallakafd9a8f12011-09-23 11:50:38 +0530135static struct gpiomux_setting gsbi3_suspended_cfg = {
136 .func = GPIOMUX_FUNC_1,
137 .drv = GPIOMUX_DRV_2MA,
138 .pull = GPIOMUX_PULL_KEEPER,
139};
140
141static struct gpiomux_setting gsbi3_active_cfg = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700142 .func = GPIOMUX_FUNC_1,
143 .drv = GPIOMUX_DRV_8MA,
144 .pull = GPIOMUX_PULL_NONE,
145};
146
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700147static struct gpiomux_setting gsbi5 = {
148 .func = GPIOMUX_FUNC_1,
149 .drv = GPIOMUX_DRV_8MA,
150 .pull = GPIOMUX_PULL_NONE,
151};
152
153static struct gpiomux_setting gsbi10 = {
154 .func = GPIOMUX_FUNC_2,
155 .drv = GPIOMUX_DRV_8MA,
156 .pull = GPIOMUX_PULL_NONE,
157};
158
159static struct gpiomux_setting gsbi12 = {
160 .func = GPIOMUX_FUNC_1,
161 .drv = GPIOMUX_DRV_8MA,
162 .pull = GPIOMUX_PULL_NONE,
163};
164
165static struct gpiomux_setting cdc_mclk = {
166 .func = GPIOMUX_FUNC_1,
167 .drv = GPIOMUX_DRV_8MA,
168 .pull = GPIOMUX_PULL_NONE,
169};
170
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -0700171static struct gpiomux_setting audio_auxpcm[] = {
172 /* Suspended state */
173 {
174 .func = GPIOMUX_FUNC_GPIO,
175 .drv = GPIOMUX_DRV_2MA,
176 .pull = GPIOMUX_PULL_NONE,
177 },
178 /* Active state */
179 {
180 .func = GPIOMUX_FUNC_1,
181 .drv = GPIOMUX_DRV_2MA,
182 .pull = GPIOMUX_PULL_NONE,
183 },
184};
185
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -0700186#if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700187static struct gpiomux_setting gpio_eth_config = {
188 .pull = GPIOMUX_PULL_NONE,
189 .drv = GPIOMUX_DRV_8MA,
190 .func = GPIOMUX_FUNC_GPIO,
191};
Stepan Moskovchenko41d168272011-08-09 17:09:42 -0700192#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700193
194static struct gpiomux_setting slimbus = {
195 .func = GPIOMUX_FUNC_1,
196 .drv = GPIOMUX_DRV_8MA,
197 .pull = GPIOMUX_PULL_KEEPER,
198};
199
Stepan Moskovchenkofc70d902011-11-30 12:39:36 -0800200static struct msm_gpiomux_config msm8960_gpiomux_configs[NR_GPIO_IRQS] = {
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -0700201#if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700202 {
203 .gpio = KS8851_IRQ_GPIO,
204 .settings = {
205 [GPIOMUX_SUSPENDED] = &gpio_eth_config,
206 }
207 },
208 {
209 .gpio = KS8851_RST_GPIO,
210 .settings = {
211 [GPIOMUX_SUSPENDED] = &gpio_eth_config,
212 }
213 },
Stepan Moskovchenko41d168272011-08-09 17:09:42 -0700214#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700215};
216
217static struct msm_gpiomux_config msm8960_gsbi_configs[] __initdata = {
218 {
219 .gpio = 6, /* GSBI1 QUP SPI_DATA_MOSI */
220 .settings = {
Harini Jayaraman608d0462011-08-09 19:10:03 -0600221 [GPIOMUX_SUSPENDED] = &spi_suspended_config,
222 [GPIOMUX_ACTIVE] = &spi_active,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700223 },
224 },
225 {
226 .gpio = 7, /* GSBI1 QUP SPI_DATA_MISO */
227 .settings = {
Harini Jayaraman608d0462011-08-09 19:10:03 -0600228 [GPIOMUX_SUSPENDED] = &spi_suspended_config,
229 [GPIOMUX_ACTIVE] = &spi_active,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700230 },
231 },
232 {
233 .gpio = 8, /* GSBI1 QUP SPI_CS_N */
234 .settings = {
Harini Jayaraman608d0462011-08-09 19:10:03 -0600235 [GPIOMUX_SUSPENDED] = &spi_suspended_config,
236 [GPIOMUX_ACTIVE] = &spi_active,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700237 },
238 },
239 {
240 .gpio = 9, /* GSBI1 QUP SPI_CLK */
241 .settings = {
Harini Jayaraman608d0462011-08-09 19:10:03 -0600242 [GPIOMUX_SUSPENDED] = &spi_suspended_config,
243 [GPIOMUX_ACTIVE] = &spi_active,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700244 },
245 },
246 {
Chandan Uddaraju15e54b92011-09-12 10:52:36 -0700247 .gpio = 14, /* GSBI1 SPI_CS_1 */
248 .settings = {
249 [GPIOMUX_SUSPENDED] = &spi_suspended_config2,
250 [GPIOMUX_ACTIVE] = &spi_active_config2,
251 },
252 },
253 {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700254 .gpio = 16, /* GSBI3 I2C QUP SDA */
255 .settings = {
Mohan Pallakafd9a8f12011-09-23 11:50:38 +0530256 [GPIOMUX_SUSPENDED] = &gsbi3_suspended_cfg,
257 [GPIOMUX_ACTIVE] = &gsbi3_active_cfg,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700258 },
259 },
260 {
261 .gpio = 17, /* GSBI3 I2C QUP SCL */
262 .settings = {
Mohan Pallakafd9a8f12011-09-23 11:50:38 +0530263 [GPIOMUX_SUSPENDED] = &gsbi3_suspended_cfg,
264 [GPIOMUX_ACTIVE] = &gsbi3_active_cfg,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700265 },
266 },
267 {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700268 .gpio = 22, /* GSBI5 UART2 */
269 .settings = {
270 [GPIOMUX_SUSPENDED] = &gsbi5,
271 },
272 },
273 {
274 .gpio = 23, /* GSBI5 UART2 */
275 .settings = {
276 [GPIOMUX_SUSPENDED] = &gsbi5,
277 },
278 },
279 {
280 .gpio = 24, /* GSBI5 UART2 */
281 .settings = {
282 [GPIOMUX_SUSPENDED] = &gsbi5,
283 },
284 },
285 {
286 .gpio = 25, /* GSBI5 UART2 */
287 .settings = {
288 [GPIOMUX_SUSPENDED] = &gsbi5,
289 },
290 },
291 {
292 .gpio = 44, /* GSBI12 I2C QUP SDA */
293 .settings = {
294 [GPIOMUX_SUSPENDED] = &gsbi12,
295 },
296 },
297 {
298 .gpio = 45, /* GSBI12 I2C QUP SCL */
299 .settings = {
300 [GPIOMUX_SUSPENDED] = &gsbi12,
301 },
302 },
303 {
304 .gpio = 73, /* GSBI10 I2C QUP SDA */
305 .settings = {
306 [GPIOMUX_SUSPENDED] = &gsbi10,
307 },
308 },
309 {
310 .gpio = 74, /* GSBI10 I2C QUP SCL */
311 .settings = {
312 [GPIOMUX_SUSPENDED] = &gsbi10,
313 },
314 },
315};
316
317static struct msm_gpiomux_config msm8960_slimbus_config[] __initdata = {
318 {
319 .gpio = 60, /* slimbus data */
320 .settings = {
321 [GPIOMUX_SUSPENDED] = &slimbus,
322 },
323 },
324 {
325 .gpio = 61, /* slimbus clk */
326 .settings = {
327 [GPIOMUX_SUSPENDED] = &slimbus,
328 },
329 },
330};
331
332static struct msm_gpiomux_config msm8960_audio_codec_configs[] __initdata = {
333 {
334 .gpio = 59,
335 .settings = {
336 [GPIOMUX_SUSPENDED] = &cdc_mclk,
337 },
338 },
339};
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -0700340
341static struct msm_gpiomux_config msm8960_audio_auxpcm_configs[] __initdata = {
342 {
343 .gpio = 63,
344 .settings = {
345 [GPIOMUX_SUSPENDED] = &audio_auxpcm[0],
346 [GPIOMUX_ACTIVE] = &audio_auxpcm[1],
347 },
348 },
349 {
350 .gpio = 64,
351 .settings = {
352 [GPIOMUX_SUSPENDED] = &audio_auxpcm[0],
353 [GPIOMUX_ACTIVE] = &audio_auxpcm[1],
354 },
355 },
356 {
357 .gpio = 65,
358 .settings = {
359 [GPIOMUX_SUSPENDED] = &audio_auxpcm[0],
360 [GPIOMUX_ACTIVE] = &audio_auxpcm[1],
361 },
362 },
363 {
364 .gpio = 66,
365 .settings = {
366 [GPIOMUX_SUSPENDED] = &audio_auxpcm[0],
367 [GPIOMUX_ACTIVE] = &audio_auxpcm[1],
368 },
369 },
370};
371
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700372static struct gpiomux_setting wcnss_5wire_suspend_cfg = {
373 .func = GPIOMUX_FUNC_GPIO,
374 .drv = GPIOMUX_DRV_2MA,
Ankur Nandwaniad0d9ac2011-09-26 11:49:25 -0700375 .pull = GPIOMUX_PULL_UP,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700376};
377
378static struct gpiomux_setting wcnss_5wire_active_cfg = {
379 .func = GPIOMUX_FUNC_1,
380 .drv = GPIOMUX_DRV_6MA,
381 .pull = GPIOMUX_PULL_DOWN,
382};
383
384static struct msm_gpiomux_config wcnss_5wire_interface[] = {
385 {
386 .gpio = 84,
387 .settings = {
388 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
389 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
390 },
391 },
392 {
393 .gpio = 85,
394 .settings = {
395 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
396 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
397 },
398 },
399 {
400 .gpio = 86,
401 .settings = {
402 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
403 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
404 },
405 },
406 {
407 .gpio = 87,
408 .settings = {
409 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
410 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
411 },
412 },
413 {
414 .gpio = 88,
415 .settings = {
416 [GPIOMUX_ACTIVE] = &wcnss_5wire_active_cfg,
417 [GPIOMUX_SUSPENDED] = &wcnss_5wire_suspend_cfg,
418 },
419 },
420};
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700421
422static struct gpiomux_setting cyts_resout_sus_cfg = {
423 .func = GPIOMUX_FUNC_GPIO,
424 .drv = GPIOMUX_DRV_6MA,
425 .pull = GPIOMUX_PULL_UP,
426};
427
428static struct gpiomux_setting cyts_resout_act_cfg = {
429 .func = GPIOMUX_FUNC_GPIO,
430 .drv = GPIOMUX_DRV_6MA,
431 .pull = GPIOMUX_PULL_UP,
432};
433
434static struct gpiomux_setting cyts_sleep_sus_cfg = {
435 .func = GPIOMUX_FUNC_GPIO,
436 .drv = GPIOMUX_DRV_6MA,
437 .pull = GPIOMUX_PULL_DOWN,
438};
439
440static struct gpiomux_setting cyts_sleep_act_cfg = {
441 .func = GPIOMUX_FUNC_GPIO,
442 .drv = GPIOMUX_DRV_6MA,
443 .pull = GPIOMUX_PULL_DOWN,
444};
445
446static struct gpiomux_setting cyts_int_act_cfg = {
447 .func = GPIOMUX_FUNC_GPIO,
448 .drv = GPIOMUX_DRV_8MA,
449 .pull = GPIOMUX_PULL_UP,
450};
451
452static struct gpiomux_setting cyts_int_sus_cfg = {
453 .func = GPIOMUX_FUNC_GPIO,
454 .drv = GPIOMUX_DRV_2MA,
Mohan Pallakacbc5d162011-09-13 15:23:21 +0530455 .pull = GPIOMUX_PULL_DOWN,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700456};
457
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700458static struct msm_gpiomux_config msm8960_cyts_configs[] __initdata = {
459 { /* TS INTERRUPT */
460 .gpio = 11,
461 .settings = {
462 [GPIOMUX_ACTIVE] = &cyts_int_act_cfg,
463 [GPIOMUX_SUSPENDED] = &cyts_int_sus_cfg,
464 },
465 },
466 { /* TS SLEEP */
467 .gpio = 50,
468 .settings = {
469 [GPIOMUX_ACTIVE] = &cyts_sleep_act_cfg,
470 [GPIOMUX_SUSPENDED] = &cyts_sleep_sus_cfg,
471 },
472 },
473 { /* TS RESOUT */
474 .gpio = 52,
475 .settings = {
476 [GPIOMUX_ACTIVE] = &cyts_resout_act_cfg,
477 [GPIOMUX_SUSPENDED] = &cyts_resout_sus_cfg,
478 },
479 },
480};
481
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +0530482#ifdef CONFIG_USB_EHCI_MSM_HSIC
483static struct gpiomux_setting hsic_act_cfg = {
484 .func = GPIOMUX_FUNC_1,
485 .drv = GPIOMUX_DRV_12MA,
486 .pull = GPIOMUX_PULL_NONE,
487};
488
489static struct gpiomux_setting hsic_sus_cfg = {
490 .func = GPIOMUX_FUNC_GPIO,
491 .drv = GPIOMUX_DRV_2MA,
492 .pull = GPIOMUX_PULL_DOWN,
Vamsi Krishnaf0f7f712011-11-17 18:15:07 -0800493 .dir = GPIOMUX_OUT_LOW,
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +0530494};
495
Vijayavardhan Vennapusa2b592824f2011-11-02 19:51:32 +0530496static struct gpiomux_setting hsic_hub_act_cfg = {
497 .func = GPIOMUX_FUNC_GPIO,
498 .drv = GPIOMUX_DRV_2MA,
499 .pull = GPIOMUX_PULL_NONE,
500};
501
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +0530502static struct msm_gpiomux_config msm8960_hsic_configs[] = {
503 {
504 .gpio = 150, /*HSIC_STROBE */
505 .settings = {
506 [GPIOMUX_ACTIVE] = &hsic_act_cfg,
507 [GPIOMUX_SUSPENDED] = &hsic_sus_cfg,
508 },
509 },
510 {
511 .gpio = 151, /* HSIC_DATA */
512 .settings = {
513 [GPIOMUX_ACTIVE] = &hsic_act_cfg,
514 [GPIOMUX_SUSPENDED] = &hsic_sus_cfg,
515 },
516 },
Vijayavardhan Vennapusa2b592824f2011-11-02 19:51:32 +0530517 {
518 .gpio = 91, /* HSIC_HUB_RESET */
519 .settings = {
520 [GPIOMUX_ACTIVE] = &hsic_hub_act_cfg,
521 [GPIOMUX_SUSPENDED] = &hsic_sus_cfg,
522 },
523 },
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +0530524};
525#endif
526
Mohan Pallaka5e490392011-09-09 15:18:41 +0530527#define HAP_SHIFT_LVL_OE_GPIO 47
528
529static struct gpiomux_setting hap_lvl_shft_suspended_config = {
530 .func = GPIOMUX_FUNC_GPIO,
531 .drv = GPIOMUX_DRV_2MA,
532 .pull = GPIOMUX_PULL_DOWN,
533};
534
535static struct gpiomux_setting hap_lvl_shft_active_config = {
536 .func = GPIOMUX_FUNC_GPIO,
537 .drv = GPIOMUX_DRV_8MA,
538 .pull = GPIOMUX_PULL_UP,
539};
540
541static struct msm_gpiomux_config hap_lvl_shft_config[] __initdata = {
542 {
543 .gpio = HAP_SHIFT_LVL_OE_GPIO,
544 .settings = {
545 [GPIOMUX_SUSPENDED] = &hap_lvl_shft_suspended_config,
546 [GPIOMUX_ACTIVE] = &hap_lvl_shft_active_config,
547 },
548 },
549};
550
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700551#if defined(CONFIG_GPIO_SX150X) || defined(CONFIG_GPIO_SX150X_MODULE)
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700552
Stepan Moskovchenkoc6ada422011-11-28 19:31:16 -0800553struct sx150x_platform_data msm8960_sx150x_data[] = {
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700554 [SX150X_CAM] = {
555 .gpio_base = GPIO_CAM_EXPANDER_BASE,
556 .oscio_is_gpo = false,
557 .io_pullup_ena = 0x0,
Nishant Pandit474f2252011-07-23 23:17:56 +0530558 .io_pulldn_ena = 0xc0,
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -0700559 .io_open_drain_ena = 0x0,
560 .irq_summary = -1,
561 },
562};
Nishant Pandit474f2252011-07-23 23:17:56 +0530563
564#endif
565
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700566#define MSM_PMEM_ADSP_SIZE 0x3800000
Ben Romberger09e462d2011-08-09 15:24:37 -0700567#define MSM_PMEM_AUDIO_SIZE 0x28B000
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -0700568#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
569#define MSM_PMEM_SIZE 0x4000000 /* 64 Mbytes */
570#else
Chetan Kalyana25d0762011-11-11 17:41:29 -0800571#define MSM_PMEM_SIZE 0x1C00000 /* 28 Mbytes */
Ravishangar Kalyanamf4ef7282011-10-10 17:39:48 -0700572#endif
Laura Abbott2d1760b2011-09-29 21:31:24 -0700573
574
575#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
Laura Abbott6db11c92011-11-04 10:31:43 -0700576#define MSM_PMEM_KERNEL_EBI1_SIZE 0xB0C000
577#define MSM_ION_EBI_SIZE (MSM_PMEM_SIZE + 0x600000)
Laura Abbott2d1760b2011-09-29 21:31:24 -0700578#define MSM_ION_ADSP_SIZE MSM_PMEM_ADSP_SIZE
579#define MSM_ION_HEAP_NUM 4
580#else
Laura Abbott6db11c92011-11-04 10:31:43 -0700581#define MSM_PMEM_KERNEL_EBI1_SIZE 0x110C000
Laura Abbott2d1760b2011-09-29 21:31:24 -0700582#define MSM_ION_HEAP_NUM 2
583#endif
Laura Abbottd6183792011-08-19 13:42:24 -0700584
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700585#ifdef CONFIG_KERNEL_PMEM_EBI_REGION
586static unsigned pmem_kernel_ebi1_size = MSM_PMEM_KERNEL_EBI1_SIZE;
587static int __init pmem_kernel_ebi1_size_setup(char *p)
588{
589 pmem_kernel_ebi1_size = memparse(p, NULL);
590 return 0;
591}
592early_param("pmem_kernel_ebi1_size", pmem_kernel_ebi1_size_setup);
593#endif
594
595#ifdef CONFIG_ANDROID_PMEM
596static unsigned pmem_size = MSM_PMEM_SIZE;
597static int __init pmem_size_setup(char *p)
598{
599 pmem_size = memparse(p, NULL);
600 return 0;
601}
602early_param("pmem_size", pmem_size_setup);
603
604static unsigned pmem_adsp_size = MSM_PMEM_ADSP_SIZE;
605
606static int __init pmem_adsp_size_setup(char *p)
607{
608 pmem_adsp_size = memparse(p, NULL);
609 return 0;
610}
611early_param("pmem_adsp_size", pmem_adsp_size_setup);
612
613static unsigned pmem_audio_size = MSM_PMEM_AUDIO_SIZE;
614
615static int __init pmem_audio_size_setup(char *p)
616{
617 pmem_audio_size = memparse(p, NULL);
618 return 0;
619}
620early_param("pmem_audio_size", pmem_audio_size_setup);
621#endif
622
623#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -0700624#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700625static struct android_pmem_platform_data android_pmem_pdata = {
626 .name = "pmem",
627 .allocator_type = PMEM_ALLOCATORTYPE_ALLORNOTHING,
628 .cached = 1,
629 .memory_type = MEMTYPE_EBI1,
630};
631
632static struct platform_device android_pmem_device = {
633 .name = "android_pmem",
634 .id = 0,
635 .dev = {.platform_data = &android_pmem_pdata},
636};
637
638static struct android_pmem_platform_data android_pmem_adsp_pdata = {
639 .name = "pmem_adsp",
640 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
641 .cached = 0,
642 .memory_type = MEMTYPE_EBI1,
643};
644static struct platform_device android_pmem_adsp_device = {
645 .name = "android_pmem",
646 .id = 2,
647 .dev = { .platform_data = &android_pmem_adsp_pdata },
648};
Laura Abbott2d1760b2011-09-29 21:31:24 -0700649#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700650
651static struct android_pmem_platform_data android_pmem_audio_pdata = {
652 .name = "pmem_audio",
653 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
654 .cached = 0,
655 .memory_type = MEMTYPE_EBI1,
656};
657
658static struct platform_device android_pmem_audio_device = {
659 .name = "android_pmem",
660 .id = 4,
661 .dev = { .platform_data = &android_pmem_audio_pdata },
662};
663#endif
664
Swaminathan Sathappanb77c65e92011-09-30 18:36:09 -0700665#define DSP_RAM_BASE_8960 0x8da00000
666#define DSP_RAM_SIZE_8960 0x1800000
667static int dspcrashd_pdata_8960 = 0xDEADDEAD;
668
669static struct resource resources_dspcrashd_8960[] = {
670 {
671 .name = "msm_dspcrashd",
672 .start = DSP_RAM_BASE_8960,
673 .end = DSP_RAM_BASE_8960 + DSP_RAM_SIZE_8960,
674 .flags = IORESOURCE_DMA,
675 },
676};
677
Stepan Moskovchenkofc70d902011-11-30 12:39:36 -0800678static struct platform_device msm_device_dspcrashd_8960 = {
Swaminathan Sathappanb77c65e92011-09-30 18:36:09 -0700679 .name = "msm_dspcrashd",
680 .num_resources = ARRAY_SIZE(resources_dspcrashd_8960),
681 .resource = resources_dspcrashd_8960,
682 .dev = { .platform_data = &dspcrashd_pdata_8960 },
683};
684
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700685static struct memtype_reserve msm8960_reserve_table[] __initdata = {
686 [MEMTYPE_SMI] = {
687 },
688 [MEMTYPE_EBI0] = {
689 .flags = MEMTYPE_FLAGS_1M_ALIGN,
690 },
691 [MEMTYPE_EBI1] = {
692 .flags = MEMTYPE_FLAGS_1M_ALIGN,
693 },
694};
695
696static void __init size_pmem_devices(void)
697{
698#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -0700699#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700700 android_pmem_adsp_pdata.size = pmem_adsp_size;
701 android_pmem_pdata.size = pmem_size;
Laura Abbott2d1760b2011-09-29 21:31:24 -0700702#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700703 android_pmem_audio_pdata.size = MSM_PMEM_AUDIO_SIZE;
704#endif
705}
706
707static void __init reserve_memory_for(struct android_pmem_platform_data *p)
708{
709 msm8960_reserve_table[p->memory_type].size += p->size;
710}
711
712static void __init reserve_pmem_memory(void)
713{
714#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -0700715#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700716 reserve_memory_for(&android_pmem_adsp_pdata);
717 reserve_memory_for(&android_pmem_pdata);
Laura Abbott2d1760b2011-09-29 21:31:24 -0700718#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700719 reserve_memory_for(&android_pmem_audio_pdata);
720 msm8960_reserve_table[MEMTYPE_EBI1].size += pmem_kernel_ebi1_size;
721#endif
722}
723
Larry Basselb4126da2011-07-18 14:31:33 -0700724static int msm8960_paddr_to_memtype(unsigned int paddr)
725{
726 return MEMTYPE_EBI1;
727}
728
Laura Abbottd6183792011-08-19 13:42:24 -0700729#ifdef CONFIG_ION_MSM
Stepan Moskovchenkofc70d902011-11-30 12:39:36 -0800730static struct ion_platform_data ion_pdata = {
Laura Abbott2d1760b2011-09-29 21:31:24 -0700731 .nr = MSM_ION_HEAP_NUM,
Laura Abbottd6183792011-08-19 13:42:24 -0700732 .heaps = {
733 {
734 .id = ION_HEAP_SYSTEM_ID,
735 .type = ION_HEAP_TYPE_SYSTEM,
736 .name = ION_KMALLOC_HEAP_NAME,
737 },
738 {
739 .id = ION_HEAP_SYSTEM_CONTIG_ID,
740 .type = ION_HEAP_TYPE_SYSTEM_CONTIG,
741 .name = ION_VMALLOC_HEAP_NAME,
742 },
Laura Abbott2d1760b2011-09-29 21:31:24 -0700743#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
Laura Abbottd6183792011-08-19 13:42:24 -0700744 {
745 .id = ION_HEAP_EBI_ID,
746 .type = ION_HEAP_TYPE_CARVEOUT,
747 .name = ION_EBI1_HEAP_NAME,
748 .size = MSM_ION_EBI_SIZE,
749 .memory_type = ION_EBI_TYPE,
750 },
Laura Abbott2d1760b2011-09-29 21:31:24 -0700751 {
752 .id = ION_HEAP_ADSP_ID,
753 .type = ION_HEAP_TYPE_CARVEOUT,
754 .name = ION_ADSP_HEAP_NAME,
755 .size = MSM_ION_ADSP_SIZE,
756 .memory_type = ION_EBI_TYPE,
757 },
758#endif
Laura Abbottd6183792011-08-19 13:42:24 -0700759 }
760};
761
Stepan Moskovchenkofc70d902011-11-30 12:39:36 -0800762static struct platform_device ion_dev = {
Laura Abbottd6183792011-08-19 13:42:24 -0700763 .name = "ion-msm",
764 .id = 1,
765 .dev = { .platform_data = &ion_pdata },
766};
767#endif
768
769static void reserve_ion_memory(void)
770{
Laura Abbott2d1760b2011-09-29 21:31:24 -0700771#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
Laura Abbottd6183792011-08-19 13:42:24 -0700772 msm8960_reserve_table[MEMTYPE_EBI1].size += MSM_ION_EBI_SIZE;
Laura Abbott2d1760b2011-09-29 21:31:24 -0700773 msm8960_reserve_table[MEMTYPE_EBI1].size += MSM_ION_ADSP_SIZE;
Laura Abbottd6183792011-08-19 13:42:24 -0700774#endif
775}
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700776static void __init msm8960_calculate_reserve_sizes(void)
777{
778 size_pmem_devices();
779 reserve_pmem_memory();
Laura Abbottd6183792011-08-19 13:42:24 -0700780 reserve_ion_memory();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700781}
782
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700783static struct reserve_info msm8960_reserve_info __initdata = {
784 .memtype_reserve_table = msm8960_reserve_table,
785 .calculate_reserve_sizes = msm8960_calculate_reserve_sizes,
786 .paddr_to_memtype = msm8960_paddr_to_memtype,
787};
788
Larry Basselb4126da2011-07-18 14:31:33 -0700789static int msm8960_memory_bank_size(void)
790{
791 return 1<<29;
792}
793
794static void __init locate_unstable_memory(void)
795{
796 struct membank *mb = &meminfo.bank[meminfo.nr_banks - 1];
797 unsigned long bank_size;
798 unsigned long low, high;
799
800 bank_size = msm8960_memory_bank_size();
801 low = meminfo.bank[0].start;
802 high = mb->start + mb->size;
Olav Haugan62052e42011-10-28 14:28:32 -0700803
804 /* Check if 32 bit overflow occured */
805 if (high < mb->start)
806 high = ~0UL;
807
Larry Basselb4126da2011-07-18 14:31:33 -0700808 low &= ~(bank_size - 1);
809
810 if (high - low <= bank_size)
811 return;
812 msm8960_reserve_info.low_unstable_address = low + bank_size;
Olav Haugan62052e42011-10-28 14:28:32 -0700813 /* To avoid overflow of u32 compute max_unstable_size
814 * by first subtracting low from mb->start)
815 * */
816 msm8960_reserve_info.max_unstable_size = (mb->start - low) +
817 mb->size - bank_size;
818
Larry Basselb4126da2011-07-18 14:31:33 -0700819 msm8960_reserve_info.bank_size = bank_size;
820 pr_info("low unstable address %lx max size %lx bank size %lx\n",
821 msm8960_reserve_info.low_unstable_address,
822 msm8960_reserve_info.max_unstable_size,
823 msm8960_reserve_info.bank_size);
824}
825
Larry Basselb830e182011-10-14 10:46:55 -0700826static void __init place_movable_zone(void)
827{
828 movable_reserved_start = msm8960_reserve_info.low_unstable_address;
829 movable_reserved_size = msm8960_reserve_info.max_unstable_size;
830 pr_info("movable zone start %lx size %lx\n",
831 movable_reserved_start, movable_reserved_size);
832}
833
834static void __init msm8960_early_memory(void)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700835{
836 reserve_info = &msm8960_reserve_info;
Larry Basselb4126da2011-07-18 14:31:33 -0700837 locate_unstable_memory();
Larry Basselb830e182011-10-14 10:46:55 -0700838 place_movable_zone();
839}
840
841static void __init msm8960_reserve(void)
842{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700843 msm_reserve();
844}
845
Larry Bassela4414b12011-08-04 11:11:02 -0700846static int msm8960_change_memory_power(u64 start, u64 size,
847 int change_type)
Larry Bassela7eadea2011-07-14 10:46:00 -0700848{
Naveen Ramarajb03bb1b2011-09-12 14:34:31 -0700849 return soc_change_memory_power(start, size, change_type);
Larry Bassela7eadea2011-07-14 10:46:00 -0700850}
851
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700852static void __init msm8960_allocate_memory_regions(void)
853{
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800854 msm8960_allocate_fb_region();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700855}
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800856
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700857#ifdef CONFIG_WCD9310_CODEC
858
859#define TABLA_INTERRUPT_BASE (NR_MSM_IRQS + NR_GPIO_IRQS + NR_PM8921_IRQS)
860
Patrick Lai3043fba2011-08-01 14:15:57 -0700861/* Micbias setting is based on 8660 CDP/MTP/FLUID requirement
862 * 4 micbiases are used to power various analog and digital
863 * microphones operating at 1800 mV. Technically, all micbiases
864 * can source from single cfilter since all microphones operate
865 * at the same voltage level. The arrangement below is to make
866 * sure all cfilters are exercised. LDO_H regulator ouput level
867 * does not need to be as high as 2.85V. It is choosen for
868 * microphone sensitivity purpose.
869 */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700870static struct tabla_pdata tabla_platform_data = {
871 .slimbus_slave_device = {
872 .name = "tabla-slave",
873 .e_addr = {0, 0, 0x10, 0, 0x17, 2},
874 },
875 .irq = MSM_GPIO_TO_INT(62),
876 .irq_base = TABLA_INTERRUPT_BASE,
877 .num_irqs = NR_TABLA_IRQS,
878 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
Patrick Lai3043fba2011-08-01 14:15:57 -0700879 .micbias = {
880 .ldoh_v = TABLA_LDOH_2P85_V,
881 .cfilt1_mv = 1800,
882 .cfilt2_mv = 1800,
883 .cfilt3_mv = 1800,
884 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
885 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
886 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
887 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
888 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700889};
890
891static struct slim_device msm_slim_tabla = {
892 .name = "tabla-slim",
893 .e_addr = {0, 1, 0x10, 0, 0x17, 2},
894 .dev = {
895 .platform_data = &tabla_platform_data,
896 },
897};
Santosh Mardi60e19d92011-10-28 01:15:14 +0530898
899static struct tabla_pdata tabla20_platform_data = {
900 .slimbus_slave_device = {
901 .name = "tabla-slave",
902 .e_addr = {0, 0, 0x60, 0, 0x17, 2},
903 },
904 .irq = MSM_GPIO_TO_INT(62),
905 .irq_base = TABLA_INTERRUPT_BASE,
906 .num_irqs = NR_TABLA_IRQS,
907 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
908 .micbias = {
909 .ldoh_v = TABLA_LDOH_2P85_V,
910 .cfilt1_mv = 1800,
911 .cfilt2_mv = 1800,
912 .cfilt3_mv = 1800,
913 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
914 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
915 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
916 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
917 }
918};
919
920static struct slim_device msm_slim_tabla20 = {
921 .name = "tabla2x-slim",
922 .e_addr = {0, 1, 0x60, 0, 0x17, 2},
923 .dev = {
924 .platform_data = &tabla20_platform_data,
925 },
926};
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700927#endif
928
929static struct slim_boardinfo msm_slim_devices[] = {
930#ifdef CONFIG_WCD9310_CODEC
931 {
932 .bus_num = 1,
933 .slim_slave = &msm_slim_tabla,
934 },
Santosh Mardi60e19d92011-10-28 01:15:14 +0530935 {
936 .bus_num = 1,
937 .slim_slave = &msm_slim_tabla20,
938 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700939#endif
940 /* add more slimbus slaves as needed */
941};
942
Yunsen Wang5c1a7392011-07-09 19:10:16 -0700943#define MSM_WCNSS_PHYS 0x03000000
944#define MSM_WCNSS_SIZE 0x280000
945
946static struct resource resources_wcnss_wlan[] = {
947 {
948 .start = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
949 .end = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
950 .name = "wcnss_wlanrx_irq",
951 .flags = IORESOURCE_IRQ,
952 },
953 {
954 .start = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
955 .end = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
956 .name = "wcnss_wlantx_irq",
957 .flags = IORESOURCE_IRQ,
958 },
959 {
960 .start = MSM_WCNSS_PHYS,
961 .end = MSM_WCNSS_PHYS + MSM_WCNSS_SIZE - 1,
962 .name = "wcnss_mmio",
963 .flags = IORESOURCE_MEM,
964 },
Ankur Nandwaniad0d9ac2011-09-26 11:49:25 -0700965 {
966 .start = 84,
967 .end = 88,
968 .name = "wcnss_gpios_5wire",
969 .flags = IORESOURCE_IO,
970 },
Yunsen Wang5c1a7392011-07-09 19:10:16 -0700971};
972
Ankur Nandwanib0039b02011-08-09 14:00:45 -0700973static struct qcom_wcnss_opts qcom_wcnss_pdata = {
974 .has_48mhz_xo = 1,
975};
976
Yunsen Wang5c1a7392011-07-09 19:10:16 -0700977static struct platform_device msm_device_wcnss_wlan = {
978 .name = "wcnss_wlan",
979 .id = 0,
980 .num_resources = ARRAY_SIZE(resources_wcnss_wlan),
981 .resource = resources_wcnss_wlan,
Ankur Nandwanib0039b02011-08-09 14:00:45 -0700982 .dev = {.platform_data = &qcom_wcnss_pdata},
Yunsen Wang5c1a7392011-07-09 19:10:16 -0700983};
984
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700985#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
986 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
987 defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
988 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
989
990#define QCE_SIZE 0x10000
991#define QCE_0_BASE 0x18500000
992
993#define QCE_HW_KEY_SUPPORT 0
994#define QCE_SHA_HMAC_SUPPORT 1
995#define QCE_SHARE_CE_RESOURCE 1
996#define QCE_CE_SHARED 0
997
998static struct resource qcrypto_resources[] = {
999 [0] = {
1000 .start = QCE_0_BASE,
1001 .end = QCE_0_BASE + QCE_SIZE - 1,
1002 .flags = IORESOURCE_MEM,
1003 },
1004 [1] = {
1005 .name = "crypto_channels",
1006 .start = DMOV_CE_IN_CHAN,
1007 .end = DMOV_CE_OUT_CHAN,
1008 .flags = IORESOURCE_DMA,
1009 },
1010 [2] = {
1011 .name = "crypto_crci_in",
1012 .start = DMOV_CE_IN_CRCI,
1013 .end = DMOV_CE_IN_CRCI,
1014 .flags = IORESOURCE_DMA,
1015 },
1016 [3] = {
1017 .name = "crypto_crci_out",
1018 .start = DMOV_CE_OUT_CRCI,
1019 .end = DMOV_CE_OUT_CRCI,
1020 .flags = IORESOURCE_DMA,
1021 },
1022};
1023
1024static struct resource qcedev_resources[] = {
1025 [0] = {
1026 .start = QCE_0_BASE,
1027 .end = QCE_0_BASE + QCE_SIZE - 1,
1028 .flags = IORESOURCE_MEM,
1029 },
1030 [1] = {
1031 .name = "crypto_channels",
1032 .start = DMOV_CE_IN_CHAN,
1033 .end = DMOV_CE_OUT_CHAN,
1034 .flags = IORESOURCE_DMA,
1035 },
1036 [2] = {
1037 .name = "crypto_crci_in",
1038 .start = DMOV_CE_IN_CRCI,
1039 .end = DMOV_CE_IN_CRCI,
1040 .flags = IORESOURCE_DMA,
1041 },
1042 [3] = {
1043 .name = "crypto_crci_out",
1044 .start = DMOV_CE_OUT_CRCI,
1045 .end = DMOV_CE_OUT_CRCI,
1046 .flags = IORESOURCE_DMA,
1047 },
1048};
1049
1050#endif
1051
1052#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1053 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
1054
1055static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
1056 .ce_shared = QCE_CE_SHARED,
1057 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
1058 .hw_key_support = QCE_HW_KEY_SUPPORT,
1059 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
1060};
1061
1062static struct platform_device qcrypto_device = {
1063 .name = "qcrypto",
1064 .id = 0,
1065 .num_resources = ARRAY_SIZE(qcrypto_resources),
1066 .resource = qcrypto_resources,
1067 .dev = {
1068 .coherent_dma_mask = DMA_BIT_MASK(32),
1069 .platform_data = &qcrypto_ce_hw_suppport,
1070 },
1071};
1072#endif
1073
1074#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1075 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1076
1077static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
1078 .ce_shared = QCE_CE_SHARED,
1079 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
1080 .hw_key_support = QCE_HW_KEY_SUPPORT,
1081 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
1082};
1083
1084static struct platform_device qcedev_device = {
1085 .name = "qce",
1086 .id = 0,
1087 .num_resources = ARRAY_SIZE(qcedev_resources),
1088 .resource = qcedev_resources,
1089 .dev = {
1090 .coherent_dma_mask = DMA_BIT_MASK(32),
1091 .platform_data = &qcedev_ce_hw_suppport,
1092 },
1093};
1094#endif
1095
Joel Kingb8352a12011-11-15 18:46:24 -08001096#define MDM2AP_ERRFATAL 70
1097#define AP2MDM_ERRFATAL 95
1098#define MDM2AP_STATUS 69
1099#define AP2MDM_STATUS 94
1100#define AP2MDM_PMIC_RESET_N 80
1101#define AP2MDM_KPDPWR_N 81
1102
1103static struct gpiomux_setting ap2mdm_cfg = {
1104 .func = GPIOMUX_FUNC_GPIO,
1105 .drv = GPIOMUX_DRV_8MA,
1106 .pull = GPIOMUX_PULL_DOWN,
1107};
1108
1109static struct gpiomux_setting mdm2ap_status_cfg = {
1110 .func = GPIOMUX_FUNC_GPIO,
1111 .drv = GPIOMUX_DRV_8MA,
1112 .pull = GPIOMUX_PULL_NONE,
1113};
1114
1115static struct gpiomux_setting mdm2ap_errfatal_cfg = {
1116 .func = GPIOMUX_FUNC_GPIO,
1117 .drv = GPIOMUX_DRV_16MA,
1118 .pull = GPIOMUX_PULL_DOWN,
1119};
1120
1121static struct gpiomux_setting ap2mdm_kpdpwr_n_cfg = {
1122 .func = GPIOMUX_FUNC_GPIO,
1123 .drv = GPIOMUX_DRV_8MA,
1124 .pull = GPIOMUX_PULL_NONE,
1125};
1126
1127static struct msm_gpiomux_config mdm_configs[] __initdata = {
1128 /* AP2MDM_STATUS */
1129 {
1130 .gpio = AP2MDM_STATUS,
1131 .settings = {
1132 [GPIOMUX_SUSPENDED] = &ap2mdm_cfg,
1133 }
1134 },
1135 /* MDM2AP_STATUS */
1136 {
1137 .gpio = MDM2AP_STATUS,
1138 .settings = {
1139 [GPIOMUX_SUSPENDED] = &mdm2ap_status_cfg,
1140 }
1141 },
1142 /* MDM2AP_ERRFATAL */
1143 {
1144 .gpio = MDM2AP_ERRFATAL,
1145 .settings = {
1146 [GPIOMUX_SUSPENDED] = &mdm2ap_errfatal_cfg,
1147 }
1148 },
1149 /* AP2MDM_ERRFATAL */
1150 {
1151 .gpio = AP2MDM_ERRFATAL,
1152 .settings = {
1153 [GPIOMUX_SUSPENDED] = &ap2mdm_cfg,
1154 }
1155 },
1156 /* AP2MDM_KPDPWR_N */
1157 {
1158 .gpio = AP2MDM_KPDPWR_N,
1159 .settings = {
1160 [GPIOMUX_SUSPENDED] = &ap2mdm_kpdpwr_n_cfg,
1161 }
1162 },
1163 /* AP2MDM_PMIC_RESET_N */
1164 {
1165 .gpio = AP2MDM_PMIC_RESET_N,
1166 .settings = {
1167 [GPIOMUX_SUSPENDED] = &ap2mdm_kpdpwr_n_cfg,
1168 }
1169 }
1170};
1171
1172static struct resource mdm_resources[] = {
1173 {
1174 .start = MDM2AP_ERRFATAL,
1175 .end = MDM2AP_ERRFATAL,
1176 .name = "MDM2AP_ERRFATAL",
1177 .flags = IORESOURCE_IO,
1178 },
1179 {
1180 .start = AP2MDM_ERRFATAL,
1181 .end = AP2MDM_ERRFATAL,
1182 .name = "AP2MDM_ERRFATAL",
1183 .flags = IORESOURCE_IO,
1184 },
1185 {
1186 .start = MDM2AP_STATUS,
1187 .end = MDM2AP_STATUS,
1188 .name = "MDM2AP_STATUS",
1189 .flags = IORESOURCE_IO,
1190 },
1191 {
1192 .start = AP2MDM_STATUS,
1193 .end = AP2MDM_STATUS,
1194 .name = "AP2MDM_STATUS",
1195 .flags = IORESOURCE_IO,
1196 },
1197 {
1198 .start = AP2MDM_PMIC_RESET_N,
1199 .end = AP2MDM_PMIC_RESET_N,
1200 .name = "AP2MDM_PMIC_RESET_N",
1201 .flags = IORESOURCE_IO,
1202 },
1203 {
1204 .start = AP2MDM_KPDPWR_N,
1205 .end = AP2MDM_KPDPWR_N,
1206 .name = "AP2MDM_KPDPWR_N",
1207 .flags = IORESOURCE_IO,
1208 },
1209};
1210
1211static struct mdm_platform_data mdm_platform_data = {
1212 .mdm_version = "2.5",
1213};
1214
Stepan Moskovchenkofc70d902011-11-30 12:39:36 -08001215static struct platform_device mdm_device = {
Joel Kingb8352a12011-11-15 18:46:24 -08001216 .name = "mdm2_modem",
1217 .id = -1,
1218 .num_resources = ARRAY_SIZE(mdm_resources),
1219 .resource = mdm_resources,
1220 .dev = {
1221 .platform_data = &mdm_platform_data,
1222 },
1223};
1224
1225static struct platform_device *mdm_devices[] __initdata = {
1226 &mdm_device,
1227};
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001228
1229static int __init gpiomux_init(void)
1230{
1231 int rc;
1232
1233 rc = msm_gpiomux_init(NR_GPIO_IRQS);
1234 if (rc) {
1235 pr_err(KERN_ERR "msm_gpiomux_init failed %d\n", rc);
1236 return rc;
1237 }
1238
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001239 msm_gpiomux_install(msm8960_gpiomux_configs,
Stepan Moskovchenkod2a45a82011-08-09 17:02:57 -07001240 ARRAY_SIZE(msm8960_gpiomux_configs));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001241
1242 msm_gpiomux_install(msm8960_gsbi_configs,
1243 ARRAY_SIZE(msm8960_gsbi_configs));
1244
1245 msm_gpiomux_install(msm8960_cyts_configs,
1246 ARRAY_SIZE(msm8960_cyts_configs));
1247
1248 msm_gpiomux_install(msm8960_slimbus_config,
1249 ARRAY_SIZE(msm8960_slimbus_config));
1250
1251 msm_gpiomux_install(msm8960_audio_codec_configs,
1252 ARRAY_SIZE(msm8960_audio_codec_configs));
1253
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -07001254 msm_gpiomux_install(msm8960_audio_auxpcm_configs,
1255 ARRAY_SIZE(msm8960_audio_auxpcm_configs));
1256
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001257 msm_gpiomux_install(wcnss_5wire_interface,
1258 ARRAY_SIZE(wcnss_5wire_interface));
1259
Mohan Pallaka5e490392011-09-09 15:18:41 +05301260 if (machine_is_msm8960_mtp() || machine_is_msm8960_fluid() ||
1261 machine_is_msm8960_liquid() || machine_is_msm8960_cdp())
1262 msm_gpiomux_install(hap_lvl_shft_config,
1263 ARRAY_SIZE(hap_lvl_shft_config));
Joel Kingb8352a12011-11-15 18:46:24 -08001264
1265 if (PLATFORM_IS_CHARM25())
1266 msm_gpiomux_install(mdm_configs,
1267 ARRAY_SIZE(mdm_configs));
1268
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001269 return 0;
1270}
1271
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001272#define MSM_SHARED_RAM_PHYS 0x80000000
1273
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001274static void __init msm8960_map_io(void)
1275{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001276 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001277 msm_map_msm8960_io();
Jeff Ohlstein3a77f9f2011-09-06 14:50:20 -07001278
1279 if (socinfo_init() < 0)
1280 pr_err("socinfo_init() failed!\n");
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001281}
1282
Stepan Moskovchenkof4fdfe52011-10-18 17:28:58 -07001283#ifdef CONFIG_ARCH_MSM8930
1284static void __init msm8930_map_io(void)
1285{
1286 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
1287 msm_map_msm8930_io();
1288
1289 if (socinfo_init() < 0)
1290 pr_err("socinfo_init() failed!\n");
1291}
1292#endif
1293
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001294static void __init msm8960_init_irq(void)
1295{
1296 unsigned int i;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001297
1298 msm_mpm_irq_extn_init();
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001299 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001300 (void *)MSM_QGIC_CPU_BASE);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001301
1302 /* Edge trigger PPIs except AVS_SVICINT and AVS_SVICINTSWDONE */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001303 writel_relaxed(0xFFFFD7FF, MSM_QGIC_DIST_BASE + GIC_DIST_CONFIG + 4);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001304
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001305 writel_relaxed(0x0000FFFF, MSM_QGIC_DIST_BASE + GIC_DIST_ENABLE_SET);
1306 mb();
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08001307
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001308 /* FIXME: Not installing AVS_SVICINT and AVS_SVICINTSWDONE yet
1309 * as they are configured as level, which does not play nice with
1310 * handle_percpu_irq.
1311 */
1312 for (i = GIC_PPI_START; i < GIC_SPI_START; i++) {
1313 if (i != AVS_SVICINT && i != AVS_SVICINTSWDONE)
Thomas Gleixner6845664a2011-03-24 13:25:22 +01001314 irq_set_handler(i, handle_percpu_irq);
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08001315 }
1316}
1317
Stepan Moskovchenko73b943b2011-10-31 22:43:00 -07001318/* MSM8960 has 5 SDCC controllers */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001319enum sdcc_controllers {
1320 SDCC1,
1321 SDCC2,
1322 SDCC3,
1323 SDCC4,
1324 SDCC5,
1325 MAX_SDCC_CONTROLLER
1326};
1327
Stepan Moskovchenko73b943b2011-10-31 22:43:00 -07001328/* All SDCC controllers require VDD/VCC voltage */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001329static struct msm_mmc_reg_data mmc_vdd_reg_data[MAX_SDCC_CONTROLLER] = {
1330 /* SDCC1 : eMMC card connected */
1331 [SDCC1] = {
1332 .name = "sdc_vdd",
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05301333 .high_vol_level = 2950000,
1334 .low_vol_level = 2950000,
Subhash Jadavanidd7ef892011-08-18 16:49:57 +05301335 .always_on = 1,
1336 .lpm_sup = 1,
1337 .lpm_uA = 9000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001338 .hpm_uA = 200000, /* 200mA */
1339 },
1340 /* SDCC3 : External card slot connected */
1341 [SDCC3] = {
1342 .name = "sdc_vdd",
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05301343 .high_vol_level = 2950000,
1344 .low_vol_level = 2950000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001345 .hpm_uA = 600000, /* 600mA */
1346 }
1347};
1348
1349/* Only slots having eMMC card will require VCCQ voltage */
1350static struct msm_mmc_reg_data mmc_vccq_reg_data[1] = {
1351 /* SDCC1 : eMMC card connected */
1352 [SDCC1] = {
1353 .name = "sdc_vccq",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001354 .always_on = 1,
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05301355 .high_vol_level = 1800000,
1356 .low_vol_level = 1800000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001357 .hpm_uA = 200000, /* 200mA */
1358 }
1359};
1360
1361/* All SDCC controllers may require voting for VDD PAD voltage */
1362static struct msm_mmc_reg_data mmc_vddp_reg_data[MAX_SDCC_CONTROLLER] = {
1363 /* SDCC3 : External card slot connected */
1364 [SDCC3] = {
1365 .name = "sdc_vddp",
Subhash Jadavani99ba53a2011-08-01 16:04:18 +05301366 .high_vol_level = 2950000,
1367 .low_vol_level = 1850000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001368 .always_on = 1,
1369 .lpm_sup = 1,
1370 /* Max. Active current required is 16 mA */
1371 .hpm_uA = 16000,
1372 /*
1373 * Sleep current required is ~300 uA. But min. vote can be
1374 * in terms of mA (min. 1 mA). So let's vote for 2 mA
1375 * during sleep.
1376 */
1377 .lpm_uA = 2000,
1378 }
1379};
1380
1381static struct msm_mmc_slot_reg_data mmc_slot_vreg_data[MAX_SDCC_CONTROLLER] = {
1382 /* SDCC1 : eMMC card connected */
1383 [SDCC1] = {
1384 .vdd_data = &mmc_vdd_reg_data[SDCC1],
1385 .vccq_data = &mmc_vccq_reg_data[SDCC1],
1386 },
1387 /* SDCC3 : External card slot connected */
1388 [SDCC3] = {
1389 .vdd_data = &mmc_vdd_reg_data[SDCC3],
1390 .vddp_data = &mmc_vddp_reg_data[SDCC3],
1391 }
1392};
1393
1394/* SDC1 pad data */
1395static struct msm_mmc_pad_drv sdc1_pad_drv_on_cfg[] = {
1396 {TLMM_HDRV_SDC1_CLK, GPIO_CFG_16MA},
Subhash Jadavani87bda5a2011-08-30 17:40:44 +05301397 {TLMM_HDRV_SDC1_CMD, GPIO_CFG_10MA},
1398 {TLMM_HDRV_SDC1_DATA, GPIO_CFG_10MA}
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001399};
1400
1401static struct msm_mmc_pad_drv sdc1_pad_drv_off_cfg[] = {
1402 {TLMM_HDRV_SDC1_CLK, GPIO_CFG_2MA},
1403 {TLMM_HDRV_SDC1_CMD, GPIO_CFG_2MA},
1404 {TLMM_HDRV_SDC1_DATA, GPIO_CFG_2MA}
1405};
1406
1407static struct msm_mmc_pad_pull sdc1_pad_pull_on_cfg[] = {
Subhash Jadavanib7b5b8a2011-09-13 13:00:40 +05301408 {TLMM_PULL_SDC1_CLK, GPIO_CFG_NO_PULL},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001409 {TLMM_PULL_SDC1_CMD, GPIO_CFG_PULL_UP},
1410 {TLMM_PULL_SDC1_DATA, GPIO_CFG_PULL_UP}
1411};
1412
1413static struct msm_mmc_pad_pull sdc1_pad_pull_off_cfg[] = {
Subhash Jadavanib7b5b8a2011-09-13 13:00:40 +05301414 {TLMM_PULL_SDC1_CLK, GPIO_CFG_NO_PULL},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001415 {TLMM_PULL_SDC1_CMD, GPIO_CFG_PULL_DOWN},
1416 {TLMM_PULL_SDC1_DATA, GPIO_CFG_PULL_DOWN}
1417};
1418
1419/* SDC3 pad data */
1420static struct msm_mmc_pad_drv sdc3_pad_drv_on_cfg[] = {
1421 {TLMM_HDRV_SDC3_CLK, GPIO_CFG_8MA},
1422 {TLMM_HDRV_SDC3_CMD, GPIO_CFG_8MA},
1423 {TLMM_HDRV_SDC3_DATA, GPIO_CFG_8MA}
1424};
1425
1426static struct msm_mmc_pad_drv sdc3_pad_drv_off_cfg[] = {
1427 {TLMM_HDRV_SDC3_CLK, GPIO_CFG_2MA},
1428 {TLMM_HDRV_SDC3_CMD, GPIO_CFG_2MA},
1429 {TLMM_HDRV_SDC3_DATA, GPIO_CFG_2MA}
1430};
1431
1432static struct msm_mmc_pad_pull sdc3_pad_pull_on_cfg[] = {
Subhash Jadavanib7b5b8a2011-09-13 13:00:40 +05301433 {TLMM_PULL_SDC3_CLK, GPIO_CFG_NO_PULL},
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001434 {TLMM_PULL_SDC3_CMD, GPIO_CFG_PULL_UP},
1435 {TLMM_PULL_SDC3_DATA, GPIO_CFG_PULL_UP}
1436};
1437
1438static struct msm_mmc_pad_pull sdc3_pad_pull_off_cfg[] = {
Subhash Jadavanib7b5b8a2011-09-13 13:00:40 +05301439 {TLMM_PULL_SDC3_CLK, GPIO_CFG_NO_PULL},
Subhash Jadavani46d4f342011-10-12 14:44:45 +05301440 /*
1441 * SDC3 CMD line should be PULLed UP otherwise fluid platform will
1442 * see transitions (1 -> 0 and 0 -> 1) on card detection line,
1443 * which would result in false card detection interrupts.
1444 */
1445 {TLMM_PULL_SDC3_CMD, GPIO_CFG_PULL_UP},
1446 /*
1447 * Keeping DATA lines status to PULL UP will make sure that
1448 * there is no current leak during sleep if external pull up
1449 * is connected to DATA lines.
1450 */
1451 {TLMM_PULL_SDC3_DATA, GPIO_CFG_PULL_UP}
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001452};
1453
Stepan Moskovchenkofc70d902011-11-30 12:39:36 -08001454static struct msm_mmc_pad_pull_data mmc_pad_pull_data[MAX_SDCC_CONTROLLER] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001455 [SDCC1] = {
1456 .on = sdc1_pad_pull_on_cfg,
1457 .off = sdc1_pad_pull_off_cfg,
1458 .size = ARRAY_SIZE(sdc1_pad_pull_on_cfg)
1459 },
1460 [SDCC3] = {
1461 .on = sdc3_pad_pull_on_cfg,
1462 .off = sdc3_pad_pull_off_cfg,
1463 .size = ARRAY_SIZE(sdc3_pad_pull_on_cfg)
1464 },
1465};
1466
Stepan Moskovchenkofc70d902011-11-30 12:39:36 -08001467static struct msm_mmc_pad_drv_data mmc_pad_drv_data[MAX_SDCC_CONTROLLER] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001468 [SDCC1] = {
1469 .on = sdc1_pad_drv_on_cfg,
1470 .off = sdc1_pad_drv_off_cfg,
1471 .size = ARRAY_SIZE(sdc1_pad_drv_on_cfg)
1472 },
1473 [SDCC3] = {
1474 .on = sdc3_pad_drv_on_cfg,
1475 .off = sdc3_pad_drv_off_cfg,
1476 .size = ARRAY_SIZE(sdc3_pad_drv_on_cfg)
1477 },
1478};
1479
Stepan Moskovchenkofc70d902011-11-30 12:39:36 -08001480static struct msm_mmc_pad_data mmc_pad_data[MAX_SDCC_CONTROLLER] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001481 [SDCC1] = {
1482 .pull = &mmc_pad_pull_data[SDCC1],
1483 .drv = &mmc_pad_drv_data[SDCC1]
1484 },
1485 [SDCC3] = {
1486 .pull = &mmc_pad_pull_data[SDCC3],
1487 .drv = &mmc_pad_drv_data[SDCC3]
1488 },
1489};
1490
Stepan Moskovchenkofc70d902011-11-30 12:39:36 -08001491static struct msm_mmc_pin_data mmc_slot_pin_data[MAX_SDCC_CONTROLLER] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001492 [SDCC1] = {
1493 .pad_data = &mmc_pad_data[SDCC1],
1494 },
1495 [SDCC3] = {
1496 .pad_data = &mmc_pad_data[SDCC3],
1497 },
1498};
1499
1500static unsigned int sdc1_sup_clk_rates[] = {
Subhash Jadavani0e027b72011-08-30 17:40:55 +05301501 400000, 24000000, 48000000
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001502};
1503
1504static unsigned int sdc3_sup_clk_rates[] = {
1505 400000, 24000000, 48000000, 96000000
1506};
1507
1508#ifdef CONFIG_MMC_MSM_SDC1_SUPPORT
1509static struct mmc_platform_data msm8960_sdc1_data = {
1510 .ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29,
1511#ifdef CONFIG_MMC_MSM_SDC1_8_BIT_SUPPORT
1512 .mmc_bus_width = MMC_CAP_8_BIT_DATA,
1513#else
1514 .mmc_bus_width = MMC_CAP_4_BIT_DATA,
1515#endif
1516 .sup_clk_table = sdc1_sup_clk_rates,
1517 .sup_clk_cnt = ARRAY_SIZE(sdc1_sup_clk_rates),
Subhash Jadavanib7655b62011-09-27 19:12:36 +05301518 .pclk_src_dfab = 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001519 .nonremovable = 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001520 .vreg_data = &mmc_slot_vreg_data[SDCC1],
Subhash Jadavani0e027b72011-08-30 17:40:55 +05301521 .pin_data = &mmc_slot_pin_data[SDCC1]
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001522};
1523#endif
1524
1525#ifdef CONFIG_MMC_MSM_SDC3_SUPPORT
1526static struct mmc_platform_data msm8960_sdc3_data = {
1527 .ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29,
1528 .mmc_bus_width = MMC_CAP_4_BIT_DATA,
1529 .sup_clk_table = sdc3_sup_clk_rates,
1530 .sup_clk_cnt = ARRAY_SIZE(sdc3_sup_clk_rates),
Subhash Jadavanib7655b62011-09-27 19:12:36 +05301531 .pclk_src_dfab = 1,
Subhash Jadavanib9ef7472011-09-21 18:37:28 +05301532#ifdef CONFIG_MMC_MSM_SDC3_WP_SUPPORT
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001533 .wpswitch_gpio = PM8921_GPIO_PM_TO_SYS(16),
Subhash Jadavanib9ef7472011-09-21 18:37:28 +05301534#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001535 .vreg_data = &mmc_slot_vreg_data[SDCC3],
1536 .pin_data = &mmc_slot_pin_data[SDCC3],
1537#ifdef CONFIG_MMC_MSM_CARD_HW_DETECTION
1538 .status_gpio = PM8921_GPIO_PM_TO_SYS(26),
1539 .status_irq = PM8921_GPIO_IRQ(PM8921_IRQ_BASE, 26),
1540 .irq_flags = IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
1541#endif
1542 .xpc_cap = 1,
1543 .uhs_caps = (MMC_CAP_UHS_SDR12 | MMC_CAP_UHS_SDR25 |
1544 MMC_CAP_UHS_SDR50 | MMC_CAP_UHS_DDR50 |
Subhash Jadavani0e027b72011-08-30 17:40:55 +05301545 MMC_CAP_MAX_CURRENT_600)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001546};
1547#endif
1548
1549static void __init msm8960_init_mmc(void)
1550{
1551#ifdef CONFIG_MMC_MSM_SDC1_SUPPORT
1552 /* SDC1 : eMMC card connected */
1553 msm_add_sdcc(1, &msm8960_sdc1_data);
1554#endif
1555#ifdef CONFIG_MMC_MSM_SDC3_SUPPORT
1556 /* SDC3: External card slot */
1557 msm_add_sdcc(3, &msm8960_sdc3_data);
1558#endif
1559}
1560
1561static void __init msm8960_init_buses(void)
1562{
1563#ifdef CONFIG_MSM_BUS_SCALING
Gagan Macdc1dc142011-09-16 15:13:35 -06001564 msm_bus_rpm_set_mt_mask();
Gagan Macae154c4b2011-10-05 19:24:43 -06001565 msm_bus_8960_apps_fabric_pdata.rpm_enabled = 1;
1566 msm_bus_8960_sys_fabric_pdata.rpm_enabled = 1;
1567 msm_bus_8960_mm_fabric_pdata.rpm_enabled = 1;
1568 msm_bus_apps_fabric.dev.platform_data =
1569 &msm_bus_8960_apps_fabric_pdata;
1570 msm_bus_sys_fabric.dev.platform_data = &msm_bus_8960_sys_fabric_pdata;
1571 msm_bus_mm_fabric.dev.platform_data = &msm_bus_8960_mm_fabric_pdata;
1572 msm_bus_sys_fpb.dev.platform_data = &msm_bus_8960_sys_fpb_pdata;
1573 msm_bus_cpss_fpb.dev.platform_data = &msm_bus_8960_cpss_fpb_pdata;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001574#endif
1575}
1576
1577static struct msm_spi_platform_data msm8960_qup_spi_gsbi1_pdata = {
1578 .max_clock_speed = 15060000,
1579};
1580
1581#ifdef CONFIG_USB_MSM_OTG_72K
1582static struct msm_otg_platform_data msm_otg_pdata;
1583#else
1584#define USB_5V_EN 42
1585static void msm_hsusb_vbus_power(bool on)
1586{
1587 int rc;
1588 static bool vbus_is_on;
1589 static struct regulator *mvs_otg_switch;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001590
1591 if (vbus_is_on == on)
1592 return;
1593
1594 if (on) {
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07001595 mvs_otg_switch = regulator_get(&msm8960_device_otg.dev,
1596 "vbus_otg");
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001597 if (IS_ERR(mvs_otg_switch)) {
1598 pr_err("Unable to get mvs_otg_switch\n");
1599 return;
1600 }
1601
1602 rc = gpio_request(PM8921_GPIO_PM_TO_SYS(USB_5V_EN),
1603 "usb_5v_en");
1604 if (rc < 0) {
1605 pr_err("failed to request usb_5v_en gpio\n");
1606 goto put_mvs_otg;
1607 }
1608
Anji jonnala2936fd92011-11-09 15:39:22 +05301609 rc = gpio_direction_output(PM8921_GPIO_PM_TO_SYS(USB_5V_EN), 1);
1610 if (rc) {
1611 pr_err("%s: unable to set_direction for gpio [%d]\n",
1612 __func__, PM8921_GPIO_PM_TO_SYS(USB_5V_EN));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001613 goto free_usb_5v_en;
1614 }
1615
Anji jonnala2936fd92011-11-09 15:39:22 +05301616 if (regulator_enable(mvs_otg_switch)) {
1617 pr_err("unable to enable mvs_otg_switch\n");
1618 goto err_ldo_gpio_set_dir;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001619 }
Anji jonnala2936fd92011-11-09 15:39:22 +05301620
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001621 vbus_is_on = true;
1622 return;
1623 }
Anji jonnala2936fd92011-11-09 15:39:22 +05301624 regulator_disable(mvs_otg_switch);
1625err_ldo_gpio_set_dir:
1626 gpio_set_value(PM8921_GPIO_PM_TO_SYS(USB_5V_EN), 0);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001627free_usb_5v_en:
Anji jonnala2936fd92011-11-09 15:39:22 +05301628 gpio_free(PM8921_GPIO_PM_TO_SYS(USB_5V_EN));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001629put_mvs_otg:
Anji jonnala2936fd92011-11-09 15:39:22 +05301630 regulator_put(mvs_otg_switch);
1631 vbus_is_on = false;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001632}
1633
1634static struct msm_otg_platform_data msm_otg_pdata = {
1635 .mode = USB_OTG,
1636 .otg_control = OTG_PMIC_CONTROL,
1637 .phy_type = SNPS_28NM_INTEGRATED_PHY,
1638 .pclk_src_name = "dfab_usb_hs_clk",
1639 .pmic_id_irq = PM8921_USB_ID_IN_IRQ(PM8921_IRQ_BASE),
1640 .vbus_power = msm_hsusb_vbus_power,
Anji jonnala4e3e6772011-09-15 18:53:42 +05301641 .power_budget = 750,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001642};
1643#endif
1644
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05301645#ifdef CONFIG_USB_EHCI_MSM_HSIC
Vijayavardhan Vennapusa2b592824f2011-11-02 19:51:32 +05301646#define HSIC_HUB_RESET_GPIO 91
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05301647static struct msm_hsic_host_platform_data msm_hsic_pdata = {
1648 .strobe = 150,
1649 .data = 151,
1650};
1651#else
1652static struct msm_hsic_host_platform_data msm_hsic_pdata;
1653#endif
1654
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001655#define PID_MAGIC_ID 0x71432909
1656#define SERIAL_NUM_MAGIC_ID 0x61945374
1657#define SERIAL_NUMBER_LENGTH 127
1658#define DLOAD_USB_BASE_ADD 0x2A03F0C8
1659
1660struct magic_num_struct {
1661 uint32_t pid;
1662 uint32_t serial_num;
1663};
1664
1665struct dload_struct {
1666 uint32_t reserved1;
1667 uint32_t reserved2;
1668 uint32_t reserved3;
1669 uint16_t reserved4;
1670 uint16_t pid;
1671 char serial_number[SERIAL_NUMBER_LENGTH];
1672 uint16_t reserved5;
1673 struct magic_num_struct magic_struct;
1674};
1675
1676static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum)
1677{
1678 struct dload_struct __iomem *dload = 0;
1679
1680 dload = ioremap(DLOAD_USB_BASE_ADD, sizeof(*dload));
1681 if (!dload) {
1682 pr_err("%s: cannot remap I/O memory region: %08x\n",
1683 __func__, DLOAD_USB_BASE_ADD);
1684 return -ENXIO;
1685 }
1686
1687 pr_debug("%s: dload:%p pid:%x serial_num:%s\n",
1688 __func__, dload, pid, snum);
1689 /* update pid */
1690 dload->magic_struct.pid = PID_MAGIC_ID;
1691 dload->pid = pid;
1692
1693 /* update serial number */
1694 dload->magic_struct.serial_num = 0;
1695 if (!snum) {
1696 memset(dload->serial_number, 0, SERIAL_NUMBER_LENGTH);
1697 goto out;
1698 }
1699
1700 dload->magic_struct.serial_num = SERIAL_NUM_MAGIC_ID;
Jin Honge49b1482011-10-03 11:15:50 -07001701 strlcpy(dload->serial_number, snum, SERIAL_NUMBER_LENGTH);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001702out:
1703 iounmap(dload);
1704 return 0;
1705}
1706
1707static struct android_usb_platform_data android_usb_pdata = {
1708 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
1709};
1710
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07001711static struct platform_device android_usb_device = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001712 .name = "android_usb",
1713 .id = -1,
1714 .dev = {
1715 .platform_data = &android_usb_pdata,
1716 },
1717};
1718
1719static uint8_t spm_wfi_cmd_sequence[] __initdata = {
1720 0x03, 0x0f,
1721};
1722
1723static uint8_t spm_power_collapse_without_rpm[] __initdata = {
1724 0x00, 0x24, 0x54, 0x10,
1725 0x09, 0x03, 0x01,
1726 0x10, 0x54, 0x30, 0x0C,
1727 0x24, 0x30, 0x0f,
1728};
1729
1730static uint8_t spm_power_collapse_with_rpm[] __initdata = {
1731 0x00, 0x24, 0x54, 0x10,
1732 0x09, 0x07, 0x01, 0x0B,
1733 0x10, 0x54, 0x30, 0x0C,
1734 0x24, 0x30, 0x0f,
1735};
1736
1737static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = {
1738 [0] = {
1739 .mode = MSM_SPM_MODE_CLOCK_GATING,
1740 .notify_rpm = false,
1741 .cmd = spm_wfi_cmd_sequence,
1742 },
1743 [1] = {
1744 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1745 .notify_rpm = false,
1746 .cmd = spm_power_collapse_without_rpm,
1747 },
1748 [2] = {
1749 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1750 .notify_rpm = true,
1751 .cmd = spm_power_collapse_with_rpm,
1752 },
1753};
1754
1755static struct msm_spm_platform_data msm_spm_data[] __initdata = {
1756 [0] = {
1757 .reg_base_addr = MSM_SAW0_BASE,
1758 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
1759 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
1760 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0x9C,
1761#if defined(CONFIG_MSM_AVS_HW)
1762 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1763 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1764#endif
1765 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
1766 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
1767 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1768 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1769 .vctl_timeout_us = 50,
1770 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1771 .modes = msm_spm_seq_list,
1772 },
1773 [1] = {
1774 .reg_base_addr = MSM_SAW1_BASE,
1775 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
1776 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
1777 .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0x9C,
1778#if defined(CONFIG_MSM_AVS_HW)
1779 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
1780 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
1781#endif
1782 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
1783 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
1784 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
1785 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
1786 .vctl_timeout_us = 50,
1787 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1788 .modes = msm_spm_seq_list,
1789 },
1790};
1791
1792static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = {
1793 0x00, 0x20, 0x03, 0x20,
1794 0x00, 0x0f,
1795};
1796
1797static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = {
1798 0x00, 0x20, 0x34, 0x64,
1799 0x48, 0x07, 0x48, 0x20,
1800 0x50, 0x64, 0x04, 0x34,
1801 0x50, 0x0f,
1802};
1803static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = {
1804 0x00, 0x10, 0x34, 0x64,
1805 0x48, 0x07, 0x48, 0x10,
1806 0x50, 0x64, 0x04, 0x34,
1807 0x50, 0x0F,
1808};
1809
1810static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = {
1811 [0] = {
1812 .mode = MSM_SPM_L2_MODE_RETENTION,
1813 .notify_rpm = false,
1814 .cmd = l2_spm_wfi_cmd_sequence,
1815 },
1816 [1] = {
1817 .mode = MSM_SPM_L2_MODE_GDHS,
1818 .notify_rpm = true,
1819 .cmd = l2_spm_gdhs_cmd_sequence,
1820 },
1821 [2] = {
1822 .mode = MSM_SPM_L2_MODE_POWER_COLLAPSE,
1823 .notify_rpm = true,
1824 .cmd = l2_spm_power_off_cmd_sequence,
1825 },
1826};
1827
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001828static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = {
1829 [0] = {
1830 .reg_base_addr = MSM_SAW_L2_BASE,
1831 .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00,
1832 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00,
1833 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202,
1834 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE,
1835 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020,
1836 .modes = msm_spm_l2_seq_list,
1837 .num_modes = ARRAY_SIZE(msm_spm_l2_seq_list),
1838 },
1839};
1840
Mohan Pallaka5e490392011-09-09 15:18:41 +05301841#define PM_HAP_EN_GPIO PM8921_GPIO_PM_TO_SYS(33)
1842#define PM_HAP_LEN_GPIO PM8921_GPIO_PM_TO_SYS(20)
1843
1844static struct msm_xo_voter *xo_handle_d1;
1845
1846static int isa1200_power(int on)
1847{
1848 int rc = 0;
1849
1850 gpio_set_value(HAP_SHIFT_LVL_OE_GPIO, !!on);
1851
1852 rc = on ? msm_xo_mode_vote(xo_handle_d1, MSM_XO_MODE_ON) :
1853 msm_xo_mode_vote(xo_handle_d1, MSM_XO_MODE_OFF);
1854 if (rc < 0) {
1855 pr_err("%s: failed to %svote for TCXO D1 buffer%d\n",
1856 __func__, on ? "" : "de-", rc);
1857 goto err_xo_vote;
1858 }
1859
1860 return 0;
1861
1862err_xo_vote:
1863 gpio_set_value(HAP_SHIFT_LVL_OE_GPIO, !on);
1864 return rc;
1865}
1866
1867static int isa1200_dev_setup(bool enable)
1868{
1869 int rc = 0;
1870
1871 struct pm_gpio hap_gpio_config = {
1872 .direction = PM_GPIO_DIR_OUT,
1873 .pull = PM_GPIO_PULL_NO,
1874 .out_strength = PM_GPIO_STRENGTH_HIGH,
1875 .function = PM_GPIO_FUNC_NORMAL,
1876 .inv_int_pol = 0,
1877 .vin_sel = 2,
1878 .output_buffer = PM_GPIO_OUT_BUF_CMOS,
1879 .output_value = 0,
1880 };
1881
1882 if (enable == true) {
1883 rc = pm8xxx_gpio_config(PM_HAP_EN_GPIO, &hap_gpio_config);
1884 if (rc) {
1885 pr_err("%s: pm8921 gpio %d config failed(%d)\n",
1886 __func__, PM_HAP_EN_GPIO, rc);
1887 return rc;
1888 }
1889
1890 rc = pm8xxx_gpio_config(PM_HAP_LEN_GPIO, &hap_gpio_config);
1891 if (rc) {
1892 pr_err("%s: pm8921 gpio %d config failed(%d)\n",
1893 __func__, PM_HAP_LEN_GPIO, rc);
1894 return rc;
1895 }
1896
1897 rc = gpio_request(HAP_SHIFT_LVL_OE_GPIO, "hap_shft_lvl_oe");
1898 if (rc) {
1899 pr_err("%s: unable to request gpio %d (%d)\n",
1900 __func__, HAP_SHIFT_LVL_OE_GPIO, rc);
1901 return rc;
1902 }
1903
1904 rc = gpio_direction_output(HAP_SHIFT_LVL_OE_GPIO, 0);
1905 if (rc) {
1906 pr_err("%s: Unable to set direction\n", __func__);
1907 goto free_gpio;
1908 }
1909
1910 xo_handle_d1 = msm_xo_get(MSM_XO_TCXO_D1, "isa1200");
1911 if (IS_ERR(xo_handle_d1)) {
1912 rc = PTR_ERR(xo_handle_d1);
1913 pr_err("%s: failed to get the handle for D1(%d)\n",
1914 __func__, rc);
1915 goto gpio_set_dir;
1916 }
1917 } else {
1918 gpio_free(HAP_SHIFT_LVL_OE_GPIO);
1919
1920 msm_xo_put(xo_handle_d1);
1921 }
1922
1923 return 0;
1924
1925gpio_set_dir:
1926 gpio_set_value(HAP_SHIFT_LVL_OE_GPIO, 0);
1927free_gpio:
1928 gpio_free(HAP_SHIFT_LVL_OE_GPIO);
1929 return rc;
1930}
1931
1932static struct isa1200_regulator isa1200_reg_data[] = {
1933 {
1934 .name = "vcc_i2c",
1935 .min_uV = ISA_I2C_VTG_MIN_UV,
1936 .max_uV = ISA_I2C_VTG_MAX_UV,
1937 .load_uA = ISA_I2C_CURR_UA,
1938 },
1939};
1940
1941static struct isa1200_platform_data isa1200_1_pdata = {
1942 .name = "vibrator",
1943 .dev_setup = isa1200_dev_setup,
1944 .power_on = isa1200_power,
1945 .hap_en_gpio = PM_HAP_EN_GPIO,
1946 .hap_len_gpio = PM_HAP_LEN_GPIO,
1947 .max_timeout = 15000,
1948 .mode_ctrl = PWM_GEN_MODE,
1949 .pwm_fd = {
1950 .pwm_div = 256,
1951 },
1952 .is_erm = false,
1953 .smart_en = true,
1954 .ext_clk_en = true,
1955 .chip_en = 1,
1956 .regulator_info = isa1200_reg_data,
1957 .num_regulators = ARRAY_SIZE(isa1200_reg_data),
1958};
1959
1960static struct i2c_board_info msm_isa1200_board_info[] __initdata = {
1961 {
1962 I2C_BOARD_INFO("isa1200_1", 0x90>>1),
1963 .platform_data = &isa1200_1_pdata,
1964 },
1965};
1966
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001967#define CYTTSP_TS_GPIO_IRQ 11
1968#define CYTTSP_TS_SLEEP_GPIO 50
1969#define CYTTSP_TS_RESOUT_N_GPIO 52
1970
1971/*virtual key support */
1972static ssize_t tma340_vkeys_show(struct kobject *kobj,
1973 struct kobj_attribute *attr, char *buf)
1974{
1975 return snprintf(buf, 200,
1976 __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":73:1120:97:97"
1977 ":" __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":230:1120:97:97"
1978 ":" __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":389:1120:97:97"
1979 ":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":544:1120:97:97"
1980 "\n");
1981}
1982
1983static struct kobj_attribute tma340_vkeys_attr = {
1984 .attr = {
1985 .mode = S_IRUGO,
1986 },
1987 .show = &tma340_vkeys_show,
1988};
1989
1990static struct attribute *tma340_properties_attrs[] = {
1991 &tma340_vkeys_attr.attr,
1992 NULL
1993};
1994
1995static struct attribute_group tma340_properties_attr_group = {
1996 .attrs = tma340_properties_attrs,
1997};
1998
1999
2000static int cyttsp_platform_init(struct i2c_client *client)
2001{
2002 int rc = 0;
2003 static struct kobject *tma340_properties_kobj;
2004
2005 tma340_vkeys_attr.attr.name = "virtualkeys.cyttsp-i2c";
2006 tma340_properties_kobj = kobject_create_and_add("board_properties",
2007 NULL);
2008 if (tma340_properties_kobj)
2009 rc = sysfs_create_group(tma340_properties_kobj,
2010 &tma340_properties_attr_group);
2011 if (!tma340_properties_kobj || rc)
2012 pr_err("%s: failed to create board_properties\n",
2013 __func__);
2014
2015 return 0;
2016}
2017
2018static struct cyttsp_regulator regulator_data[] = {
2019 {
2020 .name = "vdd",
2021 .min_uV = CY_TMA300_VTG_MIN_UV,
2022 .max_uV = CY_TMA300_VTG_MAX_UV,
Anirudh Ghayalf9929b12011-09-07 15:57:36 +05302023 .hpm_load_uA = CY_TMA300_CURR_24HZ_UA,
2024 .lpm_load_uA = CY_TMA300_SLEEP_CURR_UA,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002025 },
2026 /* TODO: Remove after runtime PM is enabled in I2C driver */
2027 {
2028 .name = "vcc_i2c",
2029 .min_uV = CY_I2C_VTG_MIN_UV,
2030 .max_uV = CY_I2C_VTG_MAX_UV,
Anirudh Ghayalf9929b12011-09-07 15:57:36 +05302031 .hpm_load_uA = CY_I2C_CURR_UA,
2032 .lpm_load_uA = CY_I2C_SLEEP_CURR_UA,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002033 },
2034};
2035
2036static struct cyttsp_platform_data cyttsp_pdata = {
2037 .panel_maxx = 634,
2038 .panel_maxy = 1166,
2039 .disp_maxx = 616,
2040 .disp_maxy = 1023,
2041 .disp_minx = 0,
2042 .disp_miny = 16,
2043 .flags = 0x01,
2044 .gen = CY_GEN3, /* or */
2045 .use_st = CY_USE_ST,
2046 .use_mt = CY_USE_MT,
2047 .use_hndshk = CY_SEND_HNDSHK,
2048 .use_trk_id = CY_USE_TRACKING_ID,
Anirudh Ghayale96f66d2011-08-11 14:06:38 +05302049 .use_sleep = CY_USE_DEEP_SLEEP_SEL | CY_USE_LOW_POWER_SEL,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002050 .use_gestures = CY_USE_GESTURES,
2051 .fw_fname = "cyttsp_8960_cdp.hex",
2052 /* activate up to 4 groups
2053 * and set active distance
2054 */
2055 .gest_set = CY_GEST_GRP1 | CY_GEST_GRP2 |
2056 CY_GEST_GRP3 | CY_GEST_GRP4 |
2057 CY_ACT_DIST,
2058 /* change act_intrvl to customize the Active power state
2059 * scanning/processing refresh interval for Operating mode
2060 */
2061 .act_intrvl = CY_ACT_INTRVL_DFLT,
2062 /* change tch_tmout to customize the touch timeout for the
2063 * Active power state for Operating mode
2064 */
2065 .tch_tmout = CY_TCH_TMOUT_DFLT,
2066 /* change lp_intrvl to customize the Low Power power state
2067 * scanning/processing refresh interval for Operating mode
2068 */
2069 .lp_intrvl = CY_LP_INTRVL_DFLT,
2070 .sleep_gpio = CYTTSP_TS_SLEEP_GPIO,
2071 .resout_gpio = CYTTSP_TS_RESOUT_N_GPIO,
2072 .irq_gpio = CYTTSP_TS_GPIO_IRQ,
2073 .regulator_info = regulator_data,
2074 .num_regulators = ARRAY_SIZE(regulator_data),
2075 .init = cyttsp_platform_init,
Mohan Pallaka49c37d62011-08-01 11:52:00 +05302076 .correct_fw_ver = 9,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002077};
2078
2079static struct i2c_board_info cyttsp_info[] __initdata = {
2080 {
2081 I2C_BOARD_INFO(CY_I2C_NAME, 0x24),
2082 .platform_data = &cyttsp_pdata,
2083#ifndef CY_USE_TIMER
2084 .irq = MSM_GPIO_TO_INT(CYTTSP_TS_GPIO_IRQ),
2085#endif /* CY_USE_TIMER */
2086 },
2087};
2088
Mohan Pallaka50837382011-09-07 11:00:57 +05302089/* configuration data */
2090static const u8 mxt_config_data[] = {
2091 /* T6 Object */
Jing Lin2f863172011-10-17 10:56:58 -07002092 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05302093 /* T38 Object */
Jing Lin93f07082011-11-11 15:53:54 -08002094 11, 2, 0, 11, 11, 11, 0, 0, 0, 0,
Jing Lin2f863172011-10-17 10:56:58 -07002095 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2096 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2097 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2098 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2099 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2100 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05302101 /* T7 Object */
Jing Lin2f863172011-10-17 10:56:58 -07002102 100, 16, 50,
Mohan Pallaka50837382011-09-07 11:00:57 +05302103 /* T8 Object */
Jing Lin93f07082011-11-11 15:53:54 -08002104 8, 0, 0, 0, 0, 0, 8, 14, 50, 215,
Mohan Pallaka50837382011-09-07 11:00:57 +05302105 /* T9 Object */
Jing Lin93f07082011-11-11 15:53:54 -08002106 131, 0, 0, 26, 42, 0, 32, 63, 3, 5,
2107 0, 2, 1, 113, 10, 10, 8, 10, 255, 2,
2108 85, 5, 0, 0, 20, 20, 75, 25, 202, 29,
2109 10, 10, 45, 46,
Mohan Pallaka50837382011-09-07 11:00:57 +05302110 /* T15 Object */
Jing Lin2f863172011-10-17 10:56:58 -07002111 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2112 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05302113 /* T22 Object */
Jing Lin93f07082011-11-11 15:53:54 -08002114 5, 0, 0, 0, 0, 0, 0, 0, 30, 0,
2115 0, 0, 5, 8, 10, 13, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05302116 /* T24 Object */
Jing Lin2f863172011-10-17 10:56:58 -07002117 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2118 0, 0, 0, 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05302119 /* T25 Object */
Jing Lin2f863172011-10-17 10:56:58 -07002120 3, 0, 188, 52, 52, 33, 0, 0, 0, 0,
2121 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05302122 /* T27 Object */
Jing Lin2f863172011-10-17 10:56:58 -07002123 0, 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05302124 /* T28 Object */
Jing Lin93f07082011-11-11 15:53:54 -08002125 0, 0, 0, 8, 12, 60,
Mohan Pallaka50837382011-09-07 11:00:57 +05302126 /* T40 Object */
Jing Lin2f863172011-10-17 10:56:58 -07002127 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05302128 /* T41 Object */
Jing Lin2f863172011-10-17 10:56:58 -07002129 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05302130 /* T43 Object */
Jing Lin2f863172011-10-17 10:56:58 -07002131 0, 0, 0, 0, 0, 0,
Mohan Pallaka50837382011-09-07 11:00:57 +05302132};
2133
2134#define MXT_TS_GPIO_IRQ 11
2135#define MXT_TS_LDO_EN_GPIO 50
2136#define MXT_TS_RESET_GPIO 52
2137
2138static void mxt_init_hw_liquid(void)
2139{
2140 int rc;
2141
2142 rc = gpio_request(MXT_TS_GPIO_IRQ, "mxt_ts_irq_gpio");
2143 if (rc) {
2144 pr_err("%s: unable to request mxt_ts_irq gpio [%d]\n",
2145 __func__, MXT_TS_GPIO_IRQ);
2146 return;
2147 }
2148
2149 rc = gpio_direction_input(MXT_TS_GPIO_IRQ);
2150 if (rc) {
2151 pr_err("%s: unable to set_direction for mxt_ts_irq gpio [%d]\n",
2152 __func__, MXT_TS_GPIO_IRQ);
2153 goto err_irq_gpio_req;
2154 }
2155
2156 rc = gpio_request(MXT_TS_LDO_EN_GPIO, "mxt_ldo_en_gpio");
2157 if (rc) {
2158 pr_err("%s: unable to request mxt_ldo_en gpio [%d]\n",
2159 __func__, MXT_TS_LDO_EN_GPIO);
2160 goto err_irq_gpio_req;
2161 }
2162
2163 rc = gpio_direction_output(MXT_TS_LDO_EN_GPIO, 1);
2164 if (rc) {
2165 pr_err("%s: unable to set_direction for mxt_ldo_en gpio [%d]\n",
2166 __func__, MXT_TS_LDO_EN_GPIO);
2167 goto err_ldo_gpio_req;
2168 }
2169
2170 rc = gpio_request(MXT_TS_RESET_GPIO, "mxt_reset_gpio");
2171 if (rc) {
2172 pr_err("%s: unable to request mxt_reset gpio [%d]\n",
2173 __func__, MXT_TS_RESET_GPIO);
2174 goto err_ldo_gpio_set_dir;
2175 }
2176
2177 rc = gpio_direction_output(MXT_TS_RESET_GPIO, 1);
2178 if (rc) {
2179 pr_err("%s: unable to set_direction for mxt_reset gpio [%d]\n",
2180 __func__, MXT_TS_RESET_GPIO);
2181 goto err_reset_gpio_req;
2182 }
2183
2184 return;
2185
2186err_reset_gpio_req:
2187 gpio_free(MXT_TS_RESET_GPIO);
2188err_ldo_gpio_set_dir:
2189 gpio_set_value(MXT_TS_LDO_EN_GPIO, 0);
2190err_ldo_gpio_req:
2191 gpio_free(MXT_TS_LDO_EN_GPIO);
2192err_irq_gpio_req:
2193 gpio_free(MXT_TS_GPIO_IRQ);
2194}
2195
2196static struct mxt_platform_data mxt_platform_data = {
2197 .config = mxt_config_data,
2198 .config_length = ARRAY_SIZE(mxt_config_data),
Jing Lin2f863172011-10-17 10:56:58 -07002199 .x_size = 1365,
2200 .y_size = 767,
Mohan Pallaka50837382011-09-07 11:00:57 +05302201 .irqflags = IRQF_TRIGGER_FALLING,
Jing Lin2f863172011-10-17 10:56:58 -07002202 .i2c_pull_up = true,
Mohan Pallaka50837382011-09-07 11:00:57 +05302203};
2204
2205static struct i2c_board_info mxt_device_info[] __initdata = {
2206 {
2207 I2C_BOARD_INFO("atmel_mxt_ts", 0x5b),
2208 .platform_data = &mxt_platform_data,
2209 .irq = MSM_GPIO_TO_INT(MXT_TS_GPIO_IRQ),
2210 },
2211};
2212
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002213static void gsbi_qup_i2c_gpio_config(int adap_id, int config_type)
2214{
2215}
2216
2217static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi4_pdata = {
2218 .clk_freq = 100000,
2219 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002220 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
2221};
2222
2223static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi3_pdata = {
2224 .clk_freq = 100000,
2225 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002226 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
2227};
2228
2229static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi10_pdata = {
2230 .clk_freq = 100000,
2231 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002232 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
2233};
2234
2235static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi12_pdata = {
2236 .clk_freq = 100000,
2237 .src_clk_rate = 24000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002238 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
2239};
2240
2241static struct msm_rpm_platform_data msm_rpm_data = {
2242 .reg_base_addrs = {
2243 [MSM_RPM_PAGE_STATUS] = MSM_RPM_BASE,
2244 [MSM_RPM_PAGE_CTRL] = MSM_RPM_BASE + 0x400,
2245 [MSM_RPM_PAGE_REQ] = MSM_RPM_BASE + 0x600,
2246 [MSM_RPM_PAGE_ACK] = MSM_RPM_BASE + 0xa00,
2247 },
2248
2249 .irq_ack = RPM_APCC_CPU0_GP_HIGH_IRQ,
2250 .irq_err = RPM_APCC_CPU0_GP_LOW_IRQ,
2251 .irq_vmpm = RPM_APCC_CPU0_GP_MEDIUM_IRQ,
2252 .msm_apps_ipc_rpm_reg = MSM_APCS_GCC_BASE + 0x008,
2253 .msm_apps_ipc_rpm_val = 4,
2254};
2255
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07002256static struct ks8851_pdata spi_eth_pdata = {
2257 .irq_gpio = KS8851_IRQ_GPIO,
2258 .rst_gpio = KS8851_RST_GPIO,
2259};
Praveen Chidambaram043f4ce2011-08-02 09:37:59 -06002260
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002261static struct spi_board_info spi_board_info[] __initdata = {
2262 {
2263 .modalias = "ks8851",
2264 .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO),
2265 .max_speed_hz = 19200000,
2266 .bus_num = 0,
2267 .chip_select = 0,
2268 .mode = SPI_MODE_0,
Stepan Moskovchenko93d79ec2011-09-21 16:52:16 -07002269 .platform_data = &spi_eth_pdata
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002270 },
Chandan Uddaraju15e54b92011-09-12 10:52:36 -07002271 {
2272 .modalias = "dsi_novatek_3d_panel_spi",
2273 .max_speed_hz = 10800000,
2274 .bus_num = 0,
2275 .chip_select = 1,
2276 .mode = SPI_MODE_0,
2277 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002278};
2279
2280static struct platform_device msm_device_saw_core0 = {
2281 .name = "saw-regulator",
2282 .id = 0,
2283 .dev = {
2284 .platform_data = &msm_saw_regulator_pdata_s5,
2285 },
2286};
2287
2288static struct platform_device msm_device_saw_core1 = {
2289 .name = "saw-regulator",
2290 .id = 1,
2291 .dev = {
2292 .platform_data = &msm_saw_regulator_pdata_s6,
2293 },
2294};
2295
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -07002296static struct tsens_platform_data msm_tsens_pdata = {
2297 .slope = 910,
2298 .tsens_factor = 1000,
2299 .hw_type = MSM_8960,
2300 .tsens_num_sensor = 5,
2301};
2302
2303static struct platform_device msm_tsens_device = {
2304 .name = "tsens8960-tm",
2305 .id = -1,
2306 .dev = {
2307 .platform_data = &msm_tsens_pdata,
2308 },
2309};
2310
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002311#ifdef CONFIG_MSM_FAKE_BATTERY
2312static struct platform_device fish_battery_device = {
2313 .name = "fish_battery",
2314};
2315#endif
2316
David Collins26f05562011-06-20 09:56:28 -07002317static struct platform_device msm8960_device_ext_5v_vreg __devinitdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002318 .name = GPIO_REGULATOR_DEV_NAME,
2319 .id = PM8921_MPP_PM_TO_SYS(7),
2320 .dev = {
2321 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V],
2322 },
2323};
2324
David Collins26f05562011-06-20 09:56:28 -07002325static struct platform_device msm8960_device_ext_l2_vreg __devinitdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002326 .name = GPIO_REGULATOR_DEV_NAME,
2327 .id = 91,
2328 .dev = {
2329 .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_L2],
2330 },
2331};
2332
David Collinsb10be1d2011-09-02 10:29:31 -07002333static struct platform_device msm8960_device_ext_3p3v_vreg __devinitdata = {
2334 .name = GPIO_REGULATOR_DEV_NAME,
2335 .id = PM8921_GPIO_PM_TO_SYS(17),
2336 .dev = {
2337 .platform_data =
2338 &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_3P3V],
2339 },
2340};
2341
David Collins26f05562011-06-20 09:56:28 -07002342static struct platform_device msm8960_device_rpm_regulator __devinitdata = {
2343 .name = "rpm-regulator",
2344 .id = -1,
2345 .dev = {
2346 .platform_data = &msm_rpm_regulator_pdata,
2347 },
2348};
2349
David Collins4c31a872011-08-31 10:07:10 -07002350static struct msm_rpm_log_platform_data msm_rpm_log_pdata = {
2351 .phys_addr_base = 0x0010C000,
2352 .reg_offsets = {
2353 [MSM_RPM_LOG_PAGE_INDICES] = 0x00000080,
2354 [MSM_RPM_LOG_PAGE_BUFFER] = 0x000000A0,
2355 },
2356 .phys_size = SZ_8K,
2357 .log_len = 4096, /* log's buffer length in bytes */
2358 .log_len_mask = (4096 >> 2) - 1, /* length mask in units of u32 */
2359};
2360
2361static struct platform_device msm_rpm_log_device = {
2362 .name = "msm_rpm_log",
2363 .id = -1,
2364 .dev = {
2365 .platform_data = &msm_rpm_log_pdata,
2366 },
2367};
2368
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002369static struct platform_device *common_devices[] __initdata = {
Stepan Moskovchenkodf13d342011-08-03 19:01:25 -07002370 &msm8960_device_dmov,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002371 &msm_device_smd,
2372 &msm8960_device_uart_gsbi5,
Mayank Rana9f51f582011-08-04 18:35:59 +05302373 &msm_device_uart_dm6,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002374 &msm_device_saw_core0,
2375 &msm_device_saw_core1,
2376 &msm8960_device_ext_5v_vreg,
2377 &msm8960_device_ext_l2_vreg,
2378 &msm8960_device_ssbi_pm8921,
2379 &msm8960_device_qup_spi_gsbi1,
2380 &msm8960_device_qup_i2c_gsbi3,
2381 &msm8960_device_qup_i2c_gsbi4,
2382 &msm8960_device_qup_i2c_gsbi10,
2383#ifndef CONFIG_MSM_DSPS
2384 &msm8960_device_qup_i2c_gsbi12,
2385#endif
2386 &msm_slim_ctrl,
2387 &msm_device_wcnss_wlan,
2388#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
2389 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
2390 &qcrypto_device,
2391#endif
2392
2393#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
2394 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
2395 &qcedev_device,
2396#endif
2397#ifdef CONFIG_MSM_ROTATOR
2398 &msm_rotator_device,
2399#endif
2400 &msm_device_sps,
2401#ifdef CONFIG_MSM_FAKE_BATTERY
2402 &fish_battery_device,
2403#endif
2404#ifdef CONFIG_ANDROID_PMEM
Laura Abbott2d1760b2011-09-29 21:31:24 -07002405#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002406 &android_pmem_device,
2407 &android_pmem_adsp_device,
Laura Abbott2d1760b2011-09-29 21:31:24 -07002408#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002409 &android_pmem_audio_device,
2410#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002411 &msm_device_vidc,
2412 &msm_device_bam_dmux,
2413 &msm_fm_platform_init,
Mona Hossain9c430e32011-07-27 11:04:47 -07002414
2415#ifdef CONFIG_HW_RANDOM_MSM
2416 &msm_device_rng,
2417#endif
Praveen Chidambaram043f4ce2011-08-02 09:37:59 -06002418 &msm_rpm_device,
Laura Abbottd6183792011-08-19 13:42:24 -07002419#ifdef CONFIG_ION_MSM
2420 &ion_dev,
2421#endif
David Collins4c31a872011-08-31 10:07:10 -07002422 &msm_rpm_log_device,
Praveen Chidambaram7a712232011-10-28 13:39:45 -06002423 &msm_rpm_stat_device,
Mona Hossain11c03ac2011-10-26 12:42:10 -07002424 &msm_device_tz_log,
2425
Pratik Patel7831c082011-06-08 21:44:37 -07002426#ifdef CONFIG_MSM_QDSS
2427 &msm_etb_device,
2428 &msm_tpiu_device,
2429 &msm_funnel_device,
Pratik Patelfd6f56a2011-10-10 17:47:55 -07002430 &msm_debug_device,
Pratik Patel7831c082011-06-08 21:44:37 -07002431 &msm_ptm_device,
2432#endif
Swaminathan Sathappanb77c65e92011-09-30 18:36:09 -07002433 &msm_device_dspcrashd_8960,
Jeff Ohlstein7e668552011-10-06 16:17:25 -07002434 &msm8960_device_watchdog,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002435};
2436
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002437static struct platform_device *sim_devices[] __initdata = {
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07002438 &msm8960_device_otg,
2439 &msm8960_device_gadget_peripheral,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002440 &msm_device_hsusb_host,
Vijayavardhan Vennapusaeb566482011-09-18 07:48:37 +05302441 &msm_device_hsic_host,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002442 &android_usb_device,
2443 &msm_device_vidc,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002444 &msm_bus_apps_fabric,
2445 &msm_bus_sys_fabric,
2446 &msm_bus_mm_fabric,
2447 &msm_bus_sys_fpb,
2448 &msm_bus_cpss_fpb,
2449 &msm_pcm,
2450 &msm_pcm_routing,
2451 &msm_cpudai0,
2452 &msm_cpudai1,
2453 &msm_cpudai_hdmi_rx,
2454 &msm_cpudai_bt_rx,
2455 &msm_cpudai_bt_tx,
2456 &msm_cpudai_fm_rx,
2457 &msm_cpudai_fm_tx,
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -07002458 &msm_cpudai_auxpcm_rx,
2459 &msm_cpudai_auxpcm_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002460 &msm_cpu_fe,
2461 &msm_stub_codec,
2462 &msm_voice,
2463 &msm_voip,
2464 &msm_lpa_pcm,
2465
2466#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
2467 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
2468 &qcrypto_device,
2469#endif
2470
2471#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
2472 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
2473 &qcedev_device,
2474#endif
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002475};
2476
2477static struct platform_device *rumi3_devices[] __initdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002478 &msm_kgsl_3d0,
2479 &msm_kgsl_2d0,
2480 &msm_kgsl_2d1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002481#ifdef CONFIG_MSM_GEMINI
2482 &msm8960_gemini_device,
2483#endif
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002484};
2485
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002486static struct platform_device *cdp_devices[] __initdata = {
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07002487 &msm8960_device_otg,
2488 &msm8960_device_gadget_peripheral,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002489 &msm_device_hsusb_host,
2490 &android_usb_device,
2491 &msm_pcm,
2492 &msm_pcm_routing,
2493 &msm_cpudai0,
2494 &msm_cpudai1,
2495 &msm_cpudai_hdmi_rx,
2496 &msm_cpudai_bt_rx,
2497 &msm_cpudai_bt_tx,
2498 &msm_cpudai_fm_rx,
2499 &msm_cpudai_fm_tx,
Bhalchandra Gajare0e795c42011-08-15 18:10:30 -07002500 &msm_cpudai_auxpcm_rx,
2501 &msm_cpudai_auxpcm_tx,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002502 &msm_cpu_fe,
2503 &msm_stub_codec,
2504 &msm_kgsl_3d0,
2505#ifdef CONFIG_MSM_KGSL_2D
2506 &msm_kgsl_2d0,
2507 &msm_kgsl_2d1,
2508#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002509#ifdef CONFIG_MSM_GEMINI
2510 &msm8960_gemini_device,
2511#endif
2512 &msm_voice,
2513 &msm_voip,
2514 &msm_lpa_pcm,
Laxminath Kasamcee1d602011-08-01 19:26:57 +05302515 &msm_cpudai_afe_01_rx,
2516 &msm_cpudai_afe_01_tx,
2517 &msm_cpudai_afe_02_rx,
2518 &msm_cpudai_afe_02_tx,
2519 &msm_pcm_afe,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002520 &msm_pcm_hostless,
2521 &msm_bus_apps_fabric,
2522 &msm_bus_sys_fabric,
2523 &msm_bus_mm_fabric,
2524 &msm_bus_sys_fpb,
2525 &msm_bus_cpss_fpb,
Siddartha Mohanadossba21fdd2011-08-18 10:05:27 -07002526 &msm_tsens_device,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002527};
2528
2529static void __init msm8960_i2c_init(void)
2530{
2531 msm8960_device_qup_i2c_gsbi4.dev.platform_data =
2532 &msm8960_i2c_qup_gsbi4_pdata;
2533
2534 msm8960_device_qup_i2c_gsbi3.dev.platform_data =
2535 &msm8960_i2c_qup_gsbi3_pdata;
2536
2537 msm8960_device_qup_i2c_gsbi10.dev.platform_data =
2538 &msm8960_i2c_qup_gsbi10_pdata;
2539
2540 msm8960_device_qup_i2c_gsbi12.dev.platform_data =
2541 &msm8960_i2c_qup_gsbi12_pdata;
2542}
2543
Lucille Sylvester34ec3692011-08-16 16:28:04 -06002544static void __init msm8960_gfx_init(void)
2545{
Jeremy Gebben58b2dce2011-10-13 11:14:19 -06002546 uint32_t soc_platform_version = socinfo_get_version();
Lucille Sylvester34ec3692011-08-16 16:28:04 -06002547 if (SOCINFO_VERSION_MAJOR(soc_platform_version) == 1) {
2548 struct kgsl_device_platform_data *kgsl_3d0_pdata =
2549 msm_kgsl_3d0.dev.platform_data;
Lucille Sylvesterdce84cd2011-10-12 14:15:37 -06002550 kgsl_3d0_pdata->pwrlevel[0].gpu_freq = 320000000;
2551 kgsl_3d0_pdata->pwrlevel[1].gpu_freq = 266667000;
Lucille Sylvester34ec3692011-08-16 16:28:04 -06002552 }
2553}
2554
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002555static struct msm_cpuidle_state msm_cstates[] __initdata = {
2556 {0, 0, "C0", "WFI",
2557 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
2558
2559 {0, 1, "C1", "STANDALONE_POWER_COLLAPSE",
2560 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
2561
2562 {0, 2, "C2", "POWER_COLLAPSE",
2563 MSM_PM_SLEEP_MODE_POWER_COLLAPSE},
2564
2565 {1, 0, "C0", "WFI",
2566 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
2567
2568 {1, 1, "C1", "STANDALONE_POWER_COLLAPSE",
2569 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
2570};
2571
2572static struct msm_pm_platform_data msm_pm_data[MSM_PM_SLEEP_MODE_NR * 2] = {
2573 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
2574 .idle_supported = 1,
2575 .suspend_supported = 1,
2576 .idle_enabled = 0,
2577 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002578 },
2579
2580 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
2581 .idle_supported = 1,
2582 .suspend_supported = 1,
2583 .idle_enabled = 0,
2584 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002585 },
2586
2587 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
2588 .idle_supported = 1,
2589 .suspend_supported = 1,
2590 .idle_enabled = 1,
2591 .suspend_enabled = 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002592 },
2593
2594 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
2595 .idle_supported = 0,
2596 .suspend_supported = 1,
2597 .idle_enabled = 0,
2598 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002599 },
2600
2601 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
2602 .idle_supported = 1,
2603 .suspend_supported = 1,
2604 .idle_enabled = 0,
2605 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002606 },
2607
2608 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
2609 .idle_supported = 1,
2610 .suspend_supported = 0,
2611 .idle_enabled = 1,
2612 .suspend_enabled = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002613 },
2614};
2615
2616static struct msm_rpmrs_level msm_rpmrs_levels[] __initdata = {
2617 {
2618 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
2619 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
2620 true,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06002621 100, 8000, 100000, 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002622 },
2623
2624 {
2625 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
2626 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
2627 true,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06002628 2000, 6000, 60100000, 3000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002629 },
2630
2631 {
2632 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2633 MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE),
2634 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06002635 4200, 5000, 60350000, 3500,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002636 },
2637
2638 {
2639 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2640 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, MAX, ACTIVE),
2641 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06002642 6300, 4500, 65350000, 4800,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002643 },
Maheshkumar Sivasubramanian7df12362011-11-02 08:25:49 -06002644 {
2645 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2646 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, ACTIVE, RET_HIGH),
2647 false,
2648 7000, 3500, 66600000, 5150,
2649 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002650
2651 {
2652 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2653 MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE),
2654 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06002655 11700, 2500, 67850000, 5500,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002656 },
2657
2658 {
2659 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2660 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
2661 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06002662 13800, 2000, 71850000, 6800,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002663 },
2664
2665 {
2666 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2667 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH),
2668 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06002669 29700, 500, 75850000, 8800,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002670 },
2671
2672 {
2673 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2674 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
2675 false,
Maheshkumar Sivasubramanianef101a02011-09-19 16:34:30 -06002676 29700, 0, 76350000, 9800,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002677 },
2678};
2679
2680#ifdef CONFIG_I2C
2681#define I2C_SURF 1
2682#define I2C_FFA (1 << 1)
2683#define I2C_RUMI (1 << 2)
2684#define I2C_SIM (1 << 3)
2685#define I2C_FLUID (1 << 4)
Amir Samuelov05f87802011-08-27 18:30:12 +03002686#define I2C_LIQUID (1 << 5)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002687
2688struct i2c_registry {
2689 u8 machs;
2690 int bus;
2691 struct i2c_board_info *info;
2692 int len;
2693};
2694
2695#ifdef CONFIG_MSM_CAMERA
2696static struct i2c_board_info msm_camera_boardinfo[] __initdata = {
2697#ifdef CONFIG_IMX074
2698 {
2699 I2C_BOARD_INFO("imx074", 0x1A),
2700 },
2701#endif
2702#ifdef CONFIG_OV2720
2703 {
2704 I2C_BOARD_INFO("ov2720", 0x6C),
2705 },
2706#endif
Nishant Pandit474f2252011-07-23 23:17:56 +05302707#ifdef CONFIG_MSM_CAMERA_FLASH_SC628A
2708 {
2709 I2C_BOARD_INFO("sc628a", 0x6E),
2710 },
2711#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002712};
2713#endif
2714
2715/* Sensors DSPS platform data */
2716#ifdef CONFIG_MSM_DSPS
2717#define DSPS_PIL_GENERIC_NAME "dsps"
2718#endif /* CONFIG_MSM_DSPS */
2719
2720static void __init msm8960_init_dsps(void)
2721{
2722#ifdef CONFIG_MSM_DSPS
2723 struct msm_dsps_platform_data *pdata =
2724 msm_dsps_device.dev.platform_data;
2725 pdata->pil_name = DSPS_PIL_GENERIC_NAME;
2726 pdata->gpios = NULL;
2727 pdata->gpios_num = 0;
2728
2729 platform_device_register(&msm_dsps_device);
2730#endif /* CONFIG_MSM_DSPS */
2731}
2732
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07002733static void __init msm8960_init_hsic(void)
2734{
2735#ifdef CONFIG_USB_EHCI_MSM_HSIC
2736 uint32_t version = socinfo_get_version();
2737
2738 pr_info("%s: version:%d mtp:%d\n", __func__,
2739 SOCINFO_VERSION_MAJOR(version),
2740 machine_is_msm8960_mtp());
2741
2742 if ((SOCINFO_VERSION_MAJOR(version) == 1) ||
2743 machine_is_msm8960_mtp() ||
2744 machine_is_msm8960_fluid())
2745 return;
2746
2747 msm_gpiomux_install(msm8960_hsic_configs,
2748 ARRAY_SIZE(msm8960_hsic_configs));
2749
2750 platform_device_register(&msm_device_hsic_host);
2751#endif
2752}
2753
2754
Amir Samuelov5137e392011-09-21 17:31:25 +03002755#ifdef CONFIG_ISL9519_CHARGER
2756static struct isl_platform_data isl_data __initdata = {
2757 .valid_n_gpio = 0, /* Not required when notify-by-pmic */
2758 .chg_detection_config = NULL, /* Not required when notify-by-pmic */
2759 .max_system_voltage = 4200,
2760 .min_system_voltage = 3200,
2761 .chgcurrent = 1000, /* 1900, */
2762 .term_current = 400, /* Need fine tuning */
2763 .input_current = 2048,
2764};
2765
2766static struct i2c_board_info isl_charger_i2c_info[] __initdata = {
2767 {
2768 I2C_BOARD_INFO("isl9519q", 0x9),
2769 .irq = 0, /* Not required when notify-by-pmic */
2770 .platform_data = &isl_data,
2771 },
2772};
2773#endif /* CONFIG_ISL9519_CHARGER */
2774
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002775static struct i2c_registry msm8960_i2c_devices[] __initdata = {
2776#ifdef CONFIG_MSM_CAMERA
2777 {
Amir Samuelov05f87802011-08-27 18:30:12 +03002778 I2C_SURF | I2C_FFA | I2C_FLUID | I2C_LIQUID | I2C_RUMI,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002779 MSM_8960_GSBI4_QUP_I2C_BUS_ID,
2780 msm_camera_boardinfo,
2781 ARRAY_SIZE(msm_camera_boardinfo),
2782 },
2783#endif
Amir Samuelov5137e392011-09-21 17:31:25 +03002784#ifdef CONFIG_ISL9519_CHARGER
2785 {
2786 I2C_LIQUID,
2787 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
2788 isl_charger_i2c_info,
2789 ARRAY_SIZE(isl_charger_i2c_info),
2790 },
2791#endif /* CONFIG_ISL9519_CHARGER */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002792 {
2793 I2C_SURF | I2C_FFA | I2C_FLUID,
2794 MSM_8960_GSBI3_QUP_I2C_BUS_ID,
2795 cyttsp_info,
2796 ARRAY_SIZE(cyttsp_info),
Rohit Vaswanicd2a59b2011-07-19 12:00:48 -07002797 },
Mohan Pallaka50837382011-09-07 11:00:57 +05302798 {
2799 I2C_LIQUID,
2800 MSM_8960_GSBI3_QUP_I2C_BUS_ID,
2801 mxt_device_info,
2802 ARRAY_SIZE(mxt_device_info),
2803 },
Mohan Pallaka5e490392011-09-09 15:18:41 +05302804 {
2805 I2C_LIQUID,
2806 MSM_8960_GSBI10_QUP_I2C_BUS_ID,
2807 msm_isa1200_board_info,
2808 ARRAY_SIZE(msm_isa1200_board_info),
2809 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002810};
2811#endif /* CONFIG_I2C */
2812
2813static void __init register_i2c_devices(void)
2814{
2815#ifdef CONFIG_I2C
2816 u8 mach_mask = 0;
2817 int i;
2818
2819 /* Build the matching 'supported_machs' bitmask */
2820 if (machine_is_msm8960_cdp())
2821 mach_mask = I2C_SURF;
2822 else if (machine_is_msm8960_rumi3())
2823 mach_mask = I2C_RUMI;
2824 else if (machine_is_msm8960_sim())
2825 mach_mask = I2C_SIM;
Amy Maloche2d028032011-07-20 14:08:06 -07002826 else if (machine_is_msm8960_fluid())
2827 mach_mask = I2C_FLUID;
Amir Samuelov05f87802011-08-27 18:30:12 +03002828 else if (machine_is_msm8960_liquid())
2829 mach_mask = I2C_LIQUID;
Amy Maloche1b0663f2011-08-02 16:46:22 -07002830 else if (machine_is_msm8960_mtp())
2831 mach_mask = I2C_FFA;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002832 else
2833 pr_err("unmatched machine ID in register_i2c_devices\n");
2834
2835 /* Run the array and install devices as appropriate */
2836 for (i = 0; i < ARRAY_SIZE(msm8960_i2c_devices); ++i) {
2837 if (msm8960_i2c_devices[i].machs & mach_mask)
2838 i2c_register_board_info(msm8960_i2c_devices[i].bus,
2839 msm8960_i2c_devices[i].info,
2840 msm8960_i2c_devices[i].len);
2841 }
2842#endif
2843}
2844
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002845static void __init msm8960_sim_init(void)
2846{
Jeff Ohlstein7e668552011-10-06 16:17:25 -07002847 struct msm_watchdog_pdata *wdog_pdata = (struct msm_watchdog_pdata *)
2848 &msm8960_device_watchdog.dev.platform_data;
2849
2850 wdog_pdata->bark_time = 15000;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002851 BUG_ON(msm_rpm_init(&msm_rpm_data));
2852 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
2853 ARRAY_SIZE(msm_rpmrs_levels)));
2854 regulator_suppress_info_printing();
David Collins26f05562011-06-20 09:56:28 -07002855 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07002856 msm_clock_init(&msm8960_clock_init_data);
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08002857 msm8960_init_pmic();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002858
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07002859 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002860 gpiomux_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002861 msm8960_i2c_init();
2862 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
2863 msm_spm_l2_init(msm_spm_l2_data);
2864 msm8960_init_buses();
2865 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08002866 msm8960_pm8921_gpio_mpp_init();
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002867 platform_add_devices(sim_devices, ARRAY_SIZE(sim_devices));
Matt Wagantallec57f062011-08-16 23:54:46 -07002868 acpuclk_init(&acpuclk_8960_soc_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002869
2870 msm8960_device_qup_spi_gsbi1.dev.platform_data =
2871 &msm8960_qup_spi_gsbi1_pdata;
2872 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
2873
2874 msm8960_init_mmc();
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -08002875 msm8960_init_fb();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002876 slim_register_board_info(msm_slim_devices,
2877 ARRAY_SIZE(msm_slim_devices));
2878 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
2879 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
2880 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
2881 msm_pm_data);
Maheshkumar Sivasubramanian8ccc16e2011-10-25 15:59:57 -06002882 BUG_ON(msm_pm_boot_init(MSM_PM_BOOT_CONFIG_TZ, NULL));
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002883}
2884
2885static void __init msm8960_rumi3_init(void)
2886{
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002887 BUG_ON(msm_rpm_init(&msm_rpm_data));
2888 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
2889 ARRAY_SIZE(msm_rpmrs_levels)));
2890 regulator_suppress_info_printing();
David Collins26f05562011-06-20 09:56:28 -07002891 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07002892 msm_clock_init(&msm8960_dummy_clock_init_data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002893 gpiomux_init();
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08002894 msm8960_init_pmic();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002895 msm8960_device_qup_spi_gsbi1.dev.platform_data =
2896 &msm8960_qup_spi_gsbi1_pdata;
2897 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
2898 msm8960_i2c_init();
2899 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
2900 msm_spm_l2_init(msm_spm_l2_data);
2901 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08002902 msm8960_pm8921_gpio_mpp_init();
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002903 platform_add_devices(rumi3_devices, ARRAY_SIZE(rumi3_devices));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002904 msm8960_init_mmc();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002905 register_i2c_devices();
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -08002906 msm8960_init_fb();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002907 slim_register_board_info(msm_slim_devices,
2908 ARRAY_SIZE(msm_slim_devices));
2909 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
2910 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
2911 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
2912 msm_pm_data);
Maheshkumar Sivasubramanian8ccc16e2011-10-25 15:59:57 -06002913 BUG_ON(msm_pm_boot_init(MSM_PM_BOOT_CONFIG_TZ, NULL));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002914}
2915
2916static void __init msm8960_cdp_init(void)
2917{
Naveen Ramaraj76483ad2011-09-06 14:25:44 -07002918 if (meminfo_init(SYS_MEMORY, SZ_256M) < 0)
2919 pr_err("meminfo_init() failed!\n");
2920
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002921 BUG_ON(msm_rpm_init(&msm_rpm_data));
2922 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
2923 ARRAY_SIZE(msm_rpmrs_levels)));
Abhijeet Dharmapurikar6d565fd2011-09-15 18:49:56 -07002924
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002925 regulator_suppress_info_printing();
2926 if (msm_xo_init())
2927 pr_err("Failed to initialize XO votes\n");
David Collins26f05562011-06-20 09:56:28 -07002928 platform_device_register(&msm8960_device_rpm_regulator);
Stephen Boydbb600ae2011-08-02 20:11:40 -07002929 msm_clock_init(&msm8960_clock_init_data);
Vijayavardhan Vennapusafc464f02011-11-04 21:54:00 +05302930 if (machine_is_msm8960_liquid())
2931 msm_otg_pdata.mhl_enable = true;
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07002932 msm8960_device_otg.dev.platform_data = &msm_otg_pdata;
Vijayavardhan Vennapusa2b592824f2011-11-02 19:51:32 +05302933#ifdef CONFIG_USB_EHCI_MSM_HSIC
2934 if (machine_is_msm8960_liquid()) {
2935 if (SOCINFO_VERSION_MAJOR(socinfo_get_version()) >= 2)
2936 msm_hsic_pdata.hub_reset = HSIC_HUB_RESET_GPIO;
2937 }
2938#endif
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +05302939 msm_device_hsic_host.dev.platform_data = &msm_hsic_pdata;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002940 gpiomux_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002941 msm8960_device_qup_spi_gsbi1.dev.platform_data =
2942 &msm8960_qup_spi_gsbi1_pdata;
2943 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08002944
2945 msm8960_init_pmic();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002946 msm8960_i2c_init();
Lucille Sylvester34ec3692011-08-16 16:28:04 -06002947 msm8960_gfx_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002948 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
2949 msm_spm_l2_init(msm_spm_l2_data);
2950 msm8960_init_buses();
2951 platform_add_devices(msm_footswitch_devices,
2952 msm_num_footswitch_devices);
David Collinsb10be1d2011-09-02 10:29:31 -07002953 if (machine_is_msm8960_liquid())
2954 platform_device_register(&msm8960_device_ext_3p3v_vreg);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002955 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Stepan Moskovchenkoef1e0b62011-12-01 12:10:16 -08002956 msm8960_pm8921_gpio_mpp_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002957 platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices));
Vamsi Krishna98f54fb2011-11-02 14:55:41 -07002958 msm8960_init_hsic();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002959 msm8960_init_cam();
2960 msm8960_init_mmc();
Matt Wagantallec57f062011-08-16 23:54:46 -07002961 acpuclk_init(&acpuclk_8960_soc_data);
Mohan Pallaka50837382011-09-07 11:00:57 +05302962 if (machine_is_msm8960_liquid())
2963 mxt_init_hw_liquid();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002964 register_i2c_devices();
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -08002965 msm8960_init_fb();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002966 slim_register_board_info(msm_slim_devices,
2967 ARRAY_SIZE(msm_slim_devices));
2968 msm8960_init_dsps();
2969 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
2970 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
2971 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
2972 msm_pm_data);
Larry Bassela7eadea2011-07-14 10:46:00 -07002973 change_memory_power = &msm8960_change_memory_power;
Maheshkumar Sivasubramanian8ccc16e2011-10-25 15:59:57 -06002974 BUG_ON(msm_pm_boot_init(MSM_PM_BOOT_CONFIG_TZ, NULL));
Joel Kingb8352a12011-11-15 18:46:24 -08002975
2976 if (PLATFORM_IS_CHARM25())
2977 platform_add_devices(mdm_devices, ARRAY_SIZE(mdm_devices));
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002978}
2979
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002980MACHINE_START(MSM8960_SIM, "QCT MSM8960 SIMULATOR")
2981 .map_io = msm8960_map_io,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002982 .reserve = msm8960_reserve,
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002983 .init_irq = msm8960_init_irq,
2984 .timer = &msm_timer,
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002985 .init_machine = msm8960_sim_init,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002986 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07002987 .init_very_early = msm8960_early_memory,
Stepan Moskovchenkof441ca22010-12-01 19:31:16 -08002988MACHINE_END
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08002989
2990MACHINE_START(MSM8960_RUMI3, "QCT MSM8960 RUMI3")
2991 .map_io = msm8960_map_io,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002992 .reserve = msm8960_reserve,
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08002993 .init_irq = msm8960_init_irq,
2994 .timer = &msm_timer,
Stepan Moskovchenkod056fca2011-01-27 12:12:07 -08002995 .init_machine = msm8960_rumi3_init,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002996 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07002997 .init_very_early = msm8960_early_memory,
Stepan Moskovchenko50ede4e2010-12-13 18:12:19 -08002998MACHINE_END
2999
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003000MACHINE_START(MSM8960_CDP, "QCT MSM8960 CDP")
3001 .map_io = msm8960_map_io,
3002 .reserve = msm8960_reserve,
3003 .init_irq = msm8960_init_irq,
3004 .timer = &msm_timer,
3005 .init_machine = msm8960_cdp_init,
3006 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07003007 .init_very_early = msm8960_early_memory,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003008MACHINE_END
3009
3010MACHINE_START(MSM8960_MTP, "QCT MSM8960 MTP")
3011 .map_io = msm8960_map_io,
3012 .reserve = msm8960_reserve,
3013 .init_irq = msm8960_init_irq,
3014 .timer = &msm_timer,
3015 .init_machine = msm8960_cdp_init,
3016 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07003017 .init_very_early = msm8960_early_memory,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003018MACHINE_END
3019
3020MACHINE_START(MSM8960_FLUID, "QCT MSM8960 FLUID")
3021 .map_io = msm8960_map_io,
3022 .reserve = msm8960_reserve,
3023 .init_irq = msm8960_init_irq,
3024 .timer = &msm_timer,
3025 .init_machine = msm8960_cdp_init,
3026 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07003027 .init_very_early = msm8960_early_memory,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003028MACHINE_END
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03003029
3030MACHINE_START(MSM8960_LIQUID, "QCT MSM8960 LIQUID")
3031 .map_io = msm8960_map_io,
3032 .reserve = msm8960_reserve,
3033 .init_irq = msm8960_init_irq,
3034 .timer = &msm_timer,
3035 .init_machine = msm8960_cdp_init,
3036 .init_early = msm8960_allocate_memory_regions,
Larry Basselb830e182011-10-14 10:46:55 -07003037 .init_very_early = msm8960_early_memory,
Amir Samuelov0d1f8ae2011-07-28 11:13:58 +03003038MACHINE_END
Stepan Moskovchenkof4fdfe52011-10-18 17:28:58 -07003039
3040#ifdef CONFIG_ARCH_MSM8930
3041MACHINE_START(MSM8930_CDP, "QCT MSM8930 CDP")
3042 .map_io = msm8930_map_io,
3043 .reserve = msm8960_reserve,
3044 .init_irq = msm8960_init_irq,
3045 .timer = &msm_timer,
3046 .init_machine = msm8960_cdp_init,
3047 .init_early = msm8960_allocate_memory_regions,
Stepan Moskovchenko0ae2e722011-11-01 13:24:41 -07003048 .init_very_early = msm8960_early_memory,
Stepan Moskovchenkof4fdfe52011-10-18 17:28:58 -07003049MACHINE_END
3050
3051MACHINE_START(MSM8930_MTP, "QCT MSM8930 MTP")
3052 .map_io = msm8930_map_io,
3053 .reserve = msm8960_reserve,
3054 .init_irq = msm8960_init_irq,
3055 .timer = &msm_timer,
3056 .init_machine = msm8960_cdp_init,
3057 .init_early = msm8960_allocate_memory_regions,
Stepan Moskovchenko0ae2e722011-11-01 13:24:41 -07003058 .init_very_early = msm8960_early_memory,
Stepan Moskovchenkof4fdfe52011-10-18 17:28:58 -07003059MACHINE_END
3060
3061MACHINE_START(MSM8930_FLUID, "QCT MSM8930 FLUID")
3062 .map_io = msm8930_map_io,
3063 .reserve = msm8960_reserve,
3064 .init_irq = msm8960_init_irq,
3065 .timer = &msm_timer,
3066 .init_machine = msm8960_cdp_init,
3067 .init_early = msm8960_allocate_memory_regions,
Stepan Moskovchenko0ae2e722011-11-01 13:24:41 -07003068 .init_very_early = msm8960_early_memory,
Stepan Moskovchenkof4fdfe52011-10-18 17:28:58 -07003069MACHINE_END
3070#endif