Anji Jonnala | 1a1711a | 2013-01-29 13:34:10 +0530 | [diff] [blame] | 1 | /* Copyright (c) 2011-2013, The Linux Foundation. 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 | */ |
Abhimanyu Kapur | 440cdde | 2012-12-04 00:05:40 -0800 | [diff] [blame] | 13 | #include <linux/err.h> |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 14 | #include <linux/kernel.h> |
| 15 | #include <linux/platform_device.h> |
| 16 | #include <linux/io.h> |
| 17 | #include <linux/irq.h> |
| 18 | #include <linux/i2c.h> |
| 19 | #include <linux/i2c/sx150x.h> |
| 20 | #include <linux/i2c/isl9519.h> |
| 21 | #include <linux/gpio.h> |
| 22 | #include <linux/msm_ssbi.h> |
Steve Muckle | f132c6c | 2012-06-06 18:30:57 -0700 | [diff] [blame] | 23 | #include <linux/regulator/msm-gpio-regulator.h> |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 24 | #include <linux/mfd/pm8xxx/pm8921.h> |
| 25 | #include <linux/mfd/pm8xxx/pm8xxx-adc.h> |
| 26 | #include <linux/regulator/consumer.h> |
| 27 | #include <linux/spi/spi.h> |
| 28 | #include <linux/slimbus/slimbus.h> |
| 29 | #include <linux/bootmem.h> |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 30 | #ifdef CONFIG_ANDROID_PMEM |
| 31 | #include <linux/android_pmem.h> |
| 32 | #endif |
Laura Abbott | fd1ad20 | 2012-09-18 11:45:43 -0700 | [diff] [blame] | 33 | #include <linux/dma-contiguous.h> |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 34 | #include <linux/dma-mapping.h> |
| 35 | #include <linux/platform_data/qcom_crypto_device.h> |
| 36 | #include <linux/platform_data/qcom_wcnss_device.h> |
| 37 | #include <linux/leds.h> |
| 38 | #include <linux/leds-pm8xxx.h> |
| 39 | #include <linux/i2c/atmel_mxt_ts.h> |
| 40 | #include <linux/msm_tsens.h> |
| 41 | #include <linux/ks8851.h> |
| 42 | #include <linux/i2c/isa1200.h> |
Anirudh Ghayal | eb3af97 | 2011-12-13 17:29:06 +0530 | [diff] [blame] | 43 | #include <linux/gpio_keys.h> |
Jack Cheung | 6ce8f68 | 2012-01-17 10:35:42 -0800 | [diff] [blame] | 44 | #include <linux/memory.h> |
Hanumant Singh | eea6256 | 2012-05-14 11:32:45 -0700 | [diff] [blame] | 45 | #include <linux/memblock.h> |
Praveen Chidambaram | 877d7a4 | 2012-06-05 14:33:20 -0600 | [diff] [blame] | 46 | #include <linux/msm_thermal.h> |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 47 | |
Asish Bhattacharya | b86c347 | 2012-02-15 08:31:52 +0530 | [diff] [blame] | 48 | #include <linux/slimbus/slimbus.h> |
| 49 | #include <linux/mfd/wcd9xxx/core.h> |
| 50 | #include <linux/mfd/wcd9xxx/pdata.h> |
| 51 | |
Wentao Xu | 114c015 | 2012-06-12 11:40:38 -0400 | [diff] [blame] | 52 | #ifdef CONFIG_STM_LIS3DH |
| 53 | #include <linux/input/lis3dh.h> |
| 54 | #endif |
| 55 | |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 56 | #include <asm/mach-types.h> |
| 57 | #include <asm/mach/arch.h> |
| 58 | #include <asm/setup.h> |
| 59 | #include <asm/hardware/gic.h> |
| 60 | #include <asm/mach/mmc.h> |
| 61 | |
| 62 | #include <mach/board.h> |
| 63 | #include <mach/msm_iomap.h> |
| 64 | #include <mach/msm_spi.h> |
| 65 | #ifdef CONFIG_USB_MSM_OTG_72K |
| 66 | #include <mach/msm_hsusb.h> |
| 67 | #else |
| 68 | #include <linux/usb/msm_hsusb.h> |
| 69 | #endif |
| 70 | #include <linux/usb/android.h> |
| 71 | #include <mach/usbdiag.h> |
| 72 | #include <mach/socinfo.h> |
| 73 | #include <mach/rpm.h> |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 74 | #include <mach/gpiomux.h> |
| 75 | #include <mach/msm_bus_board.h> |
| 76 | #include <mach/msm_memtypes.h> |
| 77 | #include <mach/dma.h> |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 78 | #include <mach/msm_xo.h> |
| 79 | #include <mach/restart.h> |
| 80 | |
Mitchel Humpherys | b805552 | 2012-09-06 11:33:28 -0700 | [diff] [blame] | 81 | #include <linux/msm_ion.h> |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 82 | #include <mach/ion.h> |
| 83 | #include <mach/mdm2.h> |
Laura Abbott | f8c03b9 | 2012-02-16 14:57:58 -0800 | [diff] [blame] | 84 | #include <mach/msm_rtb.h> |
Hanumant Singh | eea6256 | 2012-05-14 11:32:45 -0700 | [diff] [blame] | 85 | #include <linux/fmem.h> |
Laura Abbott | f317304 | 2012-05-29 15:23:18 -0700 | [diff] [blame] | 86 | #include <mach/msm_cache_dump.h> |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 87 | |
Jordan Crouse | 914de9b | 2012-07-09 13:49:46 -0600 | [diff] [blame] | 88 | #include <mach/kgsl.h> |
Wentao Xu | f59ce4e | 2012-05-22 17:30:13 -0400 | [diff] [blame] | 89 | #ifdef CONFIG_INPUT_MPU3050 |
| 90 | #include <linux/input/mpu3050.h> |
| 91 | #endif |
| 92 | |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 93 | #include "timer.h" |
| 94 | #include "devices.h" |
| 95 | #include "devices-msm8x60.h" |
| 96 | #include "spm.h" |
Matt Wagantall | 7cca464 | 2012-02-01 16:43:24 -0800 | [diff] [blame] | 97 | #include "pm.h" |
Abhijeet Dharmapurikar | efaca4f | 2011-12-27 16:24:07 -0800 | [diff] [blame] | 98 | #include <mach/cpuidle.h> |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 99 | #include "rpm_resources.h" |
Subhash Jadavani | 909e04f | 2012-04-12 10:52:50 +0530 | [diff] [blame] | 100 | #include <mach/mpm.h> |
Matt Wagantall | 33d01f5 | 2012-02-23 23:27:44 -0800 | [diff] [blame] | 101 | #include "clock.h" |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 102 | #include "smd_private.h" |
| 103 | #include "pm-boot.h" |
| 104 | #include "msm_watchdog.h" |
Jay Chokshi | 06fa754 | 2011-12-07 13:09:17 -0800 | [diff] [blame] | 105 | #include "board-8930.h" |
Patrick Daly | c1227cb | 2012-08-28 13:39:17 -0700 | [diff] [blame] | 106 | #include "acpuclock-krait.h" |
Syed Rameez Mustafa | 9de4634 | 2012-11-30 11:00:08 -0800 | [diff] [blame] | 107 | #include "platsmp.h" |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 108 | |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 109 | static struct platform_device msm_fm_platform_init = { |
| 110 | .name = "iris_fm", |
| 111 | .id = -1, |
| 112 | }; |
| 113 | |
| 114 | #define KS8851_RST_GPIO 89 |
| 115 | #define KS8851_IRQ_GPIO 90 |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 116 | #define HAP_SHIFT_LVL_OE_GPIO 47 |
| 117 | |
Manoj Rao | c6d904c | 2012-06-22 00:32:14 -0700 | [diff] [blame] | 118 | #define MHL_GPIO_INT 72 |
| 119 | #define MHL_GPIO_RESET 71 |
| 120 | #define MHL_GPIO_PWR_EN 5 |
| 121 | |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 122 | #if defined(CONFIG_GPIO_SX150X) || defined(CONFIG_GPIO_SX150X_MODULE) |
| 123 | |
| 124 | struct sx150x_platform_data msm8930_sx150x_data[] = { |
| 125 | [SX150X_CAM] = { |
| 126 | .gpio_base = GPIO_CAM_EXPANDER_BASE, |
| 127 | .oscio_is_gpo = false, |
| 128 | .io_pullup_ena = 0x0, |
| 129 | .io_pulldn_ena = 0xc0, |
| 130 | .io_open_drain_ena = 0x0, |
| 131 | .irq_summary = -1, |
| 132 | }, |
| 133 | }; |
| 134 | |
| 135 | #endif |
| 136 | |
Olav Haugan | a21169d | 2012-01-04 09:17:06 -0800 | [diff] [blame] | 137 | #define MSM_PMEM_ADSP_SIZE 0x7800000 |
Vicky Sehrawat | 074f543 | 2012-11-07 14:32:17 -0800 | [diff] [blame] | 138 | #define MSM_PMEM_AUDIO_SIZE 0x408000 |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 139 | #ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY |
| 140 | #define MSM_PMEM_SIZE 0x4000000 /* 64 Mbytes */ |
| 141 | #else |
Olav Haugan | b88eef1 | 2012-01-15 10:59:26 -0800 | [diff] [blame] | 142 | #define MSM_PMEM_SIZE 0x2800000 /* 40 Mbytes */ |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 143 | #endif |
Hanumant Singh | eea6256 | 2012-05-14 11:32:45 -0700 | [diff] [blame] | 144 | #define MSM_LIQUID_PMEM_SIZE 0x4000000 /* 64 Mbytes */ |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 145 | |
| 146 | #ifdef CONFIG_MSM_MULTIMEDIA_USE_ION |
Deepak Kotur | 9830bf0 | 2012-06-01 15:04:29 -0700 | [diff] [blame] | 147 | #define HOLE_SIZE 0x20000 |
Mitchel Humpherys | 05e5881 | 2012-08-13 14:24:13 -0700 | [diff] [blame] | 148 | #define MSM_CONTIG_MEM_SIZE 0x65000 |
Hanumant Singh | edfb046 | 2012-05-15 14:49:32 -0700 | [diff] [blame] | 149 | #ifdef CONFIG_MSM_IOMMU |
| 150 | #define MSM_ION_MM_SIZE 0x3800000 /* Need to be multiple of 64K */ |
| 151 | #define MSM_ION_SF_SIZE 0x0 |
Olav Haugan | 494e4dc | 2012-05-15 15:14:31 -0700 | [diff] [blame] | 152 | #define MSM_ION_QSECOM_SIZE 0x780000 /* (7.5MB) */ |
Hanumant Singh | edfb046 | 2012-05-15 14:49:32 -0700 | [diff] [blame] | 153 | #define MSM_ION_HEAP_NUM 7 |
| 154 | #else |
Olav Haugan | b88eef1 | 2012-01-15 10:59:26 -0800 | [diff] [blame] | 155 | #define MSM_ION_SF_SIZE MSM_PMEM_SIZE |
Olav Haugan | b88eef1 | 2012-01-15 10:59:26 -0800 | [diff] [blame] | 156 | #define MSM_ION_MM_SIZE MSM_PMEM_ADSP_SIZE |
Olav Haugan | 494e4dc | 2012-05-15 15:14:31 -0700 | [diff] [blame] | 157 | #define MSM_ION_QSECOM_SIZE 0x600000 /* (6MB) */ |
Hanumant Singh | eea6256 | 2012-05-14 11:32:45 -0700 | [diff] [blame] | 158 | #define MSM_ION_HEAP_NUM 8 |
Hanumant Singh | edfb046 | 2012-05-15 14:49:32 -0700 | [diff] [blame] | 159 | #endif |
Deepak Kotur | 9830bf0 | 2012-06-01 15:04:29 -0700 | [diff] [blame] | 160 | #define MSM_ION_MM_FW_SIZE (0x200000 - HOLE_SIZE) /* 2MB - 128Kb */ |
Olav Haugan | b5be799 | 2011-11-18 14:29:02 -0800 | [diff] [blame] | 161 | #define MSM_ION_MFC_SIZE SZ_8K |
Olav Haugan | 7355db0 | 2012-01-13 16:59:13 -0800 | [diff] [blame] | 162 | #define MSM_ION_AUDIO_SIZE MSM_PMEM_AUDIO_SIZE |
Hanumant Singh | eea6256 | 2012-05-14 11:32:45 -0700 | [diff] [blame] | 163 | |
| 164 | #define MSM_LIQUID_ION_MM_SIZE (MSM_ION_MM_SIZE + 0x600000) |
| 165 | #define MSM_LIQUID_ION_SF_SIZE MSM_LIQUID_PMEM_SIZE |
| 166 | #define MSM_HDMI_PRIM_ION_SF_SIZE MSM_HDMI_PRIM_PMEM_SIZE |
| 167 | |
Deepak Kotur | 9830bf0 | 2012-06-01 15:04:29 -0700 | [diff] [blame] | 168 | #define MSM_MM_FW_SIZE (0x200000 - HOLE_SIZE) /*2MB -128Kb */ |
| 169 | #define MSM8930_FIXED_AREA_START (0xa0000000 - (MSM_ION_MM_FW_SIZE + \ |
| 170 | HOLE_SIZE)) |
Hanumant Singh | eea6256 | 2012-05-14 11:32:45 -0700 | [diff] [blame] | 171 | #define MAX_FIXED_AREA_SIZE 0x10000000 |
Deepak Kotur | 9830bf0 | 2012-06-01 15:04:29 -0700 | [diff] [blame] | 172 | #define MSM8930_FW_START MSM8930_FIXED_AREA_START |
Hanumant Singh | eea6256 | 2012-05-14 11:32:45 -0700 | [diff] [blame] | 173 | |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 174 | #else |
Mitchel Humpherys | 05e5881 | 2012-08-13 14:24:13 -0700 | [diff] [blame] | 175 | #define MSM_CONTIG_MEM_SIZE 0x110C000 |
Olav Haugan | b5be799 | 2011-11-18 14:29:02 -0800 | [diff] [blame] | 176 | #define MSM_ION_HEAP_NUM 1 |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 177 | #endif |
| 178 | |
Mitchel Humpherys | 05e5881 | 2012-08-13 14:24:13 -0700 | [diff] [blame] | 179 | #ifdef CONFIG_KERNEL_MSM_CONTIG_MEM_REGION |
| 180 | static unsigned msm_contig_mem_size = MSM_CONTIG_MEM_SIZE; |
| 181 | static int __init msm_contig_mem_size_setup(char *p) |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 182 | { |
Mitchel Humpherys | 05e5881 | 2012-08-13 14:24:13 -0700 | [diff] [blame] | 183 | msm_contig_mem_size = memparse(p, NULL); |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 184 | return 0; |
| 185 | } |
Mitchel Humpherys | 05e5881 | 2012-08-13 14:24:13 -0700 | [diff] [blame] | 186 | early_param("msm_contig_mem_size", msm_contig_mem_size_setup); |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 187 | #endif |
| 188 | |
| 189 | #ifdef CONFIG_ANDROID_PMEM |
| 190 | static unsigned pmem_size = MSM_PMEM_SIZE; |
| 191 | static int __init pmem_size_setup(char *p) |
| 192 | { |
| 193 | pmem_size = memparse(p, NULL); |
| 194 | return 0; |
| 195 | } |
| 196 | early_param("pmem_size", pmem_size_setup); |
| 197 | |
| 198 | static unsigned pmem_adsp_size = MSM_PMEM_ADSP_SIZE; |
| 199 | |
| 200 | static int __init pmem_adsp_size_setup(char *p) |
| 201 | { |
| 202 | pmem_adsp_size = memparse(p, NULL); |
| 203 | return 0; |
| 204 | } |
| 205 | early_param("pmem_adsp_size", pmem_adsp_size_setup); |
| 206 | |
| 207 | static unsigned pmem_audio_size = MSM_PMEM_AUDIO_SIZE; |
| 208 | |
| 209 | static int __init pmem_audio_size_setup(char *p) |
| 210 | { |
| 211 | pmem_audio_size = memparse(p, NULL); |
| 212 | return 0; |
| 213 | } |
| 214 | early_param("pmem_audio_size", pmem_audio_size_setup); |
| 215 | #endif |
| 216 | |
| 217 | #ifdef CONFIG_ANDROID_PMEM |
| 218 | #ifndef CONFIG_MSM_MULTIMEDIA_USE_ION |
| 219 | static struct android_pmem_platform_data android_pmem_pdata = { |
| 220 | .name = "pmem", |
| 221 | .allocator_type = PMEM_ALLOCATORTYPE_ALLORNOTHING, |
| 222 | .cached = 1, |
| 223 | .memory_type = MEMTYPE_EBI1, |
| 224 | }; |
| 225 | |
Laura Abbott | b93525f | 2012-04-12 09:57:19 -0700 | [diff] [blame] | 226 | static struct platform_device msm8930_android_pmem_device = { |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 227 | .name = "android_pmem", |
| 228 | .id = 0, |
| 229 | .dev = {.platform_data = &android_pmem_pdata}, |
| 230 | }; |
| 231 | |
| 232 | static struct android_pmem_platform_data android_pmem_adsp_pdata = { |
| 233 | .name = "pmem_adsp", |
| 234 | .allocator_type = PMEM_ALLOCATORTYPE_BITMAP, |
| 235 | .cached = 0, |
| 236 | .memory_type = MEMTYPE_EBI1, |
| 237 | }; |
Laura Abbott | b93525f | 2012-04-12 09:57:19 -0700 | [diff] [blame] | 238 | static struct platform_device msm8930_android_pmem_adsp_device = { |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 239 | .name = "android_pmem", |
| 240 | .id = 2, |
| 241 | .dev = { .platform_data = &android_pmem_adsp_pdata }, |
| 242 | }; |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 243 | |
| 244 | static struct android_pmem_platform_data android_pmem_audio_pdata = { |
| 245 | .name = "pmem_audio", |
| 246 | .allocator_type = PMEM_ALLOCATORTYPE_BITMAP, |
| 247 | .cached = 0, |
| 248 | .memory_type = MEMTYPE_EBI1, |
| 249 | }; |
| 250 | |
Laura Abbott | b93525f | 2012-04-12 09:57:19 -0700 | [diff] [blame] | 251 | static struct platform_device msm8930_android_pmem_audio_device = { |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 252 | .name = "android_pmem", |
| 253 | .id = 4, |
| 254 | .dev = { .platform_data = &android_pmem_audio_pdata }, |
| 255 | }; |
Asish Bhattacharya | 5d63c4b | 2012-04-12 08:41:12 +0530 | [diff] [blame] | 256 | #endif /* CONFIG_MSM_MULTIMEDIA_USE_ION */ |
| 257 | #endif /* CONFIG_ANDROID_PMEM */ |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 258 | |
Hanumant Singh | eea6256 | 2012-05-14 11:32:45 -0700 | [diff] [blame] | 259 | struct fmem_platform_data msm8930_fmem_pdata = { |
| 260 | }; |
| 261 | |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 262 | #define DSP_RAM_BASE_8960 0x8da00000 |
| 263 | #define DSP_RAM_SIZE_8960 0x1800000 |
| 264 | static int dspcrashd_pdata_8960 = 0xDEADDEAD; |
| 265 | |
| 266 | static struct resource resources_dspcrashd_8960[] = { |
| 267 | { |
| 268 | .name = "msm_dspcrashd", |
| 269 | .start = DSP_RAM_BASE_8960, |
| 270 | .end = DSP_RAM_BASE_8960 + DSP_RAM_SIZE_8960, |
| 271 | .flags = IORESOURCE_DMA, |
| 272 | }, |
| 273 | }; |
| 274 | |
| 275 | static struct platform_device msm_device_dspcrashd_8960 = { |
| 276 | .name = "msm_dspcrashd", |
| 277 | .num_resources = ARRAY_SIZE(resources_dspcrashd_8960), |
| 278 | .resource = resources_dspcrashd_8960, |
| 279 | .dev = { .platform_data = &dspcrashd_pdata_8960 }, |
| 280 | }; |
| 281 | |
| 282 | static struct memtype_reserve msm8930_reserve_table[] __initdata = { |
| 283 | [MEMTYPE_SMI] = { |
| 284 | }, |
| 285 | [MEMTYPE_EBI0] = { |
| 286 | .flags = MEMTYPE_FLAGS_1M_ALIGN, |
| 287 | }, |
| 288 | [MEMTYPE_EBI1] = { |
| 289 | .flags = MEMTYPE_FLAGS_1M_ALIGN, |
| 290 | }, |
| 291 | }; |
| 292 | |
Laura Abbott | f8c03b9 | 2012-02-16 14:57:58 -0800 | [diff] [blame] | 293 | |
| 294 | static void __init reserve_rtb_memory(void) |
| 295 | { |
| 296 | #if defined(CONFIG_MSM_RTB) |
Laura Abbott | b93525f | 2012-04-12 09:57:19 -0700 | [diff] [blame] | 297 | msm8930_reserve_table[MEMTYPE_EBI1].size += msm8930_rtb_pdata.size; |
Laura Abbott | f8c03b9 | 2012-02-16 14:57:58 -0800 | [diff] [blame] | 298 | #endif |
| 299 | } |
| 300 | |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 301 | static void __init size_pmem_devices(void) |
| 302 | { |
| 303 | #ifdef CONFIG_ANDROID_PMEM |
| 304 | #ifndef CONFIG_MSM_MULTIMEDIA_USE_ION |
| 305 | android_pmem_adsp_pdata.size = pmem_adsp_size; |
| 306 | android_pmem_pdata.size = pmem_size; |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 307 | android_pmem_audio_pdata.size = MSM_PMEM_AUDIO_SIZE; |
Asish Bhattacharya | 5d63c4b | 2012-04-12 08:41:12 +0530 | [diff] [blame] | 308 | #endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/ |
| 309 | #endif /*CONFIG_ANDROID_PMEM*/ |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 310 | } |
| 311 | |
Asish Bhattacharya | 5d63c4b | 2012-04-12 08:41:12 +0530 | [diff] [blame] | 312 | #ifdef CONFIG_ANDROID_PMEM |
| 313 | #ifndef CONFIG_MSM_MULTIMEDIA_USE_ION |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 314 | static void __init reserve_memory_for(struct android_pmem_platform_data *p) |
| 315 | { |
| 316 | msm8930_reserve_table[p->memory_type].size += p->size; |
| 317 | } |
Asish Bhattacharya | 5d63c4b | 2012-04-12 08:41:12 +0530 | [diff] [blame] | 318 | #endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/ |
| 319 | #endif /*CONFIG_ANDROID_PMEM*/ |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 320 | |
| 321 | static void __init reserve_pmem_memory(void) |
| 322 | { |
| 323 | #ifdef CONFIG_ANDROID_PMEM |
| 324 | #ifndef CONFIG_MSM_MULTIMEDIA_USE_ION |
| 325 | reserve_memory_for(&android_pmem_adsp_pdata); |
| 326 | reserve_memory_for(&android_pmem_pdata); |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 327 | reserve_memory_for(&android_pmem_audio_pdata); |
Asish Bhattacharya | 5d63c4b | 2012-04-12 08:41:12 +0530 | [diff] [blame] | 328 | #endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/ |
Mitchel Humpherys | 05e5881 | 2012-08-13 14:24:13 -0700 | [diff] [blame] | 329 | msm8930_reserve_table[MEMTYPE_EBI1].size += msm_contig_mem_size; |
Asish Bhattacharya | 5d63c4b | 2012-04-12 08:41:12 +0530 | [diff] [blame] | 330 | #endif /*CONFIG_ANDROID_PMEM*/ |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 331 | } |
| 332 | |
| 333 | static int msm8930_paddr_to_memtype(unsigned int paddr) |
| 334 | { |
| 335 | return MEMTYPE_EBI1; |
| 336 | } |
| 337 | |
Steve Muckle | f132c6c | 2012-06-06 18:30:57 -0700 | [diff] [blame] | 338 | #define FMEM_ENABLED 0 |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 339 | #ifdef CONFIG_ION_MSM |
Olav Haugan | 0703dbf | 2011-12-19 17:53:38 -0800 | [diff] [blame] | 340 | #ifdef CONFIG_MSM_MULTIMEDIA_USE_ION |
Laura Abbott | b93525f | 2012-04-12 09:57:19 -0700 | [diff] [blame] | 341 | static struct ion_cp_heap_pdata cp_mm_msm8930_ion_pdata = { |
Olav Haugan | 0703dbf | 2011-12-19 17:53:38 -0800 | [diff] [blame] | 342 | .permission_type = IPT_TYPE_MM_CARVEOUT, |
Olav Haugan | 42ebe71 | 2012-01-10 16:30:58 -0800 | [diff] [blame] | 343 | .align = PAGE_SIZE, |
Hanumant Singh | eea6256 | 2012-05-14 11:32:45 -0700 | [diff] [blame] | 344 | .reusable = FMEM_ENABLED, |
| 345 | .mem_is_fmem = FMEM_ENABLED, |
| 346 | .fixed_position = FIXED_MIDDLE, |
Olav Haugan | 0703dbf | 2011-12-19 17:53:38 -0800 | [diff] [blame] | 347 | }; |
| 348 | |
Laura Abbott | b93525f | 2012-04-12 09:57:19 -0700 | [diff] [blame] | 349 | static struct ion_cp_heap_pdata cp_mfc_msm8930_ion_pdata = { |
Olav Haugan | 0703dbf | 2011-12-19 17:53:38 -0800 | [diff] [blame] | 350 | .permission_type = IPT_TYPE_MFC_SHAREDMEM, |
Olav Haugan | 42ebe71 | 2012-01-10 16:30:58 -0800 | [diff] [blame] | 351 | .align = PAGE_SIZE, |
Hanumant Singh | eea6256 | 2012-05-14 11:32:45 -0700 | [diff] [blame] | 352 | .reusable = 0, |
| 353 | .mem_is_fmem = FMEM_ENABLED, |
| 354 | .fixed_position = FIXED_HIGH, |
Olav Haugan | 0703dbf | 2011-12-19 17:53:38 -0800 | [diff] [blame] | 355 | }; |
Hanumant Singh | eea6256 | 2012-05-14 11:32:45 -0700 | [diff] [blame] | 356 | |
Laura Abbott | b93525f | 2012-04-12 09:57:19 -0700 | [diff] [blame] | 357 | static struct ion_co_heap_pdata co_msm8930_ion_pdata = { |
Olav Haugan | 42ebe71 | 2012-01-10 16:30:58 -0800 | [diff] [blame] | 358 | .adjacent_mem_id = INVALID_HEAP_ID, |
| 359 | .align = PAGE_SIZE, |
Hanumant Singh | eea6256 | 2012-05-14 11:32:45 -0700 | [diff] [blame] | 360 | .mem_is_fmem = 0, |
Olav Haugan | 42ebe71 | 2012-01-10 16:30:58 -0800 | [diff] [blame] | 361 | }; |
Hanumant Singh | eea6256 | 2012-05-14 11:32:45 -0700 | [diff] [blame] | 362 | |
Laura Abbott | b93525f | 2012-04-12 09:57:19 -0700 | [diff] [blame] | 363 | static struct ion_co_heap_pdata fw_co_msm8930_ion_pdata = { |
Olav Haugan | 42ebe71 | 2012-01-10 16:30:58 -0800 | [diff] [blame] | 364 | .adjacent_mem_id = ION_CP_MM_HEAP_ID, |
| 365 | .align = SZ_128K, |
Hanumant Singh | eea6256 | 2012-05-14 11:32:45 -0700 | [diff] [blame] | 366 | .mem_is_fmem = FMEM_ENABLED, |
| 367 | .fixed_position = FIXED_LOW, |
Olav Haugan | 0703dbf | 2011-12-19 17:53:38 -0800 | [diff] [blame] | 368 | }; |
| 369 | #endif |
Olav Haugan | 9cdfc2f | 2012-02-15 09:52:57 -0800 | [diff] [blame] | 370 | |
Laura Abbott | fd1ad20 | 2012-09-18 11:45:43 -0700 | [diff] [blame] | 371 | |
| 372 | static u64 msm_dmamask = DMA_BIT_MASK(32); |
| 373 | |
| 374 | static struct platform_device ion_mm_heap_device = { |
| 375 | .name = "ion-mm-heap-device", |
| 376 | .id = -1, |
| 377 | .dev = { |
| 378 | .dma_mask = &msm_dmamask, |
| 379 | .coherent_dma_mask = DMA_BIT_MASK(32), |
| 380 | } |
| 381 | }; |
| 382 | |
Olav Haugan | 9cdfc2f | 2012-02-15 09:52:57 -0800 | [diff] [blame] | 383 | /** |
| 384 | * These heaps are listed in the order they will be allocated. Due to |
| 385 | * video hardware restrictions and content protection the FW heap has to |
| 386 | * be allocated adjacent (below) the MM heap and the MFC heap has to be |
| 387 | * allocated after the MM heap to ensure MFC heap is not more than 256MB |
| 388 | * away from the base address of the FW heap. |
| 389 | * However, the order of FW heap and MM heap doesn't matter since these |
| 390 | * two heaps are taken care of by separate code to ensure they are adjacent |
| 391 | * to each other. |
| 392 | * Don't swap the order unless you know what you are doing! |
| 393 | */ |
Benjamin Gaignard | 63d8103 | 2012-06-25 15:27:30 -0700 | [diff] [blame] | 394 | struct ion_platform_heap msm8930_heaps[] = { |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 395 | { |
Olav Haugan | b5be799 | 2011-11-18 14:29:02 -0800 | [diff] [blame] | 396 | .id = ION_SYSTEM_HEAP_ID, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 397 | .type = ION_HEAP_TYPE_SYSTEM, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 398 | .name = ION_VMALLOC_HEAP_NAME, |
| 399 | }, |
| 400 | #ifdef CONFIG_MSM_MULTIMEDIA_USE_ION |
| 401 | { |
Olav Haugan | b5be799 | 2011-11-18 14:29:02 -0800 | [diff] [blame] | 402 | .id = ION_CP_MM_HEAP_ID, |
Olav Haugan | 0a85251 | 2012-01-09 10:20:55 -0800 | [diff] [blame] | 403 | .type = ION_HEAP_TYPE_CP, |
Olav Haugan | b5be799 | 2011-11-18 14:29:02 -0800 | [diff] [blame] | 404 | .name = ION_MM_HEAP_NAME, |
| 405 | .size = MSM_ION_MM_SIZE, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 406 | .memory_type = ION_EBI_TYPE, |
Laura Abbott | b93525f | 2012-04-12 09:57:19 -0700 | [diff] [blame] | 407 | .extra_data = (void *) &cp_mm_msm8930_ion_pdata, |
Laura Abbott | fd1ad20 | 2012-09-18 11:45:43 -0700 | [diff] [blame] | 408 | .priv = &ion_mm_heap_device.dev |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 409 | }, |
Olav Haugan | b5be799 | 2011-11-18 14:29:02 -0800 | [diff] [blame] | 410 | { |
Olav Haugan | 42ebe71 | 2012-01-10 16:30:58 -0800 | [diff] [blame] | 411 | .id = ION_MM_FIRMWARE_HEAP_ID, |
| 412 | .type = ION_HEAP_TYPE_CARVEOUT, |
| 413 | .name = ION_MM_FIRMWARE_HEAP_NAME, |
| 414 | .size = MSM_ION_MM_FW_SIZE, |
| 415 | .memory_type = ION_EBI_TYPE, |
Laura Abbott | b93525f | 2012-04-12 09:57:19 -0700 | [diff] [blame] | 416 | .extra_data = (void *) &fw_co_msm8930_ion_pdata, |
Olav Haugan | 42ebe71 | 2012-01-10 16:30:58 -0800 | [diff] [blame] | 417 | }, |
| 418 | { |
Olav Haugan | b5be799 | 2011-11-18 14:29:02 -0800 | [diff] [blame] | 419 | .id = ION_CP_MFC_HEAP_ID, |
Olav Haugan | 0a85251 | 2012-01-09 10:20:55 -0800 | [diff] [blame] | 420 | .type = ION_HEAP_TYPE_CP, |
Olav Haugan | b5be799 | 2011-11-18 14:29:02 -0800 | [diff] [blame] | 421 | .name = ION_MFC_HEAP_NAME, |
| 422 | .size = MSM_ION_MFC_SIZE, |
| 423 | .memory_type = ION_EBI_TYPE, |
Laura Abbott | b93525f | 2012-04-12 09:57:19 -0700 | [diff] [blame] | 424 | .extra_data = (void *) &cp_mfc_msm8930_ion_pdata, |
Olav Haugan | b5be799 | 2011-11-18 14:29:02 -0800 | [diff] [blame] | 425 | }, |
Hanumant Singh | edfb046 | 2012-05-15 14:49:32 -0700 | [diff] [blame] | 426 | #ifndef CONFIG_MSM_IOMMU |
Olav Haugan | b5be799 | 2011-11-18 14:29:02 -0800 | [diff] [blame] | 427 | { |
Olav Haugan | 9cdfc2f | 2012-02-15 09:52:57 -0800 | [diff] [blame] | 428 | .id = ION_SF_HEAP_ID, |
| 429 | .type = ION_HEAP_TYPE_CARVEOUT, |
| 430 | .name = ION_SF_HEAP_NAME, |
| 431 | .size = MSM_ION_SF_SIZE, |
| 432 | .memory_type = ION_EBI_TYPE, |
Laura Abbott | b93525f | 2012-04-12 09:57:19 -0700 | [diff] [blame] | 433 | .extra_data = (void *) &co_msm8930_ion_pdata, |
Olav Haugan | 9cdfc2f | 2012-02-15 09:52:57 -0800 | [diff] [blame] | 434 | }, |
Hanumant Singh | edfb046 | 2012-05-15 14:49:32 -0700 | [diff] [blame] | 435 | #endif |
Olav Haugan | 9cdfc2f | 2012-02-15 09:52:57 -0800 | [diff] [blame] | 436 | { |
Olav Haugan | b5be799 | 2011-11-18 14:29:02 -0800 | [diff] [blame] | 437 | .id = ION_IOMMU_HEAP_ID, |
| 438 | .type = ION_HEAP_TYPE_IOMMU, |
| 439 | .name = ION_IOMMU_HEAP_NAME, |
| 440 | }, |
Olav Haugan | 80854eb | 2012-01-12 12:00:23 -0800 | [diff] [blame] | 441 | { |
| 442 | .id = ION_QSECOM_HEAP_ID, |
| 443 | .type = ION_HEAP_TYPE_CARVEOUT, |
| 444 | .name = ION_QSECOM_HEAP_NAME, |
| 445 | .size = MSM_ION_QSECOM_SIZE, |
| 446 | .memory_type = ION_EBI_TYPE, |
Laura Abbott | b93525f | 2012-04-12 09:57:19 -0700 | [diff] [blame] | 447 | .extra_data = (void *) &co_msm8930_ion_pdata, |
Olav Haugan | 80854eb | 2012-01-12 12:00:23 -0800 | [diff] [blame] | 448 | }, |
Olav Haugan | 7355db0 | 2012-01-13 16:59:13 -0800 | [diff] [blame] | 449 | { |
| 450 | .id = ION_AUDIO_HEAP_ID, |
| 451 | .type = ION_HEAP_TYPE_CARVEOUT, |
| 452 | .name = ION_AUDIO_HEAP_NAME, |
| 453 | .size = MSM_ION_AUDIO_SIZE, |
| 454 | .memory_type = ION_EBI_TYPE, |
Laura Abbott | b93525f | 2012-04-12 09:57:19 -0700 | [diff] [blame] | 455 | .extra_data = (void *) &co_msm8930_ion_pdata, |
Olav Haugan | 7355db0 | 2012-01-13 16:59:13 -0800 | [diff] [blame] | 456 | }, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 457 | #endif |
Benjamin Gaignard | 63d8103 | 2012-06-25 15:27:30 -0700 | [diff] [blame] | 458 | }; |
| 459 | |
| 460 | static struct ion_platform_data msm8930_ion_pdata = { |
| 461 | .nr = MSM_ION_HEAP_NUM, |
| 462 | .heaps = msm8930_heaps, |
| 463 | |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 464 | }; |
| 465 | |
Laura Abbott | b93525f | 2012-04-12 09:57:19 -0700 | [diff] [blame] | 466 | static struct platform_device msm8930_ion_dev = { |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 467 | .name = "ion-msm", |
| 468 | .id = 1, |
Laura Abbott | b93525f | 2012-04-12 09:57:19 -0700 | [diff] [blame] | 469 | .dev = { .platform_data = &msm8930_ion_pdata }, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 470 | }; |
| 471 | #endif |
| 472 | |
Hanumant Singh | eea6256 | 2012-05-14 11:32:45 -0700 | [diff] [blame] | 473 | struct platform_device msm8930_fmem_device = { |
| 474 | .name = "fmem", |
| 475 | .id = 1, |
| 476 | .dev = { .platform_data = &msm8930_fmem_pdata }, |
| 477 | }; |
| 478 | |
| 479 | static void __init reserve_mem_for_ion(enum ion_memory_types mem_type, |
| 480 | unsigned long size) |
| 481 | { |
| 482 | msm8930_reserve_table[mem_type].size += size; |
| 483 | } |
| 484 | |
| 485 | static void __init msm8930_reserve_fixed_area(unsigned long fixed_area_size) |
| 486 | { |
| 487 | #if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION) |
| 488 | int ret; |
| 489 | |
| 490 | if (fixed_area_size > MAX_FIXED_AREA_SIZE) |
| 491 | panic("fixed area size is larger than %dM\n", |
| 492 | MAX_FIXED_AREA_SIZE >> 20); |
| 493 | |
| 494 | reserve_info->fixed_area_size = fixed_area_size; |
| 495 | reserve_info->fixed_area_start = MSM8930_FW_START; |
| 496 | |
| 497 | ret = memblock_remove(reserve_info->fixed_area_start, |
| 498 | reserve_info->fixed_area_size); |
| 499 | BUG_ON(ret); |
| 500 | #endif |
| 501 | } |
| 502 | |
| 503 | /** |
| 504 | * Reserve memory for ION and calculate amount of reusable memory for fmem. |
| 505 | * We only reserve memory for heaps that are not reusable. However, we only |
| 506 | * support one reusable heap at the moment so we ignore the reusable flag for |
| 507 | * other than the first heap with reusable flag set. Also handle special case |
| 508 | * for video heaps (MM,FW, and MFC). Video requires heaps MM and MFC to be |
| 509 | * at a higher address than FW in addition to not more than 256MB away from the |
| 510 | * base address of the firmware. This means that if MM is reusable the other |
| 511 | * two heaps must be allocated in the same region as FW. This is handled by the |
| 512 | * mem_is_fmem flag in the platform data. In addition the MM heap must be |
| 513 | * adjacent to the FW heap for content protection purposes. |
| 514 | */ |
Stephen Boyd | 668d765 | 2012-04-25 11:31:01 -0700 | [diff] [blame] | 515 | static void __init reserve_ion_memory(void) |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 516 | { |
| 517 | #if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION) |
Hanumant Singh | eea6256 | 2012-05-14 11:32:45 -0700 | [diff] [blame] | 518 | unsigned int i; |
Laura Abbott | fd1ad20 | 2012-09-18 11:45:43 -0700 | [diff] [blame] | 519 | int ret; |
Hanumant Singh | eea6256 | 2012-05-14 11:32:45 -0700 | [diff] [blame] | 520 | unsigned int fixed_size = 0; |
| 521 | unsigned int fixed_low_size, fixed_middle_size, fixed_high_size; |
| 522 | unsigned long fixed_low_start, fixed_middle_start, fixed_high_start; |
Laura Abbott | fd1ad20 | 2012-09-18 11:45:43 -0700 | [diff] [blame] | 523 | unsigned long cma_alignment; |
| 524 | unsigned int low_use_cma = 0; |
| 525 | unsigned int middle_use_cma = 0; |
| 526 | unsigned int high_use_cma = 0; |
Hanumant Singh | eea6256 | 2012-05-14 11:32:45 -0700 | [diff] [blame] | 527 | |
Hanumant Singh | eea6256 | 2012-05-14 11:32:45 -0700 | [diff] [blame] | 528 | fixed_low_size = 0; |
| 529 | fixed_middle_size = 0; |
| 530 | fixed_high_size = 0; |
| 531 | |
Laura Abbott | fd1ad20 | 2012-09-18 11:45:43 -0700 | [diff] [blame] | 532 | cma_alignment = PAGE_SIZE << max(MAX_ORDER, pageblock_order); |
| 533 | |
Hanumant Singh | eea6256 | 2012-05-14 11:32:45 -0700 | [diff] [blame] | 534 | for (i = 0; i < msm8930_ion_pdata.nr; ++i) { |
Laura Abbott | fd1ad20 | 2012-09-18 11:45:43 -0700 | [diff] [blame] | 535 | struct ion_platform_heap *heap = |
Hanumant Singh | eea6256 | 2012-05-14 11:32:45 -0700 | [diff] [blame] | 536 | &(msm8930_ion_pdata.heaps[i]); |
| 537 | |
Laura Abbott | fd1ad20 | 2012-09-18 11:45:43 -0700 | [diff] [blame] | 538 | int use_cma = 0; |
| 539 | |
Hanumant Singh | eea6256 | 2012-05-14 11:32:45 -0700 | [diff] [blame] | 540 | if (heap->extra_data) { |
| 541 | int fixed_position = NOT_FIXED; |
Hanumant Singh | eea6256 | 2012-05-14 11:32:45 -0700 | [diff] [blame] | 542 | |
Mitchel Humpherys | 362b52b | 2012-09-13 10:53:22 -0700 | [diff] [blame] | 543 | switch ((int) heap->type) { |
Hanumant Singh | eea6256 | 2012-05-14 11:32:45 -0700 | [diff] [blame] | 544 | case ION_HEAP_TYPE_CP: |
Laura Abbott | fd1ad20 | 2012-09-18 11:45:43 -0700 | [diff] [blame] | 545 | if (((struct ion_cp_heap_pdata *) |
| 546 | heap->extra_data)->is_cma) { |
| 547 | heap->size = ALIGN(heap->size, |
| 548 | cma_alignment); |
| 549 | use_cma = 1; |
| 550 | } |
Hanumant Singh | eea6256 | 2012-05-14 11:32:45 -0700 | [diff] [blame] | 551 | fixed_position = ((struct ion_cp_heap_pdata *) |
| 552 | heap->extra_data)->fixed_position; |
| 553 | break; |
Laura Abbott | fd1ad20 | 2012-09-18 11:45:43 -0700 | [diff] [blame] | 554 | case ION_HEAP_TYPE_DMA: |
| 555 | use_cma = 1; |
| 556 | /* Purposely fall through here */ |
Hanumant Singh | eea6256 | 2012-05-14 11:32:45 -0700 | [diff] [blame] | 557 | case ION_HEAP_TYPE_CARVEOUT: |
Hanumant Singh | eea6256 | 2012-05-14 11:32:45 -0700 | [diff] [blame] | 558 | fixed_position = ((struct ion_co_heap_pdata *) |
| 559 | heap->extra_data)->fixed_position; |
| 560 | break; |
| 561 | default: |
| 562 | break; |
| 563 | } |
| 564 | |
| 565 | if (fixed_position != NOT_FIXED) |
| 566 | fixed_size += heap->size; |
| 567 | else |
| 568 | reserve_mem_for_ion(MEMTYPE_EBI1, heap->size); |
| 569 | |
Laura Abbott | fd1ad20 | 2012-09-18 11:45:43 -0700 | [diff] [blame] | 570 | if (fixed_position == FIXED_LOW) { |
Hanumant Singh | eea6256 | 2012-05-14 11:32:45 -0700 | [diff] [blame] | 571 | fixed_low_size += heap->size; |
Laura Abbott | fd1ad20 | 2012-09-18 11:45:43 -0700 | [diff] [blame] | 572 | low_use_cma = use_cma; |
| 573 | } else if (fixed_position == FIXED_MIDDLE) { |
Hanumant Singh | eea6256 | 2012-05-14 11:32:45 -0700 | [diff] [blame] | 574 | fixed_middle_size += heap->size; |
Laura Abbott | fd1ad20 | 2012-09-18 11:45:43 -0700 | [diff] [blame] | 575 | middle_use_cma = use_cma; |
| 576 | } else if (fixed_position == FIXED_HIGH) { |
Hanumant Singh | eea6256 | 2012-05-14 11:32:45 -0700 | [diff] [blame] | 577 | fixed_high_size += heap->size; |
Laura Abbott | fd1ad20 | 2012-09-18 11:45:43 -0700 | [diff] [blame] | 578 | high_use_cma = use_cma; |
| 579 | } else if (use_cma) { |
| 580 | /* |
| 581 | * Heaps that use CMA but are not part of the |
| 582 | * fixed set. Create wherever. |
| 583 | */ |
| 584 | dma_declare_contiguous( |
| 585 | heap->priv, |
| 586 | heap->size, |
| 587 | 0, |
| 588 | 0xb0000000); |
| 589 | } |
Hanumant Singh | eea6256 | 2012-05-14 11:32:45 -0700 | [diff] [blame] | 590 | } |
| 591 | } |
| 592 | |
| 593 | if (!fixed_size) |
| 594 | return; |
Laura Abbott | fd1ad20 | 2012-09-18 11:45:43 -0700 | [diff] [blame] | 595 | /* |
| 596 | * Given the setup for the fixed area, we can't round up all sizes. |
| 597 | * Some sizes must be set up exactly and aligned correctly. Incorrect |
| 598 | * alignments are considered a configuration issue |
Hanumant Singh | eea6256 | 2012-05-14 11:32:45 -0700 | [diff] [blame] | 599 | */ |
Hanumant Singh | eea6256 | 2012-05-14 11:32:45 -0700 | [diff] [blame] | 600 | |
| 601 | fixed_low_start = MSM8930_FIXED_AREA_START; |
Laura Abbott | fd1ad20 | 2012-09-18 11:45:43 -0700 | [diff] [blame] | 602 | if (low_use_cma) { |
| 603 | BUG_ON(!IS_ALIGNED(fixed_low_size + HOLE_SIZE, cma_alignment)); |
| 604 | BUG_ON(!IS_ALIGNED(fixed_low_start, cma_alignment)); |
| 605 | } else { |
| 606 | BUG_ON(!IS_ALIGNED(fixed_low_size + HOLE_SIZE, SECTION_SIZE)); |
| 607 | ret = memblock_remove(fixed_low_start, |
| 608 | fixed_low_size + HOLE_SIZE); |
| 609 | BUG_ON(ret); |
| 610 | } |
| 611 | |
Deepak Kotur | 9830bf0 | 2012-06-01 15:04:29 -0700 | [diff] [blame] | 612 | fixed_middle_start = fixed_low_start + fixed_low_size + HOLE_SIZE; |
Laura Abbott | fd1ad20 | 2012-09-18 11:45:43 -0700 | [diff] [blame] | 613 | if (middle_use_cma) { |
| 614 | BUG_ON(!IS_ALIGNED(fixed_middle_start, cma_alignment)); |
| 615 | BUG_ON(!IS_ALIGNED(fixed_middle_size, cma_alignment)); |
| 616 | } else { |
| 617 | BUG_ON(!IS_ALIGNED(fixed_middle_size, SECTION_SIZE)); |
| 618 | ret = memblock_remove(fixed_middle_start, fixed_middle_size); |
| 619 | BUG_ON(ret); |
| 620 | } |
| 621 | |
Hanumant Singh | eea6256 | 2012-05-14 11:32:45 -0700 | [diff] [blame] | 622 | fixed_high_start = fixed_middle_start + fixed_middle_size; |
Laura Abbott | fd1ad20 | 2012-09-18 11:45:43 -0700 | [diff] [blame] | 623 | if (high_use_cma) { |
| 624 | fixed_high_size = ALIGN(fixed_high_size, cma_alignment); |
| 625 | BUG_ON(!IS_ALIGNED(fixed_high_start, cma_alignment)); |
| 626 | } else { |
| 627 | /* This is the end of the fixed area so it's okay to round up */ |
| 628 | fixed_high_size = ALIGN(fixed_high_size, SECTION_SIZE); |
| 629 | ret = memblock_remove(fixed_high_start, fixed_high_size); |
| 630 | BUG_ON(ret); |
| 631 | } |
Hanumant Singh | eea6256 | 2012-05-14 11:32:45 -0700 | [diff] [blame] | 632 | |
| 633 | for (i = 0; i < msm8930_ion_pdata.nr; ++i) { |
| 634 | struct ion_platform_heap *heap = &(msm8930_ion_pdata.heaps[i]); |
| 635 | |
| 636 | if (heap->extra_data) { |
| 637 | int fixed_position = NOT_FIXED; |
Steve Muckle | 75c34ca | 2012-06-12 14:27:40 -0700 | [diff] [blame] | 638 | struct ion_cp_heap_pdata *pdata = NULL; |
Hanumant Singh | eea6256 | 2012-05-14 11:32:45 -0700 | [diff] [blame] | 639 | |
Mitchel Humpherys | 362b52b | 2012-09-13 10:53:22 -0700 | [diff] [blame] | 640 | switch ((int) heap->type) { |
Hanumant Singh | eea6256 | 2012-05-14 11:32:45 -0700 | [diff] [blame] | 641 | case ION_HEAP_TYPE_CP: |
Deepak Kotur | 9830bf0 | 2012-06-01 15:04:29 -0700 | [diff] [blame] | 642 | pdata = |
| 643 | (struct ion_cp_heap_pdata *)heap->extra_data; |
| 644 | fixed_position = pdata->fixed_position; |
Hanumant Singh | eea6256 | 2012-05-14 11:32:45 -0700 | [diff] [blame] | 645 | break; |
Laura Abbott | fd1ad20 | 2012-09-18 11:45:43 -0700 | [diff] [blame] | 646 | case ION_HEAP_TYPE_DMA: |
Hanumant Singh | eea6256 | 2012-05-14 11:32:45 -0700 | [diff] [blame] | 647 | case ION_HEAP_TYPE_CARVEOUT: |
| 648 | fixed_position = ((struct ion_co_heap_pdata *) |
| 649 | heap->extra_data)->fixed_position; |
| 650 | break; |
| 651 | default: |
| 652 | break; |
| 653 | } |
| 654 | |
| 655 | switch (fixed_position) { |
| 656 | case FIXED_LOW: |
| 657 | heap->base = fixed_low_start; |
| 658 | break; |
| 659 | case FIXED_MIDDLE: |
| 660 | heap->base = fixed_middle_start; |
Laura Abbott | fd1ad20 | 2012-09-18 11:45:43 -0700 | [diff] [blame] | 661 | if (middle_use_cma) |
| 662 | dma_declare_contiguous( |
| 663 | &ion_mm_heap_device.dev, |
| 664 | heap->size, |
| 665 | fixed_middle_start, |
| 666 | 0xa0000000); |
Deepak Kotur | 9830bf0 | 2012-06-01 15:04:29 -0700 | [diff] [blame] | 667 | pdata->secure_base = fixed_middle_start |
| 668 | - HOLE_SIZE; |
| 669 | pdata->secure_size = HOLE_SIZE + heap->size; |
Hanumant Singh | eea6256 | 2012-05-14 11:32:45 -0700 | [diff] [blame] | 670 | break; |
| 671 | case FIXED_HIGH: |
| 672 | heap->base = fixed_high_start; |
| 673 | break; |
| 674 | default: |
| 675 | break; |
| 676 | } |
| 677 | } |
| 678 | } |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 679 | #endif |
| 680 | } |
Huaibin Yang | a541942 | 2011-12-08 23:52:10 -0800 | [diff] [blame] | 681 | |
| 682 | static void __init reserve_mdp_memory(void) |
| 683 | { |
| 684 | msm8930_mdp_writeback(msm8930_reserve_table); |
| 685 | } |
| 686 | |
Laura Abbott | f317304 | 2012-05-29 15:23:18 -0700 | [diff] [blame] | 687 | #ifdef CONFIG_MSM_CACHE_DUMP |
| 688 | static void __init reserve_cache_dump_memory(void) |
| 689 | { |
| 690 | unsigned int total; |
| 691 | |
| 692 | total = msm8930_cache_dump_pdata.l1_size + |
| 693 | msm8930_cache_dump_pdata.l2_size; |
| 694 | msm8930_reserve_table[MEMTYPE_EBI1].size += total; |
| 695 | } |
| 696 | #else |
| 697 | static void __init reserve_cache_dump_memory(void) { } |
| 698 | #endif |
| 699 | |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 700 | static void __init msm8930_calculate_reserve_sizes(void) |
| 701 | { |
| 702 | size_pmem_devices(); |
| 703 | reserve_pmem_memory(); |
| 704 | reserve_ion_memory(); |
Huaibin Yang | a541942 | 2011-12-08 23:52:10 -0800 | [diff] [blame] | 705 | reserve_mdp_memory(); |
Laura Abbott | f8c03b9 | 2012-02-16 14:57:58 -0800 | [diff] [blame] | 706 | reserve_rtb_memory(); |
Laura Abbott | f317304 | 2012-05-29 15:23:18 -0700 | [diff] [blame] | 707 | reserve_cache_dump_memory(); |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 708 | } |
| 709 | |
| 710 | static struct reserve_info msm8930_reserve_info __initdata = { |
| 711 | .memtype_reserve_table = msm8930_reserve_table, |
| 712 | .calculate_reserve_sizes = msm8930_calculate_reserve_sizes, |
Hanumant Singh | eea6256 | 2012-05-14 11:32:45 -0700 | [diff] [blame] | 713 | .reserve_fixed_area = msm8930_reserve_fixed_area, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 714 | .paddr_to_memtype = msm8930_paddr_to_memtype, |
| 715 | }; |
| 716 | |
| 717 | static int msm8930_memory_bank_size(void) |
| 718 | { |
| 719 | return 1<<29; |
| 720 | } |
| 721 | |
| 722 | static void __init locate_unstable_memory(void) |
| 723 | { |
| 724 | struct membank *mb = &meminfo.bank[meminfo.nr_banks - 1]; |
| 725 | unsigned long bank_size; |
| 726 | unsigned long low, high; |
| 727 | |
| 728 | bank_size = msm8930_memory_bank_size(); |
| 729 | low = meminfo.bank[0].start; |
| 730 | high = mb->start + mb->size; |
| 731 | |
| 732 | /* Check if 32 bit overflow occured */ |
| 733 | if (high < mb->start) |
Hanumant Singh | eea6256 | 2012-05-14 11:32:45 -0700 | [diff] [blame] | 734 | high -= PAGE_SIZE; |
| 735 | |
| 736 | if (high < MAX_FIXED_AREA_SIZE + MSM8930_FIXED_AREA_START) |
| 737 | panic("fixed area extends beyond end of memory\n"); |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 738 | |
| 739 | low &= ~(bank_size - 1); |
| 740 | |
| 741 | if (high - low <= bank_size) |
Hanumant Singh | eea6256 | 2012-05-14 11:32:45 -0700 | [diff] [blame] | 742 | goto no_dmm; |
Larry Bassel | b8d6102 | 2012-02-24 10:49:45 -0800 | [diff] [blame] | 743 | |
| 744 | msm8930_reserve_info.bank_size = bank_size; |
| 745 | #ifdef CONFIG_ENABLE_DMM |
Jack Cheung | 6ce8f68 | 2012-01-17 10:35:42 -0800 | [diff] [blame] | 746 | msm8930_reserve_info.low_unstable_address = mb->start - |
| 747 | MIN_MEMORY_BLOCK_SIZE + mb->size; |
| 748 | msm8930_reserve_info.max_unstable_size = MIN_MEMORY_BLOCK_SIZE; |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 749 | pr_info("low unstable address %lx max size %lx bank size %lx\n", |
| 750 | msm8930_reserve_info.low_unstable_address, |
| 751 | msm8930_reserve_info.max_unstable_size, |
| 752 | msm8930_reserve_info.bank_size); |
Hanumant Singh | eea6256 | 2012-05-14 11:32:45 -0700 | [diff] [blame] | 753 | return; |
Larry Bassel | b8d6102 | 2012-02-24 10:49:45 -0800 | [diff] [blame] | 754 | #endif |
Hanumant Singh | eea6256 | 2012-05-14 11:32:45 -0700 | [diff] [blame] | 755 | no_dmm: |
| 756 | msm8930_reserve_info.low_unstable_address = high; |
| 757 | msm8930_reserve_info.max_unstable_size = 0; |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 758 | } |
| 759 | |
| 760 | static void __init place_movable_zone(void) |
| 761 | { |
Larry Bassel | b8d6102 | 2012-02-24 10:49:45 -0800 | [diff] [blame] | 762 | #ifdef CONFIG_ENABLE_DMM |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 763 | movable_reserved_start = msm8930_reserve_info.low_unstable_address; |
| 764 | movable_reserved_size = msm8930_reserve_info.max_unstable_size; |
| 765 | pr_info("movable zone start %lx size %lx\n", |
| 766 | movable_reserved_start, movable_reserved_size); |
Larry Bassel | b8d6102 | 2012-02-24 10:49:45 -0800 | [diff] [blame] | 767 | #endif |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 768 | } |
| 769 | |
| 770 | static void __init msm8930_early_memory(void) |
| 771 | { |
| 772 | reserve_info = &msm8930_reserve_info; |
| 773 | locate_unstable_memory(); |
| 774 | place_movable_zone(); |
| 775 | } |
| 776 | |
Aravind Venkateswaran | 06a4635 | 2012-08-16 14:52:39 -0700 | [diff] [blame] | 777 | static char prim_panel_name[PANEL_NAME_MAX_LEN]; |
| 778 | static char ext_panel_name[PANEL_NAME_MAX_LEN]; |
| 779 | |
| 780 | static int __init prim_display_setup(char *param) |
| 781 | { |
| 782 | if (strnlen(param, PANEL_NAME_MAX_LEN)) |
| 783 | strlcpy(prim_panel_name, param, PANEL_NAME_MAX_LEN); |
| 784 | return 0; |
| 785 | } |
| 786 | early_param("prim_display", prim_display_setup); |
| 787 | |
| 788 | static int __init ext_display_setup(char *param) |
| 789 | { |
| 790 | if (strnlen(param, PANEL_NAME_MAX_LEN)) |
| 791 | strlcpy(ext_panel_name, param, PANEL_NAME_MAX_LEN); |
| 792 | return 0; |
| 793 | } |
| 794 | early_param("ext_display", ext_display_setup); |
| 795 | |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 796 | static void __init msm8930_reserve(void) |
| 797 | { |
Aravind Venkateswaran | 06a4635 | 2012-08-16 14:52:39 -0700 | [diff] [blame] | 798 | msm8930_set_display_params(prim_panel_name, ext_panel_name); |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 799 | msm_reserve(); |
| 800 | } |
| 801 | |
| 802 | static int msm8930_change_memory_power(u64 start, u64 size, |
| 803 | int change_type) |
| 804 | { |
| 805 | return soc_change_memory_power(start, size, change_type); |
| 806 | } |
| 807 | |
| 808 | static void __init msm8930_allocate_memory_regions(void) |
| 809 | { |
| 810 | msm8930_allocate_fb_region(); |
| 811 | } |
| 812 | |
Asish Bhattacharya | b86c347 | 2012-02-15 08:31:52 +0530 | [diff] [blame] | 813 | #ifdef CONFIG_WCD9304_CODEC |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 814 | |
Asish Bhattacharya | b86c347 | 2012-02-15 08:31:52 +0530 | [diff] [blame] | 815 | #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] | 816 | |
| 817 | /* Micbias setting is based on 8660 CDP/MTP/FLUID requirement |
| 818 | * 4 micbiases are used to power various analog and digital |
| 819 | * microphones operating at 1800 mV. Technically, all micbiases |
| 820 | * can source from single cfilter since all microphones operate |
| 821 | * at the same voltage level. The arrangement below is to make |
| 822 | * sure all cfilters are exercised. LDO_H regulator ouput level |
| 823 | * does not need to be as high as 2.85V. It is choosen for |
| 824 | * microphone sensitivity purpose. |
| 825 | */ |
Asish Bhattacharya | b86c347 | 2012-02-15 08:31:52 +0530 | [diff] [blame] | 826 | static struct wcd9xxx_pdata sitar_platform_data = { |
| 827 | .slimbus_slave_device = { |
| 828 | .name = "sitar-slave", |
| 829 | .e_addr = {0, 0, 0x00, 0, 0x17, 2}, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 830 | }, |
| 831 | .irq = MSM_GPIO_TO_INT(62), |
Asish Bhattacharya | b86c347 | 2012-02-15 08:31:52 +0530 | [diff] [blame] | 832 | .irq_base = SITAR_INTERRUPT_BASE, |
Asish Bhattacharya | b1aeae2 | 2012-02-15 08:29:28 +0530 | [diff] [blame] | 833 | .num_irqs = NR_WCD9XXX_IRQS, |
Asish Bhattacharya | b86c347 | 2012-02-15 08:31:52 +0530 | [diff] [blame] | 834 | .reset_gpio = 42, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 835 | .micbias = { |
Asish Bhattacharya | b86c347 | 2012-02-15 08:31:52 +0530 | [diff] [blame] | 836 | .ldoh_v = SITAR_LDOH_2P85_V, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 837 | .cfilt1_mv = 1800, |
| 838 | .cfilt2_mv = 1800, |
Asish Bhattacharya | b86c347 | 2012-02-15 08:31:52 +0530 | [diff] [blame] | 839 | .bias1_cfilt_sel = SITAR_CFILT1_SEL, |
| 840 | .bias2_cfilt_sel = SITAR_CFILT2_SEL, |
Bhalchandra Gajare | 15dbeaa | 2012-06-26 12:53:07 -0700 | [diff] [blame] | 841 | .bias1_cap_mode = MICBIAS_EXT_BYP_CAP, |
| 842 | .bias2_cap_mode = MICBIAS_NO_EXT_BYP_CAP, |
Asish Bhattacharya | b86c347 | 2012-02-15 08:31:52 +0530 | [diff] [blame] | 843 | }, |
| 844 | .regulator = { |
| 845 | { |
| 846 | .name = "CDC_VDD_CP", |
Bhalchandra Gajare | e94bac2 | 2012-10-08 19:16:13 -0700 | [diff] [blame] | 847 | .min_uV = 2200000, |
Asish Bhattacharya | b86c347 | 2012-02-15 08:31:52 +0530 | [diff] [blame] | 848 | .max_uV = 2200000, |
| 849 | .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX, |
| 850 | }, |
| 851 | { |
| 852 | .name = "CDC_VDDA_RX", |
| 853 | .min_uV = 1800000, |
| 854 | .max_uV = 1800000, |
| 855 | .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX, |
| 856 | }, |
| 857 | { |
| 858 | .name = "CDC_VDDA_TX", |
| 859 | .min_uV = 1800000, |
| 860 | .max_uV = 1800000, |
| 861 | .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX, |
| 862 | }, |
| 863 | { |
| 864 | .name = "VDDIO_CDC", |
| 865 | .min_uV = 1800000, |
| 866 | .max_uV = 1800000, |
| 867 | .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX, |
| 868 | }, |
| 869 | { |
| 870 | .name = "VDDD_CDC_D", |
| 871 | .min_uV = 1200000, |
David Collins | 19e7881 | 2012-06-04 15:50:09 -0700 | [diff] [blame] | 872 | .max_uV = 1250000, |
Asish Bhattacharya | b86c347 | 2012-02-15 08:31:52 +0530 | [diff] [blame] | 873 | .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX, |
| 874 | }, |
| 875 | { |
| 876 | .name = "CDC_VDDA_A_1P2V", |
| 877 | .min_uV = 1200000, |
David Collins | 19e7881 | 2012-06-04 15:50:09 -0700 | [diff] [blame] | 878 | .max_uV = 1250000, |
Asish Bhattacharya | b86c347 | 2012-02-15 08:31:52 +0530 | [diff] [blame] | 879 | .optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX, |
| 880 | }, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 881 | }, |
| 882 | }; |
| 883 | |
Asish Bhattacharya | b86c347 | 2012-02-15 08:31:52 +0530 | [diff] [blame] | 884 | static struct slim_device msm_slim_sitar = { |
| 885 | .name = "sitar-slim", |
| 886 | .e_addr = {0, 1, 0x00, 0, 0x17, 2}, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 887 | .dev = { |
Asish Bhattacharya | b86c347 | 2012-02-15 08:31:52 +0530 | [diff] [blame] | 888 | .platform_data = &sitar_platform_data, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 889 | }, |
| 890 | }; |
Bhalchandra Gajare | 83c81f6 | 2012-05-18 16:09:05 -0700 | [diff] [blame] | 891 | |
| 892 | static struct wcd9xxx_pdata sitar1p1_platform_data = { |
| 893 | .slimbus_slave_device = { |
| 894 | .name = "sitar-slave", |
| 895 | .e_addr = {0, 0, 0x70, 0, 0x17, 2}, |
| 896 | }, |
| 897 | .irq = MSM_GPIO_TO_INT(62), |
| 898 | .irq_base = SITAR_INTERRUPT_BASE, |
| 899 | .num_irqs = NR_WCD9XXX_IRQS, |
| 900 | .reset_gpio = 42, |
| 901 | .micbias = { |
| 902 | .ldoh_v = SITAR_LDOH_2P85_V, |
| 903 | .cfilt1_mv = 1800, |
| 904 | .cfilt2_mv = 1800, |
| 905 | .bias1_cfilt_sel = SITAR_CFILT1_SEL, |
| 906 | .bias2_cfilt_sel = SITAR_CFILT2_SEL, |
Bhalchandra Gajare | 15dbeaa | 2012-06-26 12:53:07 -0700 | [diff] [blame] | 907 | .bias1_cap_mode = MICBIAS_EXT_BYP_CAP, |
| 908 | .bias2_cap_mode = MICBIAS_NO_EXT_BYP_CAP, |
Bhalchandra Gajare | 83c81f6 | 2012-05-18 16:09:05 -0700 | [diff] [blame] | 909 | }, |
| 910 | .regulator = { |
| 911 | { |
| 912 | .name = "CDC_VDD_CP", |
Bhalchandra Gajare | e94bac2 | 2012-10-08 19:16:13 -0700 | [diff] [blame] | 913 | .min_uV = 2200000, |
Bhalchandra Gajare | 83c81f6 | 2012-05-18 16:09:05 -0700 | [diff] [blame] | 914 | .max_uV = 2200000, |
| 915 | .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX, |
| 916 | }, |
| 917 | { |
| 918 | .name = "CDC_VDDA_RX", |
| 919 | .min_uV = 1800000, |
| 920 | .max_uV = 1800000, |
| 921 | .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX, |
| 922 | }, |
| 923 | { |
| 924 | .name = "CDC_VDDA_TX", |
| 925 | .min_uV = 1800000, |
| 926 | .max_uV = 1800000, |
| 927 | .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX, |
| 928 | }, |
| 929 | { |
| 930 | .name = "VDDIO_CDC", |
| 931 | .min_uV = 1800000, |
| 932 | .max_uV = 1800000, |
| 933 | .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX, |
| 934 | }, |
| 935 | { |
| 936 | .name = "VDDD_CDC_D", |
| 937 | .min_uV = 1200000, |
David Collins | 19e7881 | 2012-06-04 15:50:09 -0700 | [diff] [blame] | 938 | .max_uV = 1250000, |
Bhalchandra Gajare | 83c81f6 | 2012-05-18 16:09:05 -0700 | [diff] [blame] | 939 | .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX, |
| 940 | }, |
| 941 | { |
| 942 | .name = "CDC_VDDA_A_1P2V", |
| 943 | .min_uV = 1200000, |
David Collins | 19e7881 | 2012-06-04 15:50:09 -0700 | [diff] [blame] | 944 | .max_uV = 1250000, |
Bhalchandra Gajare | 83c81f6 | 2012-05-18 16:09:05 -0700 | [diff] [blame] | 945 | .optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX, |
| 946 | }, |
| 947 | }, |
| 948 | }; |
| 949 | |
| 950 | static struct slim_device msm_slim_sitar1p1 = { |
| 951 | .name = "sitar1p1-slim", |
| 952 | .e_addr = {0, 1, 0x70, 0, 0x17, 2}, |
| 953 | .dev = { |
| 954 | .platform_data = &sitar1p1_platform_data, |
| 955 | }, |
| 956 | }; |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 957 | #endif |
| 958 | |
Asish Bhattacharya | b86c347 | 2012-02-15 08:31:52 +0530 | [diff] [blame] | 959 | |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 960 | static struct slim_boardinfo msm_slim_devices[] = { |
Asish Bhattacharya | b86c347 | 2012-02-15 08:31:52 +0530 | [diff] [blame] | 961 | #ifdef CONFIG_WCD9304_CODEC |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 962 | { |
| 963 | .bus_num = 1, |
Asish Bhattacharya | b86c347 | 2012-02-15 08:31:52 +0530 | [diff] [blame] | 964 | .slim_slave = &msm_slim_sitar, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 965 | }, |
Bhalchandra Gajare | 83c81f6 | 2012-05-18 16:09:05 -0700 | [diff] [blame] | 966 | { |
| 967 | .bus_num = 1, |
| 968 | .slim_slave = &msm_slim_sitar1p1, |
| 969 | }, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 970 | #endif |
| 971 | /* add more slimbus slaves as needed */ |
| 972 | }; |
| 973 | |
| 974 | #define MSM_WCNSS_PHYS 0x03000000 |
| 975 | #define MSM_WCNSS_SIZE 0x280000 |
| 976 | |
| 977 | static struct resource resources_wcnss_wlan[] = { |
| 978 | { |
| 979 | .start = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ, |
| 980 | .end = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ, |
| 981 | .name = "wcnss_wlanrx_irq", |
| 982 | .flags = IORESOURCE_IRQ, |
| 983 | }, |
| 984 | { |
| 985 | .start = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ, |
| 986 | .end = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ, |
| 987 | .name = "wcnss_wlantx_irq", |
| 988 | .flags = IORESOURCE_IRQ, |
| 989 | }, |
| 990 | { |
| 991 | .start = MSM_WCNSS_PHYS, |
| 992 | .end = MSM_WCNSS_PHYS + MSM_WCNSS_SIZE - 1, |
| 993 | .name = "wcnss_mmio", |
| 994 | .flags = IORESOURCE_MEM, |
| 995 | }, |
| 996 | { |
| 997 | .start = 84, |
| 998 | .end = 88, |
| 999 | .name = "wcnss_gpios_5wire", |
| 1000 | .flags = IORESOURCE_IO, |
| 1001 | }, |
| 1002 | }; |
| 1003 | |
| 1004 | static struct qcom_wcnss_opts qcom_wcnss_pdata = { |
| 1005 | .has_48mhz_xo = 1, |
| 1006 | }; |
| 1007 | |
| 1008 | static struct platform_device msm_device_wcnss_wlan = { |
| 1009 | .name = "wcnss_wlan", |
| 1010 | .id = 0, |
| 1011 | .num_resources = ARRAY_SIZE(resources_wcnss_wlan), |
| 1012 | .resource = resources_wcnss_wlan, |
| 1013 | .dev = {.platform_data = &qcom_wcnss_pdata}, |
| 1014 | }; |
| 1015 | |
Ramesh Masavarapu | a26cce7 | 2012-04-09 12:32:25 -0700 | [diff] [blame] | 1016 | #ifdef CONFIG_QSEECOM |
| 1017 | /* qseecom bus scaling */ |
| 1018 | static struct msm_bus_vectors qseecom_clks_init_vectors[] = { |
| 1019 | { |
| 1020 | .src = MSM_BUS_MASTER_SPS, |
| 1021 | .dst = MSM_BUS_SLAVE_EBI_CH0, |
| 1022 | .ib = 0, |
| 1023 | .ab = 0, |
| 1024 | }, |
| 1025 | { |
Ramesh Masavarapu | 1e8c724 | 2012-09-04 11:52:57 -0700 | [diff] [blame] | 1026 | .src = MSM_BUS_MASTER_SPS, |
| 1027 | .dst = MSM_BUS_SLAVE_SPS, |
| 1028 | .ib = 0, |
| 1029 | .ab = 0, |
| 1030 | }, |
| 1031 | { |
Ramesh Masavarapu | a26cce7 | 2012-04-09 12:32:25 -0700 | [diff] [blame] | 1032 | .src = MSM_BUS_MASTER_SPDM, |
| 1033 | .dst = MSM_BUS_SLAVE_SPDM, |
| 1034 | .ib = 0, |
| 1035 | .ab = 0, |
| 1036 | }, |
| 1037 | }; |
| 1038 | |
| 1039 | static struct msm_bus_vectors qseecom_enable_dfab_vectors[] = { |
| 1040 | { |
| 1041 | .src = MSM_BUS_MASTER_SPS, |
| 1042 | .dst = MSM_BUS_SLAVE_EBI_CH0, |
| 1043 | .ib = (492 * 8) * 1000000UL, |
| 1044 | .ab = (492 * 8) * 100000UL, |
| 1045 | }, |
| 1046 | { |
Ramesh Masavarapu | 1e8c724 | 2012-09-04 11:52:57 -0700 | [diff] [blame] | 1047 | .src = MSM_BUS_MASTER_SPS, |
| 1048 | .dst = MSM_BUS_SLAVE_SPS, |
| 1049 | .ib = (492 * 8) * 1000000UL, |
| 1050 | .ab = (492 * 8) * 100000UL, |
| 1051 | }, |
| 1052 | { |
Ramesh Masavarapu | a26cce7 | 2012-04-09 12:32:25 -0700 | [diff] [blame] | 1053 | .src = MSM_BUS_MASTER_SPDM, |
| 1054 | .dst = MSM_BUS_SLAVE_SPDM, |
| 1055 | .ib = 0, |
| 1056 | .ab = 0, |
| 1057 | }, |
| 1058 | }; |
| 1059 | |
| 1060 | static struct msm_bus_vectors qseecom_enable_sfpb_vectors[] = { |
| 1061 | { |
| 1062 | .src = MSM_BUS_MASTER_SPS, |
| 1063 | .dst = MSM_BUS_SLAVE_EBI_CH0, |
| 1064 | .ib = 0, |
| 1065 | .ab = 0, |
| 1066 | }, |
| 1067 | { |
Ramesh Masavarapu | 1e8c724 | 2012-09-04 11:52:57 -0700 | [diff] [blame] | 1068 | .src = MSM_BUS_MASTER_SPS, |
| 1069 | .dst = MSM_BUS_SLAVE_SPS, |
| 1070 | .ib = 0, |
| 1071 | .ab = 0, |
| 1072 | }, |
| 1073 | { |
Ramesh Masavarapu | a26cce7 | 2012-04-09 12:32:25 -0700 | [diff] [blame] | 1074 | .src = MSM_BUS_MASTER_SPDM, |
| 1075 | .dst = MSM_BUS_SLAVE_SPDM, |
| 1076 | .ib = (64 * 8) * 1000000UL, |
| 1077 | .ab = (64 * 8) * 100000UL, |
| 1078 | }, |
| 1079 | }; |
| 1080 | |
Ramesh Masavarapu | 8d75658 | 2012-10-03 10:18:06 -0700 | [diff] [blame] | 1081 | static struct msm_bus_vectors qseecom_enable_dfab_sfpb_vectors[] = { |
| 1082 | { |
| 1083 | .src = MSM_BUS_MASTER_SPS, |
| 1084 | .dst = MSM_BUS_SLAVE_EBI_CH0, |
| 1085 | .ib = (492 * 8) * 1000000UL, |
| 1086 | .ab = (492 * 8) * 100000UL, |
| 1087 | }, |
| 1088 | { |
| 1089 | .src = MSM_BUS_MASTER_SPS, |
| 1090 | .dst = MSM_BUS_SLAVE_SPS, |
| 1091 | .ib = (492 * 8) * 1000000UL, |
| 1092 | .ab = (492 * 8) * 100000UL, |
| 1093 | }, |
| 1094 | { |
| 1095 | .src = MSM_BUS_MASTER_SPDM, |
| 1096 | .dst = MSM_BUS_SLAVE_SPDM, |
| 1097 | .ib = (64 * 8) * 1000000UL, |
| 1098 | .ab = (64 * 8) * 100000UL, |
| 1099 | }, |
| 1100 | }; |
| 1101 | |
Ramesh Masavarapu | a26cce7 | 2012-04-09 12:32:25 -0700 | [diff] [blame] | 1102 | static struct msm_bus_paths qseecom_hw_bus_scale_usecases[] = { |
| 1103 | { |
| 1104 | ARRAY_SIZE(qseecom_clks_init_vectors), |
| 1105 | qseecom_clks_init_vectors, |
| 1106 | }, |
| 1107 | { |
| 1108 | ARRAY_SIZE(qseecom_enable_dfab_vectors), |
| 1109 | qseecom_enable_sfpb_vectors, |
| 1110 | }, |
| 1111 | { |
| 1112 | ARRAY_SIZE(qseecom_enable_sfpb_vectors), |
| 1113 | qseecom_enable_sfpb_vectors, |
| 1114 | }, |
Ramesh Masavarapu | 8d75658 | 2012-10-03 10:18:06 -0700 | [diff] [blame] | 1115 | { |
| 1116 | ARRAY_SIZE(qseecom_enable_dfab_sfpb_vectors), |
| 1117 | qseecom_enable_dfab_sfpb_vectors, |
| 1118 | }, |
Ramesh Masavarapu | a26cce7 | 2012-04-09 12:32:25 -0700 | [diff] [blame] | 1119 | }; |
| 1120 | |
| 1121 | static struct msm_bus_scale_pdata qseecom_bus_pdata = { |
| 1122 | qseecom_hw_bus_scale_usecases, |
| 1123 | ARRAY_SIZE(qseecom_hw_bus_scale_usecases), |
| 1124 | .name = "qsee", |
| 1125 | }; |
| 1126 | |
| 1127 | static struct platform_device qseecom_device = { |
| 1128 | .name = "qseecom", |
| 1129 | .id = 0, |
| 1130 | .dev = { |
| 1131 | .platform_data = &qseecom_bus_pdata, |
| 1132 | }, |
| 1133 | }; |
| 1134 | #endif |
| 1135 | |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 1136 | #if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \ |
| 1137 | defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \ |
| 1138 | defined(CONFIG_CRYPTO_DEV_QCEDEV) || \ |
| 1139 | defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE) |
| 1140 | |
| 1141 | #define QCE_SIZE 0x10000 |
| 1142 | #define QCE_0_BASE 0x18500000 |
| 1143 | |
| 1144 | #define QCE_HW_KEY_SUPPORT 0 |
| 1145 | #define QCE_SHA_HMAC_SUPPORT 1 |
| 1146 | #define QCE_SHARE_CE_RESOURCE 1 |
| 1147 | #define QCE_CE_SHARED 0 |
| 1148 | |
Ramesh Masavarapu | 992faf6 | 2012-06-15 20:21:39 -0700 | [diff] [blame] | 1149 | /* Begin Bus scaling definitions */ |
| 1150 | static struct msm_bus_vectors crypto_hw_init_vectors[] = { |
| 1151 | { |
| 1152 | .src = MSM_BUS_MASTER_ADM_PORT0, |
| 1153 | .dst = MSM_BUS_SLAVE_EBI_CH0, |
| 1154 | .ab = 0, |
| 1155 | .ib = 0, |
| 1156 | }, |
| 1157 | { |
| 1158 | .src = MSM_BUS_MASTER_ADM_PORT1, |
| 1159 | .dst = MSM_BUS_SLAVE_GSBI1_UART, |
| 1160 | .ab = 0, |
| 1161 | .ib = 0, |
| 1162 | }, |
| 1163 | }; |
| 1164 | |
| 1165 | static struct msm_bus_vectors crypto_hw_active_vectors[] = { |
| 1166 | { |
| 1167 | .src = MSM_BUS_MASTER_ADM_PORT0, |
| 1168 | .dst = MSM_BUS_SLAVE_EBI_CH0, |
| 1169 | .ab = 70000000UL, |
| 1170 | .ib = 70000000UL, |
| 1171 | }, |
| 1172 | { |
| 1173 | .src = MSM_BUS_MASTER_ADM_PORT1, |
| 1174 | .dst = MSM_BUS_SLAVE_GSBI1_UART, |
| 1175 | .ab = 2480000000UL, |
| 1176 | .ib = 2480000000UL, |
| 1177 | }, |
| 1178 | }; |
| 1179 | |
| 1180 | static struct msm_bus_paths crypto_hw_bus_scale_usecases[] = { |
| 1181 | { |
| 1182 | ARRAY_SIZE(crypto_hw_init_vectors), |
| 1183 | crypto_hw_init_vectors, |
| 1184 | }, |
| 1185 | { |
| 1186 | ARRAY_SIZE(crypto_hw_active_vectors), |
| 1187 | crypto_hw_active_vectors, |
| 1188 | }, |
| 1189 | }; |
| 1190 | |
| 1191 | static struct msm_bus_scale_pdata crypto_hw_bus_scale_pdata = { |
| 1192 | crypto_hw_bus_scale_usecases, |
| 1193 | ARRAY_SIZE(crypto_hw_bus_scale_usecases), |
| 1194 | .name = "cryptohw", |
| 1195 | }; |
| 1196 | /* End Bus Scaling Definitions*/ |
| 1197 | |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 1198 | static struct resource qcrypto_resources[] = { |
| 1199 | [0] = { |
| 1200 | .start = QCE_0_BASE, |
| 1201 | .end = QCE_0_BASE + QCE_SIZE - 1, |
| 1202 | .flags = IORESOURCE_MEM, |
| 1203 | }, |
| 1204 | [1] = { |
| 1205 | .name = "crypto_channels", |
| 1206 | .start = DMOV_CE_IN_CHAN, |
| 1207 | .end = DMOV_CE_OUT_CHAN, |
| 1208 | .flags = IORESOURCE_DMA, |
| 1209 | }, |
| 1210 | [2] = { |
| 1211 | .name = "crypto_crci_in", |
| 1212 | .start = DMOV_CE_IN_CRCI, |
| 1213 | .end = DMOV_CE_IN_CRCI, |
| 1214 | .flags = IORESOURCE_DMA, |
| 1215 | }, |
| 1216 | [3] = { |
| 1217 | .name = "crypto_crci_out", |
| 1218 | .start = DMOV_CE_OUT_CRCI, |
| 1219 | .end = DMOV_CE_OUT_CRCI, |
| 1220 | .flags = IORESOURCE_DMA, |
| 1221 | }, |
| 1222 | }; |
| 1223 | |
| 1224 | static struct resource qcedev_resources[] = { |
| 1225 | [0] = { |
| 1226 | .start = QCE_0_BASE, |
| 1227 | .end = QCE_0_BASE + QCE_SIZE - 1, |
| 1228 | .flags = IORESOURCE_MEM, |
| 1229 | }, |
| 1230 | [1] = { |
| 1231 | .name = "crypto_channels", |
| 1232 | .start = DMOV_CE_IN_CHAN, |
| 1233 | .end = DMOV_CE_OUT_CHAN, |
| 1234 | .flags = IORESOURCE_DMA, |
| 1235 | }, |
| 1236 | [2] = { |
| 1237 | .name = "crypto_crci_in", |
| 1238 | .start = DMOV_CE_IN_CRCI, |
| 1239 | .end = DMOV_CE_IN_CRCI, |
| 1240 | .flags = IORESOURCE_DMA, |
| 1241 | }, |
| 1242 | [3] = { |
| 1243 | .name = "crypto_crci_out", |
| 1244 | .start = DMOV_CE_OUT_CRCI, |
| 1245 | .end = DMOV_CE_OUT_CRCI, |
| 1246 | .flags = IORESOURCE_DMA, |
| 1247 | }, |
| 1248 | }; |
| 1249 | |
| 1250 | #endif |
| 1251 | |
| 1252 | #if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \ |
| 1253 | defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) |
| 1254 | |
| 1255 | static struct msm_ce_hw_support qcrypto_ce_hw_suppport = { |
| 1256 | .ce_shared = QCE_CE_SHARED, |
| 1257 | .shared_ce_resource = QCE_SHARE_CE_RESOURCE, |
| 1258 | .hw_key_support = QCE_HW_KEY_SUPPORT, |
| 1259 | .sha_hmac = QCE_SHA_HMAC_SUPPORT, |
Ramesh Masavarapu | 992faf6 | 2012-06-15 20:21:39 -0700 | [diff] [blame] | 1260 | .bus_scale_table = &crypto_hw_bus_scale_pdata, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 1261 | }; |
| 1262 | |
| 1263 | static struct platform_device qcrypto_device = { |
| 1264 | .name = "qcrypto", |
| 1265 | .id = 0, |
| 1266 | .num_resources = ARRAY_SIZE(qcrypto_resources), |
| 1267 | .resource = qcrypto_resources, |
| 1268 | .dev = { |
| 1269 | .coherent_dma_mask = DMA_BIT_MASK(32), |
| 1270 | .platform_data = &qcrypto_ce_hw_suppport, |
| 1271 | }, |
| 1272 | }; |
| 1273 | #endif |
| 1274 | |
| 1275 | #if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \ |
| 1276 | defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE) |
| 1277 | |
| 1278 | static struct msm_ce_hw_support qcedev_ce_hw_suppport = { |
| 1279 | .ce_shared = QCE_CE_SHARED, |
| 1280 | .shared_ce_resource = QCE_SHARE_CE_RESOURCE, |
| 1281 | .hw_key_support = QCE_HW_KEY_SUPPORT, |
| 1282 | .sha_hmac = QCE_SHA_HMAC_SUPPORT, |
Ramesh Masavarapu | 992faf6 | 2012-06-15 20:21:39 -0700 | [diff] [blame] | 1283 | .bus_scale_table = &crypto_hw_bus_scale_pdata, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 1284 | }; |
| 1285 | |
| 1286 | static struct platform_device qcedev_device = { |
| 1287 | .name = "qce", |
| 1288 | .id = 0, |
| 1289 | .num_resources = ARRAY_SIZE(qcedev_resources), |
| 1290 | .resource = qcedev_resources, |
| 1291 | .dev = { |
| 1292 | .coherent_dma_mask = DMA_BIT_MASK(32), |
| 1293 | .platform_data = &qcedev_ce_hw_suppport, |
| 1294 | }, |
| 1295 | }; |
| 1296 | #endif |
| 1297 | |
| 1298 | #define MDM2AP_ERRFATAL 70 |
| 1299 | #define AP2MDM_ERRFATAL 95 |
| 1300 | #define MDM2AP_STATUS 69 |
| 1301 | #define AP2MDM_STATUS 94 |
| 1302 | #define AP2MDM_PMIC_RESET_N 80 |
| 1303 | #define AP2MDM_KPDPWR_N 81 |
| 1304 | |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 1305 | static struct resource mdm_resources[] = { |
| 1306 | { |
| 1307 | .start = MDM2AP_ERRFATAL, |
| 1308 | .end = MDM2AP_ERRFATAL, |
| 1309 | .name = "MDM2AP_ERRFATAL", |
| 1310 | .flags = IORESOURCE_IO, |
| 1311 | }, |
| 1312 | { |
| 1313 | .start = AP2MDM_ERRFATAL, |
| 1314 | .end = AP2MDM_ERRFATAL, |
| 1315 | .name = "AP2MDM_ERRFATAL", |
| 1316 | .flags = IORESOURCE_IO, |
| 1317 | }, |
| 1318 | { |
| 1319 | .start = MDM2AP_STATUS, |
| 1320 | .end = MDM2AP_STATUS, |
| 1321 | .name = "MDM2AP_STATUS", |
| 1322 | .flags = IORESOURCE_IO, |
| 1323 | }, |
| 1324 | { |
| 1325 | .start = AP2MDM_STATUS, |
| 1326 | .end = AP2MDM_STATUS, |
| 1327 | .name = "AP2MDM_STATUS", |
| 1328 | .flags = IORESOURCE_IO, |
| 1329 | }, |
| 1330 | { |
| 1331 | .start = AP2MDM_PMIC_RESET_N, |
| 1332 | .end = AP2MDM_PMIC_RESET_N, |
| 1333 | .name = "AP2MDM_PMIC_RESET_N", |
| 1334 | .flags = IORESOURCE_IO, |
| 1335 | }, |
| 1336 | { |
| 1337 | .start = AP2MDM_KPDPWR_N, |
| 1338 | .end = AP2MDM_KPDPWR_N, |
| 1339 | .name = "AP2MDM_KPDPWR_N", |
| 1340 | .flags = IORESOURCE_IO, |
| 1341 | }, |
| 1342 | }; |
| 1343 | |
| 1344 | static struct mdm_platform_data mdm_platform_data = { |
| 1345 | .mdm_version = "2.5", |
| 1346 | }; |
| 1347 | |
| 1348 | static struct platform_device mdm_device = { |
| 1349 | .name = "mdm2_modem", |
| 1350 | .id = -1, |
| 1351 | .num_resources = ARRAY_SIZE(mdm_resources), |
| 1352 | .resource = mdm_resources, |
| 1353 | .dev = { |
| 1354 | .platform_data = &mdm_platform_data, |
| 1355 | }, |
| 1356 | }; |
| 1357 | |
| 1358 | static struct platform_device *mdm_devices[] __initdata = { |
| 1359 | &mdm_device, |
| 1360 | }; |
| 1361 | |
Praveen Chidambaram | 7849901 | 2011-11-01 17:15:17 -0600 | [diff] [blame] | 1362 | #ifdef CONFIG_MSM_MPM |
| 1363 | static uint16_t msm_mpm_irqs_m2a[MSM_MPM_NR_MPM_IRQS] __initdata = { |
| 1364 | [1] = MSM_GPIO_TO_INT(46), |
| 1365 | [2] = MSM_GPIO_TO_INT(150), |
| 1366 | [4] = MSM_GPIO_TO_INT(103), |
| 1367 | [5] = MSM_GPIO_TO_INT(104), |
| 1368 | [6] = MSM_GPIO_TO_INT(105), |
| 1369 | [7] = MSM_GPIO_TO_INT(106), |
| 1370 | [8] = MSM_GPIO_TO_INT(107), |
| 1371 | [9] = MSM_GPIO_TO_INT(7), |
| 1372 | [10] = MSM_GPIO_TO_INT(11), |
| 1373 | [11] = MSM_GPIO_TO_INT(15), |
| 1374 | [12] = MSM_GPIO_TO_INT(19), |
| 1375 | [13] = MSM_GPIO_TO_INT(23), |
| 1376 | [14] = MSM_GPIO_TO_INT(27), |
| 1377 | [15] = MSM_GPIO_TO_INT(31), |
| 1378 | [16] = MSM_GPIO_TO_INT(35), |
| 1379 | [19] = MSM_GPIO_TO_INT(90), |
| 1380 | [20] = MSM_GPIO_TO_INT(92), |
| 1381 | [23] = MSM_GPIO_TO_INT(85), |
| 1382 | [24] = MSM_GPIO_TO_INT(83), |
| 1383 | [25] = USB1_HS_IRQ, |
Mahesh Sivasubramanian | 47e38a8 | 2012-03-06 09:35:26 -0700 | [diff] [blame] | 1384 | [26] = MSM_GPIO_TO_INT(6), |
Praveen Chidambaram | 7849901 | 2011-11-01 17:15:17 -0600 | [diff] [blame] | 1385 | [27] = HDMI_IRQ, |
| 1386 | [29] = MSM_GPIO_TO_INT(10), |
| 1387 | [30] = MSM_GPIO_TO_INT(102), |
| 1388 | [31] = MSM_GPIO_TO_INT(81), |
| 1389 | [32] = MSM_GPIO_TO_INT(78), |
| 1390 | [33] = MSM_GPIO_TO_INT(94), |
| 1391 | [34] = MSM_GPIO_TO_INT(72), |
| 1392 | [35] = MSM_GPIO_TO_INT(39), |
| 1393 | [36] = MSM_GPIO_TO_INT(43), |
| 1394 | [37] = MSM_GPIO_TO_INT(61), |
| 1395 | [38] = MSM_GPIO_TO_INT(50), |
| 1396 | [39] = MSM_GPIO_TO_INT(42), |
| 1397 | [41] = MSM_GPIO_TO_INT(62), |
Mahesh Sivasubramanian | 47e38a8 | 2012-03-06 09:35:26 -0700 | [diff] [blame] | 1398 | [42] = MSM_GPIO_TO_INT(8), |
| 1399 | [43] = MSM_GPIO_TO_INT(33), |
Praveen Chidambaram | 7849901 | 2011-11-01 17:15:17 -0600 | [diff] [blame] | 1400 | [44] = MSM_GPIO_TO_INT(70), |
| 1401 | [45] = MSM_GPIO_TO_INT(69), |
| 1402 | [46] = MSM_GPIO_TO_INT(67), |
| 1403 | [47] = MSM_GPIO_TO_INT(65), |
Mahesh Sivasubramanian | 47e38a8 | 2012-03-06 09:35:26 -0700 | [diff] [blame] | 1404 | [48] = MSM_GPIO_TO_INT(55), |
| 1405 | [49] = MSM_GPIO_TO_INT(74), |
| 1406 | [50] = MSM_GPIO_TO_INT(98), |
Praveen Chidambaram | 7849901 | 2011-11-01 17:15:17 -0600 | [diff] [blame] | 1407 | [51] = MSM_GPIO_TO_INT(49), |
| 1408 | [52] = MSM_GPIO_TO_INT(40), |
| 1409 | [53] = MSM_GPIO_TO_INT(37), |
| 1410 | [54] = MSM_GPIO_TO_INT(24), |
| 1411 | [55] = MSM_GPIO_TO_INT(14), |
| 1412 | }; |
| 1413 | |
| 1414 | static uint16_t msm_mpm_bypassed_apps_irqs[] __initdata = { |
| 1415 | TLMM_MSM_SUMMARY_IRQ, |
| 1416 | RPM_APCC_CPU0_GP_HIGH_IRQ, |
| 1417 | RPM_APCC_CPU0_GP_MEDIUM_IRQ, |
| 1418 | RPM_APCC_CPU0_GP_LOW_IRQ, |
| 1419 | RPM_APCC_CPU0_WAKE_UP_IRQ, |
| 1420 | RPM_APCC_CPU1_GP_HIGH_IRQ, |
| 1421 | RPM_APCC_CPU1_GP_MEDIUM_IRQ, |
| 1422 | RPM_APCC_CPU1_GP_LOW_IRQ, |
| 1423 | RPM_APCC_CPU1_WAKE_UP_IRQ, |
| 1424 | MSS_TO_APPS_IRQ_0, |
| 1425 | MSS_TO_APPS_IRQ_1, |
| 1426 | MSS_TO_APPS_IRQ_2, |
| 1427 | MSS_TO_APPS_IRQ_3, |
| 1428 | MSS_TO_APPS_IRQ_4, |
| 1429 | MSS_TO_APPS_IRQ_5, |
| 1430 | MSS_TO_APPS_IRQ_6, |
| 1431 | MSS_TO_APPS_IRQ_7, |
| 1432 | MSS_TO_APPS_IRQ_8, |
| 1433 | MSS_TO_APPS_IRQ_9, |
| 1434 | LPASS_SCSS_GP_LOW_IRQ, |
| 1435 | LPASS_SCSS_GP_MEDIUM_IRQ, |
| 1436 | LPASS_SCSS_GP_HIGH_IRQ, |
| 1437 | SPS_MTI_30, |
| 1438 | SPS_MTI_31, |
| 1439 | RIVA_APSS_SPARE_IRQ, |
| 1440 | RIVA_APPS_WLAN_SMSM_IRQ, |
| 1441 | RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ, |
| 1442 | RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ, |
| 1443 | }; |
| 1444 | |
| 1445 | struct msm_mpm_device_data msm8930_mpm_dev_data __initdata = { |
| 1446 | .irqs_m2a = msm_mpm_irqs_m2a, |
| 1447 | .irqs_m2a_size = ARRAY_SIZE(msm_mpm_irqs_m2a), |
| 1448 | .bypassed_apps_irqs = msm_mpm_bypassed_apps_irqs, |
| 1449 | .bypassed_apps_irqs_size = ARRAY_SIZE(msm_mpm_bypassed_apps_irqs), |
| 1450 | .mpm_request_reg_base = MSM_RPM_BASE + 0x9d8, |
| 1451 | .mpm_status_reg_base = MSM_RPM_BASE + 0xdf8, |
| 1452 | .mpm_apps_ipc_reg = MSM_APCS_GCC_BASE + 0x008, |
| 1453 | .mpm_apps_ipc_val = BIT(1), |
| 1454 | .mpm_ipc_irq = RPM_APCC_CPU0_GP_MEDIUM_IRQ, |
| 1455 | |
| 1456 | }; |
| 1457 | #endif |
| 1458 | |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 1459 | #define MSM_SHARED_RAM_PHYS 0x80000000 |
| 1460 | |
| 1461 | static void __init msm8930_map_io(void) |
| 1462 | { |
| 1463 | msm_shared_ram_phys = MSM_SHARED_RAM_PHYS; |
| 1464 | msm_map_msm8930_io(); |
| 1465 | |
Abhimanyu Kapur | 91a0a50 | 2013-01-11 19:24:59 -0800 | [diff] [blame] | 1466 | if (socinfo_init() < 0) |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 1467 | pr_err("socinfo_init() failed!\n"); |
Abhimanyu Kapur | 440cdde | 2012-12-04 00:05:40 -0800 | [diff] [blame] | 1468 | |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 1469 | } |
| 1470 | |
| 1471 | static void __init msm8930_init_irq(void) |
| 1472 | { |
Praveen Chidambaram | 7849901 | 2011-11-01 17:15:17 -0600 | [diff] [blame] | 1473 | struct msm_mpm_device_data *data = NULL; |
| 1474 | #ifdef CONFIG_MSM_MPM |
| 1475 | data = &msm8930_mpm_dev_data; |
| 1476 | #endif |
| 1477 | |
| 1478 | msm_mpm_irq_extn_init(data); |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 1479 | gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE, |
| 1480 | (void *)MSM_QGIC_CPU_BASE); |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 1481 | } |
| 1482 | |
| 1483 | static void __init msm8930_init_buses(void) |
| 1484 | { |
| 1485 | #ifdef CONFIG_MSM_BUS_SCALING |
| 1486 | msm_bus_rpm_set_mt_mask(); |
Gagan Mac | cd5b327 | 2012-02-09 18:13:10 -0700 | [diff] [blame] | 1487 | msm_bus_8930_apps_fabric_pdata.rpm_enabled = 1; |
| 1488 | msm_bus_8930_sys_fabric_pdata.rpm_enabled = 1; |
| 1489 | msm_bus_8930_mm_fabric_pdata.rpm_enabled = 1; |
| 1490 | msm_bus_8930_apps_fabric.dev.platform_data = |
| 1491 | &msm_bus_8930_apps_fabric_pdata; |
| 1492 | msm_bus_8930_sys_fabric.dev.platform_data = |
| 1493 | &msm_bus_8930_sys_fabric_pdata; |
| 1494 | msm_bus_8930_mm_fabric.dev.platform_data = |
| 1495 | &msm_bus_8930_mm_fabric_pdata; |
| 1496 | msm_bus_8930_sys_fpb.dev.platform_data = &msm_bus_8930_sys_fpb_pdata; |
| 1497 | 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] | 1498 | #endif |
| 1499 | } |
| 1500 | |
| 1501 | static struct msm_spi_platform_data msm8960_qup_spi_gsbi1_pdata = { |
| 1502 | .max_clock_speed = 15060000, |
| 1503 | }; |
| 1504 | |
| 1505 | #ifdef CONFIG_USB_MSM_OTG_72K |
| 1506 | static struct msm_otg_platform_data msm_otg_pdata; |
| 1507 | #else |
Mayank Rana | 7e57416 | 2013-01-08 15:10:51 +0530 | [diff] [blame] | 1508 | static int enable_usb_host_mode; |
| 1509 | static int __init usb_host_mode_with_pm8917(char *param) |
| 1510 | { |
| 1511 | int ret; |
| 1512 | |
| 1513 | ret = kstrtoint(param, 10, &enable_usb_host_mode); |
| 1514 | return ret; |
| 1515 | } |
| 1516 | early_param("usb_host_mode_pm8917", usb_host_mode_with_pm8917); |
| 1517 | |
Manu Gautam | 32ab946 | 2012-02-20 12:33:01 +0530 | [diff] [blame] | 1518 | #ifdef CONFIG_MSM_BUS_SCALING |
| 1519 | /* Bandwidth requests (zero) if no vote placed */ |
| 1520 | static struct msm_bus_vectors usb_init_vectors[] = { |
| 1521 | { |
| 1522 | .src = MSM_BUS_MASTER_SPS, |
| 1523 | .dst = MSM_BUS_SLAVE_EBI_CH0, |
| 1524 | .ab = 0, |
| 1525 | .ib = 0, |
| 1526 | }, |
| 1527 | }; |
| 1528 | |
| 1529 | /* Bus bandwidth requests in Bytes/sec */ |
| 1530 | static struct msm_bus_vectors usb_max_vectors[] = { |
| 1531 | { |
| 1532 | .src = MSM_BUS_MASTER_SPS, |
| 1533 | .dst = MSM_BUS_SLAVE_EBI_CH0, |
| 1534 | .ab = 60000000, /* At least 480Mbps on bus. */ |
| 1535 | .ib = 960000000, /* MAX bursts rate */ |
| 1536 | }, |
| 1537 | }; |
| 1538 | |
| 1539 | static struct msm_bus_paths usb_bus_scale_usecases[] = { |
| 1540 | { |
| 1541 | ARRAY_SIZE(usb_init_vectors), |
| 1542 | usb_init_vectors, |
| 1543 | }, |
| 1544 | { |
| 1545 | ARRAY_SIZE(usb_max_vectors), |
| 1546 | usb_max_vectors, |
| 1547 | }, |
| 1548 | }; |
| 1549 | |
| 1550 | static struct msm_bus_scale_pdata usb_bus_scale_pdata = { |
| 1551 | usb_bus_scale_usecases, |
| 1552 | ARRAY_SIZE(usb_bus_scale_usecases), |
| 1553 | .name = "usb", |
| 1554 | }; |
| 1555 | #endif |
| 1556 | |
Mayank Rana | 2fe1aec | 2012-06-07 18:00:12 +0530 | [diff] [blame] | 1557 | static int hsusb_phy_init_seq[] = { |
| 1558 | 0x44, 0x80, /* set VBUS valid threshold |
| 1559 | and disconnect valid threshold */ |
Chiranjeevi Velempati | f983aeb | 2012-08-23 08:16:50 +0530 | [diff] [blame] | 1560 | 0x68, 0x81, /* update DC voltage level */ |
Mayank Rana | 2fe1aec | 2012-06-07 18:00:12 +0530 | [diff] [blame] | 1561 | 0x24, 0x82, /* set preemphasis and rise/fall time */ |
| 1562 | 0x13, 0x83, /* set source impedance adjusment */ |
| 1563 | -1}; |
| 1564 | |
Jack Pham | 87f202f | 2012-08-06 00:24:22 -0700 | [diff] [blame] | 1565 | #define MSM_MPM_PIN_USB1_OTGSESSVLD 40 |
| 1566 | |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 1567 | static struct msm_otg_platform_data msm_otg_pdata = { |
| 1568 | .mode = USB_OTG, |
| 1569 | .otg_control = OTG_PMIC_CONTROL, |
| 1570 | .phy_type = SNPS_28NM_INTEGRATED_PHY, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 1571 | .power_budget = 750, |
Manu Gautam | 32ab946 | 2012-02-20 12:33:01 +0530 | [diff] [blame] | 1572 | #ifdef CONFIG_MSM_BUS_SCALING |
| 1573 | .bus_scale_table = &usb_bus_scale_pdata, |
| 1574 | #endif |
Pavankumar Kondeti | 2aec9f3 | 2012-06-13 09:06:03 +0530 | [diff] [blame] | 1575 | #ifdef CONFIG_FB_MSM_HDMI_MHL_8334 |
| 1576 | .mhl_dev_name = "sii8334", |
| 1577 | #endif |
Jack Pham | 87f202f | 2012-08-06 00:24:22 -0700 | [diff] [blame] | 1578 | .mpm_otgsessvld_int = MSM_MPM_PIN_USB1_OTGSESSVLD, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 1579 | }; |
| 1580 | #endif |
| 1581 | |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 1582 | #define PID_MAGIC_ID 0x71432909 |
| 1583 | #define SERIAL_NUM_MAGIC_ID 0x61945374 |
| 1584 | #define SERIAL_NUMBER_LENGTH 127 |
| 1585 | #define DLOAD_USB_BASE_ADD 0x2A03F0C8 |
| 1586 | |
| 1587 | struct magic_num_struct { |
| 1588 | uint32_t pid; |
| 1589 | uint32_t serial_num; |
| 1590 | }; |
| 1591 | |
| 1592 | struct dload_struct { |
| 1593 | uint32_t reserved1; |
| 1594 | uint32_t reserved2; |
| 1595 | uint32_t reserved3; |
| 1596 | uint16_t reserved4; |
| 1597 | uint16_t pid; |
| 1598 | char serial_number[SERIAL_NUMBER_LENGTH]; |
| 1599 | uint16_t reserved5; |
| 1600 | struct magic_num_struct magic_struct; |
| 1601 | }; |
| 1602 | |
| 1603 | static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum) |
| 1604 | { |
| 1605 | struct dload_struct __iomem *dload = 0; |
| 1606 | |
| 1607 | dload = ioremap(DLOAD_USB_BASE_ADD, sizeof(*dload)); |
| 1608 | if (!dload) { |
| 1609 | pr_err("%s: cannot remap I/O memory region: %08x\n", |
| 1610 | __func__, DLOAD_USB_BASE_ADD); |
| 1611 | return -ENXIO; |
| 1612 | } |
| 1613 | |
| 1614 | pr_debug("%s: dload:%p pid:%x serial_num:%s\n", |
| 1615 | __func__, dload, pid, snum); |
| 1616 | /* update pid */ |
| 1617 | dload->magic_struct.pid = PID_MAGIC_ID; |
| 1618 | dload->pid = pid; |
| 1619 | |
| 1620 | /* update serial number */ |
| 1621 | dload->magic_struct.serial_num = 0; |
| 1622 | if (!snum) { |
| 1623 | memset(dload->serial_number, 0, SERIAL_NUMBER_LENGTH); |
| 1624 | goto out; |
| 1625 | } |
| 1626 | |
| 1627 | dload->magic_struct.serial_num = SERIAL_NUM_MAGIC_ID; |
| 1628 | strlcpy(dload->serial_number, snum, SERIAL_NUMBER_LENGTH); |
| 1629 | out: |
| 1630 | iounmap(dload); |
| 1631 | return 0; |
| 1632 | } |
| 1633 | |
| 1634 | static struct android_usb_platform_data android_usb_pdata = { |
| 1635 | .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num, |
| 1636 | }; |
| 1637 | |
| 1638 | static struct platform_device android_usb_device = { |
| 1639 | .name = "android_usb", |
| 1640 | .id = -1, |
| 1641 | .dev = { |
| 1642 | .platform_data = &android_usb_pdata, |
| 1643 | }, |
| 1644 | }; |
| 1645 | |
| 1646 | static uint8_t spm_wfi_cmd_sequence[] __initdata = { |
Praveen Chidambaram | 7849901 | 2011-11-01 17:15:17 -0600 | [diff] [blame] | 1647 | 0x03, 0x0f, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 1648 | }; |
| 1649 | |
Anji Jonnala | 1a1711a | 2013-01-29 13:34:10 +0530 | [diff] [blame] | 1650 | |
Girish Mahadevan | 3bc9877 | 2012-08-15 10:01:27 -0600 | [diff] [blame] | 1651 | static uint8_t spm_retention_cmd_sequence[] __initdata = { |
| 1652 | 0x00, 0x05, 0x03, 0x0D, |
| 1653 | 0x0B, 0x00, 0x0f, |
| 1654 | }; |
| 1655 | |
Anji Jonnala | 1a1711a | 2013-01-29 13:34:10 +0530 | [diff] [blame] | 1656 | static uint8_t spm_retention_with_krait_v3_cmd_sequence[] __initdata = { |
| 1657 | 0x42, 0x1B, 0x00, |
| 1658 | 0x05, 0x03, 0x01, 0x0B, |
| 1659 | 0x00, 0x42, 0x1B, |
| 1660 | 0x0f, |
| 1661 | }; |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 1662 | static uint8_t spm_power_collapse_without_rpm[] __initdata = { |
Praveen Chidambaram | 7849901 | 2011-11-01 17:15:17 -0600 | [diff] [blame] | 1663 | 0x00, 0x24, 0x54, 0x10, |
| 1664 | 0x09, 0x03, 0x01, |
| 1665 | 0x10, 0x54, 0x30, 0x0C, |
| 1666 | 0x24, 0x30, 0x0f, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 1667 | }; |
| 1668 | |
| 1669 | static uint8_t spm_power_collapse_with_rpm[] __initdata = { |
Praveen Chidambaram | 7849901 | 2011-11-01 17:15:17 -0600 | [diff] [blame] | 1670 | 0x00, 0x24, 0x54, 0x10, |
| 1671 | 0x09, 0x07, 0x01, 0x0B, |
| 1672 | 0x10, 0x54, 0x30, 0x0C, |
| 1673 | 0x24, 0x30, 0x0f, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 1674 | }; |
| 1675 | |
Girish Mahadevan | 3bc9877 | 2012-08-15 10:01:27 -0600 | [diff] [blame] | 1676 | static struct msm_spm_seq_entry msm_spm_boot_cpu_seq_list[] __initdata = { |
| 1677 | [0] = { |
| 1678 | .mode = MSM_SPM_MODE_CLOCK_GATING, |
| 1679 | .notify_rpm = false, |
| 1680 | .cmd = spm_wfi_cmd_sequence, |
| 1681 | }, |
| 1682 | [1] = { |
| 1683 | .mode = MSM_SPM_MODE_POWER_RETENTION, |
| 1684 | .notify_rpm = false, |
| 1685 | .cmd = spm_retention_cmd_sequence, |
| 1686 | }, |
| 1687 | [2] = { |
| 1688 | .mode = MSM_SPM_MODE_POWER_COLLAPSE, |
| 1689 | .notify_rpm = false, |
| 1690 | .cmd = spm_power_collapse_without_rpm, |
| 1691 | }, |
| 1692 | [3] = { |
| 1693 | .mode = MSM_SPM_MODE_POWER_COLLAPSE, |
| 1694 | .notify_rpm = true, |
| 1695 | .cmd = spm_power_collapse_with_rpm, |
| 1696 | }, |
| 1697 | }; |
| 1698 | |
| 1699 | static struct msm_spm_seq_entry msm_spm_nonboot_cpu_seq_list[] __initdata = { |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 1700 | [0] = { |
| 1701 | .mode = MSM_SPM_MODE_CLOCK_GATING, |
| 1702 | .notify_rpm = false, |
| 1703 | .cmd = spm_wfi_cmd_sequence, |
| 1704 | }, |
| 1705 | [1] = { |
Anji Jonnala | 1a1711a | 2013-01-29 13:34:10 +0530 | [diff] [blame] | 1706 | .mode = MSM_SPM_MODE_POWER_RETENTION, |
| 1707 | .notify_rpm = false, |
| 1708 | .cmd = spm_retention_cmd_sequence, |
| 1709 | }, |
| 1710 | [2] = { |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 1711 | .mode = MSM_SPM_MODE_POWER_COLLAPSE, |
| 1712 | .notify_rpm = false, |
| 1713 | .cmd = spm_power_collapse_without_rpm, |
| 1714 | }, |
Anji Jonnala | 1a1711a | 2013-01-29 13:34:10 +0530 | [diff] [blame] | 1715 | [3] = { |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 1716 | .mode = MSM_SPM_MODE_POWER_COLLAPSE, |
| 1717 | .notify_rpm = true, |
| 1718 | .cmd = spm_power_collapse_with_rpm, |
| 1719 | }, |
| 1720 | }; |
| 1721 | |
| 1722 | static struct msm_spm_platform_data msm_spm_data[] __initdata = { |
| 1723 | [0] = { |
| 1724 | .reg_base_addr = MSM_SAW0_BASE, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 1725 | .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 1726 | #if defined(CONFIG_MSM_AVS_HW) |
| 1727 | .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00, |
| 1728 | .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00, |
| 1729 | #endif |
| 1730 | .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01, |
Girish Mahadevan | 3bc9877 | 2012-08-15 10:01:27 -0600 | [diff] [blame] | 1731 | .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x03020004, |
| 1732 | .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0084009C, |
| 1733 | .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A4001C, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 1734 | .vctl_timeout_us = 50, |
Girish Mahadevan | 3bc9877 | 2012-08-15 10:01:27 -0600 | [diff] [blame] | 1735 | .num_modes = ARRAY_SIZE(msm_spm_boot_cpu_seq_list), |
| 1736 | .modes = msm_spm_boot_cpu_seq_list, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 1737 | }, |
| 1738 | [1] = { |
| 1739 | .reg_base_addr = MSM_SAW1_BASE, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 1740 | .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 1741 | #if defined(CONFIG_MSM_AVS_HW) |
| 1742 | .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00, |
| 1743 | .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00, |
| 1744 | #endif |
| 1745 | .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01, |
Praveen Chidambaram | e4b9eb1 | 2012-02-28 19:39:58 -0700 | [diff] [blame] | 1746 | .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 1747 | .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C, |
| 1748 | .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C, |
| 1749 | .vctl_timeout_us = 50, |
Girish Mahadevan | 3bc9877 | 2012-08-15 10:01:27 -0600 | [diff] [blame] | 1750 | .num_modes = ARRAY_SIZE(msm_spm_nonboot_cpu_seq_list), |
| 1751 | .modes = msm_spm_nonboot_cpu_seq_list, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 1752 | }, |
| 1753 | }; |
| 1754 | |
| 1755 | static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = { |
Praveen Chidambaram | 7849901 | 2011-11-01 17:15:17 -0600 | [diff] [blame] | 1756 | 0x00, 0x20, 0x03, 0x20, |
| 1757 | 0x00, 0x0f, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 1758 | }; |
| 1759 | |
| 1760 | static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = { |
Praveen Chidambaram | 7849901 | 2011-11-01 17:15:17 -0600 | [diff] [blame] | 1761 | 0x00, 0x20, 0x34, 0x64, |
| 1762 | 0x48, 0x07, 0x48, 0x20, |
| 1763 | 0x50, 0x64, 0x04, 0x34, |
| 1764 | 0x50, 0x0f, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 1765 | }; |
| 1766 | static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = { |
Praveen Chidambaram | 7849901 | 2011-11-01 17:15:17 -0600 | [diff] [blame] | 1767 | 0x00, 0x10, 0x34, 0x64, |
| 1768 | 0x48, 0x07, 0x48, 0x10, |
| 1769 | 0x50, 0x64, 0x04, 0x34, |
| 1770 | 0x50, 0x0F, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 1771 | }; |
| 1772 | |
| 1773 | static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = { |
| 1774 | [0] = { |
| 1775 | .mode = MSM_SPM_L2_MODE_RETENTION, |
| 1776 | .notify_rpm = false, |
| 1777 | .cmd = l2_spm_wfi_cmd_sequence, |
| 1778 | }, |
| 1779 | [1] = { |
| 1780 | .mode = MSM_SPM_L2_MODE_GDHS, |
| 1781 | .notify_rpm = true, |
| 1782 | .cmd = l2_spm_gdhs_cmd_sequence, |
| 1783 | }, |
| 1784 | [2] = { |
| 1785 | .mode = MSM_SPM_L2_MODE_POWER_COLLAPSE, |
| 1786 | .notify_rpm = true, |
| 1787 | .cmd = l2_spm_power_off_cmd_sequence, |
| 1788 | }, |
| 1789 | }; |
| 1790 | |
| 1791 | static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = { |
| 1792 | [0] = { |
| 1793 | .reg_base_addr = MSM_SAW_L2_BASE, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 1794 | .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00, |
Praveen Chidambaram | e4b9eb1 | 2012-02-28 19:39:58 -0700 | [diff] [blame] | 1795 | .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 1796 | .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE, |
| 1797 | .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020, |
| 1798 | .modes = msm_spm_l2_seq_list, |
| 1799 | .num_modes = ARRAY_SIZE(msm_spm_l2_seq_list), |
| 1800 | }, |
| 1801 | }; |
| 1802 | |
Anirudh Ghayal | 8c15f7f | 2012-01-09 14:04:02 +0530 | [diff] [blame] | 1803 | #define ISA1200_HAP_EN_GPIO 77 |
| 1804 | #define ISA1200_HAP_LEN_GPIO 78 |
David Collins | fd344aa | 2012-08-06 15:02:03 -0700 | [diff] [blame] | 1805 | #define ISA1200_HAP_CLK_PM8038 PM8038_GPIO_PM_TO_SYS(7) |
| 1806 | #define ISA1200_HAP_CLK_PM8917 PM8917_GPIO_PM_TO_SYS(38) |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 1807 | |
| 1808 | static int isa1200_power(int on) |
| 1809 | { |
David Collins | fd344aa | 2012-08-06 15:02:03 -0700 | [diff] [blame] | 1810 | unsigned int gpio = ISA1200_HAP_CLK_PM8038; |
| 1811 | enum pm8xxx_aux_clk_id clk_id = CLK_MP3_1; |
Amy Maloche | b20c105 | 2012-04-11 10:36:13 -0700 | [diff] [blame] | 1812 | int rc = 0; |
| 1813 | |
David Collins | fd344aa | 2012-08-06 15:02:03 -0700 | [diff] [blame] | 1814 | if (socinfo_get_pmic_model() == PMIC_MODEL_PM8917) { |
| 1815 | gpio = ISA1200_HAP_CLK_PM8917; |
| 1816 | clk_id = CLK_MP3_2; |
| 1817 | } |
| 1818 | |
| 1819 | gpio_set_value_cansleep(gpio, !!on); |
Anirudh Ghayal | 8c15f7f | 2012-01-09 14:04:02 +0530 | [diff] [blame] | 1820 | |
Amy Maloche | b20c105 | 2012-04-11 10:36:13 -0700 | [diff] [blame] | 1821 | if (on) |
David Collins | fd344aa | 2012-08-06 15:02:03 -0700 | [diff] [blame] | 1822 | rc = pm8xxx_aux_clk_control(clk_id, XO_DIV_1, true); |
Amy Maloche | b20c105 | 2012-04-11 10:36:13 -0700 | [diff] [blame] | 1823 | else |
David Collins | fd344aa | 2012-08-06 15:02:03 -0700 | [diff] [blame] | 1824 | rc = pm8xxx_aux_clk_control(clk_id, XO_DIV_NONE, true); |
Amy Maloche | b20c105 | 2012-04-11 10:36:13 -0700 | [diff] [blame] | 1825 | |
| 1826 | if (rc) { |
| 1827 | pr_err("%s: unable to write aux clock register(%d)\n", |
| 1828 | __func__, rc); |
| 1829 | } |
| 1830 | |
| 1831 | return rc; |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 1832 | } |
| 1833 | |
| 1834 | static int isa1200_dev_setup(bool enable) |
| 1835 | { |
David Collins | fd344aa | 2012-08-06 15:02:03 -0700 | [diff] [blame] | 1836 | unsigned int gpio = ISA1200_HAP_CLK_PM8038; |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 1837 | int rc = 0; |
| 1838 | |
David Collins | fd344aa | 2012-08-06 15:02:03 -0700 | [diff] [blame] | 1839 | if (socinfo_get_pmic_model() == PMIC_MODEL_PM8917) |
| 1840 | gpio = ISA1200_HAP_CLK_PM8917; |
| 1841 | |
Amy Maloche | b20c105 | 2012-04-11 10:36:13 -0700 | [diff] [blame] | 1842 | if (!enable) |
| 1843 | goto fail_gpio_dir; |
Anirudh Ghayal | 8c15f7f | 2012-01-09 14:04:02 +0530 | [diff] [blame] | 1844 | |
David Collins | fd344aa | 2012-08-06 15:02:03 -0700 | [diff] [blame] | 1845 | rc = gpio_request(gpio, "haptics_clk"); |
Anirudh Ghayal | 8c15f7f | 2012-01-09 14:04:02 +0530 | [diff] [blame] | 1846 | if (rc) { |
| 1847 | pr_err("%s: gpio_request for %d gpio failed rc(%d)\n", |
David Collins | fd344aa | 2012-08-06 15:02:03 -0700 | [diff] [blame] | 1848 | __func__, gpio, rc); |
Anirudh Ghayal | 8c15f7f | 2012-01-09 14:04:02 +0530 | [diff] [blame] | 1849 | goto fail_gpio_req; |
| 1850 | } |
| 1851 | |
David Collins | fd344aa | 2012-08-06 15:02:03 -0700 | [diff] [blame] | 1852 | rc = gpio_direction_output(gpio, 0); |
Anirudh Ghayal | 8c15f7f | 2012-01-09 14:04:02 +0530 | [diff] [blame] | 1853 | if (rc) { |
| 1854 | pr_err("%s: gpio_direction_output failed for %d gpio rc(%d)\n", |
David Collins | fd344aa | 2012-08-06 15:02:03 -0700 | [diff] [blame] | 1855 | __func__, gpio, rc); |
Anirudh Ghayal | 8c15f7f | 2012-01-09 14:04:02 +0530 | [diff] [blame] | 1856 | goto fail_gpio_dir; |
| 1857 | } |
| 1858 | |
| 1859 | return 0; |
| 1860 | |
| 1861 | fail_gpio_dir: |
David Collins | fd344aa | 2012-08-06 15:02:03 -0700 | [diff] [blame] | 1862 | gpio_free(gpio); |
Anirudh Ghayal | 8c15f7f | 2012-01-09 14:04:02 +0530 | [diff] [blame] | 1863 | fail_gpio_req: |
| 1864 | return rc; |
| 1865 | |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 1866 | } |
| 1867 | |
| 1868 | static struct isa1200_regulator isa1200_reg_data[] = { |
Anirudh Ghayal | 8c15f7f | 2012-01-09 14:04:02 +0530 | [diff] [blame] | 1869 | { |
| 1870 | .name = "vddp", |
| 1871 | .min_uV = ISA_I2C_VTG_MIN_UV, |
| 1872 | .max_uV = ISA_I2C_VTG_MAX_UV, |
| 1873 | .load_uA = ISA_I2C_CURR_UA, |
| 1874 | }, |
Amy Maloche | e8de95d | 2012-02-23 10:40:25 -0800 | [diff] [blame] | 1875 | { |
| 1876 | .name = "vcc_i2c", |
| 1877 | .min_uV = ISA_I2C_VTG_MIN_UV, |
| 1878 | .max_uV = ISA_I2C_VTG_MAX_UV, |
| 1879 | .load_uA = ISA_I2C_CURR_UA, |
| 1880 | }, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 1881 | }; |
| 1882 | |
| 1883 | static struct isa1200_platform_data isa1200_1_pdata = { |
| 1884 | .name = "vibrator", |
| 1885 | .dev_setup = isa1200_dev_setup, |
| 1886 | .power_on = isa1200_power, |
Anirudh Ghayal | 8c15f7f | 2012-01-09 14:04:02 +0530 | [diff] [blame] | 1887 | .hap_en_gpio = ISA1200_HAP_EN_GPIO, |
| 1888 | .hap_len_gpio = ISA1200_HAP_LEN_GPIO, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 1889 | .max_timeout = 15000, |
| 1890 | .mode_ctrl = PWM_GEN_MODE, |
| 1891 | .pwm_fd = { |
| 1892 | .pwm_div = 256, |
| 1893 | }, |
| 1894 | .is_erm = false, |
| 1895 | .smart_en = true, |
| 1896 | .ext_clk_en = true, |
| 1897 | .chip_en = 1, |
| 1898 | .regulator_info = isa1200_reg_data, |
| 1899 | .num_regulators = ARRAY_SIZE(isa1200_reg_data), |
| 1900 | }; |
| 1901 | |
| 1902 | static struct i2c_board_info msm_isa1200_board_info[] __initdata = { |
| 1903 | { |
| 1904 | I2C_BOARD_INFO("isa1200_1", 0x90>>1), |
| 1905 | .platform_data = &isa1200_1_pdata, |
| 1906 | }, |
| 1907 | }; |
| 1908 | |
Amy Maloche | f3c9db4 | 2011-12-08 15:17:35 -0800 | [diff] [blame] | 1909 | #define MXT_TS_GPIO_IRQ 11 |
| 1910 | #define MXT_TS_RESET_GPIO 52 |
| 1911 | |
Mohan Pallaka | 204b6f7 | 2012-07-09 14:44:10 +0530 | [diff] [blame] | 1912 | static const u8 mxt_config_data_8930_v1[] = { |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 1913 | /* T6 Object */ |
Amy Maloche | f3c9db4 | 2011-12-08 15:17:35 -0800 | [diff] [blame] | 1914 | 0, 0, 0, 0, 0, 0, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 1915 | /* T38 Object */ |
Mohan Pallaka | 84f72513 | 2012-05-17 16:38:56 +0530 | [diff] [blame] | 1916 | 15, 3, 0, 15, 12, 11, 0, 0, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 1917 | /* T7 Object */ |
Mohan Pallaka | 84f72513 | 2012-05-17 16:38:56 +0530 | [diff] [blame] | 1918 | 32, 16, 50, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 1919 | /* T8 Object */ |
Mohan Pallaka | 84f72513 | 2012-05-17 16:38:56 +0530 | [diff] [blame] | 1920 | 30, 0, 5, 1, 0, 0, 8, 8, 0, 0, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 1921 | /* T9 Object */ |
Mohan Pallaka | 84f72513 | 2012-05-17 16:38:56 +0530 | [diff] [blame] | 1922 | 131, 0, 0, 19, 11, 0, 16, 43, 2, 3, |
| 1923 | 10, 7, 2, 0, 4, 5, 35, 10, 43, 4, |
| 1924 | 54, 2, 15, 32, 38, 38, 143, 40, 143, 80, |
| 1925 | 7, 9, 50, 50, 2, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 1926 | /* T15 Object */ |
Amy Maloche | f3c9db4 | 2011-12-08 15:17:35 -0800 | [diff] [blame] | 1927 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 1928 | 0, |
| 1929 | /* T18 Object */ |
| 1930 | 0, 0, |
| 1931 | /* T19 Object */ |
| 1932 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 1933 | 0, 0, 0, 0, 0, 0, |
| 1934 | /* T23 Object */ |
| 1935 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 1936 | 0, 0, 0, 0, 0, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 1937 | /* T25 Object */ |
Amy Maloche | f3c9db4 | 2011-12-08 15:17:35 -0800 | [diff] [blame] | 1938 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 1939 | 0, 0, 0, 0, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 1940 | /* T40 Object */ |
Amy Maloche | f3c9db4 | 2011-12-08 15:17:35 -0800 | [diff] [blame] | 1941 | 0, 0, 0, 0, 0, |
| 1942 | /* T42 Object */ |
| 1943 | 0, 0, 0, 0, 0, 0, 0, 0, |
| 1944 | /* T46 Object */ |
Mohan Pallaka | 84f72513 | 2012-05-17 16:38:56 +0530 | [diff] [blame] | 1945 | 0, 3, 8, 16, 0, 0, 1, 0, 0, |
Amy Maloche | f3c9db4 | 2011-12-08 15:17:35 -0800 | [diff] [blame] | 1946 | /* T47 Object */ |
| 1947 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 1948 | /* T48 Object */ |
Mohan Pallaka | 84f72513 | 2012-05-17 16:38:56 +0530 | [diff] [blame] | 1949 | 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, |
| 1950 | 0, 0, 0, 0, 0, 0, 0, 100, 4, 64, |
| 1951 | 0, 0, 5, 42, 0, 0, 0, 0, 0, 0, |
Amy Maloche | f3c9db4 | 2011-12-08 15:17:35 -0800 | [diff] [blame] | 1952 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 1953 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 1954 | 0, 0, 0, 0, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 1955 | }; |
| 1956 | |
Mohan Pallaka | 204b6f7 | 2012-07-09 14:44:10 +0530 | [diff] [blame] | 1957 | static const u8 mxt_config_data_8930_v2[] = { |
| 1958 | /* T6 Object */ |
| 1959 | 0, 0, 0, 0, 0, 0, |
| 1960 | /* T38 Object */ |
| 1961 | 15, 4, 0, 9, 7, 12, 0, 0, |
| 1962 | /* T7 Object */ |
| 1963 | 32, 16, 50, |
| 1964 | /* T8 Object */ |
| 1965 | 30, 0, 5, 10, 0, 0, 10, 10, 0, 0, |
| 1966 | /* T9 Object */ |
| 1967 | 131, 0, 0, 19, 11, 0, 16, 50, 1, 3, |
| 1968 | 12, 7, 2, 0, 4, 5, 2, 10, 43, 4, |
| 1969 | 54, 2, -25, 29, 38, 18, 143, 40, 207, 80, |
| 1970 | 17, 5, 50, 50, 0, |
| 1971 | /* T18 Object */ |
| 1972 | 0, 0, |
| 1973 | /* T19 Object */ |
| 1974 | 0, 0, 0, 0, 0, 0, |
| 1975 | /* T25 Object */ |
| 1976 | 0, 0, 0, 0, 0, 0, |
| 1977 | /* T42 Object */ |
| 1978 | 3, 60, 20, 20, 150, 0, 0, 0, |
| 1979 | /* T46 Object */ |
| 1980 | 0, 3, 28, 28, 0, 0, 1, 0, 0, |
| 1981 | /* T47 Object */ |
| 1982 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 1983 | /* T48 Object */ |
| 1984 | 1, 3, 82, 0, 0, 0, 0, 0, 0, 0, |
| 1985 | 16, 30, 0, 6, 6, 0, 0, 124, 4, 100, |
| 1986 | 0, 0, 0, 5, 0, 42, 0, 1, 0, 40, |
| 1987 | 52, 20, 0, 0, 0, 50, 1, 5, 2, 1, |
| 1988 | 4, 5, 3, -25, 29, 38, 18, 143, 40, 207, |
| 1989 | 80, 10, 5, 2, |
| 1990 | /* T55 Object */ |
| 1991 | 0, 0, 0, 0, |
| 1992 | }; |
| 1993 | |
Amy Maloche | f3c9db4 | 2011-12-08 15:17:35 -0800 | [diff] [blame] | 1994 | static ssize_t mxt224e_vkeys_show(struct kobject *kobj, |
| 1995 | struct kobj_attribute *attr, char *buf) |
| 1996 | { |
| 1997 | return snprintf(buf, 200, |
Amy Maloche | f8130f9 | 2012-02-01 10:38:59 +0530 | [diff] [blame] | 1998 | __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":57:1030:90:90" |
| 1999 | ":" __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":206:1030:90:90" |
| 2000 | ":" __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":366:1030:90:90" |
| 2001 | ":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":503:1030:90:90" |
Amy Maloche | f3c9db4 | 2011-12-08 15:17:35 -0800 | [diff] [blame] | 2002 | "\n"); |
| 2003 | } |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 2004 | |
Amy Maloche | f3c9db4 | 2011-12-08 15:17:35 -0800 | [diff] [blame] | 2005 | static struct kobj_attribute mxt224e_vkeys_attr = { |
| 2006 | .attr = { |
| 2007 | .mode = S_IRUGO, |
| 2008 | }, |
| 2009 | .show = &mxt224e_vkeys_show, |
| 2010 | }; |
| 2011 | |
| 2012 | static struct attribute *mxt224e_properties_attrs[] = { |
| 2013 | &mxt224e_vkeys_attr.attr, |
| 2014 | NULL |
| 2015 | }; |
| 2016 | |
| 2017 | static struct attribute_group mxt224e_properties_attr_group = { |
| 2018 | .attrs = mxt224e_properties_attrs, |
| 2019 | }; |
| 2020 | |
| 2021 | static void mxt_init_vkeys_8930(void) |
| 2022 | { |
Steve Muckle | f132c6c | 2012-06-06 18:30:57 -0700 | [diff] [blame] | 2023 | int rc = 0; |
Amy Maloche | f3c9db4 | 2011-12-08 15:17:35 -0800 | [diff] [blame] | 2024 | static struct kobject *mxt224e_properties_kobj; |
| 2025 | |
| 2026 | mxt224e_vkeys_attr.attr.name = "virtualkeys.atmel_mxt_ts"; |
| 2027 | mxt224e_properties_kobj = kobject_create_and_add("board_properties", |
| 2028 | NULL); |
| 2029 | if (mxt224e_properties_kobj) |
| 2030 | rc = sysfs_create_group(mxt224e_properties_kobj, |
| 2031 | &mxt224e_properties_attr_group); |
| 2032 | if (!mxt224e_properties_kobj || rc) |
| 2033 | pr_err("%s: failed to create board_properties\n", |
| 2034 | __func__); |
| 2035 | |
| 2036 | return; |
| 2037 | } |
| 2038 | |
Jing Lin | dc4413c | 2012-01-16 15:22:52 -0800 | [diff] [blame] | 2039 | static struct mxt_config_info mxt_config_array[] = { |
| 2040 | { |
Mohan Pallaka | 204b6f7 | 2012-07-09 14:44:10 +0530 | [diff] [blame] | 2041 | .config = mxt_config_data_8930_v1, |
| 2042 | .config_length = ARRAY_SIZE(mxt_config_data_8930_v1), |
Jing Lin | dc4413c | 2012-01-16 15:22:52 -0800 | [diff] [blame] | 2043 | .family_id = 0x81, |
| 2044 | .variant_id = 0x01, |
| 2045 | .version = 0x10, |
| 2046 | .build = 0xAA, |
Mohan Pallaka | 204b6f7 | 2012-07-09 14:44:10 +0530 | [diff] [blame] | 2047 | .bootldr_id = MXT_BOOTLOADER_ID_224E, |
| 2048 | .fw_name = "atmel_8930_fluid_v2_0_AB.hex", |
| 2049 | }, |
| 2050 | { |
| 2051 | .config = mxt_config_data_8930_v2, |
| 2052 | .config_length = ARRAY_SIZE(mxt_config_data_8930_v2), |
| 2053 | .family_id = 0x81, |
| 2054 | .variant_id = 0x15, |
| 2055 | .version = 0x11, |
| 2056 | .build = 0xAA, |
| 2057 | .bootldr_id = MXT_BOOTLOADER_ID_224E, |
| 2058 | .fw_name = "atmel_8930_fluid_v2_0_AB.hex", |
| 2059 | }, |
| 2060 | { |
| 2061 | .config = mxt_config_data_8930_v2, |
| 2062 | .config_length = ARRAY_SIZE(mxt_config_data_8930_v2), |
| 2063 | .family_id = 0x81, |
| 2064 | .variant_id = 0x01, |
| 2065 | .version = 0x20, |
| 2066 | .build = 0xAB, |
| 2067 | .bootldr_id = MXT_BOOTLOADER_ID_224E, |
Jing Lin | dc4413c | 2012-01-16 15:22:52 -0800 | [diff] [blame] | 2068 | }, |
| 2069 | }; |
| 2070 | |
Amy Maloche | f3c9db4 | 2011-12-08 15:17:35 -0800 | [diff] [blame] | 2071 | static struct mxt_platform_data mxt_platform_data_8930 = { |
Jing Lin | dc4413c | 2012-01-16 15:22:52 -0800 | [diff] [blame] | 2072 | .config_array = mxt_config_array, |
| 2073 | .config_array_size = ARRAY_SIZE(mxt_config_array), |
Mohan Pallaka | 56a1a5d | 2012-02-23 12:05:13 -0800 | [diff] [blame] | 2074 | .panel_minx = 0, |
| 2075 | .panel_maxx = 566, |
| 2076 | .panel_miny = 0, |
| 2077 | .panel_maxy = 1067, |
| 2078 | .disp_minx = 0, |
| 2079 | .disp_maxx = 540, |
| 2080 | .disp_miny = 0, |
| 2081 | .disp_maxy = 960, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 2082 | .irqflags = IRQF_TRIGGER_FALLING, |
Anirudh Ghayal | d7ad84c | 2012-01-09 09:17:53 +0530 | [diff] [blame] | 2083 | #ifdef MSM8930_PHASE_2 |
| 2084 | .digital_pwr_regulator = true, |
| 2085 | #endif |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 2086 | .i2c_pull_up = true, |
Amy Maloche | f3c9db4 | 2011-12-08 15:17:35 -0800 | [diff] [blame] | 2087 | .reset_gpio = MXT_TS_RESET_GPIO, |
| 2088 | .irq_gpio = MXT_TS_GPIO_IRQ, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 2089 | }; |
| 2090 | |
Amy Maloche | f3c9db4 | 2011-12-08 15:17:35 -0800 | [diff] [blame] | 2091 | static struct i2c_board_info mxt_device_info_8930[] __initdata = { |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 2092 | { |
Amy Maloche | f3c9db4 | 2011-12-08 15:17:35 -0800 | [diff] [blame] | 2093 | I2C_BOARD_INFO("atmel_mxt_ts", 0x4a), |
| 2094 | .platform_data = &mxt_platform_data_8930, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 2095 | .irq = MSM_GPIO_TO_INT(MXT_TS_GPIO_IRQ), |
| 2096 | }, |
| 2097 | }; |
| 2098 | |
David Collins | fd344aa | 2012-08-06 15:02:03 -0700 | [diff] [blame] | 2099 | #define MHL_POWER_GPIO_PM8038 PM8038_GPIO_PM_TO_SYS(MHL_GPIO_PWR_EN) |
| 2100 | #define MHL_POWER_GPIO_PM8917 PM8917_GPIO_PM_TO_SYS(25) |
Manoj Rao | c6d904c | 2012-06-22 00:32:14 -0700 | [diff] [blame] | 2101 | static struct msm_mhl_platform_data mhl_platform_data = { |
| 2102 | .irq = MSM_GPIO_TO_INT(MHL_GPIO_INT), |
| 2103 | .gpio_mhl_int = MHL_GPIO_INT, |
| 2104 | .gpio_mhl_reset = MHL_GPIO_RESET, |
David Collins | fd344aa | 2012-08-06 15:02:03 -0700 | [diff] [blame] | 2105 | .gpio_mhl_power = MHL_POWER_GPIO_PM8038, |
Manoj Rao | c6d904c | 2012-06-22 00:32:14 -0700 | [diff] [blame] | 2106 | .gpio_hdmi_mhl_mux = HDMI_MHL_MUX_GPIO, |
| 2107 | }; |
| 2108 | |
| 2109 | static struct i2c_board_info sii_device_info[] __initdata = { |
| 2110 | { |
| 2111 | /* |
| 2112 | * keeps SI 8334 as the default |
| 2113 | * MHL TX |
| 2114 | */ |
| 2115 | I2C_BOARD_INFO("sii8334", 0x39), |
| 2116 | .platform_data = &mhl_platform_data, |
| 2117 | .flags = I2C_CLIENT_WAKE, |
| 2118 | }, |
| 2119 | }; |
| 2120 | |
| 2121 | |
Anirudh Ghayal | eb3af97 | 2011-12-13 17:29:06 +0530 | [diff] [blame] | 2122 | #ifdef MSM8930_PHASE_2 |
| 2123 | |
David Collins | fd344aa | 2012-08-06 15:02:03 -0700 | [diff] [blame] | 2124 | #define GPIO_VOLUME_UP_PM8038 PM8038_GPIO_PM_TO_SYS(3) |
| 2125 | #define GPIO_VOLUME_DOWN_PM8038 PM8038_GPIO_PM_TO_SYS(8) |
| 2126 | #define GPIO_CAMERA_SNAPSHOT_PM8038 PM8038_GPIO_PM_TO_SYS(10) |
| 2127 | #define GPIO_CAMERA_FOCUS_PM8038 PM8038_GPIO_PM_TO_SYS(11) |
Anirudh Ghayal | eb3af97 | 2011-12-13 17:29:06 +0530 | [diff] [blame] | 2128 | |
David Collins | fd344aa | 2012-08-06 15:02:03 -0700 | [diff] [blame] | 2129 | #define GPIO_VOLUME_UP_PM8917 PM8917_GPIO_PM_TO_SYS(27) |
| 2130 | #define GPIO_VOLUME_DOWN_PM8917 PM8917_GPIO_PM_TO_SYS(28) |
| 2131 | #define GPIO_CAMERA_SNAPSHOT_PM8917 PM8917_GPIO_PM_TO_SYS(36) |
| 2132 | #define GPIO_CAMERA_FOCUS_PM8917 PM8917_GPIO_PM_TO_SYS(37) |
| 2133 | |
| 2134 | static struct gpio_keys_button keys_8930_pm8038[] = { |
Anirudh Ghayal | eb3af97 | 2011-12-13 17:29:06 +0530 | [diff] [blame] | 2135 | { |
| 2136 | .code = KEY_VOLUMEUP, |
| 2137 | .type = EV_KEY, |
| 2138 | .desc = "volume_up", |
David Collins | fd344aa | 2012-08-06 15:02:03 -0700 | [diff] [blame] | 2139 | .gpio = GPIO_VOLUME_UP_PM8038, |
Anirudh Ghayal | eb3af97 | 2011-12-13 17:29:06 +0530 | [diff] [blame] | 2140 | .wakeup = 1, |
| 2141 | .active_low = 1, |
Amy Maloche | ff31a97 | 2012-06-06 15:28:54 -0700 | [diff] [blame] | 2142 | .debounce_interval = 15, |
Anirudh Ghayal | eb3af97 | 2011-12-13 17:29:06 +0530 | [diff] [blame] | 2143 | }, |
| 2144 | { |
| 2145 | .code = KEY_VOLUMEDOWN, |
| 2146 | .type = EV_KEY, |
| 2147 | .desc = "volume_down", |
David Collins | fd344aa | 2012-08-06 15:02:03 -0700 | [diff] [blame] | 2148 | .gpio = GPIO_VOLUME_DOWN_PM8038, |
Anirudh Ghayal | eb3af97 | 2011-12-13 17:29:06 +0530 | [diff] [blame] | 2149 | .wakeup = 1, |
| 2150 | .active_low = 1, |
Amy Maloche | ff31a97 | 2012-06-06 15:28:54 -0700 | [diff] [blame] | 2151 | .debounce_interval = 15, |
Anirudh Ghayal | eb3af97 | 2011-12-13 17:29:06 +0530 | [diff] [blame] | 2152 | }, |
| 2153 | { |
| 2154 | .code = KEY_CAMERA_FOCUS, |
| 2155 | .type = EV_KEY, |
| 2156 | .desc = "camera_focus", |
David Collins | fd344aa | 2012-08-06 15:02:03 -0700 | [diff] [blame] | 2157 | .gpio = GPIO_CAMERA_FOCUS_PM8038, |
Anirudh Ghayal | eb3af97 | 2011-12-13 17:29:06 +0530 | [diff] [blame] | 2158 | .wakeup = 1, |
| 2159 | .active_low = 1, |
Amy Maloche | ff31a97 | 2012-06-06 15:28:54 -0700 | [diff] [blame] | 2160 | .debounce_interval = 15, |
Anirudh Ghayal | eb3af97 | 2011-12-13 17:29:06 +0530 | [diff] [blame] | 2161 | }, |
| 2162 | { |
| 2163 | .code = KEY_CAMERA_SNAPSHOT, |
| 2164 | .type = EV_KEY, |
| 2165 | .desc = "camera_snapshot", |
David Collins | fd344aa | 2012-08-06 15:02:03 -0700 | [diff] [blame] | 2166 | .gpio = GPIO_CAMERA_SNAPSHOT_PM8038, |
| 2167 | .wakeup = 1, |
| 2168 | .active_low = 1, |
| 2169 | .debounce_interval = 15, |
| 2170 | }, |
| 2171 | }; |
| 2172 | |
| 2173 | static struct gpio_keys_button keys_8930_pm8917[] = { |
| 2174 | { |
| 2175 | .code = KEY_VOLUMEUP, |
| 2176 | .type = EV_KEY, |
| 2177 | .desc = "volume_up", |
| 2178 | .gpio = GPIO_VOLUME_UP_PM8917, |
| 2179 | .wakeup = 1, |
| 2180 | .active_low = 1, |
| 2181 | .debounce_interval = 15, |
| 2182 | }, |
| 2183 | { |
| 2184 | .code = KEY_VOLUMEDOWN, |
| 2185 | .type = EV_KEY, |
| 2186 | .desc = "volume_down", |
| 2187 | .gpio = GPIO_VOLUME_DOWN_PM8917, |
| 2188 | .wakeup = 1, |
| 2189 | .active_low = 1, |
| 2190 | .debounce_interval = 15, |
| 2191 | }, |
| 2192 | { |
| 2193 | .code = KEY_CAMERA_FOCUS, |
| 2194 | .type = EV_KEY, |
| 2195 | .desc = "camera_focus", |
| 2196 | .gpio = GPIO_CAMERA_FOCUS_PM8917, |
| 2197 | .wakeup = 1, |
| 2198 | .active_low = 1, |
| 2199 | .debounce_interval = 15, |
| 2200 | }, |
| 2201 | { |
| 2202 | .code = KEY_CAMERA_SNAPSHOT, |
| 2203 | .type = EV_KEY, |
| 2204 | .desc = "camera_snapshot", |
| 2205 | .gpio = GPIO_CAMERA_SNAPSHOT_PM8917, |
Anirudh Ghayal | eb3af97 | 2011-12-13 17:29:06 +0530 | [diff] [blame] | 2206 | .wakeup = 1, |
| 2207 | .active_low = 1, |
Amy Maloche | ff31a97 | 2012-06-06 15:28:54 -0700 | [diff] [blame] | 2208 | .debounce_interval = 15, |
Anirudh Ghayal | eb3af97 | 2011-12-13 17:29:06 +0530 | [diff] [blame] | 2209 | }, |
| 2210 | }; |
| 2211 | |
| 2212 | /* Add GPIO keys for 8930 */ |
| 2213 | static struct gpio_keys_platform_data gpio_keys_8930_pdata = { |
David Collins | fd344aa | 2012-08-06 15:02:03 -0700 | [diff] [blame] | 2214 | .buttons = keys_8930_pm8038, |
| 2215 | .nbuttons = ARRAY_SIZE(keys_8930_pm8038), |
Anirudh Ghayal | eb3af97 | 2011-12-13 17:29:06 +0530 | [diff] [blame] | 2216 | }; |
| 2217 | |
| 2218 | static struct platform_device gpio_keys_8930 = { |
| 2219 | .name = "gpio-keys", |
| 2220 | .id = -1, |
| 2221 | .dev = { |
| 2222 | .platform_data = &gpio_keys_8930_pdata, |
| 2223 | }, |
| 2224 | }; |
| 2225 | #endif /* MSM8930_PHASE_2 */ |
| 2226 | |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 2227 | static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi4_pdata = { |
| 2228 | .clk_freq = 100000, |
| 2229 | .src_clk_rate = 24000000, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 2230 | }; |
| 2231 | |
| 2232 | static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi3_pdata = { |
| 2233 | .clk_freq = 100000, |
| 2234 | .src_clk_rate = 24000000, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 2235 | }; |
| 2236 | |
Harini Jayaraman | fe6ff416 | 2012-03-14 11:25:40 -0600 | [diff] [blame] | 2237 | static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi9_pdata = { |
| 2238 | .clk_freq = 100000, |
| 2239 | .src_clk_rate = 24000000, |
| 2240 | }; |
| 2241 | |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 2242 | static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi10_pdata = { |
| 2243 | .clk_freq = 100000, |
| 2244 | .src_clk_rate = 24000000, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 2245 | }; |
| 2246 | |
| 2247 | static struct msm_i2c_platform_data msm8960_i2c_qup_gsbi12_pdata = { |
| 2248 | .clk_freq = 100000, |
| 2249 | .src_clk_rate = 24000000, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 2250 | }; |
| 2251 | |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 2252 | |
| 2253 | static struct ks8851_pdata spi_eth_pdata = { |
| 2254 | .irq_gpio = KS8851_IRQ_GPIO, |
| 2255 | .rst_gpio = KS8851_RST_GPIO, |
| 2256 | }; |
| 2257 | |
| 2258 | static struct spi_board_info spi_board_info[] __initdata = { |
| 2259 | { |
| 2260 | .modalias = "ks8851", |
| 2261 | .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO), |
| 2262 | .max_speed_hz = 19200000, |
| 2263 | .bus_num = 0, |
| 2264 | .chip_select = 0, |
| 2265 | .mode = SPI_MODE_0, |
| 2266 | .platform_data = &spi_eth_pdata |
| 2267 | }, |
| 2268 | { |
| 2269 | .modalias = "dsi_novatek_3d_panel_spi", |
| 2270 | .max_speed_hz = 10800000, |
| 2271 | .bus_num = 0, |
| 2272 | .chip_select = 1, |
| 2273 | .mode = SPI_MODE_0, |
| 2274 | }, |
| 2275 | }; |
| 2276 | |
| 2277 | static struct platform_device msm_device_saw_core0 = { |
Jay Chokshi | 06fa754 | 2011-12-07 13:09:17 -0800 | [diff] [blame] | 2278 | .name = "saw-regulator", |
| 2279 | .id = 0, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 2280 | .dev = { |
David Collins | 4614cb9 | 2012-08-20 12:17:09 -0700 | [diff] [blame] | 2281 | .platform_data = &msm8930_pm8038_saw_regulator_core0_pdata, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 2282 | }, |
| 2283 | }; |
| 2284 | |
| 2285 | static struct platform_device msm_device_saw_core1 = { |
Jay Chokshi | 06fa754 | 2011-12-07 13:09:17 -0800 | [diff] [blame] | 2286 | .name = "saw-regulator", |
| 2287 | .id = 1, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 2288 | .dev = { |
David Collins | 4614cb9 | 2012-08-20 12:17:09 -0700 | [diff] [blame] | 2289 | .platform_data = &msm8930_pm8038_saw_regulator_core1_pdata, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 2290 | }, |
| 2291 | }; |
| 2292 | |
| 2293 | static struct tsens_platform_data msm_tsens_pdata = { |
Jay Chokshi | 06fa754 | 2011-12-07 13:09:17 -0800 | [diff] [blame] | 2294 | .tsens_factor = 1000, |
Siddartha Mohanadoss | 9742512 | 2012-03-09 12:06:54 -0800 | [diff] [blame] | 2295 | .hw_type = APQ_8064, |
Siddartha Mohanadoss | 892ee47 | 2012-05-03 10:35:20 -0700 | [diff] [blame] | 2296 | .tsens_num_sensor = 10, |
| 2297 | .slope = {1132, 1135, 1137, 1135, 1157, |
| 2298 | 1142, 1124, 1153, 1175, 1166}, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 2299 | }; |
| 2300 | |
Siddartha Mohanadoss | 48cad91 | 2012-04-05 21:29:54 -0700 | [diff] [blame] | 2301 | static struct platform_device msm_tsens_device = { |
| 2302 | .name = "tsens8960-tm", |
| 2303 | .id = -1, |
| 2304 | }; |
| 2305 | |
Praveen Chidambaram | 877d7a4 | 2012-06-05 14:33:20 -0600 | [diff] [blame] | 2306 | static struct msm_thermal_data msm_thermal_pdata = { |
| 2307 | .sensor_id = 9, |
Eugene Seah | 2ee4a5d | 2012-06-25 18:16:41 -0600 | [diff] [blame] | 2308 | .poll_ms = 250, |
| 2309 | .limit_temp_degC = 60, |
| 2310 | .temp_hysteresis_degC = 10, |
| 2311 | .freq_step = 2, |
Praveen Chidambaram | 877d7a4 | 2012-06-05 14:33:20 -0600 | [diff] [blame] | 2312 | }; |
| 2313 | |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 2314 | #ifdef CONFIG_MSM_FAKE_BATTERY |
| 2315 | static struct platform_device fish_battery_device = { |
| 2316 | .name = "fish_battery", |
| 2317 | }; |
| 2318 | #endif |
| 2319 | |
David Collins | 1d4061b | 2011-12-06 15:36:40 -0800 | [diff] [blame] | 2320 | #ifndef MSM8930_PHASE_2 |
| 2321 | |
| 2322 | /* 8930 Phase 1 */ |
Jay Chokshi | 06fa754 | 2011-12-07 13:09:17 -0800 | [diff] [blame] | 2323 | static struct platform_device msm8930_device_ext_5v_vreg __devinitdata = { |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 2324 | .name = GPIO_REGULATOR_DEV_NAME, |
| 2325 | .id = PM8921_MPP_PM_TO_SYS(7), |
| 2326 | .dev = { |
| 2327 | .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V], |
| 2328 | }, |
| 2329 | }; |
| 2330 | |
Jay Chokshi | 06fa754 | 2011-12-07 13:09:17 -0800 | [diff] [blame] | 2331 | static struct platform_device msm8930_device_ext_l2_vreg __devinitdata = { |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 2332 | .name = GPIO_REGULATOR_DEV_NAME, |
| 2333 | .id = 91, |
| 2334 | .dev = { |
| 2335 | .platform_data = &msm_gpio_regulator_pdata[GPIO_VREG_ID_EXT_L2], |
| 2336 | }, |
| 2337 | }; |
| 2338 | |
David Collins | 1d4061b | 2011-12-06 15:36:40 -0800 | [diff] [blame] | 2339 | #else |
| 2340 | |
| 2341 | /* 8930 Phase 2 */ |
| 2342 | static struct platform_device msm8930_device_ext_5v_vreg __devinitdata = { |
| 2343 | .name = GPIO_REGULATOR_DEV_NAME, |
| 2344 | .id = 63, |
| 2345 | .dev = { |
David Collins | 4614cb9 | 2012-08-20 12:17:09 -0700 | [diff] [blame] | 2346 | .platform_data = &msm8930_pm8038_gpio_regulator_pdata[ |
| 2347 | MSM8930_GPIO_VREG_ID_EXT_5V], |
David Collins | 1d4061b | 2011-12-06 15:36:40 -0800 | [diff] [blame] | 2348 | }, |
| 2349 | }; |
| 2350 | |
| 2351 | static struct platform_device msm8930_device_ext_otg_sw_vreg __devinitdata = { |
| 2352 | .name = GPIO_REGULATOR_DEV_NAME, |
| 2353 | .id = 97, |
| 2354 | .dev = { |
David Collins | 4614cb9 | 2012-08-20 12:17:09 -0700 | [diff] [blame] | 2355 | .platform_data = &msm8930_pm8038_gpio_regulator_pdata[ |
| 2356 | MSM8930_GPIO_VREG_ID_EXT_OTG_SW], |
David Collins | 1d4061b | 2011-12-06 15:36:40 -0800 | [diff] [blame] | 2357 | }, |
| 2358 | }; |
| 2359 | |
| 2360 | #endif |
| 2361 | |
Jay Chokshi | 06fa754 | 2011-12-07 13:09:17 -0800 | [diff] [blame] | 2362 | static struct platform_device msm8930_device_rpm_regulator __devinitdata = { |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 2363 | .name = "rpm-regulator", |
| 2364 | .id = -1, |
| 2365 | .dev = { |
David Collins | 8af872e | 2012-01-06 11:31:56 -0800 | [diff] [blame] | 2366 | #ifndef MSM8930_PHASE_2 |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 2367 | .platform_data = &msm_rpm_regulator_pdata, |
David Collins | 8af872e | 2012-01-06 11:31:56 -0800 | [diff] [blame] | 2368 | #else |
David Collins | 4614cb9 | 2012-08-20 12:17:09 -0700 | [diff] [blame] | 2369 | .platform_data = &msm8930_pm8038_rpm_regulator_pdata, |
Jay Chokshi | 06fa754 | 2011-12-07 13:09:17 -0800 | [diff] [blame] | 2370 | #endif |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 2371 | }, |
| 2372 | }; |
| 2373 | |
David Collins | 4614cb9 | 2012-08-20 12:17:09 -0700 | [diff] [blame] | 2374 | static struct platform_device *early_common_devices[] __initdata = { |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 2375 | &msm8960_device_dmov, |
| 2376 | &msm_device_smd, |
| 2377 | &msm8960_device_uart_gsbi5, |
| 2378 | &msm_device_uart_dm6, |
| 2379 | &msm_device_saw_core0, |
| 2380 | &msm_device_saw_core1, |
David Collins | 4614cb9 | 2012-08-20 12:17:09 -0700 | [diff] [blame] | 2381 | }; |
| 2382 | |
| 2383 | /* ext_5v and ext_otg_sw are present when using PM8038 */ |
| 2384 | static struct platform_device *pmic_pm8038_devices[] __initdata = { |
Jay Chokshi | 06fa754 | 2011-12-07 13:09:17 -0800 | [diff] [blame] | 2385 | &msm8930_device_ext_5v_vreg, |
David Collins | 1d4061b | 2011-12-06 15:36:40 -0800 | [diff] [blame] | 2386 | #ifndef MSM8930_PHASE_2 |
Jay Chokshi | 06fa754 | 2011-12-07 13:09:17 -0800 | [diff] [blame] | 2387 | &msm8930_device_ext_l2_vreg, |
David Collins | 1d4061b | 2011-12-06 15:36:40 -0800 | [diff] [blame] | 2388 | #endif |
Jay Chokshi | 33c044a | 2011-12-07 13:05:40 -0800 | [diff] [blame] | 2389 | &msm8960_device_ssbi_pmic, |
David Collins | 1d4061b | 2011-12-06 15:36:40 -0800 | [diff] [blame] | 2390 | #ifdef MSM8930_PHASE_2 |
| 2391 | &msm8930_device_ext_otg_sw_vreg, |
| 2392 | #endif |
David Collins | 4614cb9 | 2012-08-20 12:17:09 -0700 | [diff] [blame] | 2393 | }; |
| 2394 | |
| 2395 | /* ext_5v and ext_otg_sw are not present when using PM8917 */ |
| 2396 | static struct platform_device *pmic_pm8917_devices[] __initdata = { |
| 2397 | &msm8960_device_ssbi_pmic, |
| 2398 | }; |
| 2399 | |
| 2400 | static struct platform_device *common_devices[] __initdata = { |
Stephen Boyd | 28d5495 | 2011-12-16 13:19:51 -0800 | [diff] [blame] | 2401 | &msm_8960_q6_lpass, |
Stephen Boyd | 322a992 | 2011-09-20 01:05:54 -0700 | [diff] [blame] | 2402 | &msm_8960_riva, |
Stephen Boyd | d89eebe | 2011-09-28 23:28:11 -0700 | [diff] [blame] | 2403 | &msm_pil_tzapps, |
Stephen Boyd | 7b973de | 2012-03-09 12:26:16 -0800 | [diff] [blame] | 2404 | &msm_pil_vidc, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 2405 | &msm8960_device_qup_spi_gsbi1, |
| 2406 | &msm8960_device_qup_i2c_gsbi3, |
| 2407 | &msm8960_device_qup_i2c_gsbi4, |
Harini Jayaraman | fe6ff416 | 2012-03-14 11:25:40 -0600 | [diff] [blame] | 2408 | &msm8960_device_qup_i2c_gsbi9, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 2409 | &msm8960_device_qup_i2c_gsbi10, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 2410 | &msm8960_device_qup_i2c_gsbi12, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 2411 | &msm_slim_ctrl, |
| 2412 | &msm_device_wcnss_wlan, |
Ramesh Masavarapu | a26cce7 | 2012-04-09 12:32:25 -0700 | [diff] [blame] | 2413 | #if defined(CONFIG_QSEECOM) |
| 2414 | &qseecom_device, |
| 2415 | #endif |
| 2416 | |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 2417 | #if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \ |
| 2418 | defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) |
| 2419 | &qcrypto_device, |
| 2420 | #endif |
| 2421 | |
| 2422 | #if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \ |
| 2423 | defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE) |
| 2424 | &qcedev_device, |
| 2425 | #endif |
| 2426 | #ifdef CONFIG_MSM_ROTATOR |
| 2427 | &msm_rotator_device, |
| 2428 | #endif |
| 2429 | &msm_device_sps, |
| 2430 | #ifdef CONFIG_MSM_FAKE_BATTERY |
| 2431 | &fish_battery_device, |
| 2432 | #endif |
| 2433 | #ifdef CONFIG_ANDROID_PMEM |
| 2434 | #ifndef CONFIG_MSM_MULTIMEDIA_USE_ION |
Laura Abbott | b93525f | 2012-04-12 09:57:19 -0700 | [diff] [blame] | 2435 | &msm8930_android_pmem_device, |
| 2436 | &msm8930_android_pmem_adsp_device, |
| 2437 | &msm8930_android_pmem_audio_device, |
Asish Bhattacharya | 5d63c4b | 2012-04-12 08:41:12 +0530 | [diff] [blame] | 2438 | #endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/ |
| 2439 | #endif /*CONFIG_ANDROID_PMEM*/ |
Hanumant Singh | eea6256 | 2012-05-14 11:32:45 -0700 | [diff] [blame] | 2440 | &msm8930_fmem_device, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 2441 | &msm_device_bam_dmux, |
| 2442 | &msm_fm_platform_init, |
| 2443 | |
| 2444 | #ifdef CONFIG_HW_RANDOM_MSM |
| 2445 | &msm_device_rng, |
| 2446 | #endif |
Praveen Chidambaram | 7849901 | 2011-11-01 17:15:17 -0600 | [diff] [blame] | 2447 | &msm8930_rpm_device, |
| 2448 | &msm8930_rpm_log_device, |
Girish Mahadevan | 898c56d | 2012-06-05 16:09:19 -0600 | [diff] [blame] | 2449 | &msm8930_rpm_rbcpr_device, |
Praveen Chidambaram | 7849901 | 2011-11-01 17:15:17 -0600 | [diff] [blame] | 2450 | &msm8930_rpm_stat_device, |
Anji Jonnala | 9312992 | 2012-10-09 20:57:53 +0530 | [diff] [blame] | 2451 | &msm8930_rpm_master_stat_device, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 2452 | #ifdef CONFIG_ION_MSM |
Laura Abbott | b93525f | 2012-04-12 09:57:19 -0700 | [diff] [blame] | 2453 | &msm8930_ion_dev, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 2454 | #endif |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 2455 | &msm_device_tz_log, |
Pratik Patel | 3b0ca88 | 2012-06-01 16:54:14 -0700 | [diff] [blame] | 2456 | &coresight_tpiu_device, |
| 2457 | &coresight_etb_device, |
| 2458 | &coresight_funnel_device, |
| 2459 | &coresight_etm0_device, |
| 2460 | &coresight_etm1_device, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 2461 | &msm_device_dspcrashd_8960, |
| 2462 | &msm8960_device_watchdog, |
Anirudh Ghayal | eb3af97 | 2011-12-13 17:29:06 +0530 | [diff] [blame] | 2463 | #ifdef MSM8930_PHASE_2 |
| 2464 | &gpio_keys_8930, |
| 2465 | #endif |
Laura Abbott | b93525f | 2012-04-12 09:57:19 -0700 | [diff] [blame] | 2466 | &msm8930_rtb_device, |
Gagan Mac | cd5b327 | 2012-02-09 18:13:10 -0700 | [diff] [blame] | 2467 | &msm_bus_8930_apps_fabric, |
| 2468 | &msm_bus_8930_sys_fabric, |
| 2469 | &msm_bus_8930_mm_fabric, |
| 2470 | &msm_bus_8930_sys_fpb, |
| 2471 | &msm_bus_8930_cpss_fpb, |
Stepan Moskovchenko | 28662c5 | 2012-03-01 12:48:45 -0800 | [diff] [blame] | 2472 | &msm8960_device_cache_erp, |
Laura Abbott | 0577d7b | 2012-04-17 11:14:30 -0700 | [diff] [blame] | 2473 | &msm8930_iommu_domain_device, |
Siddartha Mohanadoss | 48cad91 | 2012-04-05 21:29:54 -0700 | [diff] [blame] | 2474 | &msm_tsens_device, |
Laura Abbott | f317304 | 2012-05-29 15:23:18 -0700 | [diff] [blame] | 2475 | &msm8930_cache_dump_device, |
Anji Jonnala | f91d897 | 2013-02-26 17:55:50 +0530 | [diff] [blame] | 2476 | &msm8930_cpu_slp_status, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 2477 | }; |
| 2478 | |
| 2479 | static struct platform_device *cdp_devices[] __initdata = { |
| 2480 | &msm8960_device_otg, |
| 2481 | &msm8960_device_gadget_peripheral, |
| 2482 | &msm_device_hsusb_host, |
| 2483 | &android_usb_device, |
| 2484 | &msm_pcm, |
| 2485 | &msm_pcm_routing, |
| 2486 | &msm_cpudai0, |
| 2487 | &msm_cpudai1, |
| 2488 | &msm_cpudai_hdmi_rx, |
| 2489 | &msm_cpudai_bt_rx, |
| 2490 | &msm_cpudai_bt_tx, |
| 2491 | &msm_cpudai_fm_rx, |
| 2492 | &msm_cpudai_fm_tx, |
| 2493 | &msm_cpudai_auxpcm_rx, |
| 2494 | &msm_cpudai_auxpcm_tx, |
| 2495 | &msm_cpu_fe, |
| 2496 | &msm_stub_codec, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 2497 | #ifdef CONFIG_MSM_GEMINI |
| 2498 | &msm8960_gemini_device, |
| 2499 | #endif |
| 2500 | &msm_voice, |
| 2501 | &msm_voip, |
| 2502 | &msm_lpa_pcm, |
| 2503 | &msm_cpudai_afe_01_rx, |
| 2504 | &msm_cpudai_afe_01_tx, |
| 2505 | &msm_cpudai_afe_02_rx, |
| 2506 | &msm_cpudai_afe_02_tx, |
| 2507 | &msm_pcm_afe, |
Ajay Dudani | 79e268c | 2011-12-28 13:14:44 -0800 | [diff] [blame] | 2508 | &msm_compr_dsp, |
| 2509 | &msm_cpudai_incall_music_rx, |
| 2510 | &msm_cpudai_incall_record_rx, |
| 2511 | &msm_cpudai_incall_record_tx, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 2512 | &msm_pcm_hostless, |
Asish Bhattacharya | 705c673 | 2012-08-14 23:22:55 +0530 | [diff] [blame] | 2513 | &msm_multi_ch_pcm, |
Jayasena Sangaraboina | 99bf09c | 2012-07-17 12:03:08 -0700 | [diff] [blame] | 2514 | &msm_lowlatency_pcm, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 2515 | }; |
| 2516 | |
| 2517 | static void __init msm8930_i2c_init(void) |
| 2518 | { |
| 2519 | msm8960_device_qup_i2c_gsbi4.dev.platform_data = |
| 2520 | &msm8960_i2c_qup_gsbi4_pdata; |
| 2521 | |
| 2522 | msm8960_device_qup_i2c_gsbi3.dev.platform_data = |
| 2523 | &msm8960_i2c_qup_gsbi3_pdata; |
| 2524 | |
Harini Jayaraman | fe6ff416 | 2012-03-14 11:25:40 -0600 | [diff] [blame] | 2525 | msm8960_device_qup_i2c_gsbi9.dev.platform_data = |
| 2526 | &msm8960_i2c_qup_gsbi9_pdata; |
| 2527 | |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 2528 | msm8960_device_qup_i2c_gsbi10.dev.platform_data = |
| 2529 | &msm8960_i2c_qup_gsbi10_pdata; |
| 2530 | |
| 2531 | msm8960_device_qup_i2c_gsbi12.dev.platform_data = |
| 2532 | &msm8960_i2c_qup_gsbi12_pdata; |
| 2533 | } |
| 2534 | |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 2535 | static struct msm_rpmrs_level msm_rpmrs_levels[] __initdata = { |
| 2536 | { |
| 2537 | MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT, |
| 2538 | MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE), |
| 2539 | true, |
Girish Mahadevan | 9bf7156 | 2012-04-13 14:41:44 -0600 | [diff] [blame] | 2540 | 1, 784, 180000, 100, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 2541 | }, |
| 2542 | |
| 2543 | { |
Girish Mahadevan | 3bc9877 | 2012-08-15 10:01:27 -0600 | [diff] [blame] | 2544 | MSM_PM_SLEEP_MODE_RETENTION, |
| 2545 | MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE), |
| 2546 | true, |
| 2547 | 415, 715, 340827, 475, |
| 2548 | }, |
| 2549 | |
| 2550 | { |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 2551 | MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE, |
| 2552 | MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE), |
| 2553 | true, |
Girish Mahadevan | 9bf7156 | 2012-04-13 14:41:44 -0600 | [diff] [blame] | 2554 | 1300, 228, 1200000, 2000, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 2555 | }, |
| 2556 | |
| 2557 | { |
| 2558 | MSM_PM_SLEEP_MODE_POWER_COLLAPSE, |
| 2559 | MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE), |
| 2560 | false, |
Girish Mahadevan | 9bf7156 | 2012-04-13 14:41:44 -0600 | [diff] [blame] | 2561 | 2000, 138, 1208400, 3200, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 2562 | }, |
| 2563 | |
| 2564 | { |
| 2565 | MSM_PM_SLEEP_MODE_POWER_COLLAPSE, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 2566 | MSM_RPMRS_LIMITS(ON, HSFS_OPEN, ACTIVE, RET_HIGH), |
| 2567 | false, |
Girish Mahadevan | 9bf7156 | 2012-04-13 14:41:44 -0600 | [diff] [blame] | 2568 | 6000, 119, 1850300, 9000, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 2569 | }, |
| 2570 | |
| 2571 | { |
| 2572 | MSM_PM_SLEEP_MODE_POWER_COLLAPSE, |
| 2573 | MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE), |
| 2574 | false, |
Girish Mahadevan | 9bf7156 | 2012-04-13 14:41:44 -0600 | [diff] [blame] | 2575 | 9200, 68, 2839200, 16400, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 2576 | }, |
| 2577 | |
| 2578 | { |
| 2579 | MSM_PM_SLEEP_MODE_POWER_COLLAPSE, |
| 2580 | MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE), |
| 2581 | false, |
Girish Mahadevan | 9bf7156 | 2012-04-13 14:41:44 -0600 | [diff] [blame] | 2582 | 10300, 63, 3128000, 18200, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 2583 | }, |
| 2584 | |
| 2585 | { |
| 2586 | MSM_PM_SLEEP_MODE_POWER_COLLAPSE, |
| 2587 | MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH), |
| 2588 | false, |
Girish Mahadevan | 9bf7156 | 2012-04-13 14:41:44 -0600 | [diff] [blame] | 2589 | 18000, 10, 4602600, 27000, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 2590 | }, |
| 2591 | |
| 2592 | { |
| 2593 | MSM_PM_SLEEP_MODE_POWER_COLLAPSE, |
| 2594 | MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW), |
| 2595 | false, |
Girish Mahadevan | 9bf7156 | 2012-04-13 14:41:44 -0600 | [diff] [blame] | 2596 | 20000, 2, 5752000, 32000, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 2597 | }, |
| 2598 | }; |
| 2599 | |
Praveen Chidambaram | 7849901 | 2011-11-01 17:15:17 -0600 | [diff] [blame] | 2600 | static struct msm_rpmrs_platform_data msm_rpmrs_data __initdata = { |
| 2601 | .levels = &msm_rpmrs_levels[0], |
| 2602 | .num_levels = ARRAY_SIZE(msm_rpmrs_levels), |
| 2603 | .vdd_mem_levels = { |
| 2604 | [MSM_RPMRS_VDD_MEM_RET_LOW] = 750000, |
| 2605 | [MSM_RPMRS_VDD_MEM_RET_HIGH] = 750000, |
| 2606 | [MSM_RPMRS_VDD_MEM_ACTIVE] = 1050000, |
| 2607 | [MSM_RPMRS_VDD_MEM_MAX] = 1150000, |
| 2608 | }, |
| 2609 | .vdd_dig_levels = { |
Mahesh Sivasubramanian | 745e16e | 2012-05-21 11:52:04 -0600 | [diff] [blame] | 2610 | [MSM_RPMRS_VDD_DIG_RET_LOW] = 0, |
| 2611 | [MSM_RPMRS_VDD_DIG_RET_HIGH] = 0, |
| 2612 | [MSM_RPMRS_VDD_DIG_ACTIVE] = 1, |
| 2613 | [MSM_RPMRS_VDD_DIG_MAX] = 3, |
Praveen Chidambaram | 7849901 | 2011-11-01 17:15:17 -0600 | [diff] [blame] | 2614 | }, |
| 2615 | .vdd_mask = 0x7FFFFF, |
| 2616 | .rpmrs_target_id = { |
| 2617 | [MSM_RPMRS_ID_PXO_CLK] = MSM_RPM_ID_PXO_CLK, |
| 2618 | [MSM_RPMRS_ID_L2_CACHE_CTL] = MSM_RPM_ID_LAST, |
Mahesh Sivasubramanian | 745e16e | 2012-05-21 11:52:04 -0600 | [diff] [blame] | 2619 | [MSM_RPMRS_ID_VDD_DIG_0] = MSM_RPM_ID_VOLTAGE_CORNER, |
| 2620 | [MSM_RPMRS_ID_VDD_DIG_1] = MSM_RPM_ID_LAST, |
Praveen Chidambaram | 7849901 | 2011-11-01 17:15:17 -0600 | [diff] [blame] | 2621 | [MSM_RPMRS_ID_VDD_MEM_0] = MSM_RPM_ID_PM8038_L24_0, |
| 2622 | [MSM_RPMRS_ID_VDD_MEM_1] = MSM_RPM_ID_PM8038_L24_1, |
| 2623 | [MSM_RPMRS_ID_RPM_CTL] = MSM_RPM_ID_RPM_CTL, |
| 2624 | }, |
| 2625 | }; |
| 2626 | |
Praveen Chidambaram | 75b8c81 | 2012-08-10 16:26:37 -0600 | [diff] [blame] | 2627 | static struct msm_rpmrs_platform_data msm_rpmrs_data_pm8917 __initdata = { |
| 2628 | .levels = &msm_rpmrs_levels[0], |
| 2629 | .num_levels = ARRAY_SIZE(msm_rpmrs_levels), |
| 2630 | .vdd_mem_levels = { |
| 2631 | [MSM_RPMRS_VDD_MEM_RET_LOW] = 750000, |
| 2632 | [MSM_RPMRS_VDD_MEM_RET_HIGH] = 750000, |
| 2633 | [MSM_RPMRS_VDD_MEM_ACTIVE] = 1050000, |
| 2634 | [MSM_RPMRS_VDD_MEM_MAX] = 1150000, |
| 2635 | }, |
| 2636 | .vdd_dig_levels = { |
| 2637 | [MSM_RPMRS_VDD_DIG_RET_LOW] = 0, |
| 2638 | [MSM_RPMRS_VDD_DIG_RET_HIGH] = 0, |
| 2639 | [MSM_RPMRS_VDD_DIG_ACTIVE] = 1, |
| 2640 | [MSM_RPMRS_VDD_DIG_MAX] = 3, |
| 2641 | }, |
| 2642 | .vdd_mask = 0x7FFFFF, |
| 2643 | .rpmrs_target_id = { |
| 2644 | [MSM_RPMRS_ID_PXO_CLK] = MSM_RPM_ID_PXO_CLK, |
| 2645 | [MSM_RPMRS_ID_L2_CACHE_CTL] = MSM_RPM_ID_LAST, |
| 2646 | [MSM_RPMRS_ID_VDD_DIG_0] = MSM_RPM_ID_VOLTAGE_CORNER, |
| 2647 | [MSM_RPMRS_ID_VDD_DIG_1] = MSM_RPM_ID_LAST, |
| 2648 | [MSM_RPMRS_ID_VDD_MEM_0] = MSM_RPM_ID_PM8917_L24_0, |
| 2649 | [MSM_RPMRS_ID_VDD_MEM_1] = MSM_RPM_ID_PM8917_L24_1, |
| 2650 | [MSM_RPMRS_ID_RPM_CTL] = MSM_RPM_ID_RPM_CTL, |
| 2651 | }, |
| 2652 | }; |
| 2653 | |
Maheshkumar Sivasubramanian | c6c5503 | 2011-10-25 16:01:32 -0600 | [diff] [blame] | 2654 | static struct msm_pm_boot_platform_data msm_pm_boot_pdata __initdata = { |
| 2655 | .mode = MSM_PM_BOOT_CONFIG_TZ, |
| 2656 | }; |
| 2657 | |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 2658 | #ifdef CONFIG_I2C |
| 2659 | #define I2C_SURF 1 |
| 2660 | #define I2C_FFA (1 << 1) |
| 2661 | #define I2C_RUMI (1 << 2) |
| 2662 | #define I2C_SIM (1 << 3) |
| 2663 | #define I2C_FLUID (1 << 4) |
| 2664 | #define I2C_LIQUID (1 << 5) |
| 2665 | |
| 2666 | struct i2c_registry { |
| 2667 | u8 machs; |
| 2668 | int bus; |
| 2669 | struct i2c_board_info *info; |
| 2670 | int len; |
| 2671 | }; |
| 2672 | |
Wentao Xu | f59ce4e | 2012-05-22 17:30:13 -0400 | [diff] [blame] | 2673 | #ifdef CONFIG_INPUT_MPU3050 |
| 2674 | #define MPU3050_INT_GPIO 69 |
| 2675 | |
| 2676 | static struct mpu3050_gyro_platform_data mpu3050_gyro = { |
| 2677 | .gpio_int = MPU3050_INT_GPIO, |
| 2678 | }; |
| 2679 | |
| 2680 | static struct i2c_board_info __initdata mpu3050_i2c_boardinfo[] = { |
| 2681 | { |
| 2682 | I2C_BOARD_INFO("mpu3050", 0x68), |
Wentao Xu | c7769c0 | 2012-08-03 15:06:41 -0400 | [diff] [blame] | 2683 | .irq = MSM_GPIO_TO_INT(MPU3050_INT_GPIO), |
Wentao Xu | f59ce4e | 2012-05-22 17:30:13 -0400 | [diff] [blame] | 2684 | .platform_data = &mpu3050_gyro, |
| 2685 | }, |
| 2686 | }; |
| 2687 | #endif |
| 2688 | |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 2689 | #ifdef CONFIG_ISL9519_CHARGER |
| 2690 | static struct isl_platform_data isl_data __initdata = { |
| 2691 | .valid_n_gpio = 0, /* Not required when notify-by-pmic */ |
| 2692 | .chg_detection_config = NULL, /* Not required when notify-by-pmic */ |
| 2693 | .max_system_voltage = 4200, |
| 2694 | .min_system_voltage = 3200, |
| 2695 | .chgcurrent = 1000, /* 1900, */ |
| 2696 | .term_current = 400, /* Need fine tuning */ |
| 2697 | .input_current = 2048, |
| 2698 | }; |
| 2699 | |
| 2700 | static struct i2c_board_info isl_charger_i2c_info[] __initdata = { |
| 2701 | { |
| 2702 | I2C_BOARD_INFO("isl9519q", 0x9), |
| 2703 | .irq = 0, /* Not required when notify-by-pmic */ |
| 2704 | .platform_data = &isl_data, |
| 2705 | }, |
| 2706 | }; |
| 2707 | #endif /* CONFIG_ISL9519_CHARGER */ |
| 2708 | |
Wentao Xu | 114c015 | 2012-06-12 11:40:38 -0400 | [diff] [blame] | 2709 | #ifdef CONFIG_STM_LIS3DH |
| 2710 | static struct lis3dh_acc_platform_data lis3dh_accel = { |
| 2711 | .poll_interval = 200, |
| 2712 | .min_interval = 10, |
| 2713 | .g_range = LIS3DH_ACC_G_2G, |
| 2714 | .axis_map_x = 1, |
| 2715 | .axis_map_y = 0, |
| 2716 | .axis_map_z = 2, |
| 2717 | .negate_x = 0, |
| 2718 | .negate_y = 0, |
| 2719 | .negate_z = 1, |
| 2720 | .init = NULL, |
| 2721 | .exit = NULL, |
| 2722 | .gpio_int1 = -EINVAL, |
| 2723 | .gpio_int2 = -EINVAL, |
| 2724 | }; |
| 2725 | |
| 2726 | static struct i2c_board_info __initdata lis3dh_i2c_boardinfo[] = { |
| 2727 | { |
| 2728 | I2C_BOARD_INFO(LIS3DH_ACC_DEV_NAME, 0x18), |
| 2729 | .platform_data = &lis3dh_accel, |
| 2730 | }, |
| 2731 | }; |
| 2732 | #endif /* CONFIG_STM_LIS3DH */ |
| 2733 | |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 2734 | static struct i2c_registry msm8960_i2c_devices[] __initdata = { |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 2735 | #ifdef CONFIG_ISL9519_CHARGER |
| 2736 | { |
| 2737 | I2C_LIQUID, |
| 2738 | MSM_8930_GSBI10_QUP_I2C_BUS_ID, |
| 2739 | isl_charger_i2c_info, |
| 2740 | ARRAY_SIZE(isl_charger_i2c_info), |
| 2741 | }, |
| 2742 | #endif /* CONFIG_ISL9519_CHARGER */ |
Wentao Xu | f59ce4e | 2012-05-22 17:30:13 -0400 | [diff] [blame] | 2743 | #ifdef CONFIG_INPUT_MPU3050 |
| 2744 | { |
| 2745 | I2C_FFA | I2C_FLUID, |
| 2746 | MSM_8930_GSBI12_QUP_I2C_BUS_ID, |
| 2747 | mpu3050_i2c_boardinfo, |
| 2748 | ARRAY_SIZE(mpu3050_i2c_boardinfo), |
| 2749 | }, |
| 2750 | #endif |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 2751 | { |
Amy Maloche | e8de95d | 2012-02-23 10:40:25 -0800 | [diff] [blame] | 2752 | I2C_SURF | I2C_FFA | I2C_FLUID, |
| 2753 | MSM_8930_GSBI9_QUP_I2C_BUS_ID, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 2754 | msm_isa1200_board_info, |
| 2755 | ARRAY_SIZE(msm_isa1200_board_info), |
| 2756 | }, |
Amy Maloche | f3c9db4 | 2011-12-08 15:17:35 -0800 | [diff] [blame] | 2757 | { |
Amy Maloche | 8eb9111 | 2012-03-30 10:22:37 -0700 | [diff] [blame] | 2758 | I2C_SURF | I2C_FFA | I2C_FLUID, |
Amy Maloche | f3c9db4 | 2011-12-08 15:17:35 -0800 | [diff] [blame] | 2759 | MSM_8930_GSBI3_QUP_I2C_BUS_ID, |
| 2760 | mxt_device_info_8930, |
| 2761 | ARRAY_SIZE(mxt_device_info_8930), |
| 2762 | }, |
Manoj Rao | c6d904c | 2012-06-22 00:32:14 -0700 | [diff] [blame] | 2763 | { |
| 2764 | I2C_SURF | I2C_FFA | I2C_LIQUID | I2C_FLUID, |
| 2765 | MSM_8930_GSBI9_QUP_I2C_BUS_ID, |
| 2766 | sii_device_info, |
| 2767 | ARRAY_SIZE(sii_device_info), |
| 2768 | }, |
Wentao Xu | 114c015 | 2012-06-12 11:40:38 -0400 | [diff] [blame] | 2769 | #ifdef CONFIG_STM_LIS3DH |
| 2770 | { |
| 2771 | I2C_FFA | I2C_FLUID, |
| 2772 | MSM_8930_GSBI12_QUP_I2C_BUS_ID, |
| 2773 | lis3dh_i2c_boardinfo, |
| 2774 | ARRAY_SIZE(lis3dh_i2c_boardinfo), |
| 2775 | }, |
| 2776 | #endif |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 2777 | }; |
| 2778 | #endif /* CONFIG_I2C */ |
| 2779 | |
| 2780 | static void __init register_i2c_devices(void) |
| 2781 | { |
| 2782 | #ifdef CONFIG_I2C |
| 2783 | u8 mach_mask = 0; |
| 2784 | int i; |
Kevin Chan | 09f4e66 | 2011-12-16 08:17:02 -0800 | [diff] [blame] | 2785 | #ifdef CONFIG_MSM_CAMERA |
| 2786 | struct i2c_registry msm8930_camera_i2c_devices = { |
| 2787 | I2C_SURF | I2C_FFA | I2C_FLUID | I2C_LIQUID | I2C_RUMI, |
| 2788 | MSM_8930_GSBI4_QUP_I2C_BUS_ID, |
| 2789 | msm8930_camera_board_info.board_info, |
| 2790 | msm8930_camera_board_info.num_i2c_board_info, |
| 2791 | }; |
| 2792 | #endif |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 2793 | |
| 2794 | /* Build the matching 'supported_machs' bitmask */ |
Stepan Moskovchenko | 8768eff | 2011-12-01 18:55:07 -0800 | [diff] [blame] | 2795 | if (machine_is_msm8930_cdp() || machine_is_msm8627_cdp()) |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 2796 | mach_mask = I2C_SURF; |
| 2797 | else if (machine_is_msm8930_fluid()) |
| 2798 | mach_mask = I2C_FLUID; |
Stepan Moskovchenko | 8768eff | 2011-12-01 18:55:07 -0800 | [diff] [blame] | 2799 | else if (machine_is_msm8930_mtp() || machine_is_msm8627_mtp()) |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 2800 | mach_mask = I2C_FFA; |
| 2801 | else |
| 2802 | pr_err("unmatched machine ID in register_i2c_devices\n"); |
| 2803 | |
| 2804 | /* Run the array and install devices as appropriate */ |
| 2805 | for (i = 0; i < ARRAY_SIZE(msm8960_i2c_devices); ++i) { |
| 2806 | if (msm8960_i2c_devices[i].machs & mach_mask) |
| 2807 | i2c_register_board_info(msm8960_i2c_devices[i].bus, |
| 2808 | msm8960_i2c_devices[i].info, |
| 2809 | msm8960_i2c_devices[i].len); |
| 2810 | } |
Kevin Chan | 09f4e66 | 2011-12-16 08:17:02 -0800 | [diff] [blame] | 2811 | #ifdef CONFIG_MSM_CAMERA |
| 2812 | if (msm8930_camera_i2c_devices.machs & mach_mask) |
| 2813 | i2c_register_board_info(msm8930_camera_i2c_devices.bus, |
| 2814 | msm8930_camera_i2c_devices.info, |
| 2815 | msm8930_camera_i2c_devices.len); |
| 2816 | #endif |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 2817 | #endif |
| 2818 | } |
| 2819 | |
Bhalchandra Gajare | e94bac2 | 2012-10-08 19:16:13 -0700 | [diff] [blame] | 2820 | /*Modify the WCD9xxx platform data to support supplies from PM8917 */ |
| 2821 | static void __init msm8930_pm8917_wcd9xxx_pdata_fixup( |
| 2822 | struct wcd9xxx_pdata *cdc_pdata) |
| 2823 | { |
| 2824 | int i; |
| 2825 | |
| 2826 | for (i = 0; i < ARRAY_SIZE(cdc_pdata->regulator); i++) { |
| 2827 | |
| 2828 | if (cdc_pdata->regulator[i].name != NULL |
| 2829 | && strncmp(cdc_pdata->regulator[i].name, |
| 2830 | "CDC_VDD_CP", 10) == 0) { |
| 2831 | cdc_pdata->regulator[i].min_uV = |
| 2832 | cdc_pdata->regulator[i].max_uV = 1800000; |
| 2833 | pr_info("%s: CDC_VDD_CP forced to 1.8 volts for PM8917\n", |
| 2834 | __func__); |
| 2835 | return; |
| 2836 | } |
| 2837 | } |
| 2838 | } |
| 2839 | |
David Collins | fd344aa | 2012-08-06 15:02:03 -0700 | [diff] [blame] | 2840 | /* Modify platform data values to match requirements for PM8917. */ |
| 2841 | static void __init msm8930_pm8917_pdata_fixup(void) |
| 2842 | { |
Patrick Daly | c1227cb | 2012-08-28 13:39:17 -0700 | [diff] [blame] | 2843 | struct acpuclk_platform_data *pdata; |
| 2844 | |
Bhalchandra Gajare | e94bac2 | 2012-10-08 19:16:13 -0700 | [diff] [blame] | 2845 | msm8930_pm8917_wcd9xxx_pdata_fixup(&sitar_platform_data); |
| 2846 | msm8930_pm8917_wcd9xxx_pdata_fixup(&sitar1p1_platform_data); |
| 2847 | |
David Collins | fd344aa | 2012-08-06 15:02:03 -0700 | [diff] [blame] | 2848 | mhl_platform_data.gpio_mhl_power = MHL_POWER_GPIO_PM8917; |
| 2849 | |
| 2850 | gpio_keys_8930_pdata.buttons = keys_8930_pm8917; |
| 2851 | gpio_keys_8930_pdata.nbuttons = ARRAY_SIZE(keys_8930_pm8917); |
David Collins | 4614cb9 | 2012-08-20 12:17:09 -0700 | [diff] [blame] | 2852 | |
| 2853 | msm_device_saw_core0.dev.platform_data |
| 2854 | = &msm8930_pm8038_saw_regulator_core0_pdata; |
| 2855 | msm_device_saw_core1.dev.platform_data |
| 2856 | = &msm8930_pm8038_saw_regulator_core1_pdata; |
| 2857 | |
| 2858 | msm8930_device_rpm_regulator.dev.platform_data |
| 2859 | = &msm8930_pm8917_rpm_regulator_pdata; |
Patrick Daly | c1227cb | 2012-08-28 13:39:17 -0700 | [diff] [blame] | 2860 | |
| 2861 | pdata = msm8930_device_acpuclk.dev.platform_data; |
| 2862 | pdata->uses_pm8917 = true; |
Tianyi Gou | 2520b6e | 2012-10-29 19:13:53 -0700 | [diff] [blame] | 2863 | |
| 2864 | pdata = msm8930ab_device_acpuclk.dev.platform_data; |
| 2865 | pdata->uses_pm8917 = true; |
David Collins | fd344aa | 2012-08-06 15:02:03 -0700 | [diff] [blame] | 2866 | } |
| 2867 | |
Anji Jonnala | 1a1711a | 2013-01-29 13:34:10 +0530 | [diff] [blame] | 2868 | static void __init msm8930ab_update_retention_spm(void) |
| 2869 | { |
| 2870 | int i; |
| 2871 | |
| 2872 | /* Update the SPM sequences for krait retention on all cores */ |
| 2873 | for (i = 0; i < ARRAY_SIZE(msm_spm_data); i++) { |
| 2874 | int j; |
| 2875 | struct msm_spm_platform_data *pdata = &msm_spm_data[i]; |
| 2876 | for (j = 0; j < pdata->num_modes; j++) { |
| 2877 | if (pdata->modes[j].cmd == |
| 2878 | spm_retention_cmd_sequence) |
| 2879 | pdata->modes[j].cmd = |
| 2880 | spm_retention_with_krait_v3_cmd_sequence; |
| 2881 | } |
| 2882 | } |
| 2883 | } |
| 2884 | |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 2885 | static void __init msm8930_cdp_init(void) |
| 2886 | { |
David Collins | fd344aa | 2012-08-06 15:02:03 -0700 | [diff] [blame] | 2887 | if (socinfo_get_pmic_model() == PMIC_MODEL_PM8917) |
| 2888 | msm8930_pm8917_pdata_fixup(); |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 2889 | if (meminfo_init(SYS_MEMORY, SZ_256M) < 0) |
| 2890 | pr_err("meminfo_init() failed!\n"); |
| 2891 | |
Rohit Vaswani | b1cc493 | 2012-07-23 21:30:11 -0700 | [diff] [blame] | 2892 | platform_device_register(&msm_gpio_device); |
Siddartha Mohanadoss | fad0af1 | 2012-01-20 15:08:38 -0800 | [diff] [blame] | 2893 | msm_tsens_early_init(&msm_tsens_pdata); |
Praveen Chidambaram | 877d7a4 | 2012-06-05 14:33:20 -0600 | [diff] [blame] | 2894 | msm_thermal_init(&msm_thermal_pdata); |
Praveen Chidambaram | 75b8c81 | 2012-08-10 16:26:37 -0600 | [diff] [blame] | 2895 | if (socinfo_get_pmic_model() != PMIC_MODEL_PM8917) { |
| 2896 | BUG_ON(msm_rpm_init(&msm8930_rpm_data)); |
| 2897 | BUG_ON(msm_rpmrs_levels_init(&msm_rpmrs_data)); |
| 2898 | } else { |
| 2899 | BUG_ON(msm_rpm_init(&msm8930_rpm_data_pm8917)); |
| 2900 | BUG_ON(msm_rpmrs_levels_init(&msm_rpmrs_data_pm8917)); |
| 2901 | } |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 2902 | |
| 2903 | regulator_suppress_info_printing(); |
| 2904 | if (msm_xo_init()) |
| 2905 | pr_err("Failed to initialize XO votes\n"); |
Jay Chokshi | 06fa754 | 2011-12-07 13:09:17 -0800 | [diff] [blame] | 2906 | platform_device_register(&msm8930_device_rpm_regulator); |
Patrick Daly | 8fad60d | 2012-08-27 16:25:07 -0700 | [diff] [blame] | 2907 | if (socinfo_get_pmic_model() == PMIC_MODEL_PM8917) |
| 2908 | msm_clock_init(&msm8930_pm8917_clock_init_data); |
| 2909 | else |
| 2910 | msm_clock_init(&msm8930_clock_init_data); |
Mayank Rana | 7e57416 | 2013-01-08 15:10:51 +0530 | [diff] [blame] | 2911 | |
| 2912 | if (socinfo_get_pmic_model() == PMIC_MODEL_PM8917) { |
| 2913 | /* |
| 2914 | * By default, set USB mode as USB Peripheral only due to |
| 2915 | * hardware rework requirement for USB Host Mode. |
| 2916 | * Provide pmic_id_irq number only if host mode is enable |
| 2917 | * by user assuming that hardware rework is available. |
| 2918 | */ |
| 2919 | if (enable_usb_host_mode) { |
| 2920 | /* MPP01 IRQ number */ |
| 2921 | msm_otg_pdata.pmic_id_irq = |
| 2922 | PM8921_MPP_IRQ(PM8917_IRQ_BASE, 1); |
| 2923 | } else { |
| 2924 | pr_err("Enabling USB Peripheral Only mode.\n"); |
| 2925 | msm_otg_pdata.mode = USB_PERIPHERAL; |
| 2926 | } |
| 2927 | } else { |
| 2928 | msm_otg_pdata.pmic_id_irq = |
| 2929 | PM8038_USB_ID_IN_IRQ(PM8038_IRQ_BASE); |
| 2930 | } |
| 2931 | |
Mayank Rana | 2fe1aec | 2012-06-07 18:00:12 +0530 | [diff] [blame] | 2932 | msm_otg_pdata.phy_init_seq = hsusb_phy_init_seq; |
Aravind Venkateswaran | 06a4635 | 2012-08-16 14:52:39 -0700 | [diff] [blame] | 2933 | if (msm8930_mhl_display_enabled()) { |
| 2934 | mhl_platform_data.mhl_enabled = true; |
| 2935 | msm_otg_pdata.mhl_enable = true; |
| 2936 | } |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 2937 | msm8960_device_otg.dev.platform_data = &msm_otg_pdata; |
Mayank Rana | c64b639 | 2012-05-21 14:05:23 +0530 | [diff] [blame] | 2938 | android_usb_pdata.swfi_latency = |
| 2939 | msm_rpmrs_levels[0].latency_us; |
Stepan Moskovchenko | 3b09bf5 | 2011-12-06 20:40:53 -0800 | [diff] [blame] | 2940 | msm8930_init_gpiomux(); |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 2941 | msm8960_device_qup_spi_gsbi1.dev.platform_data = |
| 2942 | &msm8960_qup_spi_gsbi1_pdata; |
| 2943 | spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info)); |
| 2944 | |
Jay Chokshi | 06fa754 | 2011-12-07 13:09:17 -0800 | [diff] [blame] | 2945 | /* |
| 2946 | * TODO: When physical 8930/PM8038 hardware becomes |
| 2947 | * available, remove this block or add the config |
| 2948 | * option. |
| 2949 | */ |
| 2950 | #ifndef MSM8930_PHASE_2 |
| 2951 | msm8960_init_pmic(); |
| 2952 | #else |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 2953 | msm8930_init_pmic(); |
Jay Chokshi | 06fa754 | 2011-12-07 13:09:17 -0800 | [diff] [blame] | 2954 | #endif |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 2955 | msm8930_i2c_init(); |
Sudhakara Rao Tentu | 8b5c8ed | 2012-03-05 14:48:41 +0530 | [diff] [blame] | 2956 | msm8930_init_gpu(); |
Anji Jonnala | 1a1711a | 2013-01-29 13:34:10 +0530 | [diff] [blame] | 2957 | if (cpu_is_krait_v3()) { |
Praveen Chidambaram | f27a515 | 2013-02-01 11:44:53 -0700 | [diff] [blame] | 2958 | struct msm_pm_init_data_type *pdata = |
| 2959 | msm8930_pm_8x60.dev.platform_data; |
| 2960 | pdata->retention_calls_tz = false; |
Anji Jonnala | 1a1711a | 2013-01-29 13:34:10 +0530 | [diff] [blame] | 2961 | msm8930ab_update_retention_spm(); |
Anji Jonnala | 1a1711a | 2013-01-29 13:34:10 +0530 | [diff] [blame] | 2962 | } |
Praveen Chidambaram | f27a515 | 2013-02-01 11:44:53 -0700 | [diff] [blame] | 2963 | |
| 2964 | platform_device_register(&msm8930_pm_8x60); |
| 2965 | |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 2966 | msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data)); |
| 2967 | msm_spm_l2_init(msm_spm_l2_data); |
| 2968 | msm8930_init_buses(); |
Aravind Venkateswaran | 896d2f9 | 2012-10-29 17:54:55 -0700 | [diff] [blame] | 2969 | if (cpu_is_msm8627()) { |
Tianyi Gou | 723843b | 2012-06-13 15:24:56 -0700 | [diff] [blame] | 2970 | platform_add_devices(msm8627_footswitch, |
| 2971 | msm8627_num_footswitch); |
Aravind Venkateswaran | 896d2f9 | 2012-10-29 17:54:55 -0700 | [diff] [blame] | 2972 | } else { |
| 2973 | if (socinfo_get_pmic_model() == PMIC_MODEL_PM8917) |
| 2974 | platform_add_devices(msm8930_pm8917_footswitch, |
| 2975 | msm8930_pm8917_num_footswitch); |
| 2976 | else |
| 2977 | platform_add_devices(msm8930_footswitch, |
| 2978 | msm8930_num_footswitch); |
| 2979 | } |
Matt Wagantall | 6dcfa92 | 2012-06-07 20:13:51 -0700 | [diff] [blame] | 2980 | if (cpu_is_msm8627()) |
Matt Wagantall | ab730bd | 2012-06-07 20:13:51 -0700 | [diff] [blame] | 2981 | platform_device_register(&msm8627_device_acpuclk); |
Tianyi Gou | 12370f1 | 2012-07-23 19:13:57 -0700 | [diff] [blame] | 2982 | else if (cpu_is_msm8930()) |
Matt Wagantall | 6dcfa92 | 2012-06-07 20:13:51 -0700 | [diff] [blame] | 2983 | platform_device_register(&msm8930_device_acpuclk); |
Tianyi Gou | 12370f1 | 2012-07-23 19:13:57 -0700 | [diff] [blame] | 2984 | else if (cpu_is_msm8930aa()) |
| 2985 | platform_device_register(&msm8930aa_device_acpuclk); |
Tianyi Gou | 2520b6e | 2012-10-29 19:13:53 -0700 | [diff] [blame] | 2986 | else if (cpu_is_msm8930ab()) |
| 2987 | platform_device_register(&msm8930ab_device_acpuclk); |
David Collins | 4614cb9 | 2012-08-20 12:17:09 -0700 | [diff] [blame] | 2988 | platform_add_devices(early_common_devices, |
| 2989 | ARRAY_SIZE(early_common_devices)); |
| 2990 | if (socinfo_get_pmic_model() != PMIC_MODEL_PM8917) |
| 2991 | platform_add_devices(pmic_pm8038_devices, |
| 2992 | ARRAY_SIZE(pmic_pm8038_devices)); |
| 2993 | else |
| 2994 | platform_add_devices(pmic_pm8917_devices, |
| 2995 | ARRAY_SIZE(pmic_pm8917_devices)); |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 2996 | platform_add_devices(common_devices, ARRAY_SIZE(common_devices)); |
Arun Menon | aabf263 | 2012-02-24 15:30:47 -0800 | [diff] [blame] | 2997 | msm8930_add_vidc_device(); |
Jay Chokshi | 06fa754 | 2011-12-07 13:09:17 -0800 | [diff] [blame] | 2998 | /* |
| 2999 | * TODO: When physical 8930/PM8038 hardware becomes |
| 3000 | * available, remove this block or add the config |
| 3001 | * option. |
| 3002 | */ |
| 3003 | #ifndef MSM8930_PHASE_2 |
| 3004 | msm8960_pm8921_gpio_mpp_init(); |
| 3005 | #else |
David Collins | fd344aa | 2012-08-06 15:02:03 -0700 | [diff] [blame] | 3006 | if (socinfo_get_pmic_model() != PMIC_MODEL_PM8917) |
| 3007 | msm8930_pm8038_gpio_mpp_init(); |
| 3008 | else |
| 3009 | msm8930_pm8917_gpio_mpp_init(); |
Jay Chokshi | 06fa754 | 2011-12-07 13:09:17 -0800 | [diff] [blame] | 3010 | #endif |
Jin Hong | d2e2d3b | 2012-11-01 14:16:33 -0700 | [diff] [blame] | 3011 | /* Don't add modem devices on APQ targets */ |
| 3012 | if (socinfo_get_id() != 119 && socinfo_get_id() != 157 |
| 3013 | && socinfo_get_id() != 160) |
| 3014 | platform_device_register(&msm_8960_q6_mss); |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 3015 | platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices)); |
Steve Muckle | f132c6c | 2012-06-06 18:30:57 -0700 | [diff] [blame] | 3016 | #ifdef CONFIG_MSM_CAMERA |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 3017 | msm8930_init_cam(); |
Steve Muckle | f132c6c | 2012-06-06 18:30:57 -0700 | [diff] [blame] | 3018 | #endif |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 3019 | msm8930_init_mmc(); |
Amy Maloche | 8eb9111 | 2012-03-30 10:22:37 -0700 | [diff] [blame] | 3020 | mxt_init_vkeys_8930(); |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 3021 | register_i2c_devices(); |
| 3022 | msm8930_init_fb(); |
| 3023 | slim_register_board_info(msm_slim_devices, |
| 3024 | ARRAY_SIZE(msm_slim_devices)); |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 3025 | change_memory_power = &msm8930_change_memory_power; |
Maheshkumar Sivasubramanian | c6c5503 | 2011-10-25 16:01:32 -0600 | [diff] [blame] | 3026 | BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata)); |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 3027 | |
| 3028 | if (PLATFORM_IS_CHARM25()) |
| 3029 | platform_add_devices(mdm_devices, ARRAY_SIZE(mdm_devices)); |
| 3030 | } |
| 3031 | |
| 3032 | MACHINE_START(MSM8930_CDP, "QCT MSM8930 CDP") |
| 3033 | .map_io = msm8930_map_io, |
| 3034 | .reserve = msm8930_reserve, |
| 3035 | .init_irq = msm8930_init_irq, |
Marc Zyngier | 89bdafd1 | 2011-12-22 11:39:20 +0530 | [diff] [blame] | 3036 | .handle_irq = gic_handle_irq, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 3037 | .timer = &msm_timer, |
| 3038 | .init_machine = msm8930_cdp_init, |
| 3039 | .init_early = msm8930_allocate_memory_regions, |
| 3040 | .init_very_early = msm8930_early_memory, |
Jeff Ohlstein | dd0dd9b | 2012-05-29 17:47:21 -0700 | [diff] [blame] | 3041 | .restart = msm_restart, |
Syed Rameez Mustafa | 9de4634 | 2012-11-30 11:00:08 -0800 | [diff] [blame] | 3042 | .smp = &msm8960_smp_ops, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 3043 | MACHINE_END |
| 3044 | |
| 3045 | MACHINE_START(MSM8930_MTP, "QCT MSM8930 MTP") |
| 3046 | .map_io = msm8930_map_io, |
| 3047 | .reserve = msm8930_reserve, |
| 3048 | .init_irq = msm8930_init_irq, |
Marc Zyngier | 89bdafd1 | 2011-12-22 11:39:20 +0530 | [diff] [blame] | 3049 | .handle_irq = gic_handle_irq, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 3050 | .timer = &msm_timer, |
| 3051 | .init_machine = msm8930_cdp_init, |
| 3052 | .init_early = msm8930_allocate_memory_regions, |
| 3053 | .init_very_early = msm8930_early_memory, |
Jeff Ohlstein | dd0dd9b | 2012-05-29 17:47:21 -0700 | [diff] [blame] | 3054 | .restart = msm_restart, |
Syed Rameez Mustafa | 9de4634 | 2012-11-30 11:00:08 -0800 | [diff] [blame] | 3055 | .smp = &msm8960_smp_ops, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 3056 | MACHINE_END |
| 3057 | |
| 3058 | MACHINE_START(MSM8930_FLUID, "QCT MSM8930 FLUID") |
| 3059 | .map_io = msm8930_map_io, |
| 3060 | .reserve = msm8930_reserve, |
| 3061 | .init_irq = msm8930_init_irq, |
Marc Zyngier | 89bdafd1 | 2011-12-22 11:39:20 +0530 | [diff] [blame] | 3062 | .handle_irq = gic_handle_irq, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 3063 | .timer = &msm_timer, |
| 3064 | .init_machine = msm8930_cdp_init, |
| 3065 | .init_early = msm8930_allocate_memory_regions, |
| 3066 | .init_very_early = msm8930_early_memory, |
Jeff Ohlstein | dd0dd9b | 2012-05-29 17:47:21 -0700 | [diff] [blame] | 3067 | .restart = msm_restart, |
Syed Rameez Mustafa | 9de4634 | 2012-11-30 11:00:08 -0800 | [diff] [blame] | 3068 | .smp = &msm8960_smp_ops, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 3069 | MACHINE_END |
Stepan Moskovchenko | 8768eff | 2011-12-01 18:55:07 -0800 | [diff] [blame] | 3070 | |
| 3071 | MACHINE_START(MSM8627_CDP, "QCT MSM8627 CDP") |
| 3072 | .map_io = msm8930_map_io, |
| 3073 | .reserve = msm8930_reserve, |
| 3074 | .init_irq = msm8930_init_irq, |
Marc Zyngier | 89bdafd1 | 2011-12-22 11:39:20 +0530 | [diff] [blame] | 3075 | .handle_irq = gic_handle_irq, |
Stepan Moskovchenko | 8768eff | 2011-12-01 18:55:07 -0800 | [diff] [blame] | 3076 | .timer = &msm_timer, |
| 3077 | .init_machine = msm8930_cdp_init, |
| 3078 | .init_early = msm8930_allocate_memory_regions, |
| 3079 | .init_very_early = msm8930_early_memory, |
Jeff Ohlstein | dd0dd9b | 2012-05-29 17:47:21 -0700 | [diff] [blame] | 3080 | .restart = msm_restart, |
Syed Rameez Mustafa | 9de4634 | 2012-11-30 11:00:08 -0800 | [diff] [blame] | 3081 | .smp = &msm8960_smp_ops, |
Stepan Moskovchenko | 8768eff | 2011-12-01 18:55:07 -0800 | [diff] [blame] | 3082 | MACHINE_END |
| 3083 | |
| 3084 | MACHINE_START(MSM8627_MTP, "QCT MSM8627 MTP") |
| 3085 | .map_io = msm8930_map_io, |
| 3086 | .reserve = msm8930_reserve, |
| 3087 | .init_irq = msm8930_init_irq, |
Marc Zyngier | 89bdafd1 | 2011-12-22 11:39:20 +0530 | [diff] [blame] | 3088 | .handle_irq = gic_handle_irq, |
Stepan Moskovchenko | 8768eff | 2011-12-01 18:55:07 -0800 | [diff] [blame] | 3089 | .timer = &msm_timer, |
| 3090 | .init_machine = msm8930_cdp_init, |
| 3091 | .init_early = msm8930_allocate_memory_regions, |
| 3092 | .init_very_early = msm8930_early_memory, |
Jeff Ohlstein | dd0dd9b | 2012-05-29 17:47:21 -0700 | [diff] [blame] | 3093 | .restart = msm_restart, |
Syed Rameez Mustafa | 9de4634 | 2012-11-30 11:00:08 -0800 | [diff] [blame] | 3094 | .smp = &msm8960_smp_ops, |
Stepan Moskovchenko | 8768eff | 2011-12-01 18:55:07 -0800 | [diff] [blame] | 3095 | MACHINE_END |