blob: e68d5cdd4adefd4e352a1e0d75a927ff22f23e9a [file] [log] [blame]
Manu Gautam5143b252012-01-05 19:25:23 -08001/* Copyright (c) 2011-2012, Code Aurora Forum. All rights reserved.
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -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 */
13#include <linux/kernel.h>
14#include <linux/platform_device.h>
Amit Blay5f968cf2012-01-22 12:04:01 +020015#include <linux/io.h>
Harini Jayaramaneba52672011-09-08 15:13:00 -060016#include <linux/i2c.h>
Sagar Dharia2a5378d2011-12-01 20:00:11 -070017#include <linux/slimbus/slimbus.h>
Kenneth Heitkeaf3d3cf2011-09-08 11:45:31 -070018#include <linux/msm_ssbi.h>
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -060019#include <linux/memblock.h>
Rohit Vaswania6815892011-12-15 20:20:39 -080020#include <linux/usb/android.h>
21#include <linux/usb/msm_hsusb.h>
22#include <linux/mfd/pm8xxx/pm8xxx-adc.h>
23#include <linux/leds.h>
24#include <linux/leds-pm8xxx.h>
25#include <linux/power/ltc4088-charger.h>
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -070026#include <asm/mach-types.h>
27#include <asm/mach/arch.h>
Marc Zyngier89bdafd12011-12-22 11:39:20 +053028#include <asm/hardware/gic.h>
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -070029#include <mach/board.h>
30#include <mach/msm_iomap.h>
31#include <mach/gpio.h>
Harini Jayaraman738c9312011-09-08 15:22:38 -060032#include <mach/msm_spi.h>
Gagan Mac7a827642011-09-22 19:42:21 -060033#include <mach/msm_bus_board.h>
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -070034#include "timer.h"
35#include "devices.h"
David Collinsfb88c432011-08-25 15:12:47 -070036#include "board-9615.h"
Abhijeet Dharmapurikarefaca4f2011-12-27 16:24:07 -080037#include <mach/cpuidle.h>
38#include <mach/pm.h>
Vikram Mulukutlab5e1cda2011-10-04 16:17:22 -070039#include "acpuclock.h"
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -060040#include "pm-boot.h"
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -070041
Siddartha Mohanadoss5f60b452011-10-05 11:49:00 -070042static struct pm8xxx_adc_amux pm8018_adc_channels_data[] = {
43 {"vcoin", CHANNEL_VCOIN, CHAN_PATH_SCALING2, AMUX_RSV1,
44 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
45 {"vbat", CHANNEL_VBAT, CHAN_PATH_SCALING2, AMUX_RSV1,
46 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
47 {"vph_pwr", CHANNEL_VPH_PWR, CHAN_PATH_SCALING2, AMUX_RSV1,
48 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
49 {"batt_therm", CHANNEL_BATT_THERM, CHAN_PATH_SCALING1, AMUX_RSV2,
50 ADC_DECIMATION_TYPE2, ADC_SCALE_BATT_THERM},
51 {"batt_id", CHANNEL_BATT_ID, CHAN_PATH_SCALING1, AMUX_RSV2,
52 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
53 {"pmic_therm", CHANNEL_DIE_TEMP, CHAN_PATH_SCALING1, AMUX_RSV1,
54 ADC_DECIMATION_TYPE2, ADC_SCALE_PMIC_THERM},
55 {"625mv", CHANNEL_625MV, CHAN_PATH_SCALING1, AMUX_RSV1,
56 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
57 {"125v", CHANNEL_125V, CHAN_PATH_SCALING1, AMUX_RSV1,
58 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
59 {"pa_therm0", ADC_MPP_1_AMUX3, CHAN_PATH_SCALING1, AMUX_RSV1,
60 ADC_DECIMATION_TYPE2, ADC_SCALE_PA_THERM},
61};
62
63static struct pm8xxx_adc_properties pm8018_adc_data = {
64 .adc_vdd_reference = 1800, /* milli-voltage for this adc */
65 .bitresolution = 15,
66 .bipolar = 0,
67};
68
69static struct pm8xxx_adc_platform_data pm8018_adc_pdata = {
70 .adc_channel = pm8018_adc_channels_data,
71 .adc_num_board_channel = ARRAY_SIZE(pm8018_adc_channels_data),
72 .adc_prop = &pm8018_adc_data,
73};
74
David Collinsfb88c432011-08-25 15:12:47 -070075static struct pm8xxx_irq_platform_data pm8xxx_irq_pdata __devinitdata = {
76 .irq_base = PM8018_IRQ_BASE,
77 .devirq = MSM_GPIO_TO_INT(87),
78 .irq_trigger_flag = IRQF_TRIGGER_LOW,
79};
80
81static struct pm8xxx_gpio_platform_data pm8xxx_gpio_pdata __devinitdata = {
82 .gpio_base = PM8018_GPIO_PM_TO_SYS(1),
83};
84
85static struct pm8xxx_mpp_platform_data pm8xxx_mpp_pdata __devinitdata = {
86 .mpp_base = PM8018_MPP_PM_TO_SYS(1),
87};
88
89static struct pm8xxx_rtc_platform_data pm8xxx_rtc_pdata __devinitdata = {
90 .rtc_write_enable = false,
Ashay Jaiswaldb5e6dc2011-10-12 11:02:47 +053091 .rtc_alarm_powerup = false,
David Collinsfb88c432011-08-25 15:12:47 -070092};
93
94static struct pm8xxx_pwrkey_platform_data pm8xxx_pwrkey_pdata = {
95 .pull_up = 1,
Jing Lineecdc062011-11-17 09:47:09 -080096 .kpd_trigger_delay_us = 15625,
David Collinsfb88c432011-08-25 15:12:47 -070097 .wakeup = 1,
98};
99
100static struct pm8xxx_misc_platform_data pm8xxx_misc_pdata = {
101 .priority = 0,
102};
103
Jay Chokshieb5d0d52011-09-28 17:16:20 -0700104#define PM8018_LED_KB_MAX_CURRENT 20 /* I = 20mA */
105#define PM8XXX_LED_PWM_PERIOD_US 1000
106
107/**
108 * PM8XXX_PWM_CHANNEL_NONE shall be used when LED shall not be
109 * driven using PWM feature.
110 */
111#define PM8XXX_PWM_CHANNEL_NONE -1
112
113static struct led_info pm8018_led_info[] = {
114 [0] = {
115 .name = "led:kb",
116 },
117};
118
119static struct led_platform_data pm8018_led_core_pdata = {
120 .num_leds = ARRAY_SIZE(pm8018_led_info),
121 .leds = pm8018_led_info,
122};
123
124static struct pm8xxx_led_config pm8018_led_configs[] = {
125 [0] = {
126 .id = PM8XXX_ID_LED_KB_LIGHT,
127 .mode = PM8XXX_LED_MODE_PWM3,
128 .max_current = PM8018_LED_KB_MAX_CURRENT,
129 .pwm_channel = 2,
130 .pwm_period_us = PM8XXX_LED_PWM_PERIOD_US,
131 },
132};
133
134static struct pm8xxx_led_platform_data pm8xxx_leds_pdata = {
135 .led_core = &pm8018_led_core_pdata,
136 .configs = pm8018_led_configs,
137 .num_configs = ARRAY_SIZE(pm8018_led_configs),
138};
139
Jay Chokshidc8028b2011-12-01 16:17:34 -0800140#ifdef CONFIG_LTC4088_CHARGER
141static struct ltc4088_charger_platform_data ltc4088_chg_pdata = {
142 .gpio_mode_select_d0 = 7,
143 .gpio_mode_select_d1 = 6,
144 .gpio_mode_select_d2 = 4,
145};
146#endif
147
David Collinsfb88c432011-08-25 15:12:47 -0700148static struct pm8018_platform_data pm8018_platform_data __devinitdata = {
149 .irq_pdata = &pm8xxx_irq_pdata,
150 .gpio_pdata = &pm8xxx_gpio_pdata,
151 .mpp_pdata = &pm8xxx_mpp_pdata,
152 .rtc_pdata = &pm8xxx_rtc_pdata,
153 .pwrkey_pdata = &pm8xxx_pwrkey_pdata,
154 .misc_pdata = &pm8xxx_misc_pdata,
David Collins00b31e62011-08-31 20:00:10 -0700155 .regulator_pdatas = msm_pm8018_regulator_pdata,
Siddartha Mohanadoss5f60b452011-10-05 11:49:00 -0700156 .adc_pdata = &pm8018_adc_pdata,
Jay Chokshieb5d0d52011-09-28 17:16:20 -0700157 .leds_pdata = &pm8xxx_leds_pdata,
David Collinsfb88c432011-08-25 15:12:47 -0700158};
159
Kenneth Heitkeaf3d3cf2011-09-08 11:45:31 -0700160static struct msm_ssbi_platform_data msm9615_ssbi_pm8018_pdata __devinitdata = {
161 .controller_type = MSM_SBI_CTRL_PMIC_ARBITER,
162 .slave = {
David Collinsfb88c432011-08-25 15:12:47 -0700163 .name = PM8018_CORE_DEV_NAME,
164 .platform_data = &pm8018_platform_data,
Kenneth Heitkeaf3d3cf2011-09-08 11:45:31 -0700165 },
166};
167
David Collinsbea297a2011-09-28 13:11:14 -0700168static struct platform_device msm9615_device_rpm_regulator __devinitdata = {
169 .name = "rpm-regulator",
170 .id = -1,
171 .dev = {
172 .platform_data = &msm_rpm_regulator_9615_pdata,
173 },
174};
175
David Collins0f9942a2011-10-31 09:47:34 -0700176static struct platform_device msm9615_device_ext_2p95v_vreg = {
177 .name = GPIO_REGULATOR_DEV_NAME,
178 .id = 18,
179 .dev = {
180 .platform_data =
181 &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_2P95V],
182 },
183};
184
Maheshkumar Sivasubramanian4923db22011-09-15 09:28:15 -0600185static struct msm_cpuidle_state msm_cstates[] __initdata = {
186 {0, 0, "C0", "WFI",
187 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT},
188
189 {0, 1, "C1", "STANDALONE_POWER_COLLAPSE",
190 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE},
191
192 {0, 2, "C2", "POWER_COLLAPSE",
193 MSM_PM_SLEEP_MODE_POWER_COLLAPSE},
194};
195static struct msm_pm_platform_data msm_pm_data[MSM_PM_SLEEP_MODE_NR] = {
196 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = {
197 .idle_supported = 1,
198 .suspend_supported = 1,
199 .idle_enabled = 0,
200 .suspend_enabled = 0,
201 },
202 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = {
203 .idle_supported = 1,
204 .suspend_supported = 1,
205 .idle_enabled = 0,
206 .suspend_enabled = 0,
207 },
208 [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = {
209 .idle_supported = 1,
210 .suspend_supported = 1,
211 .idle_enabled = 1,
212 .suspend_enabled = 1,
213 },
214};
Krishna Kondadd794462011-10-01 00:19:29 -0700215
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -0600216static struct msm_pm_boot_platform_data msm_pm_boot_pdata __initdata = {
217 .mode = MSM_PM_BOOT_CONFIG_REMAP_BOOT_ADDR,
218 .v_addr = MSM_APCS_GLB_BASE + 0x24,
219};
220
Gagan Mac7a827642011-09-22 19:42:21 -0600221static void __init msm9615_init_buses(void)
222{
223#ifdef CONFIG_MSM_BUS_SCALING
224 msm_bus_rpm_set_mt_mask();
225 msm_bus_9615_sys_fabric_pdata.rpm_enabled = 1;
226 msm_bus_9615_sys_fabric.dev.platform_data =
227 &msm_bus_9615_sys_fabric_pdata;
228 msm_bus_def_fab.dev.platform_data = &msm_bus_9615_def_fab_pdata;
229#endif
230}
231
Sagar Dharia2a5378d2011-12-01 20:00:11 -0700232static struct slim_boardinfo msm_slim_devices[] = {
233 /* add slimbus slaves as needed */
234};
235
Harini Jayaraman738c9312011-09-08 15:22:38 -0600236static struct msm_spi_platform_data msm9615_qup_spi_gsbi3_pdata = {
237 .max_clock_speed = 24000000,
238};
239
Harini Jayaramaneba52672011-09-08 15:13:00 -0600240static struct msm_i2c_platform_data msm9615_i2c_qup_gsbi5_pdata = {
241 .clk_freq = 100000,
242 .src_clk_rate = 24000000,
243};
244
Amit Blay6a8d4f32011-11-21 10:36:25 +0200245#define USB_5V_EN 3
246#define PM_USB_5V_EN PM8018_GPIO_PM_TO_SYS(USB_5V_EN)
247
Mayank Rana8549e632012-01-23 12:49:54 +0530248static int msm_hsusb_vbus_power(bool on)
Amit Blay6a8d4f32011-11-21 10:36:25 +0200249{
Amit Blaya4416f92012-01-24 21:03:52 +0200250 int rc;
Amit Blay6a8d4f32011-11-21 10:36:25 +0200251 struct pm_gpio usb_vbus = {
252 .direction = PM_GPIO_DIR_OUT,
253 .pull = PM_GPIO_PULL_NO,
254 .output_buffer = PM_GPIO_OUT_BUF_CMOS,
Amit Blay6a8d4f32011-11-21 10:36:25 +0200255 .vin_sel = 2,
256 .out_strength = PM_GPIO_STRENGTH_HIGH,
257 .function = PM_GPIO_FUNC_NORMAL,
258 .inv_int_pol = 0,
259 };
260
Amit Blaya4416f92012-01-24 21:03:52 +0200261 usb_vbus.output_value = on;
Amit Blay6a8d4f32011-11-21 10:36:25 +0200262
Amit Blaya4416f92012-01-24 21:03:52 +0200263 rc = pm8xxx_gpio_config(PM_USB_5V_EN, &usb_vbus);
264 if (rc)
265 pr_err("failed to config usb_5v_en gpio\n");
Amit Blay6a8d4f32011-11-21 10:36:25 +0200266
Mayank Rana8549e632012-01-23 12:49:54 +0530267 return rc;
Amit Blay6a8d4f32011-11-21 10:36:25 +0200268}
269
Anji jonnalaa8b8d732011-12-06 10:03:24 +0530270static int shelby_phy_init_seq[] = {
271 0x44, 0x80,/* set VBUS valid threshold and
272 disconnect valid threshold */
273 0x38, 0x81, /* update DC voltage level */
274 0x14, 0x82,/* set preemphasis and rise/fall time */
275 0x13, 0x83,/* set source impedance adjustment */
276 -1};
277
Ofir Cohen40a4e862011-12-08 15:17:52 +0200278#define USB_BAM_PHY_BASE 0x12502000
Ofir Cohen43473c82012-01-25 16:28:13 +0200279#define HSIC_BAM_PHY_BASE 0x12542000
Ofir Cohen40a4e862011-12-08 15:17:52 +0200280#define A2_BAM_PHY_BASE 0x124C2000
281static struct usb_bam_pipe_connect msm_usb_bam_connections[4][2] = {
Ofir Cohen43473c82012-01-25 16:28:13 +0200282#ifndef CONFIG_USB_GADGET_CI13XXX_MSM_HSIC
Ofir Cohen40a4e862011-12-08 15:17:52 +0200283 [0][USB_TO_PEER_PERIPHERAL] = {
284 .src_phy_addr = USB_BAM_PHY_BASE,
285 .src_pipe_index = 11,
286 .dst_phy_addr = A2_BAM_PHY_BASE,
287 .dst_pipe_index = 0,
Ofir Cohen29cd5752011-12-14 17:20:30 +0200288 .data_fifo_base_offset = 0x1100,
289 .data_fifo_size = 0x600,
290 .desc_fifo_base_offset = 0x1700,
Ofir Cohen40a4e862011-12-08 15:17:52 +0200291 .desc_fifo_size = 0x300,
292 },
293 [0][PEER_PERIPHERAL_TO_USB] = {
294 .src_phy_addr = A2_BAM_PHY_BASE,
295 .src_pipe_index = 1,
296 .dst_phy_addr = USB_BAM_PHY_BASE,
297 .dst_pipe_index = 10,
298 .data_fifo_base_offset = 0xa00,
Ofir Cohen29cd5752011-12-14 17:20:30 +0200299 .data_fifo_size = 0x600,
300 .desc_fifo_base_offset = 0x1000,
Ofir Cohen40a4e862011-12-08 15:17:52 +0200301 .desc_fifo_size = 0x100,
302 },
Ofir Cohen43473c82012-01-25 16:28:13 +0200303#else
304 [0][USB_TO_PEER_PERIPHERAL] = {
305 .src_phy_addr = HSIC_BAM_PHY_BASE,
306 .src_pipe_index = 1,
307 .dst_phy_addr = A2_BAM_PHY_BASE,
308 .dst_pipe_index = 0,
309 .data_fifo_base_offset = 0x1100,
310 .data_fifo_size = 0x600,
311 .desc_fifo_base_offset = 0x1700,
312 .desc_fifo_size = 0x300,
313 },
314 [0][PEER_PERIPHERAL_TO_USB] = {
315 .src_phy_addr = A2_BAM_PHY_BASE,
316 .src_pipe_index = 1,
317 .dst_phy_addr = HSIC_BAM_PHY_BASE,
318 .dst_pipe_index = 0,
319 .data_fifo_base_offset = 0xa00,
320 .data_fifo_size = 0x600,
321 .desc_fifo_base_offset = 0x1000,
322 .desc_fifo_size = 0x100,
323 },
324#endif
Anna Perel21515162012-02-02 20:50:02 +0200325 [1][USB_TO_PEER_PERIPHERAL] = {
326 .src_phy_addr = USB_BAM_PHY_BASE,
327 .src_pipe_index = 13,
328 .dst_phy_addr = A2_BAM_PHY_BASE,
329 .dst_pipe_index = 2,
330 .data_fifo_base_offset = 0x2100,
331 .data_fifo_size = 0x600,
332 .desc_fifo_base_offset = 0x2700,
333 .desc_fifo_size = 0x300,
334 },
335 [1][PEER_PERIPHERAL_TO_USB] = {
336 .src_phy_addr = A2_BAM_PHY_BASE,
337 .src_pipe_index = 3,
338 .dst_phy_addr = USB_BAM_PHY_BASE,
339 .dst_pipe_index = 12,
340 .data_fifo_base_offset = 0x1a00,
341 .data_fifo_size = 0x600,
342 .desc_fifo_base_offset = 0x2000,
343 .desc_fifo_size = 0x100,
344 },
345 [2][USB_TO_PEER_PERIPHERAL] = {
346 .src_phy_addr = USB_BAM_PHY_BASE,
347 .src_pipe_index = 15,
348 .dst_phy_addr = A2_BAM_PHY_BASE,
349 .dst_pipe_index = 4,
350 .data_fifo_base_offset = 0x3100,
351 .data_fifo_size = 0x600,
352 .desc_fifo_base_offset = 0x3700,
353 .desc_fifo_size = 0x300,
354 },
355 [2][PEER_PERIPHERAL_TO_USB] = {
356 .src_phy_addr = A2_BAM_PHY_BASE,
357 .src_pipe_index = 5,
358 .dst_phy_addr = USB_BAM_PHY_BASE,
359 .dst_pipe_index = 14,
360 .data_fifo_base_offset = 0x2a00,
361 .data_fifo_size = 0x600,
362 .desc_fifo_base_offset = 0x3000,
363 .desc_fifo_size = 0x100,
364 }
Ofir Cohen40a4e862011-12-08 15:17:52 +0200365};
366
367static struct msm_usb_bam_platform_data msm_usb_bam_pdata = {
368 .connections = &msm_usb_bam_connections[0][0],
Ofir Cohen43473c82012-01-25 16:28:13 +0200369#ifndef CONFIG_USB_GADGET_CI13XXX_MSM_HSIC
370 .usb_active_bam = HSUSB_BAM,
371 .usb_bam_num_pipes = 16,
372#else
373 .usb_active_bam = HSIC_BAM,
374 .usb_bam_num_pipes = 16,
375#endif
Ofir Cohen40a4e862011-12-08 15:17:52 +0200376};
377
Amit Blay5e4ec192011-10-20 09:16:54 +0200378static struct msm_otg_platform_data msm_otg_pdata = {
Amit Blay6a8d4f32011-11-21 10:36:25 +0200379 .mode = USB_OTG,
380 .otg_control = OTG_PHY_CONTROL,
Amit Blay5e4ec192011-10-20 09:16:54 +0200381 .phy_type = SNPS_28NM_INTEGRATED_PHY,
Amit Blay6a8d4f32011-11-21 10:36:25 +0200382 .vbus_power = msm_hsusb_vbus_power,
Ofir Cohen4da266f2012-01-03 10:19:29 +0200383 .disable_reset_on_disconnect = true,
Amit Blay5e4ec192011-10-20 09:16:54 +0200384};
385
Amit Blay5f968cf2012-01-22 12:04:01 +0200386#define PID_MAGIC_ID 0x71432909
387#define SERIAL_NUM_MAGIC_ID 0x61945374
388#define SERIAL_NUMBER_LENGTH 127
389#define DLOAD_USB_BASE_ADD 0x2B0000C8
390
391struct magic_num_struct {
392 uint32_t pid;
393 uint32_t serial_num;
394};
395
396struct dload_struct {
397 uint32_t reserved1;
398 uint32_t reserved2;
399 uint32_t reserved3;
400 uint16_t reserved4;
401 uint16_t pid;
402 char serial_number[SERIAL_NUMBER_LENGTH];
403 uint16_t reserved5;
404 struct magic_num_struct magic_struct;
405};
406
Amit Blay5e4ec192011-10-20 09:16:54 +0200407static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum)
408{
Amit Blay5f968cf2012-01-22 12:04:01 +0200409 struct dload_struct __iomem *dload = 0;
410
411 dload = ioremap(DLOAD_USB_BASE_ADD, sizeof(*dload));
412 if (!dload) {
413 pr_err("%s: cannot remap I/O memory region: %08x\n",
414 __func__, DLOAD_USB_BASE_ADD);
415 return -ENXIO;
416 }
417
418 pr_debug("%s: dload:%p pid:%x serial_num:%s\n",
419 __func__, dload, pid, snum);
420 /* update pid */
421 dload->magic_struct.pid = PID_MAGIC_ID;
422 dload->pid = pid;
423
424 /* update serial number */
425 dload->magic_struct.serial_num = 0;
426 if (!snum) {
427 memset(dload->serial_number, 0, SERIAL_NUMBER_LENGTH);
428 goto out;
429 }
430
431 dload->magic_struct.serial_num = SERIAL_NUM_MAGIC_ID;
432 strlcpy(dload->serial_number, snum, SERIAL_NUMBER_LENGTH);
433out:
434 iounmap(dload);
Amit Blay5e4ec192011-10-20 09:16:54 +0200435 return 0;
436}
437
438static struct android_usb_platform_data android_usb_pdata = {
439 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
440};
441
442static struct platform_device android_usb_device = {
443 .name = "android_usb",
444 .id = -1,
445 .dev = {
446 .platform_data = &android_usb_pdata,
447 },
448};
449
Rohit Vaswani149f0a72011-11-09 15:21:28 -0800450static struct platform_device msm_wlan_ar6000_pm_device = {
451 .name = "wlan_ar6000_pm_dev",
452 .id = -1,
453};
454
455static int __init msm9615_init_ar6000pm(void)
456{
457 return platform_device_register(&msm_wlan_ar6000_pm_device);
458}
459
Jay Chokshidc8028b2011-12-01 16:17:34 -0800460#ifdef CONFIG_LTC4088_CHARGER
461static struct platform_device msm_device_charger = {
462 .name = LTC4088_CHARGER_DEV_NAME,
463 .id = -1,
464 .dev = {
465 .platform_data = &ltc4088_chg_pdata,
466 },
467};
468#endif
469
Amit Blay5e4ec192011-10-20 09:16:54 +0200470static struct platform_device *common_devices[] = {
471 &msm9615_device_dmov,
472 &msm_device_smd,
Jay Chokshidc8028b2011-12-01 16:17:34 -0800473#ifdef CONFIG_LTC4088_CHARGER
474 &msm_device_charger,
475#endif
Amit Blay5e4ec192011-10-20 09:16:54 +0200476 &msm_device_otg,
Ofir Cohen73c99e82012-01-15 13:38:14 +0200477 &msm_device_hsic_peripheral,
Amit Blay5e4ec192011-10-20 09:16:54 +0200478 &msm_device_gadget_peripheral,
Amit Blay6a8d4f32011-11-21 10:36:25 +0200479 &msm_device_hsusb_host,
Ofir Cohen40a4e862011-12-08 15:17:52 +0200480 &msm_device_usb_bam,
Amit Blay5e4ec192011-10-20 09:16:54 +0200481 &android_usb_device,
482 &msm9615_device_uart_gsbi4,
David Collins0f9942a2011-10-31 09:47:34 -0700483 &msm9615_device_ext_2p95v_vreg,
Amit Blay5e4ec192011-10-20 09:16:54 +0200484 &msm9615_device_ssbi_pmic1,
485 &msm9615_device_qup_i2c_gsbi5,
486 &msm9615_device_qup_spi_gsbi3,
487 &msm_device_sps,
Sagar Dharia2a5378d2011-12-01 20:00:11 -0700488 &msm9615_slim_ctrl,
Amit Blay5e4ec192011-10-20 09:16:54 +0200489 &msm9615_device_tsens,
490 &msm_device_nand,
Eric Holmberg0c96e702011-11-08 18:04:31 -0700491 &msm_device_bam_dmux,
Praveen Chidambaram78499012011-11-01 17:15:17 -0600492 &msm9615_rpm_device,
Amit Blay5e4ec192011-10-20 09:16:54 +0200493#ifdef CONFIG_HW_RANDOM_MSM
494 &msm_device_rng,
495#endif
496
497#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
498 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
Ramesh Masavarapuaa28b5b2011-10-21 10:26:03 -0700499 &msm9615_qcrypto_device,
Amit Blay5e4ec192011-10-20 09:16:54 +0200500#endif
501
502#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
503 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
Ramesh Masavarapuaa28b5b2011-10-21 10:26:03 -0700504 &msm9615_qcedev_device,
Amit Blay5e4ec192011-10-20 09:16:54 +0200505#endif
Jeff Ohlstein7e668552011-10-06 16:17:25 -0700506 &msm9615_device_watchdog,
Gagan Mac7a827642011-09-22 19:42:21 -0600507 &msm_bus_9615_sys_fabric,
508 &msm_bus_def_fab,
Praveen Chidambaram78499012011-11-01 17:15:17 -0600509 &msm9615_rpm_log_device,
510 &msm9615_rpm_stat_device,
Amit Blay5e4ec192011-10-20 09:16:54 +0200511};
512
Harini Jayaramaneba52672011-09-08 15:13:00 -0600513static void __init msm9615_i2c_init(void)
514{
515 msm9615_device_qup_i2c_gsbi5.dev.platform_data =
516 &msm9615_i2c_qup_gsbi5_pdata;
517}
518
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -0600519static void __init msm9615_reserve(void)
520{
521 msm_pm_boot_pdata.p_addr = memblock_alloc(SZ_8, SZ_64K);
522}
523
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -0700524static void __init msm9615_common_init(void)
525{
526 msm9615_device_init();
Rohit Vaswania6815892011-12-15 20:20:39 -0800527 msm9615_init_gpiomux();
Harini Jayaramaneba52672011-09-08 15:13:00 -0600528 msm9615_i2c_init();
David Collins00b31e62011-08-31 20:00:10 -0700529 regulator_suppress_info_printing();
David Collinsbea297a2011-09-28 13:11:14 -0700530 platform_device_register(&msm9615_device_rpm_regulator);
Gagan Mac7a827642011-09-22 19:42:21 -0600531 msm_clock_init(&msm9615_clock_init_data);
532 msm9615_init_buses();
Harini Jayaraman738c9312011-09-08 15:22:38 -0600533 msm9615_device_qup_spi_gsbi3.dev.platform_data =
534 &msm9615_qup_spi_gsbi3_pdata;
Kenneth Heitkeaf3d3cf2011-09-08 11:45:31 -0700535 msm9615_device_ssbi_pmic1.dev.platform_data =
536 &msm9615_ssbi_pm8018_pdata;
David Collins00b31e62011-08-31 20:00:10 -0700537 pm8018_platform_data.num_regulators = msm_pm8018_regulator_pdata_len;
Amit Blay5e4ec192011-10-20 09:16:54 +0200538
539 msm_device_otg.dev.platform_data = &msm_otg_pdata;
Anji jonnalaa8b8d732011-12-06 10:03:24 +0530540 msm_otg_pdata.phy_init_seq = shelby_phy_init_seq;
Ofir Cohen40a4e862011-12-08 15:17:52 +0200541 msm_device_usb_bam.dev.platform_data = &msm_usb_bam_pdata;
Rohit Vaswani09666872011-08-23 17:41:54 -0700542 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Krishna Kondadd794462011-10-01 00:19:29 -0700543
Vikram Mulukutlab5e1cda2011-10-04 16:17:22 -0700544 acpuclk_init(&acpuclk_9615_soc_data);
545
Rohit Vaswani149f0a72011-11-09 15:21:28 -0800546 /* Ensure ar6000pm device is registered before MMC/SDC */
547 msm9615_init_ar6000pm();
548
Krishna Kondadd794462011-10-01 00:19:29 -0700549 msm9615_init_mmc();
Sagar Dharia2a5378d2011-12-01 20:00:11 -0700550 slim_register_board_info(msm_slim_devices,
551 ARRAY_SIZE(msm_slim_devices));
Maheshkumar Sivasubramanian4923db22011-09-15 09:28:15 -0600552 msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data));
553 msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ);
554 msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates),
555 msm_pm_data);
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -0600556 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -0700557}
558
559static void __init msm9615_cdp_init(void)
560{
561 msm9615_common_init();
562}
563
564static void __init msm9615_mtp_init(void)
565{
566 msm9615_common_init();
567}
568
569MACHINE_START(MSM9615_CDP, "QCT MSM9615 CDP")
570 .map_io = msm9615_map_io,
571 .init_irq = msm9615_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +0530572 .handle_irq = gic_handle_irq,
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -0700573 .timer = &msm_timer,
574 .init_machine = msm9615_cdp_init,
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -0600575 .reserve = msm9615_reserve,
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -0700576MACHINE_END
577
578MACHINE_START(MSM9615_MTP, "QCT MSM9615 MTP")
579 .map_io = msm9615_map_io,
580 .init_irq = msm9615_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +0530581 .handle_irq = gic_handle_irq,
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -0700582 .timer = &msm_timer,
583 .init_machine = msm9615_mtp_init,
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -0600584 .reserve = msm9615_reserve,
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -0700585MACHINE_END