blob: 7563300b5878489bfc07f861857dc2cc2354e36a [file] [log] [blame]
Sravan Kumar Ambapuramb22cf4d2012-01-02 21:45:04 +05301/* Copyright (c) 2011-2012, Code Aurora Forum. All rights reserved.
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002 *
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 */
12#include <linux/kernel.h>
13#include <linux/init.h>
14#include <linux/gpio_event.h>
Taniya Das2b16d1d2011-12-02 14:44:19 +053015#include <linux/memblock.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070016#include <asm/mach-types.h>
Murali Nalajala41786ab2012-03-06 10:47:32 +053017#include <linux/memblock.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070018#include <asm/mach/arch.h>
Taniya Das43bcdd62011-12-02 17:33:27 +053019#include <asm/hardware/gic.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070020#include <mach/board.h>
21#include <mach/msm_iomap.h>
22#include <mach/msm_hsusb.h>
23#include <mach/rpc_hsusb.h>
24#include <mach/rpc_pmapp.h>
25#include <mach/usbdiag.h>
26#include <mach/msm_memtypes.h>
27#include <mach/msm_serial_hs.h>
28#include <linux/usb/android.h>
29#include <linux/platform_device.h>
30#include <linux/io.h>
31#include <linux/gpio.h>
32#include <mach/vreg.h>
33#include <mach/pmic.h>
34#include <mach/socinfo.h>
35#include <linux/mtd/nand.h>
36#include <linux/mtd/partitions.h>
37#include <asm/mach/mmc.h>
38#include <linux/i2c.h>
39#include <linux/i2c/sx150x.h>
40#include <linux/gpio.h>
41#include <linux/android_pmem.h>
42#include <linux/bootmem.h>
43#include <linux/mfd/marimba.h>
44#include <mach/vreg.h>
45#include <linux/power_supply.h>
Justin Paupored98328e2011-08-19 13:48:31 -070046#include <linux/regulator/consumer.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070047#include <mach/rpc_pmapp.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070048#include <mach/msm_battery.h>
49#include <linux/smsc911x.h>
50#include <linux/atmel_maxtouch.h>
Laura Abbott8f3d58b2011-12-18 10:47:03 -080051#include <linux/fmem.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070052#include "devices.h"
53#include "timer.h"
Justin Pauporeb3a33b72011-08-23 15:30:32 -070054#include "board-msm7x27a-regulator.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070055#include "devices-msm7x2xa.h"
Matt Wagantall7cca4642012-02-01 16:43:24 -080056#include "pm.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070057#include <mach/rpc_server_handset.h>
58#include <mach/socinfo.h>
Maheshkumar Sivasubramanian8ccc16e2011-10-25 15:59:57 -060059#include "pm-boot.h"
Chintan Pandyacf467fc2011-12-01 17:11:11 +053060#include "board-msm7627a.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070061
62#define PMEM_KERNEL_EBI1_SIZE 0x3A000
63#define MSM_PMEM_AUDIO_SIZE 0x5B000
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070064
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070065#if defined(CONFIG_GPIO_SX150X)
66enum {
67 SX150X_CORE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070068};
69
70static struct sx150x_platform_data sx150x_data[] __initdata = {
71 [SX150X_CORE] = {
72 .gpio_base = GPIO_CORE_EXPANDER_BASE,
73 .oscio_is_gpo = false,
74 .io_pullup_ena = 0,
pankaj kumarc5c01392011-08-12 13:44:05 +053075 .io_pulldn_ena = 0x02,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070076 .io_open_drain_ena = 0xfef8,
77 .irq_summary = -1,
78 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070079};
80#endif
81
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070082
Santosh Sajjan6822c682011-07-26 10:49:36 +053083static struct platform_device msm_wlan_ar6000_pm_device = {
84 .name = "wlan_ar6000_pm_dev",
85 .id = -1,
86};
87
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070088#if defined(CONFIG_I2C) && defined(CONFIG_GPIO_SX150X)
89static struct i2c_board_info core_exp_i2c_info[] __initdata = {
90 {
91 I2C_BOARD_INFO("sx1509q", 0x3e),
92 },
93};
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070094
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070095static void __init register_i2c_devices(void)
96{
Taniya Dase3027e22012-02-27 16:32:27 +053097 if (machine_is_msm7x27a_surf() || machine_is_msm7625a_surf() ||
98 machine_is_msm8625_surf())
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070099 sx150x_data[SX150X_CORE].io_open_drain_ena = 0xe0f0;
100
101 core_exp_i2c_info[0].platform_data =
102 &sx150x_data[SX150X_CORE];
103
104 i2c_register_board_info(MSM_GSBI1_QUP_I2C_BUS_ID,
105 core_exp_i2c_info,
106 ARRAY_SIZE(core_exp_i2c_info));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700107}
108#endif
109
110static struct msm_gpio qup_i2c_gpios_io[] = {
111 { GPIO_CFG(60, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
112 "qup_scl" },
113 { GPIO_CFG(61, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
114 "qup_sda" },
115 { GPIO_CFG(131, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
116 "qup_scl" },
117 { GPIO_CFG(132, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
118 "qup_sda" },
119};
120
121static struct msm_gpio qup_i2c_gpios_hw[] = {
122 { GPIO_CFG(60, 1, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
123 "qup_scl" },
124 { GPIO_CFG(61, 1, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
125 "qup_sda" },
126 { GPIO_CFG(131, 2, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
127 "qup_scl" },
128 { GPIO_CFG(132, 2, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
129 "qup_sda" },
130};
131
132static void gsbi_qup_i2c_gpio_config(int adap_id, int config_type)
133{
134 int rc;
135
136 if (adap_id < 0 || adap_id > 1)
137 return;
138
139 /* Each adapter gets 2 lines from the table */
140 if (config_type)
141 rc = msm_gpios_request_enable(&qup_i2c_gpios_hw[adap_id*2], 2);
142 else
143 rc = msm_gpios_request_enable(&qup_i2c_gpios_io[adap_id*2], 2);
144 if (rc < 0)
145 pr_err("QUP GPIO request/enable failed: %d\n", rc);
146}
147
148static struct msm_i2c_platform_data msm_gsbi0_qup_i2c_pdata = {
149 .clk_freq = 100000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700150 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
151};
152
153static struct msm_i2c_platform_data msm_gsbi1_qup_i2c_pdata = {
154 .clk_freq = 100000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700155 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
156};
157
158#ifdef CONFIG_ARCH_MSM7X27A
Neti Ravi Kumar061726e2011-12-08 15:14:57 +0530159#define MSM_PMEM_MDP_SIZE 0x2300000
160#define MSM7x25A_MSM_PMEM_MDP_SIZE 0x1500000
Jeevan Shriramf40764e2011-10-31 23:28:26 +0530161
Mahesh Lankaa2f6df12012-01-05 16:54:40 +0530162#define MSM_PMEM_ADSP_SIZE 0x1100000
Jeevan Shriramf40764e2011-10-31 23:28:26 +0530163#define MSM7x25A_MSM_PMEM_ADSP_SIZE 0xB91000
164
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700165#endif
166
167static struct android_usb_platform_data android_usb_pdata = {
168 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
169};
170
171static struct platform_device android_usb_device = {
172 .name = "android_usb",
173 .id = -1,
174 .dev = {
175 .platform_data = &android_usb_pdata,
176 },
177};
178
179#ifdef CONFIG_USB_EHCI_MSM_72K
180static void msm_hsusb_vbus_power(unsigned phy_info, int on)
181{
182 int rc = 0;
183 unsigned gpio;
184
185 gpio = GPIO_HOST_VBUS_EN;
186
187 rc = gpio_request(gpio, "i2c_host_vbus_en");
188 if (rc < 0) {
189 pr_err("failed to request %d GPIO\n", gpio);
190 return;
191 }
192 gpio_direction_output(gpio, !!on);
193 gpio_set_value_cansleep(gpio, !!on);
194 gpio_free(gpio);
195}
196
197static struct msm_usb_host_platform_data msm_usb_host_pdata = {
198 .phy_info = (USB_PHY_INTEGRATED | USB_PHY_MODEL_45NM),
199};
200
201static void __init msm7x2x_init_host(void)
202{
203 msm_add_host(0, &msm_usb_host_pdata);
204}
205#endif
206
207#ifdef CONFIG_USB_MSM_OTG_72K
208static int hsusb_rpc_connect(int connect)
209{
210 if (connect)
211 return msm_hsusb_rpc_connect();
212 else
213 return msm_hsusb_rpc_close();
214}
215
Justin Paupored98328e2011-08-19 13:48:31 -0700216static struct regulator *reg_hsusb;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700217static int msm_hsusb_ldo_init(int init)
218{
Justin Paupored98328e2011-08-19 13:48:31 -0700219 int rc = 0;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700220
Justin Paupored98328e2011-08-19 13:48:31 -0700221 if (init) {
222 reg_hsusb = regulator_get(NULL, "usb");
223 if (IS_ERR(reg_hsusb)) {
224 rc = PTR_ERR(reg_hsusb);
225 pr_err("%s: could not get regulator: %d\n",
226 __func__, rc);
227 goto out;
228 }
229
230 rc = regulator_set_voltage(reg_hsusb, 3300000, 3300000);
231 if (rc) {
232 pr_err("%s: could not set voltage: %d\n",
233 __func__, rc);
234 goto reg_free;
235 }
236
237 return 0;
238 }
239 /* else fall through */
240reg_free:
241 regulator_put(reg_hsusb);
242out:
243 reg_hsusb = NULL;
244 return rc;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700245}
246
247static int msm_hsusb_ldo_enable(int enable)
248{
249 static int ldo_status;
250
Justin Paupored98328e2011-08-19 13:48:31 -0700251 if (IS_ERR_OR_NULL(reg_hsusb))
252 return reg_hsusb ? PTR_ERR(reg_hsusb) : -ENODEV;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700253
254 if (ldo_status == enable)
255 return 0;
256
257 ldo_status = enable;
258
Justin Paupored98328e2011-08-19 13:48:31 -0700259 return enable ?
260 regulator_enable(reg_hsusb) :
261 regulator_disable(reg_hsusb);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700262}
263
264#ifndef CONFIG_USB_EHCI_MSM_72K
265static int msm_hsusb_pmic_notif_init(void (*callback)(int online), int init)
266{
267 int ret = 0;
268
269 if (init)
270 ret = msm_pm_app_rpc_init(callback);
271 else
272 msm_pm_app_rpc_deinit(callback);
273
274 return ret;
275}
276#endif
277
278static struct msm_otg_platform_data msm_otg_pdata = {
279#ifndef CONFIG_USB_EHCI_MSM_72K
280 .pmic_vbus_notif_init = msm_hsusb_pmic_notif_init,
281#else
282 .vbus_power = msm_hsusb_vbus_power,
283#endif
284 .rpc_connect = hsusb_rpc_connect,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700285 .pemp_level = PRE_EMPHASIS_WITH_20_PERCENT,
286 .cdr_autoreset = CDR_AUTO_RESET_DISABLE,
287 .drv_ampl = HS_DRV_AMPLITUDE_DEFAULT,
288 .se1_gating = SE1_GATING_DISABLE,
289 .ldo_init = msm_hsusb_ldo_init,
290 .ldo_enable = msm_hsusb_ldo_enable,
291 .chg_init = hsusb_chg_init,
292 .chg_connected = hsusb_chg_connected,
293 .chg_vbus_draw = hsusb_chg_vbus_draw,
294};
295#endif
296
297static struct msm_hsusb_gadget_platform_data msm_gadget_pdata = {
298 .is_phy_status_timer_on = 1,
299};
300
301static struct resource smc91x_resources[] = {
302 [0] = {
303 .start = 0x90000300,
304 .end = 0x900003ff,
305 .flags = IORESOURCE_MEM,
306 },
307 [1] = {
308 .start = MSM_GPIO_TO_INT(4),
309 .end = MSM_GPIO_TO_INT(4),
310 .flags = IORESOURCE_IRQ,
311 },
312};
313
314static struct platform_device smc91x_device = {
315 .name = "smc91x",
316 .id = 0,
317 .num_resources = ARRAY_SIZE(smc91x_resources),
318 .resource = smc91x_resources,
319};
320
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700321#ifdef CONFIG_SERIAL_MSM_HS
322static struct msm_serial_hs_platform_data msm_uart_dm1_pdata = {
323 .inject_rx_on_wakeup = 1,
324 .rx_to_inject = 0xFD,
325};
326#endif
327static struct msm_pm_platform_data msm7x27a_pm_data[MSM_PM_SLEEP_MODE_NR] = {
Murali Nalajalab10363d2012-01-12 16:29:01 +0530328 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700329 .idle_supported = 1,
330 .suspend_supported = 1,
331 .idle_enabled = 1,
332 .suspend_enabled = 1,
333 .latency = 16000,
334 .residency = 20000,
335 },
Murali Nalajalab10363d2012-01-12 16:29:01 +0530336 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_NO_XO_SHUTDOWN)] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700337 .idle_supported = 1,
338 .suspend_supported = 1,
339 .idle_enabled = 1,
340 .suspend_enabled = 1,
341 .latency = 12000,
342 .residency = 20000,
343 },
Murali Nalajalab10363d2012-01-12 16:29:01 +0530344 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_RAMP_DOWN_AND_WAIT_FOR_INTERRUPT)] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700345 .idle_supported = 1,
346 .suspend_supported = 1,
347 .idle_enabled = 0,
348 .suspend_enabled = 1,
349 .latency = 2000,
350 .residency = 0,
351 },
Murali Nalajalab10363d2012-01-12 16:29:01 +0530352 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700353 .idle_supported = 1,
354 .suspend_supported = 1,
355 .idle_enabled = 1,
356 .suspend_enabled = 1,
357 .latency = 2,
358 .residency = 0,
359 },
360};
361
Sujit Reddy Thummaca0c1062012-02-24 14:47:05 +0530362u32 msm7627a_power_collapse_latency(enum msm_pm_sleep_mode mode)
363{
364 switch (mode) {
365 case MSM_PM_SLEEP_MODE_POWER_COLLAPSE:
366 return msm7x27a_pm_data
367 [MSM_PM_SLEEP_MODE_POWER_COLLAPSE].latency;
368 case MSM_PM_SLEEP_MODE_POWER_COLLAPSE_NO_XO_SHUTDOWN:
369 return msm7x27a_pm_data
370 [MSM_PM_SLEEP_MODE_POWER_COLLAPSE_NO_XO_SHUTDOWN].latency;
371 case MSM_PM_SLEEP_MODE_RAMP_DOWN_AND_WAIT_FOR_INTERRUPT:
372 return msm7x27a_pm_data
373 [MSM_PM_SLEEP_MODE_RAMP_DOWN_AND_WAIT_FOR_INTERRUPT].latency;
374 case MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT:
375 return msm7x27a_pm_data
376 [MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT].latency;
377 default:
378 return 0;
379 }
380}
381
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -0600382static struct msm_pm_boot_platform_data msm_pm_boot_pdata __initdata = {
Sravan Kumar Ambapuramb22cf4d2012-01-02 21:45:04 +0530383 .mode = MSM_PM_BOOT_CONFIG_RESET_VECTOR_PHYS,
384 .p_addr = 0,
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -0600385};
386
Murali Nalajalad1f67b02012-02-10 00:23:49 +0530387/* 8625 PM platform data */
388static struct msm_pm_platform_data msm8625_pm_data[MSM_PM_SLEEP_MODE_NR * 2] = {
389 /* CORE0 entries */
390 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
391 .idle_supported = 1,
392 .suspend_supported = 1,
393 .idle_enabled = 0,
394 .suspend_enabled = 0,
395 .latency = 16000,
396 .residency = 20000,
397 },
398
399 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_NO_XO_SHUTDOWN)] = {
400 .idle_supported = 1,
401 .suspend_supported = 1,
402 .idle_enabled = 0,
403 .suspend_enabled = 0,
404 .latency = 12000,
405 .residency = 20000,
406 },
407
408 /* picked latency & redisdency values from 7x30 */
409 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
410 .idle_supported = 1,
411 .suspend_supported = 1,
412 .idle_enabled = 0,
413 .suspend_enabled = 0,
414 .latency = 500,
415 .residency = 6000,
416 },
417
418 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
419 .idle_supported = 1,
420 .suspend_supported = 1,
421 .idle_enabled = 1,
422 .suspend_enabled = 1,
423 .latency = 2,
424 .residency = 10,
425 },
426
427 /* picked latency & redisdency values from 7x30 */
428 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
429 .idle_supported = 1,
430 .suspend_supported = 1,
431 .idle_enabled = 0,
432 .suspend_enabled = 0,
433 .latency = 500,
434 .residency = 6000,
435 },
436
437 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
438 .idle_supported = 1,
439 .suspend_supported = 1,
440 .idle_enabled = 1,
441 .suspend_enabled = 1,
442 .latency = 2,
443 .residency = 10,
444 },
445
446};
447
Murali Nalajala41786ab2012-03-06 10:47:32 +0530448static struct msm_pm_boot_platform_data msm_pm_8625_boot_pdata __initdata = {
449 .mode = MSM_PM_BOOT_CONFIG_REMAP_BOOT_ADDR,
450 .v_addr = MSM_CFG_CTL_BASE,
451};
452
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700453static struct android_pmem_platform_data android_pmem_adsp_pdata = {
454 .name = "pmem_adsp",
455 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
Mahesh Lankac6af7eb2011-08-02 18:00:35 +0530456 .cached = 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700457 .memory_type = MEMTYPE_EBI1,
Laura Abbott8f3d58b2011-12-18 10:47:03 -0800458 .request_region = request_fmem_c_region,
459 .release_region = release_fmem_c_region,
460 .reusable = 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700461};
462
463static struct platform_device android_pmem_adsp_device = {
464 .name = "android_pmem",
465 .id = 1,
466 .dev = { .platform_data = &android_pmem_adsp_pdata },
467};
468
469static unsigned pmem_mdp_size = MSM_PMEM_MDP_SIZE;
470static int __init pmem_mdp_size_setup(char *p)
471{
472 pmem_mdp_size = memparse(p, NULL);
473 return 0;
474}
475
476early_param("pmem_mdp_size", pmem_mdp_size_setup);
477
478static unsigned pmem_adsp_size = MSM_PMEM_ADSP_SIZE;
479static int __init pmem_adsp_size_setup(char *p)
480{
481 pmem_adsp_size = memparse(p, NULL);
482 return 0;
483}
484
485early_param("pmem_adsp_size", pmem_adsp_size_setup);
486
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700487#define SND(desc, num) { .name = #desc, .id = num }
488static struct snd_endpoint snd_endpoints_list[] = {
489 SND(HANDSET, 0),
490 SND(MONO_HEADSET, 2),
491 SND(HEADSET, 3),
492 SND(SPEAKER, 6),
493 SND(TTY_HEADSET, 8),
494 SND(TTY_VCO, 9),
495 SND(TTY_HCO, 10),
496 SND(BT, 12),
497 SND(IN_S_SADC_OUT_HANDSET, 16),
498 SND(IN_S_SADC_OUT_SPEAKER_PHONE, 25),
499 SND(FM_DIGITAL_STEREO_HEADSET, 26),
500 SND(FM_DIGITAL_SPEAKER_PHONE, 27),
501 SND(FM_DIGITAL_BT_A2DP_HEADSET, 28),
Shashi Kumar64e07602011-10-11 13:18:57 +0530502 SND(STEREO_HEADSET_AND_SPEAKER, 31),
Sidipotu Ashokab34ca42011-07-22 16:34:20 +0530503 SND(CURRENT, 0x7FFFFFFE),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700504 SND(FM_ANALOG_STEREO_HEADSET, 35),
505 SND(FM_ANALOG_STEREO_HEADSET_CODEC, 36),
506};
507#undef SND
508
509static struct msm_snd_endpoints msm_device_snd_endpoints = {
510 .endpoints = snd_endpoints_list,
511 .num = sizeof(snd_endpoints_list) / sizeof(struct snd_endpoint)
512};
513
514static struct platform_device msm_device_snd = {
515 .name = "msm_snd",
516 .id = -1,
517 .dev = {
518 .platform_data = &msm_device_snd_endpoints
519 },
520};
521
522#define DEC0_FORMAT ((1<<MSM_ADSP_CODEC_MP3)| \
523 (1<<MSM_ADSP_CODEC_AAC)|(1<<MSM_ADSP_CODEC_WMA)| \
524 (1<<MSM_ADSP_CODEC_WMAPRO)|(1<<MSM_ADSP_CODEC_AMRWB)| \
525 (1<<MSM_ADSP_CODEC_AMRNB)|(1<<MSM_ADSP_CODEC_WAV)| \
526 (1<<MSM_ADSP_CODEC_ADPCM)|(1<<MSM_ADSP_CODEC_YADPCM)| \
527 (1<<MSM_ADSP_CODEC_EVRC)|(1<<MSM_ADSP_CODEC_QCELP))
528#define DEC1_FORMAT ((1<<MSM_ADSP_CODEC_MP3)| \
529 (1<<MSM_ADSP_CODEC_AAC)|(1<<MSM_ADSP_CODEC_WMA)| \
530 (1<<MSM_ADSP_CODEC_WMAPRO)|(1<<MSM_ADSP_CODEC_AMRWB)| \
531 (1<<MSM_ADSP_CODEC_AMRNB)|(1<<MSM_ADSP_CODEC_WAV)| \
532 (1<<MSM_ADSP_CODEC_ADPCM)|(1<<MSM_ADSP_CODEC_YADPCM)| \
533 (1<<MSM_ADSP_CODEC_EVRC)|(1<<MSM_ADSP_CODEC_QCELP))
534#define DEC2_FORMAT ((1<<MSM_ADSP_CODEC_MP3)| \
535 (1<<MSM_ADSP_CODEC_AAC)|(1<<MSM_ADSP_CODEC_WMA)| \
536 (1<<MSM_ADSP_CODEC_WMAPRO)|(1<<MSM_ADSP_CODEC_AMRWB)| \
537 (1<<MSM_ADSP_CODEC_AMRNB)|(1<<MSM_ADSP_CODEC_WAV)| \
538 (1<<MSM_ADSP_CODEC_ADPCM)|(1<<MSM_ADSP_CODEC_YADPCM)| \
539 (1<<MSM_ADSP_CODEC_EVRC)|(1<<MSM_ADSP_CODEC_QCELP))
540#define DEC3_FORMAT ((1<<MSM_ADSP_CODEC_MP3)| \
541 (1<<MSM_ADSP_CODEC_AAC)|(1<<MSM_ADSP_CODEC_WMA)| \
542 (1<<MSM_ADSP_CODEC_WMAPRO)|(1<<MSM_ADSP_CODEC_AMRWB)| \
543 (1<<MSM_ADSP_CODEC_AMRNB)|(1<<MSM_ADSP_CODEC_WAV)| \
544 (1<<MSM_ADSP_CODEC_ADPCM)|(1<<MSM_ADSP_CODEC_YADPCM)| \
545 (1<<MSM_ADSP_CODEC_EVRC)|(1<<MSM_ADSP_CODEC_QCELP))
546#define DEC4_FORMAT (1<<MSM_ADSP_CODEC_MIDI)
547
548static unsigned int dec_concurrency_table[] = {
549 /* Audio LP */
550 (DEC0_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DMA)), 0,
551 0, 0, 0,
552
553 /* Concurrency 1 */
554 (DEC0_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
555 (DEC1_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
556 (DEC2_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
557 (DEC3_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
558 (DEC4_FORMAT),
559
560 /* Concurrency 2 */
561 (DEC0_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
562 (DEC1_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
563 (DEC2_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
564 (DEC3_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
565 (DEC4_FORMAT),
566
567 /* Concurrency 3 */
568 (DEC0_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
569 (DEC1_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
570 (DEC2_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
571 (DEC3_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
572 (DEC4_FORMAT),
573
574 /* Concurrency 4 */
575 (DEC0_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
576 (DEC1_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
577 (DEC2_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
578 (DEC3_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
579 (DEC4_FORMAT),
580
581 /* Concurrency 5 */
582 (DEC0_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
583 (DEC1_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
584 (DEC2_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
585 (DEC3_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
586 (DEC4_FORMAT),
587
588 /* Concurrency 6 */
589 (DEC0_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
Sidipotu Ashok0a690212012-02-21 17:18:53 +0530590 (DEC1_FORMAT|(1<<MSM_ADSP_MODE_TUNNEL)|(1<<MSM_ADSP_OP_DM)),
591 0, 0, 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700592
593 /* Concurrency 7 */
594 (DEC0_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
595 (DEC1_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
596 (DEC2_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
597 (DEC3_FORMAT|(1<<MSM_ADSP_MODE_NONTUNNEL)|(1<<MSM_ADSP_OP_DM)),
598 (DEC4_FORMAT),
599};
600
601#define DEC_INFO(name, queueid, decid, nr_codec) { .module_name = name, \
602 .module_queueid = queueid, .module_decid = decid, \
603 .nr_codec_support = nr_codec}
604
605static struct msm_adspdec_info dec_info_list[] = {
606 DEC_INFO("AUDPLAY0TASK", 13, 0, 11), /* AudPlay0BitStreamCtrlQueue */
607 DEC_INFO("AUDPLAY1TASK", 14, 1, 11), /* AudPlay1BitStreamCtrlQueue */
608 DEC_INFO("AUDPLAY2TASK", 15, 2, 11), /* AudPlay2BitStreamCtrlQueue */
609 DEC_INFO("AUDPLAY3TASK", 16, 3, 11), /* AudPlay3BitStreamCtrlQueue */
610 DEC_INFO("AUDPLAY4TASK", 17, 4, 1), /* AudPlay4BitStreamCtrlQueue */
611};
612
613static struct msm_adspdec_database msm_device_adspdec_database = {
614 .num_dec = ARRAY_SIZE(dec_info_list),
615 .num_concurrency_support = (ARRAY_SIZE(dec_concurrency_table) / \
616 ARRAY_SIZE(dec_info_list)),
617 .dec_concurrency_table = dec_concurrency_table,
618 .dec_info_list = dec_info_list,
619};
620
621static struct platform_device msm_device_adspdec = {
622 .name = "msm_adspdec",
623 .id = -1,
624 .dev = {
625 .platform_data = &msm_device_adspdec_database
626 },
627};
628
629static struct android_pmem_platform_data android_pmem_audio_pdata = {
630 .name = "pmem_audio",
631 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
632 .cached = 0,
633 .memory_type = MEMTYPE_EBI1,
634};
635
636static struct platform_device android_pmem_audio_device = {
637 .name = "android_pmem",
638 .id = 2,
639 .dev = { .platform_data = &android_pmem_audio_pdata },
640};
641
642static struct android_pmem_platform_data android_pmem_pdata = {
643 .name = "pmem",
644 .allocator_type = PMEM_ALLOCATORTYPE_BITMAP,
645 .cached = 1,
646 .memory_type = MEMTYPE_EBI1,
647};
648static struct platform_device android_pmem_device = {
649 .name = "android_pmem",
650 .id = 0,
651 .dev = { .platform_data = &android_pmem_pdata },
652};
653
654static u32 msm_calculate_batt_capacity(u32 current_voltage);
655
656static struct msm_psy_batt_pdata msm_psy_batt_data = {
657 .voltage_min_design = 2800,
658 .voltage_max_design = 4300,
659 .avail_chg_sources = AC_CHG | USB_CHG ,
660 .batt_technology = POWER_SUPPLY_TECHNOLOGY_LION,
661 .calculate_capacity = &msm_calculate_batt_capacity,
662};
663
664static u32 msm_calculate_batt_capacity(u32 current_voltage)
665{
666 u32 low_voltage = msm_psy_batt_data.voltage_min_design;
667 u32 high_voltage = msm_psy_batt_data.voltage_max_design;
668
669 return (current_voltage - low_voltage) * 100
670 / (high_voltage - low_voltage);
671}
672
673static struct platform_device msm_batt_device = {
674 .name = "msm-battery",
675 .id = -1,
676 .dev.platform_data = &msm_psy_batt_data,
677};
678
679static struct smsc911x_platform_config smsc911x_config = {
680 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_HIGH,
681 .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL,
682 .flags = SMSC911X_USE_16BIT,
683};
684
685static struct resource smsc911x_resources[] = {
686 [0] = {
687 .start = 0x90000000,
688 .end = 0x90007fff,
689 .flags = IORESOURCE_MEM,
690 },
691 [1] = {
692 .start = MSM_GPIO_TO_INT(48),
693 .end = MSM_GPIO_TO_INT(48),
694 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
695 },
696};
697
698static struct platform_device smsc911x_device = {
699 .name = "smsc911x",
700 .id = 0,
701 .num_resources = ARRAY_SIZE(smsc911x_resources),
702 .resource = smsc911x_resources,
703 .dev = {
704 .platform_data = &smsc911x_config,
705 },
706};
707
708static struct msm_gpio smsc911x_gpios[] = {
709 { GPIO_CFG(48, 0, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_6MA),
710 "smsc911x_irq" },
711 { GPIO_CFG(49, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_6MA),
712 "eth_fifo_sel" },
713};
714
715#define ETH_FIFO_SEL_GPIO 49
716static void msm7x27a_cfg_smsc911x(void)
717{
718 int res;
719
720 res = msm_gpios_request_enable(smsc911x_gpios,
721 ARRAY_SIZE(smsc911x_gpios));
722 if (res) {
723 pr_err("%s: unable to enable gpios for SMSC911x\n", __func__);
724 return;
725 }
726
727 /* ETH_FIFO_SEL */
728 res = gpio_direction_output(ETH_FIFO_SEL_GPIO, 0);
729 if (res) {
730 pr_err("%s: unable to get direction for gpio %d\n", __func__,
731 ETH_FIFO_SEL_GPIO);
732 msm_gpios_disable_free(smsc911x_gpios,
733 ARRAY_SIZE(smsc911x_gpios));
734 return;
735 }
736 gpio_set_value(ETH_FIFO_SEL_GPIO, 0);
737}
738
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700739#if defined(CONFIG_SERIAL_MSM_HSL_CONSOLE) \
740 && defined(CONFIG_MSM_SHARED_GPIO_FOR_UART2DM)
741static struct msm_gpio uart2dm_gpios[] = {
742 {GPIO_CFG(19, 2, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA),
743 "uart2dm_rfr_n" },
744 {GPIO_CFG(20, 2, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA),
745 "uart2dm_cts_n" },
746 {GPIO_CFG(21, 2, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA),
747 "uart2dm_rx" },
748 {GPIO_CFG(108, 2, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA),
749 "uart2dm_tx" },
750};
751
752static void msm7x27a_cfg_uart2dm_serial(void)
753{
754 int ret;
755 ret = msm_gpios_request_enable(uart2dm_gpios,
756 ARRAY_SIZE(uart2dm_gpios));
757 if (ret)
758 pr_err("%s: unable to enable gpios for uart2dm\n", __func__);
759}
760#else
761static void msm7x27a_cfg_uart2dm_serial(void) { }
762#endif
763
Laura Abbott8f3d58b2011-12-18 10:47:03 -0800764struct fmem_platform_data fmem_pdata;
765
766struct platform_device fmem_device = {
767 .name = "fmem",
768 .id = -1,
769 .dev = { .platform_data = &fmem_pdata },
770};
771
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700772static struct platform_device *rumi_sim_devices[] __initdata = {
773 &msm_device_dmov,
774 &msm_device_smd,
775 &smc91x_device,
776 &msm_device_uart1,
777 &msm_device_nand,
778 &msm_device_uart_dm1,
779 &msm_gsbi0_qup_i2c_device,
780 &msm_gsbi1_qup_i2c_device,
781};
782
Taniya Das43bcdd62011-12-02 17:33:27 +0530783static struct platform_device *msm8625_rumi3_devices[] __initdata = {
784 &msm8625_device_dmov,
Angshuman Sarkarfb1cce92012-02-21 15:20:43 +0530785 &msm8625_device_smd,
Taniya Das43bcdd62011-12-02 17:33:27 +0530786 &msm8625_device_uart1,
Taniya Dase3027e22012-02-27 16:32:27 +0530787 &msm8625_gsbi0_qup_i2c_device,
Taniya Das43bcdd62011-12-02 17:33:27 +0530788};
789
Taniya Dase3027e22012-02-27 16:32:27 +0530790static struct platform_device *msm7627a_surf_ffa_devices[] __initdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700791 &msm_device_dmov,
792 &msm_device_smd,
793 &msm_device_uart1,
794 &msm_device_uart_dm1,
795 &msm_device_uart_dm2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700796 &msm_gsbi0_qup_i2c_device,
797 &msm_gsbi1_qup_i2c_device,
798 &msm_device_otg,
799 &msm_device_gadget_peripheral,
Taniya Dase3027e22012-02-27 16:32:27 +0530800 &smsc911x_device,
801 &msm_kgsl_3d0,
802};
803
804static struct platform_device *common_devices[] __initdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700805 &android_usb_device,
806 &android_pmem_device,
807 &android_pmem_adsp_device,
808 &android_pmem_audio_device,
Taniya Dase3027e22012-02-27 16:32:27 +0530809 &fmem_device,
810 &msm_device_nand,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700811 &msm_device_snd,
812 &msm_device_adspdec,
Manish Dewangan3a260992011-06-24 18:01:34 +0530813 &asoc_msm_pcm,
814 &asoc_msm_dai0,
815 &asoc_msm_dai1,
Taniya Dase3027e22012-02-27 16:32:27 +0530816 &msm_batt_device,
817};
818
819static struct platform_device *msm8625_surf_devices[] __initdata = {
820 &msm8625_device_dmov,
821 &msm8625_device_uart1,
822 &msm8625_device_uart_dm1,
823 &msm8625_device_uart_dm2,
824 &msm8625_gsbi0_qup_i2c_device,
825 &msm8625_gsbi1_qup_i2c_device,
Taniya Dasf2665302012-02-28 16:54:54 +0530826 &msm8625_device_smd,
Taniya Dase3027e22012-02-27 16:32:27 +0530827 &msm8625_device_otg,
828 &msm8625_device_gadget_peripheral,
Ranjhith Kalisamy4ec2e102012-03-06 12:27:50 +0530829 &msm8625_kgsl_3d0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700830};
831
832static unsigned pmem_kernel_ebi1_size = PMEM_KERNEL_EBI1_SIZE;
833static int __init pmem_kernel_ebi1_size_setup(char *p)
834{
835 pmem_kernel_ebi1_size = memparse(p, NULL);
836 return 0;
837}
838early_param("pmem_kernel_ebi1_size", pmem_kernel_ebi1_size_setup);
839
840static unsigned pmem_audio_size = MSM_PMEM_AUDIO_SIZE;
841static int __init pmem_audio_size_setup(char *p)
842{
843 pmem_audio_size = memparse(p, NULL);
844 return 0;
845}
846early_param("pmem_audio_size", pmem_audio_size_setup);
847
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700848static struct memtype_reserve msm7x27a_reserve_table[] __initdata = {
849 [MEMTYPE_SMI] = {
850 },
851 [MEMTYPE_EBI0] = {
852 .flags = MEMTYPE_FLAGS_1M_ALIGN,
853 },
854 [MEMTYPE_EBI1] = {
855 .flags = MEMTYPE_FLAGS_1M_ALIGN,
856 },
857};
858
Laura Abbott8f3d58b2011-12-18 10:47:03 -0800859#ifdef CONFIG_ANDROID_PMEM
860static struct android_pmem_platform_data *pmem_pdata_array[] __initdata = {
861 &android_pmem_adsp_pdata,
862 &android_pmem_audio_pdata,
863 &android_pmem_pdata,
864};
865#endif
866
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700867static void __init size_pmem_devices(void)
868{
Laura Abbott8f3d58b2011-12-18 10:47:03 -0800869#ifdef CONFIG_ANDROID_PMEM
870 unsigned int i;
871 unsigned int reusable_count = 0;
Jeevan Shriramf40764e2011-10-31 23:28:26 +0530872
873 if (machine_is_msm7625a_surf() || machine_is_msm7625a_ffa()) {
874 pmem_mdp_size = MSM7x25A_MSM_PMEM_MDP_SIZE;
875 pmem_adsp_size = MSM7x25A_MSM_PMEM_ADSP_SIZE;
876 } else {
877 pmem_mdp_size = MSM_PMEM_MDP_SIZE;
878 pmem_adsp_size = MSM_PMEM_ADSP_SIZE;
879 }
880
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700881 android_pmem_adsp_pdata.size = pmem_adsp_size;
882 android_pmem_pdata.size = pmem_mdp_size;
883 android_pmem_audio_pdata.size = pmem_audio_size;
Laura Abbott8f3d58b2011-12-18 10:47:03 -0800884
885 fmem_pdata.size = 0;
886
887 /* Find pmem devices that should use FMEM (reusable) memory.
888 */
889 for (i = 0; i < ARRAY_SIZE(pmem_pdata_array); ++i) {
890 struct android_pmem_platform_data *pdata = pmem_pdata_array[i];
891
892 if (!reusable_count && pdata->reusable)
893 fmem_pdata.size += pdata->size;
894
895 reusable_count += (pdata->reusable) ? 1 : 0;
896
897 if (pdata->reusable && reusable_count > 1) {
898 pr_err("%s: Too many PMEM devices specified as reusable. PMEM device %s was not configured as reusable.\n",
899 __func__, pdata->name);
900 pdata->reusable = 0;
901 }
902 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700903#endif
Laura Abbott8f3d58b2011-12-18 10:47:03 -0800904
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700905}
906
907static void __init reserve_memory_for(struct android_pmem_platform_data *p)
908{
909 msm7x27a_reserve_table[p->memory_type].size += p->size;
910}
911
912static void __init reserve_pmem_memory(void)
913{
914#ifdef CONFIG_ANDROID_PMEM
Laura Abbott8f3d58b2011-12-18 10:47:03 -0800915 unsigned int i;
916 for (i = 0; i < ARRAY_SIZE(pmem_pdata_array); ++i) {
917 if (!pmem_pdata_array[i]->reusable)
918 reserve_memory_for(pmem_pdata_array[i]);
919 }
920
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700921 msm7x27a_reserve_table[MEMTYPE_EBI1].size += pmem_kernel_ebi1_size;
922#endif
923}
924
925static void __init msm7x27a_calculate_reserve_sizes(void)
926{
927 size_pmem_devices();
928 reserve_pmem_memory();
929}
930
931static int msm7x27a_paddr_to_memtype(unsigned int paddr)
932{
933 return MEMTYPE_EBI1;
934}
935
936static struct reserve_info msm7x27a_reserve_info __initdata = {
937 .memtype_reserve_table = msm7x27a_reserve_table,
938 .calculate_reserve_sizes = msm7x27a_calculate_reserve_sizes,
939 .paddr_to_memtype = msm7x27a_paddr_to_memtype,
940};
941
942static void __init msm7x27a_reserve(void)
943{
944 reserve_info = &msm7x27a_reserve_info;
945 msm_reserve();
Laura Abbott8f3d58b2011-12-18 10:47:03 -0800946 fmem_pdata.phys = reserve_memory_for_fmem(fmem_pdata.size);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700947}
948
Taniya Das2b16d1d2011-12-02 14:44:19 +0530949static void __init msm8625_reserve(void)
950{
Taniya Dase3027e22012-02-27 16:32:27 +0530951 msm7x27a_reserve();
Taniya Dasfe04d4f2012-03-14 11:13:21 +0530952 memblock_remove(MSM8625_SECONDARY_PHYS, SZ_8);
Murali Nalajalafeedeae2012-03-28 16:15:32 +0530953 memblock_remove(MSM8625_WARM_BOOT_PHYS, SZ_32);
Taniya Das2b16d1d2011-12-02 14:44:19 +0530954}
955
Taniya Dase3027e22012-02-27 16:32:27 +0530956static void __init msm7x27a_device_i2c_init(void)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700957{
958 msm_gsbi0_qup_i2c_device.dev.platform_data = &msm_gsbi0_qup_i2c_pdata;
959 msm_gsbi1_qup_i2c_device.dev.platform_data = &msm_gsbi1_qup_i2c_pdata;
960}
961
Taniya Dase3027e22012-02-27 16:32:27 +0530962static void __init msm8625_device_i2c_init(void)
963{
964 msm8625_gsbi0_qup_i2c_device.dev.platform_data =
965 &msm_gsbi0_qup_i2c_pdata;
966 msm8625_gsbi1_qup_i2c_device.dev.platform_data =
967 &msm_gsbi1_qup_i2c_pdata;
968}
969
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700970#define MSM_EBI2_PHYS 0xa0d00000
971#define MSM_EBI2_XMEM_CS2_CFG1 0xa0d10030
972
973static void __init msm7x27a_init_ebi2(void)
974{
975 uint32_t ebi2_cfg;
976 void __iomem *ebi2_cfg_ptr;
977
978 ebi2_cfg_ptr = ioremap_nocache(MSM_EBI2_PHYS, sizeof(uint32_t));
979 if (!ebi2_cfg_ptr)
980 return;
981
982 ebi2_cfg = readl(ebi2_cfg_ptr);
Trilok Soni3d0f6c52011-07-26 16:06:58 +0530983 if (machine_is_msm7x27a_rumi3() || machine_is_msm7x27a_surf() ||
Taniya Dase3027e22012-02-27 16:32:27 +0530984 machine_is_msm7625a_surf() || machine_is_msm8625_surf())
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700985 ebi2_cfg |= (1 << 4); /* CS2 */
986
987 writel(ebi2_cfg, ebi2_cfg_ptr);
988 iounmap(ebi2_cfg_ptr);
989
990 /* Enable A/D MUX[bit 31] from EBI2_XMEM_CS2_CFG1 */
991 ebi2_cfg_ptr = ioremap_nocache(MSM_EBI2_XMEM_CS2_CFG1,
992 sizeof(uint32_t));
993 if (!ebi2_cfg_ptr)
994 return;
995
996 ebi2_cfg = readl(ebi2_cfg_ptr);
Trilok Soni3d0f6c52011-07-26 16:06:58 +0530997 if (machine_is_msm7x27a_surf() || machine_is_msm7625a_surf())
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700998 ebi2_cfg |= (1 << 31);
999
1000 writel(ebi2_cfg, ebi2_cfg_ptr);
1001 iounmap(ebi2_cfg_ptr);
1002}
1003
1004#define ATMEL_TS_I2C_NAME "maXTouch"
Justin Paupored98328e2011-08-19 13:48:31 -07001005
1006static struct regulator_bulk_data regs_atmel[] = {
1007 { .supply = "ldo2", .min_uV = 2850000, .max_uV = 2850000 },
1008 { .supply = "smps3", .min_uV = 1800000, .max_uV = 1800000 },
1009};
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001010
1011#define ATMEL_TS_GPIO_IRQ 82
1012
1013static int atmel_ts_power_on(bool on)
1014{
Justin Paupored98328e2011-08-19 13:48:31 -07001015 int rc = on ?
1016 regulator_bulk_enable(ARRAY_SIZE(regs_atmel), regs_atmel) :
1017 regulator_bulk_disable(ARRAY_SIZE(regs_atmel), regs_atmel);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001018
Justin Paupored98328e2011-08-19 13:48:31 -07001019 if (rc)
1020 pr_err("%s: could not %sable regulators: %d\n",
1021 __func__, on ? "en" : "dis", rc);
1022 else
1023 msleep(50);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001024
Justin Paupored98328e2011-08-19 13:48:31 -07001025 return rc;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001026}
1027
1028static int atmel_ts_platform_init(struct i2c_client *client)
1029{
1030 int rc;
Justin Paupored98328e2011-08-19 13:48:31 -07001031 struct device *dev = &client->dev;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001032
Justin Paupored98328e2011-08-19 13:48:31 -07001033 rc = regulator_bulk_get(dev, ARRAY_SIZE(regs_atmel), regs_atmel);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001034 if (rc) {
Justin Paupored98328e2011-08-19 13:48:31 -07001035 dev_err(dev, "%s: could not get regulators: %d\n",
1036 __func__, rc);
1037 goto out;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001038 }
1039
Justin Paupored98328e2011-08-19 13:48:31 -07001040 rc = regulator_bulk_set_voltage(ARRAY_SIZE(regs_atmel), regs_atmel);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001041 if (rc) {
Justin Paupored98328e2011-08-19 13:48:31 -07001042 dev_err(dev, "%s: could not set voltages: %d\n",
1043 __func__, rc);
1044 goto reg_free;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001045 }
1046
1047 rc = gpio_tlmm_config(GPIO_CFG(ATMEL_TS_GPIO_IRQ, 0,
1048 GPIO_CFG_INPUT, GPIO_CFG_PULL_UP,
1049 GPIO_CFG_8MA), GPIO_CFG_ENABLE);
1050 if (rc) {
Justin Paupored98328e2011-08-19 13:48:31 -07001051 dev_err(dev, "%s: gpio_tlmm_config for %d failed\n",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001052 __func__, ATMEL_TS_GPIO_IRQ);
Justin Paupored98328e2011-08-19 13:48:31 -07001053 goto reg_free;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001054 }
1055
1056 /* configure touchscreen interrupt gpio */
1057 rc = gpio_request(ATMEL_TS_GPIO_IRQ, "atmel_maxtouch_gpio");
1058 if (rc) {
Justin Paupored98328e2011-08-19 13:48:31 -07001059 dev_err(dev, "%s: unable to request gpio %d\n",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001060 __func__, ATMEL_TS_GPIO_IRQ);
1061 goto ts_gpio_tlmm_unconfig;
1062 }
1063
1064 rc = gpio_direction_input(ATMEL_TS_GPIO_IRQ);
1065 if (rc < 0) {
Justin Paupored98328e2011-08-19 13:48:31 -07001066 dev_err(dev, "%s: unable to set the direction of gpio %d\n",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001067 __func__, ATMEL_TS_GPIO_IRQ);
1068 goto free_ts_gpio;
1069 }
1070 return 0;
1071
1072free_ts_gpio:
1073 gpio_free(ATMEL_TS_GPIO_IRQ);
1074ts_gpio_tlmm_unconfig:
1075 gpio_tlmm_config(GPIO_CFG(ATMEL_TS_GPIO_IRQ, 0,
1076 GPIO_CFG_INPUT, GPIO_CFG_NO_PULL,
1077 GPIO_CFG_2MA), GPIO_CFG_DISABLE);
Justin Paupored98328e2011-08-19 13:48:31 -07001078reg_free:
1079 regulator_bulk_free(ARRAY_SIZE(regs_atmel), regs_atmel);
1080out:
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001081 return rc;
1082}
1083
1084static int atmel_ts_platform_exit(struct i2c_client *client)
1085{
1086 gpio_free(ATMEL_TS_GPIO_IRQ);
1087 gpio_tlmm_config(GPIO_CFG(ATMEL_TS_GPIO_IRQ, 0,
1088 GPIO_CFG_INPUT, GPIO_CFG_NO_PULL,
1089 GPIO_CFG_2MA), GPIO_CFG_DISABLE);
Justin Paupored98328e2011-08-19 13:48:31 -07001090 regulator_bulk_free(ARRAY_SIZE(regs_atmel), regs_atmel);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001091 return 0;
1092}
1093
1094static u8 atmel_ts_read_chg(void)
1095{
1096 return gpio_get_value(ATMEL_TS_GPIO_IRQ);
1097}
1098
1099static u8 atmel_ts_valid_interrupt(void)
1100{
1101 return !atmel_ts_read_chg();
1102}
1103
1104#define ATMEL_X_OFFSET 13
1105#define ATMEL_Y_OFFSET 0
1106
Mohan Pallaka4e9a94e2011-11-23 16:34:21 +05301107static struct maxtouch_platform_data atmel_ts_pdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001108 .numtouch = 4,
1109 .init_platform_hw = atmel_ts_platform_init,
1110 .exit_platform_hw = atmel_ts_platform_exit,
1111 .power_on = atmel_ts_power_on,
1112 .display_res_x = 480,
1113 .display_res_y = 864,
1114 .min_x = ATMEL_X_OFFSET,
1115 .max_x = (505 - ATMEL_X_OFFSET),
1116 .min_y = ATMEL_Y_OFFSET,
1117 .max_y = (863 - ATMEL_Y_OFFSET),
1118 .valid_interrupt = atmel_ts_valid_interrupt,
1119 .read_chg = atmel_ts_read_chg,
1120};
1121
1122static struct i2c_board_info atmel_ts_i2c_info[] __initdata = {
1123 {
1124 I2C_BOARD_INFO(ATMEL_TS_I2C_NAME, 0x4a),
1125 .platform_data = &atmel_ts_pdata,
1126 .irq = MSM_GPIO_TO_INT(ATMEL_TS_GPIO_IRQ),
1127 },
1128};
1129
1130#define KP_INDEX(row, col) ((row)*ARRAY_SIZE(kp_col_gpios) + (col))
1131
1132static unsigned int kp_row_gpios[] = {31, 32, 33, 34, 35};
1133static unsigned int kp_col_gpios[] = {36, 37, 38, 39, 40};
1134
1135static const unsigned short keymap[ARRAY_SIZE(kp_col_gpios) *
1136 ARRAY_SIZE(kp_row_gpios)] = {
1137 [KP_INDEX(0, 0)] = KEY_7,
1138 [KP_INDEX(0, 1)] = KEY_DOWN,
1139 [KP_INDEX(0, 2)] = KEY_UP,
1140 [KP_INDEX(0, 3)] = KEY_RIGHT,
1141 [KP_INDEX(0, 4)] = KEY_ENTER,
1142
1143 [KP_INDEX(1, 0)] = KEY_LEFT,
1144 [KP_INDEX(1, 1)] = KEY_SEND,
1145 [KP_INDEX(1, 2)] = KEY_1,
1146 [KP_INDEX(1, 3)] = KEY_4,
1147 [KP_INDEX(1, 4)] = KEY_CLEAR,
1148
1149 [KP_INDEX(2, 0)] = KEY_6,
1150 [KP_INDEX(2, 1)] = KEY_5,
1151 [KP_INDEX(2, 2)] = KEY_8,
1152 [KP_INDEX(2, 3)] = KEY_3,
1153 [KP_INDEX(2, 4)] = KEY_NUMERIC_STAR,
1154
1155 [KP_INDEX(3, 0)] = KEY_9,
1156 [KP_INDEX(3, 1)] = KEY_NUMERIC_POUND,
1157 [KP_INDEX(3, 2)] = KEY_0,
1158 [KP_INDEX(3, 3)] = KEY_2,
1159 [KP_INDEX(3, 4)] = KEY_SLEEP,
1160
1161 [KP_INDEX(4, 0)] = KEY_BACK,
1162 [KP_INDEX(4, 1)] = KEY_HOME,
1163 [KP_INDEX(4, 2)] = KEY_MENU,
1164 [KP_INDEX(4, 3)] = KEY_VOLUMEUP,
1165 [KP_INDEX(4, 4)] = KEY_VOLUMEDOWN,
1166};
1167
1168/* SURF keypad platform device information */
1169static struct gpio_event_matrix_info kp_matrix_info = {
1170 .info.func = gpio_event_matrix_func,
1171 .keymap = keymap,
1172 .output_gpios = kp_row_gpios,
1173 .input_gpios = kp_col_gpios,
1174 .noutputs = ARRAY_SIZE(kp_row_gpios),
1175 .ninputs = ARRAY_SIZE(kp_col_gpios),
1176 .settle_time.tv_nsec = 40 * NSEC_PER_USEC,
1177 .poll_time.tv_nsec = 20 * NSEC_PER_MSEC,
1178 .flags = GPIOKPF_LEVEL_TRIGGERED_IRQ | GPIOKPF_DRIVE_INACTIVE |
1179 GPIOKPF_PRINT_UNMAPPED_KEYS,
1180};
1181
1182static struct gpio_event_info *kp_info[] = {
1183 &kp_matrix_info.info
1184};
1185
1186static struct gpio_event_platform_data kp_pdata = {
1187 .name = "7x27a_kp",
1188 .info = kp_info,
1189 .info_count = ARRAY_SIZE(kp_info)
1190};
1191
1192static struct platform_device kp_pdev = {
1193 .name = GPIO_EVENT_DEV_NAME,
1194 .id = -1,
1195 .dev = {
1196 .platform_data = &kp_pdata,
1197 },
1198};
1199
1200static struct msm_handset_platform_data hs_platform_data = {
1201 .hs_name = "7k_handset",
1202 .pwr_key_delay_ms = 500, /* 0 will disable end key */
1203};
1204
1205static struct platform_device hs_pdev = {
1206 .name = "msm-handset",
1207 .id = -1,
1208 .dev = {
1209 .platform_data = &hs_platform_data,
1210 },
1211};
1212
Justin Pauporeb3a33b72011-08-23 15:30:32 -07001213static struct platform_device msm_proccomm_regulator_dev = {
1214 .name = PROCCOMM_REGULATOR_DEV_NAME,
1215 .id = -1,
1216 .dev = {
1217 .platform_data = &msm7x27a_proccomm_regulator_data
1218 }
1219};
1220
Laxminath Kasam5faa1ca2012-02-15 12:06:45 +05301221static void msm_adsp_add_pdev(void)
1222{
1223 int rc = 0;
1224 struct rpc_board_dev *rpc_adsp_pdev;
1225
1226 rpc_adsp_pdev = kzalloc(sizeof(struct rpc_board_dev), GFP_KERNEL);
1227 if (rpc_adsp_pdev == NULL) {
1228 pr_err("%s: Memory Allocation failure\n", __func__);
1229 return;
1230 }
1231 rpc_adsp_pdev->prog = ADSP_RPC_PROG;
Taniya Dase3027e22012-02-27 16:32:27 +05301232
1233 if (cpu_is_msm8625())
1234 rpc_adsp_pdev->pdev = msm8625_device_adsp;
1235 else
1236 rpc_adsp_pdev->pdev = msm_adsp_device;
Laxminath Kasam5faa1ca2012-02-15 12:06:45 +05301237 rc = msm_rpc_add_board_dev(rpc_adsp_pdev, 1);
1238 if (rc < 0) {
1239 pr_err("%s: return val: %d\n", __func__, rc);
1240 kfree(rpc_adsp_pdev);
1241 }
1242}
1243
Trilok Soni16f61af2011-07-26 16:06:58 +05301244static void __init msm7627a_rumi3_init(void)
1245{
1246 msm7x27a_init_ebi2();
1247 platform_add_devices(rumi_sim_devices,
1248 ARRAY_SIZE(rumi_sim_devices));
1249}
1250
Taniya Das43bcdd62011-12-02 17:33:27 +05301251static void __init msm8625_rumi3_init(void)
1252{
1253 msm7x2x_misc_init();
Taniya Dase3027e22012-02-27 16:32:27 +05301254 msm_adsp_add_pdev();
1255 msm8625_device_i2c_init();
Taniya Das43bcdd62011-12-02 17:33:27 +05301256 platform_add_devices(msm8625_rumi3_devices,
1257 ARRAY_SIZE(msm8625_rumi3_devices));
Murali Nalajala41786ab2012-03-06 10:47:32 +05301258
Murali Nalajalad1f67b02012-02-10 00:23:49 +05301259 msm_pm_set_platform_data(msm8625_pm_data,
1260 ARRAY_SIZE(msm8625_pm_data));
Murali Nalajala41786ab2012-03-06 10:47:32 +05301261 BUG_ON(msm_pm_boot_init(&msm_pm_8625_boot_pdata));
1262 msm8x25_spm_device_init();
Taniya Das43bcdd62011-12-02 17:33:27 +05301263}
1264
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001265#define LED_GPIO_PDM 96
1266#define UART1DM_RX_GPIO 45
Santosh Sajjanb479f0f2011-08-18 21:00:44 +05301267
1268#if defined(CONFIG_BT) && defined(CONFIG_MARIMBA_CORE)
1269static int __init msm7x27a_init_ar6000pm(void)
1270{
Santosh Sajjan374d6592012-01-19 23:16:46 +05301271 msm_wlan_ar6000_pm_device.dev.platform_data = &ar600x_wlan_power;
Santosh Sajjanb479f0f2011-08-18 21:00:44 +05301272 return platform_device_register(&msm_wlan_ar6000_pm_device);
1273}
1274#else
1275static int __init msm7x27a_init_ar6000pm(void) { return 0; }
1276#endif
1277
Justin Pauporeb3a33b72011-08-23 15:30:32 -07001278static void __init msm7x27a_init_regulators(void)
1279{
1280 int rc = platform_device_register(&msm_proccomm_regulator_dev);
1281 if (rc)
1282 pr_err("%s: could not register regulator device: %d\n",
1283 __func__, rc);
1284}
1285
Taniya Dase3027e22012-02-27 16:32:27 +05301286static void __init msm7x27a_add_footswitch_devices(void)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001287{
Trilok Soni16f61af2011-07-26 16:06:58 +05301288 platform_add_devices(msm_footswitch_devices,
1289 msm_num_footswitch_devices);
Taniya Dase3027e22012-02-27 16:32:27 +05301290}
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001291
Taniya Dase3027e22012-02-27 16:32:27 +05301292static void __init msm7x27a_add_platform_devices(void)
1293{
1294 if (machine_is_msm8625_surf()) {
1295 platform_add_devices(msm8625_surf_devices,
1296 ARRAY_SIZE(msm8625_surf_devices));
1297 } else {
1298 platform_add_devices(msm7627a_surf_ffa_devices,
1299 ARRAY_SIZE(msm7627a_surf_ffa_devices));
1300 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001301
Taniya Dase3027e22012-02-27 16:32:27 +05301302 platform_add_devices(common_devices,
1303 ARRAY_SIZE(common_devices));
1304}
1305
1306static void __init msm7x27a_uartdm_config(void)
1307{
1308 msm7x27a_cfg_uart2dm_serial();
1309 msm_uart_dm1_pdata.wakeup_irq = gpio_to_irq(UART1DM_RX_GPIO);
1310 if (cpu_is_msm8625())
1311 msm8625_device_uart_dm1.dev.platform_data =
1312 &msm_uart_dm1_pdata;
1313 else
1314 msm_device_uart_dm1.dev.platform_data = &msm_uart_dm1_pdata;
1315}
1316
1317static void __init msm7x27a_otg_gadget(void)
1318{
1319 msm_otg_pdata.swfi_latency =
1320 msm7x27a_pm_data[
1321 MSM_PM_SLEEP_MODE_RAMP_DOWN_AND_WAIT_FOR_INTERRUPT].latency;
1322 if (cpu_is_msm8625()) {
1323 msm8625_device_otg.dev.platform_data = &msm_otg_pdata;
1324 msm8625_device_gadget_peripheral.dev.platform_data =
1325 &msm_gadget_pdata;
1326 } else {
1327 msm_device_otg.dev.platform_data = &msm_otg_pdata;
1328 msm_device_gadget_peripheral.dev.platform_data =
1329 &msm_gadget_pdata;
1330 }
1331}
1332
1333static void __init msm7x27a_add_io_devices(void)
1334{
1335 /* touchscreen */
Trilok Soni3d0f6c52011-07-26 16:06:58 +05301336 if (machine_is_msm7625a_surf() || machine_is_msm7625a_ffa()) {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001337 atmel_ts_pdata.min_x = 0;
1338 atmel_ts_pdata.max_x = 480;
1339 atmel_ts_pdata.min_y = 0;
1340 atmel_ts_pdata.max_y = 320;
1341 }
1342
1343 i2c_register_board_info(MSM_GSBI1_QUP_I2C_BUS_ID,
Taniya Dase3027e22012-02-27 16:32:27 +05301344 atmel_ts_i2c_info,
1345 ARRAY_SIZE(atmel_ts_i2c_info));
1346 /* keypad */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001347 platform_device_register(&kp_pdev);
Taniya Dase3027e22012-02-27 16:32:27 +05301348
1349 /* headset */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001350 platform_device_register(&hs_pdev);
1351
Taniya Dase3027e22012-02-27 16:32:27 +05301352 /* LED: configure it as a pdm function */
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001353 if (gpio_tlmm_config(GPIO_CFG(LED_GPIO_PDM, 3,
1354 GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL,
1355 GPIO_CFG_8MA), GPIO_CFG_ENABLE))
1356 pr_err("%s: gpio_tlmm_config for %d failed\n",
1357 __func__, LED_GPIO_PDM);
1358 else
1359 platform_device_register(&led_pdev);
1360
Taniya Dase3027e22012-02-27 16:32:27 +05301361 /* Vibrator */
Trilok Soni3d0f6c52011-07-26 16:06:58 +05301362 if (machine_is_msm7x27a_ffa() || machine_is_msm7625a_ffa())
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001363 msm_init_pmic_vibrator();
Taniya Dase3027e22012-02-27 16:32:27 +05301364}
1365
1366static void __init msm7x27a_pm_init(void)
1367{
Murali Nalajala8ee084e2012-03-07 00:09:38 +05301368 if (machine_is_msm8625_surf()) {
1369 msm_pm_set_platform_data(msm8625_pm_data,
1370 ARRAY_SIZE(msm8625_pm_data));
1371 BUG_ON(msm_pm_boot_init(&msm_pm_8625_boot_pdata));
1372 msm8x25_spm_device_init();
1373 } else {
1374 msm_pm_set_platform_data(msm7x27a_pm_data,
1375 ARRAY_SIZE(msm7x27a_pm_data));
1376 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
1377 }
Murali Nalajala2a0bbda2012-03-28 12:12:54 +05301378
1379 msm_pm_register_irqs();
Taniya Dase3027e22012-02-27 16:32:27 +05301380}
1381
1382static void __init msm7x2x_init(void)
1383{
1384 msm7x2x_misc_init();
1385
1386 /* Initialize regulators first so that other devices can use them */
1387 msm7x27a_init_regulators();
1388 msm_adsp_add_pdev();
1389 if (cpu_is_msm8625())
1390 msm8625_device_i2c_init();
1391 else
1392 msm7x27a_device_i2c_init();
1393 msm7x27a_init_ebi2();
1394 msm7x27a_uartdm_config();
1395
1396 msm7x27a_otg_gadget();
1397 msm7x27a_cfg_smsc911x();
1398
1399 msm7x27a_add_footswitch_devices();
1400 msm7x27a_add_platform_devices();
1401 /* Ensure ar6000pm device is registered before MMC/SDC */
1402 msm7x27a_init_ar6000pm();
1403 msm7627a_init_mmc();
1404 msm_fb_add_devices();
1405 msm7x2x_init_host();
1406 msm7x27a_pm_init();
1407 register_i2c_devices();
1408 msm7627a_bt_power_init();
1409 msm7627a_camera_init();
1410 msm7x27a_add_io_devices();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001411 /*7x25a kgsl initializations*/
1412 msm7x25a_kgsl_3d0_init();
1413}
1414
1415static void __init msm7x2x_init_early(void)
1416{
Chintan Pandya250c2e52012-01-19 17:15:49 +05301417 msm_msm7627a_allocate_memory_regions();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001418}
1419
1420MACHINE_START(MSM7X27A_RUMI3, "QCT MSM7x27a RUMI3")
1421 .boot_params = PHYS_OFFSET + 0x100,
1422 .map_io = msm_common_io_init,
1423 .reserve = msm7x27a_reserve,
1424 .init_irq = msm_init_irq,
Trilok Soni16f61af2011-07-26 16:06:58 +05301425 .init_machine = msm7627a_rumi3_init,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001426 .timer = &msm_timer,
1427 .init_early = msm7x2x_init_early,
Taniya Das86e0e132011-10-19 11:32:00 +05301428 .handle_irq = vic_handle_irq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001429MACHINE_END
1430MACHINE_START(MSM7X27A_SURF, "QCT MSM7x27a SURF")
1431 .boot_params = PHYS_OFFSET + 0x100,
1432 .map_io = msm_common_io_init,
1433 .reserve = msm7x27a_reserve,
1434 .init_irq = msm_init_irq,
1435 .init_machine = msm7x2x_init,
1436 .timer = &msm_timer,
1437 .init_early = msm7x2x_init_early,
Taniya Das86e0e132011-10-19 11:32:00 +05301438 .handle_irq = vic_handle_irq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001439MACHINE_END
1440MACHINE_START(MSM7X27A_FFA, "QCT MSM7x27a FFA")
1441 .boot_params = PHYS_OFFSET + 0x100,
1442 .map_io = msm_common_io_init,
1443 .reserve = msm7x27a_reserve,
1444 .init_irq = msm_init_irq,
1445 .init_machine = msm7x2x_init,
1446 .timer = &msm_timer,
1447 .init_early = msm7x2x_init_early,
Taniya Das86e0e132011-10-19 11:32:00 +05301448 .handle_irq = vic_handle_irq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001449MACHINE_END
Trilok Soni3d0f6c52011-07-26 16:06:58 +05301450MACHINE_START(MSM7625A_SURF, "QCT MSM7625a SURF")
1451 .boot_params = PHYS_OFFSET + 0x100,
1452 .map_io = msm_common_io_init,
1453 .reserve = msm7x27a_reserve,
1454 .init_irq = msm_init_irq,
1455 .init_machine = msm7x2x_init,
1456 .timer = &msm_timer,
1457 .init_early = msm7x2x_init_early,
Taniya Das86e0e132011-10-19 11:32:00 +05301458 .handle_irq = vic_handle_irq,
Trilok Soni3d0f6c52011-07-26 16:06:58 +05301459MACHINE_END
1460MACHINE_START(MSM7625A_FFA, "QCT MSM7625a FFA")
1461 .boot_params = PHYS_OFFSET + 0x100,
1462 .map_io = msm_common_io_init,
1463 .reserve = msm7x27a_reserve,
1464 .init_irq = msm_init_irq,
1465 .init_machine = msm7x2x_init,
1466 .timer = &msm_timer,
1467 .init_early = msm7x2x_init_early,
Taniya Das86e0e132011-10-19 11:32:00 +05301468 .handle_irq = vic_handle_irq,
Trilok Soni3d0f6c52011-07-26 16:06:58 +05301469MACHINE_END
Taniya Das43bcdd62011-12-02 17:33:27 +05301470MACHINE_START(MSM8625_RUMI3, "QCT MSM8625 RUMI3")
1471 .boot_params = PHYS_OFFSET + 0x100,
1472 .map_io = msm8625_map_io,
Taniya Das2b16d1d2011-12-02 14:44:19 +05301473 .reserve = msm8625_reserve,
Taniya Das43bcdd62011-12-02 17:33:27 +05301474 .init_irq = msm8625_init_irq,
1475 .init_machine = msm8625_rumi3_init,
1476 .timer = &msm_timer,
1477 .handle_irq = gic_handle_irq,
1478MACHINE_END
Taniya Dase3027e22012-02-27 16:32:27 +05301479MACHINE_START(MSM8625_SURF, "QCT MSM8625 SURF")
1480 .boot_params = PHYS_OFFSET + 0x100,
1481 .map_io = msm8625_map_io,
1482 .reserve = msm8625_reserve,
1483 .init_irq = msm8625_init_irq,
1484 .init_machine = msm7x2x_init,
1485 .timer = &msm_timer,
1486 .init_early = msm7x2x_init_early,
1487 .handle_irq = gic_handle_irq,
1488MACHINE_END