blob: 9c9ccaa42bb4ee87469f925099a4d26ff3df872e [file] [log] [blame]
Duy Truong790f06d2013-02-13 16:38:12 -08001/* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved.
Taniya Dasc98bfbc2011-08-23 09:58:55 +05302 *
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
13#include <linux/kernel.h>
14#include <linux/init.h>
15#include <linux/gpio_event.h>
Pankaj Kumar6f841742011-10-10 15:52:14 +053016#include <linux/usb/android.h>
Taniya Dasc98bfbc2011-08-23 09:58:55 +053017#include <linux/platform_device.h>
18#include <linux/io.h>
19#include <linux/gpio.h>
20#include <linux/mtd/nand.h>
21#include <linux/mtd/partitions.h>
22#include <linux/i2c.h>
Taniya Dasc98bfbc2011-08-23 09:58:55 +053023#include <linux/bootmem.h>
24#include <linux/mfd/marimba.h>
25#include <linux/power_supply.h>
Trilok Sonib9410792012-04-07 15:37:13 +053026#include <linux/input/rmi_platformdata.h>
27#include <linux/input/rmi_i2c.h>
28#include <linux/i2c/atmel_mxt_ts.h>
Pankaj Kumar3cec0582011-11-18 11:13:29 +053029#include <linux/regulator/consumer.h>
Chintan Pandyaf4ad4002012-02-28 19:49:03 +053030#include <linux/memblock.h>
Mohan Pallaka5afe9852012-01-12 23:12:06 +053031#include <linux/input/ft5x06_ts.h>
Siddartha Mohanadossbc2103f2012-03-20 11:41:48 -070032#include <linux/msm_adc.h>
Steve Muckle75c34ca2012-06-12 14:27:40 -070033#include <linux/regulator/msm-gpio-regulator.h>
Mitchel Humpherysf6fb8112012-09-06 11:35:18 -070034#include <linux/msm_ion.h>
Anirudh Ghayal51a33442012-09-18 16:20:00 +053035#include <linux/i2c-gpio.h>
Anirudh Ghayala11387f2012-09-18 16:42:20 +053036#include <linux/regulator/onsemi-ncp6335d.h>
Taniya Dasc98bfbc2011-08-23 09:58:55 +053037#include <asm/mach/mmc.h>
38#include <asm/mach-types.h>
39#include <asm/mach/arch.h>
Chintan Pandyaf4ad4002012-02-28 19:49:03 +053040#include <asm/hardware/gic.h>
Taniya Dasc98bfbc2011-08-23 09:58:55 +053041#include <mach/board.h>
42#include <mach/msm_iomap.h>
43#include <mach/msm_hsusb.h>
44#include <mach/rpc_hsusb.h>
45#include <mach/rpc_pmapp.h>
46#include <mach/usbdiag.h>
Taniya Dasc98bfbc2011-08-23 09:58:55 +053047#include <mach/msm_memtypes.h>
48#include <mach/msm_serial_hs.h>
Saket Saurabha1e3b482012-10-26 12:19:08 +053049#include <mach/msm_serial_pdata.h>
Taniya Dasc98bfbc2011-08-23 09:58:55 +053050#include <mach/pmic.h>
51#include <mach/socinfo.h>
52#include <mach/vreg.h>
53#include <mach/rpc_pmapp.h>
54#include <mach/msm_battery.h>
55#include <mach/rpc_server_handset.h>
56#include <mach/socinfo.h>
Pankaj Kumar27c02642011-09-22 15:55:55 +053057#include "board-msm7x27a-regulator.h"
Taniya Dasc98bfbc2011-08-23 09:58:55 +053058#include "devices.h"
59#include "devices-msm7x2xa.h"
Matt Wagantall7cca4642012-02-01 16:43:24 -080060#include "pm.h"
Taniya Dasc98bfbc2011-08-23 09:58:55 +053061#include "timer.h"
Murali Nalajalaa1827842011-11-13 14:12:39 +053062#include "pm-boot.h"
Pankaj Kumar3cec0582011-11-18 11:13:29 +053063#include "board-msm7x27a-regulator.h"
Chintan Pandyacf467fc2011-12-01 17:11:11 +053064#include "board-msm7627a.h"
Syed Rameez Mustafa9de46342012-11-30 11:00:08 -080065#include "platsmp.h"
Taniya Dasc98bfbc2011-08-23 09:58:55 +053066
Utsab Bose158d2b32012-09-03 17:59:52 +053067#define RESERVE_KERNEL_EBI1_SIZE 0x3A000
68#define MSM_RESERVE_AUDIO_SIZE 0x1F4000
Trilok Sonib9410792012-04-07 15:37:13 +053069#define BAHAMA_SLAVE_ID_FM_REG 0x02
70#define FM_GPIO 83
71#define BT_PCM_BCLK_MODE 0x88
72#define BT_PCM_DIN_MODE 0x89
73#define BT_PCM_DOUT_MODE 0x8A
74#define BT_PCM_SYNC_MODE 0x8B
75#define FM_I2S_SD_MODE 0x8E
76#define FM_I2S_WS_MODE 0x8F
77#define FM_I2S_SCK_MODE 0x90
78#define I2C_PIN_CTL 0x15
79#define I2C_NORMAL 0x40
80
Manish Dewangan1c0fa492012-08-22 10:33:11 +053081
Taniya Dasc98bfbc2011-08-23 09:58:55 +053082static struct platform_device msm_wlan_ar6000_pm_device = {
83 .name = "wlan_ar6000_pm_dev",
84 .id = -1,
85};
86
Saket Saurabha1e3b482012-10-26 12:19:08 +053087static struct msm_serial_platform_data msm_8625_uart1_pdata = {
88 .userid = 10,
89};
90
Taniya Dasc98bfbc2011-08-23 09:58:55 +053091static struct msm_gpio qup_i2c_gpios_io[] = {
92 { GPIO_CFG(60, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
93 "qup_scl" },
94 { GPIO_CFG(61, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
95 "qup_sda" },
Alok Chauhan4f419512013-01-09 16:23:44 +053096 { GPIO_CFG(131, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA),
Taniya Dasc98bfbc2011-08-23 09:58:55 +053097 "qup_scl" },
Alok Chauhan4f419512013-01-09 16:23:44 +053098 { GPIO_CFG(132, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA),
Taniya Dasc98bfbc2011-08-23 09:58:55 +053099 "qup_sda" },
100};
101
102static struct msm_gpio qup_i2c_gpios_hw[] = {
103 { GPIO_CFG(60, 1, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
104 "qup_scl" },
105 { GPIO_CFG(61, 1, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
106 "qup_sda" },
Alok Chauhan4f419512013-01-09 16:23:44 +0530107 { GPIO_CFG(131, 2, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA),
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530108 "qup_scl" },
Alok Chauhan4f419512013-01-09 16:23:44 +0530109 { GPIO_CFG(132, 2, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA),
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530110 "qup_sda" },
111};
112
113static void gsbi_qup_i2c_gpio_config(int adap_id, int config_type)
114{
115 int rc;
116
117 if (adap_id < 0 || adap_id > 1)
118 return;
119
120 /* Each adapter gets 2 lines from the table */
121 if (config_type)
122 rc = msm_gpios_request_enable(&qup_i2c_gpios_hw[adap_id*2], 2);
123 else
124 rc = msm_gpios_request_enable(&qup_i2c_gpios_io[adap_id*2], 2);
125 if (rc < 0)
126 pr_err("QUP GPIO request/enable failed: %d\n", rc);
127}
128
129static struct msm_i2c_platform_data msm_gsbi0_qup_i2c_pdata = {
130 .clk_freq = 100000,
131 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
132};
133
134static struct msm_i2c_platform_data msm_gsbi1_qup_i2c_pdata = {
135 .clk_freq = 100000,
136 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
137};
138
Mohan Pallaka25d9b3b2012-12-05 16:18:16 +0530139static struct msm_gpio msm8625q_i2c_gpio_config[] = {
Anirudh Ghayal51a33442012-09-18 16:20:00 +0530140 { GPIO_CFG(39, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
141 "qup_scl" },
142 { GPIO_CFG(36, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
143 "qup_sda" },
144};
145
Mohan Pallaka25d9b3b2012-12-05 16:18:16 +0530146static struct i2c_gpio_platform_data msm8625q_i2c_gpio_pdata = {
Anirudh Ghayal51a33442012-09-18 16:20:00 +0530147 .scl_pin = 39,
148 .sda_pin = 36,
149 .udelay = 5, /* 100 Khz */
150};
151
Mohan Pallaka25d9b3b2012-12-05 16:18:16 +0530152static struct platform_device msm8625q_i2c_gpio = {
Anirudh Ghayal51a33442012-09-18 16:20:00 +0530153 .name = "i2c-gpio",
154 .id = 2,
155 .dev = {
Mohan Pallaka25d9b3b2012-12-05 16:18:16 +0530156 .platform_data = &msm8625q_i2c_gpio_pdata,
Anirudh Ghayal51a33442012-09-18 16:20:00 +0530157 }
158};
159
Trilok Sonib9410792012-04-07 15:37:13 +0530160#ifdef CONFIG_ARCH_MSM7X27A
Utsab Bose158d2b32012-09-03 17:59:52 +0530161
162#define MSM_RESERVE_MDP_SIZE 0x1B00000
163#define MSM_RESERVE_ADSP_SIZE 0x1200000
164#define CAMERA_ZSL_SIZE (SZ_1M * 60)
Chintan Pandya43d0a342012-06-08 19:45:56 +0530165
Chintan Pandya43d0a342012-06-08 19:45:56 +0530166#ifdef CONFIG_ION_MSM
Chintan Pandyacb0a07a2012-08-17 13:30:45 +0530167#define MSM_ION_HEAP_NUM 4
Chintan Pandya43d0a342012-06-08 19:45:56 +0530168static struct platform_device ion_dev;
Chintan Pandyacb0a07a2012-08-17 13:30:45 +0530169static int msm_ion_camera_size;
170static int msm_ion_audio_size;
171static int msm_ion_sf_size;
Chintan Pandya43d0a342012-06-08 19:45:56 +0530172#endif
Trilok Sonib9410792012-04-07 15:37:13 +0530173#endif
174
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530175static struct android_usb_platform_data android_usb_pdata = {
Pankaj Kumar6f841742011-10-10 15:52:14 +0530176 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
Rajkumar Raghupathyc9cb2052012-04-26 13:14:10 +0530177 .cdrom = 1,
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530178};
179
180static struct platform_device android_usb_device = {
181 .name = "android_usb",
182 .id = -1,
183 .dev = {
184 .platform_data = &android_usb_pdata,
185 },
186};
187
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530188#ifdef CONFIG_USB_EHCI_MSM_72K
189static void msm_hsusb_vbus_power(unsigned phy_info, int on)
190{
191 int rc = 0;
192 unsigned gpio;
193
Chintan Pandya40762702011-12-06 13:47:06 +0530194 gpio = QRD_GPIO_HOST_VBUS_EN;
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530195
196 rc = gpio_request(gpio, "i2c_host_vbus_en");
197 if (rc < 0) {
198 pr_err("failed to request %d GPIO\n", gpio);
199 return;
200 }
201 gpio_direction_output(gpio, !!on);
202 gpio_set_value_cansleep(gpio, !!on);
203 gpio_free(gpio);
204}
205
206static struct msm_usb_host_platform_data msm_usb_host_pdata = {
207 .phy_info = (USB_PHY_INTEGRATED | USB_PHY_MODEL_45NM),
208};
209
210static void __init msm7627a_init_host(void)
211{
212 msm_add_host(0, &msm_usb_host_pdata);
213}
214#endif
215
216#ifdef CONFIG_USB_MSM_OTG_72K
217static int hsusb_rpc_connect(int connect)
218{
219 if (connect)
220 return msm_hsusb_rpc_connect();
221 else
222 return msm_hsusb_rpc_close();
223}
224
Pankaj Kumar27c02642011-09-22 15:55:55 +0530225static struct regulator *reg_hsusb;
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530226static int msm_hsusb_ldo_init(int init)
227{
Pankaj Kumar27c02642011-09-22 15:55:55 +0530228 int rc = 0;
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530229
Pankaj Kumar27c02642011-09-22 15:55:55 +0530230 if (init) {
231 reg_hsusb = regulator_get(NULL, "usb");
232 if (IS_ERR(reg_hsusb)) {
233 rc = PTR_ERR(reg_hsusb);
234 pr_err("%s: could not get regulator: %d\n",
235 __func__, rc);
236 goto out;
237 }
238
239 rc = regulator_set_voltage(reg_hsusb, 3300000, 3300000);
240 if (rc) {
241 pr_err("%s: could not set voltage: %d\n",
242 __func__, rc);
243 goto reg_free;
244 }
245
246 return 0;
247 }
248 /* else fall through */
249reg_free:
250 regulator_put(reg_hsusb);
251out:
252 reg_hsusb = NULL;
253 return rc;
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530254}
255
256static int msm_hsusb_ldo_enable(int enable)
257{
258 static int ldo_status;
259
Pankaj Kumar27c02642011-09-22 15:55:55 +0530260 if (IS_ERR_OR_NULL(reg_hsusb))
261 return reg_hsusb ? PTR_ERR(reg_hsusb) : -ENODEV;
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530262
263 if (ldo_status == enable)
264 return 0;
265
266 ldo_status = enable;
267
Pankaj Kumar27c02642011-09-22 15:55:55 +0530268 return enable ?
269 regulator_enable(reg_hsusb) :
270 regulator_disable(reg_hsusb);
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530271}
272
273#ifndef CONFIG_USB_EHCI_MSM_72K
274static int msm_hsusb_pmic_notif_init(void (*callback)(int online), int init)
275{
276 int ret = 0;
277
278 if (init)
279 ret = msm_pm_app_rpc_init(callback);
280 else
281 msm_pm_app_rpc_deinit(callback);
282
283 return ret;
284}
285#endif
286
287static struct msm_otg_platform_data msm_otg_pdata = {
288#ifndef CONFIG_USB_EHCI_MSM_72K
289 .pmic_vbus_notif_init = msm_hsusb_pmic_notif_init,
290#else
291 .vbus_power = msm_hsusb_vbus_power,
292#endif
293 .rpc_connect = hsusb_rpc_connect,
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530294 .pemp_level = PRE_EMPHASIS_WITH_20_PERCENT,
295 .cdr_autoreset = CDR_AUTO_RESET_DISABLE,
296 .drv_ampl = HS_DRV_AMPLITUDE_DEFAULT,
297 .se1_gating = SE1_GATING_DISABLE,
298 .ldo_init = msm_hsusb_ldo_init,
299 .ldo_enable = msm_hsusb_ldo_enable,
300 .chg_init = hsusb_chg_init,
301 .chg_connected = hsusb_chg_connected,
302 .chg_vbus_draw = hsusb_chg_vbus_draw,
303};
304#endif
305
306static struct msm_hsusb_gadget_platform_data msm_gadget_pdata = {
307 .is_phy_status_timer_on = 1,
Rajkumar Raghupathyc0e14a42012-09-17 16:35:47 +0530308 .prop_chg = 0,
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530309};
310
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530311#ifdef CONFIG_SERIAL_MSM_HS
312static struct msm_serial_hs_platform_data msm_uart_dm1_pdata = {
313 .inject_rx_on_wakeup = 1,
314 .rx_to_inject = 0xFD,
315};
316#endif
317static struct msm_pm_platform_data msm7627a_pm_data[MSM_PM_SLEEP_MODE_NR] = {
318 [MSM_PM_SLEEP_MODE_POWER_COLLAPSE] = {
319 .idle_supported = 1,
320 .suspend_supported = 1,
321 .idle_enabled = 1,
322 .suspend_enabled = 1,
323 .latency = 16000,
324 .residency = 20000,
325 },
326 [MSM_PM_SLEEP_MODE_POWER_COLLAPSE_NO_XO_SHUTDOWN] = {
327 .idle_supported = 1,
328 .suspend_supported = 1,
329 .idle_enabled = 1,
330 .suspend_enabled = 1,
331 .latency = 12000,
332 .residency = 20000,
333 },
334 [MSM_PM_SLEEP_MODE_RAMP_DOWN_AND_WAIT_FOR_INTERRUPT] = {
335 .idle_supported = 1,
336 .suspend_supported = 1,
337 .idle_enabled = 0,
338 .suspend_enabled = 1,
339 .latency = 2000,
340 .residency = 0,
341 },
342 [MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT] = {
343 .idle_supported = 1,
344 .suspend_supported = 1,
345 .idle_enabled = 1,
346 .suspend_enabled = 1,
347 .latency = 2,
348 .residency = 0,
349 },
350};
351
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -0600352static struct msm_pm_boot_platform_data msm_pm_boot_pdata __initdata = {
Sravan Kumar Ambapuramb22cf4d2012-01-02 21:45:04 +0530353 .mode = MSM_PM_BOOT_CONFIG_RESET_VECTOR_PHYS,
354 .p_addr = 0,
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -0600355};
356
Murali Nalajala4c996be2012-03-12 17:05:41 +0530357/* 8625 PM platform data */
Murali Nalajala28ced1b2012-10-19 13:48:44 +0530358static struct msm_pm_platform_data
359 msm8625_pm_data[MSM_PM_SLEEP_MODE_NR * CONFIG_NR_CPUS] = {
Murali Nalajala4c996be2012-03-12 17:05:41 +0530360 /* CORE0 entries */
361 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
362 .idle_supported = 1,
363 .suspend_supported = 1,
364 .idle_enabled = 0,
365 .suspend_enabled = 0,
366 .latency = 16000,
367 .residency = 20000,
368 },
369
370 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_NO_XO_SHUTDOWN)] = {
371 .idle_supported = 1,
372 .suspend_supported = 1,
373 .idle_enabled = 0,
374 .suspend_enabled = 0,
375 .latency = 12000,
376 .residency = 20000,
377 },
378
379 /* picked latency & redisdency values from 7x30 */
380 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
381 .idle_supported = 1,
382 .suspend_supported = 1,
383 .idle_enabled = 0,
384 .suspend_enabled = 0,
385 .latency = 500,
Krishna Vankad89bcd22012-12-11 10:32:31 +0530386 .residency = 500,
Murali Nalajala4c996be2012-03-12 17:05:41 +0530387 },
388
389 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
390 .idle_supported = 1,
391 .suspend_supported = 1,
392 .idle_enabled = 1,
393 .suspend_enabled = 1,
394 .latency = 2,
395 .residency = 10,
396 },
397
398 /* picked latency & redisdency values from 7x30 */
399 [MSM_PM_MODE(1, 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,
Krishna Vankad89bcd22012-12-11 10:32:31 +0530405 .residency = 500,
Murali Nalajala4c996be2012-03-12 17:05:41 +0530406 },
407
408 [MSM_PM_MODE(1, 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
Murali Nalajala28ced1b2012-10-19 13:48:44 +0530417 /* picked latency & redisdency values from 7x30 */
418 [MSM_PM_MODE(2, 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,
Krishna Vankad89bcd22012-12-11 10:32:31 +0530424 .residency = 500,
Murali Nalajala28ced1b2012-10-19 13:48:44 +0530425 },
426
427 [MSM_PM_MODE(2, 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 /* picked latency & redisdency values from 7x30 */
437 [MSM_PM_MODE(3, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
438 .idle_supported = 1,
439 .suspend_supported = 1,
440 .idle_enabled = 0,
441 .suspend_enabled = 0,
442 .latency = 500,
Krishna Vankad89bcd22012-12-11 10:32:31 +0530443 .residency = 500,
Murali Nalajala28ced1b2012-10-19 13:48:44 +0530444 },
445
446 [MSM_PM_MODE(3, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
447 .idle_supported = 1,
448 .suspend_supported = 1,
449 .idle_enabled = 1,
450 .suspend_enabled = 1,
451 .latency = 2,
452 .residency = 10,
453 },
454
Murali Nalajala4c996be2012-03-12 17:05:41 +0530455};
456
457static struct msm_pm_boot_platform_data msm_pm_8625_boot_pdata __initdata = {
458 .mode = MSM_PM_BOOT_CONFIG_REMAP_BOOT_ADDR,
459 .v_addr = MSM_CFG_CTL_BASE,
460};
461
Utsab Bose158d2b32012-09-03 17:59:52 +0530462static unsigned reserve_mdp_size = MSM_RESERVE_MDP_SIZE;
463static int __init reserve_mdp_size_setup(char *p)
Trilok Sonib9410792012-04-07 15:37:13 +0530464{
Utsab Bose158d2b32012-09-03 17:59:52 +0530465 reserve_mdp_size = memparse(p, NULL);
Trilok Sonib9410792012-04-07 15:37:13 +0530466 return 0;
467}
468
Utsab Bose158d2b32012-09-03 17:59:52 +0530469early_param("reserve_mdp_size", reserve_mdp_size_setup);
Trilok Sonib9410792012-04-07 15:37:13 +0530470
Utsab Bose158d2b32012-09-03 17:59:52 +0530471static unsigned reserve_adsp_size = MSM_RESERVE_ADSP_SIZE;
472static int __init reserve_adsp_size_setup(char *p)
Trilok Sonib9410792012-04-07 15:37:13 +0530473{
Utsab Bose158d2b32012-09-03 17:59:52 +0530474 reserve_adsp_size = memparse(p, NULL);
Trilok Sonib9410792012-04-07 15:37:13 +0530475 return 0;
476}
477
Utsab Bose158d2b32012-09-03 17:59:52 +0530478early_param("reserve_adsp_size", reserve_adsp_size_setup);
Trilok Sonib9410792012-04-07 15:37:13 +0530479
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530480static u32 msm_calculate_batt_capacity(u32 current_voltage);
481
482static struct msm_psy_batt_pdata msm_psy_batt_data = {
Krishna Vankab3778112012-07-16 11:36:12 +0530483 .voltage_min_design = 3500,
Krishna Vanka9a265e12012-06-04 23:24:26 +0530484 .voltage_max_design = 4200,
Krishna Vankab3778112012-07-16 11:36:12 +0530485 .voltage_fail_safe = 3598,
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530486 .avail_chg_sources = AC_CHG | USB_CHG ,
487 .batt_technology = POWER_SUPPLY_TECHNOLOGY_LION,
488 .calculate_capacity = &msm_calculate_batt_capacity,
489};
490
491static u32 msm_calculate_batt_capacity(u32 current_voltage)
492{
493 u32 low_voltage = msm_psy_batt_data.voltage_min_design;
494 u32 high_voltage = msm_psy_batt_data.voltage_max_design;
495
Krishna Vankab3494692012-06-12 15:06:43 +0530496 if (current_voltage <= low_voltage)
497 return 0;
498 else if (current_voltage >= high_voltage)
499 return 100;
500 else
501 return (current_voltage - low_voltage) * 100
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530502 / (high_voltage - low_voltage);
503}
504
505static struct platform_device msm_batt_device = {
506 .name = "msm-battery",
507 .id = -1,
508 .dev.platform_data = &msm_psy_batt_data,
509};
510
Siddartha Mohanadossbc2103f2012-03-20 11:41:48 -0700511static char *msm_adc_surf_device_names[] = {
512 "XO_ADC",
513};
514
515static struct msm_adc_platform_data msm_adc_pdata = {
516 .dev_names = msm_adc_surf_device_names,
517 .num_adc = ARRAY_SIZE(msm_adc_surf_device_names),
518 .target_hw = MSM_8x25,
519};
520
521static struct platform_device msm_adc_device = {
522 .name = "msm_adc",
523 .id = -1,
524 .dev = {
525 .platform_data = &msm_adc_pdata,
526 },
527};
528
Utsab Bose9a341172012-08-07 13:07:28 +0530529#ifdef CONFIG_MSM_RTB
530static struct msm_rtb_platform_data msm7627a_rtb_pdata = {
531 .size = SZ_1M,
532};
533
534static int __init msm_rtb_set_buffer_size(char *p)
535{
536 int s;
537
538 s = memparse(p, NULL);
539 msm7627a_rtb_pdata.size = ALIGN(s, SZ_4K);
540 return 0;
541}
542early_param("msm_rtb_size", msm_rtb_set_buffer_size);
543
544struct platform_device msm7627a_rtb_device = {
545 .name = "msm_rtb",
546 .id = -1,
547 .dev = {
548 .platform_data = &msm7627a_rtb_pdata,
549 },
550};
551#endif
552
Trilok Soni0ed9c4a2012-05-22 17:54:32 +0530553#define GPIO_VREG_INIT(_id, _reg_name, _gpio_label, _gpio, _active_low) \
554 [GPIO_VREG_ID_##_id] = { \
555 .init_data = { \
556 .constraints = { \
557 .valid_ops_mask = REGULATOR_CHANGE_STATUS, \
558 }, \
559 .num_consumer_supplies = \
560 ARRAY_SIZE(vreg_consumers_##_id), \
561 .consumer_supplies = vreg_consumers_##_id, \
562 }, \
563 .regulator_name = _reg_name, \
564 .active_low = _active_low, \
565 .gpio_label = _gpio_label, \
566 .gpio = _gpio, \
567 }
568
569#define GPIO_VREG_ID_EXT_2P85V 0
570#define GPIO_VREG_ID_EXT_1P8V 1
Padmanabhan Komandurue77bcf52012-07-26 12:43:39 +0530571#define GPIO_VREG_ID_EXT_2P85V_SKU3 2
572#define GPIO_VREG_ID_EXT_1P8V_SKU3 3
573#define GPIO_VREG_ID_EXT_1P8V_SKU3_1 4
Trilok Soni0ed9c4a2012-05-22 17:54:32 +0530574
575static struct regulator_consumer_supply vreg_consumers_EXT_2P85V[] = {
Raju P.L.S.S.S.N4d01b2c2012-06-13 20:13:27 +0530576 REGULATOR_SUPPLY("cam_ov5647_avdd", "0-006c"),
577 REGULATOR_SUPPLY("cam_ov7692_avdd", "0-0078"),
578 REGULATOR_SUPPLY("cam_ov8825_avdd", "0-000d"),
Trilok Soni0ed9c4a2012-05-22 17:54:32 +0530579 REGULATOR_SUPPLY("lcd_vdd", "mipi_dsi.1"),
580};
581
582static struct regulator_consumer_supply vreg_consumers_EXT_1P8V[] = {
Raju P.L.S.S.S.N4d01b2c2012-06-13 20:13:27 +0530583 REGULATOR_SUPPLY("cam_ov5647_vdd", "0-006c"),
584 REGULATOR_SUPPLY("cam_ov7692_vdd", "0-0078"),
585 REGULATOR_SUPPLY("cam_ov8825_vdd", "0-000d"),
Trilok Soni0ed9c4a2012-05-22 17:54:32 +0530586 REGULATOR_SUPPLY("lcd_vddi", "mipi_dsi.1"),
587};
588
Padmanabhan Komandurue77bcf52012-07-26 12:43:39 +0530589static struct regulator_consumer_supply vreg_consumers_EXT_2P85V_SKU3[] = {
590 REGULATOR_SUPPLY("cam_ov5647_avdd", "0-006c"),
591 REGULATOR_SUPPLY("cam_ov7692_avdd", "0-0078"),
592 REGULATOR_SUPPLY("cam_ov8825_avdd", "0-000d"),
593 REGULATOR_SUPPLY("lcd_vdd_sku3", "lcdc.0"),
594};
595
596static struct regulator_consumer_supply vreg_consumers_EXT_1P8V_SKU3[] = {
597 REGULATOR_SUPPLY("cam_ov5647_vdd", "0-006c"),
598 REGULATOR_SUPPLY("cam_ov7692_vdd", "0-0078"),
599 REGULATOR_SUPPLY("cam_ov8825_vdd", "0-000d"),
600 REGULATOR_SUPPLY("lcd_vddi_sku3", "lcdc.0"),
601};
602
603static struct regulator_consumer_supply vreg_consumers_EXT_1P8V_SKU3_1[] = {
604 REGULATOR_SUPPLY("cam_ov5647_vdd", "0-006c"),
605 REGULATOR_SUPPLY("cam_ov7692_vdd", "0-0078"),
606 REGULATOR_SUPPLY("cam_ov8825_vdd", "0-000d"),
607 REGULATOR_SUPPLY("lcd_vddi_sku3", "lcdc.0"),
608};
609
Trilok Soni0ed9c4a2012-05-22 17:54:32 +0530610/* GPIO regulator constraints */
611static struct gpio_regulator_platform_data msm_gpio_regulator_pdata[] = {
612 GPIO_VREG_INIT(EXT_2P85V, "ext_2p85v", "ext_2p85v_en", 35, 0),
613 GPIO_VREG_INIT(EXT_1P8V, "ext_1p8v", "ext_1p8v_en", 40, 0),
Padmanabhan Komandurue77bcf52012-07-26 12:43:39 +0530614 GPIO_VREG_INIT(EXT_2P85V_SKU3, "ext_2p85v_sku3", "ext_2p85v_sku3_en",
615 35, 0),
616 GPIO_VREG_INIT(EXT_1P8V_SKU3, "ext_1p8v_sku3", "ext_1p8v_sku3_en",
617 34, 0),
618 GPIO_VREG_INIT(EXT_1P8V_SKU3_1, "ext_1p8v_sku3_1", "ext_1p8v_sku3_1_en",
619 58, 0),
Trilok Soni0ed9c4a2012-05-22 17:54:32 +0530620};
621
622/* GPIO regulator */
Aparna Mallavarapu336c78d2012-07-02 19:43:18 +0530623static struct platform_device qrd_vreg_gpio_ext_2p85v __devinitdata = {
Trilok Soni0ed9c4a2012-05-22 17:54:32 +0530624 .name = GPIO_REGULATOR_DEV_NAME,
625 .id = 35,
626 .dev = {
627 .platform_data =
628 &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_2P85V],
629 },
630};
631
Aparna Mallavarapu336c78d2012-07-02 19:43:18 +0530632static struct platform_device qrd_vreg_gpio_ext_1p8v __devinitdata = {
Trilok Soni0ed9c4a2012-05-22 17:54:32 +0530633 .name = GPIO_REGULATOR_DEV_NAME,
634 .id = 40,
635 .dev = {
636 .platform_data =
637 &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_1P8V],
638 },
639};
640
Padmanabhan Komandurue77bcf52012-07-26 12:43:39 +0530641static struct platform_device qrd_vreg_gpio_ext_2p85v_sku3 __devinitdata = {
642 .name = GPIO_REGULATOR_DEV_NAME,
643 .id = 35,
644 .dev = {
645 .platform_data =
646 &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_2P85V_SKU3],
647 },
648};
649
650static struct platform_device qrd_vreg_gpio_ext_1p8v_sku3 __devinitdata = {
651 .name = GPIO_REGULATOR_DEV_NAME,
652 .id = 34,
653 .dev = {
654 .platform_data =
655 &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_1P8V_SKU3],
656 },
657};
658
659static struct platform_device qrd_vreg_gpio_ext_1p8v_sku3_1 __devinitdata = {
660 .name = GPIO_REGULATOR_DEV_NAME,
661 .id = 58,
662 .dev = {
663 .platform_data =
664 &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_1P8V_SKU3_1],
665 },
666};
667
Anirudh Ghayala11387f2012-09-18 16:42:20 +0530668/* Regulator configuration for the NCP6335D buck */
669struct regulator_consumer_supply ncp6335d_consumer_supplies[] = {
670 REGULATOR_SUPPLY("ncp6335d", NULL),
Trilok Soni4c95bf72012-11-08 14:49:24 +0530671 /* TO DO: NULL entry needs to be fixed once
672 * we fix the cross-dependencies.
673 */
674 REGULATOR_SUPPLY("vddx_cx", NULL),
Anirudh Ghayala11387f2012-09-18 16:42:20 +0530675};
676
677static struct regulator_init_data ncp6335d_init_data = {
678 .constraints = {
679 .name = "ncp6335d_sw",
680 .min_uV = 600000,
681 .max_uV = 1400000,
682 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
683 REGULATOR_CHANGE_STATUS |
684 REGULATOR_CHANGE_MODE,
685 .valid_modes_mask = REGULATOR_MODE_NORMAL |
686 REGULATOR_MODE_FAST,
687 .initial_mode = REGULATOR_MODE_NORMAL,
688 .always_on = 1,
689 },
690 .num_consumer_supplies = ARRAY_SIZE(ncp6335d_consumer_supplies),
691 .consumer_supplies = ncp6335d_consumer_supplies,
692};
693
694static struct ncp6335d_platform_data ncp6335d_pdata = {
695 .init_data = &ncp6335d_init_data,
696 .default_vsel = NCP6335D_VSEL0,
697 .slew_rate_ns = 166,
Anirudh Ghayalc91e7e52012-12-10 11:37:36 +0530698 .sleep_enable = true,
Anirudh Ghayala11387f2012-09-18 16:42:20 +0530699};
700
701static struct i2c_board_info i2c2_info[] __initdata = {
702 {
703 I2C_BOARD_INFO("ncp6335d", 0x38 >> 1),
704 .platform_data = &ncp6335d_pdata,
705 },
706};
707
Chintan Pandyaf4ad4002012-02-28 19:49:03 +0530708static struct platform_device *common_devices[] __initdata = {
709 &android_usb_device,
Chintan Pandyaf4ad4002012-02-28 19:49:03 +0530710 &msm_batt_device,
Trilok Sonib9410792012-04-07 15:37:13 +0530711 &msm_device_adspdec,
712 &msm_device_snd,
Manish Dewangan1c0fa492012-08-22 10:33:11 +0530713 &msm_device_cad,
Chintan Pandyaf4ad4002012-02-28 19:49:03 +0530714 &asoc_msm_pcm,
715 &asoc_msm_dai0,
716 &asoc_msm_dai1,
Siddartha Mohanadossbc2103f2012-03-20 11:41:48 -0700717 &msm_adc_device,
Utsab Bose9a341172012-08-07 13:07:28 +0530718#ifdef CONFIG_MSM_RTB
719 &msm7627a_rtb_device,
720#endif
Chintan Pandya43d0a342012-06-08 19:45:56 +0530721#ifdef CONFIG_ION_MSM
722 &ion_dev,
723#endif
Chintan Pandyaf4ad4002012-02-28 19:49:03 +0530724};
725
726static struct platform_device *qrd7627a_devices[] __initdata = {
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530727 &msm_device_dmov,
728 &msm_device_smd,
729 &msm_device_uart1,
730 &msm_device_uart_dm1,
731 &msm_gsbi0_qup_i2c_device,
732 &msm_gsbi1_qup_i2c_device,
733 &msm_device_otg,
734 &msm_device_gadget_peripheral,
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530735 &msm_kgsl_3d0,
Padmanabhan Komandurue77bcf52012-07-26 12:43:39 +0530736};
737
738static struct platform_device *msm8625_lcd_camera_devices[] __initdata = {
Aparna Mallavarapu336c78d2012-07-02 19:43:18 +0530739 &qrd_vreg_gpio_ext_2p85v,
740 &qrd_vreg_gpio_ext_1p8v,
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530741};
742
Padmanabhan Komandurue77bcf52012-07-26 12:43:39 +0530743static struct platform_device *sku3_lcd_camera_devices[] __initdata = {
744 &qrd_vreg_gpio_ext_2p85v_sku3,
745 &qrd_vreg_gpio_ext_1p8v_sku3,
746};
747
748static struct platform_device *sku3_1_lcd_camera_devices[] __initdata = {
749 &qrd_vreg_gpio_ext_2p85v_sku3,
750 &qrd_vreg_gpio_ext_1p8v_sku3_1,
751};
752
Chintan Pandyab1bad0e2012-02-06 19:04:51 +0530753static struct platform_device *qrd3_devices[] __initdata = {
754 &msm_device_nand,
755};
756
Chintan Pandyaf4ad4002012-02-28 19:49:03 +0530757static struct platform_device *msm8625_evb_devices[] __initdata = {
758 &msm8625_device_dmov,
759 &msm8625_device_smd,
760 &msm8625_gsbi0_qup_i2c_device,
761 &msm8625_gsbi1_qup_i2c_device,
762 &msm8625_device_uart1,
Ram Mohan Korukonda5ee9fb82012-03-09 12:10:01 +0530763 &msm8625_device_uart_dm1,
Chintan Pandyaf4ad4002012-02-28 19:49:03 +0530764 &msm8625_device_otg,
765 &msm8625_device_gadget_peripheral,
Aparna Mallavarapud95d8fc2012-03-08 12:07:37 +0530766 &msm8625_kgsl_3d0,
Chintan Pandyaf4ad4002012-02-28 19:49:03 +0530767};
768
Utsab Bose158d2b32012-09-03 17:59:52 +0530769static unsigned reserve_kernel_ebi1_size = RESERVE_KERNEL_EBI1_SIZE;
770static int __init reserve_kernel_ebi1_size_setup(char *p)
Trilok Sonib9410792012-04-07 15:37:13 +0530771{
Utsab Bose158d2b32012-09-03 17:59:52 +0530772 reserve_kernel_ebi1_size = memparse(p, NULL);
Trilok Sonib9410792012-04-07 15:37:13 +0530773 return 0;
774}
Utsab Bose158d2b32012-09-03 17:59:52 +0530775early_param("reserve_kernel_ebi1_size", reserve_kernel_ebi1_size_setup);
Trilok Sonib9410792012-04-07 15:37:13 +0530776
Utsab Bose158d2b32012-09-03 17:59:52 +0530777
778static unsigned reserve_audio_size = MSM_RESERVE_AUDIO_SIZE;
779static int __init reserve_audio_size_setup(char *p)
Trilok Sonib9410792012-04-07 15:37:13 +0530780{
Utsab Bose158d2b32012-09-03 17:59:52 +0530781 reserve_audio_size = memparse(p, NULL);
Trilok Sonib9410792012-04-07 15:37:13 +0530782 return 0;
783}
Utsab Bose158d2b32012-09-03 17:59:52 +0530784early_param("reserve_audio_size", reserve_audio_size_setup);
Trilok Sonib9410792012-04-07 15:37:13 +0530785
Chintan Pandyacb0a07a2012-08-17 13:30:45 +0530786static void fix_sizes(void)
787{
Chintan Pandyad8413762012-08-17 13:30:45 +0530788 if (get_ddr_size() > SZ_512M)
Utsab Bose158d2b32012-09-03 17:59:52 +0530789 reserve_adsp_size = CAMERA_ZSL_SIZE;
Chintan Pandyacb0a07a2012-08-17 13:30:45 +0530790#ifdef CONFIG_ION_MSM
Utsab Bose158d2b32012-09-03 17:59:52 +0530791 msm_ion_camera_size = reserve_adsp_size;
792 msm_ion_audio_size = (MSM_RESERVE_AUDIO_SIZE +
793 RESERVE_KERNEL_EBI1_SIZE);
794 msm_ion_sf_size = reserve_mdp_size;
Chintan Pandyacb0a07a2012-08-17 13:30:45 +0530795#endif
796}
797
Chintan Pandya43d0a342012-06-08 19:45:56 +0530798#ifdef CONFIG_ION_MSM
799#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
800static struct ion_co_heap_pdata co_ion_pdata = {
801 .adjacent_mem_id = INVALID_HEAP_ID,
802 .align = PAGE_SIZE,
803};
804#endif
805
806/**
807 * These heaps are listed in the order they will be allocated.
808 * Don't swap the order unless you know what you are doing!
809 */
Benjamin Gaignard63d81032012-06-25 15:27:30 -0700810struct ion_platform_heap qrd7627a_heaps[] = {
Chintan Pandya43d0a342012-06-08 19:45:56 +0530811 {
812 .id = ION_SYSTEM_HEAP_ID,
813 .type = ION_HEAP_TYPE_SYSTEM,
814 .name = ION_VMALLOC_HEAP_NAME,
815 },
816#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
Utsab Bose158d2b32012-09-03 17:59:52 +0530817 /* ION_ADSP = CAMERA */
Chintan Pandya43d0a342012-06-08 19:45:56 +0530818 {
819 .id = ION_CAMERA_HEAP_ID,
820 .type = ION_HEAP_TYPE_CARVEOUT,
821 .name = ION_CAMERA_HEAP_NAME,
Chintan Pandya43d0a342012-06-08 19:45:56 +0530822 .memory_type = ION_EBI_TYPE,
Chintan Pandya43d0a342012-06-08 19:45:56 +0530823 .extra_data = (void *)&co_ion_pdata,
824 },
Utsab Bose158d2b32012-09-03 17:59:52 +0530825 /* ION_AUDIO */
Chintan Pandya43d0a342012-06-08 19:45:56 +0530826 {
827 .id = ION_AUDIO_HEAP_ID,
828 .type = ION_HEAP_TYPE_CARVEOUT,
829 .name = ION_AUDIO_HEAP_NAME,
Chintan Pandya43d0a342012-06-08 19:45:56 +0530830 .memory_type = ION_EBI_TYPE,
Chintan Pandya43d0a342012-06-08 19:45:56 +0530831 .extra_data = (void *)&co_ion_pdata,
832 },
Utsab Bose158d2b32012-09-03 17:59:52 +0530833 /* ION_MDP = SF */
Chintan Pandya43d0a342012-06-08 19:45:56 +0530834 {
835 .id = ION_SF_HEAP_ID,
836 .type = ION_HEAP_TYPE_CARVEOUT,
837 .name = ION_SF_HEAP_NAME,
Chintan Pandya43d0a342012-06-08 19:45:56 +0530838 .memory_type = ION_EBI_TYPE,
Chintan Pandya43d0a342012-06-08 19:45:56 +0530839 .extra_data = (void *)&co_ion_pdata,
840 },
841#endif
Benjamin Gaignard63d81032012-06-25 15:27:30 -0700842};
843
844static struct ion_platform_data ion_pdata = {
845 .nr = MSM_ION_HEAP_NUM,
846 .has_outer_cache = 1,
847 .heaps = qrd7627a_heaps,
Chintan Pandya43d0a342012-06-08 19:45:56 +0530848};
849
850static struct platform_device ion_dev = {
851 .name = "ion-msm",
852 .id = 1,
853 .dev = { .platform_data = &ion_pdata },
854};
855#endif
856
Trilok Sonib9410792012-04-07 15:37:13 +0530857static struct memtype_reserve msm7627a_reserve_table[] __initdata = {
858 [MEMTYPE_SMI] = {
859 },
860 [MEMTYPE_EBI0] = {
861 .flags = MEMTYPE_FLAGS_1M_ALIGN,
862 },
863 [MEMTYPE_EBI1] = {
864 .flags = MEMTYPE_FLAGS_1M_ALIGN,
865 },
866};
867
Utsab Bose9a341172012-08-07 13:07:28 +0530868#ifdef CONFIG_MSM_RTB
869static void __init reserve_rtb_memory(void)
870{
871 msm7627a_reserve_table[MEMTYPE_EBI1].size += msm7627a_rtb_pdata.size;
872}
873#else
874static void __init reserve_rtb_memory(void)
875{
876}
877#endif
878
Chintan Pandyacb0a07a2012-08-17 13:30:45 +0530879static void __init size_ion_devices(void)
880{
881#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
882 ion_pdata.heaps[1].size = msm_ion_camera_size;
883 ion_pdata.heaps[2].size = msm_ion_audio_size;
884 ion_pdata.heaps[3].size = msm_ion_sf_size;
885#endif
886}
887
Chintan Pandya43d0a342012-06-08 19:45:56 +0530888static void __init reserve_ion_memory(void)
889{
890#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
Chintan Pandyacb0a07a2012-08-17 13:30:45 +0530891 msm7627a_reserve_table[MEMTYPE_EBI1].size += msm_ion_camera_size;
892 msm7627a_reserve_table[MEMTYPE_EBI1].size += msm_ion_audio_size;
893 msm7627a_reserve_table[MEMTYPE_EBI1].size += msm_ion_sf_size;
Chintan Pandya43d0a342012-06-08 19:45:56 +0530894#endif
Trilok Sonib9410792012-04-07 15:37:13 +0530895}
896
897static void __init msm7627a_calculate_reserve_sizes(void)
898{
Chintan Pandyacb0a07a2012-08-17 13:30:45 +0530899 fix_sizes();
Chintan Pandyacb0a07a2012-08-17 13:30:45 +0530900 size_ion_devices();
Chintan Pandya43d0a342012-06-08 19:45:56 +0530901 reserve_ion_memory();
Utsab Bose9a341172012-08-07 13:07:28 +0530902 reserve_rtb_memory();
Trilok Sonib9410792012-04-07 15:37:13 +0530903}
904
905static int msm7627a_paddr_to_memtype(unsigned int paddr)
906{
907 return MEMTYPE_EBI1;
908}
909
910static struct reserve_info msm7627a_reserve_info __initdata = {
911 .memtype_reserve_table = msm7627a_reserve_table,
912 .calculate_reserve_sizes = msm7627a_calculate_reserve_sizes,
913 .paddr_to_memtype = msm7627a_paddr_to_memtype,
914};
915
916static void __init msm7627a_reserve(void)
917{
918 reserve_info = &msm7627a_reserve_info;
919 msm_reserve();
920 memblock_remove(MSM8625_WARM_BOOT_PHYS, SZ_32);
921}
922
923static void __init msm8625_reserve(void)
924{
Taniya Das46c964e2012-09-24 17:59:14 +0530925 memblock_remove(MSM8625_CPU_PHYS, SZ_8);
Trilok Sonib9410792012-04-07 15:37:13 +0530926 msm7627a_reserve();
927}
928
929static void msmqrd_adsp_add_pdev(void)
930{
931 int rc = 0;
932 struct rpc_board_dev *rpc_adsp_pdev;
933
934 rpc_adsp_pdev = kzalloc(sizeof(struct rpc_board_dev), GFP_KERNEL);
935 if (rpc_adsp_pdev == NULL) {
936 pr_err("%s: Memory Allocation failure\n", __func__);
937 return;
938 }
939 rpc_adsp_pdev->prog = ADSP_RPC_PROG;
940
Utsab Bose4ed4ba12012-11-08 18:52:38 +0530941 if (cpu_is_msm8625() || cpu_is_msm8625q())
Trilok Sonib9410792012-04-07 15:37:13 +0530942 rpc_adsp_pdev->pdev = msm8625_device_adsp;
943 else
944 rpc_adsp_pdev->pdev = msm_adsp_device;
945 rc = msm_rpc_add_board_dev(rpc_adsp_pdev, 1);
946 if (rc < 0) {
947 pr_err("%s: return val: %d\n", __func__, rc);
948 kfree(rpc_adsp_pdev);
949 }
950}
951
Chintan Pandyaf4ad4002012-02-28 19:49:03 +0530952static void __init msm7627a_device_i2c_init(void)
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530953{
954 msm_gsbi0_qup_i2c_device.dev.platform_data = &msm_gsbi0_qup_i2c_pdata;
955 msm_gsbi1_qup_i2c_device.dev.platform_data = &msm_gsbi1_qup_i2c_pdata;
956}
957
Chintan Pandyaf4ad4002012-02-28 19:49:03 +0530958static void __init msm8625_device_i2c_init(void)
959{
Anirudh Ghayal51a33442012-09-18 16:20:00 +0530960 int i, rc;
961
Chintan Pandyaf4ad4002012-02-28 19:49:03 +0530962 msm8625_gsbi0_qup_i2c_device.dev.platform_data
963 = &msm_gsbi0_qup_i2c_pdata;
964 msm8625_gsbi1_qup_i2c_device.dev.platform_data
965 = &msm_gsbi1_qup_i2c_pdata;
Mohan Pallaka25d9b3b2012-12-05 16:18:16 +0530966 if (machine_is_qrd_skud_prime() || cpu_is_msm8625q()) {
967 for (i = 0 ; i < ARRAY_SIZE(msm8625q_i2c_gpio_config); i++) {
968 rc = gpio_tlmm_config(
969 msm8625q_i2c_gpio_config[i].gpio_cfg,
Anirudh Ghayal51a33442012-09-18 16:20:00 +0530970 GPIO_CFG_ENABLE);
971 if (rc)
972 pr_err("I2C-gpio tlmm config failed\n");
973 }
Mohan Pallaka25d9b3b2012-12-05 16:18:16 +0530974 rc = platform_device_register(&msm8625q_i2c_gpio);
975 if (rc)
976 pr_err("%s: could not register i2c-gpio device: %d\n",
977 __func__, rc);
Anirudh Ghayal51a33442012-09-18 16:20:00 +0530978 }
Chintan Pandyaf4ad4002012-02-28 19:49:03 +0530979}
980
Pankaj Kumar3cec0582011-11-18 11:13:29 +0530981static struct platform_device msm_proccomm_regulator_dev = {
982 .name = PROCCOMM_REGULATOR_DEV_NAME,
983 .id = -1,
984 .dev = {
985 .platform_data = &msm7x27a_proccomm_regulator_data
986 }
987};
988
989static void __init msm7627a_init_regulators(void)
990{
991 int rc = platform_device_register(&msm_proccomm_regulator_dev);
992 if (rc)
993 pr_err("%s: could not register regulator device: %d\n",
994 __func__, rc);
995}
996
Santosh Sajjan374d6592012-01-19 23:16:46 +0530997static int __init msm_qrd_init_ar6000pm(void)
998{
999 msm_wlan_ar6000_pm_device.dev.platform_data = &ar600x_wlan_power;
1000 return platform_device_register(&msm_wlan_ar6000_pm_device);
1001}
1002
Taniya Dase380a2d2012-03-09 13:02:41 +05301003static void __init msm_add_footswitch_devices(void)
1004{
1005 platform_add_devices(msm_footswitch_devices,
1006 msm_num_footswitch_devices);
1007}
1008
Stephen Boyd668d7652012-04-25 11:31:01 -07001009static void __init add_platform_devices(void)
Chintan Pandyab1bad0e2012-02-06 19:04:51 +05301010{
Aparna Mallavarapu5a326242012-05-09 19:49:02 +05301011 if (machine_is_msm8625_evb() || machine_is_msm8625_qrd7()
Channagoud Kadabi2bd65c82012-10-12 15:14:23 +05301012 || machine_is_msm8625_evt()
1013 || machine_is_qrd_skud_prime()) {
Saket Saurabha1e3b482012-10-26 12:19:08 +05301014 msm8625_device_uart1.dev.platform_data = &msm_8625_uart1_pdata;
Chintan Pandyaf4ad4002012-02-28 19:49:03 +05301015 platform_add_devices(msm8625_evb_devices,
1016 ARRAY_SIZE(msm8625_evb_devices));
Aparna Mallavarapubeafcbc2012-03-13 16:57:39 +05301017 platform_add_devices(qrd3_devices,
Taniya Dasbd096542012-03-15 17:43:45 +05301018 ARRAY_SIZE(qrd3_devices));
Aparna Mallavarapubeafcbc2012-03-13 16:57:39 +05301019 } else {
Chintan Pandyaf4ad4002012-02-28 19:49:03 +05301020 platform_add_devices(qrd7627a_devices,
1021 ARRAY_SIZE(qrd7627a_devices));
Chintan Pandyaf4ad4002012-02-28 19:49:03 +05301022 }
Taniya Dasbd096542012-03-15 17:43:45 +05301023
Aparna Mallavarapu0b69ca22012-03-26 15:58:35 +05301024 if (machine_is_msm7627a_qrd3() || machine_is_msm7627a_evb())
Taniya Dasbd096542012-03-15 17:43:45 +05301025 platform_add_devices(qrd3_devices,
Aparna Mallavarapu0b69ca22012-03-26 15:58:35 +05301026 ARRAY_SIZE(qrd3_devices));
Taniya Dasbd096542012-03-15 17:43:45 +05301027
Padmanabhan Komandurue77bcf52012-07-26 12:43:39 +05301028 if (machine_is_msm7627a_evb() || machine_is_msm8625_evb()
Channagoud Kadabi2bd65c82012-10-12 15:14:23 +05301029 || machine_is_msm8625_evt()
1030 || machine_is_qrd_skud_prime())
Padmanabhan Komandurue77bcf52012-07-26 12:43:39 +05301031 platform_add_devices(msm8625_lcd_camera_devices,
1032 ARRAY_SIZE(msm8625_lcd_camera_devices));
1033 else if (machine_is_msm8625_qrd7())
1034 platform_add_devices(sku3_1_lcd_camera_devices,
1035 ARRAY_SIZE(sku3_1_lcd_camera_devices));
1036 else if (machine_is_msm7627a_qrd3()) {
1037 u32 socinfo = socinfo_get_platform_type();
1038 if (socinfo == 0x0B)
1039 platform_add_devices(sku3_lcd_camera_devices,
1040 ARRAY_SIZE(sku3_lcd_camera_devices));
1041 else if (socinfo == 0x0F)
1042 platform_add_devices(sku3_1_lcd_camera_devices,
1043 ARRAY_SIZE(sku3_1_lcd_camera_devices));
1044 }
1045
Chintan Pandyaf4ad4002012-02-28 19:49:03 +05301046 platform_add_devices(common_devices,
1047 ARRAY_SIZE(common_devices));
Chintan Pandyab1bad0e2012-02-06 19:04:51 +05301048}
1049
Taniya Dasc98bfbc2011-08-23 09:58:55 +05301050#define UART1DM_RX_GPIO 45
Chintan Pandyaf4ad4002012-02-28 19:49:03 +05301051static void __init qrd7627a_uart1dm_config(void)
1052{
1053 msm_uart_dm1_pdata.wakeup_irq = gpio_to_irq(UART1DM_RX_GPIO);
Utsab Bose4ed4ba12012-11-08 18:52:38 +05301054 if (cpu_is_msm8625() || cpu_is_msm8625q())
Chintan Pandyaf4ad4002012-02-28 19:49:03 +05301055 msm8625_device_uart_dm1.dev.platform_data =
1056 &msm_uart_dm1_pdata;
1057 else
1058 msm_device_uart_dm1.dev.platform_data = &msm_uart_dm1_pdata;
1059}
1060
1061static void __init qrd7627a_otg_gadget(void)
1062{
Utsab Bose4ed4ba12012-11-08 18:52:38 +05301063 if (cpu_is_msm8625() || cpu_is_msm8625q()) {
Murali Nalajala6ff8fb12012-05-02 18:50:50 +05301064 msm_otg_pdata.swfi_latency = msm8625_pm_data
1065 [MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT].latency;
Chintan Pandyaf4ad4002012-02-28 19:49:03 +05301066 msm8625_device_otg.dev.platform_data = &msm_otg_pdata;
1067 msm8625_device_gadget_peripheral.dev.platform_data =
1068 &msm_gadget_pdata;
1069
1070 } else {
Murali Nalajala6ff8fb12012-05-02 18:50:50 +05301071 msm_otg_pdata.swfi_latency = msm7627a_pm_data
1072 [MSM_PM_SLEEP_MODE_RAMP_DOWN_AND_WAIT_FOR_INTERRUPT].latency;
Chintan Pandyaf4ad4002012-02-28 19:49:03 +05301073 msm_device_otg.dev.platform_data = &msm_otg_pdata;
1074 msm_device_gadget_peripheral.dev.platform_data =
1075 &msm_gadget_pdata;
1076 }
1077}
1078
Taniya Dasbd096542012-03-15 17:43:45 +05301079static void __init msm_pm_init(void)
1080{
Taniya Dasbd096542012-03-15 17:43:45 +05301081
Utsab Bose4ed4ba12012-11-08 18:52:38 +05301082 if (!cpu_is_msm8625() && !cpu_is_msm8625q()) {
Taniya Dasbd096542012-03-15 17:43:45 +05301083 msm_pm_set_platform_data(msm7627a_pm_data,
1084 ARRAY_SIZE(msm7627a_pm_data));
1085 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
1086 } else {
1087 msm_pm_set_platform_data(msm8625_pm_data,
1088 ARRAY_SIZE(msm8625_pm_data));
1089 BUG_ON(msm_pm_boot_init(&msm_pm_8625_boot_pdata));
1090 msm8x25_spm_device_init();
Murali Nalajalaff723ec2012-07-13 16:54:40 +05301091 msm_pm_register_cpr_ops();
Taniya Dasbd096542012-03-15 17:43:45 +05301092 }
1093}
1094
Taniya Dasc868a2e2012-01-03 10:18:47 +05301095static void __init msm_qrd_init(void)
Taniya Dasc98bfbc2011-08-23 09:58:55 +05301096{
1097 msm7x2x_misc_init();
Pankaj Kumar3cec0582011-11-18 11:13:29 +05301098 msm7627a_init_regulators();
Trilok Sonib9410792012-04-07 15:37:13 +05301099 msmqrd_adsp_add_pdev();
Taniya Dasc98bfbc2011-08-23 09:58:55 +05301100
Utsab Bose4ed4ba12012-11-08 18:52:38 +05301101 if (cpu_is_msm8625() || cpu_is_msm8625q())
Chintan Pandyaf4ad4002012-02-28 19:49:03 +05301102 msm8625_device_i2c_init();
1103 else
1104 msm7627a_device_i2c_init();
1105
1106 /* uart1dm*/
1107 qrd7627a_uart1dm_config();
1108 /*OTG gadget*/
1109 qrd7627a_otg_gadget();
Taniya Dasc868a2e2012-01-03 10:18:47 +05301110
Taniya Dase380a2d2012-03-09 13:02:41 +05301111 msm_add_footswitch_devices();
Chintan Pandyab1bad0e2012-02-06 19:04:51 +05301112 add_platform_devices();
Taniya Dasc868a2e2012-01-03 10:18:47 +05301113
Santosh Sajjan374d6592012-01-19 23:16:46 +05301114 /* Ensure ar6000pm device is registered before MMC/SDC */
1115 msm_qrd_init_ar6000pm();
Chintan Pandyacf467fc2011-12-01 17:11:11 +05301116 msm7627a_init_mmc();
1117
Taniya Dasc98bfbc2011-08-23 09:58:55 +05301118#ifdef CONFIG_USB_EHCI_MSM_72K
1119 msm7627a_init_host();
1120#endif
Taniya Dasbd096542012-03-15 17:43:45 +05301121 msm_pm_init();
Murali Nalajalaa1827842011-11-13 14:12:39 +05301122
Murali Nalajala2a0bbda2012-03-28 12:12:54 +05301123 msm_pm_register_irqs();
Taniya Das0a5303a2011-08-23 18:47:48 +05301124 msm_fb_add_devices();
Taniya Dasc98bfbc2011-08-23 09:58:55 +05301125
Anirudh Ghayala11387f2012-09-18 16:42:20 +05301126 if (machine_is_qrd_skud_prime())
1127 i2c_register_board_info(2, i2c2_info,
1128 ARRAY_SIZE(i2c2_info));
1129
1130
Taniya Dasc98bfbc2011-08-23 09:58:55 +05301131#if defined(CONFIG_BT) && defined(CONFIG_MARIMBA_CORE)
Chintan Pandya13490c02011-12-20 13:03:36 +05301132 msm7627a_bt_power_init();
Taniya Dasc98bfbc2011-08-23 09:58:55 +05301133#endif
Taniya Dasda408822011-09-06 12:54:06 +05301134
Chintan Pandya40762702011-12-06 13:47:06 +05301135 msm7627a_camera_init();
Chintan Pandya0d453192012-03-09 13:20:33 +05301136 qrd7627a_add_io_devices();
Aparna Mallavarapud95d8fc2012-03-08 12:07:37 +05301137 msm7x25a_kgsl_3d0_init();
Sudhakara Rao Tentu38ad6e12012-03-30 15:25:18 -07001138 msm8x25_kgsl_3d0_init();
Taniya Dasc98bfbc2011-08-23 09:58:55 +05301139}
1140
1141static void __init qrd7627a_init_early(void)
1142{
1143 msm_msm7627a_allocate_memory_regions();
1144}
1145
1146MACHINE_START(MSM7627A_QRD1, "QRD MSM7627a QRD1")
Steve Mucklef132c6c2012-06-06 18:30:57 -07001147 .atag_offset = 0x100,
Taniya Dasc98bfbc2011-08-23 09:58:55 +05301148 .map_io = msm_common_io_init,
Trilok Sonib9410792012-04-07 15:37:13 +05301149 .reserve = msm7627a_reserve,
Taniya Dasc98bfbc2011-08-23 09:58:55 +05301150 .init_irq = msm_init_irq,
Taniya Dasc868a2e2012-01-03 10:18:47 +05301151 .init_machine = msm_qrd_init,
1152 .timer = &msm_timer,
1153 .init_early = qrd7627a_init_early,
1154 .handle_irq = vic_handle_irq,
1155MACHINE_END
Chintan Pandyab1bad0e2012-02-06 19:04:51 +05301156MACHINE_START(MSM7627A_QRD3, "QRD MSM7627a QRD3")
Steve Mucklef132c6c2012-06-06 18:30:57 -07001157 .atag_offset = 0x100,
Chintan Pandyab1bad0e2012-02-06 19:04:51 +05301158 .map_io = msm_common_io_init,
Trilok Sonib9410792012-04-07 15:37:13 +05301159 .reserve = msm7627a_reserve,
Chintan Pandyab1bad0e2012-02-06 19:04:51 +05301160 .init_irq = msm_init_irq,
1161 .init_machine = msm_qrd_init,
1162 .timer = &msm_timer,
1163 .init_early = qrd7627a_init_early,
1164 .handle_irq = vic_handle_irq,
1165MACHINE_END
Taniya Dasc868a2e2012-01-03 10:18:47 +05301166MACHINE_START(MSM7627A_EVB, "QRD MSM7627a EVB")
Steve Mucklef132c6c2012-06-06 18:30:57 -07001167 .atag_offset = 0x100,
Taniya Dasc868a2e2012-01-03 10:18:47 +05301168 .map_io = msm_common_io_init,
Trilok Sonib9410792012-04-07 15:37:13 +05301169 .reserve = msm7627a_reserve,
Taniya Dasc868a2e2012-01-03 10:18:47 +05301170 .init_irq = msm_init_irq,
1171 .init_machine = msm_qrd_init,
Taniya Dasc98bfbc2011-08-23 09:58:55 +05301172 .timer = &msm_timer,
1173 .init_early = qrd7627a_init_early,
Pankaj Kumarbf8a2a32011-10-21 11:47:21 +05301174 .handle_irq = vic_handle_irq,
Taniya Dasc98bfbc2011-08-23 09:58:55 +05301175MACHINE_END
Chintan Pandyaf4ad4002012-02-28 19:49:03 +05301176MACHINE_START(MSM8625_EVB, "QRD MSM8625 EVB")
Steve Mucklef132c6c2012-06-06 18:30:57 -07001177 .atag_offset = 0x100,
Chintan Pandyaf4ad4002012-02-28 19:49:03 +05301178 .map_io = msm8625_map_io,
Trilok Sonib9410792012-04-07 15:37:13 +05301179 .reserve = msm8625_reserve,
Chintan Pandyaf4ad4002012-02-28 19:49:03 +05301180 .init_irq = msm8625_init_irq,
1181 .init_machine = msm_qrd_init,
1182 .timer = &msm_timer,
1183 .init_early = qrd7627a_init_early,
1184 .handle_irq = gic_handle_irq,
Syed Rameez Mustafa9de46342012-11-30 11:00:08 -08001185 .smp = &msm8625_smp_ops,
Chintan Pandyaf4ad4002012-02-28 19:49:03 +05301186MACHINE_END
Taniya Dasbd096542012-03-15 17:43:45 +05301187MACHINE_START(MSM8625_QRD7, "QRD MSM8625 QRD7")
Steve Mucklef132c6c2012-06-06 18:30:57 -07001188 .atag_offset = 0x100,
Taniya Dasbd096542012-03-15 17:43:45 +05301189 .map_io = msm8625_map_io,
Trilok Sonib9410792012-04-07 15:37:13 +05301190 .reserve = msm8625_reserve,
Taniya Dasbd096542012-03-15 17:43:45 +05301191 .init_irq = msm8625_init_irq,
1192 .init_machine = msm_qrd_init,
1193 .timer = &msm_timer,
1194 .init_early = qrd7627a_init_early,
1195 .handle_irq = gic_handle_irq,
Syed Rameez Mustafa9de46342012-11-30 11:00:08 -08001196 .smp = &msm8625_smp_ops,
Taniya Dasbd096542012-03-15 17:43:45 +05301197MACHINE_END
Aparna Mallavarapu5a326242012-05-09 19:49:02 +05301198MACHINE_START(MSM8625_EVT, "QRD MSM8625 EVT")
Steve Mucklef132c6c2012-06-06 18:30:57 -07001199 .atag_offset = 0x100,
Aparna Mallavarapu5a326242012-05-09 19:49:02 +05301200 .map_io = msm8625_map_io,
1201 .reserve = msm8625_reserve,
1202 .init_irq = msm8625_init_irq,
1203 .init_machine = msm_qrd_init,
1204 .timer = &msm_timer,
1205 .init_early = qrd7627a_init_early,
1206 .handle_irq = gic_handle_irq,
Syed Rameez Mustafa9de46342012-11-30 11:00:08 -08001207 .smp = &msm8625_smp_ops,
Aparna Mallavarapu5a326242012-05-09 19:49:02 +05301208MACHINE_END
Channagoud Kadabi2bd65c82012-10-12 15:14:23 +05301209MACHINE_START(QRD_SKUD_PRIME, "QRD MSM8625 SKUD PRIME")
1210 .atag_offset = 0x100,
1211 .map_io = msm8625_map_io,
1212 .reserve = msm8625_reserve,
1213 .init_irq = msm8625_init_irq,
1214 .init_machine = msm_qrd_init,
1215 .timer = &msm_timer,
1216 .init_early = qrd7627a_init_early,
1217 .handle_irq = gic_handle_irq,
Syed Rameez Mustafa9de46342012-11-30 11:00:08 -08001218 .smp = &msm8625_smp_ops,
Channagoud Kadabi2bd65c82012-10-12 15:14:23 +05301219MACHINE_END