blob: 6266d92b48b43b5b02342547827b1f4c849e53f3 [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>
Shiv Maliyappanahalli9ec55e92012-01-09 14:44:59 -080018#ifdef CONFIG_WCD9310_CODEC
19#include <linux/mfd/wcd9xxx/core.h>
20#include <linux/mfd/wcd9xxx/pdata.h>
21#endif
Kenneth Heitkeaf3d3cf2011-09-08 11:45:31 -070022#include <linux/msm_ssbi.h>
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -060023#include <linux/memblock.h>
Rohit Vaswania6815892011-12-15 20:20:39 -080024#include <linux/usb/android.h>
25#include <linux/usb/msm_hsusb.h>
26#include <linux/mfd/pm8xxx/pm8xxx-adc.h>
27#include <linux/leds.h>
28#include <linux/leds-pm8xxx.h>
29#include <linux/power/ltc4088-charger.h>
Steve Mucklef132c6c2012-06-06 18:30:57 -070030#include <linux/gpio.h>
Siddartha Mohanadoss7e25dc12012-03-19 11:19:27 -070031#include <linux/msm_tsens.h>
Mitchel Humpherysc7fb35f2012-09-06 11:34:35 -070032#include <linux/msm_ion.h>
Olav Haugane6a0acd2012-04-05 09:29:12 -070033#include <linux/memory.h>
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -070034#include <asm/mach-types.h>
35#include <asm/mach/arch.h>
Marc Zyngier89bdafd12011-12-22 11:39:20 +053036#include <asm/hardware/gic.h>
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -070037#include <mach/board.h>
38#include <mach/msm_iomap.h>
Shiv Maliyappanahalli9ec55e92012-01-09 14:44:59 -080039#include <mach/socinfo.h>
Harini Jayaraman738c9312011-09-08 15:22:38 -060040#include <mach/msm_spi.h>
Gagan Mac7a827642011-09-22 19:42:21 -060041#include <mach/msm_bus_board.h>
Vikram Mulukutla2021c002011-12-16 12:32:59 -080042#include <mach/msm_xo.h>
Shiv Maliyappanahalli9ec55e92012-01-09 14:44:59 -080043#include <mach/dma.h>
Olav Haugane6a0acd2012-04-05 09:29:12 -070044#include <mach/ion.h>
45#include <mach/msm_memtypes.h>
Amit Blaye5bb35e2012-05-08 20:38:20 +030046#include <mach/cpuidle.h>
47#include <mach/usb_bam.h>
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -070048#include <mach/restart.h>
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -070049#include "timer.h"
50#include "devices.h"
David Collinsfb88c432011-08-25 15:12:47 -070051#include "board-9615.h"
Matt Wagantall7cca4642012-02-01 16:43:24 -080052#include "pm.h"
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -060053#include "pm-boot.h"
Venkat Sudhir5efc4912012-05-15 17:10:35 -070054#include <mach/gpiomux.h>
Ido Shayevitz479f2eb2012-06-27 10:39:57 +030055#include "ci13xxx_udc.h"
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -070056
Olav Haugane6a0acd2012-04-05 09:29:12 -070057#ifdef CONFIG_ION_MSM
58#define MSM_ION_AUDIO_SIZE 0xAF000
59#define MSM_ION_HEAP_NUM 3
60#define MSM_KERNEL_EBI_SIZE 0x51000
61
62static struct memtype_reserve msm9615_reserve_table[] __initdata = {
63 [MEMTYPE_SMI] = {
64 },
65 [MEMTYPE_EBI0] = {
66 .flags = MEMTYPE_FLAGS_1M_ALIGN,
67 },
68 [MEMTYPE_EBI1] = {
69 .flags = MEMTYPE_FLAGS_1M_ALIGN,
70 },
71};
72
73static int msm9615_paddr_to_memtype(unsigned int paddr)
74{
75 return MEMTYPE_EBI1;
76}
77
78static struct ion_co_heap_pdata co_ion_pdata = {
79 .adjacent_mem_id = INVALID_HEAP_ID,
80 .align = PAGE_SIZE,
81};
82
Benjamin Gaignardb2d367c2012-06-25 15:27:30 -070083static struct ion_platform_heap msm9615_heaps[] = {
Olav Haugane6a0acd2012-04-05 09:29:12 -070084 {
85 .id = ION_SYSTEM_HEAP_ID,
86 .type = ION_HEAP_TYPE_SYSTEM,
87 .name = ION_VMALLOC_HEAP_NAME,
88 },
89 {
90 .id = ION_IOMMU_HEAP_ID,
91 .type = ION_HEAP_TYPE_IOMMU,
92 .name = ION_IOMMU_HEAP_NAME,
93 },
94 {
95 .id = ION_AUDIO_HEAP_ID,
96 .type = ION_HEAP_TYPE_CARVEOUT,
97 .name = ION_AUDIO_HEAP_NAME,
98 .size = MSM_ION_AUDIO_SIZE,
99 .memory_type = ION_EBI_TYPE,
100 .extra_data = (void *) &co_ion_pdata,
101 },
Benjamin Gaignardb2d367c2012-06-25 15:27:30 -0700102};
103
104static struct ion_platform_data ion_pdata = {
105 .nr = MSM_ION_HEAP_NUM,
106 .heaps = msm9615_heaps,
Olav Haugane6a0acd2012-04-05 09:29:12 -0700107};
108
109static struct platform_device ion_dev = {
110 .name = "ion-msm",
111 .id = 1,
112 .dev = { .platform_data = &ion_pdata },
113};
114
Stephen Boyd668d7652012-04-25 11:31:01 -0700115static void __init reserve_ion_memory(void)
Olav Haugane6a0acd2012-04-05 09:29:12 -0700116{
117 msm9615_reserve_table[MEMTYPE_EBI1].size += MSM_ION_AUDIO_SIZE;
118}
119
120static void __init msm9615_calculate_reserve_sizes(void)
121{
122 reserve_ion_memory();
123 msm9615_reserve_table[MEMTYPE_EBI1].size += MSM_KERNEL_EBI_SIZE;
124}
125
126static struct reserve_info msm9615_reserve_info __initdata = {
127 .memtype_reserve_table = msm9615_reserve_table,
128 .calculate_reserve_sizes = msm9615_calculate_reserve_sizes,
129 .paddr_to_memtype = msm9615_paddr_to_memtype,
130};
131#endif
132
Jay Chokshi215f7be2012-02-09 18:30:44 -0800133struct pm8xxx_gpio_init {
134 unsigned gpio;
135 struct pm_gpio config;
136};
137
138struct pm8xxx_mpp_init {
139 unsigned mpp;
140 struct pm8xxx_mpp_config_data config;
141};
142
143#define PM8018_GPIO_INIT(_gpio, _dir, _buf, _val, _pull, _vin, _out_strength, \
144 _func, _inv, _disable) \
145{ \
146 .gpio = PM8018_GPIO_PM_TO_SYS(_gpio), \
147 .config = { \
148 .direction = _dir, \
149 .output_buffer = _buf, \
150 .output_value = _val, \
151 .pull = _pull, \
152 .vin_sel = _vin, \
153 .out_strength = _out_strength, \
154 .function = _func, \
155 .inv_int_pol = _inv, \
156 .disable_pin = _disable, \
157 } \
158}
159
160#define PM8018_MPP_INIT(_mpp, _type, _level, _control) \
161{ \
162 .mpp = PM8018_MPP_PM_TO_SYS(_mpp), \
163 .config = { \
164 .type = PM8XXX_MPP_TYPE_##_type, \
165 .level = _level, \
166 .control = PM8XXX_MPP_##_control, \
167 } \
168}
169
170#define PM8018_GPIO_DISABLE(_gpio) \
171 PM8018_GPIO_INIT(_gpio, PM_GPIO_DIR_IN, 0, 0, 0, PM8018_GPIO_VIN_S3, \
172 0, 0, 0, 1)
173
174#define PM8018_GPIO_OUTPUT(_gpio, _val, _strength) \
175 PM8018_GPIO_INIT(_gpio, PM_GPIO_DIR_OUT, PM_GPIO_OUT_BUF_CMOS, _val, \
176 PM_GPIO_PULL_NO, PM8018_GPIO_VIN_S3, \
177 PM_GPIO_STRENGTH_##_strength, \
178 PM_GPIO_FUNC_NORMAL, 0, 0)
179
180#define PM8018_GPIO_INPUT(_gpio, _pull) \
181 PM8018_GPIO_INIT(_gpio, PM_GPIO_DIR_IN, PM_GPIO_OUT_BUF_CMOS, 0, \
182 _pull, PM8018_GPIO_VIN_S3, \
183 PM_GPIO_STRENGTH_NO, \
184 PM_GPIO_FUNC_NORMAL, 0, 0)
185
186#define PM8018_GPIO_OUTPUT_FUNC(_gpio, _val, _func) \
187 PM8018_GPIO_INIT(_gpio, PM_GPIO_DIR_OUT, PM_GPIO_OUT_BUF_CMOS, _val, \
188 PM_GPIO_PULL_NO, PM8018_GPIO_VIN_S3, \
189 PM_GPIO_STRENGTH_HIGH, \
190 _func, 0, 0)
191
192#define PM8018_GPIO_OUTPUT_VIN(_gpio, _val, _vin) \
193 PM8018_GPIO_INIT(_gpio, PM_GPIO_DIR_OUT, PM_GPIO_OUT_BUF_CMOS, _val, \
194 PM_GPIO_PULL_NO, _vin, \
195 PM_GPIO_STRENGTH_HIGH, \
196 PM_GPIO_FUNC_NORMAL, 0, 0)
197
198/* Initial PM8018 GPIO configurations */
199static struct pm8xxx_gpio_init pm8018_gpios[] __initdata = {
Pavan Kumar8eb05b32012-06-27 17:39:15 -0700200 PM8018_GPIO_OUTPUT(2, 0, HIGH), /* EXT_LDO_EN_WLAN */
201 PM8018_GPIO_OUTPUT(6, 0, LOW), /* WLAN_CLK_PWR_REQ */
Jay Chokshi215f7be2012-02-09 18:30:44 -0800202};
203
204/* Initial PM8018 MPP configurations */
205static struct pm8xxx_mpp_init pm8018_mpps[] __initdata = {
206};
207
208void __init msm9615_pm8xxx_gpio_mpp_init(void)
209{
210 int i, rc;
211
212 for (i = 0; i < ARRAY_SIZE(pm8018_gpios); i++) {
213 rc = pm8xxx_gpio_config(pm8018_gpios[i].gpio,
214 &pm8018_gpios[i].config);
215 if (rc) {
216 pr_err("%s: pm8018_gpio_config: rc=%d\n", __func__, rc);
217 break;
218 }
219 }
220
221 for (i = 0; i < ARRAY_SIZE(pm8018_mpps); i++) {
222 rc = pm8xxx_mpp_config(pm8018_mpps[i].mpp,
223 &pm8018_mpps[i].config);
224 if (rc) {
225 pr_err("%s: pm8018_mpp_config: rc=%d\n", __func__, rc);
226 break;
227 }
228 }
229}
230
Siddartha Mohanadoss5f60b452011-10-05 11:49:00 -0700231static struct pm8xxx_adc_amux pm8018_adc_channels_data[] = {
232 {"vcoin", CHANNEL_VCOIN, CHAN_PATH_SCALING2, AMUX_RSV1,
233 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
234 {"vbat", CHANNEL_VBAT, CHAN_PATH_SCALING2, AMUX_RSV1,
235 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
236 {"vph_pwr", CHANNEL_VPH_PWR, CHAN_PATH_SCALING2, AMUX_RSV1,
237 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
Siddartha Mohanadossf9383d52012-04-19 09:42:49 -0700238 /* AMUX8 is used to read either Batt_id/Batt_therm.
239 * Current configuration is to support Batt_id. If clients
240 * want to read the Batt_therm, the scaling function needs to be
241 * updated to use ADC_SCALE_BATT_THERM instead of ADC_SCALE_DEFAULT.
242 * E.g.
243 * {"batt_therm", CHANNEL_BATT_ID_THERM, CHAN_PATH_SCALING1,
244 * AMUX_RSV2, ADC_DECIMATION_TYPE2, ADC_SCALE_BATT_THERM},
245 */
246 {"batt_id", CHANNEL_BATT_ID_THERM, CHAN_PATH_SCALING1,
247 AMUX_RSV2, ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
Siddartha Mohanadoss5f60b452011-10-05 11:49:00 -0700248 {"pmic_therm", CHANNEL_DIE_TEMP, CHAN_PATH_SCALING1, AMUX_RSV1,
249 ADC_DECIMATION_TYPE2, ADC_SCALE_PMIC_THERM},
250 {"625mv", CHANNEL_625MV, CHAN_PATH_SCALING1, AMUX_RSV1,
251 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
252 {"125v", CHANNEL_125V, CHAN_PATH_SCALING1, AMUX_RSV1,
253 ADC_DECIMATION_TYPE2, ADC_SCALE_DEFAULT},
254 {"pa_therm0", ADC_MPP_1_AMUX3, CHAN_PATH_SCALING1, AMUX_RSV1,
255 ADC_DECIMATION_TYPE2, ADC_SCALE_PA_THERM},
256};
257
258static struct pm8xxx_adc_properties pm8018_adc_data = {
259 .adc_vdd_reference = 1800, /* milli-voltage for this adc */
260 .bitresolution = 15,
261 .bipolar = 0,
262};
263
264static struct pm8xxx_adc_platform_data pm8018_adc_pdata = {
265 .adc_channel = pm8018_adc_channels_data,
266 .adc_num_board_channel = ARRAY_SIZE(pm8018_adc_channels_data),
267 .adc_prop = &pm8018_adc_data,
268};
269
David Collinsfb88c432011-08-25 15:12:47 -0700270static struct pm8xxx_irq_platform_data pm8xxx_irq_pdata __devinitdata = {
271 .irq_base = PM8018_IRQ_BASE,
272 .devirq = MSM_GPIO_TO_INT(87),
273 .irq_trigger_flag = IRQF_TRIGGER_LOW,
274};
275
276static struct pm8xxx_gpio_platform_data pm8xxx_gpio_pdata __devinitdata = {
277 .gpio_base = PM8018_GPIO_PM_TO_SYS(1),
278};
279
280static struct pm8xxx_mpp_platform_data pm8xxx_mpp_pdata __devinitdata = {
281 .mpp_base = PM8018_MPP_PM_TO_SYS(1),
282};
283
284static struct pm8xxx_rtc_platform_data pm8xxx_rtc_pdata __devinitdata = {
285 .rtc_write_enable = false,
Ashay Jaiswaldb5e6dc2011-10-12 11:02:47 +0530286 .rtc_alarm_powerup = false,
David Collinsfb88c432011-08-25 15:12:47 -0700287};
288
289static struct pm8xxx_pwrkey_platform_data pm8xxx_pwrkey_pdata = {
290 .pull_up = 1,
Jing Lineecdc062011-11-17 09:47:09 -0800291 .kpd_trigger_delay_us = 15625,
David Collinsfb88c432011-08-25 15:12:47 -0700292 .wakeup = 1,
293};
294
295static struct pm8xxx_misc_platform_data pm8xxx_misc_pdata = {
296 .priority = 0,
297};
298
Jay Chokshieb5d0d52011-09-28 17:16:20 -0700299#define PM8018_LED_KB_MAX_CURRENT 20 /* I = 20mA */
300#define PM8XXX_LED_PWM_PERIOD_US 1000
301
302/**
303 * PM8XXX_PWM_CHANNEL_NONE shall be used when LED shall not be
304 * driven using PWM feature.
305 */
306#define PM8XXX_PWM_CHANNEL_NONE -1
307
308static struct led_info pm8018_led_info[] = {
309 [0] = {
310 .name = "led:kb",
311 },
312};
313
314static struct led_platform_data pm8018_led_core_pdata = {
315 .num_leds = ARRAY_SIZE(pm8018_led_info),
316 .leds = pm8018_led_info,
317};
318
319static struct pm8xxx_led_config pm8018_led_configs[] = {
320 [0] = {
321 .id = PM8XXX_ID_LED_KB_LIGHT,
322 .mode = PM8XXX_LED_MODE_PWM3,
323 .max_current = PM8018_LED_KB_MAX_CURRENT,
324 .pwm_channel = 2,
325 .pwm_period_us = PM8XXX_LED_PWM_PERIOD_US,
326 },
327};
328
329static struct pm8xxx_led_platform_data pm8xxx_leds_pdata = {
330 .led_core = &pm8018_led_core_pdata,
331 .configs = pm8018_led_configs,
332 .num_configs = ARRAY_SIZE(pm8018_led_configs),
333};
334
Jay Chokshidc8028b2011-12-01 16:17:34 -0800335#ifdef CONFIG_LTC4088_CHARGER
336static struct ltc4088_charger_platform_data ltc4088_chg_pdata = {
337 .gpio_mode_select_d0 = 7,
338 .gpio_mode_select_d1 = 6,
339 .gpio_mode_select_d2 = 4,
340};
341#endif
342
David Collinsfb88c432011-08-25 15:12:47 -0700343static struct pm8018_platform_data pm8018_platform_data __devinitdata = {
344 .irq_pdata = &pm8xxx_irq_pdata,
345 .gpio_pdata = &pm8xxx_gpio_pdata,
346 .mpp_pdata = &pm8xxx_mpp_pdata,
347 .rtc_pdata = &pm8xxx_rtc_pdata,
348 .pwrkey_pdata = &pm8xxx_pwrkey_pdata,
349 .misc_pdata = &pm8xxx_misc_pdata,
David Collins00b31e62011-08-31 20:00:10 -0700350 .regulator_pdatas = msm_pm8018_regulator_pdata,
Siddartha Mohanadoss5f60b452011-10-05 11:49:00 -0700351 .adc_pdata = &pm8018_adc_pdata,
Jay Chokshieb5d0d52011-09-28 17:16:20 -0700352 .leds_pdata = &pm8xxx_leds_pdata,
David Collinsfb88c432011-08-25 15:12:47 -0700353};
354
Kenneth Heitkeaf3d3cf2011-09-08 11:45:31 -0700355static struct msm_ssbi_platform_data msm9615_ssbi_pm8018_pdata __devinitdata = {
356 .controller_type = MSM_SBI_CTRL_PMIC_ARBITER,
357 .slave = {
David Collinsfb88c432011-08-25 15:12:47 -0700358 .name = PM8018_CORE_DEV_NAME,
359 .platform_data = &pm8018_platform_data,
Kenneth Heitkeaf3d3cf2011-09-08 11:45:31 -0700360 },
361};
362
David Collinsbea297a2011-09-28 13:11:14 -0700363static struct platform_device msm9615_device_rpm_regulator __devinitdata = {
364 .name = "rpm-regulator",
365 .id = -1,
366 .dev = {
367 .platform_data = &msm_rpm_regulator_9615_pdata,
368 },
369};
370
David Collins0f9942a2011-10-31 09:47:34 -0700371static struct platform_device msm9615_device_ext_2p95v_vreg = {
372 .name = GPIO_REGULATOR_DEV_NAME,
373 .id = 18,
374 .dev = {
375 .platform_data =
376 &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_2P95V],
377 },
378};
379
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -0600380static struct msm_pm_boot_platform_data msm_pm_boot_pdata __initdata = {
381 .mode = MSM_PM_BOOT_CONFIG_REMAP_BOOT_ADDR,
382 .v_addr = MSM_APCS_GLB_BASE + 0x24,
383};
384
Gagan Mac7a827642011-09-22 19:42:21 -0600385static void __init msm9615_init_buses(void)
386{
387#ifdef CONFIG_MSM_BUS_SCALING
388 msm_bus_rpm_set_mt_mask();
389 msm_bus_9615_sys_fabric_pdata.rpm_enabled = 1;
390 msm_bus_9615_sys_fabric.dev.platform_data =
391 &msm_bus_9615_sys_fabric_pdata;
392 msm_bus_def_fab.dev.platform_data = &msm_bus_9615_def_fab_pdata;
393#endif
394}
395
Shiv Maliyappanahalli9ec55e92012-01-09 14:44:59 -0800396#ifdef CONFIG_WCD9310_CODEC
397
398#define TABLA_INTERRUPT_BASE (NR_MSM_IRQS + NR_GPIO_IRQS)
399
Venkat Sudhir5efc4912012-05-15 17:10:35 -0700400/*
401 * MDM9x15 I2S.
402 */
403static struct wcd9xxx_pdata wcd9xxx_i2c_platform_data = {
404 .irq = MSM_GPIO_TO_INT(85),
405 .irq_base = TABLA_INTERRUPT_BASE,
406 .num_irqs = NR_TABLA_IRQS,
407 .reset_gpio = 84,
408 .micbias = {
409 .ldoh_v = TABLA_LDOH_2P85_V,
410 .cfilt1_mv = 1800,
411 .cfilt2_mv = 1800,
412 .cfilt3_mv = 1800,
413 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
414 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
415 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
416 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
417 },
418 .regulator = {
419 {
420 .name = "CDC_VDD_CP",
421 .min_uV = 1800000,
422 .max_uV = 1800000,
423 .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX,
424 },
425 {
426 .name = "CDC_VDDA_RX",
427 .min_uV = 1800000,
428 .max_uV = 1800000,
429 .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX,
430 },
431 {
432 .name = "CDC_VDDA_TX",
433 .min_uV = 1800000,
434 .max_uV = 1800000,
435 .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX,
436 },
437 {
438 .name = "VDDIO_CDC",
439 .min_uV = 1800000,
440 .max_uV = 1800000,
441 .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX,
442 },
443 {
444 .name = "VDDD_CDC_D",
445 .min_uV = 1225000,
446 .max_uV = 1225000,
447 .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
448 },
449 {
450 .name = "CDC_VDDA_A_1P2V",
451 .min_uV = 1225000,
452 .max_uV = 1225000,
453 .optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX,
454 }
455 },
456};
457
458static struct i2c_board_info wcd9xxx_device_info[] __initdata = {
459 {
460 I2C_BOARD_INFO("tabla top level", TABLA_I2C_SLAVE_ADDR),
461 .platform_data = &wcd9xxx_i2c_platform_data,
462 },
463 {
464 I2C_BOARD_INFO("tabla analog", TABLA_ANALOG_I2C_SLAVE_ADDR),
465 .platform_data = &wcd9xxx_i2c_platform_data,
466 },
467 {
468 I2C_BOARD_INFO("tabla digital1", TABLA_DIGITAL1_I2C_SLAVE_ADDR),
469 .platform_data = &wcd9xxx_i2c_platform_data,
470 },
471 {
472 I2C_BOARD_INFO("tabla digital2", TABLA_DIGITAL2_I2C_SLAVE_ADDR),
473 .platform_data = &wcd9xxx_i2c_platform_data,
474 },
475};
476
Venkat Sudhir5efc4912012-05-15 17:10:35 -0700477/*
478 * MDM9x15 I2S.
479 */
480
Shiv Maliyappanahalli9ec55e92012-01-09 14:44:59 -0800481/* Micbias setting is based on 8660 CDP/MTP/FLUID requirement
482 * 4 micbiases are used to power various analog and digital
483 * microphones operating at 1800 mV. Technically, all micbiases
484 * can source from single cfilter since all microphones operate
485 * at the same voltage level. The arrangement below is to make
486 * sure all cfilters are exercised. LDO_H regulator ouput level
487 * does not need to be as high as 2.85V. It is choosen for
488 * microphone sensitivity purpose.
489 */
490
491static struct wcd9xxx_pdata tabla20_platform_data = {
492 .slimbus_slave_device = {
493 .name = "tabla-slave",
494 .e_addr = {0, 0, 0x60, 0, 0x17, 2},
495 },
Shiv Maliyappanahallid7147812012-05-17 12:43:03 -0700496 .irq = MSM_GPIO_TO_INT(85),
Shiv Maliyappanahalli9ec55e92012-01-09 14:44:59 -0800497 .irq_base = TABLA_INTERRUPT_BASE,
498 .num_irqs = NR_WCD9XXX_IRQS,
499 .reset_gpio = 84,
500 .micbias = {
501 .ldoh_v = TABLA_LDOH_2P85_V,
502 .cfilt1_mv = 1800,
503 .cfilt2_mv = 1800,
504 .cfilt3_mv = 1800,
505 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
506 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
507 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
508 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
509 },
510 .regulator = {
511 {
512 .name = "CDC_VDD_CP",
513 .min_uV = 1800000,
514 .max_uV = 1800000,
515 .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX,
516 },
517 {
518 .name = "CDC_VDDA_RX",
519 .min_uV = 1800000,
520 .max_uV = 1800000,
521 .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX,
522 },
523 {
524 .name = "CDC_VDDA_TX",
525 .min_uV = 1800000,
526 .max_uV = 1800000,
527 .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX,
528 },
529 {
530 .name = "VDDIO_CDC",
531 .min_uV = 1800000,
532 .max_uV = 1800000,
533 .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX,
534 },
535 {
536 .name = "VDDD_CDC_D",
537 .min_uV = 1225000,
538 .max_uV = 1225000,
539 .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
540 },
541 {
542 .name = "CDC_VDDA_A_1P2V",
543 .min_uV = 1225000,
544 .max_uV = 1225000,
545 .optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX,
546 },
547 },
548};
549
550static struct slim_device msm_slim_tabla20 = {
551 .name = "tabla2x-slim",
552 .e_addr = {0, 1, 0x60, 0, 0x17, 2},
553 .dev = {
554 .platform_data = &tabla20_platform_data,
555 },
556};
557#endif
558
Shiv Maliyappanahalli3631cfb2012-05-31 15:53:24 -0700559static struct i2c_registry msm9615_i2c_devices[] __initdata = {
560#ifdef CONFIG_WCD9310_CODEC
561 {
562 I2C_SURF | I2C_FFA | I2C_FLUID,
563 MSM_9615_GSBI5_QUP_I2C_BUS_ID,
564 wcd9xxx_device_info,
565 ARRAY_SIZE(wcd9xxx_device_info),
566 },
567#endif
568};
569
Sagar Dharia2a5378d2011-12-01 20:00:11 -0700570static struct slim_boardinfo msm_slim_devices[] = {
571 /* add slimbus slaves as needed */
Shiv Maliyappanahalli9ec55e92012-01-09 14:44:59 -0800572#ifdef CONFIG_WCD9310_CODEC
573 {
574 .bus_num = 1,
575 .slim_slave = &msm_slim_tabla20,
576 },
577#endif
Sagar Dharia2a5378d2011-12-01 20:00:11 -0700578};
579
Harini Jayaraman738c9312011-09-08 15:22:38 -0600580static struct msm_spi_platform_data msm9615_qup_spi_gsbi3_pdata = {
581 .max_clock_speed = 24000000,
582};
583
Harini Jayaramaneba52672011-09-08 15:13:00 -0600584static struct msm_i2c_platform_data msm9615_i2c_qup_gsbi5_pdata = {
585 .clk_freq = 100000,
586 .src_clk_rate = 24000000,
587};
588
Amit Blay6a8d4f32011-11-21 10:36:25 +0200589#define USB_5V_EN 3
590#define PM_USB_5V_EN PM8018_GPIO_PM_TO_SYS(USB_5V_EN)
591
Mayank Rana8549e632012-01-23 12:49:54 +0530592static int msm_hsusb_vbus_power(bool on)
Amit Blay6a8d4f32011-11-21 10:36:25 +0200593{
Amit Blaya4416f92012-01-24 21:03:52 +0200594 int rc;
Amit Blay6a8d4f32011-11-21 10:36:25 +0200595 struct pm_gpio usb_vbus = {
596 .direction = PM_GPIO_DIR_OUT,
597 .pull = PM_GPIO_PULL_NO,
598 .output_buffer = PM_GPIO_OUT_BUF_CMOS,
Amit Blay6a8d4f32011-11-21 10:36:25 +0200599 .vin_sel = 2,
600 .out_strength = PM_GPIO_STRENGTH_HIGH,
601 .function = PM_GPIO_FUNC_NORMAL,
602 .inv_int_pol = 0,
603 };
604
Amit Blaya4416f92012-01-24 21:03:52 +0200605 usb_vbus.output_value = on;
Amit Blay6a8d4f32011-11-21 10:36:25 +0200606
Amit Blaya4416f92012-01-24 21:03:52 +0200607 rc = pm8xxx_gpio_config(PM_USB_5V_EN, &usb_vbus);
608 if (rc)
609 pr_err("failed to config usb_5v_en gpio\n");
Amit Blay6a8d4f32011-11-21 10:36:25 +0200610
Mayank Rana8549e632012-01-23 12:49:54 +0530611 return rc;
Amit Blay6a8d4f32011-11-21 10:36:25 +0200612}
613
Anji jonnalaa8b8d732011-12-06 10:03:24 +0530614static int shelby_phy_init_seq[] = {
615 0x44, 0x80,/* set VBUS valid threshold and
616 disconnect valid threshold */
617 0x38, 0x81, /* update DC voltage level */
Amit Blaydbaeff82012-04-02 22:13:36 +0300618 0x24, 0x82,/* set preemphasis and rise/fall time */
Anji jonnalaa8b8d732011-12-06 10:03:24 +0530619 0x13, 0x83,/* set source impedance adjustment */
620 -1};
621
Ofir Cohen40a4e862011-12-08 15:17:52 +0200622#define USB_BAM_PHY_BASE 0x12502000
Ofir Cohen43473c82012-01-25 16:28:13 +0200623#define HSIC_BAM_PHY_BASE 0x12542000
Ofir Cohen40a4e862011-12-08 15:17:52 +0200624#define A2_BAM_PHY_BASE 0x124C2000
Lena Salmana66eddf2012-03-26 13:03:43 +0200625static struct usb_bam_pipe_connect msm_usb_bam_connections[2][4][2] = {
626 [0][0][USB_TO_PEER_PERIPHERAL] = {
Ofir Cohen40a4e862011-12-08 15:17:52 +0200627 .src_phy_addr = USB_BAM_PHY_BASE,
628 .src_pipe_index = 11,
629 .dst_phy_addr = A2_BAM_PHY_BASE,
630 .dst_pipe_index = 0,
Ofir Cohen29cd5752011-12-14 17:20:30 +0200631 .data_fifo_base_offset = 0x1100,
632 .data_fifo_size = 0x600,
633 .desc_fifo_base_offset = 0x1700,
Ofir Cohen40a4e862011-12-08 15:17:52 +0200634 .desc_fifo_size = 0x300,
635 },
Lena Salmana66eddf2012-03-26 13:03:43 +0200636 [0][0][PEER_PERIPHERAL_TO_USB] = {
Ofir Cohen40a4e862011-12-08 15:17:52 +0200637 .src_phy_addr = A2_BAM_PHY_BASE,
638 .src_pipe_index = 1,
639 .dst_phy_addr = USB_BAM_PHY_BASE,
640 .dst_pipe_index = 10,
641 .data_fifo_base_offset = 0xa00,
Ofir Cohen29cd5752011-12-14 17:20:30 +0200642 .data_fifo_size = 0x600,
643 .desc_fifo_base_offset = 0x1000,
Ofir Cohen40a4e862011-12-08 15:17:52 +0200644 .desc_fifo_size = 0x100,
645 },
Lena Salmana66eddf2012-03-26 13:03:43 +0200646 [0][1][USB_TO_PEER_PERIPHERAL] = {
Anna Perel21515162012-02-02 20:50:02 +0200647 .src_phy_addr = USB_BAM_PHY_BASE,
648 .src_pipe_index = 13,
649 .dst_phy_addr = A2_BAM_PHY_BASE,
650 .dst_pipe_index = 2,
651 .data_fifo_base_offset = 0x2100,
652 .data_fifo_size = 0x600,
653 .desc_fifo_base_offset = 0x2700,
654 .desc_fifo_size = 0x300,
655 },
Lena Salmana66eddf2012-03-26 13:03:43 +0200656 [0][1][PEER_PERIPHERAL_TO_USB] = {
Anna Perel21515162012-02-02 20:50:02 +0200657 .src_phy_addr = A2_BAM_PHY_BASE,
658 .src_pipe_index = 3,
659 .dst_phy_addr = USB_BAM_PHY_BASE,
660 .dst_pipe_index = 12,
661 .data_fifo_base_offset = 0x1a00,
662 .data_fifo_size = 0x600,
663 .desc_fifo_base_offset = 0x2000,
664 .desc_fifo_size = 0x100,
665 },
Lena Salmana66eddf2012-03-26 13:03:43 +0200666 [0][2][USB_TO_PEER_PERIPHERAL] = {
Anna Perel21515162012-02-02 20:50:02 +0200667 .src_phy_addr = USB_BAM_PHY_BASE,
668 .src_pipe_index = 15,
669 .dst_phy_addr = A2_BAM_PHY_BASE,
670 .dst_pipe_index = 4,
671 .data_fifo_base_offset = 0x3100,
672 .data_fifo_size = 0x600,
673 .desc_fifo_base_offset = 0x3700,
674 .desc_fifo_size = 0x300,
675 },
Lena Salmana66eddf2012-03-26 13:03:43 +0200676 [0][2][PEER_PERIPHERAL_TO_USB] = {
Anna Perel21515162012-02-02 20:50:02 +0200677 .src_phy_addr = A2_BAM_PHY_BASE,
678 .src_pipe_index = 5,
679 .dst_phy_addr = USB_BAM_PHY_BASE,
680 .dst_pipe_index = 14,
681 .data_fifo_base_offset = 0x2a00,
682 .data_fifo_size = 0x600,
683 .desc_fifo_base_offset = 0x3000,
684 .desc_fifo_size = 0x100,
Lena Salmana66eddf2012-03-26 13:03:43 +0200685 },
686 [1][0][USB_TO_PEER_PERIPHERAL] = {
Ofir Cohen057fb3e2012-02-05 15:25:47 +0200687 .src_phy_addr = HSIC_BAM_PHY_BASE,
688 .src_pipe_index = 1,
689 .dst_phy_addr = A2_BAM_PHY_BASE,
690 .dst_pipe_index = 0,
691 .data_fifo_base_offset = 0x1100,
692 .data_fifo_size = 0x600,
693 .desc_fifo_base_offset = 0x1700,
694 .desc_fifo_size = 0x300,
695 },
Lena Salmana66eddf2012-03-26 13:03:43 +0200696 [1][0][PEER_PERIPHERAL_TO_USB] = {
Ofir Cohen057fb3e2012-02-05 15:25:47 +0200697 .src_phy_addr = A2_BAM_PHY_BASE,
698 .src_pipe_index = 1,
699 .dst_phy_addr = HSIC_BAM_PHY_BASE,
700 .dst_pipe_index = 0,
701 .data_fifo_base_offset = 0xa00,
702 .data_fifo_size = 0x600,
703 .desc_fifo_base_offset = 0x1000,
704 .desc_fifo_size = 0x100,
705 },
Lena Salmana66eddf2012-03-26 13:03:43 +0200706 [1][1][USB_TO_PEER_PERIPHERAL] = {
Ofir Cohen057fb3e2012-02-05 15:25:47 +0200707 .src_phy_addr = HSIC_BAM_PHY_BASE,
708 .src_pipe_index = 3,
709 .dst_phy_addr = A2_BAM_PHY_BASE,
710 .dst_pipe_index = 2,
711 .data_fifo_base_offset = 0x2100,
712 .data_fifo_size = 0x600,
713 .desc_fifo_base_offset = 0x2700,
714 .desc_fifo_size = 0x300,
715 },
Lena Salmana66eddf2012-03-26 13:03:43 +0200716 [1][1][PEER_PERIPHERAL_TO_USB] = {
Ofir Cohen057fb3e2012-02-05 15:25:47 +0200717 .src_phy_addr = A2_BAM_PHY_BASE,
718 .src_pipe_index = 3,
719 .dst_phy_addr = HSIC_BAM_PHY_BASE,
720 .dst_pipe_index = 2,
721 .data_fifo_base_offset = 0x1a00,
722 .data_fifo_size = 0x600,
723 .desc_fifo_base_offset = 0x2000,
724 .desc_fifo_size = 0x100,
725 },
Lena Salmana66eddf2012-03-26 13:03:43 +0200726 [1][2][USB_TO_PEER_PERIPHERAL] = {
Ofir Cohen057fb3e2012-02-05 15:25:47 +0200727 .src_phy_addr = HSIC_BAM_PHY_BASE,
728 .src_pipe_index = 5,
729 .dst_phy_addr = A2_BAM_PHY_BASE,
730 .dst_pipe_index = 4,
731 .data_fifo_base_offset = 0x3100,
732 .data_fifo_size = 0x600,
733 .desc_fifo_base_offset = 0x3700,
734 .desc_fifo_size = 0x300,
735 },
Lena Salmana66eddf2012-03-26 13:03:43 +0200736 [1][2][PEER_PERIPHERAL_TO_USB] = {
Ofir Cohen057fb3e2012-02-05 15:25:47 +0200737 .src_phy_addr = A2_BAM_PHY_BASE,
738 .src_pipe_index = 5,
739 .dst_phy_addr = HSIC_BAM_PHY_BASE,
740 .dst_pipe_index = 4,
741 .data_fifo_base_offset = 0x2a00,
742 .data_fifo_size = 0x600,
743 .desc_fifo_base_offset = 0x3000,
744 .desc_fifo_size = 0x100,
745 }
Ofir Cohen40a4e862011-12-08 15:17:52 +0200746};
747
748static struct msm_usb_bam_platform_data msm_usb_bam_pdata = {
Lena Salmana66eddf2012-03-26 13:03:43 +0200749 .connections = &msm_usb_bam_connections[0][0][0],
Lena Salman57d167e2012-03-21 19:46:38 +0200750#ifndef CONFIG_USB_CI13XXX_MSM_HSIC
Ofir Cohen43473c82012-01-25 16:28:13 +0200751 .usb_active_bam = HSUSB_BAM,
Ofir Cohen43473c82012-01-25 16:28:13 +0200752#else
753 .usb_active_bam = HSIC_BAM,
Ofir Cohen43473c82012-01-25 16:28:13 +0200754#endif
Lena Salmana66eddf2012-03-26 13:03:43 +0200755 .usb_bam_num_pipes = 16,
Ofir Cohen40a4e862011-12-08 15:17:52 +0200756};
757
Amit Blay5e4ec192011-10-20 09:16:54 +0200758static struct msm_otg_platform_data msm_otg_pdata = {
Amit Blay6a8d4f32011-11-21 10:36:25 +0200759 .mode = USB_OTG,
760 .otg_control = OTG_PHY_CONTROL,
Amit Blay5e4ec192011-10-20 09:16:54 +0200761 .phy_type = SNPS_28NM_INTEGRATED_PHY,
Amit Blay6a8d4f32011-11-21 10:36:25 +0200762 .vbus_power = msm_hsusb_vbus_power,
Ofir Cohen4da266f2012-01-03 10:19:29 +0200763 .disable_reset_on_disconnect = true,
Amit Blay6fa647a2012-05-24 14:12:08 +0300764 .enable_lpm_on_dev_suspend = true,
Amit Blay9b6e58b2012-06-18 13:12:49 +0300765 .core_clk_always_on_workaround = true,
Amit Blay5e4ec192011-10-20 09:16:54 +0200766};
767
Ido Shayevitz479f2eb2012-06-27 10:39:57 +0300768
769static struct ci13xxx_platform_data msm_peripheral_pdata = {
770 .usb_core_id = 0,
771};
772
773static struct msm_hsic_peripheral_platform_data
774 msm_hsic_peripheral_pdata_private = {
Amit Blay9b6e58b2012-06-18 13:12:49 +0300775 .core_clk_always_on_workaround = true,
Amit Blay4d57d362012-04-28 11:00:21 +0300776};
777
Ido Shayevitz479f2eb2012-06-27 10:39:57 +0300778static struct ci13xxx_platform_data msm_hsic_peripheral_pdata = {
779 .usb_core_id = 1,
780 .prv_data = &msm_hsic_peripheral_pdata_private,
781};
782
Amit Blay5f968cf2012-01-22 12:04:01 +0200783#define PID_MAGIC_ID 0x71432909
784#define SERIAL_NUM_MAGIC_ID 0x61945374
785#define SERIAL_NUMBER_LENGTH 127
786#define DLOAD_USB_BASE_ADD 0x2B0000C8
787
788struct magic_num_struct {
789 uint32_t pid;
790 uint32_t serial_num;
791};
792
793struct dload_struct {
794 uint32_t reserved1;
795 uint32_t reserved2;
796 uint32_t reserved3;
797 uint16_t reserved4;
798 uint16_t pid;
799 char serial_number[SERIAL_NUMBER_LENGTH];
800 uint16_t reserved5;
801 struct magic_num_struct magic_struct;
802};
803
Amit Blay5e4ec192011-10-20 09:16:54 +0200804static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum)
805{
Amit Blay5f968cf2012-01-22 12:04:01 +0200806 struct dload_struct __iomem *dload = 0;
807
808 dload = ioremap(DLOAD_USB_BASE_ADD, sizeof(*dload));
809 if (!dload) {
810 pr_err("%s: cannot remap I/O memory region: %08x\n",
811 __func__, DLOAD_USB_BASE_ADD);
812 return -ENXIO;
813 }
814
815 pr_debug("%s: dload:%p pid:%x serial_num:%s\n",
816 __func__, dload, pid, snum);
817 /* update pid */
818 dload->magic_struct.pid = PID_MAGIC_ID;
819 dload->pid = pid;
820
821 /* update serial number */
822 dload->magic_struct.serial_num = 0;
823 if (!snum) {
824 memset(dload->serial_number, 0, SERIAL_NUMBER_LENGTH);
825 goto out;
826 }
827
828 dload->magic_struct.serial_num = SERIAL_NUM_MAGIC_ID;
829 strlcpy(dload->serial_number, snum, SERIAL_NUMBER_LENGTH);
830out:
831 iounmap(dload);
Amit Blay5e4ec192011-10-20 09:16:54 +0200832 return 0;
833}
834
Rohit Vaswani149f0a72011-11-09 15:21:28 -0800835static struct platform_device msm_wlan_ar6000_pm_device = {
836 .name = "wlan_ar6000_pm_dev",
837 .id = -1,
838};
839
840static int __init msm9615_init_ar6000pm(void)
841{
842 return platform_device_register(&msm_wlan_ar6000_pm_device);
843}
844
Jay Chokshidc8028b2011-12-01 16:17:34 -0800845#ifdef CONFIG_LTC4088_CHARGER
846static struct platform_device msm_device_charger = {
847 .name = LTC4088_CHARGER_DEV_NAME,
848 .id = -1,
849 .dev = {
850 .platform_data = &ltc4088_chg_pdata,
851 },
852};
853#endif
854
Siddartha Mohanadoss7e25dc12012-03-19 11:19:27 -0700855static struct tsens_platform_data msm_tsens_pdata = {
856 .tsens_factor = 1000,
857 .hw_type = MDM_9615,
858 .tsens_num_sensor = 5,
Siddartha Mohanadoss892ee472012-05-03 10:35:20 -0700859 .slope = {1176, 1162, 1162, 1149, 1176},
Siddartha Mohanadoss7e25dc12012-03-19 11:19:27 -0700860};
861
Siddartha Mohanadoss48cad912012-04-05 21:29:54 -0700862static struct platform_device msm_tsens_device = {
863 .name = "tsens8960-tm",
864 .id = -1,
865};
866
Amit Blay5e4ec192011-10-20 09:16:54 +0200867static struct platform_device *common_devices[] = {
Matt Wagantallbf430eb2012-03-22 11:45:49 -0700868 &msm9615_device_acpuclk,
Amit Blay5e4ec192011-10-20 09:16:54 +0200869 &msm9615_device_dmov,
870 &msm_device_smd,
Jay Chokshidc8028b2011-12-01 16:17:34 -0800871#ifdef CONFIG_LTC4088_CHARGER
872 &msm_device_charger,
873#endif
Amit Blay5e4ec192011-10-20 09:16:54 +0200874 &msm_device_otg,
Ofir Cohen73c99e82012-01-15 13:38:14 +0200875 &msm_device_hsic_peripheral,
Amit Blay5e4ec192011-10-20 09:16:54 +0200876 &msm_device_gadget_peripheral,
Amit Blay6a8d4f32011-11-21 10:36:25 +0200877 &msm_device_hsusb_host,
Lena Salman65bcf372012-02-14 15:33:32 +0200878 &msm_device_hsic_host,
Ofir Cohen40a4e862011-12-08 15:17:52 +0200879 &msm_device_usb_bam,
Ofir Cohen94213a72012-05-03 14:26:32 +0300880 &msm_android_usb_device,
Ido Shayevitz479f2eb2012-06-27 10:39:57 +0300881 &msm_android_usb_hsic_device,
Amit Blay5e4ec192011-10-20 09:16:54 +0200882 &msm9615_device_uart_gsbi4,
David Collins0f9942a2011-10-31 09:47:34 -0700883 &msm9615_device_ext_2p95v_vreg,
Amit Blay5e4ec192011-10-20 09:16:54 +0200884 &msm9615_device_ssbi_pmic1,
885 &msm9615_device_qup_i2c_gsbi5,
886 &msm9615_device_qup_spi_gsbi3,
887 &msm_device_sps,
Sagar Dharia2a5378d2011-12-01 20:00:11 -0700888 &msm9615_slim_ctrl,
Amit Blay5e4ec192011-10-20 09:16:54 +0200889 &msm_device_nand,
Eric Holmberg0c96e702011-11-08 18:04:31 -0700890 &msm_device_bam_dmux,
Praveen Chidambaram78499012011-11-01 17:15:17 -0600891 &msm9615_rpm_device,
Amit Blay5e4ec192011-10-20 09:16:54 +0200892#ifdef CONFIG_HW_RANDOM_MSM
893 &msm_device_rng,
894#endif
Olav Haugane6a0acd2012-04-05 09:29:12 -0700895#ifdef CONFIG_ION_MSM
896 &ion_dev,
897#endif
Amit Blay5e4ec192011-10-20 09:16:54 +0200898
Shiv Maliyappanahalli9ec55e92012-01-09 14:44:59 -0800899 &msm_pcm,
900 &msm_multi_ch_pcm,
901 &msm_pcm_routing,
902 &msm_cpudai0,
903 &msm_cpudai1,
904 &msm_cpudai_bt_rx,
905 &msm_cpudai_bt_tx,
906 &msm_cpu_fe,
907 &msm_stub_codec,
908 &msm_voice,
909 &msm_voip,
Venkat Sudhir5efc4912012-05-15 17:10:35 -0700910 &msm_i2s_cpudai0,
911 &msm_i2s_cpudai1,
Shiv Maliyappanahalli9ec55e92012-01-09 14:44:59 -0800912 &msm_pcm_hostless,
913 &msm_cpudai_afe_01_rx,
914 &msm_cpudai_afe_01_tx,
915 &msm_cpudai_afe_02_rx,
916 &msm_cpudai_afe_02_tx,
917 &msm_pcm_afe,
918 &msm_cpudai_auxpcm_rx,
919 &msm_cpudai_auxpcm_tx,
Shiv Maliyappanahalli7f4dec52012-06-01 16:06:08 -0700920 &msm_cpudai_sec_auxpcm_rx,
921 &msm_cpudai_sec_auxpcm_tx,
Shiv Maliyappanahalli9ec55e92012-01-09 14:44:59 -0800922
Amit Blay5e4ec192011-10-20 09:16:54 +0200923#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
924 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
Ramesh Masavarapuaa28b5b2011-10-21 10:26:03 -0700925 &msm9615_qcrypto_device,
Amit Blay5e4ec192011-10-20 09:16:54 +0200926#endif
927
928#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
929 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
Ramesh Masavarapuaa28b5b2011-10-21 10:26:03 -0700930 &msm9615_qcedev_device,
Amit Blay5e4ec192011-10-20 09:16:54 +0200931#endif
Jeff Ohlstein7e668552011-10-06 16:17:25 -0700932 &msm9615_device_watchdog,
Gagan Mac7a827642011-09-22 19:42:21 -0600933 &msm_bus_9615_sys_fabric,
934 &msm_bus_def_fab,
Praveen Chidambaram78499012011-11-01 17:15:17 -0600935 &msm9615_rpm_log_device,
936 &msm9615_rpm_stat_device,
Anji Jonnala2a8bd312012-11-01 13:11:42 +0530937 &msm9615_rpm_master_stat_device,
Siddartha Mohanadoss48cad912012-04-05 21:29:54 -0700938 &msm_tsens_device,
Amit Blay5e4ec192011-10-20 09:16:54 +0200939};
940
Harini Jayaramaneba52672011-09-08 15:13:00 -0600941static void __init msm9615_i2c_init(void)
942{
Venkat Sudhir5efc4912012-05-15 17:10:35 -0700943 u8 mach_mask = 0;
944 int i;
945 /* Mask is hardcoded to SURF (CDP).
946 * works on MTP with same configuration.
947 */
948 mach_mask = I2C_SURF;
949 if (machine_is_msm9615_cdp())
950 mach_mask = I2C_SURF;
951 else if (machine_is_msm9615_mtp())
952 mach_mask = I2C_FFA;
953 else
954 pr_err("unmatched machine ID in register_i2c_devices\n");
Harini Jayaramaneba52672011-09-08 15:13:00 -0600955 msm9615_device_qup_i2c_gsbi5.dev.platform_data =
956 &msm9615_i2c_qup_gsbi5_pdata;
Venkat Sudhir5efc4912012-05-15 17:10:35 -0700957 for (i = 0; i < ARRAY_SIZE(msm9615_i2c_devices); ++i) {
958 if (msm9615_i2c_devices[i].machs & mach_mask) {
959 i2c_register_board_info(msm9615_i2c_devices[i].bus,
960 msm9615_i2c_devices[i].info,
961 msm9615_i2c_devices[i].len);
962 }
963 }
Harini Jayaramaneba52672011-09-08 15:13:00 -0600964}
965
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -0600966static void __init msm9615_reserve(void)
967{
Olav Haugane6a0acd2012-04-05 09:29:12 -0700968#ifdef CONFIG_ION_MSM
969 reserve_info = &msm9615_reserve_info;
970 msm_reserve();
971#endif
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -0600972}
973
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -0700974static void __init msm9615_common_init(void)
975{
Ofir Cohen94213a72012-05-03 14:26:32 +0300976 struct android_usb_platform_data *android_pdata =
977 msm_android_usb_device.dev.platform_data;
Ido Shayevitz479f2eb2012-06-27 10:39:57 +0300978 struct android_usb_platform_data *android_hsic_pdata =
979 msm_android_usb_hsic_device.dev.platform_data;
Ofir Cohen94213a72012-05-03 14:26:32 +0300980
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -0700981 msm9615_device_init();
Rohit Vaswanib1cc4932012-07-23 21:30:11 -0700982 platform_device_register(&msm_gpio_device);
Rohit Vaswania6815892011-12-15 20:20:39 -0800983 msm9615_init_gpiomux();
Harini Jayaramaneba52672011-09-08 15:13:00 -0600984 msm9615_i2c_init();
David Collins00b31e62011-08-31 20:00:10 -0700985 regulator_suppress_info_printing();
David Collinsbea297a2011-09-28 13:11:14 -0700986 platform_device_register(&msm9615_device_rpm_regulator);
Vikram Mulukutla2021c002011-12-16 12:32:59 -0800987 msm_xo_init();
Gagan Mac7a827642011-09-22 19:42:21 -0600988 msm_clock_init(&msm9615_clock_init_data);
989 msm9615_init_buses();
Harini Jayaraman738c9312011-09-08 15:22:38 -0600990 msm9615_device_qup_spi_gsbi3.dev.platform_data =
991 &msm9615_qup_spi_gsbi3_pdata;
Kenneth Heitkeaf3d3cf2011-09-08 11:45:31 -0700992 msm9615_device_ssbi_pmic1.dev.platform_data =
993 &msm9615_ssbi_pm8018_pdata;
David Collins00b31e62011-08-31 20:00:10 -0700994 pm8018_platform_data.num_regulators = msm_pm8018_regulator_pdata_len;
Amit Blay5e4ec192011-10-20 09:16:54 +0200995
996 msm_device_otg.dev.platform_data = &msm_otg_pdata;
Anji jonnalaa8b8d732011-12-06 10:03:24 +0530997 msm_otg_pdata.phy_init_seq = shelby_phy_init_seq;
Ido Shayevitz479f2eb2012-06-27 10:39:57 +0300998 msm_device_gadget_peripheral.dev.platform_data =
999 &msm_peripheral_pdata;
Amit Blay4d57d362012-04-28 11:00:21 +03001000 msm_device_hsic_peripheral.dev.platform_data =
1001 &msm_hsic_peripheral_pdata;
Ofir Cohen40a4e862011-12-08 15:17:52 +02001002 msm_device_usb_bam.dev.platform_data = &msm_usb_bam_pdata;
Rohit Vaswani09666872011-08-23 17:41:54 -07001003 platform_add_devices(common_devices, ARRAY_SIZE(common_devices));
Jay Chokshi215f7be2012-02-09 18:30:44 -08001004 msm9615_pm8xxx_gpio_mpp_init();
Vikram Mulukutlab5e1cda2011-10-04 16:17:22 -07001005
Rohit Vaswani149f0a72011-11-09 15:21:28 -08001006 /* Ensure ar6000pm device is registered before MMC/SDC */
1007 msm9615_init_ar6000pm();
1008
Krishna Kondadd794462011-10-01 00:19:29 -07001009 msm9615_init_mmc();
Sagar Dharia2a5378d2011-12-01 20:00:11 -07001010 slim_register_board_info(msm_slim_devices,
1011 ARRAY_SIZE(msm_slim_devices));
Ido Shayevitz479f2eb2012-06-27 10:39:57 +03001012
Ofir Cohen94213a72012-05-03 14:26:32 +03001013 android_pdata->update_pid_and_serial_num =
1014 usb_diag_update_pid_and_serial_num;
Ido Shayevitz479f2eb2012-06-27 10:39:57 +03001015 android_hsic_pdata->update_pid_and_serial_num =
1016 usb_diag_update_pid_and_serial_num;
1017
Olav Haugane6a0acd2012-04-05 09:29:12 -07001018 msm_pm_boot_pdata.p_addr = allocate_contiguous_ebi_nomap(SZ_8, SZ_64K);
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06001019 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Siddartha Mohanadoss7e25dc12012-03-19 11:19:27 -07001020 msm_tsens_early_init(&msm_tsens_pdata);
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -07001021}
1022
1023static void __init msm9615_cdp_init(void)
1024{
1025 msm9615_common_init();
Zhang Chang Kena48794b2012-03-31 17:45:21 -04001026#ifdef CONFIG_FB_MSM
1027 mdm9615_init_fb();
1028#endif
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -07001029}
1030
1031static void __init msm9615_mtp_init(void)
1032{
1033 msm9615_common_init();
1034}
1035
Zhang Chang Kena48794b2012-03-31 17:45:21 -04001036#ifdef CONFIG_FB_MSM
1037static void __init mdm9615_allocate_memory_regions(void)
1038{
1039 mdm9615_allocate_fb_region();
1040}
1041#endif
1042
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -07001043MACHINE_START(MSM9615_CDP, "QCT MSM9615 CDP")
1044 .map_io = msm9615_map_io,
1045 .init_irq = msm9615_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05301046 .handle_irq = gic_handle_irq,
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -07001047 .timer = &msm_timer,
1048 .init_machine = msm9615_cdp_init,
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06001049 .reserve = msm9615_reserve,
Zhang Chang Kena48794b2012-03-31 17:45:21 -04001050#ifdef CONFIG_FB_MSM
1051 .init_early = mdm9615_allocate_memory_regions,
1052#endif
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07001053 .restart = msm_restart,
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -07001054MACHINE_END
1055
1056MACHINE_START(MSM9615_MTP, "QCT MSM9615 MTP")
1057 .map_io = msm9615_map_io,
1058 .init_irq = msm9615_init_irq,
Marc Zyngier89bdafd12011-12-22 11:39:20 +05301059 .handle_irq = gic_handle_irq,
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -07001060 .timer = &msm_timer,
1061 .init_machine = msm9615_mtp_init,
Maheshkumar Sivasubramanianc6c55032011-10-25 16:01:32 -06001062 .reserve = msm9615_reserve,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07001063 .restart = msm_restart,
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -07001064MACHINE_END