blob: 44ba518ae3d4bc6df11c43f3dbc8f718cbc5f6c0 [file] [log] [blame]
Sravan Kumar Ambapuramb22cf4d2012-01-02 21:45:04 +05301/* Copyright (c) 2011-2012, Code Aurora Forum. 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>
23#include <linux/android_pmem.h>
24#include <linux/bootmem.h>
25#include <linux/mfd/marimba.h>
26#include <linux/power_supply.h>
Pankaj Kumar3cec0582011-11-18 11:13:29 +053027#include <linux/regulator/consumer.h>
Chintan Pandyaf4ad4002012-02-28 19:49:03 +053028#include <linux/memblock.h>
Mohan Pallaka5afe9852012-01-12 23:12:06 +053029#include <linux/input/ft5x06_ts.h>
Taniya Dasc98bfbc2011-08-23 09:58:55 +053030#include <asm/mach/mmc.h>
31#include <asm/mach-types.h>
32#include <asm/mach/arch.h>
Chintan Pandyaf4ad4002012-02-28 19:49:03 +053033#include <asm/hardware/gic.h>
Taniya Dasc98bfbc2011-08-23 09:58:55 +053034#include <mach/board.h>
35#include <mach/msm_iomap.h>
36#include <mach/msm_hsusb.h>
37#include <mach/rpc_hsusb.h>
38#include <mach/rpc_pmapp.h>
39#include <mach/usbdiag.h>
Taniya Dasc98bfbc2011-08-23 09:58:55 +053040#include <mach/msm_memtypes.h>
41#include <mach/msm_serial_hs.h>
Taniya Dasc98bfbc2011-08-23 09:58:55 +053042#include <mach/pmic.h>
43#include <mach/socinfo.h>
44#include <mach/vreg.h>
45#include <mach/rpc_pmapp.h>
46#include <mach/msm_battery.h>
47#include <mach/rpc_server_handset.h>
48#include <mach/socinfo.h>
Pankaj Kumar27c02642011-09-22 15:55:55 +053049#include "board-msm7x27a-regulator.h"
Taniya Dasc98bfbc2011-08-23 09:58:55 +053050#include "devices.h"
51#include "devices-msm7x2xa.h"
Matt Wagantall7cca4642012-02-01 16:43:24 -080052#include "pm.h"
Taniya Dasc98bfbc2011-08-23 09:58:55 +053053#include "timer.h"
Murali Nalajalaa1827842011-11-13 14:12:39 +053054#include "pm-boot.h"
Pankaj Kumar3cec0582011-11-18 11:13:29 +053055#include "board-msm7x27a-regulator.h"
Chintan Pandyacf467fc2011-12-01 17:11:11 +053056#include "board-msm7627a.h"
Taniya Dasc98bfbc2011-08-23 09:58:55 +053057
Taniya Dasc98bfbc2011-08-23 09:58:55 +053058static struct platform_device msm_wlan_ar6000_pm_device = {
59 .name = "wlan_ar6000_pm_dev",
60 .id = -1,
61};
62
Taniya Dasc98bfbc2011-08-23 09:58:55 +053063static struct msm_gpio qup_i2c_gpios_io[] = {
64 { GPIO_CFG(60, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
65 "qup_scl" },
66 { GPIO_CFG(61, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
67 "qup_sda" },
68 { GPIO_CFG(131, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
69 "qup_scl" },
70 { GPIO_CFG(132, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
71 "qup_sda" },
72};
73
74static struct msm_gpio qup_i2c_gpios_hw[] = {
75 { GPIO_CFG(60, 1, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
76 "qup_scl" },
77 { GPIO_CFG(61, 1, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
78 "qup_sda" },
79 { GPIO_CFG(131, 2, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
80 "qup_scl" },
81 { GPIO_CFG(132, 2, GPIO_CFG_INPUT, GPIO_CFG_NO_PULL, GPIO_CFG_8MA),
82 "qup_sda" },
83};
84
85static void gsbi_qup_i2c_gpio_config(int adap_id, int config_type)
86{
87 int rc;
88
89 if (adap_id < 0 || adap_id > 1)
90 return;
91
92 /* Each adapter gets 2 lines from the table */
93 if (config_type)
94 rc = msm_gpios_request_enable(&qup_i2c_gpios_hw[adap_id*2], 2);
95 else
96 rc = msm_gpios_request_enable(&qup_i2c_gpios_io[adap_id*2], 2);
97 if (rc < 0)
98 pr_err("QUP GPIO request/enable failed: %d\n", rc);
99}
100
101static struct msm_i2c_platform_data msm_gsbi0_qup_i2c_pdata = {
102 .clk_freq = 100000,
103 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
104};
105
106static struct msm_i2c_platform_data msm_gsbi1_qup_i2c_pdata = {
107 .clk_freq = 100000,
108 .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config,
109};
110
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530111static struct android_usb_platform_data android_usb_pdata = {
Pankaj Kumar6f841742011-10-10 15:52:14 +0530112 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530113};
114
115static struct platform_device android_usb_device = {
116 .name = "android_usb",
117 .id = -1,
118 .dev = {
119 .platform_data = &android_usb_pdata,
120 },
121};
122
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530123#ifdef CONFIG_USB_EHCI_MSM_72K
124static void msm_hsusb_vbus_power(unsigned phy_info, int on)
125{
126 int rc = 0;
127 unsigned gpio;
128
Chintan Pandya40762702011-12-06 13:47:06 +0530129 gpio = QRD_GPIO_HOST_VBUS_EN;
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530130
131 rc = gpio_request(gpio, "i2c_host_vbus_en");
132 if (rc < 0) {
133 pr_err("failed to request %d GPIO\n", gpio);
134 return;
135 }
136 gpio_direction_output(gpio, !!on);
137 gpio_set_value_cansleep(gpio, !!on);
138 gpio_free(gpio);
139}
140
141static struct msm_usb_host_platform_data msm_usb_host_pdata = {
142 .phy_info = (USB_PHY_INTEGRATED | USB_PHY_MODEL_45NM),
143};
144
145static void __init msm7627a_init_host(void)
146{
147 msm_add_host(0, &msm_usb_host_pdata);
148}
149#endif
150
151#ifdef CONFIG_USB_MSM_OTG_72K
152static int hsusb_rpc_connect(int connect)
153{
154 if (connect)
155 return msm_hsusb_rpc_connect();
156 else
157 return msm_hsusb_rpc_close();
158}
159
Pankaj Kumar27c02642011-09-22 15:55:55 +0530160static struct regulator *reg_hsusb;
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530161static int msm_hsusb_ldo_init(int init)
162{
Pankaj Kumar27c02642011-09-22 15:55:55 +0530163 int rc = 0;
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530164
Pankaj Kumar27c02642011-09-22 15:55:55 +0530165 if (init) {
166 reg_hsusb = regulator_get(NULL, "usb");
167 if (IS_ERR(reg_hsusb)) {
168 rc = PTR_ERR(reg_hsusb);
169 pr_err("%s: could not get regulator: %d\n",
170 __func__, rc);
171 goto out;
172 }
173
174 rc = regulator_set_voltage(reg_hsusb, 3300000, 3300000);
175 if (rc) {
176 pr_err("%s: could not set voltage: %d\n",
177 __func__, rc);
178 goto reg_free;
179 }
180
181 return 0;
182 }
183 /* else fall through */
184reg_free:
185 regulator_put(reg_hsusb);
186out:
187 reg_hsusb = NULL;
188 return rc;
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530189}
190
191static int msm_hsusb_ldo_enable(int enable)
192{
193 static int ldo_status;
194
Pankaj Kumar27c02642011-09-22 15:55:55 +0530195 if (IS_ERR_OR_NULL(reg_hsusb))
196 return reg_hsusb ? PTR_ERR(reg_hsusb) : -ENODEV;
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530197
198 if (ldo_status == enable)
199 return 0;
200
201 ldo_status = enable;
202
Pankaj Kumar27c02642011-09-22 15:55:55 +0530203 return enable ?
204 regulator_enable(reg_hsusb) :
205 regulator_disable(reg_hsusb);
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530206}
207
208#ifndef CONFIG_USB_EHCI_MSM_72K
209static int msm_hsusb_pmic_notif_init(void (*callback)(int online), int init)
210{
211 int ret = 0;
212
213 if (init)
214 ret = msm_pm_app_rpc_init(callback);
215 else
216 msm_pm_app_rpc_deinit(callback);
217
218 return ret;
219}
220#endif
221
222static struct msm_otg_platform_data msm_otg_pdata = {
223#ifndef CONFIG_USB_EHCI_MSM_72K
224 .pmic_vbus_notif_init = msm_hsusb_pmic_notif_init,
225#else
226 .vbus_power = msm_hsusb_vbus_power,
227#endif
228 .rpc_connect = hsusb_rpc_connect,
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530229 .pemp_level = PRE_EMPHASIS_WITH_20_PERCENT,
230 .cdr_autoreset = CDR_AUTO_RESET_DISABLE,
231 .drv_ampl = HS_DRV_AMPLITUDE_DEFAULT,
232 .se1_gating = SE1_GATING_DISABLE,
233 .ldo_init = msm_hsusb_ldo_init,
234 .ldo_enable = msm_hsusb_ldo_enable,
235 .chg_init = hsusb_chg_init,
236 .chg_connected = hsusb_chg_connected,
237 .chg_vbus_draw = hsusb_chg_vbus_draw,
238};
239#endif
240
241static struct msm_hsusb_gadget_platform_data msm_gadget_pdata = {
242 .is_phy_status_timer_on = 1,
243};
244
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530245#ifdef CONFIG_SERIAL_MSM_HS
246static struct msm_serial_hs_platform_data msm_uart_dm1_pdata = {
247 .inject_rx_on_wakeup = 1,
248 .rx_to_inject = 0xFD,
249};
250#endif
251static struct msm_pm_platform_data msm7627a_pm_data[MSM_PM_SLEEP_MODE_NR] = {
252 [MSM_PM_SLEEP_MODE_POWER_COLLAPSE] = {
253 .idle_supported = 1,
254 .suspend_supported = 1,
255 .idle_enabled = 1,
256 .suspend_enabled = 1,
257 .latency = 16000,
258 .residency = 20000,
259 },
260 [MSM_PM_SLEEP_MODE_POWER_COLLAPSE_NO_XO_SHUTDOWN] = {
261 .idle_supported = 1,
262 .suspend_supported = 1,
263 .idle_enabled = 1,
264 .suspend_enabled = 1,
265 .latency = 12000,
266 .residency = 20000,
267 },
268 [MSM_PM_SLEEP_MODE_RAMP_DOWN_AND_WAIT_FOR_INTERRUPT] = {
269 .idle_supported = 1,
270 .suspend_supported = 1,
271 .idle_enabled = 0,
272 .suspend_enabled = 1,
273 .latency = 2000,
274 .residency = 0,
275 },
276 [MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT] = {
277 .idle_supported = 1,
278 .suspend_supported = 1,
279 .idle_enabled = 1,
280 .suspend_enabled = 1,
281 .latency = 2,
282 .residency = 0,
283 },
284};
285
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -0600286static struct msm_pm_boot_platform_data msm_pm_boot_pdata __initdata = {
Sravan Kumar Ambapuramb22cf4d2012-01-02 21:45:04 +0530287 .mode = MSM_PM_BOOT_CONFIG_RESET_VECTOR_PHYS,
288 .p_addr = 0,
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -0600289};
290
Murali Nalajala4c996be2012-03-12 17:05:41 +0530291/* 8625 PM platform data */
292static struct msm_pm_platform_data msm8625_pm_data[MSM_PM_SLEEP_MODE_NR * 2] = {
293 /* CORE0 entries */
294 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
295 .idle_supported = 1,
296 .suspend_supported = 1,
297 .idle_enabled = 0,
298 .suspend_enabled = 0,
299 .latency = 16000,
300 .residency = 20000,
301 },
302
303 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_NO_XO_SHUTDOWN)] = {
304 .idle_supported = 1,
305 .suspend_supported = 1,
306 .idle_enabled = 0,
307 .suspend_enabled = 0,
308 .latency = 12000,
309 .residency = 20000,
310 },
311
312 /* picked latency & redisdency values from 7x30 */
313 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
314 .idle_supported = 1,
315 .suspend_supported = 1,
316 .idle_enabled = 0,
317 .suspend_enabled = 0,
318 .latency = 500,
319 .residency = 6000,
320 },
321
322 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
323 .idle_supported = 1,
324 .suspend_supported = 1,
325 .idle_enabled = 1,
326 .suspend_enabled = 1,
327 .latency = 2,
328 .residency = 10,
329 },
330
331 /* picked latency & redisdency values from 7x30 */
332 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
333 .idle_supported = 1,
334 .suspend_supported = 1,
335 .idle_enabled = 0,
336 .suspend_enabled = 0,
337 .latency = 500,
338 .residency = 6000,
339 },
340
341 [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
342 .idle_supported = 1,
343 .suspend_supported = 1,
344 .idle_enabled = 1,
345 .suspend_enabled = 1,
346 .latency = 2,
347 .residency = 10,
348 },
349
350};
351
352static struct msm_pm_boot_platform_data msm_pm_8625_boot_pdata __initdata = {
353 .mode = MSM_PM_BOOT_CONFIG_REMAP_BOOT_ADDR,
354 .v_addr = MSM_CFG_CTL_BASE,
355};
356
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530357static u32 msm_calculate_batt_capacity(u32 current_voltage);
358
359static struct msm_psy_batt_pdata msm_psy_batt_data = {
360 .voltage_min_design = 2800,
361 .voltage_max_design = 4300,
362 .avail_chg_sources = AC_CHG | USB_CHG ,
363 .batt_technology = POWER_SUPPLY_TECHNOLOGY_LION,
364 .calculate_capacity = &msm_calculate_batt_capacity,
365};
366
367static u32 msm_calculate_batt_capacity(u32 current_voltage)
368{
369 u32 low_voltage = msm_psy_batt_data.voltage_min_design;
370 u32 high_voltage = msm_psy_batt_data.voltage_max_design;
371
372 return (current_voltage - low_voltage) * 100
373 / (high_voltage - low_voltage);
374}
375
376static struct platform_device msm_batt_device = {
377 .name = "msm-battery",
378 .id = -1,
379 .dev.platform_data = &msm_psy_batt_data,
380};
381
Chintan Pandyaf4ad4002012-02-28 19:49:03 +0530382static struct platform_device *common_devices[] __initdata = {
383 &android_usb_device,
Chintan Pandyaf4ad4002012-02-28 19:49:03 +0530384 &msm_batt_device,
Chintan Pandyaf4ad4002012-02-28 19:49:03 +0530385 &asoc_msm_pcm,
386 &asoc_msm_dai0,
387 &asoc_msm_dai1,
388};
389
390static struct platform_device *qrd7627a_devices[] __initdata = {
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530391 &msm_device_dmov,
392 &msm_device_smd,
393 &msm_device_uart1,
394 &msm_device_uart_dm1,
395 &msm_gsbi0_qup_i2c_device,
396 &msm_gsbi1_qup_i2c_device,
397 &msm_device_otg,
398 &msm_device_gadget_peripheral,
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530399 &msm_kgsl_3d0,
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530400};
401
Chintan Pandyab1bad0e2012-02-06 19:04:51 +0530402static struct platform_device *qrd3_devices[] __initdata = {
403 &msm_device_nand,
404};
405
Chintan Pandyaf4ad4002012-02-28 19:49:03 +0530406static struct platform_device *msm8625_evb_devices[] __initdata = {
407 &msm8625_device_dmov,
408 &msm8625_device_smd,
409 &msm8625_gsbi0_qup_i2c_device,
410 &msm8625_gsbi1_qup_i2c_device,
411 &msm8625_device_uart1,
Ram Mohan Korukonda5ee9fb82012-03-09 12:10:01 +0530412 &msm8625_device_uart_dm1,
Chintan Pandyaf4ad4002012-02-28 19:49:03 +0530413 &msm8625_device_otg,
414 &msm8625_device_gadget_peripheral,
Aparna Mallavarapud95d8fc2012-03-08 12:07:37 +0530415 &msm8625_kgsl_3d0,
Chintan Pandyaf4ad4002012-02-28 19:49:03 +0530416};
417
Chintan Pandyaf4ad4002012-02-28 19:49:03 +0530418static void __init msm7627a_device_i2c_init(void)
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530419{
420 msm_gsbi0_qup_i2c_device.dev.platform_data = &msm_gsbi0_qup_i2c_pdata;
421 msm_gsbi1_qup_i2c_device.dev.platform_data = &msm_gsbi1_qup_i2c_pdata;
422}
423
Chintan Pandyaf4ad4002012-02-28 19:49:03 +0530424static void __init msm8625_device_i2c_init(void)
425{
426 msm8625_gsbi0_qup_i2c_device.dev.platform_data
427 = &msm_gsbi0_qup_i2c_pdata;
428 msm8625_gsbi1_qup_i2c_device.dev.platform_data
429 = &msm_gsbi1_qup_i2c_pdata;
430}
431
Pankaj Kumar3cec0582011-11-18 11:13:29 +0530432static struct platform_device msm_proccomm_regulator_dev = {
433 .name = PROCCOMM_REGULATOR_DEV_NAME,
434 .id = -1,
435 .dev = {
436 .platform_data = &msm7x27a_proccomm_regulator_data
437 }
438};
439
440static void __init msm7627a_init_regulators(void)
441{
442 int rc = platform_device_register(&msm_proccomm_regulator_dev);
443 if (rc)
444 pr_err("%s: could not register regulator device: %d\n",
445 __func__, rc);
446}
447
Santosh Sajjan374d6592012-01-19 23:16:46 +0530448static int __init msm_qrd_init_ar6000pm(void)
449{
450 msm_wlan_ar6000_pm_device.dev.platform_data = &ar600x_wlan_power;
451 return platform_device_register(&msm_wlan_ar6000_pm_device);
452}
453
Taniya Dase380a2d2012-03-09 13:02:41 +0530454static void __init msm_add_footswitch_devices(void)
455{
456 platform_add_devices(msm_footswitch_devices,
457 msm_num_footswitch_devices);
458}
459
Chintan Pandyab1bad0e2012-02-06 19:04:51 +0530460static void add_platform_devices(void)
461{
Taniya Dasbd096542012-03-15 17:43:45 +0530462 if (machine_is_msm8625_evb() || machine_is_msm8625_qrd7()) {
Chintan Pandyaf4ad4002012-02-28 19:49:03 +0530463 platform_add_devices(msm8625_evb_devices,
464 ARRAY_SIZE(msm8625_evb_devices));
Aparna Mallavarapubeafcbc2012-03-13 16:57:39 +0530465 platform_add_devices(qrd3_devices,
Taniya Dasbd096542012-03-15 17:43:45 +0530466 ARRAY_SIZE(qrd3_devices));
Aparna Mallavarapubeafcbc2012-03-13 16:57:39 +0530467 } else {
Chintan Pandyaf4ad4002012-02-28 19:49:03 +0530468 platform_add_devices(qrd7627a_devices,
469 ARRAY_SIZE(qrd7627a_devices));
Chintan Pandyaf4ad4002012-02-28 19:49:03 +0530470 }
Taniya Dasbd096542012-03-15 17:43:45 +0530471
472 if (machine_is_msm7627a_qrd3())
473 platform_add_devices(qrd3_devices,
474 ARRAY_SIZE(qrd3_devices));
475
Chintan Pandyaf4ad4002012-02-28 19:49:03 +0530476 platform_add_devices(common_devices,
477 ARRAY_SIZE(common_devices));
Chintan Pandyab1bad0e2012-02-06 19:04:51 +0530478}
479
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530480#define UART1DM_RX_GPIO 45
Chintan Pandyaf4ad4002012-02-28 19:49:03 +0530481static void __init qrd7627a_uart1dm_config(void)
482{
483 msm_uart_dm1_pdata.wakeup_irq = gpio_to_irq(UART1DM_RX_GPIO);
484 if (cpu_is_msm8625())
485 msm8625_device_uart_dm1.dev.platform_data =
486 &msm_uart_dm1_pdata;
487 else
488 msm_device_uart_dm1.dev.platform_data = &msm_uart_dm1_pdata;
489}
490
491static void __init qrd7627a_otg_gadget(void)
492{
493 msm_otg_pdata.swfi_latency = msm7627a_pm_data
494 [MSM_PM_SLEEP_MODE_RAMP_DOWN_AND_WAIT_FOR_INTERRUPT].latency;
495
496 if (cpu_is_msm8625()) {
497 msm8625_device_otg.dev.platform_data = &msm_otg_pdata;
498 msm8625_device_gadget_peripheral.dev.platform_data =
499 &msm_gadget_pdata;
500
501 } else {
502 msm_device_otg.dev.platform_data = &msm_otg_pdata;
503 msm_device_gadget_peripheral.dev.platform_data =
504 &msm_gadget_pdata;
505 }
506}
507
Taniya Dasbd096542012-03-15 17:43:45 +0530508static void __init msm_pm_init(void)
509{
Taniya Dasbd096542012-03-15 17:43:45 +0530510
Aparna Mallavarapu6d969eb2012-04-03 15:10:25 +0530511 if (!cpu_is_msm8625()) {
Taniya Dasbd096542012-03-15 17:43:45 +0530512 msm_pm_set_platform_data(msm7627a_pm_data,
513 ARRAY_SIZE(msm7627a_pm_data));
514 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
515 } else {
516 msm_pm_set_platform_data(msm8625_pm_data,
517 ARRAY_SIZE(msm8625_pm_data));
518 BUG_ON(msm_pm_boot_init(&msm_pm_8625_boot_pdata));
519 msm8x25_spm_device_init();
520 }
521}
522
Chintan Pandya12ec56a2012-03-13 15:47:12 +0530523static void __init qrd8625_reserve(void)
524{
525 memblock_remove(MSM8625_SECONDARY_PHYS, SZ_8);
526 qrd7627a_reserve();
527 memblock_remove(MSM8625_WARM_BOOT_PHYS, SZ_32);
528 msm_pm_8625_boot_pdata.p_addr = memblock_alloc(SZ_8, SZ_64K);
529}
530
Taniya Dasc868a2e2012-01-03 10:18:47 +0530531static void __init msm_qrd_init(void)
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530532{
533 msm7x2x_misc_init();
Pankaj Kumar3cec0582011-11-18 11:13:29 +0530534 msm7627a_init_regulators();
Chintan Pandya12ec56a2012-03-13 15:47:12 +0530535 msm_adsp_add_pdev();
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530536
Chintan Pandyaf4ad4002012-02-28 19:49:03 +0530537 if (cpu_is_msm8625())
538 msm8625_device_i2c_init();
539 else
540 msm7627a_device_i2c_init();
541
542 /* uart1dm*/
543 qrd7627a_uart1dm_config();
544 /*OTG gadget*/
545 qrd7627a_otg_gadget();
Taniya Dasc868a2e2012-01-03 10:18:47 +0530546
Taniya Dase380a2d2012-03-09 13:02:41 +0530547 msm_add_footswitch_devices();
Chintan Pandyab1bad0e2012-02-06 19:04:51 +0530548 add_platform_devices();
Taniya Dasc868a2e2012-01-03 10:18:47 +0530549
Santosh Sajjan374d6592012-01-19 23:16:46 +0530550 /* Ensure ar6000pm device is registered before MMC/SDC */
551 msm_qrd_init_ar6000pm();
Chintan Pandyacf467fc2011-12-01 17:11:11 +0530552 msm7627a_init_mmc();
553
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530554#ifdef CONFIG_USB_EHCI_MSM_72K
555 msm7627a_init_host();
556#endif
Taniya Dasbd096542012-03-15 17:43:45 +0530557 msm_pm_init();
Murali Nalajalaa1827842011-11-13 14:12:39 +0530558
Murali Nalajala2a0bbda2012-03-28 12:12:54 +0530559 msm_pm_register_irqs();
Taniya Das0a5303a2011-08-23 18:47:48 +0530560 msm_fb_add_devices();
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530561
562#if defined(CONFIG_BT) && defined(CONFIG_MARIMBA_CORE)
Chintan Pandya13490c02011-12-20 13:03:36 +0530563 msm7627a_bt_power_init();
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530564#endif
Taniya Dasda408822011-09-06 12:54:06 +0530565
Chintan Pandya40762702011-12-06 13:47:06 +0530566 msm7627a_camera_init();
Chintan Pandya0d453192012-03-09 13:20:33 +0530567 qrd7627a_add_io_devices();
Aparna Mallavarapud95d8fc2012-03-08 12:07:37 +0530568 msm7x25a_kgsl_3d0_init();
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530569}
570
571static void __init qrd7627a_init_early(void)
572{
573 msm_msm7627a_allocate_memory_regions();
574}
575
576MACHINE_START(MSM7627A_QRD1, "QRD MSM7627a QRD1")
577 .boot_params = PHYS_OFFSET + 0x100,
578 .map_io = msm_common_io_init,
Chintan Pandya12ec56a2012-03-13 15:47:12 +0530579 .reserve = qrd7627a_reserve,
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530580 .init_irq = msm_init_irq,
Taniya Dasc868a2e2012-01-03 10:18:47 +0530581 .init_machine = msm_qrd_init,
582 .timer = &msm_timer,
583 .init_early = qrd7627a_init_early,
584 .handle_irq = vic_handle_irq,
585MACHINE_END
Chintan Pandyab1bad0e2012-02-06 19:04:51 +0530586MACHINE_START(MSM7627A_QRD3, "QRD MSM7627a QRD3")
587 .boot_params = PHYS_OFFSET + 0x100,
588 .map_io = msm_common_io_init,
Chintan Pandya12ec56a2012-03-13 15:47:12 +0530589 .reserve = qrd7627a_reserve,
Chintan Pandyab1bad0e2012-02-06 19:04:51 +0530590 .init_irq = msm_init_irq,
591 .init_machine = msm_qrd_init,
592 .timer = &msm_timer,
593 .init_early = qrd7627a_init_early,
594 .handle_irq = vic_handle_irq,
595MACHINE_END
Taniya Dasc868a2e2012-01-03 10:18:47 +0530596MACHINE_START(MSM7627A_EVB, "QRD MSM7627a EVB")
597 .boot_params = PHYS_OFFSET + 0x100,
598 .map_io = msm_common_io_init,
Chintan Pandya12ec56a2012-03-13 15:47:12 +0530599 .reserve = qrd7627a_reserve,
Taniya Dasc868a2e2012-01-03 10:18:47 +0530600 .init_irq = msm_init_irq,
601 .init_machine = msm_qrd_init,
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530602 .timer = &msm_timer,
603 .init_early = qrd7627a_init_early,
Pankaj Kumarbf8a2a32011-10-21 11:47:21 +0530604 .handle_irq = vic_handle_irq,
Taniya Dasc98bfbc2011-08-23 09:58:55 +0530605MACHINE_END
Chintan Pandyaf4ad4002012-02-28 19:49:03 +0530606MACHINE_START(MSM8625_EVB, "QRD MSM8625 EVB")
607 .boot_params = PHYS_OFFSET + 0x100,
608 .map_io = msm8625_map_io,
Chintan Pandya12ec56a2012-03-13 15:47:12 +0530609 .reserve = qrd8625_reserve,
Chintan Pandyaf4ad4002012-02-28 19:49:03 +0530610 .init_irq = msm8625_init_irq,
611 .init_machine = msm_qrd_init,
612 .timer = &msm_timer,
613 .init_early = qrd7627a_init_early,
614 .handle_irq = gic_handle_irq,
615MACHINE_END
Taniya Dasbd096542012-03-15 17:43:45 +0530616MACHINE_START(MSM8625_QRD7, "QRD MSM8625 QRD7")
617 .boot_params = PHYS_OFFSET + 0x100,
618 .map_io = msm8625_map_io,
Chintan Pandya12ec56a2012-03-13 15:47:12 +0530619 .reserve = qrd8625_reserve,
Taniya Dasbd096542012-03-15 17:43:45 +0530620 .init_irq = msm8625_init_irq,
621 .init_machine = msm_qrd_init,
622 .timer = &msm_timer,
623 .init_early = qrd7627a_init_early,
624 .handle_irq = gic_handle_irq,
625MACHINE_END