blob: 2a51e66ee60ebfbe37e6b4854744a2f7d83642b3 [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>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070041#include <linux/bootmem.h>
42#include <linux/mfd/marimba.h>
43#include <mach/vreg.h>
44#include <linux/power_supply.h>
Justin Paupored98328e2011-08-19 13:48:31 -070045#include <linux/regulator/consumer.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070046#include <mach/rpc_pmapp.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070047#include <mach/msm_battery.h>
48#include <linux/smsc911x.h>
49#include <linux/atmel_maxtouch.h>
Siddartha Mohanadossbc2103f2012-03-20 11:41:48 -070050#include <linux/msm_adc.h>
Mitchel Humpherys592bb582012-09-06 11:34:47 -070051#include <linux/msm_ion.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
Utsab Bose158d2b32012-09-03 17:59:52 +053062#define RESERVE_KERNEL_EBI1_SIZE 0x3A000
63#define MSM_RESERVE_AUDIO_SIZE 0x1F4000
Trilok Sonib9410792012-04-07 15:37:13 +053064
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
Steve Mucklef132c6c2012-06-06 18:30:57 -070083#if defined(CONFIG_BT) && defined(CONFIG_MARIMBA_CORE)
Santosh Sajjan6822c682011-07-26 10:49:36 +053084static struct platform_device msm_wlan_ar6000_pm_device = {
85 .name = "wlan_ar6000_pm_dev",
86 .id = -1,
87};
Steve Mucklef132c6c2012-06-06 18:30:57 -070088#endif
Santosh Sajjan6822c682011-07-26 10:49:36 +053089
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070090#if defined(CONFIG_I2C) && defined(CONFIG_GPIO_SX150X)
91static struct i2c_board_info core_exp_i2c_info[] __initdata = {
92 {
93 I2C_BOARD_INFO("sx1509q", 0x3e),
94 },
95};
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070096
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070097static void __init register_i2c_devices(void)
98{
Taniya Dase3027e22012-02-27 16:32:27 +053099 if (machine_is_msm7x27a_surf() || machine_is_msm7625a_surf() ||
100 machine_is_msm8625_surf())
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700101 sx150x_data[SX150X_CORE].io_open_drain_ena = 0xe0f0;
102
103 core_exp_i2c_info[0].platform_data =
104 &sx150x_data[SX150X_CORE];
105
106 i2c_register_board_info(MSM_GSBI1_QUP_I2C_BUS_ID,
107 core_exp_i2c_info,
108 ARRAY_SIZE(core_exp_i2c_info));
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700109}
110#endif
111
112static struct msm_gpio qup_i2c_gpios_io[] = {
113 { GPIO_CFG(60, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
114 "qup_scl" },
115 { GPIO_CFG(61, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
116 "qup_sda" },
117 { GPIO_CFG(131, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
118 "qup_scl" },
119 { GPIO_CFG(132, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
120 "qup_sda" },
121};
122
123static struct msm_gpio qup_i2c_gpios_hw[] = {
124 { GPIO_CFG(60, 1, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
125 "qup_scl" },
126 { GPIO_CFG(61, 1, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
127 "qup_sda" },
128 { GPIO_CFG(131, 2, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
129 "qup_scl" },
130 { GPIO_CFG(132, 2, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
131 "qup_sda" },
132};
133
134static void gsbi_qup_i2c_gpio_config(int adap_id, int config_type)
135{
136 int rc;
137
138 if (adap_id < 0 || adap_id > 1)
139 return;
140
141 /* Each adapter gets 2 lines from the table */
142 if (config_type)
143 rc = msm_gpios_request_enable(&qup_i2c_gpios_hw[adap_id*2], 2);
144 else
145 rc = msm_gpios_request_enable(&qup_i2c_gpios_io[adap_id*2], 2);
146 if (rc < 0)
147 pr_err("QUP GPIO request/enable failed: %d\n", rc);
148}
149
150static struct msm_i2c_platform_data msm_gsbi0_qup_i2c_pdata = {
151 .clk_freq = 100000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700152 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
153};
154
155static struct msm_i2c_platform_data msm_gsbi1_qup_i2c_pdata = {
156 .clk_freq = 100000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700157 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
158};
159
Trilok Sonib9410792012-04-07 15:37:13 +0530160#ifdef CONFIG_ARCH_MSM7X27A
Utsab Bose158d2b32012-09-03 17:59:52 +0530161#define MSM_RESERVE_MDP_SIZE 0x1B00000
162#define MSM7x25A_MSM_RESERVE_MDP_SIZE 0x1500000
163#define MSM_RESERVE_ADSP_SIZE 0x1200000
164#define MSM7x25A_MSM_RESERVE_ADSP_SIZE 0xB91000
165#define CAMERA_ZSL_SIZE (SZ_1M * 60)
Trilok Sonib9410792012-04-07 15:37:13 +0530166#endif
167
Chintan Pandya43d0a342012-06-08 19:45:56 +0530168#ifdef CONFIG_ION_MSM
169#define MSM_ION_HEAP_NUM 4
170static struct platform_device ion_dev;
171static int msm_ion_camera_size;
172static int msm_ion_audio_size;
173static int msm_ion_sf_size;
174#endif
175
176
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700177static struct android_usb_platform_data android_usb_pdata = {
178 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
179};
180
181static struct platform_device android_usb_device = {
182 .name = "android_usb",
183 .id = -1,
184 .dev = {
185 .platform_data = &android_usb_pdata,
186 },
187};
188
189#ifdef CONFIG_USB_EHCI_MSM_72K
190static void msm_hsusb_vbus_power(unsigned phy_info, int on)
191{
192 int rc = 0;
193 unsigned gpio;
194
195 gpio = GPIO_HOST_VBUS_EN;
196
197 rc = gpio_request(gpio, "i2c_host_vbus_en");
198 if (rc < 0) {
199 pr_err("failed to request %d GPIO\n", gpio);
200 return;
201 }
202 gpio_direction_output(gpio, !!on);
203 gpio_set_value_cansleep(gpio, !!on);
204 gpio_free(gpio);
205}
206
207static struct msm_usb_host_platform_data msm_usb_host_pdata = {
208 .phy_info = (USB_PHY_INTEGRATED | USB_PHY_MODEL_45NM),
209};
210
211static void __init msm7x2x_init_host(void)
212{
213 msm_add_host(0, &msm_usb_host_pdata);
214}
215#endif
216
217#ifdef CONFIG_USB_MSM_OTG_72K
218static int hsusb_rpc_connect(int connect)
219{
220 if (connect)
221 return msm_hsusb_rpc_connect();
222 else
223 return msm_hsusb_rpc_close();
224}
225
Justin Paupored98328e2011-08-19 13:48:31 -0700226static struct regulator *reg_hsusb;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700227static int msm_hsusb_ldo_init(int init)
228{
Justin Paupored98328e2011-08-19 13:48:31 -0700229 int rc = 0;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700230
Justin Paupored98328e2011-08-19 13:48:31 -0700231 if (init) {
232 reg_hsusb = regulator_get(NULL, "usb");
233 if (IS_ERR(reg_hsusb)) {
234 rc = PTR_ERR(reg_hsusb);
235 pr_err("%s: could not get regulator: %d\n",
236 __func__, rc);
237 goto out;
238 }
239
240 rc = regulator_set_voltage(reg_hsusb, 3300000, 3300000);
241 if (rc) {
242 pr_err("%s: could not set voltage: %d\n",
243 __func__, rc);
244 goto reg_free;
245 }
246
247 return 0;
248 }
249 /* else fall through */
250reg_free:
251 regulator_put(reg_hsusb);
252out:
253 reg_hsusb = NULL;
254 return rc;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700255}
256
257static int msm_hsusb_ldo_enable(int enable)
258{
259 static int ldo_status;
260
Justin Paupored98328e2011-08-19 13:48:31 -0700261 if (IS_ERR_OR_NULL(reg_hsusb))
262 return reg_hsusb ? PTR_ERR(reg_hsusb) : -ENODEV;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700263
264 if (ldo_status == enable)
265 return 0;
266
267 ldo_status = enable;
268
Justin Paupored98328e2011-08-19 13:48:31 -0700269 return enable ?
270 regulator_enable(reg_hsusb) :
271 regulator_disable(reg_hsusb);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700272}
273
274#ifndef CONFIG_USB_EHCI_MSM_72K
275static int msm_hsusb_pmic_notif_init(void (*callback)(int online), int init)
276{
277 int ret = 0;
278
279 if (init)
280 ret = msm_pm_app_rpc_init(callback);
281 else
282 msm_pm_app_rpc_deinit(callback);
283
284 return ret;
285}
286#endif
287
288static struct msm_otg_platform_data msm_otg_pdata = {
289#ifndef CONFIG_USB_EHCI_MSM_72K
290 .pmic_vbus_notif_init = msm_hsusb_pmic_notif_init,
291#else
292 .vbus_power = msm_hsusb_vbus_power,
293#endif
294 .rpc_connect = hsusb_rpc_connect,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700295 .pemp_level = PRE_EMPHASIS_WITH_20_PERCENT,
296 .cdr_autoreset = CDR_AUTO_RESET_DISABLE,
297 .drv_ampl = HS_DRV_AMPLITUDE_DEFAULT,
298 .se1_gating = SE1_GATING_DISABLE,
299 .ldo_init = msm_hsusb_ldo_init,
300 .ldo_enable = msm_hsusb_ldo_enable,
301 .chg_init = hsusb_chg_init,
302 .chg_connected = hsusb_chg_connected,
303 .chg_vbus_draw = hsusb_chg_vbus_draw,
304};
305#endif
306
307static struct msm_hsusb_gadget_platform_data msm_gadget_pdata = {
308 .is_phy_status_timer_on = 1,
309};
310
311static struct resource smc91x_resources[] = {
312 [0] = {
313 .start = 0x90000300,
314 .end = 0x900003ff,
315 .flags = IORESOURCE_MEM,
316 },
317 [1] = {
318 .start = MSM_GPIO_TO_INT(4),
319 .end = MSM_GPIO_TO_INT(4),
320 .flags = IORESOURCE_IRQ,
321 },
322};
323
324static struct platform_device smc91x_device = {
325 .name = "smc91x",
326 .id = 0,
327 .num_resources = ARRAY_SIZE(smc91x_resources),
328 .resource = smc91x_resources,
329};
330
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700331#ifdef CONFIG_SERIAL_MSM_HS
332static struct msm_serial_hs_platform_data msm_uart_dm1_pdata = {
333 .inject_rx_on_wakeup = 1,
334 .rx_to_inject = 0xFD,
335};
336#endif
337static struct msm_pm_platform_data msm7x27a_pm_data[MSM_PM_SLEEP_MODE_NR] = {
Murali Nalajalab10363d2012-01-12 16:29:01 +0530338 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700339 .idle_supported = 1,
340 .suspend_supported = 1,
341 .idle_enabled = 1,
342 .suspend_enabled = 1,
343 .latency = 16000,
344 .residency = 20000,
345 },
Murali Nalajalab10363d2012-01-12 16:29:01 +0530346 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_NO_XO_SHUTDOWN)] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700347 .idle_supported = 1,
348 .suspend_supported = 1,
349 .idle_enabled = 1,
350 .suspend_enabled = 1,
351 .latency = 12000,
352 .residency = 20000,
353 },
Murali Nalajalab10363d2012-01-12 16:29:01 +0530354 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_RAMP_DOWN_AND_WAIT_FOR_INTERRUPT)] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700355 .idle_supported = 1,
356 .suspend_supported = 1,
357 .idle_enabled = 0,
358 .suspend_enabled = 1,
359 .latency = 2000,
360 .residency = 0,
361 },
Murali Nalajalab10363d2012-01-12 16:29:01 +0530362 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700363 .idle_supported = 1,
364 .suspend_supported = 1,
365 .idle_enabled = 1,
366 .suspend_enabled = 1,
367 .latency = 2,
368 .residency = 0,
369 },
370};
371
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -0600372static struct msm_pm_boot_platform_data msm_pm_boot_pdata __initdata = {
Sravan Kumar Ambapuramb22cf4d2012-01-02 21:45:04 +0530373 .mode = MSM_PM_BOOT_CONFIG_RESET_VECTOR_PHYS,
374 .p_addr = 0,
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -0600375};
376
Murali Nalajalad1f67b02012-02-10 00:23:49 +0530377/* 8625 PM platform data */
378static struct msm_pm_platform_data msm8625_pm_data[MSM_PM_SLEEP_MODE_NR * 2] = {
379 /* CORE0 entries */
380 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
381 .idle_supported = 1,
382 .suspend_supported = 1,
383 .idle_enabled = 0,
384 .suspend_enabled = 0,
385 .latency = 16000,
386 .residency = 20000,
387 },
388
389 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_NO_XO_SHUTDOWN)] = {
390 .idle_supported = 1,
391 .suspend_supported = 1,
392 .idle_enabled = 0,
393 .suspend_enabled = 0,
394 .latency = 12000,
395 .residency = 20000,
396 },
397
398 /* picked latency & redisdency values from 7x30 */
399 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
400 .idle_supported = 1,
401 .suspend_supported = 1,
402 .idle_enabled = 0,
403 .suspend_enabled = 0,
404 .latency = 500,
405 .residency = 6000,
406 },
407
408 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
409 .idle_supported = 1,
410 .suspend_supported = 1,
411 .idle_enabled = 1,
412 .suspend_enabled = 1,
413 .latency = 2,
414 .residency = 10,
415 },
416
417 /* picked latency & redisdency values from 7x30 */
418 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
419 .idle_supported = 1,
420 .suspend_supported = 1,
421 .idle_enabled = 0,
422 .suspend_enabled = 0,
423 .latency = 500,
424 .residency = 6000,
425 },
426
427 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
428 .idle_supported = 1,
429 .suspend_supported = 1,
430 .idle_enabled = 1,
431 .suspend_enabled = 1,
432 .latency = 2,
433 .residency = 10,
434 },
435
436};
437
Murali Nalajala41786ab2012-03-06 10:47:32 +0530438static struct msm_pm_boot_platform_data msm_pm_8625_boot_pdata __initdata = {
439 .mode = MSM_PM_BOOT_CONFIG_REMAP_BOOT_ADDR,
440 .v_addr = MSM_CFG_CTL_BASE,
441};
442
Utsab Bose158d2b32012-09-03 17:59:52 +0530443static unsigned reserve_mdp_size = MSM_RESERVE_MDP_SIZE;
444static int __init reserve_mdp_size_setup(char *p)
Trilok Sonib9410792012-04-07 15:37:13 +0530445{
Utsab Bose158d2b32012-09-03 17:59:52 +0530446 reserve_mdp_size = memparse(p, NULL);
Trilok Sonib9410792012-04-07 15:37:13 +0530447 return 0;
448}
449
Utsab Bose158d2b32012-09-03 17:59:52 +0530450early_param("reserve_mdp_size", reserve_mdp_size_setup);
Trilok Sonib9410792012-04-07 15:37:13 +0530451
Utsab Bose158d2b32012-09-03 17:59:52 +0530452static unsigned reserve_adsp_size = MSM_RESERVE_ADSP_SIZE;
453static int __init reserve_adsp_size_setup(char *p)
Trilok Sonib9410792012-04-07 15:37:13 +0530454{
Utsab Bose158d2b32012-09-03 17:59:52 +0530455 reserve_adsp_size = memparse(p, NULL);
Trilok Sonib9410792012-04-07 15:37:13 +0530456 return 0;
457}
458
Utsab Bose158d2b32012-09-03 17:59:52 +0530459early_param("reserve_adsp_size", reserve_adsp_size_setup);
Trilok Sonib9410792012-04-07 15:37:13 +0530460
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700461static u32 msm_calculate_batt_capacity(u32 current_voltage);
462
463static struct msm_psy_batt_pdata msm_psy_batt_data = {
Krishna Vanka9a265e12012-06-04 23:24:26 +0530464 .voltage_min_design = 3200,
465 .voltage_max_design = 4200,
466 .voltage_fail_safe = 3340,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700467 .avail_chg_sources = AC_CHG | USB_CHG ,
468 .batt_technology = POWER_SUPPLY_TECHNOLOGY_LION,
469 .calculate_capacity = &msm_calculate_batt_capacity,
470};
471
472static u32 msm_calculate_batt_capacity(u32 current_voltage)
473{
474 u32 low_voltage = msm_psy_batt_data.voltage_min_design;
475 u32 high_voltage = msm_psy_batt_data.voltage_max_design;
476
Krishna Vankab3494692012-06-12 15:06:43 +0530477 if (current_voltage <= low_voltage)
478 return 0;
479 else if (current_voltage >= high_voltage)
480 return 100;
481 else
482 return (current_voltage - low_voltage) * 100
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700483 / (high_voltage - low_voltage);
484}
485
486static struct platform_device msm_batt_device = {
487 .name = "msm-battery",
488 .id = -1,
489 .dev.platform_data = &msm_psy_batt_data,
490};
491
492static struct smsc911x_platform_config smsc911x_config = {
493 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_HIGH,
494 .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL,
495 .flags = SMSC911X_USE_16BIT,
496};
497
498static struct resource smsc911x_resources[] = {
499 [0] = {
500 .start = 0x90000000,
501 .end = 0x90007fff,
502 .flags = IORESOURCE_MEM,
503 },
504 [1] = {
505 .start = MSM_GPIO_TO_INT(48),
506 .end = MSM_GPIO_TO_INT(48),
507 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
508 },
509};
510
511static struct platform_device smsc911x_device = {
512 .name = "smsc911x",
513 .id = 0,
514 .num_resources = ARRAY_SIZE(smsc911x_resources),
515 .resource = smsc911x_resources,
516 .dev = {
517 .platform_data = &smsc911x_config,
518 },
519};
520
521static struct msm_gpio smsc911x_gpios[] = {
522 { GPIO_CFG(48, 0, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_6MA),
523 "smsc911x_irq" },
524 { GPIO_CFG(49, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_6MA),
525 "eth_fifo_sel" },
526};
527
Siddartha Mohanadossbc2103f2012-03-20 11:41:48 -0700528static char *msm_adc_surf_device_names[] = {
529 "XO_ADC",
530};
531
532static struct msm_adc_platform_data msm_adc_pdata = {
533 .dev_names = msm_adc_surf_device_names,
534 .num_adc = ARRAY_SIZE(msm_adc_surf_device_names),
535 .target_hw = MSM_8x25,
536};
537
538static struct platform_device msm_adc_device = {
539 .name = "msm_adc",
540 .id = -1,
541 .dev = {
542 .platform_data = &msm_adc_pdata,
543 },
544};
545
Utsab Bose9a341172012-08-07 13:07:28 +0530546#ifdef CONFIG_MSM_RTB
547static struct msm_rtb_platform_data msm7x27a_rtb_pdata = {
548 .size = SZ_1M,
549};
550
551static int __init msm_rtb_set_buffer_size(char *p)
552{
553 int s;
554
555 s = memparse(p, NULL);
556 msm7x27a_rtb_pdata.size = ALIGN(s, SZ_4K);
557 return 0;
558}
559early_param("msm_rtb_size", msm_rtb_set_buffer_size);
560
561struct platform_device msm7x27a_rtb_device = {
562 .name = "msm_rtb",
563 .id = -1,
564 .dev = {
565 .platform_data = &msm7x27a_rtb_pdata,
566 },
567};
568#endif
569
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700570#define ETH_FIFO_SEL_GPIO 49
571static void msm7x27a_cfg_smsc911x(void)
572{
573 int res;
574
575 res = msm_gpios_request_enable(smsc911x_gpios,
576 ARRAY_SIZE(smsc911x_gpios));
577 if (res) {
578 pr_err("%s: unable to enable gpios for SMSC911x\n", __func__);
579 return;
580 }
581
582 /* ETH_FIFO_SEL */
583 res = gpio_direction_output(ETH_FIFO_SEL_GPIO, 0);
584 if (res) {
585 pr_err("%s: unable to get direction for gpio %d\n", __func__,
586 ETH_FIFO_SEL_GPIO);
587 msm_gpios_disable_free(smsc911x_gpios,
588 ARRAY_SIZE(smsc911x_gpios));
589 return;
590 }
591 gpio_set_value(ETH_FIFO_SEL_GPIO, 0);
592}
593
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700594#if defined(CONFIG_SERIAL_MSM_HSL_CONSOLE) \
595 && defined(CONFIG_MSM_SHARED_GPIO_FOR_UART2DM)
596static struct msm_gpio uart2dm_gpios[] = {
597 {GPIO_CFG(19, 2, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA),
598 "uart2dm_rfr_n" },
599 {GPIO_CFG(20, 2, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA),
600 "uart2dm_cts_n" },
601 {GPIO_CFG(21, 2, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA),
602 "uart2dm_rx" },
603 {GPIO_CFG(108, 2, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA),
604 "uart2dm_tx" },
605};
606
607static void msm7x27a_cfg_uart2dm_serial(void)
608{
609 int ret;
610 ret = msm_gpios_request_enable(uart2dm_gpios,
611 ARRAY_SIZE(uart2dm_gpios));
612 if (ret)
613 pr_err("%s: unable to enable gpios for uart2dm\n", __func__);
614}
615#else
616static void msm7x27a_cfg_uart2dm_serial(void) { }
617#endif
618
619static struct platform_device *rumi_sim_devices[] __initdata = {
620 &msm_device_dmov,
621 &msm_device_smd,
622 &smc91x_device,
623 &msm_device_uart1,
624 &msm_device_nand,
625 &msm_device_uart_dm1,
626 &msm_gsbi0_qup_i2c_device,
627 &msm_gsbi1_qup_i2c_device,
628};
629
Taniya Das43bcdd62011-12-02 17:33:27 +0530630static struct platform_device *msm8625_rumi3_devices[] __initdata = {
631 &msm8625_device_dmov,
Angshuman Sarkarfb1cce92012-02-21 15:20:43 +0530632 &msm8625_device_smd,
Taniya Das43bcdd62011-12-02 17:33:27 +0530633 &msm8625_device_uart1,
Taniya Dase3027e22012-02-27 16:32:27 +0530634 &msm8625_gsbi0_qup_i2c_device,
Taniya Das43bcdd62011-12-02 17:33:27 +0530635};
636
Taniya Dase3027e22012-02-27 16:32:27 +0530637static struct platform_device *msm7627a_surf_ffa_devices[] __initdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700638 &msm_device_dmov,
639 &msm_device_smd,
640 &msm_device_uart1,
641 &msm_device_uart_dm1,
642 &msm_device_uart_dm2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700643 &msm_gsbi0_qup_i2c_device,
644 &msm_gsbi1_qup_i2c_device,
645 &msm_device_otg,
646 &msm_device_gadget_peripheral,
Taniya Dase3027e22012-02-27 16:32:27 +0530647 &smsc911x_device,
648 &msm_kgsl_3d0,
649};
650
651static struct platform_device *common_devices[] __initdata = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700652 &android_usb_device,
Taniya Dase3027e22012-02-27 16:32:27 +0530653 &msm_device_nand,
Trilok Sonib9410792012-04-07 15:37:13 +0530654 &msm_device_snd,
Manish Dewangan1c0fa492012-08-22 10:33:11 +0530655 &msm_device_cad,
Trilok Sonib9410792012-04-07 15:37:13 +0530656 &msm_device_adspdec,
Manish Dewangan3a260992011-06-24 18:01:34 +0530657 &asoc_msm_pcm,
658 &asoc_msm_dai0,
659 &asoc_msm_dai1,
Taniya Dase3027e22012-02-27 16:32:27 +0530660 &msm_batt_device,
Siddartha Mohanadossbc2103f2012-03-20 11:41:48 -0700661 &msm_adc_device,
Utsab Bose9a341172012-08-07 13:07:28 +0530662#ifdef CONFIG_MSM_RTB
663 &msm7x27a_rtb_device,
664#endif
Chintan Pandya43d0a342012-06-08 19:45:56 +0530665#ifdef CONFIG_ION_MSM
666 &ion_dev,
667#endif
Taniya Dase3027e22012-02-27 16:32:27 +0530668};
669
670static struct platform_device *msm8625_surf_devices[] __initdata = {
671 &msm8625_device_dmov,
672 &msm8625_device_uart1,
673 &msm8625_device_uart_dm1,
674 &msm8625_device_uart_dm2,
675 &msm8625_gsbi0_qup_i2c_device,
676 &msm8625_gsbi1_qup_i2c_device,
Taniya Dasf2665302012-02-28 16:54:54 +0530677 &msm8625_device_smd,
Taniya Dase3027e22012-02-27 16:32:27 +0530678 &msm8625_device_otg,
679 &msm8625_device_gadget_peripheral,
Ranjhith Kalisamy4ec2e102012-03-06 12:27:50 +0530680 &msm8625_kgsl_3d0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700681};
682
Utsab Bose158d2b32012-09-03 17:59:52 +0530683static unsigned reserve_kernel_ebi1_size = RESERVE_KERNEL_EBI1_SIZE;
684static int __init reserve_kernel_ebi1_size_setup(char *p)
Trilok Sonib9410792012-04-07 15:37:13 +0530685{
Utsab Bose158d2b32012-09-03 17:59:52 +0530686 reserve_kernel_ebi1_size = memparse(p, NULL);
Trilok Sonib9410792012-04-07 15:37:13 +0530687 return 0;
688}
Utsab Bose158d2b32012-09-03 17:59:52 +0530689early_param("reserve_kernel_ebi1_size", reserve_kernel_ebi1_size_setup);
Trilok Sonib9410792012-04-07 15:37:13 +0530690
Utsab Bose158d2b32012-09-03 17:59:52 +0530691static unsigned reserve_audio_size = MSM_RESERVE_AUDIO_SIZE;
692static int __init reserve_audio_size_setup(char *p)
Trilok Sonib9410792012-04-07 15:37:13 +0530693{
Utsab Bose158d2b32012-09-03 17:59:52 +0530694 reserve_audio_size = memparse(p, NULL);
Trilok Sonib9410792012-04-07 15:37:13 +0530695 return 0;
696}
Utsab Bose158d2b32012-09-03 17:59:52 +0530697early_param("reserve_audio_size", reserve_audio_size_setup);
Trilok Sonib9410792012-04-07 15:37:13 +0530698
Chintan Pandya43d0a342012-06-08 19:45:56 +0530699static void fix_sizes(void)
700{
701 if (machine_is_msm7625a_surf() || machine_is_msm7625a_ffa()) {
Utsab Bose158d2b32012-09-03 17:59:52 +0530702 reserve_mdp_size = MSM7x25A_MSM_RESERVE_MDP_SIZE;
703 reserve_adsp_size = MSM7x25A_MSM_RESERVE_ADSP_SIZE;
Chintan Pandya43d0a342012-06-08 19:45:56 +0530704 } else {
Utsab Bose158d2b32012-09-03 17:59:52 +0530705 reserve_mdp_size = MSM_RESERVE_MDP_SIZE;
706 reserve_adsp_size = MSM_RESERVE_ADSP_SIZE;
Chintan Pandya43d0a342012-06-08 19:45:56 +0530707 }
Chintan Pandyad8413762012-08-17 13:30:45 +0530708
709 if (get_ddr_size() > SZ_512M)
Utsab Bose158d2b32012-09-03 17:59:52 +0530710 reserve_adsp_size = CAMERA_ZSL_SIZE;
Chintan Pandya43d0a342012-06-08 19:45:56 +0530711#ifdef CONFIG_ION_MSM
Utsab Bose158d2b32012-09-03 17:59:52 +0530712 msm_ion_camera_size = reserve_adsp_size;
713 msm_ion_audio_size = (MSM_RESERVE_AUDIO_SIZE +
714 RESERVE_KERNEL_EBI1_SIZE);
715 msm_ion_sf_size = reserve_mdp_size;
Chintan Pandya43d0a342012-06-08 19:45:56 +0530716#endif
717}
718
719#ifdef CONFIG_ION_MSM
720#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
721static struct ion_co_heap_pdata co_ion_pdata = {
722 .adjacent_mem_id = INVALID_HEAP_ID,
723 .align = PAGE_SIZE,
724};
725#endif
726
727/**
728 * These heaps are listed in the order they will be allocated.
729 * Don't swap the order unless you know what you are doing!
730 */
731static struct ion_platform_data ion_pdata = {
732 .nr = MSM_ION_HEAP_NUM,
Chintan Pandya8ce738d2012-07-27 13:21:06 +0530733 .has_outer_cache = 1,
Chintan Pandya43d0a342012-06-08 19:45:56 +0530734 .heaps = {
735 {
736 .id = ION_SYSTEM_HEAP_ID,
737 .type = ION_HEAP_TYPE_SYSTEM,
738 .name = ION_VMALLOC_HEAP_NAME,
739 },
740#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
Utsab Bose158d2b32012-09-03 17:59:52 +0530741 /* ION_ADSP = CAMERA */
Chintan Pandya43d0a342012-06-08 19:45:56 +0530742 {
743 .id = ION_CAMERA_HEAP_ID,
744 .type = ION_HEAP_TYPE_CARVEOUT,
745 .name = ION_CAMERA_HEAP_NAME,
746 .memory_type = ION_EBI_TYPE,
Chintan Pandya43d0a342012-06-08 19:45:56 +0530747 .extra_data = (void *)&co_ion_pdata,
748 },
Utsab Bose158d2b32012-09-03 17:59:52 +0530749 /* ION_AUDIO */
Chintan Pandya43d0a342012-06-08 19:45:56 +0530750 {
751 .id = ION_AUDIO_HEAP_ID,
752 .type = ION_HEAP_TYPE_CARVEOUT,
753 .name = ION_AUDIO_HEAP_NAME,
754 .memory_type = ION_EBI_TYPE,
Chintan Pandya43d0a342012-06-08 19:45:56 +0530755 .extra_data = (void *)&co_ion_pdata,
756 },
Utsab Bose158d2b32012-09-03 17:59:52 +0530757 /* ION_MDP = SF */
Chintan Pandya43d0a342012-06-08 19:45:56 +0530758 {
759 .id = ION_SF_HEAP_ID,
760 .type = ION_HEAP_TYPE_CARVEOUT,
761 .name = ION_SF_HEAP_NAME,
762 .memory_type = ION_EBI_TYPE,
Chintan Pandya43d0a342012-06-08 19:45:56 +0530763 .extra_data = (void *)&co_ion_pdata,
764 },
765#endif
766 }
767};
768
769static struct platform_device ion_dev = {
770 .name = "ion-msm",
771 .id = 1,
772 .dev = { .platform_data = &ion_pdata },
773};
774#endif
775
Trilok Sonib9410792012-04-07 15:37:13 +0530776static struct memtype_reserve msm7x27a_reserve_table[] __initdata = {
777 [MEMTYPE_SMI] = {
778 },
779 [MEMTYPE_EBI0] = {
780 .flags = MEMTYPE_FLAGS_1M_ALIGN,
781 },
782 [MEMTYPE_EBI1] = {
783 .flags = MEMTYPE_FLAGS_1M_ALIGN,
784 },
785};
786
Utsab Bose9a341172012-08-07 13:07:28 +0530787#ifdef CONFIG_MSM_RTB
788static void __init reserve_rtb_memory(void)
789{
790 msm7x27a_reserve_table[MEMTYPE_EBI1].size += msm7x27a_rtb_pdata.size;
791}
792#else
793static void __init reserve_rtb_memory(void)
794{
795}
796#endif
797
Chintan Pandya43d0a342012-06-08 19:45:56 +0530798static void __init size_ion_devices(void)
799{
800#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
801 ion_pdata.heaps[1].size = msm_ion_camera_size;
802 ion_pdata.heaps[2].size = msm_ion_audio_size;
803 ion_pdata.heaps[3].size = msm_ion_sf_size;
804#endif
805}
806
807static void __init reserve_ion_memory(void)
808{
809#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
810 msm7x27a_reserve_table[MEMTYPE_EBI1].size += msm_ion_camera_size;
811 msm7x27a_reserve_table[MEMTYPE_EBI1].size += msm_ion_audio_size;
812 msm7x27a_reserve_table[MEMTYPE_EBI1].size += msm_ion_sf_size;
813#endif
Trilok Sonib9410792012-04-07 15:37:13 +0530814}
815
816static void __init msm7x27a_calculate_reserve_sizes(void)
817{
Chintan Pandya43d0a342012-06-08 19:45:56 +0530818 fix_sizes();
Chintan Pandya43d0a342012-06-08 19:45:56 +0530819 size_ion_devices();
820 reserve_ion_memory();
Utsab Bose9a341172012-08-07 13:07:28 +0530821 reserve_rtb_memory();
Trilok Sonib9410792012-04-07 15:37:13 +0530822}
823
824static int msm7x27a_paddr_to_memtype(unsigned int paddr)
825{
826 return MEMTYPE_EBI1;
827}
828
829static struct reserve_info msm7x27a_reserve_info __initdata = {
830 .memtype_reserve_table = msm7x27a_reserve_table,
831 .calculate_reserve_sizes = msm7x27a_calculate_reserve_sizes,
832 .paddr_to_memtype = msm7x27a_paddr_to_memtype,
833};
834
835static void __init msm7x27a_reserve(void)
836{
837 reserve_info = &msm7x27a_reserve_info;
838 msm_reserve();
Trilok Sonib9410792012-04-07 15:37:13 +0530839}
840
Taniya Das2b16d1d2011-12-02 14:44:19 +0530841static void __init msm8625_reserve(void)
842{
Trilok Sonib9410792012-04-07 15:37:13 +0530843 msm7x27a_reserve();
Taniya Dasfe04d4f2012-03-14 11:13:21 +0530844 memblock_remove(MSM8625_SECONDARY_PHYS, SZ_8);
Murali Nalajalafeedeae2012-03-28 16:15:32 +0530845 memblock_remove(MSM8625_WARM_BOOT_PHYS, SZ_32);
Taniya Das2b16d1d2011-12-02 14:44:19 +0530846}
847
Taniya Dase3027e22012-02-27 16:32:27 +0530848static void __init msm7x27a_device_i2c_init(void)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700849{
850 msm_gsbi0_qup_i2c_device.dev.platform_data = &msm_gsbi0_qup_i2c_pdata;
851 msm_gsbi1_qup_i2c_device.dev.platform_data = &msm_gsbi1_qup_i2c_pdata;
852}
853
Taniya Dase3027e22012-02-27 16:32:27 +0530854static void __init msm8625_device_i2c_init(void)
855{
856 msm8625_gsbi0_qup_i2c_device.dev.platform_data =
857 &msm_gsbi0_qup_i2c_pdata;
858 msm8625_gsbi1_qup_i2c_device.dev.platform_data =
859 &msm_gsbi1_qup_i2c_pdata;
860}
861
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700862#define MSM_EBI2_PHYS 0xa0d00000
863#define MSM_EBI2_XMEM_CS2_CFG1 0xa0d10030
864
865static void __init msm7x27a_init_ebi2(void)
866{
867 uint32_t ebi2_cfg;
868 void __iomem *ebi2_cfg_ptr;
869
870 ebi2_cfg_ptr = ioremap_nocache(MSM_EBI2_PHYS, sizeof(uint32_t));
871 if (!ebi2_cfg_ptr)
872 return;
873
874 ebi2_cfg = readl(ebi2_cfg_ptr);
Trilok Soni3d0f6c52011-07-26 16:06:58 +0530875 if (machine_is_msm7x27a_rumi3() || machine_is_msm7x27a_surf() ||
Taniya Dase3027e22012-02-27 16:32:27 +0530876 machine_is_msm7625a_surf() || machine_is_msm8625_surf())
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700877 ebi2_cfg |= (1 << 4); /* CS2 */
878
879 writel(ebi2_cfg, ebi2_cfg_ptr);
880 iounmap(ebi2_cfg_ptr);
881
882 /* Enable A/D MUX[bit 31] from EBI2_XMEM_CS2_CFG1 */
883 ebi2_cfg_ptr = ioremap_nocache(MSM_EBI2_XMEM_CS2_CFG1,
884 sizeof(uint32_t));
885 if (!ebi2_cfg_ptr)
886 return;
887
888 ebi2_cfg = readl(ebi2_cfg_ptr);
Trilok Soni3d0f6c52011-07-26 16:06:58 +0530889 if (machine_is_msm7x27a_surf() || machine_is_msm7625a_surf())
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700890 ebi2_cfg |= (1 << 31);
891
892 writel(ebi2_cfg, ebi2_cfg_ptr);
893 iounmap(ebi2_cfg_ptr);
894}
895
Justin Pauporeb3a33b72011-08-23 15:30:32 -0700896static struct platform_device msm_proccomm_regulator_dev = {
897 .name = PROCCOMM_REGULATOR_DEV_NAME,
898 .id = -1,
899 .dev = {
900 .platform_data = &msm7x27a_proccomm_regulator_data
901 }
902};
903
Trilok Sonib9410792012-04-07 15:37:13 +0530904static void msm_adsp_add_pdev(void)
905{
906 int rc = 0;
907 struct rpc_board_dev *rpc_adsp_pdev;
908
909 rpc_adsp_pdev = kzalloc(sizeof(struct rpc_board_dev), GFP_KERNEL);
910 if (rpc_adsp_pdev == NULL) {
911 pr_err("%s: Memory Allocation failure\n", __func__);
912 return;
913 }
914 rpc_adsp_pdev->prog = ADSP_RPC_PROG;
915
916 if (cpu_is_msm8625())
917 rpc_adsp_pdev->pdev = msm8625_device_adsp;
918 else
919 rpc_adsp_pdev->pdev = msm_adsp_device;
920 rc = msm_rpc_add_board_dev(rpc_adsp_pdev, 1);
921 if (rc < 0) {
922 pr_err("%s: return val: %d\n", __func__, rc);
923 kfree(rpc_adsp_pdev);
924 }
925}
926
Trilok Soni16f61af2011-07-26 16:06:58 +0530927static void __init msm7627a_rumi3_init(void)
928{
929 msm7x27a_init_ebi2();
930 platform_add_devices(rumi_sim_devices,
931 ARRAY_SIZE(rumi_sim_devices));
932}
933
Taniya Das43bcdd62011-12-02 17:33:27 +0530934static void __init msm8625_rumi3_init(void)
935{
936 msm7x2x_misc_init();
Taniya Dase3027e22012-02-27 16:32:27 +0530937 msm_adsp_add_pdev();
938 msm8625_device_i2c_init();
Taniya Das43bcdd62011-12-02 17:33:27 +0530939 platform_add_devices(msm8625_rumi3_devices,
940 ARRAY_SIZE(msm8625_rumi3_devices));
Murali Nalajala41786ab2012-03-06 10:47:32 +0530941
Murali Nalajalad1f67b02012-02-10 00:23:49 +0530942 msm_pm_set_platform_data(msm8625_pm_data,
943 ARRAY_SIZE(msm8625_pm_data));
Murali Nalajala41786ab2012-03-06 10:47:32 +0530944 BUG_ON(msm_pm_boot_init(&msm_pm_8625_boot_pdata));
945 msm8x25_spm_device_init();
Murali Nalajalaff723ec2012-07-13 16:54:40 +0530946 msm_pm_register_cpr_ops();
Taniya Das43bcdd62011-12-02 17:33:27 +0530947}
948
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700949#define UART1DM_RX_GPIO 45
Santosh Sajjanb479f0f2011-08-18 21:00:44 +0530950
951#if defined(CONFIG_BT) && defined(CONFIG_MARIMBA_CORE)
952static int __init msm7x27a_init_ar6000pm(void)
953{
Santosh Sajjan374d6592012-01-19 23:16:46 +0530954 msm_wlan_ar6000_pm_device.dev.platform_data = &ar600x_wlan_power;
Santosh Sajjanb479f0f2011-08-18 21:00:44 +0530955 return platform_device_register(&msm_wlan_ar6000_pm_device);
956}
957#else
958static int __init msm7x27a_init_ar6000pm(void) { return 0; }
959#endif
960
Justin Pauporeb3a33b72011-08-23 15:30:32 -0700961static void __init msm7x27a_init_regulators(void)
962{
963 int rc = platform_device_register(&msm_proccomm_regulator_dev);
964 if (rc)
965 pr_err("%s: could not register regulator device: %d\n",
966 __func__, rc);
967}
968
Taniya Dase3027e22012-02-27 16:32:27 +0530969static void __init msm7x27a_add_footswitch_devices(void)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700970{
Trilok Soni16f61af2011-07-26 16:06:58 +0530971 platform_add_devices(msm_footswitch_devices,
972 msm_num_footswitch_devices);
Taniya Dase3027e22012-02-27 16:32:27 +0530973}
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700974
Taniya Dase3027e22012-02-27 16:32:27 +0530975static void __init msm7x27a_add_platform_devices(void)
976{
Aparna Mallavarapu9f000a72012-04-20 15:37:57 +0530977 if (machine_is_msm8625_surf() || machine_is_msm8625_ffa()) {
Taniya Dase3027e22012-02-27 16:32:27 +0530978 platform_add_devices(msm8625_surf_devices,
979 ARRAY_SIZE(msm8625_surf_devices));
980 } else {
981 platform_add_devices(msm7627a_surf_ffa_devices,
982 ARRAY_SIZE(msm7627a_surf_ffa_devices));
983 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700984
Taniya Dase3027e22012-02-27 16:32:27 +0530985 platform_add_devices(common_devices,
986 ARRAY_SIZE(common_devices));
987}
988
989static void __init msm7x27a_uartdm_config(void)
990{
991 msm7x27a_cfg_uart2dm_serial();
992 msm_uart_dm1_pdata.wakeup_irq = gpio_to_irq(UART1DM_RX_GPIO);
993 if (cpu_is_msm8625())
994 msm8625_device_uart_dm1.dev.platform_data =
995 &msm_uart_dm1_pdata;
996 else
997 msm_device_uart_dm1.dev.platform_data = &msm_uart_dm1_pdata;
998}
999
1000static void __init msm7x27a_otg_gadget(void)
1001{
Taniya Dase3027e22012-02-27 16:32:27 +05301002 if (cpu_is_msm8625()) {
Murali Nalajala6ff8fb12012-05-02 18:50:50 +05301003 msm_otg_pdata.swfi_latency =
1004 msm8625_pm_data[MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT].latency;
Taniya Dase3027e22012-02-27 16:32:27 +05301005 msm8625_device_otg.dev.platform_data = &msm_otg_pdata;
1006 msm8625_device_gadget_peripheral.dev.platform_data =
1007 &msm_gadget_pdata;
1008 } else {
Murali Nalajala6ff8fb12012-05-02 18:50:50 +05301009 msm_otg_pdata.swfi_latency =
1010 msm7x27a_pm_data[
1011 MSM_PM_SLEEP_MODE_RAMP_DOWN_AND_WAIT_FOR_INTERRUPT].latency;
Taniya Dase3027e22012-02-27 16:32:27 +05301012 msm_device_otg.dev.platform_data = &msm_otg_pdata;
1013 msm_device_gadget_peripheral.dev.platform_data =
1014 &msm_gadget_pdata;
1015 }
1016}
1017
Taniya Dase3027e22012-02-27 16:32:27 +05301018static void __init msm7x27a_pm_init(void)
1019{
Aparna Mallavarapu9f000a72012-04-20 15:37:57 +05301020 if (machine_is_msm8625_surf() || machine_is_msm8625_ffa()) {
Murali Nalajala8ee084e2012-03-07 00:09:38 +05301021 msm_pm_set_platform_data(msm8625_pm_data,
1022 ARRAY_SIZE(msm8625_pm_data));
1023 BUG_ON(msm_pm_boot_init(&msm_pm_8625_boot_pdata));
1024 msm8x25_spm_device_init();
Murali Nalajalaff723ec2012-07-13 16:54:40 +05301025 msm_pm_register_cpr_ops();
Murali Nalajala8ee084e2012-03-07 00:09:38 +05301026 } else {
1027 msm_pm_set_platform_data(msm7x27a_pm_data,
1028 ARRAY_SIZE(msm7x27a_pm_data));
1029 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
1030 }
Murali Nalajala2a0bbda2012-03-28 12:12:54 +05301031
1032 msm_pm_register_irqs();
Taniya Dase3027e22012-02-27 16:32:27 +05301033}
1034
1035static void __init msm7x2x_init(void)
1036{
1037 msm7x2x_misc_init();
1038
1039 /* Initialize regulators first so that other devices can use them */
1040 msm7x27a_init_regulators();
1041 msm_adsp_add_pdev();
1042 if (cpu_is_msm8625())
1043 msm8625_device_i2c_init();
1044 else
1045 msm7x27a_device_i2c_init();
1046 msm7x27a_init_ebi2();
1047 msm7x27a_uartdm_config();
1048
1049 msm7x27a_otg_gadget();
1050 msm7x27a_cfg_smsc911x();
1051
1052 msm7x27a_add_footswitch_devices();
1053 msm7x27a_add_platform_devices();
1054 /* Ensure ar6000pm device is registered before MMC/SDC */
1055 msm7x27a_init_ar6000pm();
1056 msm7627a_init_mmc();
1057 msm_fb_add_devices();
1058 msm7x2x_init_host();
1059 msm7x27a_pm_init();
1060 register_i2c_devices();
Steve Mucklef132c6c2012-06-06 18:30:57 -07001061#if defined(CONFIG_BT) && defined(CONFIG_MARIMBA_CORE)
Taniya Dase3027e22012-02-27 16:32:27 +05301062 msm7627a_bt_power_init();
Steve Mucklef132c6c2012-06-06 18:30:57 -07001063#endif
Taniya Dase3027e22012-02-27 16:32:27 +05301064 msm7627a_camera_init();
Chintan Pandya0d453192012-03-09 13:20:33 +05301065 msm7627a_add_io_devices();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001066 /*7x25a kgsl initializations*/
1067 msm7x25a_kgsl_3d0_init();
Sudhakara Rao Tentu38ad6e12012-03-30 15:25:18 -07001068 /*8x25 kgsl initializations*/
1069 msm8x25_kgsl_3d0_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001070}
1071
1072static void __init msm7x2x_init_early(void)
1073{
Chintan Pandya250c2e52012-01-19 17:15:49 +05301074 msm_msm7627a_allocate_memory_regions();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001075}
1076
1077MACHINE_START(MSM7X27A_RUMI3, "QCT MSM7x27a RUMI3")
Steve Mucklef132c6c2012-06-06 18:30:57 -07001078 .atag_offset = 0x100,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001079 .map_io = msm_common_io_init,
Trilok Sonib9410792012-04-07 15:37:13 +05301080 .reserve = msm7x27a_reserve,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001081 .init_irq = msm_init_irq,
Trilok Soni16f61af2011-07-26 16:06:58 +05301082 .init_machine = msm7627a_rumi3_init,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001083 .timer = &msm_timer,
1084 .init_early = msm7x2x_init_early,
Taniya Das86e0e132011-10-19 11:32:00 +05301085 .handle_irq = vic_handle_irq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001086MACHINE_END
1087MACHINE_START(MSM7X27A_SURF, "QCT MSM7x27a SURF")
Steve Mucklef132c6c2012-06-06 18:30:57 -07001088 .atag_offset = 0x100,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001089 .map_io = msm_common_io_init,
Trilok Sonib9410792012-04-07 15:37:13 +05301090 .reserve = msm7x27a_reserve,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001091 .init_irq = msm_init_irq,
1092 .init_machine = msm7x2x_init,
1093 .timer = &msm_timer,
1094 .init_early = msm7x2x_init_early,
Taniya Das86e0e132011-10-19 11:32:00 +05301095 .handle_irq = vic_handle_irq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001096MACHINE_END
1097MACHINE_START(MSM7X27A_FFA, "QCT MSM7x27a FFA")
Steve Mucklef132c6c2012-06-06 18:30:57 -07001098 .atag_offset = 0x100,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001099 .map_io = msm_common_io_init,
Trilok Sonib9410792012-04-07 15:37:13 +05301100 .reserve = msm7x27a_reserve,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001101 .init_irq = msm_init_irq,
1102 .init_machine = msm7x2x_init,
1103 .timer = &msm_timer,
1104 .init_early = msm7x2x_init_early,
Taniya Das86e0e132011-10-19 11:32:00 +05301105 .handle_irq = vic_handle_irq,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001106MACHINE_END
Trilok Soni3d0f6c52011-07-26 16:06:58 +05301107MACHINE_START(MSM7625A_SURF, "QCT MSM7625a SURF")
Steve Mucklef132c6c2012-06-06 18:30:57 -07001108 .atag_offset = 0x100,
Trilok Soni3d0f6c52011-07-26 16:06:58 +05301109 .map_io = msm_common_io_init,
Trilok Sonib9410792012-04-07 15:37:13 +05301110 .reserve = msm7x27a_reserve,
Trilok Soni3d0f6c52011-07-26 16:06:58 +05301111 .init_irq = msm_init_irq,
1112 .init_machine = msm7x2x_init,
1113 .timer = &msm_timer,
1114 .init_early = msm7x2x_init_early,
Taniya Das86e0e132011-10-19 11:32:00 +05301115 .handle_irq = vic_handle_irq,
Trilok Soni3d0f6c52011-07-26 16:06:58 +05301116MACHINE_END
1117MACHINE_START(MSM7625A_FFA, "QCT MSM7625a FFA")
Steve Mucklef132c6c2012-06-06 18:30:57 -07001118 .atag_offset = 0x100,
Trilok Soni3d0f6c52011-07-26 16:06:58 +05301119 .map_io = msm_common_io_init,
Trilok Sonib9410792012-04-07 15:37:13 +05301120 .reserve = msm7x27a_reserve,
Trilok Soni3d0f6c52011-07-26 16:06:58 +05301121 .init_irq = msm_init_irq,
1122 .init_machine = msm7x2x_init,
1123 .timer = &msm_timer,
1124 .init_early = msm7x2x_init_early,
Taniya Das86e0e132011-10-19 11:32:00 +05301125 .handle_irq = vic_handle_irq,
Trilok Soni3d0f6c52011-07-26 16:06:58 +05301126MACHINE_END
Taniya Das43bcdd62011-12-02 17:33:27 +05301127MACHINE_START(MSM8625_RUMI3, "QCT MSM8625 RUMI3")
Steve Mucklef132c6c2012-06-06 18:30:57 -07001128 .atag_offset = 0x100,
Taniya Das43bcdd62011-12-02 17:33:27 +05301129 .map_io = msm8625_map_io,
Taniya Das2b16d1d2011-12-02 14:44:19 +05301130 .reserve = msm8625_reserve,
Taniya Das43bcdd62011-12-02 17:33:27 +05301131 .init_irq = msm8625_init_irq,
1132 .init_machine = msm8625_rumi3_init,
1133 .timer = &msm_timer,
1134 .handle_irq = gic_handle_irq,
1135MACHINE_END
Taniya Dase3027e22012-02-27 16:32:27 +05301136MACHINE_START(MSM8625_SURF, "QCT MSM8625 SURF")
Steve Mucklef132c6c2012-06-06 18:30:57 -07001137 .atag_offset = 0x100,
Taniya Dase3027e22012-02-27 16:32:27 +05301138 .map_io = msm8625_map_io,
1139 .reserve = msm8625_reserve,
1140 .init_irq = msm8625_init_irq,
1141 .init_machine = msm7x2x_init,
1142 .timer = &msm_timer,
1143 .init_early = msm7x2x_init_early,
1144 .handle_irq = gic_handle_irq,
1145MACHINE_END
Aparna Mallavarapu9f000a72012-04-20 15:37:57 +05301146MACHINE_START(MSM8625_FFA, "QCT MSM8625 FFA")
Steve Mucklef132c6c2012-06-06 18:30:57 -07001147 .atag_offset = 0x100,
Aparna Mallavarapu9f000a72012-04-20 15:37:57 +05301148 .map_io = msm8625_map_io,
1149 .reserve = msm8625_reserve,
1150 .init_irq = msm8625_init_irq,
1151 .init_machine = msm7x2x_init,
1152 .timer = &msm_timer,
1153 .init_early = msm7x2x_init_early,
1154 .handle_irq = gic_handle_irq,
1155MACHINE_END