Stepan Moskovchenko | f441ca2 | 2010-12-01 19:31:16 -0800 | [diff] [blame] | 1 | /* Copyright (c) 2011, Code Aurora Forum. All rights reserved. |
| 2 | * |
| 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 | * |
Stepan Moskovchenko | f441ca2 | 2010-12-01 19:31:16 -0800 | [diff] [blame] | 12 | */ |
| 13 | #include <linux/kernel.h> |
| 14 | #include <linux/platform_device.h> |
| 15 | #include <linux/io.h> |
| 16 | #include <linux/irq.h> |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 17 | #include <linux/i2c.h> |
Rohit Vaswani | cd2a59b | 2011-07-19 12:00:48 -0700 | [diff] [blame] | 18 | #include <linux/i2c/sx150x.h> |
Amir Samuelov | 5137e39 | 2011-09-21 17:31:25 +0300 | [diff] [blame] | 19 | #include <linux/i2c/isl9519.h> |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 20 | #include <linux/gpio.h> |
| 21 | #include <linux/msm_ssbi.h> |
| 22 | #include <linux/regulator/gpio-regulator.h> |
| 23 | #include <linux/mfd/pm8xxx/pm8921.h> |
Siddartha Mohanadoss | af91d90 | 2011-10-20 10:23:34 -0700 | [diff] [blame] | 24 | #include <linux/mfd/pm8xxx/pm8xxx-adc.h> |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 25 | #include <linux/regulator/consumer.h> |
| 26 | #include <linux/spi/spi.h> |
| 27 | #include <linux/slimbus/slimbus.h> |
| 28 | #include <linux/bootmem.h> |
Lucille Sylvester | 34ec369 | 2011-08-16 16:28:04 -0600 | [diff] [blame] | 29 | #include <linux/msm_kgsl.h> |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 30 | #ifdef CONFIG_ANDROID_PMEM |
| 31 | #include <linux/android_pmem.h> |
| 32 | #endif |
| 33 | #include <linux/cyttsp.h> |
| 34 | #include <linux/dma-mapping.h> |
| 35 | #include <linux/platform_data/qcom_crypto_device.h> |
Ankur Nandwani | b0039b0 | 2011-08-09 14:00:45 -0700 | [diff] [blame] | 36 | #include <linux/platform_data/qcom_wcnss_device.h> |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 37 | #include <linux/leds.h> |
| 38 | #include <linux/leds-pm8xxx.h> |
Mohan Pallaka | 5083738 | 2011-09-07 11:00:57 +0530 | [diff] [blame] | 39 | #include <linux/i2c/atmel_mxt_ts.h> |
Siddartha Mohanadoss | ba21fdd | 2011-08-18 10:05:27 -0700 | [diff] [blame] | 40 | #include <linux/msm_tsens.h> |
Stepan Moskovchenko | 93d79ec | 2011-09-21 16:52:16 -0700 | [diff] [blame] | 41 | #include <linux/ks8851.h> |
Mohan Pallaka | 5e49039 | 2011-09-09 15:18:41 +0530 | [diff] [blame] | 42 | #include <linux/i2c/isa1200.h> |
Jack Cheung | 0b1987e | 2011-11-18 13:36:29 -0800 | [diff] [blame] | 43 | #include <linux/memory.h> |
Stepan Moskovchenko | f441ca2 | 2010-12-01 19:31:16 -0800 | [diff] [blame] | 44 | |
| 45 | #include <asm/mach-types.h> |
| 46 | #include <asm/mach/arch.h> |
Larry Bassel | b4126da | 2011-07-18 14:31:33 -0700 | [diff] [blame] | 47 | #include <asm/setup.h> |
Stepan Moskovchenko | f441ca2 | 2010-12-01 19:31:16 -0800 | [diff] [blame] | 48 | #include <asm/hardware/gic.h> |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 49 | #include <asm/mach/mmc.h> |
Stepan Moskovchenko | f441ca2 | 2010-12-01 19:31:16 -0800 | [diff] [blame] | 50 | |
| 51 | #include <mach/board.h> |
| 52 | #include <mach/msm_iomap.h> |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 53 | #include <mach/msm_spi.h> |
| 54 | #ifdef CONFIG_USB_MSM_OTG_72K |
| 55 | #include <mach/msm_hsusb.h> |
| 56 | #else |
| 57 | #include <linux/usb/msm_hsusb.h> |
| 58 | #endif |
| 59 | #include <linux/usb/android.h> |
| 60 | #include <mach/usbdiag.h> |
| 61 | #include <mach/socinfo.h> |
| 62 | #include <mach/rpm.h> |
| 63 | #include <mach/gpio.h> |
Rohit Vaswani | a513aa8d | 2011-07-18 15:14:28 -0700 | [diff] [blame] | 64 | #include <mach/gpiomux.h> |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 65 | #include <mach/msm_bus_board.h> |
| 66 | #include <mach/msm_memtypes.h> |
| 67 | #include <mach/dma.h> |
| 68 | #include <mach/msm_dsps.h> |
| 69 | #include <mach/msm_xo.h> |
Abhijeet Dharmapurikar | 6d565fd | 2011-09-15 18:49:56 -0700 | [diff] [blame] | 70 | #include <mach/restart.h> |
Stepan Moskovchenko | f441ca2 | 2010-12-01 19:31:16 -0800 | [diff] [blame] | 71 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 72 | #ifdef CONFIG_WCD9310_CODEC |
| 73 | #include <linux/slimbus/slimbus.h> |
| 74 | #include <linux/mfd/wcd9310/core.h> |
| 75 | #include <linux/mfd/wcd9310/pdata.h> |
| 76 | #endif |
| 77 | |
Laura Abbott | d618379 | 2011-08-19 13:42:24 -0700 | [diff] [blame] | 78 | #include <linux/ion.h> |
| 79 | #include <mach/ion.h> |
Joel King | b8352a1 | 2011-11-15 18:46:24 -0800 | [diff] [blame] | 80 | #include <mach/mdm2.h> |
Laura Abbott | d618379 | 2011-08-19 13:42:24 -0700 | [diff] [blame] | 81 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 82 | #include "timer.h" |
Stepan Moskovchenko | d056fca | 2011-01-27 12:12:07 -0800 | [diff] [blame] | 83 | #include "devices.h" |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 84 | #include "devices-msm8x60.h" |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 85 | #include "spm.h" |
Stepan Moskovchenko | 5a83dba | 2011-12-05 17:30:17 -0800 | [diff] [blame] | 86 | #include "board-8960.h" |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 87 | #include "pm.h" |
| 88 | #include "cpuidle.h" |
| 89 | #include "rpm_resources.h" |
| 90 | #include "mpm.h" |
Matt Wagantall | 6d9ebee | 2011-08-26 12:15:24 -0700 | [diff] [blame] | 91 | #include "acpuclock.h" |
David Collins | 4c31a87 | 2011-08-31 10:07:10 -0700 | [diff] [blame] | 92 | #include "rpm_log.h" |
Naveen Ramaraj | 76483ad | 2011-09-06 14:25:44 -0700 | [diff] [blame] | 93 | #include "smd_private.h" |
Maheshkumar Sivasubramanian | 8ccc16e | 2011-10-25 15:59:57 -0600 | [diff] [blame] | 94 | #include "pm-boot.h" |
Jeff Ohlstein | 7e66855 | 2011-10-06 16:17:25 -0700 | [diff] [blame] | 95 | #include "msm_watchdog.h" |
Stepan Moskovchenko | c6ada42 | 2011-11-28 19:31:16 -0800 | [diff] [blame] | 96 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 97 | static struct platform_device msm_fm_platform_init = { |
| 98 | .name = "iris_fm", |
| 99 | .id = -1, |
| 100 | }; |
| 101 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 102 | #define KS8851_RST_GPIO 89 |
| 103 | #define KS8851_IRQ_GPIO 90 |
Mohan Pallaka | 5e49039 | 2011-09-09 15:18:41 +0530 | [diff] [blame] | 104 | #define HAP_SHIFT_LVL_OE_GPIO 47 |
| 105 | |
Rohit Vaswani | cd2a59b | 2011-07-19 12:00:48 -0700 | [diff] [blame] | 106 | #if defined(CONFIG_GPIO_SX150X) || defined(CONFIG_GPIO_SX150X_MODULE) |
Rohit Vaswani | cd2a59b | 2011-07-19 12:00:48 -0700 | [diff] [blame] | 107 | |
Stepan Moskovchenko | c6ada42 | 2011-11-28 19:31:16 -0800 | [diff] [blame] | 108 | struct sx150x_platform_data msm8960_sx150x_data[] = { |
Rohit Vaswani | cd2a59b | 2011-07-19 12:00:48 -0700 | [diff] [blame] | 109 | [SX150X_CAM] = { |
| 110 | .gpio_base = GPIO_CAM_EXPANDER_BASE, |
| 111 | .oscio_is_gpo = false, |
| 112 | .io_pullup_ena = 0x0, |
Nishant Pandit | 474f225 | 2011-07-23 23:17:56 +0530 | [diff] [blame] | 113 | .io_pulldn_ena = 0xc0, |
Rohit Vaswani | cd2a59b | 2011-07-19 12:00:48 -0700 | [diff] [blame] | 114 | .io_open_drain_ena = 0x0, |
| 115 | .irq_summary = -1, |
| 116 | }, |
| 117 | }; |
Nishant Pandit | 474f225 | 2011-07-23 23:17:56 +0530 | [diff] [blame] | 118 | |
| 119 | #endif |
| 120 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 121 | #define MSM_PMEM_ADSP_SIZE 0x3800000 |
Ben Romberger | 09e462d | 2011-08-09 15:24:37 -0700 | [diff] [blame] | 122 | #define MSM_PMEM_AUDIO_SIZE 0x28B000 |
Ravishangar Kalyanam | f4ef728 | 2011-10-10 17:39:48 -0700 | [diff] [blame] | 123 | #ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY |
| 124 | #define MSM_PMEM_SIZE 0x4000000 /* 64 Mbytes */ |
| 125 | #else |
Chetan Kalyan | a25d076 | 2011-11-11 17:41:29 -0800 | [diff] [blame] | 126 | #define MSM_PMEM_SIZE 0x1C00000 /* 28 Mbytes */ |
Ravishangar Kalyanam | f4ef728 | 2011-10-10 17:39:48 -0700 | [diff] [blame] | 127 | #endif |
Laura Abbott | 2d1760b | 2011-09-29 21:31:24 -0700 | [diff] [blame] | 128 | |
| 129 | |
| 130 | #ifdef CONFIG_MSM_MULTIMEDIA_USE_ION |
Laura Abbott | 6db11c9 | 2011-11-04 10:31:43 -0700 | [diff] [blame] | 131 | #define MSM_PMEM_KERNEL_EBI1_SIZE 0xB0C000 |
| 132 | #define MSM_ION_EBI_SIZE (MSM_PMEM_SIZE + 0x600000) |
Laura Abbott | 2d1760b | 2011-09-29 21:31:24 -0700 | [diff] [blame] | 133 | #define MSM_ION_ADSP_SIZE MSM_PMEM_ADSP_SIZE |
Laura Abbott | 8c01736 | 2011-09-22 20:59:12 -0700 | [diff] [blame] | 134 | #define MSM_ION_HEAP_NUM 5 |
Laura Abbott | 2d1760b | 2011-09-29 21:31:24 -0700 | [diff] [blame] | 135 | #else |
Laura Abbott | 6db11c9 | 2011-11-04 10:31:43 -0700 | [diff] [blame] | 136 | #define MSM_PMEM_KERNEL_EBI1_SIZE 0x110C000 |
Laura Abbott | 2d1760b | 2011-09-29 21:31:24 -0700 | [diff] [blame] | 137 | #define MSM_ION_HEAP_NUM 2 |
| 138 | #endif |
Laura Abbott | d618379 | 2011-08-19 13:42:24 -0700 | [diff] [blame] | 139 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 140 | #ifdef CONFIG_KERNEL_PMEM_EBI_REGION |
| 141 | static unsigned pmem_kernel_ebi1_size = MSM_PMEM_KERNEL_EBI1_SIZE; |
| 142 | static int __init pmem_kernel_ebi1_size_setup(char *p) |
| 143 | { |
| 144 | pmem_kernel_ebi1_size = memparse(p, NULL); |
| 145 | return 0; |
| 146 | } |
| 147 | early_param("pmem_kernel_ebi1_size", pmem_kernel_ebi1_size_setup); |
| 148 | #endif |
| 149 | |
| 150 | #ifdef CONFIG_ANDROID_PMEM |
| 151 | static unsigned pmem_size = MSM_PMEM_SIZE; |
| 152 | static int __init pmem_size_setup(char *p) |
| 153 | { |
| 154 | pmem_size = memparse(p, NULL); |
| 155 | return 0; |
| 156 | } |
| 157 | early_param("pmem_size", pmem_size_setup); |
| 158 | |
| 159 | static unsigned pmem_adsp_size = MSM_PMEM_ADSP_SIZE; |
| 160 | |
| 161 | static int __init pmem_adsp_size_setup(char *p) |
| 162 | { |
| 163 | pmem_adsp_size = memparse(p, NULL); |
| 164 | return 0; |
| 165 | } |
| 166 | early_param("pmem_adsp_size", pmem_adsp_size_setup); |
| 167 | |
| 168 | static unsigned pmem_audio_size = MSM_PMEM_AUDIO_SIZE; |
| 169 | |
| 170 | static int __init pmem_audio_size_setup(char *p) |
| 171 | { |
| 172 | pmem_audio_size = memparse(p, NULL); |
| 173 | return 0; |
| 174 | } |
| 175 | early_param("pmem_audio_size", pmem_audio_size_setup); |
| 176 | #endif |
| 177 | |
| 178 | #ifdef CONFIG_ANDROID_PMEM |
Laura Abbott | 2d1760b | 2011-09-29 21:31:24 -0700 | [diff] [blame] | 179 | #ifndef CONFIG_MSM_MULTIMEDIA_USE_ION |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 180 | static struct android_pmem_platform_data android_pmem_pdata = { |
| 181 | .name = "pmem", |
| 182 | .allocator_type = PMEM_ALLOCATORTYPE_ALLORNOTHING, |
| 183 | .cached = 1, |
| 184 | .memory_type = MEMTYPE_EBI1, |
| 185 | }; |
| 186 | |
| 187 | static struct platform_device android_pmem_device = { |
| 188 | .name = "android_pmem", |
| 189 | .id = 0, |
| 190 | .dev = {.platform_data = &android_pmem_pdata}, |
| 191 | }; |
| 192 | |
| 193 | static struct android_pmem_platform_data android_pmem_adsp_pdata = { |
| 194 | .name = "pmem_adsp", |
| 195 | .allocator_type = PMEM_ALLOCATORTYPE_BITMAP, |
| 196 | .cached = 0, |
| 197 | .memory_type = MEMTYPE_EBI1, |
| 198 | }; |
| 199 | static struct platform_device android_pmem_adsp_device = { |
| 200 | .name = "android_pmem", |
| 201 | .id = 2, |
| 202 | .dev = { .platform_data = &android_pmem_adsp_pdata }, |
| 203 | }; |
Laura Abbott | 2d1760b | 2011-09-29 21:31:24 -0700 | [diff] [blame] | 204 | #endif |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 205 | |
| 206 | static struct android_pmem_platform_data android_pmem_audio_pdata = { |
| 207 | .name = "pmem_audio", |
| 208 | .allocator_type = PMEM_ALLOCATORTYPE_BITMAP, |
| 209 | .cached = 0, |
| 210 | .memory_type = MEMTYPE_EBI1, |
| 211 | }; |
| 212 | |
| 213 | static struct platform_device android_pmem_audio_device = { |
| 214 | .name = "android_pmem", |
| 215 | .id = 4, |
| 216 | .dev = { .platform_data = &android_pmem_audio_pdata }, |
| 217 | }; |
| 218 | #endif |
| 219 | |
Swaminathan Sathappan | b77c65e9 | 2011-09-30 18:36:09 -0700 | [diff] [blame] | 220 | #define DSP_RAM_BASE_8960 0x8da00000 |
| 221 | #define DSP_RAM_SIZE_8960 0x1800000 |
| 222 | static int dspcrashd_pdata_8960 = 0xDEADDEAD; |
| 223 | |
| 224 | static struct resource resources_dspcrashd_8960[] = { |
| 225 | { |
| 226 | .name = "msm_dspcrashd", |
| 227 | .start = DSP_RAM_BASE_8960, |
| 228 | .end = DSP_RAM_BASE_8960 + DSP_RAM_SIZE_8960, |
| 229 | .flags = IORESOURCE_DMA, |
| 230 | }, |
| 231 | }; |
| 232 | |
Stepan Moskovchenko | fc70d90 | 2011-11-30 12:39:36 -0800 | [diff] [blame] | 233 | static struct platform_device msm_device_dspcrashd_8960 = { |
Swaminathan Sathappan | b77c65e9 | 2011-09-30 18:36:09 -0700 | [diff] [blame] | 234 | .name = "msm_dspcrashd", |
| 235 | .num_resources = ARRAY_SIZE(resources_dspcrashd_8960), |
| 236 | .resource = resources_dspcrashd_8960, |
| 237 | .dev = { .platform_data = &dspcrashd_pdata_8960 }, |
| 238 | }; |
| 239 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 240 | static struct memtype_reserve msm8960_reserve_table[] __initdata = { |
| 241 | [MEMTYPE_SMI] = { |
| 242 | }, |
| 243 | [MEMTYPE_EBI0] = { |
| 244 | .flags = MEMTYPE_FLAGS_1M_ALIGN, |
| 245 | }, |
| 246 | [MEMTYPE_EBI1] = { |
| 247 | .flags = MEMTYPE_FLAGS_1M_ALIGN, |
| 248 | }, |
| 249 | }; |
| 250 | |
| 251 | static void __init size_pmem_devices(void) |
| 252 | { |
| 253 | #ifdef CONFIG_ANDROID_PMEM |
Laura Abbott | 2d1760b | 2011-09-29 21:31:24 -0700 | [diff] [blame] | 254 | #ifndef CONFIG_MSM_MULTIMEDIA_USE_ION |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 255 | android_pmem_adsp_pdata.size = pmem_adsp_size; |
| 256 | android_pmem_pdata.size = pmem_size; |
Laura Abbott | 2d1760b | 2011-09-29 21:31:24 -0700 | [diff] [blame] | 257 | #endif |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 258 | android_pmem_audio_pdata.size = MSM_PMEM_AUDIO_SIZE; |
| 259 | #endif |
| 260 | } |
| 261 | |
| 262 | static void __init reserve_memory_for(struct android_pmem_platform_data *p) |
| 263 | { |
| 264 | msm8960_reserve_table[p->memory_type].size += p->size; |
| 265 | } |
| 266 | |
| 267 | static void __init reserve_pmem_memory(void) |
| 268 | { |
| 269 | #ifdef CONFIG_ANDROID_PMEM |
Laura Abbott | 2d1760b | 2011-09-29 21:31:24 -0700 | [diff] [blame] | 270 | #ifndef CONFIG_MSM_MULTIMEDIA_USE_ION |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 271 | reserve_memory_for(&android_pmem_adsp_pdata); |
| 272 | reserve_memory_for(&android_pmem_pdata); |
Laura Abbott | 2d1760b | 2011-09-29 21:31:24 -0700 | [diff] [blame] | 273 | #endif |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 274 | reserve_memory_for(&android_pmem_audio_pdata); |
| 275 | msm8960_reserve_table[MEMTYPE_EBI1].size += pmem_kernel_ebi1_size; |
| 276 | #endif |
| 277 | } |
| 278 | |
Larry Bassel | b4126da | 2011-07-18 14:31:33 -0700 | [diff] [blame] | 279 | static int msm8960_paddr_to_memtype(unsigned int paddr) |
| 280 | { |
| 281 | return MEMTYPE_EBI1; |
| 282 | } |
| 283 | |
Laura Abbott | d618379 | 2011-08-19 13:42:24 -0700 | [diff] [blame] | 284 | #ifdef CONFIG_ION_MSM |
Stepan Moskovchenko | fc70d90 | 2011-11-30 12:39:36 -0800 | [diff] [blame] | 285 | static struct ion_platform_data ion_pdata = { |
Laura Abbott | 2d1760b | 2011-09-29 21:31:24 -0700 | [diff] [blame] | 286 | .nr = MSM_ION_HEAP_NUM, |
Laura Abbott | d618379 | 2011-08-19 13:42:24 -0700 | [diff] [blame] | 287 | .heaps = { |
| 288 | { |
| 289 | .id = ION_HEAP_SYSTEM_ID, |
| 290 | .type = ION_HEAP_TYPE_SYSTEM, |
| 291 | .name = ION_KMALLOC_HEAP_NAME, |
| 292 | }, |
| 293 | { |
| 294 | .id = ION_HEAP_SYSTEM_CONTIG_ID, |
| 295 | .type = ION_HEAP_TYPE_SYSTEM_CONTIG, |
| 296 | .name = ION_VMALLOC_HEAP_NAME, |
| 297 | }, |
Laura Abbott | 2d1760b | 2011-09-29 21:31:24 -0700 | [diff] [blame] | 298 | #ifdef CONFIG_MSM_MULTIMEDIA_USE_ION |
Laura Abbott | d618379 | 2011-08-19 13:42:24 -0700 | [diff] [blame] | 299 | { |
| 300 | .id = ION_HEAP_EBI_ID, |
| 301 | .type = ION_HEAP_TYPE_CARVEOUT, |
| 302 | .name = ION_EBI1_HEAP_NAME, |
| 303 | .size = MSM_ION_EBI_SIZE, |
| 304 | .memory_type = ION_EBI_TYPE, |
| 305 | }, |
Laura Abbott | 2d1760b | 2011-09-29 21:31:24 -0700 | [diff] [blame] | 306 | { |
| 307 | .id = ION_HEAP_ADSP_ID, |
| 308 | .type = ION_HEAP_TYPE_CARVEOUT, |
| 309 | .name = ION_ADSP_HEAP_NAME, |
| 310 | .size = MSM_ION_ADSP_SIZE, |
| 311 | .memory_type = ION_EBI_TYPE, |
| 312 | }, |
Laura Abbott | 8c01736 | 2011-09-22 20:59:12 -0700 | [diff] [blame] | 313 | { |
| 314 | .id = ION_HEAP_IOMMU_ID, |
| 315 | .type = ION_HEAP_TYPE_IOMMU, |
| 316 | .name = ION_IOMMU_HEAP_NAME, |
| 317 | }, |
Laura Abbott | 2d1760b | 2011-09-29 21:31:24 -0700 | [diff] [blame] | 318 | #endif |
Laura Abbott | d618379 | 2011-08-19 13:42:24 -0700 | [diff] [blame] | 319 | } |
| 320 | }; |
| 321 | |
Stepan Moskovchenko | fc70d90 | 2011-11-30 12:39:36 -0800 | [diff] [blame] | 322 | static struct platform_device ion_dev = { |
Laura Abbott | d618379 | 2011-08-19 13:42:24 -0700 | [diff] [blame] | 323 | .name = "ion-msm", |
| 324 | .id = 1, |
| 325 | .dev = { .platform_data = &ion_pdata }, |
| 326 | }; |
| 327 | #endif |
| 328 | |
| 329 | static void reserve_ion_memory(void) |
| 330 | { |
Laura Abbott | 2d1760b | 2011-09-29 21:31:24 -0700 | [diff] [blame] | 331 | #if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION) |
Laura Abbott | d618379 | 2011-08-19 13:42:24 -0700 | [diff] [blame] | 332 | msm8960_reserve_table[MEMTYPE_EBI1].size += MSM_ION_EBI_SIZE; |
Laura Abbott | 2d1760b | 2011-09-29 21:31:24 -0700 | [diff] [blame] | 333 | msm8960_reserve_table[MEMTYPE_EBI1].size += MSM_ION_ADSP_SIZE; |
Laura Abbott | d618379 | 2011-08-19 13:42:24 -0700 | [diff] [blame] | 334 | #endif |
| 335 | } |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 336 | static void __init msm8960_calculate_reserve_sizes(void) |
| 337 | { |
| 338 | size_pmem_devices(); |
| 339 | reserve_pmem_memory(); |
Laura Abbott | d618379 | 2011-08-19 13:42:24 -0700 | [diff] [blame] | 340 | reserve_ion_memory(); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 341 | } |
| 342 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 343 | static struct reserve_info msm8960_reserve_info __initdata = { |
| 344 | .memtype_reserve_table = msm8960_reserve_table, |
| 345 | .calculate_reserve_sizes = msm8960_calculate_reserve_sizes, |
| 346 | .paddr_to_memtype = msm8960_paddr_to_memtype, |
| 347 | }; |
| 348 | |
Larry Bassel | b4126da | 2011-07-18 14:31:33 -0700 | [diff] [blame] | 349 | static int msm8960_memory_bank_size(void) |
| 350 | { |
| 351 | return 1<<29; |
| 352 | } |
| 353 | |
| 354 | static void __init locate_unstable_memory(void) |
| 355 | { |
| 356 | struct membank *mb = &meminfo.bank[meminfo.nr_banks - 1]; |
| 357 | unsigned long bank_size; |
| 358 | unsigned long low, high; |
| 359 | |
| 360 | bank_size = msm8960_memory_bank_size(); |
| 361 | low = meminfo.bank[0].start; |
| 362 | high = mb->start + mb->size; |
Olav Haugan | 62052e4 | 2011-10-28 14:28:32 -0700 | [diff] [blame] | 363 | |
| 364 | /* Check if 32 bit overflow occured */ |
| 365 | if (high < mb->start) |
| 366 | high = ~0UL; |
| 367 | |
Larry Bassel | b4126da | 2011-07-18 14:31:33 -0700 | [diff] [blame] | 368 | low &= ~(bank_size - 1); |
| 369 | |
| 370 | if (high - low <= bank_size) |
| 371 | return; |
Jack Cheung | 0b1987e | 2011-11-18 13:36:29 -0800 | [diff] [blame] | 372 | msm8960_reserve_info.low_unstable_address = high - |
| 373 | MIN_MEMORY_BLOCK_SIZE; |
| 374 | msm8960_reserve_info.max_unstable_size = MIN_MEMORY_BLOCK_SIZE; |
Olav Haugan | 62052e4 | 2011-10-28 14:28:32 -0700 | [diff] [blame] | 375 | |
Larry Bassel | b4126da | 2011-07-18 14:31:33 -0700 | [diff] [blame] | 376 | msm8960_reserve_info.bank_size = bank_size; |
| 377 | pr_info("low unstable address %lx max size %lx bank size %lx\n", |
| 378 | msm8960_reserve_info.low_unstable_address, |
| 379 | msm8960_reserve_info.max_unstable_size, |
| 380 | msm8960_reserve_info.bank_size); |
| 381 | } |
| 382 | |
Larry Bassel | b830e18 | 2011-10-14 10:46:55 -0700 | [diff] [blame] | 383 | static void __init place_movable_zone(void) |
| 384 | { |
| 385 | movable_reserved_start = msm8960_reserve_info.low_unstable_address; |
| 386 | movable_reserved_size = msm8960_reserve_info.max_unstable_size; |
| 387 | pr_info("movable zone start %lx size %lx\n", |
| 388 | movable_reserved_start, movable_reserved_size); |
| 389 | } |
| 390 | |
| 391 | static void __init msm8960_early_memory(void) |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 392 | { |
| 393 | reserve_info = &msm8960_reserve_info; |
Larry Bassel | b4126da | 2011-07-18 14:31:33 -0700 | [diff] [blame] | 394 | locate_unstable_memory(); |
Larry Bassel | b830e18 | 2011-10-14 10:46:55 -0700 | [diff] [blame] | 395 | place_movable_zone(); |
| 396 | } |
| 397 | |
| 398 | static void __init msm8960_reserve(void) |
| 399 | { |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 400 | msm_reserve(); |
| 401 | } |
| 402 | |
Larry Bassel | a4414b1 | 2011-08-04 11:11:02 -0700 | [diff] [blame] | 403 | static int msm8960_change_memory_power(u64 start, u64 size, |
| 404 | int change_type) |
Larry Bassel | a7eadea | 2011-07-14 10:46:00 -0700 | [diff] [blame] | 405 | { |
Naveen Ramaraj | b03bb1b | 2011-09-12 14:34:31 -0700 | [diff] [blame] | 406 | return soc_change_memory_power(start, size, change_type); |
Larry Bassel | a7eadea | 2011-07-14 10:46:00 -0700 | [diff] [blame] | 407 | } |
| 408 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 409 | static void __init msm8960_allocate_memory_regions(void) |
| 410 | { |
Stepan Moskovchenko | 24cd864 | 2011-11-29 13:07:53 -0800 | [diff] [blame] | 411 | msm8960_allocate_fb_region(); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 412 | } |
Stepan Moskovchenko | 24cd864 | 2011-11-29 13:07:53 -0800 | [diff] [blame] | 413 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 414 | #ifdef CONFIG_WCD9310_CODEC |
| 415 | |
| 416 | #define TABLA_INTERRUPT_BASE (NR_MSM_IRQS + NR_GPIO_IRQS + NR_PM8921_IRQS) |
| 417 | |
Patrick Lai | 3043fba | 2011-08-01 14:15:57 -0700 | [diff] [blame] | 418 | /* Micbias setting is based on 8660 CDP/MTP/FLUID requirement |
| 419 | * 4 micbiases are used to power various analog and digital |
| 420 | * microphones operating at 1800 mV. Technically, all micbiases |
| 421 | * can source from single cfilter since all microphones operate |
| 422 | * at the same voltage level. The arrangement below is to make |
| 423 | * sure all cfilters are exercised. LDO_H regulator ouput level |
| 424 | * does not need to be as high as 2.85V. It is choosen for |
| 425 | * microphone sensitivity purpose. |
| 426 | */ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 427 | static struct tabla_pdata tabla_platform_data = { |
| 428 | .slimbus_slave_device = { |
| 429 | .name = "tabla-slave", |
| 430 | .e_addr = {0, 0, 0x10, 0, 0x17, 2}, |
| 431 | }, |
| 432 | .irq = MSM_GPIO_TO_INT(62), |
| 433 | .irq_base = TABLA_INTERRUPT_BASE, |
| 434 | .num_irqs = NR_TABLA_IRQS, |
| 435 | .reset_gpio = PM8921_GPIO_PM_TO_SYS(34), |
Patrick Lai | 3043fba | 2011-08-01 14:15:57 -0700 | [diff] [blame] | 436 | .micbias = { |
| 437 | .ldoh_v = TABLA_LDOH_2P85_V, |
| 438 | .cfilt1_mv = 1800, |
| 439 | .cfilt2_mv = 1800, |
| 440 | .cfilt3_mv = 1800, |
| 441 | .bias1_cfilt_sel = TABLA_CFILT1_SEL, |
| 442 | .bias2_cfilt_sel = TABLA_CFILT2_SEL, |
| 443 | .bias3_cfilt_sel = TABLA_CFILT3_SEL, |
| 444 | .bias4_cfilt_sel = TABLA_CFILT3_SEL, |
| 445 | } |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 446 | }; |
| 447 | |
| 448 | static struct slim_device msm_slim_tabla = { |
| 449 | .name = "tabla-slim", |
| 450 | .e_addr = {0, 1, 0x10, 0, 0x17, 2}, |
| 451 | .dev = { |
| 452 | .platform_data = &tabla_platform_data, |
| 453 | }, |
| 454 | }; |
Santosh Mardi | 60e19d9 | 2011-10-28 01:15:14 +0530 | [diff] [blame] | 455 | |
| 456 | static struct tabla_pdata tabla20_platform_data = { |
| 457 | .slimbus_slave_device = { |
| 458 | .name = "tabla-slave", |
| 459 | .e_addr = {0, 0, 0x60, 0, 0x17, 2}, |
| 460 | }, |
| 461 | .irq = MSM_GPIO_TO_INT(62), |
| 462 | .irq_base = TABLA_INTERRUPT_BASE, |
| 463 | .num_irqs = NR_TABLA_IRQS, |
| 464 | .reset_gpio = PM8921_GPIO_PM_TO_SYS(34), |
| 465 | .micbias = { |
| 466 | .ldoh_v = TABLA_LDOH_2P85_V, |
| 467 | .cfilt1_mv = 1800, |
| 468 | .cfilt2_mv = 1800, |
| 469 | .cfilt3_mv = 1800, |
| 470 | .bias1_cfilt_sel = TABLA_CFILT1_SEL, |
| 471 | .bias2_cfilt_sel = TABLA_CFILT2_SEL, |
| 472 | .bias3_cfilt_sel = TABLA_CFILT3_SEL, |
| 473 | .bias4_cfilt_sel = TABLA_CFILT3_SEL, |
| 474 | } |
| 475 | }; |
| 476 | |
| 477 | static struct slim_device msm_slim_tabla20 = { |
| 478 | .name = "tabla2x-slim", |
| 479 | .e_addr = {0, 1, 0x60, 0, 0x17, 2}, |
| 480 | .dev = { |
| 481 | .platform_data = &tabla20_platform_data, |
| 482 | }, |
| 483 | }; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 484 | #endif |
| 485 | |
| 486 | static struct slim_boardinfo msm_slim_devices[] = { |
| 487 | #ifdef CONFIG_WCD9310_CODEC |
| 488 | { |
| 489 | .bus_num = 1, |
| 490 | .slim_slave = &msm_slim_tabla, |
| 491 | }, |
Santosh Mardi | 60e19d9 | 2011-10-28 01:15:14 +0530 | [diff] [blame] | 492 | { |
| 493 | .bus_num = 1, |
| 494 | .slim_slave = &msm_slim_tabla20, |
| 495 | }, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 496 | #endif |
| 497 | /* add more slimbus slaves as needed */ |
| 498 | }; |
| 499 | |
Yunsen Wang | 5c1a739 | 2011-07-09 19:10:16 -0700 | [diff] [blame] | 500 | #define MSM_WCNSS_PHYS 0x03000000 |
| 501 | #define MSM_WCNSS_SIZE 0x280000 |
| 502 | |
| 503 | static struct resource resources_wcnss_wlan[] = { |
| 504 | { |
| 505 | .start = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ, |
| 506 | .end = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ, |
| 507 | .name = "wcnss_wlanrx_irq", |
| 508 | .flags = IORESOURCE_IRQ, |
| 509 | }, |
| 510 | { |
| 511 | .start = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ, |
| 512 | .end = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ, |
| 513 | .name = "wcnss_wlantx_irq", |
| 514 | .flags = IORESOURCE_IRQ, |
| 515 | }, |
| 516 | { |
| 517 | .start = MSM_WCNSS_PHYS, |
| 518 | .end = MSM_WCNSS_PHYS + MSM_WCNSS_SIZE - 1, |
| 519 | .name = "wcnss_mmio", |
| 520 | .flags = IORESOURCE_MEM, |
| 521 | }, |
Ankur Nandwani | ad0d9ac | 2011-09-26 11:49:25 -0700 | [diff] [blame] | 522 | { |
| 523 | .start = 84, |
| 524 | .end = 88, |
| 525 | .name = "wcnss_gpios_5wire", |
| 526 | .flags = IORESOURCE_IO, |
| 527 | }, |
Yunsen Wang | 5c1a739 | 2011-07-09 19:10:16 -0700 | [diff] [blame] | 528 | }; |
| 529 | |
Ankur Nandwani | b0039b0 | 2011-08-09 14:00:45 -0700 | [diff] [blame] | 530 | static struct qcom_wcnss_opts qcom_wcnss_pdata = { |
| 531 | .has_48mhz_xo = 1, |
| 532 | }; |
| 533 | |
Yunsen Wang | 5c1a739 | 2011-07-09 19:10:16 -0700 | [diff] [blame] | 534 | static struct platform_device msm_device_wcnss_wlan = { |
| 535 | .name = "wcnss_wlan", |
| 536 | .id = 0, |
| 537 | .num_resources = ARRAY_SIZE(resources_wcnss_wlan), |
| 538 | .resource = resources_wcnss_wlan, |
Ankur Nandwani | b0039b0 | 2011-08-09 14:00:45 -0700 | [diff] [blame] | 539 | .dev = {.platform_data = &qcom_wcnss_pdata}, |
Yunsen Wang | 5c1a739 | 2011-07-09 19:10:16 -0700 | [diff] [blame] | 540 | }; |
| 541 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 542 | #if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \ |
| 543 | defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \ |
| 544 | defined(CONFIG_CRYPTO_DEV_QCEDEV) || \ |
| 545 | defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE) |
| 546 | |
| 547 | #define QCE_SIZE 0x10000 |
| 548 | #define QCE_0_BASE 0x18500000 |
| 549 | |
| 550 | #define QCE_HW_KEY_SUPPORT 0 |
| 551 | #define QCE_SHA_HMAC_SUPPORT 1 |
| 552 | #define QCE_SHARE_CE_RESOURCE 1 |
| 553 | #define QCE_CE_SHARED 0 |
| 554 | |
| 555 | static struct resource qcrypto_resources[] = { |
| 556 | [0] = { |
| 557 | .start = QCE_0_BASE, |
| 558 | .end = QCE_0_BASE + QCE_SIZE - 1, |
| 559 | .flags = IORESOURCE_MEM, |
| 560 | }, |
| 561 | [1] = { |
| 562 | .name = "crypto_channels", |
| 563 | .start = DMOV_CE_IN_CHAN, |
| 564 | .end = DMOV_CE_OUT_CHAN, |
| 565 | .flags = IORESOURCE_DMA, |
| 566 | }, |
| 567 | [2] = { |
| 568 | .name = "crypto_crci_in", |
| 569 | .start = DMOV_CE_IN_CRCI, |
| 570 | .end = DMOV_CE_IN_CRCI, |
| 571 | .flags = IORESOURCE_DMA, |
| 572 | }, |
| 573 | [3] = { |
| 574 | .name = "crypto_crci_out", |
| 575 | .start = DMOV_CE_OUT_CRCI, |
| 576 | .end = DMOV_CE_OUT_CRCI, |
| 577 | .flags = IORESOURCE_DMA, |
| 578 | }, |
| 579 | }; |
| 580 | |
| 581 | static struct resource qcedev_resources[] = { |
| 582 | [0] = { |
| 583 | .start = QCE_0_BASE, |
| 584 | .end = QCE_0_BASE + QCE_SIZE - 1, |
| 585 | .flags = IORESOURCE_MEM, |
| 586 | }, |
| 587 | [1] = { |
| 588 | .name = "crypto_channels", |
| 589 | .start = DMOV_CE_IN_CHAN, |
| 590 | .end = DMOV_CE_OUT_CHAN, |
| 591 | .flags = IORESOURCE_DMA, |
| 592 | }, |
| 593 | [2] = { |
| 594 | .name = "crypto_crci_in", |
| 595 | .start = DMOV_CE_IN_CRCI, |
| 596 | .end = DMOV_CE_IN_CRCI, |
| 597 | .flags = IORESOURCE_DMA, |
| 598 | }, |
| 599 | [3] = { |
| 600 | .name = "crypto_crci_out", |
| 601 | .start = DMOV_CE_OUT_CRCI, |
| 602 | .end = DMOV_CE_OUT_CRCI, |
| 603 | .flags = IORESOURCE_DMA, |
| 604 | }, |
| 605 | }; |
| 606 | |
| 607 | #endif |
| 608 | |
| 609 | #if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \ |
| 610 | defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) |
| 611 | |
| 612 | static struct msm_ce_hw_support qcrypto_ce_hw_suppport = { |
| 613 | .ce_shared = QCE_CE_SHARED, |
| 614 | .shared_ce_resource = QCE_SHARE_CE_RESOURCE, |
| 615 | .hw_key_support = QCE_HW_KEY_SUPPORT, |
| 616 | .sha_hmac = QCE_SHA_HMAC_SUPPORT, |
| 617 | }; |
| 618 | |
| 619 | static struct platform_device qcrypto_device = { |
| 620 | .name = "qcrypto", |
| 621 | .id = 0, |
| 622 | .num_resources = ARRAY_SIZE(qcrypto_resources), |
| 623 | .resource = qcrypto_resources, |
| 624 | .dev = { |
| 625 | .coherent_dma_mask = DMA_BIT_MASK(32), |
| 626 | .platform_data = &qcrypto_ce_hw_suppport, |
| 627 | }, |
| 628 | }; |
| 629 | #endif |
| 630 | |
| 631 | #if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \ |
| 632 | defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE) |
| 633 | |
| 634 | static struct msm_ce_hw_support qcedev_ce_hw_suppport = { |
| 635 | .ce_shared = QCE_CE_SHARED, |
| 636 | .shared_ce_resource = QCE_SHARE_CE_RESOURCE, |
| 637 | .hw_key_support = QCE_HW_KEY_SUPPORT, |
| 638 | .sha_hmac = QCE_SHA_HMAC_SUPPORT, |
| 639 | }; |
| 640 | |
| 641 | static struct platform_device qcedev_device = { |
| 642 | .name = "qce", |
| 643 | .id = 0, |
| 644 | .num_resources = ARRAY_SIZE(qcedev_resources), |
| 645 | .resource = qcedev_resources, |
| 646 | .dev = { |
| 647 | .coherent_dma_mask = DMA_BIT_MASK(32), |
| 648 | .platform_data = &qcedev_ce_hw_suppport, |
| 649 | }, |
| 650 | }; |
| 651 | #endif |
| 652 | |
Joel King | b8352a1 | 2011-11-15 18:46:24 -0800 | [diff] [blame] | 653 | #define MDM2AP_ERRFATAL 70 |
| 654 | #define AP2MDM_ERRFATAL 95 |
| 655 | #define MDM2AP_STATUS 69 |
| 656 | #define AP2MDM_STATUS 94 |
| 657 | #define AP2MDM_PMIC_RESET_N 80 |
| 658 | #define AP2MDM_KPDPWR_N 81 |
| 659 | |
Joel King | b8352a1 | 2011-11-15 18:46:24 -0800 | [diff] [blame] | 660 | static struct resource mdm_resources[] = { |
| 661 | { |
| 662 | .start = MDM2AP_ERRFATAL, |
| 663 | .end = MDM2AP_ERRFATAL, |
| 664 | .name = "MDM2AP_ERRFATAL", |
| 665 | .flags = IORESOURCE_IO, |
| 666 | }, |
| 667 | { |
| 668 | .start = AP2MDM_ERRFATAL, |
| 669 | .end = AP2MDM_ERRFATAL, |
| 670 | .name = "AP2MDM_ERRFATAL", |
| 671 | .flags = IORESOURCE_IO, |
| 672 | }, |
| 673 | { |
| 674 | .start = MDM2AP_STATUS, |
| 675 | .end = MDM2AP_STATUS, |
| 676 | .name = "MDM2AP_STATUS", |
| 677 | .flags = IORESOURCE_IO, |
| 678 | }, |
| 679 | { |
| 680 | .start = AP2MDM_STATUS, |
| 681 | .end = AP2MDM_STATUS, |
| 682 | .name = "AP2MDM_STATUS", |
| 683 | .flags = IORESOURCE_IO, |
| 684 | }, |
| 685 | { |
| 686 | .start = AP2MDM_PMIC_RESET_N, |
| 687 | .end = AP2MDM_PMIC_RESET_N, |
| 688 | .name = "AP2MDM_PMIC_RESET_N", |
| 689 | .flags = IORESOURCE_IO, |
| 690 | }, |
| 691 | { |
| 692 | .start = AP2MDM_KPDPWR_N, |
| 693 | .end = AP2MDM_KPDPWR_N, |
| 694 | .name = "AP2MDM_KPDPWR_N", |
| 695 | .flags = IORESOURCE_IO, |
| 696 | }, |
| 697 | }; |
| 698 | |
| 699 | static struct mdm_platform_data mdm_platform_data = { |
| 700 | .mdm_version = "2.5", |
| 701 | }; |
| 702 | |
Stepan Moskovchenko | fc70d90 | 2011-11-30 12:39:36 -0800 | [diff] [blame] | 703 | static struct platform_device mdm_device = { |
Joel King | b8352a1 | 2011-11-15 18:46:24 -0800 | [diff] [blame] | 704 | .name = "mdm2_modem", |
| 705 | .id = -1, |
| 706 | .num_resources = ARRAY_SIZE(mdm_resources), |
| 707 | .resource = mdm_resources, |
| 708 | .dev = { |
| 709 | .platform_data = &mdm_platform_data, |
| 710 | }, |
| 711 | }; |
| 712 | |
| 713 | static struct platform_device *mdm_devices[] __initdata = { |
| 714 | &mdm_device, |
| 715 | }; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 716 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 717 | #define MSM_SHARED_RAM_PHYS 0x80000000 |
| 718 | |
Stepan Moskovchenko | f441ca2 | 2010-12-01 19:31:16 -0800 | [diff] [blame] | 719 | static void __init msm8960_map_io(void) |
| 720 | { |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 721 | msm_shared_ram_phys = MSM_SHARED_RAM_PHYS; |
Stepan Moskovchenko | f441ca2 | 2010-12-01 19:31:16 -0800 | [diff] [blame] | 722 | msm_map_msm8960_io(); |
Jeff Ohlstein | 3a77f9f | 2011-09-06 14:50:20 -0700 | [diff] [blame] | 723 | |
| 724 | if (socinfo_init() < 0) |
| 725 | pr_err("socinfo_init() failed!\n"); |
Stepan Moskovchenko | f441ca2 | 2010-12-01 19:31:16 -0800 | [diff] [blame] | 726 | } |
| 727 | |
| 728 | static void __init msm8960_init_irq(void) |
| 729 | { |
| 730 | unsigned int i; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 731 | |
| 732 | msm_mpm_irq_extn_init(); |
Stepan Moskovchenko | f441ca2 | 2010-12-01 19:31:16 -0800 | [diff] [blame] | 733 | gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 734 | (void *)MSM_QGIC_CPU_BASE); |
Stepan Moskovchenko | f441ca2 | 2010-12-01 19:31:16 -0800 | [diff] [blame] | 735 | |
| 736 | /* Edge trigger PPIs except AVS_SVICINT and AVS_SVICINTSWDONE */ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 737 | writel_relaxed(0xFFFFD7FF, MSM_QGIC_DIST_BASE + GIC_DIST_CONFIG + 4); |
Stepan Moskovchenko | f441ca2 | 2010-12-01 19:31:16 -0800 | [diff] [blame] | 738 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 739 | writel_relaxed(0x0000FFFF, MSM_QGIC_DIST_BASE + GIC_DIST_ENABLE_SET); |
| 740 | mb(); |
Stepan Moskovchenko | 50ede4e | 2010-12-13 18:12:19 -0800 | [diff] [blame] | 741 | |
Stepan Moskovchenko | f441ca2 | 2010-12-01 19:31:16 -0800 | [diff] [blame] | 742 | /* FIXME: Not installing AVS_SVICINT and AVS_SVICINTSWDONE yet |
| 743 | * as they are configured as level, which does not play nice with |
| 744 | * handle_percpu_irq. |
| 745 | */ |
| 746 | for (i = GIC_PPI_START; i < GIC_SPI_START; i++) { |
| 747 | if (i != AVS_SVICINT && i != AVS_SVICINTSWDONE) |
Thomas Gleixner | 6845664a | 2011-03-24 13:25:22 +0100 | [diff] [blame] | 748 | irq_set_handler(i, handle_percpu_irq); |
Stepan Moskovchenko | f441ca2 | 2010-12-01 19:31:16 -0800 | [diff] [blame] | 749 | } |
| 750 | } |
| 751 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 752 | static void __init msm8960_init_buses(void) |
| 753 | { |
| 754 | #ifdef CONFIG_MSM_BUS_SCALING |
Gagan Mac | dc1dc14 | 2011-09-16 15:13:35 -0600 | [diff] [blame] | 755 | msm_bus_rpm_set_mt_mask(); |
Gagan Mac | ae154c4b | 2011-10-05 19:24:43 -0600 | [diff] [blame] | 756 | msm_bus_8960_apps_fabric_pdata.rpm_enabled = 1; |
| 757 | msm_bus_8960_sys_fabric_pdata.rpm_enabled = 1; |
| 758 | msm_bus_8960_mm_fabric_pdata.rpm_enabled = 1; |
| 759 | msm_bus_apps_fabric.dev.platform_data = |
| 760 | &msm_bus_8960_apps_fabric_pdata; |
| 761 | msm_bus_sys_fabric.dev.platform_data = &msm_bus_8960_sys_fabric_pdata; |
| 762 | msm_bus_mm_fabric.dev.platform_data = &msm_bus_8960_mm_fabric_pdata; |
| 763 | msm_bus_sys_fpb.dev.platform_data = &msm_bus_8960_sys_fpb_pdata; |
| 764 | msm_bus_cpss_fpb.dev.platform_data = &msm_bus_8960_cpss_fpb_pdata; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 765 | #endif |
| 766 | } |
| 767 | |
| 768 | static struct msm_spi_platform_data msm8960_qup_spi_gsbi1_pdata = { |
| 769 | .max_clock_speed = 15060000, |
| 770 | }; |
| 771 | |
| 772 | #ifdef CONFIG_USB_MSM_OTG_72K |
| 773 | static struct msm_otg_platform_data msm_otg_pdata; |
| 774 | #else |
| 775 | #define USB_5V_EN 42 |
| 776 | static void msm_hsusb_vbus_power(bool on) |
| 777 | { |
| 778 | int rc; |
| 779 | static bool vbus_is_on; |
| 780 | static struct regulator *mvs_otg_switch; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 781 | |
| 782 | if (vbus_is_on == on) |
| 783 | return; |
| 784 | |
| 785 | if (on) { |
Stepan Moskovchenko | 14aa649 | 2011-08-08 15:15:01 -0700 | [diff] [blame] | 786 | mvs_otg_switch = regulator_get(&msm8960_device_otg.dev, |
| 787 | "vbus_otg"); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 788 | if (IS_ERR(mvs_otg_switch)) { |
| 789 | pr_err("Unable to get mvs_otg_switch\n"); |
| 790 | return; |
| 791 | } |
| 792 | |
| 793 | rc = gpio_request(PM8921_GPIO_PM_TO_SYS(USB_5V_EN), |
| 794 | "usb_5v_en"); |
| 795 | if (rc < 0) { |
| 796 | pr_err("failed to request usb_5v_en gpio\n"); |
| 797 | goto put_mvs_otg; |
| 798 | } |
| 799 | |
Anji jonnala | 2936fd9 | 2011-11-09 15:39:22 +0530 | [diff] [blame] | 800 | rc = gpio_direction_output(PM8921_GPIO_PM_TO_SYS(USB_5V_EN), 1); |
| 801 | if (rc) { |
| 802 | pr_err("%s: unable to set_direction for gpio [%d]\n", |
| 803 | __func__, PM8921_GPIO_PM_TO_SYS(USB_5V_EN)); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 804 | goto free_usb_5v_en; |
| 805 | } |
| 806 | |
Anji jonnala | 2936fd9 | 2011-11-09 15:39:22 +0530 | [diff] [blame] | 807 | if (regulator_enable(mvs_otg_switch)) { |
| 808 | pr_err("unable to enable mvs_otg_switch\n"); |
| 809 | goto err_ldo_gpio_set_dir; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 810 | } |
Anji jonnala | 2936fd9 | 2011-11-09 15:39:22 +0530 | [diff] [blame] | 811 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 812 | vbus_is_on = true; |
| 813 | return; |
| 814 | } |
Anji jonnala | 2936fd9 | 2011-11-09 15:39:22 +0530 | [diff] [blame] | 815 | regulator_disable(mvs_otg_switch); |
| 816 | err_ldo_gpio_set_dir: |
Pavankumar Kondeti | c7a5e87 | 2011-12-09 14:50:16 +0530 | [diff] [blame] | 817 | gpio_set_value_cansleep(PM8921_GPIO_PM_TO_SYS(USB_5V_EN), 0); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 818 | free_usb_5v_en: |
Anji jonnala | 2936fd9 | 2011-11-09 15:39:22 +0530 | [diff] [blame] | 819 | gpio_free(PM8921_GPIO_PM_TO_SYS(USB_5V_EN)); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 820 | put_mvs_otg: |
Anji jonnala | 2936fd9 | 2011-11-09 15:39:22 +0530 | [diff] [blame] | 821 | regulator_put(mvs_otg_switch); |
| 822 | vbus_is_on = false; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 823 | } |
| 824 | |
Anji jonnala | a8b8d73 | 2011-12-06 10:03:24 +0530 | [diff] [blame] | 825 | static int wr_phy_init_seq[] = { |
| 826 | 0x44, 0x80, /* set VBUS valid threshold |
| 827 | and disconnect valid threshold */ |
| 828 | 0x38, 0x81, /* update DC voltage level */ |
| 829 | 0x14, 0x82, /* set preemphasis and rise/fall time */ |
| 830 | 0x13, 0x83, /* set source impedance adjusment */ |
| 831 | -1}; |
| 832 | |
| 833 | static int liquid_v1_phy_init_seq[] = { |
| 834 | 0x44, 0x80,/* set VBUS valid threshold |
| 835 | and disconnect valid threshold */ |
| 836 | 0x3C, 0x81,/* update DC voltage level */ |
| 837 | 0x18, 0x82,/* set preemphasis and rise/fall time */ |
| 838 | 0x23, 0x83,/* set source impedance sdjusment */ |
| 839 | -1}; |
| 840 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 841 | static struct msm_otg_platform_data msm_otg_pdata = { |
| 842 | .mode = USB_OTG, |
| 843 | .otg_control = OTG_PMIC_CONTROL, |
| 844 | .phy_type = SNPS_28NM_INTEGRATED_PHY, |
| 845 | .pclk_src_name = "dfab_usb_hs_clk", |
| 846 | .pmic_id_irq = PM8921_USB_ID_IN_IRQ(PM8921_IRQ_BASE), |
| 847 | .vbus_power = msm_hsusb_vbus_power, |
Anji jonnala | 4e3e677 | 2011-09-15 18:53:42 +0530 | [diff] [blame] | 848 | .power_budget = 750, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 849 | }; |
| 850 | #endif |
| 851 | |
Vijayavardhan Vennapusa | e3316a1 | 2011-10-15 06:05:17 +0530 | [diff] [blame] | 852 | #ifdef CONFIG_USB_EHCI_MSM_HSIC |
Vijayavardhan Vennapusa | 2b592824f | 2011-11-02 19:51:32 +0530 | [diff] [blame] | 853 | #define HSIC_HUB_RESET_GPIO 91 |
Vijayavardhan Vennapusa | e3316a1 | 2011-10-15 06:05:17 +0530 | [diff] [blame] | 854 | static struct msm_hsic_host_platform_data msm_hsic_pdata = { |
| 855 | .strobe = 150, |
| 856 | .data = 151, |
| 857 | }; |
| 858 | #else |
| 859 | static struct msm_hsic_host_platform_data msm_hsic_pdata; |
| 860 | #endif |
| 861 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 862 | #define PID_MAGIC_ID 0x71432909 |
| 863 | #define SERIAL_NUM_MAGIC_ID 0x61945374 |
| 864 | #define SERIAL_NUMBER_LENGTH 127 |
| 865 | #define DLOAD_USB_BASE_ADD 0x2A03F0C8 |
| 866 | |
| 867 | struct magic_num_struct { |
| 868 | uint32_t pid; |
| 869 | uint32_t serial_num; |
| 870 | }; |
| 871 | |
| 872 | struct dload_struct { |
| 873 | uint32_t reserved1; |
| 874 | uint32_t reserved2; |
| 875 | uint32_t reserved3; |
| 876 | uint16_t reserved4; |
| 877 | uint16_t pid; |
| 878 | char serial_number[SERIAL_NUMBER_LENGTH]; |
| 879 | uint16_t reserved5; |
| 880 | struct magic_num_struct magic_struct; |
| 881 | }; |
| 882 | |
| 883 | static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum) |
| 884 | { |
| 885 | struct dload_struct __iomem *dload = 0; |
| 886 | |
| 887 | dload = ioremap(DLOAD_USB_BASE_ADD, sizeof(*dload)); |
| 888 | if (!dload) { |
| 889 | pr_err("%s: cannot remap I/O memory region: %08x\n", |
| 890 | __func__, DLOAD_USB_BASE_ADD); |
| 891 | return -ENXIO; |
| 892 | } |
| 893 | |
| 894 | pr_debug("%s: dload:%p pid:%x serial_num:%s\n", |
| 895 | __func__, dload, pid, snum); |
| 896 | /* update pid */ |
| 897 | dload->magic_struct.pid = PID_MAGIC_ID; |
| 898 | dload->pid = pid; |
| 899 | |
| 900 | /* update serial number */ |
| 901 | dload->magic_struct.serial_num = 0; |
| 902 | if (!snum) { |
| 903 | memset(dload->serial_number, 0, SERIAL_NUMBER_LENGTH); |
| 904 | goto out; |
| 905 | } |
| 906 | |
| 907 | dload->magic_struct.serial_num = SERIAL_NUM_MAGIC_ID; |
Jin Hong | e49b148 | 2011-10-03 11:15:50 -0700 | [diff] [blame] | 908 | strlcpy(dload->serial_number, snum, SERIAL_NUMBER_LENGTH); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 909 | out: |
| 910 | iounmap(dload); |
| 911 | return 0; |
| 912 | } |
| 913 | |
| 914 | static struct android_usb_platform_data android_usb_pdata = { |
| 915 | .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num, |
| 916 | }; |
| 917 | |
Stepan Moskovchenko | 14aa649 | 2011-08-08 15:15:01 -0700 | [diff] [blame] | 918 | static struct platform_device android_usb_device = { |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 919 | .name = "android_usb", |
| 920 | .id = -1, |
| 921 | .dev = { |
| 922 | .platform_data = &android_usb_pdata, |
| 923 | }, |
| 924 | }; |
| 925 | |
| 926 | static uint8_t spm_wfi_cmd_sequence[] __initdata = { |
| 927 | 0x03, 0x0f, |
| 928 | }; |
| 929 | |
| 930 | static uint8_t spm_power_collapse_without_rpm[] __initdata = { |
| 931 | 0x00, 0x24, 0x54, 0x10, |
| 932 | 0x09, 0x03, 0x01, |
| 933 | 0x10, 0x54, 0x30, 0x0C, |
| 934 | 0x24, 0x30, 0x0f, |
| 935 | }; |
| 936 | |
| 937 | static uint8_t spm_power_collapse_with_rpm[] __initdata = { |
| 938 | 0x00, 0x24, 0x54, 0x10, |
| 939 | 0x09, 0x07, 0x01, 0x0B, |
| 940 | 0x10, 0x54, 0x30, 0x0C, |
| 941 | 0x24, 0x30, 0x0f, |
| 942 | }; |
| 943 | |
| 944 | static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = { |
| 945 | [0] = { |
| 946 | .mode = MSM_SPM_MODE_CLOCK_GATING, |
| 947 | .notify_rpm = false, |
| 948 | .cmd = spm_wfi_cmd_sequence, |
| 949 | }, |
| 950 | [1] = { |
| 951 | .mode = MSM_SPM_MODE_POWER_COLLAPSE, |
| 952 | .notify_rpm = false, |
| 953 | .cmd = spm_power_collapse_without_rpm, |
| 954 | }, |
| 955 | [2] = { |
| 956 | .mode = MSM_SPM_MODE_POWER_COLLAPSE, |
| 957 | .notify_rpm = true, |
| 958 | .cmd = spm_power_collapse_with_rpm, |
| 959 | }, |
| 960 | }; |
| 961 | |
| 962 | static struct msm_spm_platform_data msm_spm_data[] __initdata = { |
| 963 | [0] = { |
| 964 | .reg_base_addr = MSM_SAW0_BASE, |
| 965 | .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00, |
| 966 | .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F, |
Stephen Boyd | 9ac587a | 2011-12-09 22:55:10 -0800 | [diff] [blame] | 967 | .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0xB0, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 968 | #if defined(CONFIG_MSM_AVS_HW) |
| 969 | .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00, |
| 970 | .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00, |
| 971 | #endif |
| 972 | .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01, |
| 973 | .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202, |
| 974 | .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C, |
| 975 | .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C, |
| 976 | .vctl_timeout_us = 50, |
| 977 | .num_modes = ARRAY_SIZE(msm_spm_seq_list), |
| 978 | .modes = msm_spm_seq_list, |
| 979 | }, |
| 980 | [1] = { |
| 981 | .reg_base_addr = MSM_SAW1_BASE, |
| 982 | .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00, |
| 983 | .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F, |
Stephen Boyd | 9ac587a | 2011-12-09 22:55:10 -0800 | [diff] [blame] | 984 | .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0xB0, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 985 | #if defined(CONFIG_MSM_AVS_HW) |
| 986 | .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00, |
| 987 | .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00, |
| 988 | #endif |
| 989 | .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01, |
| 990 | .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202, |
| 991 | .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C, |
| 992 | .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C, |
| 993 | .vctl_timeout_us = 50, |
| 994 | .num_modes = ARRAY_SIZE(msm_spm_seq_list), |
| 995 | .modes = msm_spm_seq_list, |
| 996 | }, |
| 997 | }; |
| 998 | |
| 999 | static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = { |
| 1000 | 0x00, 0x20, 0x03, 0x20, |
| 1001 | 0x00, 0x0f, |
| 1002 | }; |
| 1003 | |
| 1004 | static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = { |
| 1005 | 0x00, 0x20, 0x34, 0x64, |
| 1006 | 0x48, 0x07, 0x48, 0x20, |
| 1007 | 0x50, 0x64, 0x04, 0x34, |
| 1008 | 0x50, 0x0f, |
| 1009 | }; |
| 1010 | static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = { |
| 1011 | 0x00, 0x10, 0x34, 0x64, |
| 1012 | 0x48, 0x07, 0x48, 0x10, |
| 1013 | 0x50, 0x64, 0x04, 0x34, |
| 1014 | 0x50, 0x0F, |
| 1015 | }; |
| 1016 | |
| 1017 | static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = { |
| 1018 | [0] = { |
| 1019 | .mode = MSM_SPM_L2_MODE_RETENTION, |
| 1020 | .notify_rpm = false, |
| 1021 | .cmd = l2_spm_wfi_cmd_sequence, |
| 1022 | }, |
| 1023 | [1] = { |
| 1024 | .mode = MSM_SPM_L2_MODE_GDHS, |
| 1025 | .notify_rpm = true, |
| 1026 | .cmd = l2_spm_gdhs_cmd_sequence, |
| 1027 | }, |
| 1028 | [2] = { |
| 1029 | .mode = MSM_SPM_L2_MODE_POWER_COLLAPSE, |
| 1030 | .notify_rpm = true, |
| 1031 | .cmd = l2_spm_power_off_cmd_sequence, |
| 1032 | }, |
| 1033 | }; |
| 1034 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1035 | static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = { |
| 1036 | [0] = { |
| 1037 | .reg_base_addr = MSM_SAW_L2_BASE, |
| 1038 | .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00, |
| 1039 | .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00, |
| 1040 | .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202, |
| 1041 | .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE, |
| 1042 | .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020, |
| 1043 | .modes = msm_spm_l2_seq_list, |
| 1044 | .num_modes = ARRAY_SIZE(msm_spm_l2_seq_list), |
| 1045 | }, |
| 1046 | }; |
| 1047 | |
Mohan Pallaka | 5e49039 | 2011-09-09 15:18:41 +0530 | [diff] [blame] | 1048 | #define PM_HAP_EN_GPIO PM8921_GPIO_PM_TO_SYS(33) |
| 1049 | #define PM_HAP_LEN_GPIO PM8921_GPIO_PM_TO_SYS(20) |
| 1050 | |
| 1051 | static struct msm_xo_voter *xo_handle_d1; |
| 1052 | |
| 1053 | static int isa1200_power(int on) |
| 1054 | { |
| 1055 | int rc = 0; |
| 1056 | |
| 1057 | gpio_set_value(HAP_SHIFT_LVL_OE_GPIO, !!on); |
| 1058 | |
| 1059 | rc = on ? msm_xo_mode_vote(xo_handle_d1, MSM_XO_MODE_ON) : |
| 1060 | msm_xo_mode_vote(xo_handle_d1, MSM_XO_MODE_OFF); |
| 1061 | if (rc < 0) { |
| 1062 | pr_err("%s: failed to %svote for TCXO D1 buffer%d\n", |
| 1063 | __func__, on ? "" : "de-", rc); |
| 1064 | goto err_xo_vote; |
| 1065 | } |
| 1066 | |
| 1067 | return 0; |
| 1068 | |
| 1069 | err_xo_vote: |
| 1070 | gpio_set_value(HAP_SHIFT_LVL_OE_GPIO, !on); |
| 1071 | return rc; |
| 1072 | } |
| 1073 | |
| 1074 | static int isa1200_dev_setup(bool enable) |
| 1075 | { |
| 1076 | int rc = 0; |
| 1077 | |
| 1078 | struct pm_gpio hap_gpio_config = { |
| 1079 | .direction = PM_GPIO_DIR_OUT, |
| 1080 | .pull = PM_GPIO_PULL_NO, |
| 1081 | .out_strength = PM_GPIO_STRENGTH_HIGH, |
| 1082 | .function = PM_GPIO_FUNC_NORMAL, |
| 1083 | .inv_int_pol = 0, |
| 1084 | .vin_sel = 2, |
| 1085 | .output_buffer = PM_GPIO_OUT_BUF_CMOS, |
| 1086 | .output_value = 0, |
| 1087 | }; |
| 1088 | |
| 1089 | if (enable == true) { |
| 1090 | rc = pm8xxx_gpio_config(PM_HAP_EN_GPIO, &hap_gpio_config); |
| 1091 | if (rc) { |
| 1092 | pr_err("%s: pm8921 gpio %d config failed(%d)\n", |
| 1093 | __func__, PM_HAP_EN_GPIO, rc); |
| 1094 | return rc; |
| 1095 | } |
| 1096 | |
| 1097 | rc = pm8xxx_gpio_config(PM_HAP_LEN_GPIO, &hap_gpio_config); |
| 1098 | if (rc) { |
| 1099 | pr_err("%s: pm8921 gpio %d config failed(%d)\n", |
| 1100 | __func__, PM_HAP_LEN_GPIO, rc); |
| 1101 | return rc; |
| 1102 | } |
| 1103 | |
| 1104 | rc = gpio_request(HAP_SHIFT_LVL_OE_GPIO, "hap_shft_lvl_oe"); |
| 1105 | if (rc) { |
| 1106 | pr_err("%s: unable to request gpio %d (%d)\n", |
| 1107 | __func__, HAP_SHIFT_LVL_OE_GPIO, rc); |
| 1108 | return rc; |
| 1109 | } |
| 1110 | |
| 1111 | rc = gpio_direction_output(HAP_SHIFT_LVL_OE_GPIO, 0); |
| 1112 | if (rc) { |
| 1113 | pr_err("%s: Unable to set direction\n", __func__); |
| 1114 | goto free_gpio; |
| 1115 | } |
| 1116 | |
| 1117 | xo_handle_d1 = msm_xo_get(MSM_XO_TCXO_D1, "isa1200"); |
| 1118 | if (IS_ERR(xo_handle_d1)) { |
| 1119 | rc = PTR_ERR(xo_handle_d1); |
| 1120 | pr_err("%s: failed to get the handle for D1(%d)\n", |
| 1121 | __func__, rc); |
| 1122 | goto gpio_set_dir; |
| 1123 | } |
| 1124 | } else { |
| 1125 | gpio_free(HAP_SHIFT_LVL_OE_GPIO); |
| 1126 | |
| 1127 | msm_xo_put(xo_handle_d1); |
| 1128 | } |
| 1129 | |
| 1130 | return 0; |
| 1131 | |
| 1132 | gpio_set_dir: |
| 1133 | gpio_set_value(HAP_SHIFT_LVL_OE_GPIO, 0); |
| 1134 | free_gpio: |
| 1135 | gpio_free(HAP_SHIFT_LVL_OE_GPIO); |
| 1136 | return rc; |
| 1137 | } |
| 1138 | |
| 1139 | static struct isa1200_regulator isa1200_reg_data[] = { |
| 1140 | { |
| 1141 | .name = "vcc_i2c", |
| 1142 | .min_uV = ISA_I2C_VTG_MIN_UV, |
| 1143 | .max_uV = ISA_I2C_VTG_MAX_UV, |
| 1144 | .load_uA = ISA_I2C_CURR_UA, |
| 1145 | }, |
| 1146 | }; |
| 1147 | |
| 1148 | static struct isa1200_platform_data isa1200_1_pdata = { |
| 1149 | .name = "vibrator", |
| 1150 | .dev_setup = isa1200_dev_setup, |
| 1151 | .power_on = isa1200_power, |
| 1152 | .hap_en_gpio = PM_HAP_EN_GPIO, |
| 1153 | .hap_len_gpio = PM_HAP_LEN_GPIO, |
| 1154 | .max_timeout = 15000, |
| 1155 | .mode_ctrl = PWM_GEN_MODE, |
| 1156 | .pwm_fd = { |
| 1157 | .pwm_div = 256, |
| 1158 | }, |
| 1159 | .is_erm = false, |
| 1160 | .smart_en = true, |
| 1161 | .ext_clk_en = true, |
| 1162 | .chip_en = 1, |
| 1163 | .regulator_info = isa1200_reg_data, |
| 1164 | .num_regulators = ARRAY_SIZE(isa1200_reg_data), |
| 1165 | }; |
| 1166 | |
| 1167 | static struct i2c_board_info msm_isa1200_board_info[] __initdata = { |
| 1168 | { |
| 1169 | I2C_BOARD_INFO("isa1200_1", 0x90>>1), |
| 1170 | .platform_data = &isa1200_1_pdata, |
| 1171 | }, |
| 1172 | }; |
| 1173 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1174 | #define CYTTSP_TS_GPIO_IRQ 11 |
| 1175 | #define CYTTSP_TS_SLEEP_GPIO 50 |
| 1176 | #define CYTTSP_TS_RESOUT_N_GPIO 52 |
| 1177 | |
| 1178 | /*virtual key support */ |
| 1179 | static ssize_t tma340_vkeys_show(struct kobject *kobj, |
| 1180 | struct kobj_attribute *attr, char *buf) |
| 1181 | { |
| 1182 | return snprintf(buf, 200, |
| 1183 | __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":73:1120:97:97" |
| 1184 | ":" __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":230:1120:97:97" |
| 1185 | ":" __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":389:1120:97:97" |
| 1186 | ":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":544:1120:97:97" |
| 1187 | "\n"); |
| 1188 | } |
| 1189 | |
| 1190 | static struct kobj_attribute tma340_vkeys_attr = { |
| 1191 | .attr = { |
| 1192 | .mode = S_IRUGO, |
| 1193 | }, |
| 1194 | .show = &tma340_vkeys_show, |
| 1195 | }; |
| 1196 | |
| 1197 | static struct attribute *tma340_properties_attrs[] = { |
| 1198 | &tma340_vkeys_attr.attr, |
| 1199 | NULL |
| 1200 | }; |
| 1201 | |
| 1202 | static struct attribute_group tma340_properties_attr_group = { |
| 1203 | .attrs = tma340_properties_attrs, |
| 1204 | }; |
| 1205 | |
| 1206 | |
| 1207 | static int cyttsp_platform_init(struct i2c_client *client) |
| 1208 | { |
| 1209 | int rc = 0; |
| 1210 | static struct kobject *tma340_properties_kobj; |
| 1211 | |
| 1212 | tma340_vkeys_attr.attr.name = "virtualkeys.cyttsp-i2c"; |
| 1213 | tma340_properties_kobj = kobject_create_and_add("board_properties", |
| 1214 | NULL); |
| 1215 | if (tma340_properties_kobj) |
| 1216 | rc = sysfs_create_group(tma340_properties_kobj, |
| 1217 | &tma340_properties_attr_group); |
| 1218 | if (!tma340_properties_kobj || rc) |
| 1219 | pr_err("%s: failed to create board_properties\n", |
| 1220 | __func__); |
| 1221 | |
| 1222 | return 0; |
| 1223 | } |
| 1224 | |
| 1225 | static struct cyttsp_regulator regulator_data[] = { |
| 1226 | { |
| 1227 | .name = "vdd", |
| 1228 | .min_uV = CY_TMA300_VTG_MIN_UV, |
| 1229 | .max_uV = CY_TMA300_VTG_MAX_UV, |
Anirudh Ghayal | f9929b1 | 2011-09-07 15:57:36 +0530 | [diff] [blame] | 1230 | .hpm_load_uA = CY_TMA300_CURR_24HZ_UA, |
| 1231 | .lpm_load_uA = CY_TMA300_SLEEP_CURR_UA, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1232 | }, |
| 1233 | /* TODO: Remove after runtime PM is enabled in I2C driver */ |
| 1234 | { |
| 1235 | .name = "vcc_i2c", |
| 1236 | .min_uV = CY_I2C_VTG_MIN_UV, |
| 1237 | .max_uV = CY_I2C_VTG_MAX_UV, |
Anirudh Ghayal | f9929b1 | 2011-09-07 15:57:36 +0530 | [diff] [blame] | 1238 | .hpm_load_uA = CY_I2C_CURR_UA, |
| 1239 | .lpm_load_uA = CY_I2C_SLEEP_CURR_UA, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1240 | }, |
| 1241 | }; |
| 1242 | |
| 1243 | static struct cyttsp_platform_data cyttsp_pdata = { |
| 1244 | .panel_maxx = 634, |
| 1245 | .panel_maxy = 1166, |
| 1246 | .disp_maxx = 616, |
| 1247 | .disp_maxy = 1023, |
| 1248 | .disp_minx = 0, |
| 1249 | .disp_miny = 16, |
| 1250 | .flags = 0x01, |
| 1251 | .gen = CY_GEN3, /* or */ |
| 1252 | .use_st = CY_USE_ST, |
| 1253 | .use_mt = CY_USE_MT, |
| 1254 | .use_hndshk = CY_SEND_HNDSHK, |
| 1255 | .use_trk_id = CY_USE_TRACKING_ID, |
Anirudh Ghayal | e96f66d | 2011-08-11 14:06:38 +0530 | [diff] [blame] | 1256 | .use_sleep = CY_USE_DEEP_SLEEP_SEL | CY_USE_LOW_POWER_SEL, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1257 | .use_gestures = CY_USE_GESTURES, |
| 1258 | .fw_fname = "cyttsp_8960_cdp.hex", |
| 1259 | /* activate up to 4 groups |
| 1260 | * and set active distance |
| 1261 | */ |
| 1262 | .gest_set = CY_GEST_GRP1 | CY_GEST_GRP2 | |
| 1263 | CY_GEST_GRP3 | CY_GEST_GRP4 | |
| 1264 | CY_ACT_DIST, |
| 1265 | /* change act_intrvl to customize the Active power state |
| 1266 | * scanning/processing refresh interval for Operating mode |
| 1267 | */ |
| 1268 | .act_intrvl = CY_ACT_INTRVL_DFLT, |
| 1269 | /* change tch_tmout to customize the touch timeout for the |
| 1270 | * Active power state for Operating mode |
| 1271 | */ |
| 1272 | .tch_tmout = CY_TCH_TMOUT_DFLT, |
| 1273 | /* change lp_intrvl to customize the Low Power power state |
| 1274 | * scanning/processing refresh interval for Operating mode |
| 1275 | */ |
| 1276 | .lp_intrvl = CY_LP_INTRVL_DFLT, |
| 1277 | .sleep_gpio = CYTTSP_TS_SLEEP_GPIO, |
| 1278 | .resout_gpio = CYTTSP_TS_RESOUT_N_GPIO, |
| 1279 | .irq_gpio = CYTTSP_TS_GPIO_IRQ, |
| 1280 | .regulator_info = regulator_data, |
| 1281 | .num_regulators = ARRAY_SIZE(regulator_data), |
| 1282 | .init = cyttsp_platform_init, |
Mohan Pallaka | 49c37d6 | 2011-08-01 11:52:00 +0530 | [diff] [blame] | 1283 | .correct_fw_ver = 9, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1284 | }; |
| 1285 | |
| 1286 | static struct i2c_board_info cyttsp_info[] __initdata = { |
| 1287 | { |
| 1288 | I2C_BOARD_INFO(CY_I2C_NAME, 0x24), |
| 1289 | .platform_data = &cyttsp_pdata, |
| 1290 | #ifndef CY_USE_TIMER |
| 1291 | .irq = MSM_GPIO_TO_INT(CYTTSP_TS_GPIO_IRQ), |
| 1292 | #endif /* CY_USE_TIMER */ |
| 1293 | }, |
| 1294 | }; |
| 1295 | |
Mohan Pallaka | 5083738 | 2011-09-07 11:00:57 +0530 | [diff] [blame] | 1296 | /* configuration data */ |
| 1297 | static const u8 mxt_config_data[] = { |
| 1298 | /* T6 Object */ |
Jing Lin | 2f86317 | 2011-10-17 10:56:58 -0700 | [diff] [blame] | 1299 | 0, 0, 0, 0, 0, 0, |
Mohan Pallaka | 5083738 | 2011-09-07 11:00:57 +0530 | [diff] [blame] | 1300 | /* T38 Object */ |
Jing Lin | 93f0708 | 2011-11-11 15:53:54 -0800 | [diff] [blame] | 1301 | 11, 2, 0, 11, 11, 11, 0, 0, 0, 0, |
Jing Lin | 2f86317 | 2011-10-17 10:56:58 -0700 | [diff] [blame] | 1302 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 1303 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 1304 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 1305 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 1306 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 1307 | 0, 0, 0, 0, |
Mohan Pallaka | 5083738 | 2011-09-07 11:00:57 +0530 | [diff] [blame] | 1308 | /* T7 Object */ |
Jing Lin | 2f86317 | 2011-10-17 10:56:58 -0700 | [diff] [blame] | 1309 | 100, 16, 50, |
Mohan Pallaka | 5083738 | 2011-09-07 11:00:57 +0530 | [diff] [blame] | 1310 | /* T8 Object */ |
Jing Lin | 93f0708 | 2011-11-11 15:53:54 -0800 | [diff] [blame] | 1311 | 8, 0, 0, 0, 0, 0, 8, 14, 50, 215, |
Mohan Pallaka | 5083738 | 2011-09-07 11:00:57 +0530 | [diff] [blame] | 1312 | /* T9 Object */ |
Jing Lin | 93f0708 | 2011-11-11 15:53:54 -0800 | [diff] [blame] | 1313 | 131, 0, 0, 26, 42, 0, 32, 63, 3, 5, |
| 1314 | 0, 2, 1, 113, 10, 10, 8, 10, 255, 2, |
| 1315 | 85, 5, 0, 0, 20, 20, 75, 25, 202, 29, |
| 1316 | 10, 10, 45, 46, |
Mohan Pallaka | 5083738 | 2011-09-07 11:00:57 +0530 | [diff] [blame] | 1317 | /* T15 Object */ |
Jing Lin | 2f86317 | 2011-10-17 10:56:58 -0700 | [diff] [blame] | 1318 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 1319 | 0, |
Mohan Pallaka | 5083738 | 2011-09-07 11:00:57 +0530 | [diff] [blame] | 1320 | /* T22 Object */ |
Jing Lin | 93f0708 | 2011-11-11 15:53:54 -0800 | [diff] [blame] | 1321 | 5, 0, 0, 0, 0, 0, 0, 0, 30, 0, |
| 1322 | 0, 0, 5, 8, 10, 13, 0, |
Mohan Pallaka | 5083738 | 2011-09-07 11:00:57 +0530 | [diff] [blame] | 1323 | /* T24 Object */ |
Jing Lin | 2f86317 | 2011-10-17 10:56:58 -0700 | [diff] [blame] | 1324 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 1325 | 0, 0, 0, 0, 0, 0, 0, 0, 0, |
Mohan Pallaka | 5083738 | 2011-09-07 11:00:57 +0530 | [diff] [blame] | 1326 | /* T25 Object */ |
Jing Lin | 2f86317 | 2011-10-17 10:56:58 -0700 | [diff] [blame] | 1327 | 3, 0, 188, 52, 52, 33, 0, 0, 0, 0, |
| 1328 | 0, 0, 0, 0, |
Mohan Pallaka | 5083738 | 2011-09-07 11:00:57 +0530 | [diff] [blame] | 1329 | /* T27 Object */ |
Jing Lin | 2f86317 | 2011-10-17 10:56:58 -0700 | [diff] [blame] | 1330 | 0, 0, 0, 0, 0, 0, 0, |
Mohan Pallaka | 5083738 | 2011-09-07 11:00:57 +0530 | [diff] [blame] | 1331 | /* T28 Object */ |
Jing Lin | 93f0708 | 2011-11-11 15:53:54 -0800 | [diff] [blame] | 1332 | 0, 0, 0, 8, 12, 60, |
Mohan Pallaka | 5083738 | 2011-09-07 11:00:57 +0530 | [diff] [blame] | 1333 | /* T40 Object */ |
Jing Lin | 2f86317 | 2011-10-17 10:56:58 -0700 | [diff] [blame] | 1334 | 0, 0, 0, 0, 0, |
Mohan Pallaka | 5083738 | 2011-09-07 11:00:57 +0530 | [diff] [blame] | 1335 | /* T41 Object */ |
Jing Lin | 2f86317 | 2011-10-17 10:56:58 -0700 | [diff] [blame] | 1336 | 0, 0, 0, 0, 0, 0, |
Mohan Pallaka | 5083738 | 2011-09-07 11:00:57 +0530 | [diff] [blame] | 1337 | /* T43 Object */ |
Jing Lin | 2f86317 | 2011-10-17 10:56:58 -0700 | [diff] [blame] | 1338 | 0, 0, 0, 0, 0, 0, |
Mohan Pallaka | 5083738 | 2011-09-07 11:00:57 +0530 | [diff] [blame] | 1339 | }; |
| 1340 | |
| 1341 | #define MXT_TS_GPIO_IRQ 11 |
| 1342 | #define MXT_TS_LDO_EN_GPIO 50 |
| 1343 | #define MXT_TS_RESET_GPIO 52 |
| 1344 | |
| 1345 | static void mxt_init_hw_liquid(void) |
| 1346 | { |
| 1347 | int rc; |
| 1348 | |
| 1349 | rc = gpio_request(MXT_TS_GPIO_IRQ, "mxt_ts_irq_gpio"); |
| 1350 | if (rc) { |
| 1351 | pr_err("%s: unable to request mxt_ts_irq gpio [%d]\n", |
| 1352 | __func__, MXT_TS_GPIO_IRQ); |
| 1353 | return; |
| 1354 | } |
| 1355 | |
| 1356 | rc = gpio_direction_input(MXT_TS_GPIO_IRQ); |
| 1357 | if (rc) { |
| 1358 | pr_err("%s: unable to set_direction for mxt_ts_irq gpio [%d]\n", |
| 1359 | __func__, MXT_TS_GPIO_IRQ); |
| 1360 | goto err_irq_gpio_req; |
| 1361 | } |
| 1362 | |
| 1363 | rc = gpio_request(MXT_TS_LDO_EN_GPIO, "mxt_ldo_en_gpio"); |
| 1364 | if (rc) { |
| 1365 | pr_err("%s: unable to request mxt_ldo_en gpio [%d]\n", |
| 1366 | __func__, MXT_TS_LDO_EN_GPIO); |
| 1367 | goto err_irq_gpio_req; |
| 1368 | } |
| 1369 | |
| 1370 | rc = gpio_direction_output(MXT_TS_LDO_EN_GPIO, 1); |
| 1371 | if (rc) { |
| 1372 | pr_err("%s: unable to set_direction for mxt_ldo_en gpio [%d]\n", |
| 1373 | __func__, MXT_TS_LDO_EN_GPIO); |
| 1374 | goto err_ldo_gpio_req; |
| 1375 | } |
| 1376 | |
| 1377 | rc = gpio_request(MXT_TS_RESET_GPIO, "mxt_reset_gpio"); |
| 1378 | if (rc) { |
| 1379 | pr_err("%s: unable to request mxt_reset gpio [%d]\n", |
| 1380 | __func__, MXT_TS_RESET_GPIO); |
| 1381 | goto err_ldo_gpio_set_dir; |
| 1382 | } |
| 1383 | |
| 1384 | rc = gpio_direction_output(MXT_TS_RESET_GPIO, 1); |
| 1385 | if (rc) { |
| 1386 | pr_err("%s: unable to set_direction for mxt_reset gpio [%d]\n", |
| 1387 | __func__, MXT_TS_RESET_GPIO); |
| 1388 | goto err_reset_gpio_req; |
| 1389 | } |
| 1390 | |
| 1391 | return; |
| 1392 | |
| 1393 | err_reset_gpio_req: |
| 1394 | gpio_free(MXT_TS_RESET_GPIO); |
| 1395 | err_ldo_gpio_set_dir: |
| 1396 | gpio_set_value(MXT_TS_LDO_EN_GPIO, 0); |
| 1397 | err_ldo_gpio_req: |
| 1398 | gpio_free(MXT_TS_LDO_EN_GPIO); |
| 1399 | err_irq_gpio_req: |
| 1400 | gpio_free(MXT_TS_GPIO_IRQ); |
| 1401 | } |
| 1402 | |
| 1403 | static struct mxt_platform_data mxt_platform_data = { |
| 1404 | .config = mxt_config_data, |
| 1405 | .config_length = ARRAY_SIZE(mxt_config_data), |
Jing Lin | 2f86317 | 2011-10-17 10:56:58 -0700 | [diff] [blame] | 1406 | .x_size = 1365, |
| 1407 | .y_size = 767, |
Mohan Pallaka | 5083738 | 2011-09-07 11:00:57 +0530 | [diff] [blame] | 1408 | .irqflags = IRQF_TRIGGER_FALLING, |
Jing Lin | 2f86317 | 2011-10-17 10:56:58 -0700 | [diff] [blame] | 1409 | .i2c_pull_up = true, |
Mohan Pallaka | 5083738 | 2011-09-07 11:00:57 +0530 | [diff] [blame] | 1410 | }; |
| 1411 | |
| 1412 | static struct i2c_board_info mxt_device_info[] __initdata = { |
| 1413 | { |
| 1414 | I2C_BOARD_INFO("atmel_mxt_ts", 0x5b), |
| 1415 | .platform_data = &mxt_platform_data, |
| 1416 | .irq = MSM_GPIO_TO_INT(MXT_TS_GPIO_IRQ), |
| 1417 | }, |
| 1418 | }; |
| 1419 | |
Eugene Yasman | d2316b8 | 2011-12-07 18:23:48 +0200 | [diff] [blame] | 1420 | static struct i2c_board_info sii_device_info[] __initdata = { |
| 1421 | { |
| 1422 | I2C_BOARD_INFO("Sil-9244", 0x39), |
| 1423 | .flags = I2C_CLIENT_WAKE, |
| 1424 | .irq = MSM_GPIO_TO_INT(15), |
| 1425 | }, |
| 1426 | }; |
| 1427 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1428 | static void gsbi_qup_i2c_gpio_config(int adap_id, int config_type) |
| 1429 | { |
| 1430 | } |
| 1431 | |
| 1432 | static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi4_pdata = { |
| 1433 | .clk_freq = 100000, |
| 1434 | .src_clk_rate = 24000000, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1435 | .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config, |
| 1436 | }; |
| 1437 | |
| 1438 | static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi3_pdata = { |
| 1439 | .clk_freq = 100000, |
| 1440 | .src_clk_rate = 24000000, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1441 | .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config, |
| 1442 | }; |
| 1443 | |
| 1444 | static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi10_pdata = { |
| 1445 | .clk_freq = 100000, |
| 1446 | .src_clk_rate = 24000000, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1447 | .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config, |
| 1448 | }; |
| 1449 | |
| 1450 | static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi12_pdata = { |
| 1451 | .clk_freq = 100000, |
| 1452 | .src_clk_rate = 24000000, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1453 | .msm_i2c_config_gpio = gsbi_qup_i2c_gpio_config, |
| 1454 | }; |
| 1455 | |
| 1456 | static struct msm_rpm_platform_data msm_rpm_data = { |
| 1457 | .reg_base_addrs = { |
| 1458 | [MSM_RPM_PAGE_STATUS] = MSM_RPM_BASE, |
| 1459 | [MSM_RPM_PAGE_CTRL] = MSM_RPM_BASE + 0x400, |
| 1460 | [MSM_RPM_PAGE_REQ] = MSM_RPM_BASE + 0x600, |
| 1461 | [MSM_RPM_PAGE_ACK] = MSM_RPM_BASE + 0xa00, |
| 1462 | }, |
| 1463 | |
| 1464 | .irq_ack = RPM_APCC_CPU0_GP_HIGH_IRQ, |
| 1465 | .irq_err = RPM_APCC_CPU0_GP_LOW_IRQ, |
| 1466 | .irq_vmpm = RPM_APCC_CPU0_GP_MEDIUM_IRQ, |
| 1467 | .msm_apps_ipc_rpm_reg = MSM_APCS_GCC_BASE + 0x008, |
| 1468 | .msm_apps_ipc_rpm_val = 4, |
| 1469 | }; |
| 1470 | |
Stepan Moskovchenko | 93d79ec | 2011-09-21 16:52:16 -0700 | [diff] [blame] | 1471 | static struct ks8851_pdata spi_eth_pdata = { |
| 1472 | .irq_gpio = KS8851_IRQ_GPIO, |
| 1473 | .rst_gpio = KS8851_RST_GPIO, |
| 1474 | }; |
Praveen Chidambaram | 043f4ce | 2011-08-02 09:37:59 -0600 | [diff] [blame] | 1475 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1476 | static struct spi_board_info spi_board_info[] __initdata = { |
| 1477 | { |
| 1478 | .modalias = "ks8851", |
| 1479 | .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO), |
| 1480 | .max_speed_hz = 19200000, |
| 1481 | .bus_num = 0, |
| 1482 | .chip_select = 0, |
| 1483 | .mode = SPI_MODE_0, |
Stepan Moskovchenko | 93d79ec | 2011-09-21 16:52:16 -0700 | [diff] [blame] | 1484 | .platform_data = &spi_eth_pdata |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1485 | }, |
Chandan Uddaraju | 15e54b9 | 2011-09-12 10:52:36 -0700 | [diff] [blame] | 1486 | { |
| 1487 | .modalias = "dsi_novatek_3d_panel_spi", |
| 1488 | .max_speed_hz = 10800000, |
| 1489 | .bus_num = 0, |
| 1490 | .chip_select = 1, |
| 1491 | .mode = SPI_MODE_0, |
| 1492 | }, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1493 | }; |
| 1494 | |
| 1495 | static struct platform_device msm_device_saw_core0 = { |
| 1496 | .name = "saw-regulator", |
| 1497 | .id = 0, |
| 1498 | .dev = { |
| 1499 | .platform_data = &msm_saw_regulator_pdata_s5, |
| 1500 | }, |
| 1501 | }; |
| 1502 | |
| 1503 | static struct platform_device msm_device_saw_core1 = { |
| 1504 | .name = "saw-regulator", |
| 1505 | .id = 1, |
| 1506 | .dev = { |
| 1507 | .platform_data = &msm_saw_regulator_pdata_s6, |
| 1508 | }, |
| 1509 | }; |
| 1510 | |
Siddartha Mohanadoss | ba21fdd | 2011-08-18 10:05:27 -0700 | [diff] [blame] | 1511 | static struct tsens_platform_data msm_tsens_pdata = { |
| 1512 | .slope = 910, |
| 1513 | .tsens_factor = 1000, |
| 1514 | .hw_type = MSM_8960, |
| 1515 | .tsens_num_sensor = 5, |
| 1516 | }; |
| 1517 | |
| 1518 | static struct platform_device msm_tsens_device = { |
| 1519 | .name = "tsens8960-tm", |
| 1520 | .id = -1, |
| 1521 | .dev = { |
| 1522 | .platform_data = &msm_tsens_pdata, |
| 1523 | }, |
| 1524 | }; |
| 1525 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1526 | #ifdef CONFIG_MSM_FAKE_BATTERY |
| 1527 | static struct platform_device fish_battery_device = { |
| 1528 | .name = "fish_battery", |
| 1529 | }; |
| 1530 | #endif |
| 1531 | |
David Collins | 26f0556 | 2011-06-20 09:56:28 -0700 | [diff] [blame] | 1532 | static struct platform_device msm8960_device_ext_5v_vreg __devinitdata = { |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1533 | .name = GPIO_REGULATOR_DEV_NAME, |
| 1534 | .id = PM8921_MPP_PM_TO_SYS(7), |
| 1535 | .dev = { |
| 1536 | .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V], |
| 1537 | }, |
| 1538 | }; |
| 1539 | |
David Collins | 26f0556 | 2011-06-20 09:56:28 -0700 | [diff] [blame] | 1540 | static struct platform_device msm8960_device_ext_l2_vreg __devinitdata = { |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1541 | .name = GPIO_REGULATOR_DEV_NAME, |
| 1542 | .id = 91, |
| 1543 | .dev = { |
| 1544 | .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_L2], |
| 1545 | }, |
| 1546 | }; |
| 1547 | |
David Collins | b10be1d | 2011-09-02 10:29:31 -0700 | [diff] [blame] | 1548 | static struct platform_device msm8960_device_ext_3p3v_vreg __devinitdata = { |
| 1549 | .name = GPIO_REGULATOR_DEV_NAME, |
| 1550 | .id = PM8921_GPIO_PM_TO_SYS(17), |
| 1551 | .dev = { |
| 1552 | .platform_data = |
| 1553 | &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_3P3V], |
| 1554 | }, |
| 1555 | }; |
| 1556 | |
David Collins | 26f0556 | 2011-06-20 09:56:28 -0700 | [diff] [blame] | 1557 | static struct platform_device msm8960_device_rpm_regulator __devinitdata = { |
| 1558 | .name = "rpm-regulator", |
| 1559 | .id = -1, |
| 1560 | .dev = { |
| 1561 | .platform_data = &msm_rpm_regulator_pdata, |
| 1562 | }, |
| 1563 | }; |
| 1564 | |
David Collins | 4c31a87 | 2011-08-31 10:07:10 -0700 | [diff] [blame] | 1565 | static struct msm_rpm_log_platform_data msm_rpm_log_pdata = { |
| 1566 | .phys_addr_base = 0x0010C000, |
| 1567 | .reg_offsets = { |
| 1568 | [MSM_RPM_LOG_PAGE_INDICES] = 0x00000080, |
| 1569 | [MSM_RPM_LOG_PAGE_BUFFER] = 0x000000A0, |
| 1570 | }, |
| 1571 | .phys_size = SZ_8K, |
| 1572 | .log_len = 4096, /* log's buffer length in bytes */ |
| 1573 | .log_len_mask = (4096 >> 2) - 1, /* length mask in units of u32 */ |
| 1574 | }; |
| 1575 | |
| 1576 | static struct platform_device msm_rpm_log_device = { |
| 1577 | .name = "msm_rpm_log", |
| 1578 | .id = -1, |
| 1579 | .dev = { |
| 1580 | .platform_data = &msm_rpm_log_pdata, |
| 1581 | }, |
| 1582 | }; |
| 1583 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1584 | static struct platform_device *common_devices[] __initdata = { |
Stepan Moskovchenko | df13d34 | 2011-08-03 19:01:25 -0700 | [diff] [blame] | 1585 | &msm8960_device_dmov, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1586 | &msm_device_smd, |
| 1587 | &msm8960_device_uart_gsbi5, |
Mayank Rana | 9f51f58 | 2011-08-04 18:35:59 +0530 | [diff] [blame] | 1588 | &msm_device_uart_dm6, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1589 | &msm_device_saw_core0, |
| 1590 | &msm_device_saw_core1, |
| 1591 | &msm8960_device_ext_5v_vreg, |
| 1592 | &msm8960_device_ext_l2_vreg, |
Jay Chokshi | 33c044a | 2011-12-07 13:05:40 -0800 | [diff] [blame] | 1593 | &msm8960_device_ssbi_pmic, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1594 | &msm8960_device_qup_spi_gsbi1, |
| 1595 | &msm8960_device_qup_i2c_gsbi3, |
| 1596 | &msm8960_device_qup_i2c_gsbi4, |
| 1597 | &msm8960_device_qup_i2c_gsbi10, |
| 1598 | #ifndef CONFIG_MSM_DSPS |
| 1599 | &msm8960_device_qup_i2c_gsbi12, |
| 1600 | #endif |
| 1601 | &msm_slim_ctrl, |
| 1602 | &msm_device_wcnss_wlan, |
| 1603 | #if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \ |
| 1604 | defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) |
| 1605 | &qcrypto_device, |
| 1606 | #endif |
| 1607 | |
| 1608 | #if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \ |
| 1609 | defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE) |
| 1610 | &qcedev_device, |
| 1611 | #endif |
| 1612 | #ifdef CONFIG_MSM_ROTATOR |
| 1613 | &msm_rotator_device, |
| 1614 | #endif |
| 1615 | &msm_device_sps, |
| 1616 | #ifdef CONFIG_MSM_FAKE_BATTERY |
| 1617 | &fish_battery_device, |
| 1618 | #endif |
| 1619 | #ifdef CONFIG_ANDROID_PMEM |
Laura Abbott | 2d1760b | 2011-09-29 21:31:24 -0700 | [diff] [blame] | 1620 | #ifndef CONFIG_MSM_MULTIMEDIA_USE_ION |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1621 | &android_pmem_device, |
| 1622 | &android_pmem_adsp_device, |
Laura Abbott | 2d1760b | 2011-09-29 21:31:24 -0700 | [diff] [blame] | 1623 | #endif |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1624 | &android_pmem_audio_device, |
| 1625 | #endif |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1626 | &msm_device_vidc, |
| 1627 | &msm_device_bam_dmux, |
| 1628 | &msm_fm_platform_init, |
Mona Hossain | 9c430e3 | 2011-07-27 11:04:47 -0700 | [diff] [blame] | 1629 | |
| 1630 | #ifdef CONFIG_HW_RANDOM_MSM |
| 1631 | &msm_device_rng, |
| 1632 | #endif |
Praveen Chidambaram | 043f4ce | 2011-08-02 09:37:59 -0600 | [diff] [blame] | 1633 | &msm_rpm_device, |
Laura Abbott | d618379 | 2011-08-19 13:42:24 -0700 | [diff] [blame] | 1634 | #ifdef CONFIG_ION_MSM |
| 1635 | &ion_dev, |
| 1636 | #endif |
David Collins | 4c31a87 | 2011-08-31 10:07:10 -0700 | [diff] [blame] | 1637 | &msm_rpm_log_device, |
Praveen Chidambaram | 7a71223 | 2011-10-28 13:39:45 -0600 | [diff] [blame] | 1638 | &msm_rpm_stat_device, |
Mona Hossain | 11c03ac | 2011-10-26 12:42:10 -0700 | [diff] [blame] | 1639 | &msm_device_tz_log, |
| 1640 | |
Pratik Patel | 7831c08 | 2011-06-08 21:44:37 -0700 | [diff] [blame] | 1641 | #ifdef CONFIG_MSM_QDSS |
| 1642 | &msm_etb_device, |
| 1643 | &msm_tpiu_device, |
| 1644 | &msm_funnel_device, |
Pratik Patel | fd6f56a | 2011-10-10 17:47:55 -0700 | [diff] [blame] | 1645 | &msm_debug_device, |
Pratik Patel | 7831c08 | 2011-06-08 21:44:37 -0700 | [diff] [blame] | 1646 | &msm_ptm_device, |
| 1647 | #endif |
Swaminathan Sathappan | b77c65e9 | 2011-09-30 18:36:09 -0700 | [diff] [blame] | 1648 | &msm_device_dspcrashd_8960, |
Jeff Ohlstein | 7e66855 | 2011-10-06 16:17:25 -0700 | [diff] [blame] | 1649 | &msm8960_device_watchdog, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1650 | }; |
| 1651 | |
Stepan Moskovchenko | d056fca | 2011-01-27 12:12:07 -0800 | [diff] [blame] | 1652 | static struct platform_device *sim_devices[] __initdata = { |
Stepan Moskovchenko | 14aa649 | 2011-08-08 15:15:01 -0700 | [diff] [blame] | 1653 | &msm8960_device_otg, |
| 1654 | &msm8960_device_gadget_peripheral, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1655 | &msm_device_hsusb_host, |
Vijayavardhan Vennapusa | eb56648 | 2011-09-18 07:48:37 +0530 | [diff] [blame] | 1656 | &msm_device_hsic_host, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1657 | &android_usb_device, |
| 1658 | &msm_device_vidc, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1659 | &msm_bus_apps_fabric, |
| 1660 | &msm_bus_sys_fabric, |
| 1661 | &msm_bus_mm_fabric, |
| 1662 | &msm_bus_sys_fpb, |
| 1663 | &msm_bus_cpss_fpb, |
| 1664 | &msm_pcm, |
| 1665 | &msm_pcm_routing, |
| 1666 | &msm_cpudai0, |
| 1667 | &msm_cpudai1, |
| 1668 | &msm_cpudai_hdmi_rx, |
| 1669 | &msm_cpudai_bt_rx, |
| 1670 | &msm_cpudai_bt_tx, |
| 1671 | &msm_cpudai_fm_rx, |
| 1672 | &msm_cpudai_fm_tx, |
Bhalchandra Gajare | 0e795c4 | 2011-08-15 18:10:30 -0700 | [diff] [blame] | 1673 | &msm_cpudai_auxpcm_rx, |
| 1674 | &msm_cpudai_auxpcm_tx, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1675 | &msm_cpu_fe, |
| 1676 | &msm_stub_codec, |
| 1677 | &msm_voice, |
| 1678 | &msm_voip, |
| 1679 | &msm_lpa_pcm, |
Asish Bhattacharya | 96bb6f4 | 2011-11-01 20:36:09 +0530 | [diff] [blame] | 1680 | &msm_compr_dsp, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1681 | |
| 1682 | #if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \ |
| 1683 | defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) |
| 1684 | &qcrypto_device, |
| 1685 | #endif |
| 1686 | |
| 1687 | #if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \ |
| 1688 | defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE) |
| 1689 | &qcedev_device, |
| 1690 | #endif |
Stepan Moskovchenko | d056fca | 2011-01-27 12:12:07 -0800 | [diff] [blame] | 1691 | }; |
| 1692 | |
| 1693 | static struct platform_device *rumi3_devices[] __initdata = { |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1694 | &msm_kgsl_3d0, |
| 1695 | &msm_kgsl_2d0, |
| 1696 | &msm_kgsl_2d1, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1697 | #ifdef CONFIG_MSM_GEMINI |
| 1698 | &msm8960_gemini_device, |
| 1699 | #endif |
Stepan Moskovchenko | d056fca | 2011-01-27 12:12:07 -0800 | [diff] [blame] | 1700 | }; |
| 1701 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1702 | static struct platform_device *cdp_devices[] __initdata = { |
Stephen Boyd | eb81988 | 2011-08-29 14:46:30 -0700 | [diff] [blame] | 1703 | &msm_8960_q6_lpass, |
| 1704 | &msm_8960_q6_mss_fw, |
| 1705 | &msm_8960_q6_mss_sw, |
Stepan Moskovchenko | 14aa649 | 2011-08-08 15:15:01 -0700 | [diff] [blame] | 1706 | &msm8960_device_otg, |
| 1707 | &msm8960_device_gadget_peripheral, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1708 | &msm_device_hsusb_host, |
| 1709 | &android_usb_device, |
| 1710 | &msm_pcm, |
| 1711 | &msm_pcm_routing, |
| 1712 | &msm_cpudai0, |
| 1713 | &msm_cpudai1, |
| 1714 | &msm_cpudai_hdmi_rx, |
| 1715 | &msm_cpudai_bt_rx, |
| 1716 | &msm_cpudai_bt_tx, |
| 1717 | &msm_cpudai_fm_rx, |
| 1718 | &msm_cpudai_fm_tx, |
Bhalchandra Gajare | 0e795c4 | 2011-08-15 18:10:30 -0700 | [diff] [blame] | 1719 | &msm_cpudai_auxpcm_rx, |
| 1720 | &msm_cpudai_auxpcm_tx, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1721 | &msm_cpu_fe, |
| 1722 | &msm_stub_codec, |
| 1723 | &msm_kgsl_3d0, |
| 1724 | #ifdef CONFIG_MSM_KGSL_2D |
| 1725 | &msm_kgsl_2d0, |
| 1726 | &msm_kgsl_2d1, |
| 1727 | #endif |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1728 | #ifdef CONFIG_MSM_GEMINI |
| 1729 | &msm8960_gemini_device, |
| 1730 | #endif |
| 1731 | &msm_voice, |
| 1732 | &msm_voip, |
| 1733 | &msm_lpa_pcm, |
Laxminath Kasam | cee1d60 | 2011-08-01 19:26:57 +0530 | [diff] [blame] | 1734 | &msm_cpudai_afe_01_rx, |
| 1735 | &msm_cpudai_afe_01_tx, |
| 1736 | &msm_cpudai_afe_02_rx, |
| 1737 | &msm_cpudai_afe_02_tx, |
| 1738 | &msm_pcm_afe, |
Asish Bhattacharya | 96bb6f4 | 2011-11-01 20:36:09 +0530 | [diff] [blame] | 1739 | &msm_compr_dsp, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1740 | &msm_pcm_hostless, |
| 1741 | &msm_bus_apps_fabric, |
| 1742 | &msm_bus_sys_fabric, |
| 1743 | &msm_bus_mm_fabric, |
| 1744 | &msm_bus_sys_fpb, |
| 1745 | &msm_bus_cpss_fpb, |
Siddartha Mohanadoss | ba21fdd | 2011-08-18 10:05:27 -0700 | [diff] [blame] | 1746 | &msm_tsens_device, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1747 | }; |
| 1748 | |
| 1749 | static void __init msm8960_i2c_init(void) |
| 1750 | { |
| 1751 | msm8960_device_qup_i2c_gsbi4.dev.platform_data = |
| 1752 | &msm8960_i2c_qup_gsbi4_pdata; |
| 1753 | |
| 1754 | msm8960_device_qup_i2c_gsbi3.dev.platform_data = |
| 1755 | &msm8960_i2c_qup_gsbi3_pdata; |
| 1756 | |
| 1757 | msm8960_device_qup_i2c_gsbi10.dev.platform_data = |
| 1758 | &msm8960_i2c_qup_gsbi10_pdata; |
| 1759 | |
| 1760 | msm8960_device_qup_i2c_gsbi12.dev.platform_data = |
| 1761 | &msm8960_i2c_qup_gsbi12_pdata; |
| 1762 | } |
| 1763 | |
Lucille Sylvester | 34ec369 | 2011-08-16 16:28:04 -0600 | [diff] [blame] | 1764 | static void __init msm8960_gfx_init(void) |
| 1765 | { |
Jeremy Gebben | 58b2dce | 2011-10-13 11:14:19 -0600 | [diff] [blame] | 1766 | uint32_t soc_platform_version = socinfo_get_version(); |
Lucille Sylvester | 34ec369 | 2011-08-16 16:28:04 -0600 | [diff] [blame] | 1767 | if (SOCINFO_VERSION_MAJOR(soc_platform_version) == 1) { |
| 1768 | struct kgsl_device_platform_data *kgsl_3d0_pdata = |
| 1769 | msm_kgsl_3d0.dev.platform_data; |
Lucille Sylvester | dce84cd | 2011-10-12 14:15:37 -0600 | [diff] [blame] | 1770 | kgsl_3d0_pdata->pwrlevel[0].gpu_freq = 320000000; |
| 1771 | kgsl_3d0_pdata->pwrlevel[1].gpu_freq = 266667000; |
Lucille Sylvester | 34ec369 | 2011-08-16 16:28:04 -0600 | [diff] [blame] | 1772 | } |
| 1773 | } |
| 1774 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1775 | static struct msm_cpuidle_state msm_cstates[] __initdata = { |
| 1776 | {0, 0, "C0", "WFI", |
| 1777 | MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT}, |
| 1778 | |
| 1779 | {0, 1, "C1", "STANDALONE_POWER_COLLAPSE", |
| 1780 | MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE}, |
| 1781 | |
| 1782 | {0, 2, "C2", "POWER_COLLAPSE", |
| 1783 | MSM_PM_SLEEP_MODE_POWER_COLLAPSE}, |
| 1784 | |
| 1785 | {1, 0, "C0", "WFI", |
| 1786 | MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT}, |
| 1787 | |
| 1788 | {1, 1, "C1", "STANDALONE_POWER_COLLAPSE", |
| 1789 | MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE}, |
| 1790 | }; |
| 1791 | |
| 1792 | static struct msm_pm_platform_data msm_pm_data[MSM_PM_SLEEP_MODE_NR * 2] = { |
| 1793 | [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = { |
| 1794 | .idle_supported = 1, |
| 1795 | .suspend_supported = 1, |
| 1796 | .idle_enabled = 0, |
| 1797 | .suspend_enabled = 0, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1798 | }, |
| 1799 | |
| 1800 | [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = { |
| 1801 | .idle_supported = 1, |
| 1802 | .suspend_supported = 1, |
| 1803 | .idle_enabled = 0, |
| 1804 | .suspend_enabled = 0, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1805 | }, |
| 1806 | |
| 1807 | [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = { |
| 1808 | .idle_supported = 1, |
| 1809 | .suspend_supported = 1, |
| 1810 | .idle_enabled = 1, |
| 1811 | .suspend_enabled = 1, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1812 | }, |
| 1813 | |
| 1814 | [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = { |
| 1815 | .idle_supported = 0, |
| 1816 | .suspend_supported = 1, |
| 1817 | .idle_enabled = 0, |
| 1818 | .suspend_enabled = 0, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1819 | }, |
| 1820 | |
| 1821 | [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = { |
| 1822 | .idle_supported = 1, |
| 1823 | .suspend_supported = 1, |
| 1824 | .idle_enabled = 0, |
| 1825 | .suspend_enabled = 0, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1826 | }, |
| 1827 | |
| 1828 | [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = { |
| 1829 | .idle_supported = 1, |
| 1830 | .suspend_supported = 0, |
| 1831 | .idle_enabled = 1, |
| 1832 | .suspend_enabled = 0, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1833 | }, |
| 1834 | }; |
| 1835 | |
| 1836 | static struct msm_rpmrs_level msm_rpmrs_levels[] __initdata = { |
| 1837 | { |
| 1838 | MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT, |
| 1839 | MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE), |
| 1840 | true, |
Maheshkumar Sivasubramanian | ef101a0 | 2011-09-19 16:34:30 -0600 | [diff] [blame] | 1841 | 100, 8000, 100000, 1, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1842 | }, |
| 1843 | |
| 1844 | { |
| 1845 | MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE, |
| 1846 | MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE), |
| 1847 | true, |
Maheshkumar Sivasubramanian | ef101a0 | 2011-09-19 16:34:30 -0600 | [diff] [blame] | 1848 | 2000, 6000, 60100000, 3000, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1849 | }, |
| 1850 | |
| 1851 | { |
| 1852 | MSM_PM_SLEEP_MODE_POWER_COLLAPSE, |
| 1853 | MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE), |
| 1854 | false, |
Maheshkumar Sivasubramanian | ef101a0 | 2011-09-19 16:34:30 -0600 | [diff] [blame] | 1855 | 4200, 5000, 60350000, 3500, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1856 | }, |
| 1857 | |
| 1858 | { |
| 1859 | MSM_PM_SLEEP_MODE_POWER_COLLAPSE, |
| 1860 | MSM_RPMRS_LIMITS(ON, HSFS_OPEN, MAX, ACTIVE), |
| 1861 | false, |
Maheshkumar Sivasubramanian | ef101a0 | 2011-09-19 16:34:30 -0600 | [diff] [blame] | 1862 | 6300, 4500, 65350000, 4800, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1863 | }, |
Maheshkumar Sivasubramanian | 7df1236 | 2011-11-02 08:25:49 -0600 | [diff] [blame] | 1864 | { |
| 1865 | MSM_PM_SLEEP_MODE_POWER_COLLAPSE, |
| 1866 | MSM_RPMRS_LIMITS(ON, HSFS_OPEN, ACTIVE, RET_HIGH), |
| 1867 | false, |
| 1868 | 7000, 3500, 66600000, 5150, |
| 1869 | }, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1870 | |
| 1871 | { |
| 1872 | MSM_PM_SLEEP_MODE_POWER_COLLAPSE, |
| 1873 | MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE), |
| 1874 | false, |
Maheshkumar Sivasubramanian | ef101a0 | 2011-09-19 16:34:30 -0600 | [diff] [blame] | 1875 | 11700, 2500, 67850000, 5500, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1876 | }, |
| 1877 | |
| 1878 | { |
| 1879 | MSM_PM_SLEEP_MODE_POWER_COLLAPSE, |
| 1880 | MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE), |
| 1881 | false, |
Maheshkumar Sivasubramanian | ef101a0 | 2011-09-19 16:34:30 -0600 | [diff] [blame] | 1882 | 13800, 2000, 71850000, 6800, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1883 | }, |
| 1884 | |
| 1885 | { |
| 1886 | MSM_PM_SLEEP_MODE_POWER_COLLAPSE, |
| 1887 | MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH), |
| 1888 | false, |
Maheshkumar Sivasubramanian | ef101a0 | 2011-09-19 16:34:30 -0600 | [diff] [blame] | 1889 | 29700, 500, 75850000, 8800, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1890 | }, |
| 1891 | |
| 1892 | { |
| 1893 | MSM_PM_SLEEP_MODE_POWER_COLLAPSE, |
| 1894 | MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW), |
| 1895 | false, |
Maheshkumar Sivasubramanian | ef101a0 | 2011-09-19 16:34:30 -0600 | [diff] [blame] | 1896 | 29700, 0, 76350000, 9800, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1897 | }, |
| 1898 | }; |
| 1899 | |
| 1900 | #ifdef CONFIG_I2C |
| 1901 | #define I2C_SURF 1 |
| 1902 | #define I2C_FFA (1 << 1) |
| 1903 | #define I2C_RUMI (1 << 2) |
| 1904 | #define I2C_SIM (1 << 3) |
| 1905 | #define I2C_FLUID (1 << 4) |
Amir Samuelov | 05f8780 | 2011-08-27 18:30:12 +0300 | [diff] [blame] | 1906 | #define I2C_LIQUID (1 << 5) |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1907 | |
| 1908 | struct i2c_registry { |
| 1909 | u8 machs; |
| 1910 | int bus; |
| 1911 | struct i2c_board_info *info; |
| 1912 | int len; |
| 1913 | }; |
| 1914 | |
| 1915 | #ifdef CONFIG_MSM_CAMERA |
| 1916 | static struct i2c_board_info msm_camera_boardinfo[] __initdata = { |
| 1917 | #ifdef CONFIG_IMX074 |
| 1918 | { |
| 1919 | I2C_BOARD_INFO("imx074", 0x1A), |
| 1920 | }, |
| 1921 | #endif |
| 1922 | #ifdef CONFIG_OV2720 |
| 1923 | { |
| 1924 | I2C_BOARD_INFO("ov2720", 0x6C), |
| 1925 | }, |
| 1926 | #endif |
Nishant Pandit | 474f225 | 2011-07-23 23:17:56 +0530 | [diff] [blame] | 1927 | #ifdef CONFIG_MSM_CAMERA_FLASH_SC628A |
| 1928 | { |
| 1929 | I2C_BOARD_INFO("sc628a", 0x6E), |
| 1930 | }, |
| 1931 | #endif |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1932 | }; |
| 1933 | #endif |
| 1934 | |
| 1935 | /* Sensors DSPS platform data */ |
| 1936 | #ifdef CONFIG_MSM_DSPS |
| 1937 | #define DSPS_PIL_GENERIC_NAME "dsps" |
| 1938 | #endif /* CONFIG_MSM_DSPS */ |
| 1939 | |
| 1940 | static void __init msm8960_init_dsps(void) |
| 1941 | { |
| 1942 | #ifdef CONFIG_MSM_DSPS |
| 1943 | struct msm_dsps_platform_data *pdata = |
| 1944 | msm_dsps_device.dev.platform_data; |
| 1945 | pdata->pil_name = DSPS_PIL_GENERIC_NAME; |
| 1946 | pdata->gpios = NULL; |
| 1947 | pdata->gpios_num = 0; |
| 1948 | |
| 1949 | platform_device_register(&msm_dsps_device); |
| 1950 | #endif /* CONFIG_MSM_DSPS */ |
| 1951 | } |
| 1952 | |
Vamsi Krishna | 98f54fb | 2011-11-02 14:55:41 -0700 | [diff] [blame] | 1953 | static void __init msm8960_init_hsic(void) |
| 1954 | { |
| 1955 | #ifdef CONFIG_USB_EHCI_MSM_HSIC |
| 1956 | uint32_t version = socinfo_get_version(); |
| 1957 | |
Vamsi Krishna | f74d2edb | 2011-12-02 10:41:11 -0800 | [diff] [blame] | 1958 | if (SOCINFO_VERSION_MAJOR(version) == 1) |
Vamsi Krishna | 98f54fb | 2011-11-02 14:55:41 -0700 | [diff] [blame] | 1959 | return; |
| 1960 | |
Stepan Moskovchenko | 3b09bf5 | 2011-12-06 20:40:53 -0800 | [diff] [blame] | 1961 | if (PLATFORM_IS_CHARM25() || machine_is_msm8960_liquid()) |
Vamsi Krishna | f74d2edb | 2011-12-02 10:41:11 -0800 | [diff] [blame] | 1962 | platform_device_register(&msm_device_hsic_host); |
Vamsi Krishna | 98f54fb | 2011-11-02 14:55:41 -0700 | [diff] [blame] | 1963 | #endif |
| 1964 | } |
| 1965 | |
Amir Samuelov | 5137e39 | 2011-09-21 17:31:25 +0300 | [diff] [blame] | 1966 | #ifdef CONFIG_ISL9519_CHARGER |
| 1967 | static struct isl_platform_data isl_data __initdata = { |
| 1968 | .valid_n_gpio = 0, /* Not required when notify-by-pmic */ |
| 1969 | .chg_detection_config = NULL, /* Not required when notify-by-pmic */ |
| 1970 | .max_system_voltage = 4200, |
| 1971 | .min_system_voltage = 3200, |
| 1972 | .chgcurrent = 1000, /* 1900, */ |
| 1973 | .term_current = 400, /* Need fine tuning */ |
| 1974 | .input_current = 2048, |
| 1975 | }; |
| 1976 | |
| 1977 | static struct i2c_board_info isl_charger_i2c_info[] __initdata = { |
| 1978 | { |
| 1979 | I2C_BOARD_INFO("isl9519q", 0x9), |
| 1980 | .irq = 0, /* Not required when notify-by-pmic */ |
| 1981 | .platform_data = &isl_data, |
| 1982 | }, |
| 1983 | }; |
| 1984 | #endif /* CONFIG_ISL9519_CHARGER */ |
| 1985 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1986 | static struct i2c_registry msm8960_i2c_devices[] __initdata = { |
| 1987 | #ifdef CONFIG_MSM_CAMERA |
| 1988 | { |
Amir Samuelov | 05f8780 | 2011-08-27 18:30:12 +0300 | [diff] [blame] | 1989 | I2C_SURF | I2C_FFA | I2C_FLUID | I2C_LIQUID | I2C_RUMI, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1990 | MSM_8960_GSBI4_QUP_I2C_BUS_ID, |
| 1991 | msm_camera_boardinfo, |
| 1992 | ARRAY_SIZE(msm_camera_boardinfo), |
| 1993 | }, |
| 1994 | #endif |
Amir Samuelov | 5137e39 | 2011-09-21 17:31:25 +0300 | [diff] [blame] | 1995 | #ifdef CONFIG_ISL9519_CHARGER |
| 1996 | { |
| 1997 | I2C_LIQUID, |
| 1998 | MSM_8960_GSBI10_QUP_I2C_BUS_ID, |
| 1999 | isl_charger_i2c_info, |
| 2000 | ARRAY_SIZE(isl_charger_i2c_info), |
| 2001 | }, |
| 2002 | #endif /* CONFIG_ISL9519_CHARGER */ |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2003 | { |
| 2004 | I2C_SURF | I2C_FFA | I2C_FLUID, |
| 2005 | MSM_8960_GSBI3_QUP_I2C_BUS_ID, |
| 2006 | cyttsp_info, |
| 2007 | ARRAY_SIZE(cyttsp_info), |
Rohit Vaswani | cd2a59b | 2011-07-19 12:00:48 -0700 | [diff] [blame] | 2008 | }, |
Mohan Pallaka | 5083738 | 2011-09-07 11:00:57 +0530 | [diff] [blame] | 2009 | { |
| 2010 | I2C_LIQUID, |
| 2011 | MSM_8960_GSBI3_QUP_I2C_BUS_ID, |
| 2012 | mxt_device_info, |
| 2013 | ARRAY_SIZE(mxt_device_info), |
| 2014 | }, |
Mohan Pallaka | 5e49039 | 2011-09-09 15:18:41 +0530 | [diff] [blame] | 2015 | { |
| 2016 | I2C_LIQUID, |
| 2017 | MSM_8960_GSBI10_QUP_I2C_BUS_ID, |
Eugene Yasman | d2316b8 | 2011-12-07 18:23:48 +0200 | [diff] [blame] | 2018 | sii_device_info, |
| 2019 | ARRAY_SIZE(sii_device_info), |
| 2020 | }, |
| 2021 | { |
| 2022 | I2C_LIQUID, |
| 2023 | MSM_8960_GSBI10_QUP_I2C_BUS_ID, |
Mohan Pallaka | 5e49039 | 2011-09-09 15:18:41 +0530 | [diff] [blame] | 2024 | msm_isa1200_board_info, |
| 2025 | ARRAY_SIZE(msm_isa1200_board_info), |
| 2026 | }, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2027 | }; |
| 2028 | #endif /* CONFIG_I2C */ |
| 2029 | |
| 2030 | static void __init register_i2c_devices(void) |
| 2031 | { |
| 2032 | #ifdef CONFIG_I2C |
| 2033 | u8 mach_mask = 0; |
| 2034 | int i; |
| 2035 | |
| 2036 | /* Build the matching 'supported_machs' bitmask */ |
| 2037 | if (machine_is_msm8960_cdp()) |
| 2038 | mach_mask = I2C_SURF; |
| 2039 | else if (machine_is_msm8960_rumi3()) |
| 2040 | mach_mask = I2C_RUMI; |
| 2041 | else if (machine_is_msm8960_sim()) |
| 2042 | mach_mask = I2C_SIM; |
Amy Maloche | 2d02803 | 2011-07-20 14:08:06 -0700 | [diff] [blame] | 2043 | else if (machine_is_msm8960_fluid()) |
| 2044 | mach_mask = I2C_FLUID; |
Amir Samuelov | 05f8780 | 2011-08-27 18:30:12 +0300 | [diff] [blame] | 2045 | else if (machine_is_msm8960_liquid()) |
| 2046 | mach_mask = I2C_LIQUID; |
Amy Maloche | 1b0663f | 2011-08-02 16:46:22 -0700 | [diff] [blame] | 2047 | else if (machine_is_msm8960_mtp()) |
| 2048 | mach_mask = I2C_FFA; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2049 | else |
| 2050 | pr_err("unmatched machine ID in register_i2c_devices\n"); |
| 2051 | |
| 2052 | /* Run the array and install devices as appropriate */ |
| 2053 | for (i = 0; i < ARRAY_SIZE(msm8960_i2c_devices); ++i) { |
| 2054 | if (msm8960_i2c_devices[i].machs & mach_mask) |
| 2055 | i2c_register_board_info(msm8960_i2c_devices[i].bus, |
| 2056 | msm8960_i2c_devices[i].info, |
| 2057 | msm8960_i2c_devices[i].len); |
| 2058 | } |
| 2059 | #endif |
| 2060 | } |
| 2061 | |
Stepan Moskovchenko | d056fca | 2011-01-27 12:12:07 -0800 | [diff] [blame] | 2062 | static void __init msm8960_sim_init(void) |
| 2063 | { |
Jeff Ohlstein | 7e66855 | 2011-10-06 16:17:25 -0700 | [diff] [blame] | 2064 | struct msm_watchdog_pdata *wdog_pdata = (struct msm_watchdog_pdata *) |
| 2065 | &msm8960_device_watchdog.dev.platform_data; |
| 2066 | |
| 2067 | wdog_pdata->bark_time = 15000; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2068 | BUG_ON(msm_rpm_init(&msm_rpm_data)); |
| 2069 | BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels, |
| 2070 | ARRAY_SIZE(msm_rpmrs_levels))); |
| 2071 | regulator_suppress_info_printing(); |
David Collins | 26f0556 | 2011-06-20 09:56:28 -0700 | [diff] [blame] | 2072 | platform_device_register(&msm8960_device_rpm_regulator); |
Stephen Boyd | bb600ae | 2011-08-02 20:11:40 -0700 | [diff] [blame] | 2073 | msm_clock_init(&msm8960_clock_init_data); |
Stepan Moskovchenko | ef1e0b6 | 2011-12-01 12:10:16 -0800 | [diff] [blame] | 2074 | msm8960_init_pmic(); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2075 | |
Stepan Moskovchenko | 14aa649 | 2011-08-08 15:15:01 -0700 | [diff] [blame] | 2076 | msm8960_device_otg.dev.platform_data = &msm_otg_pdata; |
Stepan Moskovchenko | 3b09bf5 | 2011-12-06 20:40:53 -0800 | [diff] [blame] | 2077 | msm8960_init_gpiomux(); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2078 | msm8960_i2c_init(); |
| 2079 | msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data)); |
| 2080 | msm_spm_l2_init(msm_spm_l2_data); |
| 2081 | msm8960_init_buses(); |
| 2082 | platform_add_devices(common_devices, ARRAY_SIZE(common_devices)); |
Stepan Moskovchenko | ef1e0b6 | 2011-12-01 12:10:16 -0800 | [diff] [blame] | 2083 | msm8960_pm8921_gpio_mpp_init(); |
Stepan Moskovchenko | d056fca | 2011-01-27 12:12:07 -0800 | [diff] [blame] | 2084 | platform_add_devices(sim_devices, ARRAY_SIZE(sim_devices)); |
Matt Wagantall | ec57f06 | 2011-08-16 23:54:46 -0700 | [diff] [blame] | 2085 | acpuclk_init(&acpuclk_8960_soc_data); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2086 | |
| 2087 | msm8960_device_qup_spi_gsbi1.dev.platform_data = |
| 2088 | &msm8960_qup_spi_gsbi1_pdata; |
| 2089 | spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info)); |
| 2090 | |
| 2091 | msm8960_init_mmc(); |
Stepan Moskovchenko | 24cd864 | 2011-11-29 13:07:53 -0800 | [diff] [blame] | 2092 | msm8960_init_fb(); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2093 | slim_register_board_info(msm_slim_devices, |
| 2094 | ARRAY_SIZE(msm_slim_devices)); |
| 2095 | msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data)); |
| 2096 | msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ); |
| 2097 | msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates), |
| 2098 | msm_pm_data); |
Maheshkumar Sivasubramanian | 8ccc16e | 2011-10-25 15:59:57 -0600 | [diff] [blame] | 2099 | BUG_ON(msm_pm_boot_init(MSM_PM_BOOT_CONFIG_TZ, NULL)); |
Stepan Moskovchenko | d056fca | 2011-01-27 12:12:07 -0800 | [diff] [blame] | 2100 | } |
| 2101 | |
| 2102 | static void __init msm8960_rumi3_init(void) |
| 2103 | { |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2104 | BUG_ON(msm_rpm_init(&msm_rpm_data)); |
| 2105 | BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels, |
| 2106 | ARRAY_SIZE(msm_rpmrs_levels))); |
| 2107 | regulator_suppress_info_printing(); |
David Collins | 26f0556 | 2011-06-20 09:56:28 -0700 | [diff] [blame] | 2108 | platform_device_register(&msm8960_device_rpm_regulator); |
Stephen Boyd | bb600ae | 2011-08-02 20:11:40 -0700 | [diff] [blame] | 2109 | msm_clock_init(&msm8960_dummy_clock_init_data); |
Stepan Moskovchenko | 3b09bf5 | 2011-12-06 20:40:53 -0800 | [diff] [blame] | 2110 | msm8960_init_gpiomux(); |
Stepan Moskovchenko | ef1e0b6 | 2011-12-01 12:10:16 -0800 | [diff] [blame] | 2111 | msm8960_init_pmic(); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2112 | msm8960_device_qup_spi_gsbi1.dev.platform_data = |
| 2113 | &msm8960_qup_spi_gsbi1_pdata; |
| 2114 | spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info)); |
| 2115 | msm8960_i2c_init(); |
| 2116 | msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data)); |
| 2117 | msm_spm_l2_init(msm_spm_l2_data); |
| 2118 | platform_add_devices(common_devices, ARRAY_SIZE(common_devices)); |
Stepan Moskovchenko | ef1e0b6 | 2011-12-01 12:10:16 -0800 | [diff] [blame] | 2119 | msm8960_pm8921_gpio_mpp_init(); |
Stepan Moskovchenko | d056fca | 2011-01-27 12:12:07 -0800 | [diff] [blame] | 2120 | platform_add_devices(rumi3_devices, ARRAY_SIZE(rumi3_devices)); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2121 | msm8960_init_mmc(); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2122 | register_i2c_devices(); |
Stepan Moskovchenko | 24cd864 | 2011-11-29 13:07:53 -0800 | [diff] [blame] | 2123 | msm8960_init_fb(); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2124 | slim_register_board_info(msm_slim_devices, |
| 2125 | ARRAY_SIZE(msm_slim_devices)); |
| 2126 | msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data)); |
| 2127 | msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ); |
| 2128 | msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates), |
| 2129 | msm_pm_data); |
Maheshkumar Sivasubramanian | 8ccc16e | 2011-10-25 15:59:57 -0600 | [diff] [blame] | 2130 | BUG_ON(msm_pm_boot_init(MSM_PM_BOOT_CONFIG_TZ, NULL)); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2131 | } |
| 2132 | |
| 2133 | static void __init msm8960_cdp_init(void) |
| 2134 | { |
Naveen Ramaraj | 76483ad | 2011-09-06 14:25:44 -0700 | [diff] [blame] | 2135 | if (meminfo_init(SYS_MEMORY, SZ_256M) < 0) |
| 2136 | pr_err("meminfo_init() failed!\n"); |
| 2137 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2138 | BUG_ON(msm_rpm_init(&msm_rpm_data)); |
| 2139 | BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels, |
| 2140 | ARRAY_SIZE(msm_rpmrs_levels))); |
Abhijeet Dharmapurikar | 6d565fd | 2011-09-15 18:49:56 -0700 | [diff] [blame] | 2141 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2142 | regulator_suppress_info_printing(); |
| 2143 | if (msm_xo_init()) |
| 2144 | pr_err("Failed to initialize XO votes\n"); |
David Collins | 26f0556 | 2011-06-20 09:56:28 -0700 | [diff] [blame] | 2145 | platform_device_register(&msm8960_device_rpm_regulator); |
Stephen Boyd | bb600ae | 2011-08-02 20:11:40 -0700 | [diff] [blame] | 2146 | msm_clock_init(&msm8960_clock_init_data); |
Vijayavardhan Vennapusa | fc464f0 | 2011-11-04 21:54:00 +0530 | [diff] [blame] | 2147 | if (machine_is_msm8960_liquid()) |
| 2148 | msm_otg_pdata.mhl_enable = true; |
Stepan Moskovchenko | 14aa649 | 2011-08-08 15:15:01 -0700 | [diff] [blame] | 2149 | msm8960_device_otg.dev.platform_data = &msm_otg_pdata; |
Anji jonnala | a8b8d73 | 2011-12-06 10:03:24 +0530 | [diff] [blame] | 2150 | if (machine_is_msm8960_mtp() || machine_is_msm8960_fluid() || |
| 2151 | machine_is_msm8960_cdp()) { |
| 2152 | msm_otg_pdata.phy_init_seq = wr_phy_init_seq; |
| 2153 | } else if (machine_is_msm8960_liquid()) { |
| 2154 | msm_otg_pdata.phy_init_seq = |
| 2155 | liquid_v1_phy_init_seq; |
| 2156 | } |
Anji jonnala | a7c1c5c | 2011-12-12 12:20:36 +0530 | [diff] [blame] | 2157 | msm_otg_pdata.swfi_latency = |
| 2158 | msm_rpmrs_levels[0].latency_us; |
Vijayavardhan Vennapusa | 2b592824f | 2011-11-02 19:51:32 +0530 | [diff] [blame] | 2159 | #ifdef CONFIG_USB_EHCI_MSM_HSIC |
| 2160 | if (machine_is_msm8960_liquid()) { |
| 2161 | if (SOCINFO_VERSION_MAJOR(socinfo_get_version()) >= 2) |
| 2162 | msm_hsic_pdata.hub_reset = HSIC_HUB_RESET_GPIO; |
| 2163 | } |
| 2164 | #endif |
Vijayavardhan Vennapusa | e3316a1 | 2011-10-15 06:05:17 +0530 | [diff] [blame] | 2165 | msm_device_hsic_host.dev.platform_data = &msm_hsic_pdata; |
Stepan Moskovchenko | 3b09bf5 | 2011-12-06 20:40:53 -0800 | [diff] [blame] | 2166 | msm8960_init_gpiomux(); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2167 | msm8960_device_qup_spi_gsbi1.dev.platform_data = |
| 2168 | &msm8960_qup_spi_gsbi1_pdata; |
| 2169 | spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info)); |
Stepan Moskovchenko | ef1e0b6 | 2011-12-01 12:10:16 -0800 | [diff] [blame] | 2170 | |
| 2171 | msm8960_init_pmic(); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2172 | msm8960_i2c_init(); |
Lucille Sylvester | 34ec369 | 2011-08-16 16:28:04 -0600 | [diff] [blame] | 2173 | msm8960_gfx_init(); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2174 | msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data)); |
| 2175 | msm_spm_l2_init(msm_spm_l2_data); |
| 2176 | msm8960_init_buses(); |
| 2177 | platform_add_devices(msm_footswitch_devices, |
| 2178 | msm_num_footswitch_devices); |
David Collins | b10be1d | 2011-09-02 10:29:31 -0700 | [diff] [blame] | 2179 | if (machine_is_msm8960_liquid()) |
| 2180 | platform_device_register(&msm8960_device_ext_3p3v_vreg); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2181 | platform_add_devices(common_devices, ARRAY_SIZE(common_devices)); |
Stepan Moskovchenko | ef1e0b6 | 2011-12-01 12:10:16 -0800 | [diff] [blame] | 2182 | msm8960_pm8921_gpio_mpp_init(); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2183 | platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices)); |
Vamsi Krishna | 98f54fb | 2011-11-02 14:55:41 -0700 | [diff] [blame] | 2184 | msm8960_init_hsic(); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2185 | msm8960_init_cam(); |
| 2186 | msm8960_init_mmc(); |
Matt Wagantall | ec57f06 | 2011-08-16 23:54:46 -0700 | [diff] [blame] | 2187 | acpuclk_init(&acpuclk_8960_soc_data); |
Mohan Pallaka | 5083738 | 2011-09-07 11:00:57 +0530 | [diff] [blame] | 2188 | if (machine_is_msm8960_liquid()) |
| 2189 | mxt_init_hw_liquid(); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2190 | register_i2c_devices(); |
Stepan Moskovchenko | 24cd864 | 2011-11-29 13:07:53 -0800 | [diff] [blame] | 2191 | msm8960_init_fb(); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2192 | slim_register_board_info(msm_slim_devices, |
| 2193 | ARRAY_SIZE(msm_slim_devices)); |
| 2194 | msm8960_init_dsps(); |
| 2195 | msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data)); |
| 2196 | msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ); |
| 2197 | msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates), |
| 2198 | msm_pm_data); |
Larry Bassel | a7eadea | 2011-07-14 10:46:00 -0700 | [diff] [blame] | 2199 | change_memory_power = &msm8960_change_memory_power; |
Maheshkumar Sivasubramanian | 8ccc16e | 2011-10-25 15:59:57 -0600 | [diff] [blame] | 2200 | BUG_ON(msm_pm_boot_init(MSM_PM_BOOT_CONFIG_TZ, NULL)); |
Joel King | b8352a1 | 2011-11-15 18:46:24 -0800 | [diff] [blame] | 2201 | |
| 2202 | if (PLATFORM_IS_CHARM25()) |
| 2203 | platform_add_devices(mdm_devices, ARRAY_SIZE(mdm_devices)); |
Stepan Moskovchenko | d056fca | 2011-01-27 12:12:07 -0800 | [diff] [blame] | 2204 | } |
| 2205 | |
Stepan Moskovchenko | f441ca2 | 2010-12-01 19:31:16 -0800 | [diff] [blame] | 2206 | MACHINE_START(MSM8960_SIM, "QCT MSM8960 SIMULATOR") |
| 2207 | .map_io = msm8960_map_io, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2208 | .reserve = msm8960_reserve, |
Stepan Moskovchenko | f441ca2 | 2010-12-01 19:31:16 -0800 | [diff] [blame] | 2209 | .init_irq = msm8960_init_irq, |
| 2210 | .timer = &msm_timer, |
Stepan Moskovchenko | d056fca | 2011-01-27 12:12:07 -0800 | [diff] [blame] | 2211 | .init_machine = msm8960_sim_init, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2212 | .init_early = msm8960_allocate_memory_regions, |
Larry Bassel | b830e18 | 2011-10-14 10:46:55 -0700 | [diff] [blame] | 2213 | .init_very_early = msm8960_early_memory, |
Stepan Moskovchenko | f441ca2 | 2010-12-01 19:31:16 -0800 | [diff] [blame] | 2214 | MACHINE_END |
Stepan Moskovchenko | 50ede4e | 2010-12-13 18:12:19 -0800 | [diff] [blame] | 2215 | |
| 2216 | MACHINE_START(MSM8960_RUMI3, "QCT MSM8960 RUMI3") |
| 2217 | .map_io = msm8960_map_io, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2218 | .reserve = msm8960_reserve, |
Stepan Moskovchenko | 50ede4e | 2010-12-13 18:12:19 -0800 | [diff] [blame] | 2219 | .init_irq = msm8960_init_irq, |
| 2220 | .timer = &msm_timer, |
Stepan Moskovchenko | d056fca | 2011-01-27 12:12:07 -0800 | [diff] [blame] | 2221 | .init_machine = msm8960_rumi3_init, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2222 | .init_early = msm8960_allocate_memory_regions, |
Larry Bassel | b830e18 | 2011-10-14 10:46:55 -0700 | [diff] [blame] | 2223 | .init_very_early = msm8960_early_memory, |
Stepan Moskovchenko | 50ede4e | 2010-12-13 18:12:19 -0800 | [diff] [blame] | 2224 | MACHINE_END |
| 2225 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2226 | MACHINE_START(MSM8960_CDP, "QCT MSM8960 CDP") |
| 2227 | .map_io = msm8960_map_io, |
| 2228 | .reserve = msm8960_reserve, |
| 2229 | .init_irq = msm8960_init_irq, |
| 2230 | .timer = &msm_timer, |
| 2231 | .init_machine = msm8960_cdp_init, |
| 2232 | .init_early = msm8960_allocate_memory_regions, |
Larry Bassel | b830e18 | 2011-10-14 10:46:55 -0700 | [diff] [blame] | 2233 | .init_very_early = msm8960_early_memory, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2234 | MACHINE_END |
| 2235 | |
| 2236 | MACHINE_START(MSM8960_MTP, "QCT MSM8960 MTP") |
| 2237 | .map_io = msm8960_map_io, |
| 2238 | .reserve = msm8960_reserve, |
| 2239 | .init_irq = msm8960_init_irq, |
| 2240 | .timer = &msm_timer, |
| 2241 | .init_machine = msm8960_cdp_init, |
| 2242 | .init_early = msm8960_allocate_memory_regions, |
Larry Bassel | b830e18 | 2011-10-14 10:46:55 -0700 | [diff] [blame] | 2243 | .init_very_early = msm8960_early_memory, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2244 | MACHINE_END |
| 2245 | |
| 2246 | MACHINE_START(MSM8960_FLUID, "QCT MSM8960 FLUID") |
| 2247 | .map_io = msm8960_map_io, |
| 2248 | .reserve = msm8960_reserve, |
| 2249 | .init_irq = msm8960_init_irq, |
| 2250 | .timer = &msm_timer, |
| 2251 | .init_machine = msm8960_cdp_init, |
| 2252 | .init_early = msm8960_allocate_memory_regions, |
Larry Bassel | b830e18 | 2011-10-14 10:46:55 -0700 | [diff] [blame] | 2253 | .init_very_early = msm8960_early_memory, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2254 | MACHINE_END |
Amir Samuelov | 0d1f8ae | 2011-07-28 11:13:58 +0300 | [diff] [blame] | 2255 | |
| 2256 | MACHINE_START(MSM8960_LIQUID, "QCT MSM8960 LIQUID") |
| 2257 | .map_io = msm8960_map_io, |
| 2258 | .reserve = msm8960_reserve, |
| 2259 | .init_irq = msm8960_init_irq, |
| 2260 | .timer = &msm_timer, |
| 2261 | .init_machine = msm8960_cdp_init, |
| 2262 | .init_early = msm8960_allocate_memory_regions, |
Larry Bassel | b830e18 | 2011-10-14 10:46:55 -0700 | [diff] [blame] | 2263 | .init_very_early = msm8960_early_memory, |
Amir Samuelov | 0d1f8ae | 2011-07-28 11:13:58 +0300 | [diff] [blame] | 2264 | MACHINE_END |