David Collins | b455842 | 2012-01-05 10:50:49 -0800 | [diff] [blame] | 1 | /* Copyright (c) 2011-2012, Code Aurora Forum. All rights reserved. |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 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 | * |
| 12 | */ |
| 13 | #include <linux/kernel.h> |
| 14 | #include <linux/platform_device.h> |
| 15 | #include <linux/io.h> |
| 16 | #include <linux/irq.h> |
| 17 | #include <linux/i2c.h> |
| 18 | #include <linux/i2c/sx150x.h> |
| 19 | #include <linux/i2c/isl9519.h> |
| 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> |
| 24 | #include <linux/mfd/pm8xxx/pm8xxx-adc.h> |
| 25 | #include <linux/regulator/consumer.h> |
| 26 | #include <linux/spi/spi.h> |
| 27 | #include <linux/slimbus/slimbus.h> |
| 28 | #include <linux/bootmem.h> |
| 29 | #include <linux/msm_kgsl.h> |
| 30 | #ifdef CONFIG_ANDROID_PMEM |
| 31 | #include <linux/android_pmem.h> |
| 32 | #endif |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 33 | #include <linux/dma-mapping.h> |
| 34 | #include <linux/platform_data/qcom_crypto_device.h> |
| 35 | #include <linux/platform_data/qcom_wcnss_device.h> |
| 36 | #include <linux/leds.h> |
| 37 | #include <linux/leds-pm8xxx.h> |
| 38 | #include <linux/i2c/atmel_mxt_ts.h> |
| 39 | #include <linux/msm_tsens.h> |
| 40 | #include <linux/ks8851.h> |
| 41 | #include <linux/i2c/isa1200.h> |
Anirudh Ghayal | eb3af97 | 2011-12-13 17:29:06 +0530 | [diff] [blame] | 42 | #include <linux/gpio_keys.h> |
Jack Cheung | 6ce8f68 | 2012-01-17 10:35:42 -0800 | [diff] [blame] | 43 | #include <linux/memory.h> |
Hanumant Singh | eea6256 | 2012-05-14 11:32:45 -0700 | [diff] [blame] | 44 | #include <linux/memblock.h> |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 45 | |
Asish Bhattacharya | b86c347 | 2012-02-15 08:31:52 +0530 | [diff] [blame] | 46 | #include <linux/slimbus/slimbus.h> |
| 47 | #include <linux/mfd/wcd9xxx/core.h> |
| 48 | #include <linux/mfd/wcd9xxx/pdata.h> |
| 49 | |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 50 | #include <asm/mach-types.h> |
| 51 | #include <asm/mach/arch.h> |
| 52 | #include <asm/setup.h> |
| 53 | #include <asm/hardware/gic.h> |
| 54 | #include <asm/mach/mmc.h> |
| 55 | |
| 56 | #include <mach/board.h> |
| 57 | #include <mach/msm_iomap.h> |
| 58 | #include <mach/msm_spi.h> |
| 59 | #ifdef CONFIG_USB_MSM_OTG_72K |
| 60 | #include <mach/msm_hsusb.h> |
| 61 | #else |
| 62 | #include <linux/usb/msm_hsusb.h> |
| 63 | #endif |
| 64 | #include <linux/usb/android.h> |
| 65 | #include <mach/usbdiag.h> |
| 66 | #include <mach/socinfo.h> |
| 67 | #include <mach/rpm.h> |
| 68 | #include <mach/gpio.h> |
| 69 | #include <mach/gpiomux.h> |
| 70 | #include <mach/msm_bus_board.h> |
| 71 | #include <mach/msm_memtypes.h> |
| 72 | #include <mach/dma.h> |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 73 | #include <mach/msm_xo.h> |
| 74 | #include <mach/restart.h> |
| 75 | |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 76 | #include <linux/ion.h> |
| 77 | #include <mach/ion.h> |
| 78 | #include <mach/mdm2.h> |
Laura Abbott | f8c03b9 | 2012-02-16 14:57:58 -0800 | [diff] [blame] | 79 | #include <mach/msm_rtb.h> |
Hanumant Singh | eea6256 | 2012-05-14 11:32:45 -0700 | [diff] [blame] | 80 | #include <linux/fmem.h> |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 81 | |
| 82 | #include "timer.h" |
| 83 | #include "devices.h" |
| 84 | #include "devices-msm8x60.h" |
| 85 | #include "spm.h" |
Matt Wagantall | 7cca464 | 2012-02-01 16:43:24 -0800 | [diff] [blame] | 86 | #include "pm.h" |
Abhijeet Dharmapurikar | efaca4f | 2011-12-27 16:24:07 -0800 | [diff] [blame] | 87 | #include <mach/cpuidle.h> |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 88 | #include "rpm_resources.h" |
Subhash Jadavani | 909e04f | 2012-04-12 10:52:50 +0530 | [diff] [blame] | 89 | #include <mach/mpm.h> |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 90 | #include "acpuclock.h" |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 91 | #include "smd_private.h" |
| 92 | #include "pm-boot.h" |
| 93 | #include "msm_watchdog.h" |
Jay Chokshi | 06fa754 | 2011-12-07 13:09:17 -0800 | [diff] [blame] | 94 | #include "board-8930.h" |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 95 | |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 96 | static struct platform_device msm_fm_platform_init = { |
| 97 | .name = "iris_fm", |
| 98 | .id = -1, |
| 99 | }; |
| 100 | |
| 101 | #define KS8851_RST_GPIO 89 |
| 102 | #define KS8851_IRQ_GPIO 90 |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 103 | #define HAP_SHIFT_LVL_OE_GPIO 47 |
| 104 | |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 105 | #if defined(CONFIG_GPIO_SX150X) || defined(CONFIG_GPIO_SX150X_MODULE) |
| 106 | |
| 107 | struct sx150x_platform_data msm8930_sx150x_data[] = { |
| 108 | [SX150X_CAM] = { |
| 109 | .gpio_base = GPIO_CAM_EXPANDER_BASE, |
| 110 | .oscio_is_gpo = false, |
| 111 | .io_pullup_ena = 0x0, |
| 112 | .io_pulldn_ena = 0xc0, |
| 113 | .io_open_drain_ena = 0x0, |
| 114 | .irq_summary = -1, |
| 115 | }, |
| 116 | }; |
| 117 | |
| 118 | #endif |
| 119 | |
Olav Haugan | a21169d | 2012-01-04 09:17:06 -0800 | [diff] [blame] | 120 | #define MSM_PMEM_ADSP_SIZE 0x7800000 |
Asish Bhattacharya | 9ed880f | 2012-04-12 08:33:37 +0530 | [diff] [blame] | 121 | #define MSM_PMEM_AUDIO_SIZE 0x4CF000 |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 122 | #ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY |
| 123 | #define MSM_PMEM_SIZE 0x4000000 /* 64 Mbytes */ |
| 124 | #else |
Olav Haugan | b88eef1 | 2012-01-15 10:59:26 -0800 | [diff] [blame] | 125 | #define MSM_PMEM_SIZE 0x2800000 /* 40 Mbytes */ |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 126 | #endif |
Hanumant Singh | eea6256 | 2012-05-14 11:32:45 -0700 | [diff] [blame] | 127 | #define MSM_LIQUID_PMEM_SIZE 0x4000000 /* 64 Mbytes */ |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 128 | |
| 129 | #ifdef CONFIG_MSM_MULTIMEDIA_USE_ION |
Asish Bhattacharya | 9ed880f | 2012-04-12 08:33:37 +0530 | [diff] [blame] | 130 | #define MSM_PMEM_KERNEL_EBI1_SIZE 0x65000 |
Hanumant Singh | edfb046 | 2012-05-15 14:49:32 -0700 | [diff] [blame] | 131 | #ifdef CONFIG_MSM_IOMMU |
| 132 | #define MSM_ION_MM_SIZE 0x3800000 /* Need to be multiple of 64K */ |
| 133 | #define MSM_ION_SF_SIZE 0x0 |
| 134 | #define MSM_ION_HEAP_NUM 7 |
| 135 | #else |
Olav Haugan | b88eef1 | 2012-01-15 10:59:26 -0800 | [diff] [blame] | 136 | #define MSM_ION_SF_SIZE MSM_PMEM_SIZE |
Olav Haugan | b88eef1 | 2012-01-15 10:59:26 -0800 | [diff] [blame] | 137 | #define MSM_ION_MM_SIZE MSM_PMEM_ADSP_SIZE |
Hanumant Singh | eea6256 | 2012-05-14 11:32:45 -0700 | [diff] [blame] | 138 | #define MSM_ION_HEAP_NUM 8 |
Hanumant Singh | edfb046 | 2012-05-15 14:49:32 -0700 | [diff] [blame] | 139 | #endif |
Hanumant Singh | eea6256 | 2012-05-14 11:32:45 -0700 | [diff] [blame] | 140 | #define MSM_ION_MM_FW_SIZE 0x200000 /* (2MB) */ |
Hanumant Singh | edfb046 | 2012-05-15 14:49:32 -0700 | [diff] [blame] | 141 | #define MSM_ION_QSECOM_SIZE 0x300000 /* (3MB) */ |
Olav Haugan | b5be799 | 2011-11-18 14:29:02 -0800 | [diff] [blame] | 142 | #define MSM_ION_MFC_SIZE SZ_8K |
Olav Haugan | 7355db0 | 2012-01-13 16:59:13 -0800 | [diff] [blame] | 143 | #define MSM_ION_AUDIO_SIZE MSM_PMEM_AUDIO_SIZE |
Hanumant Singh | eea6256 | 2012-05-14 11:32:45 -0700 | [diff] [blame] | 144 | |
| 145 | #define MSM_LIQUID_ION_MM_SIZE (MSM_ION_MM_SIZE + 0x600000) |
| 146 | #define MSM_LIQUID_ION_SF_SIZE MSM_LIQUID_PMEM_SIZE |
| 147 | #define MSM_HDMI_PRIM_ION_SF_SIZE MSM_HDMI_PRIM_PMEM_SIZE |
| 148 | |
| 149 | #define MSM8930_FIXED_AREA_START 0xa0000000 |
| 150 | #define MAX_FIXED_AREA_SIZE 0x10000000 |
| 151 | #define MSM_MM_FW_SIZE 0x200000 |
| 152 | #define MSM8930_FW_START (MSM8930_FIXED_AREA_START - MSM_MM_FW_SIZE) |
| 153 | |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 154 | #else |
| 155 | #define MSM_PMEM_KERNEL_EBI1_SIZE 0x110C000 |
Olav Haugan | b5be799 | 2011-11-18 14:29:02 -0800 | [diff] [blame] | 156 | #define MSM_ION_HEAP_NUM 1 |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 157 | #endif |
| 158 | |
| 159 | #ifdef CONFIG_KERNEL_PMEM_EBI_REGION |
| 160 | static unsigned pmem_kernel_ebi1_size = MSM_PMEM_KERNEL_EBI1_SIZE; |
| 161 | static int __init pmem_kernel_ebi1_size_setup(char *p) |
| 162 | { |
| 163 | pmem_kernel_ebi1_size = memparse(p, NULL); |
| 164 | return 0; |
| 165 | } |
| 166 | early_param("pmem_kernel_ebi1_size", pmem_kernel_ebi1_size_setup); |
| 167 | #endif |
| 168 | |
| 169 | #ifdef CONFIG_ANDROID_PMEM |
| 170 | static unsigned pmem_size = MSM_PMEM_SIZE; |
| 171 | static int __init pmem_size_setup(char *p) |
| 172 | { |
| 173 | pmem_size = memparse(p, NULL); |
| 174 | return 0; |
| 175 | } |
| 176 | early_param("pmem_size", pmem_size_setup); |
| 177 | |
| 178 | static unsigned pmem_adsp_size = MSM_PMEM_ADSP_SIZE; |
| 179 | |
| 180 | static int __init pmem_adsp_size_setup(char *p) |
| 181 | { |
| 182 | pmem_adsp_size = memparse(p, NULL); |
| 183 | return 0; |
| 184 | } |
| 185 | early_param("pmem_adsp_size", pmem_adsp_size_setup); |
| 186 | |
| 187 | static unsigned pmem_audio_size = MSM_PMEM_AUDIO_SIZE; |
| 188 | |
| 189 | static int __init pmem_audio_size_setup(char *p) |
| 190 | { |
| 191 | pmem_audio_size = memparse(p, NULL); |
| 192 | return 0; |
| 193 | } |
| 194 | early_param("pmem_audio_size", pmem_audio_size_setup); |
| 195 | #endif |
| 196 | |
| 197 | #ifdef CONFIG_ANDROID_PMEM |
| 198 | #ifndef CONFIG_MSM_MULTIMEDIA_USE_ION |
| 199 | static struct android_pmem_platform_data android_pmem_pdata = { |
| 200 | .name = "pmem", |
| 201 | .allocator_type = PMEM_ALLOCATORTYPE_ALLORNOTHING, |
| 202 | .cached = 1, |
| 203 | .memory_type = MEMTYPE_EBI1, |
| 204 | }; |
| 205 | |
Laura Abbott | b93525f | 2012-04-12 09:57:19 -0700 | [diff] [blame] | 206 | static struct platform_device msm8930_android_pmem_device = { |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 207 | .name = "android_pmem", |
| 208 | .id = 0, |
| 209 | .dev = {.platform_data = &android_pmem_pdata}, |
| 210 | }; |
| 211 | |
| 212 | static struct android_pmem_platform_data android_pmem_adsp_pdata = { |
| 213 | .name = "pmem_adsp", |
| 214 | .allocator_type = PMEM_ALLOCATORTYPE_BITMAP, |
| 215 | .cached = 0, |
| 216 | .memory_type = MEMTYPE_EBI1, |
| 217 | }; |
Laura Abbott | b93525f | 2012-04-12 09:57:19 -0700 | [diff] [blame] | 218 | static struct platform_device msm8930_android_pmem_adsp_device = { |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 219 | .name = "android_pmem", |
| 220 | .id = 2, |
| 221 | .dev = { .platform_data = &android_pmem_adsp_pdata }, |
| 222 | }; |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 223 | |
| 224 | static struct android_pmem_platform_data android_pmem_audio_pdata = { |
| 225 | .name = "pmem_audio", |
| 226 | .allocator_type = PMEM_ALLOCATORTYPE_BITMAP, |
| 227 | .cached = 0, |
| 228 | .memory_type = MEMTYPE_EBI1, |
| 229 | }; |
| 230 | |
Laura Abbott | b93525f | 2012-04-12 09:57:19 -0700 | [diff] [blame] | 231 | static struct platform_device msm8930_android_pmem_audio_device = { |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 232 | .name = "android_pmem", |
| 233 | .id = 4, |
| 234 | .dev = { .platform_data = &android_pmem_audio_pdata }, |
| 235 | }; |
Asish Bhattacharya | 5d63c4b | 2012-04-12 08:41:12 +0530 | [diff] [blame] | 236 | #endif /* CONFIG_MSM_MULTIMEDIA_USE_ION */ |
| 237 | #endif /* CONFIG_ANDROID_PMEM */ |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 238 | |
Hanumant Singh | eea6256 | 2012-05-14 11:32:45 -0700 | [diff] [blame] | 239 | struct fmem_platform_data msm8930_fmem_pdata = { |
| 240 | }; |
| 241 | |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 242 | #define DSP_RAM_BASE_8960 0x8da00000 |
| 243 | #define DSP_RAM_SIZE_8960 0x1800000 |
| 244 | static int dspcrashd_pdata_8960 = 0xDEADDEAD; |
| 245 | |
| 246 | static struct resource resources_dspcrashd_8960[] = { |
| 247 | { |
| 248 | .name = "msm_dspcrashd", |
| 249 | .start = DSP_RAM_BASE_8960, |
| 250 | .end = DSP_RAM_BASE_8960 + DSP_RAM_SIZE_8960, |
| 251 | .flags = IORESOURCE_DMA, |
| 252 | }, |
| 253 | }; |
| 254 | |
| 255 | static struct platform_device msm_device_dspcrashd_8960 = { |
| 256 | .name = "msm_dspcrashd", |
| 257 | .num_resources = ARRAY_SIZE(resources_dspcrashd_8960), |
| 258 | .resource = resources_dspcrashd_8960, |
| 259 | .dev = { .platform_data = &dspcrashd_pdata_8960 }, |
| 260 | }; |
| 261 | |
| 262 | static struct memtype_reserve msm8930_reserve_table[] __initdata = { |
| 263 | [MEMTYPE_SMI] = { |
| 264 | }, |
| 265 | [MEMTYPE_EBI0] = { |
| 266 | .flags = MEMTYPE_FLAGS_1M_ALIGN, |
| 267 | }, |
| 268 | [MEMTYPE_EBI1] = { |
| 269 | .flags = MEMTYPE_FLAGS_1M_ALIGN, |
| 270 | }, |
| 271 | }; |
| 272 | |
Laura Abbott | f8c03b9 | 2012-02-16 14:57:58 -0800 | [diff] [blame] | 273 | |
| 274 | static void __init reserve_rtb_memory(void) |
| 275 | { |
| 276 | #if defined(CONFIG_MSM_RTB) |
Laura Abbott | b93525f | 2012-04-12 09:57:19 -0700 | [diff] [blame] | 277 | msm8930_reserve_table[MEMTYPE_EBI1].size += msm8930_rtb_pdata.size; |
Laura Abbott | f8c03b9 | 2012-02-16 14:57:58 -0800 | [diff] [blame] | 278 | #endif |
| 279 | } |
| 280 | |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 281 | static void __init size_pmem_devices(void) |
| 282 | { |
| 283 | #ifdef CONFIG_ANDROID_PMEM |
| 284 | #ifndef CONFIG_MSM_MULTIMEDIA_USE_ION |
| 285 | android_pmem_adsp_pdata.size = pmem_adsp_size; |
| 286 | android_pmem_pdata.size = pmem_size; |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 287 | android_pmem_audio_pdata.size = MSM_PMEM_AUDIO_SIZE; |
Asish Bhattacharya | 5d63c4b | 2012-04-12 08:41:12 +0530 | [diff] [blame] | 288 | #endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/ |
| 289 | #endif /*CONFIG_ANDROID_PMEM*/ |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 290 | } |
| 291 | |
Asish Bhattacharya | 5d63c4b | 2012-04-12 08:41:12 +0530 | [diff] [blame] | 292 | #ifdef CONFIG_ANDROID_PMEM |
| 293 | #ifndef CONFIG_MSM_MULTIMEDIA_USE_ION |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 294 | static void __init reserve_memory_for(struct android_pmem_platform_data *p) |
| 295 | { |
| 296 | msm8930_reserve_table[p->memory_type].size += p->size; |
| 297 | } |
Asish Bhattacharya | 5d63c4b | 2012-04-12 08:41:12 +0530 | [diff] [blame] | 298 | #endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/ |
| 299 | #endif /*CONFIG_ANDROID_PMEM*/ |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 300 | |
| 301 | static void __init reserve_pmem_memory(void) |
| 302 | { |
| 303 | #ifdef CONFIG_ANDROID_PMEM |
| 304 | #ifndef CONFIG_MSM_MULTIMEDIA_USE_ION |
| 305 | reserve_memory_for(&android_pmem_adsp_pdata); |
| 306 | reserve_memory_for(&android_pmem_pdata); |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 307 | reserve_memory_for(&android_pmem_audio_pdata); |
Asish Bhattacharya | 5d63c4b | 2012-04-12 08:41:12 +0530 | [diff] [blame] | 308 | #endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/ |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 309 | msm8930_reserve_table[MEMTYPE_EBI1].size += pmem_kernel_ebi1_size; |
Asish Bhattacharya | 5d63c4b | 2012-04-12 08:41:12 +0530 | [diff] [blame] | 310 | #endif /*CONFIG_ANDROID_PMEM*/ |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 311 | } |
| 312 | |
| 313 | static int msm8930_paddr_to_memtype(unsigned int paddr) |
| 314 | { |
| 315 | return MEMTYPE_EBI1; |
| 316 | } |
| 317 | |
Hanumant Singh | eea6256 | 2012-05-14 11:32:45 -0700 | [diff] [blame] | 318 | #define FMEM_ENABLED 1 |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 319 | #ifdef CONFIG_ION_MSM |
Olav Haugan | 0703dbf | 2011-12-19 17:53:38 -0800 | [diff] [blame] | 320 | #ifdef CONFIG_MSM_MULTIMEDIA_USE_ION |
Laura Abbott | b93525f | 2012-04-12 09:57:19 -0700 | [diff] [blame] | 321 | static struct ion_cp_heap_pdata cp_mm_msm8930_ion_pdata = { |
Olav Haugan | 0703dbf | 2011-12-19 17:53:38 -0800 | [diff] [blame] | 322 | .permission_type = IPT_TYPE_MM_CARVEOUT, |
Olav Haugan | 42ebe71 | 2012-01-10 16:30:58 -0800 | [diff] [blame] | 323 | .align = PAGE_SIZE, |
Hanumant Singh | eea6256 | 2012-05-14 11:32:45 -0700 | [diff] [blame] | 324 | .reusable = FMEM_ENABLED, |
| 325 | .mem_is_fmem = FMEM_ENABLED, |
| 326 | .fixed_position = FIXED_MIDDLE, |
Olav Haugan | 0703dbf | 2011-12-19 17:53:38 -0800 | [diff] [blame] | 327 | }; |
| 328 | |
Laura Abbott | b93525f | 2012-04-12 09:57:19 -0700 | [diff] [blame] | 329 | static struct ion_cp_heap_pdata cp_mfc_msm8930_ion_pdata = { |
Olav Haugan | 0703dbf | 2011-12-19 17:53:38 -0800 | [diff] [blame] | 330 | .permission_type = IPT_TYPE_MFC_SHAREDMEM, |
Olav Haugan | 42ebe71 | 2012-01-10 16:30:58 -0800 | [diff] [blame] | 331 | .align = PAGE_SIZE, |
Hanumant Singh | eea6256 | 2012-05-14 11:32:45 -0700 | [diff] [blame] | 332 | .reusable = 0, |
| 333 | .mem_is_fmem = FMEM_ENABLED, |
| 334 | .fixed_position = FIXED_HIGH, |
Olav Haugan | 0703dbf | 2011-12-19 17:53:38 -0800 | [diff] [blame] | 335 | }; |
Hanumant Singh | eea6256 | 2012-05-14 11:32:45 -0700 | [diff] [blame] | 336 | |
Laura Abbott | b93525f | 2012-04-12 09:57:19 -0700 | [diff] [blame] | 337 | static struct ion_co_heap_pdata co_msm8930_ion_pdata = { |
Olav Haugan | 42ebe71 | 2012-01-10 16:30:58 -0800 | [diff] [blame] | 338 | .adjacent_mem_id = INVALID_HEAP_ID, |
| 339 | .align = PAGE_SIZE, |
Hanumant Singh | eea6256 | 2012-05-14 11:32:45 -0700 | [diff] [blame] | 340 | .mem_is_fmem = 0, |
Olav Haugan | 42ebe71 | 2012-01-10 16:30:58 -0800 | [diff] [blame] | 341 | }; |
Hanumant Singh | eea6256 | 2012-05-14 11:32:45 -0700 | [diff] [blame] | 342 | |
Laura Abbott | b93525f | 2012-04-12 09:57:19 -0700 | [diff] [blame] | 343 | static struct ion_co_heap_pdata fw_co_msm8930_ion_pdata = { |
Olav Haugan | 42ebe71 | 2012-01-10 16:30:58 -0800 | [diff] [blame] | 344 | .adjacent_mem_id = ION_CP_MM_HEAP_ID, |
| 345 | .align = SZ_128K, |
Hanumant Singh | eea6256 | 2012-05-14 11:32:45 -0700 | [diff] [blame] | 346 | .mem_is_fmem = FMEM_ENABLED, |
| 347 | .fixed_position = FIXED_LOW, |
Olav Haugan | 0703dbf | 2011-12-19 17:53:38 -0800 | [diff] [blame] | 348 | }; |
| 349 | #endif |
Olav Haugan | 9cdfc2f | 2012-02-15 09:52:57 -0800 | [diff] [blame] | 350 | |
| 351 | /** |
| 352 | * These heaps are listed in the order they will be allocated. Due to |
| 353 | * video hardware restrictions and content protection the FW heap has to |
| 354 | * be allocated adjacent (below) the MM heap and the MFC heap has to be |
| 355 | * allocated after the MM heap to ensure MFC heap is not more than 256MB |
| 356 | * away from the base address of the FW heap. |
| 357 | * However, the order of FW heap and MM heap doesn't matter since these |
| 358 | * two heaps are taken care of by separate code to ensure they are adjacent |
| 359 | * to each other. |
| 360 | * Don't swap the order unless you know what you are doing! |
| 361 | */ |
Laura Abbott | b93525f | 2012-04-12 09:57:19 -0700 | [diff] [blame] | 362 | static struct ion_platform_data msm8930_ion_pdata = { |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 363 | .nr = MSM_ION_HEAP_NUM, |
| 364 | .heaps = { |
| 365 | { |
Olav Haugan | b5be799 | 2011-11-18 14:29:02 -0800 | [diff] [blame] | 366 | .id = ION_SYSTEM_HEAP_ID, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 367 | .type = ION_HEAP_TYPE_SYSTEM, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 368 | .name = ION_VMALLOC_HEAP_NAME, |
| 369 | }, |
| 370 | #ifdef CONFIG_MSM_MULTIMEDIA_USE_ION |
| 371 | { |
Olav Haugan | b5be799 | 2011-11-18 14:29:02 -0800 | [diff] [blame] | 372 | .id = ION_CP_MM_HEAP_ID, |
Olav Haugan | 0a85251 | 2012-01-09 10:20:55 -0800 | [diff] [blame] | 373 | .type = ION_HEAP_TYPE_CP, |
Olav Haugan | b5be799 | 2011-11-18 14:29:02 -0800 | [diff] [blame] | 374 | .name = ION_MM_HEAP_NAME, |
| 375 | .size = MSM_ION_MM_SIZE, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 376 | .memory_type = ION_EBI_TYPE, |
Laura Abbott | b93525f | 2012-04-12 09:57:19 -0700 | [diff] [blame] | 377 | .extra_data = (void *) &cp_mm_msm8930_ion_pdata, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 378 | }, |
Olav Haugan | b5be799 | 2011-11-18 14:29:02 -0800 | [diff] [blame] | 379 | { |
Olav Haugan | 42ebe71 | 2012-01-10 16:30:58 -0800 | [diff] [blame] | 380 | .id = ION_MM_FIRMWARE_HEAP_ID, |
| 381 | .type = ION_HEAP_TYPE_CARVEOUT, |
| 382 | .name = ION_MM_FIRMWARE_HEAP_NAME, |
| 383 | .size = MSM_ION_MM_FW_SIZE, |
| 384 | .memory_type = ION_EBI_TYPE, |
Laura Abbott | b93525f | 2012-04-12 09:57:19 -0700 | [diff] [blame] | 385 | .extra_data = (void *) &fw_co_msm8930_ion_pdata, |
Olav Haugan | 42ebe71 | 2012-01-10 16:30:58 -0800 | [diff] [blame] | 386 | }, |
| 387 | { |
Olav Haugan | b5be799 | 2011-11-18 14:29:02 -0800 | [diff] [blame] | 388 | .id = ION_CP_MFC_HEAP_ID, |
Olav Haugan | 0a85251 | 2012-01-09 10:20:55 -0800 | [diff] [blame] | 389 | .type = ION_HEAP_TYPE_CP, |
Olav Haugan | b5be799 | 2011-11-18 14:29:02 -0800 | [diff] [blame] | 390 | .name = ION_MFC_HEAP_NAME, |
| 391 | .size = MSM_ION_MFC_SIZE, |
| 392 | .memory_type = ION_EBI_TYPE, |
Laura Abbott | b93525f | 2012-04-12 09:57:19 -0700 | [diff] [blame] | 393 | .extra_data = (void *) &cp_mfc_msm8930_ion_pdata, |
Olav Haugan | b5be799 | 2011-11-18 14:29:02 -0800 | [diff] [blame] | 394 | }, |
Hanumant Singh | edfb046 | 2012-05-15 14:49:32 -0700 | [diff] [blame] | 395 | #ifndef CONFIG_MSM_IOMMU |
Olav Haugan | b5be799 | 2011-11-18 14:29:02 -0800 | [diff] [blame] | 396 | { |
Olav Haugan | 9cdfc2f | 2012-02-15 09:52:57 -0800 | [diff] [blame] | 397 | .id = ION_SF_HEAP_ID, |
| 398 | .type = ION_HEAP_TYPE_CARVEOUT, |
| 399 | .name = ION_SF_HEAP_NAME, |
| 400 | .size = MSM_ION_SF_SIZE, |
| 401 | .memory_type = ION_EBI_TYPE, |
Laura Abbott | b93525f | 2012-04-12 09:57:19 -0700 | [diff] [blame] | 402 | .extra_data = (void *) &co_msm8930_ion_pdata, |
Olav Haugan | 9cdfc2f | 2012-02-15 09:52:57 -0800 | [diff] [blame] | 403 | }, |
Hanumant Singh | edfb046 | 2012-05-15 14:49:32 -0700 | [diff] [blame] | 404 | #endif |
Olav Haugan | 9cdfc2f | 2012-02-15 09:52:57 -0800 | [diff] [blame] | 405 | { |
Olav Haugan | b5be799 | 2011-11-18 14:29:02 -0800 | [diff] [blame] | 406 | .id = ION_IOMMU_HEAP_ID, |
| 407 | .type = ION_HEAP_TYPE_IOMMU, |
| 408 | .name = ION_IOMMU_HEAP_NAME, |
| 409 | }, |
Olav Haugan | 80854eb | 2012-01-12 12:00:23 -0800 | [diff] [blame] | 410 | { |
| 411 | .id = ION_QSECOM_HEAP_ID, |
| 412 | .type = ION_HEAP_TYPE_CARVEOUT, |
| 413 | .name = ION_QSECOM_HEAP_NAME, |
| 414 | .size = MSM_ION_QSECOM_SIZE, |
| 415 | .memory_type = ION_EBI_TYPE, |
Laura Abbott | b93525f | 2012-04-12 09:57:19 -0700 | [diff] [blame] | 416 | .extra_data = (void *) &co_msm8930_ion_pdata, |
Olav Haugan | 80854eb | 2012-01-12 12:00:23 -0800 | [diff] [blame] | 417 | }, |
Olav Haugan | 7355db0 | 2012-01-13 16:59:13 -0800 | [diff] [blame] | 418 | { |
| 419 | .id = ION_AUDIO_HEAP_ID, |
| 420 | .type = ION_HEAP_TYPE_CARVEOUT, |
| 421 | .name = ION_AUDIO_HEAP_NAME, |
| 422 | .size = MSM_ION_AUDIO_SIZE, |
| 423 | .memory_type = ION_EBI_TYPE, |
Laura Abbott | b93525f | 2012-04-12 09:57:19 -0700 | [diff] [blame] | 424 | .extra_data = (void *) &co_msm8930_ion_pdata, |
Olav Haugan | 7355db0 | 2012-01-13 16:59:13 -0800 | [diff] [blame] | 425 | }, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 426 | #endif |
| 427 | } |
| 428 | }; |
| 429 | |
Laura Abbott | b93525f | 2012-04-12 09:57:19 -0700 | [diff] [blame] | 430 | static struct platform_device msm8930_ion_dev = { |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 431 | .name = "ion-msm", |
| 432 | .id = 1, |
Laura Abbott | b93525f | 2012-04-12 09:57:19 -0700 | [diff] [blame] | 433 | .dev = { .platform_data = &msm8930_ion_pdata }, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 434 | }; |
| 435 | #endif |
| 436 | |
Hanumant Singh | eea6256 | 2012-05-14 11:32:45 -0700 | [diff] [blame] | 437 | struct platform_device msm8930_fmem_device = { |
| 438 | .name = "fmem", |
| 439 | .id = 1, |
| 440 | .dev = { .platform_data = &msm8930_fmem_pdata }, |
| 441 | }; |
| 442 | |
| 443 | static void __init reserve_mem_for_ion(enum ion_memory_types mem_type, |
| 444 | unsigned long size) |
| 445 | { |
| 446 | msm8930_reserve_table[mem_type].size += size; |
| 447 | } |
| 448 | |
| 449 | static void __init msm8930_reserve_fixed_area(unsigned long fixed_area_size) |
| 450 | { |
| 451 | #if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION) |
| 452 | int ret; |
| 453 | |
| 454 | if (fixed_area_size > MAX_FIXED_AREA_SIZE) |
| 455 | panic("fixed area size is larger than %dM\n", |
| 456 | MAX_FIXED_AREA_SIZE >> 20); |
| 457 | |
| 458 | reserve_info->fixed_area_size = fixed_area_size; |
| 459 | reserve_info->fixed_area_start = MSM8930_FW_START; |
| 460 | |
| 461 | ret = memblock_remove(reserve_info->fixed_area_start, |
| 462 | reserve_info->fixed_area_size); |
| 463 | BUG_ON(ret); |
| 464 | #endif |
| 465 | } |
| 466 | |
| 467 | /** |
| 468 | * Reserve memory for ION and calculate amount of reusable memory for fmem. |
| 469 | * We only reserve memory for heaps that are not reusable. However, we only |
| 470 | * support one reusable heap at the moment so we ignore the reusable flag for |
| 471 | * other than the first heap with reusable flag set. Also handle special case |
| 472 | * for video heaps (MM,FW, and MFC). Video requires heaps MM and MFC to be |
| 473 | * at a higher address than FW in addition to not more than 256MB away from the |
| 474 | * base address of the firmware. This means that if MM is reusable the other |
| 475 | * two heaps must be allocated in the same region as FW. This is handled by the |
| 476 | * mem_is_fmem flag in the platform data. In addition the MM heap must be |
| 477 | * adjacent to the FW heap for content protection purposes. |
| 478 | */ |
Stephen Boyd | 668d765 | 2012-04-25 11:31:01 -0700 | [diff] [blame] | 479 | static void __init reserve_ion_memory(void) |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 480 | { |
| 481 | #if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION) |
Hanumant Singh | eea6256 | 2012-05-14 11:32:45 -0700 | [diff] [blame] | 482 | unsigned int i; |
| 483 | unsigned int reusable_count = 0; |
| 484 | unsigned int fixed_size = 0; |
| 485 | unsigned int fixed_low_size, fixed_middle_size, fixed_high_size; |
| 486 | unsigned long fixed_low_start, fixed_middle_start, fixed_high_start; |
| 487 | |
| 488 | msm8930_fmem_pdata.size = 0; |
| 489 | msm8930_fmem_pdata.reserved_size_low = 0; |
| 490 | msm8930_fmem_pdata.reserved_size_high = 0; |
Olav Haugan | 6243625 | 2012-05-16 09:09:43 -0700 | [diff] [blame^] | 491 | msm8930_fmem_pdata.align = PAGE_SIZE; |
Hanumant Singh | eea6256 | 2012-05-14 11:32:45 -0700 | [diff] [blame] | 492 | fixed_low_size = 0; |
| 493 | fixed_middle_size = 0; |
| 494 | fixed_high_size = 0; |
| 495 | |
| 496 | /* We only support 1 reusable heap. Check if more than one heap |
| 497 | * is specified as reusable and set as non-reusable if found. |
| 498 | */ |
| 499 | for (i = 0; i < msm8930_ion_pdata.nr; ++i) { |
| 500 | const struct ion_platform_heap *heap = |
| 501 | &(msm8930_ion_pdata.heaps[i]); |
| 502 | |
| 503 | if (heap->type == ION_HEAP_TYPE_CP && heap->extra_data) { |
| 504 | struct ion_cp_heap_pdata *data = heap->extra_data; |
| 505 | |
| 506 | reusable_count += (data->reusable) ? 1 : 0; |
| 507 | |
| 508 | if (data->reusable && reusable_count > 1) { |
| 509 | pr_err("%s: Too many heaps specified as " |
| 510 | "reusable. Heap %s was not configured " |
| 511 | "as reusable.\n", __func__, heap->name); |
| 512 | data->reusable = 0; |
| 513 | } |
| 514 | } |
| 515 | } |
| 516 | |
| 517 | for (i = 0; i < msm8930_ion_pdata.nr; ++i) { |
| 518 | const struct ion_platform_heap *heap = |
| 519 | &(msm8930_ion_pdata.heaps[i]); |
| 520 | |
| 521 | if (heap->extra_data) { |
| 522 | int fixed_position = NOT_FIXED; |
| 523 | int mem_is_fmem = 0; |
| 524 | |
| 525 | switch (heap->type) { |
| 526 | case ION_HEAP_TYPE_CP: |
| 527 | mem_is_fmem = ((struct ion_cp_heap_pdata *) |
| 528 | heap->extra_data)->mem_is_fmem; |
| 529 | fixed_position = ((struct ion_cp_heap_pdata *) |
| 530 | heap->extra_data)->fixed_position; |
| 531 | break; |
| 532 | case ION_HEAP_TYPE_CARVEOUT: |
| 533 | mem_is_fmem = ((struct ion_co_heap_pdata *) |
| 534 | heap->extra_data)->mem_is_fmem; |
| 535 | fixed_position = ((struct ion_co_heap_pdata *) |
| 536 | heap->extra_data)->fixed_position; |
| 537 | break; |
| 538 | default: |
| 539 | break; |
| 540 | } |
| 541 | |
| 542 | if (fixed_position != NOT_FIXED) |
| 543 | fixed_size += heap->size; |
| 544 | else |
| 545 | reserve_mem_for_ion(MEMTYPE_EBI1, heap->size); |
| 546 | |
| 547 | if (fixed_position == FIXED_LOW) |
| 548 | fixed_low_size += heap->size; |
| 549 | else if (fixed_position == FIXED_MIDDLE) |
| 550 | fixed_middle_size += heap->size; |
| 551 | else if (fixed_position == FIXED_HIGH) |
| 552 | fixed_high_size += heap->size; |
| 553 | |
| 554 | if (mem_is_fmem) |
| 555 | msm8930_fmem_pdata.size += heap->size; |
| 556 | } |
| 557 | } |
| 558 | |
| 559 | if (!fixed_size) |
| 560 | return; |
| 561 | |
| 562 | if (msm8930_fmem_pdata.size) { |
| 563 | msm8930_fmem_pdata.reserved_size_low = fixed_low_size; |
| 564 | msm8930_fmem_pdata.reserved_size_high = fixed_high_size; |
| 565 | } |
| 566 | |
| 567 | /* Since the fixed area may be carved out of lowmem, |
| 568 | * make sure the length is a multiple of 1M. |
| 569 | */ |
| 570 | fixed_size = (fixed_size + MSM_MM_FW_SIZE + SECTION_SIZE - 1) |
| 571 | & SECTION_MASK; |
| 572 | msm8930_reserve_fixed_area(fixed_size); |
| 573 | |
| 574 | fixed_low_start = MSM8930_FIXED_AREA_START; |
| 575 | fixed_middle_start = fixed_low_start + fixed_low_size; |
| 576 | fixed_high_start = fixed_middle_start + fixed_middle_size; |
| 577 | |
| 578 | for (i = 0; i < msm8930_ion_pdata.nr; ++i) { |
| 579 | struct ion_platform_heap *heap = &(msm8930_ion_pdata.heaps[i]); |
| 580 | |
| 581 | if (heap->extra_data) { |
| 582 | int fixed_position = NOT_FIXED; |
| 583 | |
| 584 | switch (heap->type) { |
| 585 | case ION_HEAP_TYPE_CP: |
| 586 | fixed_position = ((struct ion_cp_heap_pdata *) |
| 587 | heap->extra_data)->fixed_position; |
| 588 | break; |
| 589 | case ION_HEAP_TYPE_CARVEOUT: |
| 590 | fixed_position = ((struct ion_co_heap_pdata *) |
| 591 | heap->extra_data)->fixed_position; |
| 592 | break; |
| 593 | default: |
| 594 | break; |
| 595 | } |
| 596 | |
| 597 | switch (fixed_position) { |
| 598 | case FIXED_LOW: |
| 599 | heap->base = fixed_low_start; |
| 600 | break; |
| 601 | case FIXED_MIDDLE: |
| 602 | heap->base = fixed_middle_start; |
| 603 | break; |
| 604 | case FIXED_HIGH: |
| 605 | heap->base = fixed_high_start; |
| 606 | break; |
| 607 | default: |
| 608 | break; |
| 609 | } |
| 610 | } |
| 611 | } |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 612 | #endif |
| 613 | } |
Huaibin Yang | a541942 | 2011-12-08 23:52:10 -0800 | [diff] [blame] | 614 | |
| 615 | static void __init reserve_mdp_memory(void) |
| 616 | { |
| 617 | msm8930_mdp_writeback(msm8930_reserve_table); |
| 618 | } |
| 619 | |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 620 | static void __init msm8930_calculate_reserve_sizes(void) |
| 621 | { |
| 622 | size_pmem_devices(); |
| 623 | reserve_pmem_memory(); |
| 624 | reserve_ion_memory(); |
Huaibin Yang | a541942 | 2011-12-08 23:52:10 -0800 | [diff] [blame] | 625 | reserve_mdp_memory(); |
Laura Abbott | f8c03b9 | 2012-02-16 14:57:58 -0800 | [diff] [blame] | 626 | reserve_rtb_memory(); |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 627 | } |
| 628 | |
| 629 | static struct reserve_info msm8930_reserve_info __initdata = { |
| 630 | .memtype_reserve_table = msm8930_reserve_table, |
| 631 | .calculate_reserve_sizes = msm8930_calculate_reserve_sizes, |
Hanumant Singh | eea6256 | 2012-05-14 11:32:45 -0700 | [diff] [blame] | 632 | .reserve_fixed_area = msm8930_reserve_fixed_area, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 633 | .paddr_to_memtype = msm8930_paddr_to_memtype, |
| 634 | }; |
| 635 | |
| 636 | static int msm8930_memory_bank_size(void) |
| 637 | { |
| 638 | return 1<<29; |
| 639 | } |
| 640 | |
| 641 | static void __init locate_unstable_memory(void) |
| 642 | { |
| 643 | struct membank *mb = &meminfo.bank[meminfo.nr_banks - 1]; |
| 644 | unsigned long bank_size; |
| 645 | unsigned long low, high; |
| 646 | |
| 647 | bank_size = msm8930_memory_bank_size(); |
| 648 | low = meminfo.bank[0].start; |
| 649 | high = mb->start + mb->size; |
| 650 | |
| 651 | /* Check if 32 bit overflow occured */ |
| 652 | if (high < mb->start) |
Hanumant Singh | eea6256 | 2012-05-14 11:32:45 -0700 | [diff] [blame] | 653 | high -= PAGE_SIZE; |
| 654 | |
| 655 | if (high < MAX_FIXED_AREA_SIZE + MSM8930_FIXED_AREA_START) |
| 656 | panic("fixed area extends beyond end of memory\n"); |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 657 | |
| 658 | low &= ~(bank_size - 1); |
| 659 | |
| 660 | if (high - low <= bank_size) |
Hanumant Singh | eea6256 | 2012-05-14 11:32:45 -0700 | [diff] [blame] | 661 | goto no_dmm; |
Larry Bassel | b8d6102 | 2012-02-24 10:49:45 -0800 | [diff] [blame] | 662 | |
| 663 | msm8930_reserve_info.bank_size = bank_size; |
| 664 | #ifdef CONFIG_ENABLE_DMM |
Jack Cheung | 6ce8f68 | 2012-01-17 10:35:42 -0800 | [diff] [blame] | 665 | msm8930_reserve_info.low_unstable_address = mb->start - |
| 666 | MIN_MEMORY_BLOCK_SIZE + mb->size; |
| 667 | msm8930_reserve_info.max_unstable_size = MIN_MEMORY_BLOCK_SIZE; |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 668 | pr_info("low unstable address %lx max size %lx bank size %lx\n", |
| 669 | msm8930_reserve_info.low_unstable_address, |
| 670 | msm8930_reserve_info.max_unstable_size, |
| 671 | msm8930_reserve_info.bank_size); |
Hanumant Singh | eea6256 | 2012-05-14 11:32:45 -0700 | [diff] [blame] | 672 | return; |
Larry Bassel | b8d6102 | 2012-02-24 10:49:45 -0800 | [diff] [blame] | 673 | #endif |
Hanumant Singh | eea6256 | 2012-05-14 11:32:45 -0700 | [diff] [blame] | 674 | no_dmm: |
| 675 | msm8930_reserve_info.low_unstable_address = high; |
| 676 | msm8930_reserve_info.max_unstable_size = 0; |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 677 | } |
| 678 | |
| 679 | static void __init place_movable_zone(void) |
| 680 | { |
Larry Bassel | b8d6102 | 2012-02-24 10:49:45 -0800 | [diff] [blame] | 681 | #ifdef CONFIG_ENABLE_DMM |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 682 | movable_reserved_start = msm8930_reserve_info.low_unstable_address; |
| 683 | movable_reserved_size = msm8930_reserve_info.max_unstable_size; |
| 684 | pr_info("movable zone start %lx size %lx\n", |
| 685 | movable_reserved_start, movable_reserved_size); |
Larry Bassel | b8d6102 | 2012-02-24 10:49:45 -0800 | [diff] [blame] | 686 | #endif |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 687 | } |
| 688 | |
| 689 | static void __init msm8930_early_memory(void) |
| 690 | { |
| 691 | reserve_info = &msm8930_reserve_info; |
| 692 | locate_unstable_memory(); |
| 693 | place_movable_zone(); |
| 694 | } |
| 695 | |
| 696 | static void __init msm8930_reserve(void) |
| 697 | { |
| 698 | msm_reserve(); |
Hanumant Singh | eea6256 | 2012-05-14 11:32:45 -0700 | [diff] [blame] | 699 | if (msm8930_fmem_pdata.size) { |
| 700 | #if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION) |
| 701 | if (reserve_info->fixed_area_size) { |
| 702 | msm8930_fmem_pdata.phys = |
| 703 | reserve_info->fixed_area_start + MSM_MM_FW_SIZE; |
| 704 | pr_info("mm fw at %lx (fixed) size %x\n", |
| 705 | reserve_info->fixed_area_start, MSM_MM_FW_SIZE); |
| 706 | pr_info("fmem start %lx (fixed) size %lx\n", |
| 707 | msm8930_fmem_pdata.phys, msm8930_fmem_pdata.size); |
| 708 | } |
| 709 | #endif |
| 710 | } |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 711 | } |
| 712 | |
| 713 | static int msm8930_change_memory_power(u64 start, u64 size, |
| 714 | int change_type) |
| 715 | { |
| 716 | return soc_change_memory_power(start, size, change_type); |
| 717 | } |
| 718 | |
| 719 | static void __init msm8930_allocate_memory_regions(void) |
| 720 | { |
| 721 | msm8930_allocate_fb_region(); |
| 722 | } |
| 723 | |
Asish Bhattacharya | b86c347 | 2012-02-15 08:31:52 +0530 | [diff] [blame] | 724 | #ifdef CONFIG_WCD9304_CODEC |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 725 | |
Asish Bhattacharya | b86c347 | 2012-02-15 08:31:52 +0530 | [diff] [blame] | 726 | #define SITAR_INTERRUPT_BASE (NR_MSM_IRQS + NR_GPIO_IRQS + NR_PM8921_IRQS) |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 727 | |
| 728 | /* Micbias setting is based on 8660 CDP/MTP/FLUID requirement |
| 729 | * 4 micbiases are used to power various analog and digital |
| 730 | * microphones operating at 1800 mV. Technically, all micbiases |
| 731 | * can source from single cfilter since all microphones operate |
| 732 | * at the same voltage level. The arrangement below is to make |
| 733 | * sure all cfilters are exercised. LDO_H regulator ouput level |
| 734 | * does not need to be as high as 2.85V. It is choosen for |
| 735 | * microphone sensitivity purpose. |
| 736 | */ |
Asish Bhattacharya | b86c347 | 2012-02-15 08:31:52 +0530 | [diff] [blame] | 737 | static struct wcd9xxx_pdata sitar_platform_data = { |
| 738 | .slimbus_slave_device = { |
| 739 | .name = "sitar-slave", |
| 740 | .e_addr = {0, 0, 0x00, 0, 0x17, 2}, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 741 | }, |
| 742 | .irq = MSM_GPIO_TO_INT(62), |
Asish Bhattacharya | b86c347 | 2012-02-15 08:31:52 +0530 | [diff] [blame] | 743 | .irq_base = SITAR_INTERRUPT_BASE, |
Asish Bhattacharya | b1aeae2 | 2012-02-15 08:29:28 +0530 | [diff] [blame] | 744 | .num_irqs = NR_WCD9XXX_IRQS, |
Asish Bhattacharya | b86c347 | 2012-02-15 08:31:52 +0530 | [diff] [blame] | 745 | .reset_gpio = 42, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 746 | .micbias = { |
Asish Bhattacharya | b86c347 | 2012-02-15 08:31:52 +0530 | [diff] [blame] | 747 | .ldoh_v = SITAR_LDOH_2P85_V, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 748 | .cfilt1_mv = 1800, |
| 749 | .cfilt2_mv = 1800, |
Asish Bhattacharya | b86c347 | 2012-02-15 08:31:52 +0530 | [diff] [blame] | 750 | .bias1_cfilt_sel = SITAR_CFILT1_SEL, |
| 751 | .bias2_cfilt_sel = SITAR_CFILT2_SEL, |
| 752 | }, |
| 753 | .regulator = { |
| 754 | { |
| 755 | .name = "CDC_VDD_CP", |
David Collins | 226f251 | 2012-03-19 13:18:39 -0700 | [diff] [blame] | 756 | .min_uV = 1950000, |
Asish Bhattacharya | b86c347 | 2012-02-15 08:31:52 +0530 | [diff] [blame] | 757 | .max_uV = 2200000, |
| 758 | .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX, |
| 759 | }, |
| 760 | { |
| 761 | .name = "CDC_VDDA_RX", |
| 762 | .min_uV = 1800000, |
| 763 | .max_uV = 1800000, |
| 764 | .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX, |
| 765 | }, |
| 766 | { |
| 767 | .name = "CDC_VDDA_TX", |
| 768 | .min_uV = 1800000, |
| 769 | .max_uV = 1800000, |
| 770 | .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX, |
| 771 | }, |
| 772 | { |
| 773 | .name = "VDDIO_CDC", |
| 774 | .min_uV = 1800000, |
| 775 | .max_uV = 1800000, |
| 776 | .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX, |
| 777 | }, |
| 778 | { |
| 779 | .name = "VDDD_CDC_D", |
| 780 | .min_uV = 1200000, |
| 781 | .max_uV = 1200000, |
| 782 | .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX, |
| 783 | }, |
| 784 | { |
| 785 | .name = "CDC_VDDA_A_1P2V", |
| 786 | .min_uV = 1200000, |
| 787 | .max_uV = 1200000, |
| 788 | .optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX, |
| 789 | }, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 790 | }, |
| 791 | }; |
| 792 | |
Asish Bhattacharya | b86c347 | 2012-02-15 08:31:52 +0530 | [diff] [blame] | 793 | static struct slim_device msm_slim_sitar = { |
| 794 | .name = "sitar-slim", |
| 795 | .e_addr = {0, 1, 0x00, 0, 0x17, 2}, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 796 | .dev = { |
Asish Bhattacharya | b86c347 | 2012-02-15 08:31:52 +0530 | [diff] [blame] | 797 | .platform_data = &sitar_platform_data, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 798 | }, |
| 799 | }; |
| 800 | #endif |
| 801 | |
Asish Bhattacharya | b86c347 | 2012-02-15 08:31:52 +0530 | [diff] [blame] | 802 | |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 803 | static struct slim_boardinfo msm_slim_devices[] = { |
Asish Bhattacharya | b86c347 | 2012-02-15 08:31:52 +0530 | [diff] [blame] | 804 | #ifdef CONFIG_WCD9304_CODEC |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 805 | { |
| 806 | .bus_num = 1, |
Asish Bhattacharya | b86c347 | 2012-02-15 08:31:52 +0530 | [diff] [blame] | 807 | .slim_slave = &msm_slim_sitar, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 808 | }, |
| 809 | #endif |
| 810 | /* add more slimbus slaves as needed */ |
| 811 | }; |
| 812 | |
| 813 | #define MSM_WCNSS_PHYS 0x03000000 |
| 814 | #define MSM_WCNSS_SIZE 0x280000 |
| 815 | |
| 816 | static struct resource resources_wcnss_wlan[] = { |
| 817 | { |
| 818 | .start = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ, |
| 819 | .end = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ, |
| 820 | .name = "wcnss_wlanrx_irq", |
| 821 | .flags = IORESOURCE_IRQ, |
| 822 | }, |
| 823 | { |
| 824 | .start = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ, |
| 825 | .end = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ, |
| 826 | .name = "wcnss_wlantx_irq", |
| 827 | .flags = IORESOURCE_IRQ, |
| 828 | }, |
| 829 | { |
| 830 | .start = MSM_WCNSS_PHYS, |
| 831 | .end = MSM_WCNSS_PHYS + MSM_WCNSS_SIZE - 1, |
| 832 | .name = "wcnss_mmio", |
| 833 | .flags = IORESOURCE_MEM, |
| 834 | }, |
| 835 | { |
| 836 | .start = 84, |
| 837 | .end = 88, |
| 838 | .name = "wcnss_gpios_5wire", |
| 839 | .flags = IORESOURCE_IO, |
| 840 | }, |
| 841 | }; |
| 842 | |
| 843 | static struct qcom_wcnss_opts qcom_wcnss_pdata = { |
| 844 | .has_48mhz_xo = 1, |
| 845 | }; |
| 846 | |
| 847 | static struct platform_device msm_device_wcnss_wlan = { |
| 848 | .name = "wcnss_wlan", |
| 849 | .id = 0, |
| 850 | .num_resources = ARRAY_SIZE(resources_wcnss_wlan), |
| 851 | .resource = resources_wcnss_wlan, |
| 852 | .dev = {.platform_data = &qcom_wcnss_pdata}, |
| 853 | }; |
| 854 | |
Ramesh Masavarapu | a26cce7 | 2012-04-09 12:32:25 -0700 | [diff] [blame] | 855 | #ifdef CONFIG_QSEECOM |
| 856 | /* qseecom bus scaling */ |
| 857 | static struct msm_bus_vectors qseecom_clks_init_vectors[] = { |
| 858 | { |
| 859 | .src = MSM_BUS_MASTER_SPS, |
| 860 | .dst = MSM_BUS_SLAVE_EBI_CH0, |
| 861 | .ib = 0, |
| 862 | .ab = 0, |
| 863 | }, |
| 864 | { |
| 865 | .src = MSM_BUS_MASTER_SPDM, |
| 866 | .dst = MSM_BUS_SLAVE_SPDM, |
| 867 | .ib = 0, |
| 868 | .ab = 0, |
| 869 | }, |
| 870 | }; |
| 871 | |
| 872 | static struct msm_bus_vectors qseecom_enable_dfab_vectors[] = { |
| 873 | { |
| 874 | .src = MSM_BUS_MASTER_SPS, |
| 875 | .dst = MSM_BUS_SLAVE_EBI_CH0, |
| 876 | .ib = (492 * 8) * 1000000UL, |
| 877 | .ab = (492 * 8) * 100000UL, |
| 878 | }, |
| 879 | { |
| 880 | .src = MSM_BUS_MASTER_SPDM, |
| 881 | .dst = MSM_BUS_SLAVE_SPDM, |
| 882 | .ib = 0, |
| 883 | .ab = 0, |
| 884 | }, |
| 885 | }; |
| 886 | |
| 887 | static struct msm_bus_vectors qseecom_enable_sfpb_vectors[] = { |
| 888 | { |
| 889 | .src = MSM_BUS_MASTER_SPS, |
| 890 | .dst = MSM_BUS_SLAVE_EBI_CH0, |
| 891 | .ib = 0, |
| 892 | .ab = 0, |
| 893 | }, |
| 894 | { |
| 895 | .src = MSM_BUS_MASTER_SPDM, |
| 896 | .dst = MSM_BUS_SLAVE_SPDM, |
| 897 | .ib = (64 * 8) * 1000000UL, |
| 898 | .ab = (64 * 8) * 100000UL, |
| 899 | }, |
| 900 | }; |
| 901 | |
| 902 | static struct msm_bus_paths qseecom_hw_bus_scale_usecases[] = { |
| 903 | { |
| 904 | ARRAY_SIZE(qseecom_clks_init_vectors), |
| 905 | qseecom_clks_init_vectors, |
| 906 | }, |
| 907 | { |
| 908 | ARRAY_SIZE(qseecom_enable_dfab_vectors), |
| 909 | qseecom_enable_sfpb_vectors, |
| 910 | }, |
| 911 | { |
| 912 | ARRAY_SIZE(qseecom_enable_sfpb_vectors), |
| 913 | qseecom_enable_sfpb_vectors, |
| 914 | }, |
| 915 | }; |
| 916 | |
| 917 | static struct msm_bus_scale_pdata qseecom_bus_pdata = { |
| 918 | qseecom_hw_bus_scale_usecases, |
| 919 | ARRAY_SIZE(qseecom_hw_bus_scale_usecases), |
| 920 | .name = "qsee", |
| 921 | }; |
| 922 | |
| 923 | static struct platform_device qseecom_device = { |
| 924 | .name = "qseecom", |
| 925 | .id = 0, |
| 926 | .dev = { |
| 927 | .platform_data = &qseecom_bus_pdata, |
| 928 | }, |
| 929 | }; |
| 930 | #endif |
| 931 | |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 932 | #if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \ |
| 933 | defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \ |
| 934 | defined(CONFIG_CRYPTO_DEV_QCEDEV) || \ |
| 935 | defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE) |
| 936 | |
| 937 | #define QCE_SIZE 0x10000 |
| 938 | #define QCE_0_BASE 0x18500000 |
| 939 | |
| 940 | #define QCE_HW_KEY_SUPPORT 0 |
| 941 | #define QCE_SHA_HMAC_SUPPORT 1 |
| 942 | #define QCE_SHARE_CE_RESOURCE 1 |
| 943 | #define QCE_CE_SHARED 0 |
| 944 | |
| 945 | static struct resource qcrypto_resources[] = { |
| 946 | [0] = { |
| 947 | .start = QCE_0_BASE, |
| 948 | .end = QCE_0_BASE + QCE_SIZE - 1, |
| 949 | .flags = IORESOURCE_MEM, |
| 950 | }, |
| 951 | [1] = { |
| 952 | .name = "crypto_channels", |
| 953 | .start = DMOV_CE_IN_CHAN, |
| 954 | .end = DMOV_CE_OUT_CHAN, |
| 955 | .flags = IORESOURCE_DMA, |
| 956 | }, |
| 957 | [2] = { |
| 958 | .name = "crypto_crci_in", |
| 959 | .start = DMOV_CE_IN_CRCI, |
| 960 | .end = DMOV_CE_IN_CRCI, |
| 961 | .flags = IORESOURCE_DMA, |
| 962 | }, |
| 963 | [3] = { |
| 964 | .name = "crypto_crci_out", |
| 965 | .start = DMOV_CE_OUT_CRCI, |
| 966 | .end = DMOV_CE_OUT_CRCI, |
| 967 | .flags = IORESOURCE_DMA, |
| 968 | }, |
| 969 | }; |
| 970 | |
| 971 | static struct resource qcedev_resources[] = { |
| 972 | [0] = { |
| 973 | .start = QCE_0_BASE, |
| 974 | .end = QCE_0_BASE + QCE_SIZE - 1, |
| 975 | .flags = IORESOURCE_MEM, |
| 976 | }, |
| 977 | [1] = { |
| 978 | .name = "crypto_channels", |
| 979 | .start = DMOV_CE_IN_CHAN, |
| 980 | .end = DMOV_CE_OUT_CHAN, |
| 981 | .flags = IORESOURCE_DMA, |
| 982 | }, |
| 983 | [2] = { |
| 984 | .name = "crypto_crci_in", |
| 985 | .start = DMOV_CE_IN_CRCI, |
| 986 | .end = DMOV_CE_IN_CRCI, |
| 987 | .flags = IORESOURCE_DMA, |
| 988 | }, |
| 989 | [3] = { |
| 990 | .name = "crypto_crci_out", |
| 991 | .start = DMOV_CE_OUT_CRCI, |
| 992 | .end = DMOV_CE_OUT_CRCI, |
| 993 | .flags = IORESOURCE_DMA, |
| 994 | }, |
| 995 | }; |
| 996 | |
| 997 | #endif |
| 998 | |
| 999 | #if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \ |
| 1000 | defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) |
| 1001 | |
| 1002 | static struct msm_ce_hw_support qcrypto_ce_hw_suppport = { |
| 1003 | .ce_shared = QCE_CE_SHARED, |
| 1004 | .shared_ce_resource = QCE_SHARE_CE_RESOURCE, |
| 1005 | .hw_key_support = QCE_HW_KEY_SUPPORT, |
| 1006 | .sha_hmac = QCE_SHA_HMAC_SUPPORT, |
| 1007 | }; |
| 1008 | |
| 1009 | static struct platform_device qcrypto_device = { |
| 1010 | .name = "qcrypto", |
| 1011 | .id = 0, |
| 1012 | .num_resources = ARRAY_SIZE(qcrypto_resources), |
| 1013 | .resource = qcrypto_resources, |
| 1014 | .dev = { |
| 1015 | .coherent_dma_mask = DMA_BIT_MASK(32), |
| 1016 | .platform_data = &qcrypto_ce_hw_suppport, |
| 1017 | }, |
| 1018 | }; |
| 1019 | #endif |
| 1020 | |
| 1021 | #if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \ |
| 1022 | defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE) |
| 1023 | |
| 1024 | static struct msm_ce_hw_support qcedev_ce_hw_suppport = { |
| 1025 | .ce_shared = QCE_CE_SHARED, |
| 1026 | .shared_ce_resource = QCE_SHARE_CE_RESOURCE, |
| 1027 | .hw_key_support = QCE_HW_KEY_SUPPORT, |
| 1028 | .sha_hmac = QCE_SHA_HMAC_SUPPORT, |
| 1029 | }; |
| 1030 | |
| 1031 | static struct platform_device qcedev_device = { |
| 1032 | .name = "qce", |
| 1033 | .id = 0, |
| 1034 | .num_resources = ARRAY_SIZE(qcedev_resources), |
| 1035 | .resource = qcedev_resources, |
| 1036 | .dev = { |
| 1037 | .coherent_dma_mask = DMA_BIT_MASK(32), |
| 1038 | .platform_data = &qcedev_ce_hw_suppport, |
| 1039 | }, |
| 1040 | }; |
| 1041 | #endif |
| 1042 | |
| 1043 | #define MDM2AP_ERRFATAL 70 |
| 1044 | #define AP2MDM_ERRFATAL 95 |
| 1045 | #define MDM2AP_STATUS 69 |
| 1046 | #define AP2MDM_STATUS 94 |
| 1047 | #define AP2MDM_PMIC_RESET_N 80 |
| 1048 | #define AP2MDM_KPDPWR_N 81 |
| 1049 | |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 1050 | static struct resource mdm_resources[] = { |
| 1051 | { |
| 1052 | .start = MDM2AP_ERRFATAL, |
| 1053 | .end = MDM2AP_ERRFATAL, |
| 1054 | .name = "MDM2AP_ERRFATAL", |
| 1055 | .flags = IORESOURCE_IO, |
| 1056 | }, |
| 1057 | { |
| 1058 | .start = AP2MDM_ERRFATAL, |
| 1059 | .end = AP2MDM_ERRFATAL, |
| 1060 | .name = "AP2MDM_ERRFATAL", |
| 1061 | .flags = IORESOURCE_IO, |
| 1062 | }, |
| 1063 | { |
| 1064 | .start = MDM2AP_STATUS, |
| 1065 | .end = MDM2AP_STATUS, |
| 1066 | .name = "MDM2AP_STATUS", |
| 1067 | .flags = IORESOURCE_IO, |
| 1068 | }, |
| 1069 | { |
| 1070 | .start = AP2MDM_STATUS, |
| 1071 | .end = AP2MDM_STATUS, |
| 1072 | .name = "AP2MDM_STATUS", |
| 1073 | .flags = IORESOURCE_IO, |
| 1074 | }, |
| 1075 | { |
| 1076 | .start = AP2MDM_PMIC_RESET_N, |
| 1077 | .end = AP2MDM_PMIC_RESET_N, |
| 1078 | .name = "AP2MDM_PMIC_RESET_N", |
| 1079 | .flags = IORESOURCE_IO, |
| 1080 | }, |
| 1081 | { |
| 1082 | .start = AP2MDM_KPDPWR_N, |
| 1083 | .end = AP2MDM_KPDPWR_N, |
| 1084 | .name = "AP2MDM_KPDPWR_N", |
| 1085 | .flags = IORESOURCE_IO, |
| 1086 | }, |
| 1087 | }; |
| 1088 | |
| 1089 | static struct mdm_platform_data mdm_platform_data = { |
| 1090 | .mdm_version = "2.5", |
| 1091 | }; |
| 1092 | |
| 1093 | static struct platform_device mdm_device = { |
| 1094 | .name = "mdm2_modem", |
| 1095 | .id = -1, |
| 1096 | .num_resources = ARRAY_SIZE(mdm_resources), |
| 1097 | .resource = mdm_resources, |
| 1098 | .dev = { |
| 1099 | .platform_data = &mdm_platform_data, |
| 1100 | }, |
| 1101 | }; |
| 1102 | |
| 1103 | static struct platform_device *mdm_devices[] __initdata = { |
| 1104 | &mdm_device, |
| 1105 | }; |
| 1106 | |
Praveen Chidambaram | 7849901 | 2011-11-01 17:15:17 -0600 | [diff] [blame] | 1107 | #ifdef CONFIG_MSM_MPM |
| 1108 | static uint16_t msm_mpm_irqs_m2a[MSM_MPM_NR_MPM_IRQS] __initdata = { |
| 1109 | [1] = MSM_GPIO_TO_INT(46), |
| 1110 | [2] = MSM_GPIO_TO_INT(150), |
| 1111 | [4] = MSM_GPIO_TO_INT(103), |
| 1112 | [5] = MSM_GPIO_TO_INT(104), |
| 1113 | [6] = MSM_GPIO_TO_INT(105), |
| 1114 | [7] = MSM_GPIO_TO_INT(106), |
| 1115 | [8] = MSM_GPIO_TO_INT(107), |
| 1116 | [9] = MSM_GPIO_TO_INT(7), |
| 1117 | [10] = MSM_GPIO_TO_INT(11), |
| 1118 | [11] = MSM_GPIO_TO_INT(15), |
| 1119 | [12] = MSM_GPIO_TO_INT(19), |
| 1120 | [13] = MSM_GPIO_TO_INT(23), |
| 1121 | [14] = MSM_GPIO_TO_INT(27), |
| 1122 | [15] = MSM_GPIO_TO_INT(31), |
| 1123 | [16] = MSM_GPIO_TO_INT(35), |
| 1124 | [19] = MSM_GPIO_TO_INT(90), |
| 1125 | [20] = MSM_GPIO_TO_INT(92), |
| 1126 | [23] = MSM_GPIO_TO_INT(85), |
| 1127 | [24] = MSM_GPIO_TO_INT(83), |
| 1128 | [25] = USB1_HS_IRQ, |
| 1129 | [27] = HDMI_IRQ, |
| 1130 | [29] = MSM_GPIO_TO_INT(10), |
| 1131 | [30] = MSM_GPIO_TO_INT(102), |
| 1132 | [31] = MSM_GPIO_TO_INT(81), |
| 1133 | [32] = MSM_GPIO_TO_INT(78), |
| 1134 | [33] = MSM_GPIO_TO_INT(94), |
| 1135 | [34] = MSM_GPIO_TO_INT(72), |
| 1136 | [35] = MSM_GPIO_TO_INT(39), |
| 1137 | [36] = MSM_GPIO_TO_INT(43), |
| 1138 | [37] = MSM_GPIO_TO_INT(61), |
| 1139 | [38] = MSM_GPIO_TO_INT(50), |
| 1140 | [39] = MSM_GPIO_TO_INT(42), |
| 1141 | [41] = MSM_GPIO_TO_INT(62), |
| 1142 | [42] = MSM_GPIO_TO_INT(76), |
| 1143 | [43] = MSM_GPIO_TO_INT(75), |
| 1144 | [44] = MSM_GPIO_TO_INT(70), |
| 1145 | [45] = MSM_GPIO_TO_INT(69), |
| 1146 | [46] = MSM_GPIO_TO_INT(67), |
| 1147 | [47] = MSM_GPIO_TO_INT(65), |
| 1148 | [48] = MSM_GPIO_TO_INT(58), |
| 1149 | [49] = MSM_GPIO_TO_INT(54), |
| 1150 | [50] = MSM_GPIO_TO_INT(52), |
| 1151 | [51] = MSM_GPIO_TO_INT(49), |
| 1152 | [52] = MSM_GPIO_TO_INT(40), |
| 1153 | [53] = MSM_GPIO_TO_INT(37), |
| 1154 | [54] = MSM_GPIO_TO_INT(24), |
| 1155 | [55] = MSM_GPIO_TO_INT(14), |
| 1156 | }; |
| 1157 | |
| 1158 | static uint16_t msm_mpm_bypassed_apps_irqs[] __initdata = { |
| 1159 | TLMM_MSM_SUMMARY_IRQ, |
| 1160 | RPM_APCC_CPU0_GP_HIGH_IRQ, |
| 1161 | RPM_APCC_CPU0_GP_MEDIUM_IRQ, |
| 1162 | RPM_APCC_CPU0_GP_LOW_IRQ, |
| 1163 | RPM_APCC_CPU0_WAKE_UP_IRQ, |
| 1164 | RPM_APCC_CPU1_GP_HIGH_IRQ, |
| 1165 | RPM_APCC_CPU1_GP_MEDIUM_IRQ, |
| 1166 | RPM_APCC_CPU1_GP_LOW_IRQ, |
| 1167 | RPM_APCC_CPU1_WAKE_UP_IRQ, |
| 1168 | MSS_TO_APPS_IRQ_0, |
| 1169 | MSS_TO_APPS_IRQ_1, |
| 1170 | MSS_TO_APPS_IRQ_2, |
| 1171 | MSS_TO_APPS_IRQ_3, |
| 1172 | MSS_TO_APPS_IRQ_4, |
| 1173 | MSS_TO_APPS_IRQ_5, |
| 1174 | MSS_TO_APPS_IRQ_6, |
| 1175 | MSS_TO_APPS_IRQ_7, |
| 1176 | MSS_TO_APPS_IRQ_8, |
| 1177 | MSS_TO_APPS_IRQ_9, |
| 1178 | LPASS_SCSS_GP_LOW_IRQ, |
| 1179 | LPASS_SCSS_GP_MEDIUM_IRQ, |
| 1180 | LPASS_SCSS_GP_HIGH_IRQ, |
| 1181 | SPS_MTI_30, |
| 1182 | SPS_MTI_31, |
| 1183 | RIVA_APSS_SPARE_IRQ, |
| 1184 | RIVA_APPS_WLAN_SMSM_IRQ, |
| 1185 | RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ, |
| 1186 | RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ, |
| 1187 | }; |
| 1188 | |
| 1189 | struct msm_mpm_device_data msm8930_mpm_dev_data __initdata = { |
| 1190 | .irqs_m2a = msm_mpm_irqs_m2a, |
| 1191 | .irqs_m2a_size = ARRAY_SIZE(msm_mpm_irqs_m2a), |
| 1192 | .bypassed_apps_irqs = msm_mpm_bypassed_apps_irqs, |
| 1193 | .bypassed_apps_irqs_size = ARRAY_SIZE(msm_mpm_bypassed_apps_irqs), |
| 1194 | .mpm_request_reg_base = MSM_RPM_BASE + 0x9d8, |
| 1195 | .mpm_status_reg_base = MSM_RPM_BASE + 0xdf8, |
| 1196 | .mpm_apps_ipc_reg = MSM_APCS_GCC_BASE + 0x008, |
| 1197 | .mpm_apps_ipc_val = BIT(1), |
| 1198 | .mpm_ipc_irq = RPM_APCC_CPU0_GP_MEDIUM_IRQ, |
| 1199 | |
| 1200 | }; |
| 1201 | #endif |
| 1202 | |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 1203 | #define MSM_SHARED_RAM_PHYS 0x80000000 |
| 1204 | |
| 1205 | static void __init msm8930_map_io(void) |
| 1206 | { |
| 1207 | msm_shared_ram_phys = MSM_SHARED_RAM_PHYS; |
| 1208 | msm_map_msm8930_io(); |
| 1209 | |
| 1210 | if (socinfo_init() < 0) |
| 1211 | pr_err("socinfo_init() failed!\n"); |
| 1212 | } |
| 1213 | |
| 1214 | static void __init msm8930_init_irq(void) |
| 1215 | { |
Praveen Chidambaram | 7849901 | 2011-11-01 17:15:17 -0600 | [diff] [blame] | 1216 | struct msm_mpm_device_data *data = NULL; |
| 1217 | #ifdef CONFIG_MSM_MPM |
| 1218 | data = &msm8930_mpm_dev_data; |
| 1219 | #endif |
| 1220 | |
| 1221 | msm_mpm_irq_extn_init(data); |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 1222 | gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE, |
| 1223 | (void *)MSM_QGIC_CPU_BASE); |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 1224 | } |
| 1225 | |
| 1226 | static void __init msm8930_init_buses(void) |
| 1227 | { |
| 1228 | #ifdef CONFIG_MSM_BUS_SCALING |
| 1229 | msm_bus_rpm_set_mt_mask(); |
Gagan Mac | cd5b327 | 2012-02-09 18:13:10 -0700 | [diff] [blame] | 1230 | msm_bus_8930_apps_fabric_pdata.rpm_enabled = 1; |
| 1231 | msm_bus_8930_sys_fabric_pdata.rpm_enabled = 1; |
| 1232 | msm_bus_8930_mm_fabric_pdata.rpm_enabled = 1; |
| 1233 | msm_bus_8930_apps_fabric.dev.platform_data = |
| 1234 | &msm_bus_8930_apps_fabric_pdata; |
| 1235 | msm_bus_8930_sys_fabric.dev.platform_data = |
| 1236 | &msm_bus_8930_sys_fabric_pdata; |
| 1237 | msm_bus_8930_mm_fabric.dev.platform_data = |
| 1238 | &msm_bus_8930_mm_fabric_pdata; |
| 1239 | msm_bus_8930_sys_fpb.dev.platform_data = &msm_bus_8930_sys_fpb_pdata; |
| 1240 | msm_bus_8930_cpss_fpb.dev.platform_data = &msm_bus_8930_cpss_fpb_pdata; |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 1241 | #endif |
| 1242 | } |
| 1243 | |
| 1244 | static struct msm_spi_platform_data msm8960_qup_spi_gsbi1_pdata = { |
| 1245 | .max_clock_speed = 15060000, |
| 1246 | }; |
| 1247 | |
| 1248 | #ifdef CONFIG_USB_MSM_OTG_72K |
| 1249 | static struct msm_otg_platform_data msm_otg_pdata; |
| 1250 | #else |
Manu Gautam | 32ab946 | 2012-02-20 12:33:01 +0530 | [diff] [blame] | 1251 | #ifdef CONFIG_MSM_BUS_SCALING |
| 1252 | /* Bandwidth requests (zero) if no vote placed */ |
| 1253 | static struct msm_bus_vectors usb_init_vectors[] = { |
| 1254 | { |
| 1255 | .src = MSM_BUS_MASTER_SPS, |
| 1256 | .dst = MSM_BUS_SLAVE_EBI_CH0, |
| 1257 | .ab = 0, |
| 1258 | .ib = 0, |
| 1259 | }, |
| 1260 | }; |
| 1261 | |
| 1262 | /* Bus bandwidth requests in Bytes/sec */ |
| 1263 | static struct msm_bus_vectors usb_max_vectors[] = { |
| 1264 | { |
| 1265 | .src = MSM_BUS_MASTER_SPS, |
| 1266 | .dst = MSM_BUS_SLAVE_EBI_CH0, |
| 1267 | .ab = 60000000, /* At least 480Mbps on bus. */ |
| 1268 | .ib = 960000000, /* MAX bursts rate */ |
| 1269 | }, |
| 1270 | }; |
| 1271 | |
| 1272 | static struct msm_bus_paths usb_bus_scale_usecases[] = { |
| 1273 | { |
| 1274 | ARRAY_SIZE(usb_init_vectors), |
| 1275 | usb_init_vectors, |
| 1276 | }, |
| 1277 | { |
| 1278 | ARRAY_SIZE(usb_max_vectors), |
| 1279 | usb_max_vectors, |
| 1280 | }, |
| 1281 | }; |
| 1282 | |
| 1283 | static struct msm_bus_scale_pdata usb_bus_scale_pdata = { |
| 1284 | usb_bus_scale_usecases, |
| 1285 | ARRAY_SIZE(usb_bus_scale_usecases), |
| 1286 | .name = "usb", |
| 1287 | }; |
| 1288 | #endif |
| 1289 | |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 1290 | static struct msm_otg_platform_data msm_otg_pdata = { |
| 1291 | .mode = USB_OTG, |
| 1292 | .otg_control = OTG_PMIC_CONTROL, |
| 1293 | .phy_type = SNPS_28NM_INTEGRATED_PHY, |
Jay Chokshi | 06fa754 | 2011-12-07 13:09:17 -0800 | [diff] [blame] | 1294 | .pmic_id_irq = PM8038_USB_ID_IN_IRQ(PM8038_IRQ_BASE), |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 1295 | .power_budget = 750, |
Manu Gautam | 32ab946 | 2012-02-20 12:33:01 +0530 | [diff] [blame] | 1296 | #ifdef CONFIG_MSM_BUS_SCALING |
| 1297 | .bus_scale_table = &usb_bus_scale_pdata, |
| 1298 | #endif |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 1299 | }; |
| 1300 | #endif |
| 1301 | |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 1302 | #define PID_MAGIC_ID 0x71432909 |
| 1303 | #define SERIAL_NUM_MAGIC_ID 0x61945374 |
| 1304 | #define SERIAL_NUMBER_LENGTH 127 |
| 1305 | #define DLOAD_USB_BASE_ADD 0x2A03F0C8 |
| 1306 | |
| 1307 | struct magic_num_struct { |
| 1308 | uint32_t pid; |
| 1309 | uint32_t serial_num; |
| 1310 | }; |
| 1311 | |
| 1312 | struct dload_struct { |
| 1313 | uint32_t reserved1; |
| 1314 | uint32_t reserved2; |
| 1315 | uint32_t reserved3; |
| 1316 | uint16_t reserved4; |
| 1317 | uint16_t pid; |
| 1318 | char serial_number[SERIAL_NUMBER_LENGTH]; |
| 1319 | uint16_t reserved5; |
| 1320 | struct magic_num_struct magic_struct; |
| 1321 | }; |
| 1322 | |
| 1323 | static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum) |
| 1324 | { |
| 1325 | struct dload_struct __iomem *dload = 0; |
| 1326 | |
| 1327 | dload = ioremap(DLOAD_USB_BASE_ADD, sizeof(*dload)); |
| 1328 | if (!dload) { |
| 1329 | pr_err("%s: cannot remap I/O memory region: %08x\n", |
| 1330 | __func__, DLOAD_USB_BASE_ADD); |
| 1331 | return -ENXIO; |
| 1332 | } |
| 1333 | |
| 1334 | pr_debug("%s: dload:%p pid:%x serial_num:%s\n", |
| 1335 | __func__, dload, pid, snum); |
| 1336 | /* update pid */ |
| 1337 | dload->magic_struct.pid = PID_MAGIC_ID; |
| 1338 | dload->pid = pid; |
| 1339 | |
| 1340 | /* update serial number */ |
| 1341 | dload->magic_struct.serial_num = 0; |
| 1342 | if (!snum) { |
| 1343 | memset(dload->serial_number, 0, SERIAL_NUMBER_LENGTH); |
| 1344 | goto out; |
| 1345 | } |
| 1346 | |
| 1347 | dload->magic_struct.serial_num = SERIAL_NUM_MAGIC_ID; |
| 1348 | strlcpy(dload->serial_number, snum, SERIAL_NUMBER_LENGTH); |
| 1349 | out: |
| 1350 | iounmap(dload); |
| 1351 | return 0; |
| 1352 | } |
| 1353 | |
| 1354 | static struct android_usb_platform_data android_usb_pdata = { |
| 1355 | .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num, |
| 1356 | }; |
| 1357 | |
| 1358 | static struct platform_device android_usb_device = { |
| 1359 | .name = "android_usb", |
| 1360 | .id = -1, |
| 1361 | .dev = { |
| 1362 | .platform_data = &android_usb_pdata, |
| 1363 | }, |
| 1364 | }; |
| 1365 | |
| 1366 | static uint8_t spm_wfi_cmd_sequence[] __initdata = { |
Praveen Chidambaram | 7849901 | 2011-11-01 17:15:17 -0600 | [diff] [blame] | 1367 | 0x03, 0x0f, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 1368 | }; |
| 1369 | |
| 1370 | static uint8_t spm_power_collapse_without_rpm[] __initdata = { |
Praveen Chidambaram | 7849901 | 2011-11-01 17:15:17 -0600 | [diff] [blame] | 1371 | 0x00, 0x24, 0x54, 0x10, |
| 1372 | 0x09, 0x03, 0x01, |
| 1373 | 0x10, 0x54, 0x30, 0x0C, |
| 1374 | 0x24, 0x30, 0x0f, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 1375 | }; |
| 1376 | |
| 1377 | static uint8_t spm_power_collapse_with_rpm[] __initdata = { |
Praveen Chidambaram | 7849901 | 2011-11-01 17:15:17 -0600 | [diff] [blame] | 1378 | 0x00, 0x24, 0x54, 0x10, |
| 1379 | 0x09, 0x07, 0x01, 0x0B, |
| 1380 | 0x10, 0x54, 0x30, 0x0C, |
| 1381 | 0x24, 0x30, 0x0f, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 1382 | }; |
| 1383 | |
| 1384 | static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = { |
| 1385 | [0] = { |
| 1386 | .mode = MSM_SPM_MODE_CLOCK_GATING, |
| 1387 | .notify_rpm = false, |
| 1388 | .cmd = spm_wfi_cmd_sequence, |
| 1389 | }, |
| 1390 | [1] = { |
| 1391 | .mode = MSM_SPM_MODE_POWER_COLLAPSE, |
| 1392 | .notify_rpm = false, |
| 1393 | .cmd = spm_power_collapse_without_rpm, |
| 1394 | }, |
| 1395 | [2] = { |
| 1396 | .mode = MSM_SPM_MODE_POWER_COLLAPSE, |
| 1397 | .notify_rpm = true, |
| 1398 | .cmd = spm_power_collapse_with_rpm, |
| 1399 | }, |
| 1400 | }; |
| 1401 | |
| 1402 | static struct msm_spm_platform_data msm_spm_data[] __initdata = { |
| 1403 | [0] = { |
| 1404 | .reg_base_addr = MSM_SAW0_BASE, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 1405 | .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 1406 | #if defined(CONFIG_MSM_AVS_HW) |
| 1407 | .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00, |
| 1408 | .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00, |
| 1409 | #endif |
| 1410 | .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01, |
Praveen Chidambaram | e4b9eb1 | 2012-02-28 19:39:58 -0700 | [diff] [blame] | 1411 | .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 1412 | .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C, |
| 1413 | .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C, |
| 1414 | .vctl_timeout_us = 50, |
| 1415 | .num_modes = ARRAY_SIZE(msm_spm_seq_list), |
| 1416 | .modes = msm_spm_seq_list, |
| 1417 | }, |
| 1418 | [1] = { |
| 1419 | .reg_base_addr = MSM_SAW1_BASE, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 1420 | .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 1421 | #if defined(CONFIG_MSM_AVS_HW) |
| 1422 | .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00, |
| 1423 | .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00, |
| 1424 | #endif |
| 1425 | .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01, |
Praveen Chidambaram | e4b9eb1 | 2012-02-28 19:39:58 -0700 | [diff] [blame] | 1426 | .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 1427 | .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C, |
| 1428 | .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C, |
| 1429 | .vctl_timeout_us = 50, |
| 1430 | .num_modes = ARRAY_SIZE(msm_spm_seq_list), |
| 1431 | .modes = msm_spm_seq_list, |
| 1432 | }, |
| 1433 | }; |
| 1434 | |
| 1435 | static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = { |
Praveen Chidambaram | 7849901 | 2011-11-01 17:15:17 -0600 | [diff] [blame] | 1436 | 0x00, 0x20, 0x03, 0x20, |
| 1437 | 0x00, 0x0f, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 1438 | }; |
| 1439 | |
| 1440 | static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = { |
Praveen Chidambaram | 7849901 | 2011-11-01 17:15:17 -0600 | [diff] [blame] | 1441 | 0x00, 0x20, 0x34, 0x64, |
| 1442 | 0x48, 0x07, 0x48, 0x20, |
| 1443 | 0x50, 0x64, 0x04, 0x34, |
| 1444 | 0x50, 0x0f, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 1445 | }; |
| 1446 | static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = { |
Praveen Chidambaram | 7849901 | 2011-11-01 17:15:17 -0600 | [diff] [blame] | 1447 | 0x00, 0x10, 0x34, 0x64, |
| 1448 | 0x48, 0x07, 0x48, 0x10, |
| 1449 | 0x50, 0x64, 0x04, 0x34, |
| 1450 | 0x50, 0x0F, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 1451 | }; |
| 1452 | |
| 1453 | static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = { |
| 1454 | [0] = { |
| 1455 | .mode = MSM_SPM_L2_MODE_RETENTION, |
| 1456 | .notify_rpm = false, |
| 1457 | .cmd = l2_spm_wfi_cmd_sequence, |
| 1458 | }, |
| 1459 | [1] = { |
| 1460 | .mode = MSM_SPM_L2_MODE_GDHS, |
| 1461 | .notify_rpm = true, |
| 1462 | .cmd = l2_spm_gdhs_cmd_sequence, |
| 1463 | }, |
| 1464 | [2] = { |
| 1465 | .mode = MSM_SPM_L2_MODE_POWER_COLLAPSE, |
| 1466 | .notify_rpm = true, |
| 1467 | .cmd = l2_spm_power_off_cmd_sequence, |
| 1468 | }, |
| 1469 | }; |
| 1470 | |
| 1471 | static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = { |
| 1472 | [0] = { |
| 1473 | .reg_base_addr = MSM_SAW_L2_BASE, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 1474 | .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00, |
Praveen Chidambaram | e4b9eb1 | 2012-02-28 19:39:58 -0700 | [diff] [blame] | 1475 | .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 1476 | .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE, |
| 1477 | .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020, |
| 1478 | .modes = msm_spm_l2_seq_list, |
| 1479 | .num_modes = ARRAY_SIZE(msm_spm_l2_seq_list), |
| 1480 | }, |
| 1481 | }; |
| 1482 | |
Anirudh Ghayal | 8c15f7f | 2012-01-09 14:04:02 +0530 | [diff] [blame] | 1483 | #define ISA1200_HAP_EN_GPIO 77 |
| 1484 | #define ISA1200_HAP_LEN_GPIO 78 |
| 1485 | #define ISA1200_HAP_CLK PM8038_GPIO_PM_TO_SYS(7) |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 1486 | |
| 1487 | static int isa1200_power(int on) |
| 1488 | { |
Amy Maloche | b20c105 | 2012-04-11 10:36:13 -0700 | [diff] [blame] | 1489 | int rc = 0; |
| 1490 | |
Anirudh Ghayal | 8c15f7f | 2012-01-09 14:04:02 +0530 | [diff] [blame] | 1491 | gpio_set_value_cansleep(ISA1200_HAP_CLK, !!on); |
| 1492 | |
Amy Maloche | b20c105 | 2012-04-11 10:36:13 -0700 | [diff] [blame] | 1493 | if (on) |
| 1494 | rc = pm8xxx_aux_clk_control(CLK_MP3_1, XO_DIV_1, true); |
| 1495 | else |
| 1496 | rc = pm8xxx_aux_clk_control(CLK_MP3_1, XO_DIV_NONE, true); |
| 1497 | |
| 1498 | if (rc) { |
| 1499 | pr_err("%s: unable to write aux clock register(%d)\n", |
| 1500 | __func__, rc); |
| 1501 | } |
| 1502 | |
| 1503 | return rc; |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 1504 | } |
| 1505 | |
| 1506 | static int isa1200_dev_setup(bool enable) |
| 1507 | { |
| 1508 | int rc = 0; |
| 1509 | |
Amy Maloche | b20c105 | 2012-04-11 10:36:13 -0700 | [diff] [blame] | 1510 | if (!enable) |
| 1511 | goto fail_gpio_dir; |
Anirudh Ghayal | 8c15f7f | 2012-01-09 14:04:02 +0530 | [diff] [blame] | 1512 | |
| 1513 | rc = gpio_request(ISA1200_HAP_CLK, "haptics_clk"); |
| 1514 | if (rc) { |
| 1515 | pr_err("%s: gpio_request for %d gpio failed rc(%d)\n", |
| 1516 | __func__, ISA1200_HAP_CLK, rc); |
| 1517 | goto fail_gpio_req; |
| 1518 | } |
| 1519 | |
| 1520 | rc = gpio_direction_output(ISA1200_HAP_CLK, 0); |
| 1521 | if (rc) { |
| 1522 | pr_err("%s: gpio_direction_output failed for %d gpio rc(%d)\n", |
| 1523 | __func__, ISA1200_HAP_CLK, rc); |
| 1524 | goto fail_gpio_dir; |
| 1525 | } |
| 1526 | |
| 1527 | return 0; |
| 1528 | |
| 1529 | fail_gpio_dir: |
| 1530 | gpio_free(ISA1200_HAP_CLK); |
| 1531 | fail_gpio_req: |
| 1532 | return rc; |
| 1533 | |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 1534 | } |
| 1535 | |
| 1536 | static struct isa1200_regulator isa1200_reg_data[] = { |
Anirudh Ghayal | 8c15f7f | 2012-01-09 14:04:02 +0530 | [diff] [blame] | 1537 | { |
| 1538 | .name = "vddp", |
| 1539 | .min_uV = ISA_I2C_VTG_MIN_UV, |
| 1540 | .max_uV = ISA_I2C_VTG_MAX_UV, |
| 1541 | .load_uA = ISA_I2C_CURR_UA, |
| 1542 | }, |
Amy Maloche | e8de95d | 2012-02-23 10:40:25 -0800 | [diff] [blame] | 1543 | { |
| 1544 | .name = "vcc_i2c", |
| 1545 | .min_uV = ISA_I2C_VTG_MIN_UV, |
| 1546 | .max_uV = ISA_I2C_VTG_MAX_UV, |
| 1547 | .load_uA = ISA_I2C_CURR_UA, |
| 1548 | }, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 1549 | }; |
| 1550 | |
| 1551 | static struct isa1200_platform_data isa1200_1_pdata = { |
| 1552 | .name = "vibrator", |
| 1553 | .dev_setup = isa1200_dev_setup, |
| 1554 | .power_on = isa1200_power, |
Anirudh Ghayal | 8c15f7f | 2012-01-09 14:04:02 +0530 | [diff] [blame] | 1555 | .hap_en_gpio = ISA1200_HAP_EN_GPIO, |
| 1556 | .hap_len_gpio = ISA1200_HAP_LEN_GPIO, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 1557 | .max_timeout = 15000, |
| 1558 | .mode_ctrl = PWM_GEN_MODE, |
| 1559 | .pwm_fd = { |
| 1560 | .pwm_div = 256, |
| 1561 | }, |
| 1562 | .is_erm = false, |
| 1563 | .smart_en = true, |
| 1564 | .ext_clk_en = true, |
| 1565 | .chip_en = 1, |
| 1566 | .regulator_info = isa1200_reg_data, |
| 1567 | .num_regulators = ARRAY_SIZE(isa1200_reg_data), |
| 1568 | }; |
| 1569 | |
| 1570 | static struct i2c_board_info msm_isa1200_board_info[] __initdata = { |
| 1571 | { |
| 1572 | I2C_BOARD_INFO("isa1200_1", 0x90>>1), |
| 1573 | .platform_data = &isa1200_1_pdata, |
| 1574 | }, |
| 1575 | }; |
| 1576 | |
Amy Maloche | f3c9db4 | 2011-12-08 15:17:35 -0800 | [diff] [blame] | 1577 | #define MXT_TS_GPIO_IRQ 11 |
| 1578 | #define MXT_TS_RESET_GPIO 52 |
| 1579 | |
| 1580 | static const u8 mxt_config_data_8930[] = { |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 1581 | /* T6 Object */ |
Amy Maloche | f3c9db4 | 2011-12-08 15:17:35 -0800 | [diff] [blame] | 1582 | 0, 0, 0, 0, 0, 0, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 1583 | /* T38 Object */ |
Amy Maloche | c0dbec5 | 2012-04-23 10:55:45 -0700 | [diff] [blame] | 1584 | 15, 2, 0, 15, 12, 11, 0, 0, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 1585 | /* T7 Object */ |
Amy Maloche | f3c9db4 | 2011-12-08 15:17:35 -0800 | [diff] [blame] | 1586 | 48, 255, 25, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 1587 | /* T8 Object */ |
Amy Maloche | f3c9db4 | 2011-12-08 15:17:35 -0800 | [diff] [blame] | 1588 | 27, 0, 5, 1, 0, 0, 8, 8, 0, 0, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 1589 | /* T9 Object */ |
Amy Maloche | f3c9db4 | 2011-12-08 15:17:35 -0800 | [diff] [blame] | 1590 | 131, 0, 0, 19, 11, 0, 16, 35, 1, 3, |
Amy Maloche | f8130f9 | 2012-02-01 10:38:59 +0530 | [diff] [blame] | 1591 | 10, 15, 1, 11, 4, 5, 40, 10, 43, 4, |
| 1592 | 54, 2, 0, 0, 0, 0, 143, 40, 143, 80, |
Amy Maloche | f3c9db4 | 2011-12-08 15:17:35 -0800 | [diff] [blame] | 1593 | 18, 15, 50, 50, 2, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 1594 | /* T15 Object */ |
Amy Maloche | f3c9db4 | 2011-12-08 15:17:35 -0800 | [diff] [blame] | 1595 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 1596 | 0, |
| 1597 | /* T18 Object */ |
| 1598 | 0, 0, |
| 1599 | /* T19 Object */ |
| 1600 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 1601 | 0, 0, 0, 0, 0, 0, |
| 1602 | /* T23 Object */ |
| 1603 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 1604 | 0, 0, 0, 0, 0, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 1605 | /* T25 Object */ |
Amy Maloche | f3c9db4 | 2011-12-08 15:17:35 -0800 | [diff] [blame] | 1606 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 1607 | 0, 0, 0, 0, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 1608 | /* T40 Object */ |
Amy Maloche | f3c9db4 | 2011-12-08 15:17:35 -0800 | [diff] [blame] | 1609 | 0, 0, 0, 0, 0, |
| 1610 | /* T42 Object */ |
| 1611 | 0, 0, 0, 0, 0, 0, 0, 0, |
| 1612 | /* T46 Object */ |
| 1613 | 0, 3, 16, 48, 0, 0, 1, 0, 0, |
| 1614 | /* T47 Object */ |
| 1615 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 1616 | /* T48 Object */ |
| 1617 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 1618 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 1619 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 1620 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 1621 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 1622 | 0, 0, 0, 0, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 1623 | }; |
| 1624 | |
Amy Maloche | f3c9db4 | 2011-12-08 15:17:35 -0800 | [diff] [blame] | 1625 | static ssize_t mxt224e_vkeys_show(struct kobject *kobj, |
| 1626 | struct kobj_attribute *attr, char *buf) |
| 1627 | { |
| 1628 | return snprintf(buf, 200, |
Amy Maloche | f8130f9 | 2012-02-01 10:38:59 +0530 | [diff] [blame] | 1629 | __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":57:1030:90:90" |
| 1630 | ":" __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":206:1030:90:90" |
| 1631 | ":" __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":366:1030:90:90" |
| 1632 | ":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":503:1030:90:90" |
Amy Maloche | f3c9db4 | 2011-12-08 15:17:35 -0800 | [diff] [blame] | 1633 | "\n"); |
| 1634 | } |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 1635 | |
Amy Maloche | f3c9db4 | 2011-12-08 15:17:35 -0800 | [diff] [blame] | 1636 | static struct kobj_attribute mxt224e_vkeys_attr = { |
| 1637 | .attr = { |
| 1638 | .mode = S_IRUGO, |
| 1639 | }, |
| 1640 | .show = &mxt224e_vkeys_show, |
| 1641 | }; |
| 1642 | |
| 1643 | static struct attribute *mxt224e_properties_attrs[] = { |
| 1644 | &mxt224e_vkeys_attr.attr, |
| 1645 | NULL |
| 1646 | }; |
| 1647 | |
| 1648 | static struct attribute_group mxt224e_properties_attr_group = { |
| 1649 | .attrs = mxt224e_properties_attrs, |
| 1650 | }; |
| 1651 | |
| 1652 | static void mxt_init_vkeys_8930(void) |
| 1653 | { |
| 1654 | int rc; |
| 1655 | static struct kobject *mxt224e_properties_kobj; |
| 1656 | |
| 1657 | mxt224e_vkeys_attr.attr.name = "virtualkeys.atmel_mxt_ts"; |
| 1658 | mxt224e_properties_kobj = kobject_create_and_add("board_properties", |
| 1659 | NULL); |
| 1660 | if (mxt224e_properties_kobj) |
| 1661 | rc = sysfs_create_group(mxt224e_properties_kobj, |
| 1662 | &mxt224e_properties_attr_group); |
| 1663 | if (!mxt224e_properties_kobj || rc) |
| 1664 | pr_err("%s: failed to create board_properties\n", |
| 1665 | __func__); |
| 1666 | |
| 1667 | return; |
| 1668 | } |
| 1669 | |
Jing Lin | dc4413c | 2012-01-16 15:22:52 -0800 | [diff] [blame] | 1670 | static struct mxt_config_info mxt_config_array[] = { |
| 1671 | { |
| 1672 | .config = mxt_config_data_8930, |
| 1673 | .config_length = ARRAY_SIZE(mxt_config_data_8930), |
| 1674 | .family_id = 0x81, |
| 1675 | .variant_id = 0x01, |
| 1676 | .version = 0x10, |
| 1677 | .build = 0xAA, |
| 1678 | }, |
| 1679 | }; |
| 1680 | |
Amy Maloche | f3c9db4 | 2011-12-08 15:17:35 -0800 | [diff] [blame] | 1681 | static struct mxt_platform_data mxt_platform_data_8930 = { |
Jing Lin | dc4413c | 2012-01-16 15:22:52 -0800 | [diff] [blame] | 1682 | .config_array = mxt_config_array, |
| 1683 | .config_array_size = ARRAY_SIZE(mxt_config_array), |
Mohan Pallaka | 56a1a5d | 2012-02-23 12:05:13 -0800 | [diff] [blame] | 1684 | .panel_minx = 0, |
| 1685 | .panel_maxx = 566, |
| 1686 | .panel_miny = 0, |
| 1687 | .panel_maxy = 1067, |
| 1688 | .disp_minx = 0, |
| 1689 | .disp_maxx = 540, |
| 1690 | .disp_miny = 0, |
| 1691 | .disp_maxy = 960, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 1692 | .irqflags = IRQF_TRIGGER_FALLING, |
Anirudh Ghayal | d7ad84c | 2012-01-09 09:17:53 +0530 | [diff] [blame] | 1693 | #ifdef MSM8930_PHASE_2 |
| 1694 | .digital_pwr_regulator = true, |
| 1695 | #endif |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 1696 | .i2c_pull_up = true, |
Amy Maloche | f3c9db4 | 2011-12-08 15:17:35 -0800 | [diff] [blame] | 1697 | .reset_gpio = MXT_TS_RESET_GPIO, |
| 1698 | .irq_gpio = MXT_TS_GPIO_IRQ, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 1699 | }; |
| 1700 | |
Amy Maloche | f3c9db4 | 2011-12-08 15:17:35 -0800 | [diff] [blame] | 1701 | static struct i2c_board_info mxt_device_info_8930[] __initdata = { |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 1702 | { |
Amy Maloche | f3c9db4 | 2011-12-08 15:17:35 -0800 | [diff] [blame] | 1703 | I2C_BOARD_INFO("atmel_mxt_ts", 0x4a), |
| 1704 | .platform_data = &mxt_platform_data_8930, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 1705 | .irq = MSM_GPIO_TO_INT(MXT_TS_GPIO_IRQ), |
| 1706 | }, |
| 1707 | }; |
| 1708 | |
Anirudh Ghayal | eb3af97 | 2011-12-13 17:29:06 +0530 | [diff] [blame] | 1709 | #ifdef MSM8930_PHASE_2 |
| 1710 | |
| 1711 | #define GPIO_VOLUME_UP PM8038_GPIO_PM_TO_SYS(3) |
| 1712 | #define GPIO_VOLUME_DOWN PM8038_GPIO_PM_TO_SYS(8) |
| 1713 | #define GPIO_CAMERA_SNAPSHOT PM8038_GPIO_PM_TO_SYS(10) |
| 1714 | #define GPIO_CAMERA_FOCUS PM8038_GPIO_PM_TO_SYS(11) |
| 1715 | |
| 1716 | static struct gpio_keys_button keys_8930[] = { |
| 1717 | { |
| 1718 | .code = KEY_VOLUMEUP, |
| 1719 | .type = EV_KEY, |
| 1720 | .desc = "volume_up", |
| 1721 | .gpio = GPIO_VOLUME_UP, |
| 1722 | .wakeup = 1, |
| 1723 | .active_low = 1, |
| 1724 | }, |
| 1725 | { |
| 1726 | .code = KEY_VOLUMEDOWN, |
| 1727 | .type = EV_KEY, |
| 1728 | .desc = "volume_down", |
| 1729 | .gpio = GPIO_VOLUME_DOWN, |
| 1730 | .wakeup = 1, |
| 1731 | .active_low = 1, |
| 1732 | }, |
| 1733 | { |
| 1734 | .code = KEY_CAMERA_FOCUS, |
| 1735 | .type = EV_KEY, |
| 1736 | .desc = "camera_focus", |
| 1737 | .gpio = GPIO_CAMERA_FOCUS, |
| 1738 | .wakeup = 1, |
| 1739 | .active_low = 1, |
| 1740 | }, |
| 1741 | { |
| 1742 | .code = KEY_CAMERA_SNAPSHOT, |
| 1743 | .type = EV_KEY, |
| 1744 | .desc = "camera_snapshot", |
| 1745 | .gpio = GPIO_CAMERA_SNAPSHOT, |
| 1746 | .wakeup = 1, |
| 1747 | .active_low = 1, |
| 1748 | }, |
| 1749 | }; |
| 1750 | |
| 1751 | /* Add GPIO keys for 8930 */ |
| 1752 | static struct gpio_keys_platform_data gpio_keys_8930_pdata = { |
| 1753 | .buttons = keys_8930, |
| 1754 | .nbuttons = 4, |
| 1755 | }; |
| 1756 | |
| 1757 | static struct platform_device gpio_keys_8930 = { |
| 1758 | .name = "gpio-keys", |
| 1759 | .id = -1, |
| 1760 | .dev = { |
| 1761 | .platform_data = &gpio_keys_8930_pdata, |
| 1762 | }, |
| 1763 | }; |
| 1764 | #endif /* MSM8930_PHASE_2 */ |
| 1765 | |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 1766 | static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi4_pdata = { |
| 1767 | .clk_freq = 100000, |
| 1768 | .src_clk_rate = 24000000, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 1769 | }; |
| 1770 | |
| 1771 | static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi3_pdata = { |
| 1772 | .clk_freq = 100000, |
| 1773 | .src_clk_rate = 24000000, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 1774 | }; |
| 1775 | |
Harini Jayaraman | fe6ff416 | 2012-03-14 11:25:40 -0600 | [diff] [blame] | 1776 | static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi9_pdata = { |
| 1777 | .clk_freq = 100000, |
| 1778 | .src_clk_rate = 24000000, |
| 1779 | }; |
| 1780 | |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 1781 | static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi10_pdata = { |
| 1782 | .clk_freq = 100000, |
| 1783 | .src_clk_rate = 24000000, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 1784 | }; |
| 1785 | |
| 1786 | static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi12_pdata = { |
| 1787 | .clk_freq = 100000, |
| 1788 | .src_clk_rate = 24000000, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 1789 | }; |
| 1790 | |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 1791 | |
| 1792 | static struct ks8851_pdata spi_eth_pdata = { |
| 1793 | .irq_gpio = KS8851_IRQ_GPIO, |
| 1794 | .rst_gpio = KS8851_RST_GPIO, |
| 1795 | }; |
| 1796 | |
| 1797 | static struct spi_board_info spi_board_info[] __initdata = { |
| 1798 | { |
| 1799 | .modalias = "ks8851", |
| 1800 | .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO), |
| 1801 | .max_speed_hz = 19200000, |
| 1802 | .bus_num = 0, |
| 1803 | .chip_select = 0, |
| 1804 | .mode = SPI_MODE_0, |
| 1805 | .platform_data = &spi_eth_pdata |
| 1806 | }, |
| 1807 | { |
| 1808 | .modalias = "dsi_novatek_3d_panel_spi", |
| 1809 | .max_speed_hz = 10800000, |
| 1810 | .bus_num = 0, |
| 1811 | .chip_select = 1, |
| 1812 | .mode = SPI_MODE_0, |
| 1813 | }, |
| 1814 | }; |
| 1815 | |
| 1816 | static struct platform_device msm_device_saw_core0 = { |
Jay Chokshi | 06fa754 | 2011-12-07 13:09:17 -0800 | [diff] [blame] | 1817 | .name = "saw-regulator", |
| 1818 | .id = 0, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 1819 | .dev = { |
David Collins | b455842 | 2012-01-05 10:50:49 -0800 | [diff] [blame] | 1820 | .platform_data = &msm8930_saw_regulator_core0_pdata, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 1821 | }, |
| 1822 | }; |
| 1823 | |
| 1824 | static struct platform_device msm_device_saw_core1 = { |
Jay Chokshi | 06fa754 | 2011-12-07 13:09:17 -0800 | [diff] [blame] | 1825 | .name = "saw-regulator", |
| 1826 | .id = 1, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 1827 | .dev = { |
David Collins | b455842 | 2012-01-05 10:50:49 -0800 | [diff] [blame] | 1828 | .platform_data = &msm8930_saw_regulator_core1_pdata, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 1829 | }, |
| 1830 | }; |
| 1831 | |
| 1832 | static struct tsens_platform_data msm_tsens_pdata = { |
Jay Chokshi | 06fa754 | 2011-12-07 13:09:17 -0800 | [diff] [blame] | 1833 | .tsens_factor = 1000, |
Siddartha Mohanadoss | 9742512 | 2012-03-09 12:06:54 -0800 | [diff] [blame] | 1834 | .hw_type = APQ_8064, |
Siddartha Mohanadoss | 892ee47 | 2012-05-03 10:35:20 -0700 | [diff] [blame] | 1835 | .tsens_num_sensor = 10, |
| 1836 | .slope = {1132, 1135, 1137, 1135, 1157, |
| 1837 | 1142, 1124, 1153, 1175, 1166}, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 1838 | }; |
| 1839 | |
Siddartha Mohanadoss | 48cad91 | 2012-04-05 21:29:54 -0700 | [diff] [blame] | 1840 | static struct platform_device msm_tsens_device = { |
| 1841 | .name = "tsens8960-tm", |
| 1842 | .id = -1, |
| 1843 | }; |
| 1844 | |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 1845 | #ifdef CONFIG_MSM_FAKE_BATTERY |
| 1846 | static struct platform_device fish_battery_device = { |
| 1847 | .name = "fish_battery", |
| 1848 | }; |
| 1849 | #endif |
| 1850 | |
David Collins | 1d4061b | 2011-12-06 15:36:40 -0800 | [diff] [blame] | 1851 | #ifndef MSM8930_PHASE_2 |
| 1852 | |
| 1853 | /* 8930 Phase 1 */ |
Jay Chokshi | 06fa754 | 2011-12-07 13:09:17 -0800 | [diff] [blame] | 1854 | static struct platform_device msm8930_device_ext_5v_vreg __devinitdata = { |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 1855 | .name = GPIO_REGULATOR_DEV_NAME, |
| 1856 | .id = PM8921_MPP_PM_TO_SYS(7), |
| 1857 | .dev = { |
| 1858 | .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V], |
| 1859 | }, |
| 1860 | }; |
| 1861 | |
Jay Chokshi | 06fa754 | 2011-12-07 13:09:17 -0800 | [diff] [blame] | 1862 | static struct platform_device msm8930_device_ext_l2_vreg __devinitdata = { |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 1863 | .name = GPIO_REGULATOR_DEV_NAME, |
| 1864 | .id = 91, |
| 1865 | .dev = { |
| 1866 | .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_L2], |
| 1867 | }, |
| 1868 | }; |
| 1869 | |
David Collins | 1d4061b | 2011-12-06 15:36:40 -0800 | [diff] [blame] | 1870 | #else |
| 1871 | |
| 1872 | /* 8930 Phase 2 */ |
| 1873 | static struct platform_device msm8930_device_ext_5v_vreg __devinitdata = { |
| 1874 | .name = GPIO_REGULATOR_DEV_NAME, |
| 1875 | .id = 63, |
| 1876 | .dev = { |
| 1877 | .platform_data = |
| 1878 | &msm8930_gpio_regulator_pdata[MSM8930_GPIO_VREG_ID_EXT_5V], |
| 1879 | }, |
| 1880 | }; |
| 1881 | |
| 1882 | static struct platform_device msm8930_device_ext_otg_sw_vreg __devinitdata = { |
| 1883 | .name = GPIO_REGULATOR_DEV_NAME, |
| 1884 | .id = 97, |
| 1885 | .dev = { |
| 1886 | .platform_data = |
| 1887 | &msm8930_gpio_regulator_pdata[MSM8930_GPIO_VREG_ID_EXT_OTG_SW], |
| 1888 | }, |
| 1889 | }; |
| 1890 | |
| 1891 | #endif |
| 1892 | |
Jay Chokshi | 06fa754 | 2011-12-07 13:09:17 -0800 | [diff] [blame] | 1893 | static struct platform_device msm8930_device_rpm_regulator __devinitdata = { |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 1894 | .name = "rpm-regulator", |
| 1895 | .id = -1, |
| 1896 | .dev = { |
David Collins | 8af872e | 2012-01-06 11:31:56 -0800 | [diff] [blame] | 1897 | #ifndef MSM8930_PHASE_2 |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 1898 | .platform_data = &msm_rpm_regulator_pdata, |
David Collins | 8af872e | 2012-01-06 11:31:56 -0800 | [diff] [blame] | 1899 | #else |
| 1900 | .platform_data = &msm8930_rpm_regulator_pdata, |
Jay Chokshi | 06fa754 | 2011-12-07 13:09:17 -0800 | [diff] [blame] | 1901 | #endif |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 1902 | }, |
| 1903 | }; |
| 1904 | |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 1905 | static struct platform_device *common_devices[] __initdata = { |
| 1906 | &msm8960_device_dmov, |
| 1907 | &msm_device_smd, |
| 1908 | &msm8960_device_uart_gsbi5, |
| 1909 | &msm_device_uart_dm6, |
| 1910 | &msm_device_saw_core0, |
| 1911 | &msm_device_saw_core1, |
Jay Chokshi | 06fa754 | 2011-12-07 13:09:17 -0800 | [diff] [blame] | 1912 | &msm8930_device_ext_5v_vreg, |
David Collins | 1d4061b | 2011-12-06 15:36:40 -0800 | [diff] [blame] | 1913 | #ifndef MSM8930_PHASE_2 |
Jay Chokshi | 06fa754 | 2011-12-07 13:09:17 -0800 | [diff] [blame] | 1914 | &msm8930_device_ext_l2_vreg, |
David Collins | 1d4061b | 2011-12-06 15:36:40 -0800 | [diff] [blame] | 1915 | #endif |
Jay Chokshi | 33c044a | 2011-12-07 13:05:40 -0800 | [diff] [blame] | 1916 | &msm8960_device_ssbi_pmic, |
David Collins | 1d4061b | 2011-12-06 15:36:40 -0800 | [diff] [blame] | 1917 | #ifdef MSM8930_PHASE_2 |
| 1918 | &msm8930_device_ext_otg_sw_vreg, |
| 1919 | #endif |
Stephen Boyd | 28d5495 | 2011-12-16 13:19:51 -0800 | [diff] [blame] | 1920 | &msm_8960_q6_lpass, |
| 1921 | &msm_8960_q6_mss_fw, |
| 1922 | &msm_8960_q6_mss_sw, |
Stephen Boyd | 322a992 | 2011-09-20 01:05:54 -0700 | [diff] [blame] | 1923 | &msm_8960_riva, |
Stephen Boyd | d89eebe | 2011-09-28 23:28:11 -0700 | [diff] [blame] | 1924 | &msm_pil_tzapps, |
Stephen Boyd | 7b973de | 2012-03-09 12:26:16 -0800 | [diff] [blame] | 1925 | &msm_pil_vidc, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 1926 | &msm8960_device_qup_spi_gsbi1, |
| 1927 | &msm8960_device_qup_i2c_gsbi3, |
| 1928 | &msm8960_device_qup_i2c_gsbi4, |
Harini Jayaraman | fe6ff416 | 2012-03-14 11:25:40 -0600 | [diff] [blame] | 1929 | &msm8960_device_qup_i2c_gsbi9, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 1930 | &msm8960_device_qup_i2c_gsbi10, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 1931 | &msm8960_device_qup_i2c_gsbi12, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 1932 | &msm_slim_ctrl, |
| 1933 | &msm_device_wcnss_wlan, |
Ramesh Masavarapu | a26cce7 | 2012-04-09 12:32:25 -0700 | [diff] [blame] | 1934 | #if defined(CONFIG_QSEECOM) |
| 1935 | &qseecom_device, |
| 1936 | #endif |
| 1937 | |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 1938 | #if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \ |
| 1939 | defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) |
| 1940 | &qcrypto_device, |
| 1941 | #endif |
| 1942 | |
| 1943 | #if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \ |
| 1944 | defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE) |
| 1945 | &qcedev_device, |
| 1946 | #endif |
| 1947 | #ifdef CONFIG_MSM_ROTATOR |
| 1948 | &msm_rotator_device, |
| 1949 | #endif |
| 1950 | &msm_device_sps, |
| 1951 | #ifdef CONFIG_MSM_FAKE_BATTERY |
| 1952 | &fish_battery_device, |
| 1953 | #endif |
| 1954 | #ifdef CONFIG_ANDROID_PMEM |
| 1955 | #ifndef CONFIG_MSM_MULTIMEDIA_USE_ION |
Laura Abbott | b93525f | 2012-04-12 09:57:19 -0700 | [diff] [blame] | 1956 | &msm8930_android_pmem_device, |
| 1957 | &msm8930_android_pmem_adsp_device, |
| 1958 | &msm8930_android_pmem_audio_device, |
Asish Bhattacharya | 5d63c4b | 2012-04-12 08:41:12 +0530 | [diff] [blame] | 1959 | #endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/ |
| 1960 | #endif /*CONFIG_ANDROID_PMEM*/ |
Hanumant Singh | eea6256 | 2012-05-14 11:32:45 -0700 | [diff] [blame] | 1961 | &msm8930_fmem_device, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 1962 | &msm_device_bam_dmux, |
| 1963 | &msm_fm_platform_init, |
| 1964 | |
| 1965 | #ifdef CONFIG_HW_RANDOM_MSM |
| 1966 | &msm_device_rng, |
| 1967 | #endif |
Praveen Chidambaram | 7849901 | 2011-11-01 17:15:17 -0600 | [diff] [blame] | 1968 | &msm8930_rpm_device, |
| 1969 | &msm8930_rpm_log_device, |
| 1970 | &msm8930_rpm_stat_device, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 1971 | #ifdef CONFIG_ION_MSM |
Laura Abbott | b93525f | 2012-04-12 09:57:19 -0700 | [diff] [blame] | 1972 | &msm8930_ion_dev, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 1973 | #endif |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 1974 | &msm_device_tz_log, |
| 1975 | |
| 1976 | #ifdef CONFIG_MSM_QDSS |
Pratik Patel | 1403f2a | 2012-03-21 10:10:00 -0700 | [diff] [blame] | 1977 | &msm_qdss_device, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 1978 | &msm_etb_device, |
| 1979 | &msm_tpiu_device, |
| 1980 | &msm_funnel_device, |
Pratik Patel | 492b301 | 2012-03-06 14:22:30 -0800 | [diff] [blame] | 1981 | &msm_etm_device, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 1982 | #endif |
| 1983 | &msm_device_dspcrashd_8960, |
| 1984 | &msm8960_device_watchdog, |
Anirudh Ghayal | eb3af97 | 2011-12-13 17:29:06 +0530 | [diff] [blame] | 1985 | #ifdef MSM8930_PHASE_2 |
| 1986 | &gpio_keys_8930, |
| 1987 | #endif |
Laura Abbott | b93525f | 2012-04-12 09:57:19 -0700 | [diff] [blame] | 1988 | &msm8930_rtb_device, |
Praveen Chidambaram | 8ea3dcd | 2011-12-07 14:46:31 -0700 | [diff] [blame] | 1989 | &msm8930_cpu_idle_device, |
Praveen Chidambaram | 5c8adf2 | 2012-02-23 18:44:37 -0700 | [diff] [blame] | 1990 | &msm8930_msm_gov_device, |
Gagan Mac | cd5b327 | 2012-02-09 18:13:10 -0700 | [diff] [blame] | 1991 | &msm_bus_8930_apps_fabric, |
| 1992 | &msm_bus_8930_sys_fabric, |
| 1993 | &msm_bus_8930_mm_fabric, |
| 1994 | &msm_bus_8930_sys_fpb, |
| 1995 | &msm_bus_8930_cpss_fpb, |
Stepan Moskovchenko | 28662c5 | 2012-03-01 12:48:45 -0800 | [diff] [blame] | 1996 | &msm8960_device_cache_erp, |
Laura Abbott | 0577d7b | 2012-04-17 11:14:30 -0700 | [diff] [blame] | 1997 | &msm8930_iommu_domain_device, |
Siddartha Mohanadoss | 48cad91 | 2012-04-05 21:29:54 -0700 | [diff] [blame] | 1998 | &msm_tsens_device, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 1999 | }; |
| 2000 | |
| 2001 | static struct platform_device *cdp_devices[] __initdata = { |
| 2002 | &msm8960_device_otg, |
| 2003 | &msm8960_device_gadget_peripheral, |
| 2004 | &msm_device_hsusb_host, |
| 2005 | &android_usb_device, |
| 2006 | &msm_pcm, |
| 2007 | &msm_pcm_routing, |
| 2008 | &msm_cpudai0, |
| 2009 | &msm_cpudai1, |
| 2010 | &msm_cpudai_hdmi_rx, |
| 2011 | &msm_cpudai_bt_rx, |
| 2012 | &msm_cpudai_bt_tx, |
| 2013 | &msm_cpudai_fm_rx, |
| 2014 | &msm_cpudai_fm_tx, |
| 2015 | &msm_cpudai_auxpcm_rx, |
| 2016 | &msm_cpudai_auxpcm_tx, |
| 2017 | &msm_cpu_fe, |
| 2018 | &msm_stub_codec, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 2019 | #ifdef CONFIG_MSM_GEMINI |
| 2020 | &msm8960_gemini_device, |
| 2021 | #endif |
| 2022 | &msm_voice, |
| 2023 | &msm_voip, |
| 2024 | &msm_lpa_pcm, |
| 2025 | &msm_cpudai_afe_01_rx, |
| 2026 | &msm_cpudai_afe_01_tx, |
| 2027 | &msm_cpudai_afe_02_rx, |
| 2028 | &msm_cpudai_afe_02_tx, |
| 2029 | &msm_pcm_afe, |
Ajay Dudani | 79e268c | 2011-12-28 13:14:44 -0800 | [diff] [blame] | 2030 | &msm_compr_dsp, |
| 2031 | &msm_cpudai_incall_music_rx, |
| 2032 | &msm_cpudai_incall_record_rx, |
| 2033 | &msm_cpudai_incall_record_tx, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 2034 | &msm_pcm_hostless, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 2035 | }; |
| 2036 | |
| 2037 | static void __init msm8930_i2c_init(void) |
| 2038 | { |
| 2039 | msm8960_device_qup_i2c_gsbi4.dev.platform_data = |
| 2040 | &msm8960_i2c_qup_gsbi4_pdata; |
| 2041 | |
| 2042 | msm8960_device_qup_i2c_gsbi3.dev.platform_data = |
| 2043 | &msm8960_i2c_qup_gsbi3_pdata; |
| 2044 | |
Harini Jayaraman | fe6ff416 | 2012-03-14 11:25:40 -0600 | [diff] [blame] | 2045 | msm8960_device_qup_i2c_gsbi9.dev.platform_data = |
| 2046 | &msm8960_i2c_qup_gsbi9_pdata; |
| 2047 | |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 2048 | msm8960_device_qup_i2c_gsbi10.dev.platform_data = |
| 2049 | &msm8960_i2c_qup_gsbi10_pdata; |
| 2050 | |
| 2051 | msm8960_device_qup_i2c_gsbi12.dev.platform_data = |
| 2052 | &msm8960_i2c_qup_gsbi12_pdata; |
| 2053 | } |
| 2054 | |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 2055 | static struct msm_rpmrs_level msm_rpmrs_levels[] __initdata = { |
| 2056 | { |
| 2057 | MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT, |
| 2058 | MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE), |
| 2059 | true, |
Praveen Chidambaram | e338067 | 2012-02-08 10:32:27 -0700 | [diff] [blame] | 2060 | 100, 650, 801, 200, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 2061 | }, |
| 2062 | |
| 2063 | { |
| 2064 | MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE, |
| 2065 | MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE), |
| 2066 | true, |
Praveen Chidambaram | e338067 | 2012-02-08 10:32:27 -0700 | [diff] [blame] | 2067 | 2000, 200, 576000, 2000, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 2068 | }, |
| 2069 | |
| 2070 | { |
| 2071 | MSM_PM_SLEEP_MODE_POWER_COLLAPSE, |
| 2072 | MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE), |
| 2073 | false, |
Praveen Chidambaram | e338067 | 2012-02-08 10:32:27 -0700 | [diff] [blame] | 2074 | 8500, 51, 1122000, 8500, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 2075 | }, |
| 2076 | |
| 2077 | { |
| 2078 | MSM_PM_SLEEP_MODE_POWER_COLLAPSE, |
| 2079 | MSM_RPMRS_LIMITS(ON, HSFS_OPEN, MAX, ACTIVE), |
| 2080 | false, |
Praveen Chidambaram | e338067 | 2012-02-08 10:32:27 -0700 | [diff] [blame] | 2081 | 9000, 51, 1130300, 9000, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 2082 | }, |
| 2083 | { |
| 2084 | MSM_PM_SLEEP_MODE_POWER_COLLAPSE, |
| 2085 | MSM_RPMRS_LIMITS(ON, HSFS_OPEN, ACTIVE, RET_HIGH), |
| 2086 | false, |
Praveen Chidambaram | e338067 | 2012-02-08 10:32:27 -0700 | [diff] [blame] | 2087 | 10000, 51, 1130300, 10000, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 2088 | }, |
| 2089 | |
| 2090 | { |
| 2091 | MSM_PM_SLEEP_MODE_POWER_COLLAPSE, |
| 2092 | MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE), |
| 2093 | false, |
Praveen Chidambaram | e338067 | 2012-02-08 10:32:27 -0700 | [diff] [blame] | 2094 | 12000, 14, 2205900, 12000, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 2095 | }, |
| 2096 | |
| 2097 | { |
| 2098 | MSM_PM_SLEEP_MODE_POWER_COLLAPSE, |
| 2099 | MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE), |
| 2100 | false, |
Praveen Chidambaram | e338067 | 2012-02-08 10:32:27 -0700 | [diff] [blame] | 2101 | 18000, 12, 2364250, 18000, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 2102 | }, |
| 2103 | |
| 2104 | { |
| 2105 | MSM_PM_SLEEP_MODE_POWER_COLLAPSE, |
| 2106 | MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH), |
| 2107 | false, |
Praveen Chidambaram | e338067 | 2012-02-08 10:32:27 -0700 | [diff] [blame] | 2108 | 23500, 10, 2667000, 23500, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 2109 | }, |
| 2110 | |
| 2111 | { |
| 2112 | MSM_PM_SLEEP_MODE_POWER_COLLAPSE, |
| 2113 | MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW), |
| 2114 | false, |
Praveen Chidambaram | e338067 | 2012-02-08 10:32:27 -0700 | [diff] [blame] | 2115 | 29700, 5, 2867000, 30000, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 2116 | }, |
| 2117 | }; |
| 2118 | |
Praveen Chidambaram | 7849901 | 2011-11-01 17:15:17 -0600 | [diff] [blame] | 2119 | static struct msm_rpmrs_platform_data msm_rpmrs_data __initdata = { |
| 2120 | .levels = &msm_rpmrs_levels[0], |
| 2121 | .num_levels = ARRAY_SIZE(msm_rpmrs_levels), |
| 2122 | .vdd_mem_levels = { |
| 2123 | [MSM_RPMRS_VDD_MEM_RET_LOW] = 750000, |
| 2124 | [MSM_RPMRS_VDD_MEM_RET_HIGH] = 750000, |
| 2125 | [MSM_RPMRS_VDD_MEM_ACTIVE] = 1050000, |
| 2126 | [MSM_RPMRS_VDD_MEM_MAX] = 1150000, |
| 2127 | }, |
| 2128 | .vdd_dig_levels = { |
| 2129 | [MSM_RPMRS_VDD_DIG_RET_LOW] = 500000, |
| 2130 | [MSM_RPMRS_VDD_DIG_RET_HIGH] = 750000, |
| 2131 | [MSM_RPMRS_VDD_DIG_ACTIVE] = 950000, |
| 2132 | [MSM_RPMRS_VDD_DIG_MAX] = 1150000, |
| 2133 | }, |
| 2134 | .vdd_mask = 0x7FFFFF, |
| 2135 | .rpmrs_target_id = { |
| 2136 | [MSM_RPMRS_ID_PXO_CLK] = MSM_RPM_ID_PXO_CLK, |
| 2137 | [MSM_RPMRS_ID_L2_CACHE_CTL] = MSM_RPM_ID_LAST, |
| 2138 | [MSM_RPMRS_ID_VDD_DIG_0] = MSM_RPM_ID_PM8038_S1_0, |
| 2139 | [MSM_RPMRS_ID_VDD_DIG_1] = MSM_RPM_ID_PM8038_S1_1, |
| 2140 | [MSM_RPMRS_ID_VDD_MEM_0] = MSM_RPM_ID_PM8038_L24_0, |
| 2141 | [MSM_RPMRS_ID_VDD_MEM_1] = MSM_RPM_ID_PM8038_L24_1, |
| 2142 | [MSM_RPMRS_ID_RPM_CTL] = MSM_RPM_ID_RPM_CTL, |
| 2143 | }, |
| 2144 | }; |
| 2145 | |
Maheshkumar Sivasubramanian | c6c5503 | 2011-10-25 16:01:32 -0600 | [diff] [blame] | 2146 | static struct msm_pm_boot_platform_data msm_pm_boot_pdata __initdata = { |
| 2147 | .mode = MSM_PM_BOOT_CONFIG_TZ, |
| 2148 | }; |
| 2149 | |
Praveen Chidambaram | 4d19be4 | 2012-04-03 18:05:52 -0600 | [diff] [blame] | 2150 | static struct msm_pm_sleep_status_data msm_pm_slp_sts_data = { |
| 2151 | .base_addr = MSM_ACC0_BASE + 0x08, |
| 2152 | .cpu_offset = MSM_ACC1_BASE - MSM_ACC0_BASE, |
| 2153 | .mask = 1UL << 13, |
| 2154 | }; |
| 2155 | |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 2156 | #ifdef CONFIG_I2C |
| 2157 | #define I2C_SURF 1 |
| 2158 | #define I2C_FFA (1 << 1) |
| 2159 | #define I2C_RUMI (1 << 2) |
| 2160 | #define I2C_SIM (1 << 3) |
| 2161 | #define I2C_FLUID (1 << 4) |
| 2162 | #define I2C_LIQUID (1 << 5) |
| 2163 | |
| 2164 | struct i2c_registry { |
| 2165 | u8 machs; |
| 2166 | int bus; |
| 2167 | struct i2c_board_info *info; |
| 2168 | int len; |
| 2169 | }; |
| 2170 | |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 2171 | #ifdef CONFIG_ISL9519_CHARGER |
| 2172 | static struct isl_platform_data isl_data __initdata = { |
| 2173 | .valid_n_gpio = 0, /* Not required when notify-by-pmic */ |
| 2174 | .chg_detection_config = NULL, /* Not required when notify-by-pmic */ |
| 2175 | .max_system_voltage = 4200, |
| 2176 | .min_system_voltage = 3200, |
| 2177 | .chgcurrent = 1000, /* 1900, */ |
| 2178 | .term_current = 400, /* Need fine tuning */ |
| 2179 | .input_current = 2048, |
| 2180 | }; |
| 2181 | |
| 2182 | static struct i2c_board_info isl_charger_i2c_info[] __initdata = { |
| 2183 | { |
| 2184 | I2C_BOARD_INFO("isl9519q", 0x9), |
| 2185 | .irq = 0, /* Not required when notify-by-pmic */ |
| 2186 | .platform_data = &isl_data, |
| 2187 | }, |
| 2188 | }; |
| 2189 | #endif /* CONFIG_ISL9519_CHARGER */ |
| 2190 | |
| 2191 | static struct i2c_registry msm8960_i2c_devices[] __initdata = { |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 2192 | #ifdef CONFIG_ISL9519_CHARGER |
| 2193 | { |
| 2194 | I2C_LIQUID, |
| 2195 | MSM_8930_GSBI10_QUP_I2C_BUS_ID, |
| 2196 | isl_charger_i2c_info, |
| 2197 | ARRAY_SIZE(isl_charger_i2c_info), |
| 2198 | }, |
| 2199 | #endif /* CONFIG_ISL9519_CHARGER */ |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 2200 | { |
Amy Maloche | e8de95d | 2012-02-23 10:40:25 -0800 | [diff] [blame] | 2201 | I2C_SURF | I2C_FFA | I2C_FLUID, |
| 2202 | MSM_8930_GSBI9_QUP_I2C_BUS_ID, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 2203 | msm_isa1200_board_info, |
| 2204 | ARRAY_SIZE(msm_isa1200_board_info), |
| 2205 | }, |
Amy Maloche | f3c9db4 | 2011-12-08 15:17:35 -0800 | [diff] [blame] | 2206 | { |
Amy Maloche | 8eb9111 | 2012-03-30 10:22:37 -0700 | [diff] [blame] | 2207 | I2C_SURF | I2C_FFA | I2C_FLUID, |
Amy Maloche | f3c9db4 | 2011-12-08 15:17:35 -0800 | [diff] [blame] | 2208 | MSM_8930_GSBI3_QUP_I2C_BUS_ID, |
| 2209 | mxt_device_info_8930, |
| 2210 | ARRAY_SIZE(mxt_device_info_8930), |
| 2211 | }, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 2212 | }; |
| 2213 | #endif /* CONFIG_I2C */ |
| 2214 | |
| 2215 | static void __init register_i2c_devices(void) |
| 2216 | { |
| 2217 | #ifdef CONFIG_I2C |
| 2218 | u8 mach_mask = 0; |
| 2219 | int i; |
Kevin Chan | 09f4e66 | 2011-12-16 08:17:02 -0800 | [diff] [blame] | 2220 | #ifdef CONFIG_MSM_CAMERA |
| 2221 | struct i2c_registry msm8930_camera_i2c_devices = { |
| 2222 | I2C_SURF | I2C_FFA | I2C_FLUID | I2C_LIQUID | I2C_RUMI, |
| 2223 | MSM_8930_GSBI4_QUP_I2C_BUS_ID, |
| 2224 | msm8930_camera_board_info.board_info, |
| 2225 | msm8930_camera_board_info.num_i2c_board_info, |
| 2226 | }; |
| 2227 | #endif |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 2228 | |
| 2229 | /* Build the matching 'supported_machs' bitmask */ |
Stepan Moskovchenko | 8768eff | 2011-12-01 18:55:07 -0800 | [diff] [blame] | 2230 | if (machine_is_msm8930_cdp() || machine_is_msm8627_cdp()) |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 2231 | mach_mask = I2C_SURF; |
| 2232 | else if (machine_is_msm8930_fluid()) |
| 2233 | mach_mask = I2C_FLUID; |
Stepan Moskovchenko | 8768eff | 2011-12-01 18:55:07 -0800 | [diff] [blame] | 2234 | else if (machine_is_msm8930_mtp() || machine_is_msm8627_mtp()) |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 2235 | mach_mask = I2C_FFA; |
| 2236 | else |
| 2237 | pr_err("unmatched machine ID in register_i2c_devices\n"); |
| 2238 | |
| 2239 | /* Run the array and install devices as appropriate */ |
| 2240 | for (i = 0; i < ARRAY_SIZE(msm8960_i2c_devices); ++i) { |
| 2241 | if (msm8960_i2c_devices[i].machs & mach_mask) |
| 2242 | i2c_register_board_info(msm8960_i2c_devices[i].bus, |
| 2243 | msm8960_i2c_devices[i].info, |
| 2244 | msm8960_i2c_devices[i].len); |
| 2245 | } |
Kevin Chan | 09f4e66 | 2011-12-16 08:17:02 -0800 | [diff] [blame] | 2246 | #ifdef CONFIG_MSM_CAMERA |
| 2247 | if (msm8930_camera_i2c_devices.machs & mach_mask) |
| 2248 | i2c_register_board_info(msm8930_camera_i2c_devices.bus, |
| 2249 | msm8930_camera_i2c_devices.info, |
| 2250 | msm8930_camera_i2c_devices.len); |
| 2251 | #endif |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 2252 | #endif |
| 2253 | } |
| 2254 | |
| 2255 | static void __init msm8930_cdp_init(void) |
| 2256 | { |
| 2257 | if (meminfo_init(SYS_MEMORY, SZ_256M) < 0) |
| 2258 | pr_err("meminfo_init() failed!\n"); |
| 2259 | |
Siddartha Mohanadoss | fad0af1 | 2012-01-20 15:08:38 -0800 | [diff] [blame] | 2260 | msm_tsens_early_init(&msm_tsens_pdata); |
Praveen Chidambaram | 7849901 | 2011-11-01 17:15:17 -0600 | [diff] [blame] | 2261 | BUG_ON(msm_rpm_init(&msm8930_rpm_data)); |
| 2262 | BUG_ON(msm_rpmrs_levels_init(&msm_rpmrs_data)); |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 2263 | |
| 2264 | regulator_suppress_info_printing(); |
| 2265 | if (msm_xo_init()) |
| 2266 | pr_err("Failed to initialize XO votes\n"); |
Jay Chokshi | 06fa754 | 2011-12-07 13:09:17 -0800 | [diff] [blame] | 2267 | platform_device_register(&msm8930_device_rpm_regulator); |
Tianyi Gou | e3d4f54 | 2012-03-15 17:06:45 -0700 | [diff] [blame] | 2268 | msm_clock_init(&msm8930_clock_init_data); |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 2269 | msm8960_device_otg.dev.platform_data = &msm_otg_pdata; |
Stepan Moskovchenko | 3b09bf5 | 2011-12-06 20:40:53 -0800 | [diff] [blame] | 2270 | msm8930_init_gpiomux(); |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 2271 | msm8960_device_qup_spi_gsbi1.dev.platform_data = |
| 2272 | &msm8960_qup_spi_gsbi1_pdata; |
| 2273 | spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info)); |
| 2274 | |
Jay Chokshi | 06fa754 | 2011-12-07 13:09:17 -0800 | [diff] [blame] | 2275 | /* |
| 2276 | * TODO: When physical 8930/PM8038 hardware becomes |
| 2277 | * available, remove this block or add the config |
| 2278 | * option. |
| 2279 | */ |
| 2280 | #ifndef MSM8930_PHASE_2 |
| 2281 | msm8960_init_pmic(); |
| 2282 | #else |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 2283 | msm8930_init_pmic(); |
Jay Chokshi | 06fa754 | 2011-12-07 13:09:17 -0800 | [diff] [blame] | 2284 | #endif |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 2285 | msm8930_i2c_init(); |
Sudhakara Rao Tentu | 8b5c8ed | 2012-03-05 14:48:41 +0530 | [diff] [blame] | 2286 | msm8930_init_gpu(); |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 2287 | msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data)); |
| 2288 | msm_spm_l2_init(msm_spm_l2_data); |
| 2289 | msm8930_init_buses(); |
Matt Wagantall | 1f65d9d | 2012-04-25 14:24:20 -0700 | [diff] [blame] | 2290 | platform_add_devices(msm8930_footswitch, msm8930_num_footswitch); |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 2291 | platform_add_devices(common_devices, ARRAY_SIZE(common_devices)); |
Arun Menon | aabf263 | 2012-02-24 15:30:47 -0800 | [diff] [blame] | 2292 | msm8930_add_vidc_device(); |
Jay Chokshi | 06fa754 | 2011-12-07 13:09:17 -0800 | [diff] [blame] | 2293 | /* |
| 2294 | * TODO: When physical 8930/PM8038 hardware becomes |
| 2295 | * available, remove this block or add the config |
| 2296 | * option. |
| 2297 | */ |
| 2298 | #ifndef MSM8930_PHASE_2 |
| 2299 | msm8960_pm8921_gpio_mpp_init(); |
| 2300 | #else |
| 2301 | msm8930_pm8038_gpio_mpp_init(); |
| 2302 | #endif |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 2303 | platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices)); |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 2304 | msm8930_init_cam(); |
| 2305 | msm8930_init_mmc(); |
Tianyi Gou | 7c6b81f | 2011-12-07 23:09:08 -0800 | [diff] [blame] | 2306 | acpuclk_init(&acpuclk_8930_soc_data); |
Amy Maloche | 8eb9111 | 2012-03-30 10:22:37 -0700 | [diff] [blame] | 2307 | mxt_init_vkeys_8930(); |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 2308 | register_i2c_devices(); |
| 2309 | msm8930_init_fb(); |
| 2310 | slim_register_board_info(msm_slim_devices, |
| 2311 | ARRAY_SIZE(msm_slim_devices)); |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 2312 | change_memory_power = &msm8930_change_memory_power; |
Maheshkumar Sivasubramanian | c6c5503 | 2011-10-25 16:01:32 -0600 | [diff] [blame] | 2313 | BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata)); |
Praveen Chidambaram | 4d19be4 | 2012-04-03 18:05:52 -0600 | [diff] [blame] | 2314 | msm_pm_init_sleep_status_data(&msm_pm_slp_sts_data); |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 2315 | |
| 2316 | if (PLATFORM_IS_CHARM25()) |
| 2317 | platform_add_devices(mdm_devices, ARRAY_SIZE(mdm_devices)); |
| 2318 | } |
| 2319 | |
| 2320 | MACHINE_START(MSM8930_CDP, "QCT MSM8930 CDP") |
| 2321 | .map_io = msm8930_map_io, |
| 2322 | .reserve = msm8930_reserve, |
| 2323 | .init_irq = msm8930_init_irq, |
Marc Zyngier | 89bdafd1 | 2011-12-22 11:39:20 +0530 | [diff] [blame] | 2324 | .handle_irq = gic_handle_irq, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 2325 | .timer = &msm_timer, |
| 2326 | .init_machine = msm8930_cdp_init, |
| 2327 | .init_early = msm8930_allocate_memory_regions, |
| 2328 | .init_very_early = msm8930_early_memory, |
| 2329 | MACHINE_END |
| 2330 | |
| 2331 | MACHINE_START(MSM8930_MTP, "QCT MSM8930 MTP") |
| 2332 | .map_io = msm8930_map_io, |
| 2333 | .reserve = msm8930_reserve, |
| 2334 | .init_irq = msm8930_init_irq, |
Marc Zyngier | 89bdafd1 | 2011-12-22 11:39:20 +0530 | [diff] [blame] | 2335 | .handle_irq = gic_handle_irq, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 2336 | .timer = &msm_timer, |
| 2337 | .init_machine = msm8930_cdp_init, |
| 2338 | .init_early = msm8930_allocate_memory_regions, |
| 2339 | .init_very_early = msm8930_early_memory, |
| 2340 | MACHINE_END |
| 2341 | |
| 2342 | MACHINE_START(MSM8930_FLUID, "QCT MSM8930 FLUID") |
| 2343 | .map_io = msm8930_map_io, |
| 2344 | .reserve = msm8930_reserve, |
| 2345 | .init_irq = msm8930_init_irq, |
Marc Zyngier | 89bdafd1 | 2011-12-22 11:39:20 +0530 | [diff] [blame] | 2346 | .handle_irq = gic_handle_irq, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 2347 | .timer = &msm_timer, |
| 2348 | .init_machine = msm8930_cdp_init, |
| 2349 | .init_early = msm8930_allocate_memory_regions, |
| 2350 | .init_very_early = msm8930_early_memory, |
| 2351 | MACHINE_END |
Stepan Moskovchenko | 8768eff | 2011-12-01 18:55:07 -0800 | [diff] [blame] | 2352 | |
| 2353 | MACHINE_START(MSM8627_CDP, "QCT MSM8627 CDP") |
| 2354 | .map_io = msm8930_map_io, |
| 2355 | .reserve = msm8930_reserve, |
| 2356 | .init_irq = msm8930_init_irq, |
Marc Zyngier | 89bdafd1 | 2011-12-22 11:39:20 +0530 | [diff] [blame] | 2357 | .handle_irq = gic_handle_irq, |
Stepan Moskovchenko | 8768eff | 2011-12-01 18:55:07 -0800 | [diff] [blame] | 2358 | .timer = &msm_timer, |
| 2359 | .init_machine = msm8930_cdp_init, |
| 2360 | .init_early = msm8930_allocate_memory_regions, |
| 2361 | .init_very_early = msm8930_early_memory, |
| 2362 | MACHINE_END |
| 2363 | |
| 2364 | MACHINE_START(MSM8627_MTP, "QCT MSM8627 MTP") |
| 2365 | .map_io = msm8930_map_io, |
| 2366 | .reserve = msm8930_reserve, |
| 2367 | .init_irq = msm8930_init_irq, |
Marc Zyngier | 89bdafd1 | 2011-12-22 11:39:20 +0530 | [diff] [blame] | 2368 | .handle_irq = gic_handle_irq, |
Stepan Moskovchenko | 8768eff | 2011-12-01 18:55:07 -0800 | [diff] [blame] | 2369 | .timer = &msm_timer, |
| 2370 | .init_machine = msm8930_cdp_init, |
| 2371 | .init_early = msm8930_allocate_memory_regions, |
| 2372 | .init_very_early = msm8930_early_memory, |
| 2373 | MACHINE_END |