Manu Gautam | 5143b25 | 2012-01-05 19:25:23 -0800 | [diff] [blame] | 1 | /* Copyright (c) 2011-2012, Code Aurora Forum. All rights reserved. |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2 | * |
| 3 | * This program is free software; you can redistribute it and/or modify |
| 4 | * it under the terms of the GNU General Public License version 2 and |
| 5 | * only version 2 as published by the Free Software Foundation. |
| 6 | * |
| 7 | * This program is distributed in the hope that it will be useful, |
| 8 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 9 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 10 | * GNU General Public License for more details. |
| 11 | * |
| 12 | */ |
| 13 | #include <linux/kernel.h> |
| 14 | #include <linux/platform_device.h> |
| 15 | #include <linux/io.h> |
| 16 | #include <linux/irq.h> |
Kenneth Heitke | 748593a | 2011-07-15 15:45:11 -0600 | [diff] [blame] | 17 | #include <linux/i2c.h> |
Sagar Dharia | 8bdcdaf | 2011-09-16 16:01:15 -0600 | [diff] [blame] | 18 | #include <linux/slimbus/slimbus.h> |
Swaminathan Sathappan | 2f51a75 | 2011-12-05 12:51:19 -0800 | [diff] [blame] | 19 | #include <linux/mfd/wcd9310/core.h> |
| 20 | #include <linux/mfd/wcd9310/pdata.h> |
Kenneth Heitke | 36920d3 | 2011-07-20 16:44:30 -0600 | [diff] [blame] | 21 | #include <linux/msm_ssbi.h> |
Stepan Moskovchenko | eed82a5 | 2011-09-02 13:19:23 -0700 | [diff] [blame] | 22 | #include <linux/spi/spi.h> |
Ramesh Masavarapu | 2831191 | 2011-10-27 11:04:12 -0700 | [diff] [blame] | 23 | #include <linux/dma-mapping.h> |
| 24 | #include <linux/platform_data/qcom_crypto_device.h> |
Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 25 | #include <linux/ion.h> |
Jack Cheung | 46bfffa | 2012-01-19 15:26:24 -0800 | [diff] [blame] | 26 | #include <linux/memory.h> |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 27 | #include <asm/mach-types.h> |
| 28 | #include <asm/mach/arch.h> |
| 29 | #include <asm/hardware/gic.h> |
Sahitya Tummala | 3586ed9 | 2011-08-03 09:13:23 +0530 | [diff] [blame] | 30 | #include <asm/mach/mmc.h> |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 31 | |
| 32 | #include <mach/board.h> |
| 33 | #include <mach/msm_iomap.h> |
Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 34 | #include <mach/ion.h> |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 35 | #include <linux/usb/msm_hsusb.h> |
| 36 | #include <linux/usb/android.h> |
| 37 | #include <mach/socinfo.h> |
Harini Jayaraman | c4c5869 | 2011-07-19 14:50:10 -0600 | [diff] [blame] | 38 | #include <mach/msm_spi.h> |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 39 | #include "timer.h" |
| 40 | #include "devices.h" |
Joel King | 4ebccc6 | 2011-07-22 09:43:22 -0700 | [diff] [blame] | 41 | #include <mach/gpio.h> |
| 42 | #include <mach/gpiomux.h> |
Praveen Chidambaram | 7849901 | 2011-11-01 17:15:17 -0600 | [diff] [blame] | 43 | #include <mach/rpm.h> |
Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 44 | #ifdef CONFIG_ANDROID_PMEM |
Kevin Chan | 13be4e2 | 2011-10-20 11:30:32 -0700 | [diff] [blame] | 45 | #include <linux/android_pmem.h> |
Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 46 | #endif |
Kevin Chan | 13be4e2 | 2011-10-20 11:30:32 -0700 | [diff] [blame] | 47 | #include <mach/msm_memtypes.h> |
| 48 | #include <linux/bootmem.h> |
| 49 | #include <asm/setup.h> |
Ramesh Masavarapu | 2831191 | 2011-10-27 11:04:12 -0700 | [diff] [blame] | 50 | #include <mach/dma.h> |
Gagan Mac | 8a7a5d3 | 2011-11-11 16:43:06 -0700 | [diff] [blame] | 51 | #include <mach/msm_bus_board.h> |
Praveen Chidambaram | 7849901 | 2011-11-01 17:15:17 -0600 | [diff] [blame] | 52 | #include <mach/pm.h> |
| 53 | #include <mach/cpuidle.h> |
Joel King | 4ebccc6 | 2011-07-22 09:43:22 -0700 | [diff] [blame] | 54 | |
Jeff Ohlstein | 7e66855 | 2011-10-06 16:17:25 -0700 | [diff] [blame] | 55 | #include "msm_watchdog.h" |
Stepan Moskovchenko | 5a83dba | 2011-12-05 17:30:17 -0800 | [diff] [blame] | 56 | #include "board-8064.h" |
Vikram Mulukutla | bc2e957 | 2011-11-04 03:41:38 -0700 | [diff] [blame] | 57 | #include "acpuclock.h" |
Praveen Chidambaram | 7849901 | 2011-11-01 17:15:17 -0600 | [diff] [blame] | 58 | #include "spm.h" |
| 59 | #include "mpm.h" |
| 60 | #include "rpm_resources.h" |
| 61 | #include "pm-boot.h" |
Rajesh Sastrula | aee8af3 | 2012-01-20 11:46:31 -0800 | [diff] [blame] | 62 | #include "devices-msm8x60.h" |
Jay Chokshi | ea67c62 | 2011-07-29 17:12:26 -0700 | [diff] [blame] | 63 | |
Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 64 | #define MSM_PMEM_ADSP_SIZE 0x7800000 |
Ben Romberger | 3ffcd81 | 2011-12-08 19:12:10 -0800 | [diff] [blame] | 65 | #define MSM_PMEM_AUDIO_SIZE 0x2B4000 |
Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 66 | #ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY |
| 67 | #define MSM_PMEM_SIZE 0x4000000 /* 64 Mbytes */ |
| 68 | #else |
| 69 | #define MSM_PMEM_SIZE 0x2800000 /* 40 Mbytes */ |
| 70 | #endif |
Kevin Chan | 13be4e2 | 2011-10-20 11:30:32 -0700 | [diff] [blame] | 71 | |
Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 72 | #ifdef CONFIG_MSM_MULTIMEDIA_USE_ION |
Olav Haugan | edcf683 | 2012-01-24 08:35:41 -0800 | [diff] [blame] | 73 | #define MSM_PMEM_KERNEL_EBI1_SIZE 0x280000 |
Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 74 | #define MSM_ION_SF_SIZE MSM_PMEM_SIZE |
Olav Haugan | d3d2968 | 2012-01-19 10:57:07 -0800 | [diff] [blame] | 75 | #define MSM_ION_MM_FW_SIZE 0x200000 /* (2MB) */ |
Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 76 | #define MSM_ION_MM_SIZE MSM_PMEM_ADSP_SIZE |
Olav Haugan | f45e214 | 2012-01-19 11:01:01 -0800 | [diff] [blame] | 77 | #define MSM_ION_QSECOM_SIZE 0x100000 /* (1MB) */ |
Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 78 | #define MSM_ION_MFC_SIZE SZ_8K |
Olav Haugan | 2c43fac | 2012-01-19 11:06:37 -0800 | [diff] [blame] | 79 | #define MSM_ION_AUDIO_SIZE MSM_PMEM_AUDIO_SIZE |
| 80 | #define MSM_ION_HEAP_NUM 8 |
Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 81 | #else |
| 82 | #define MSM_PMEM_KERNEL_EBI1_SIZE 0x110C000 |
| 83 | #define MSM_ION_HEAP_NUM 1 |
| 84 | #endif |
Kevin Chan | 13be4e2 | 2011-10-20 11:30:32 -0700 | [diff] [blame] | 85 | |
Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 86 | #ifdef CONFIG_KERNEL_PMEM_EBI_REGION |
| 87 | static unsigned pmem_kernel_ebi1_size = MSM_PMEM_KERNEL_EBI1_SIZE; |
| 88 | static int __init pmem_kernel_ebi1_size_setup(char *p) |
Kevin Chan | 13be4e2 | 2011-10-20 11:30:32 -0700 | [diff] [blame] | 89 | { |
Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 90 | pmem_kernel_ebi1_size = memparse(p, NULL); |
| 91 | return 0; |
Kevin Chan | 13be4e2 | 2011-10-20 11:30:32 -0700 | [diff] [blame] | 92 | } |
Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 93 | early_param("pmem_kernel_ebi1_size", pmem_kernel_ebi1_size_setup); |
| 94 | #endif |
Kevin Chan | 13be4e2 | 2011-10-20 11:30:32 -0700 | [diff] [blame] | 95 | |
Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 96 | #ifdef CONFIG_ANDROID_PMEM |
Kevin Chan | 13be4e2 | 2011-10-20 11:30:32 -0700 | [diff] [blame] | 97 | static unsigned pmem_size = MSM_PMEM_SIZE; |
| 98 | static int __init pmem_size_setup(char *p) |
| 99 | { |
| 100 | pmem_size = memparse(p, NULL); |
| 101 | return 0; |
| 102 | } |
| 103 | early_param("pmem_size", pmem_size_setup); |
| 104 | |
| 105 | static unsigned pmem_adsp_size = MSM_PMEM_ADSP_SIZE; |
| 106 | |
| 107 | static int __init pmem_adsp_size_setup(char *p) |
| 108 | { |
| 109 | pmem_adsp_size = memparse(p, NULL); |
| 110 | return 0; |
| 111 | } |
| 112 | early_param("pmem_adsp_size", pmem_adsp_size_setup); |
| 113 | |
| 114 | static unsigned pmem_audio_size = MSM_PMEM_AUDIO_SIZE; |
| 115 | |
| 116 | static int __init pmem_audio_size_setup(char *p) |
| 117 | { |
| 118 | pmem_audio_size = memparse(p, NULL); |
| 119 | return 0; |
| 120 | } |
| 121 | early_param("pmem_audio_size", pmem_audio_size_setup); |
Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 122 | #endif |
Kevin Chan | 13be4e2 | 2011-10-20 11:30:32 -0700 | [diff] [blame] | 123 | |
Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 124 | #ifdef CONFIG_ANDROID_PMEM |
| 125 | #ifndef CONFIG_MSM_MULTIMEDIA_USE_ION |
Kevin Chan | 13be4e2 | 2011-10-20 11:30:32 -0700 | [diff] [blame] | 126 | static struct android_pmem_platform_data android_pmem_pdata = { |
| 127 | .name = "pmem", |
| 128 | .allocator_type = PMEM_ALLOCATORTYPE_ALLORNOTHING, |
| 129 | .cached = 1, |
| 130 | .memory_type = MEMTYPE_EBI1, |
| 131 | }; |
| 132 | |
| 133 | static struct platform_device android_pmem_device = { |
| 134 | .name = "android_pmem", |
| 135 | .id = 0, |
| 136 | .dev = {.platform_data = &android_pmem_pdata}, |
| 137 | }; |
| 138 | |
| 139 | static struct android_pmem_platform_data android_pmem_adsp_pdata = { |
| 140 | .name = "pmem_adsp", |
| 141 | .allocator_type = PMEM_ALLOCATORTYPE_BITMAP, |
| 142 | .cached = 0, |
| 143 | .memory_type = MEMTYPE_EBI1, |
| 144 | }; |
Kevin Chan | 13be4e2 | 2011-10-20 11:30:32 -0700 | [diff] [blame] | 145 | static struct platform_device android_pmem_adsp_device = { |
| 146 | .name = "android_pmem", |
| 147 | .id = 2, |
| 148 | .dev = { .platform_data = &android_pmem_adsp_pdata }, |
| 149 | }; |
Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 150 | #endif |
Kevin Chan | 13be4e2 | 2011-10-20 11:30:32 -0700 | [diff] [blame] | 151 | |
| 152 | static struct android_pmem_platform_data android_pmem_audio_pdata = { |
| 153 | .name = "pmem_audio", |
| 154 | .allocator_type = PMEM_ALLOCATORTYPE_BITMAP, |
| 155 | .cached = 0, |
| 156 | .memory_type = MEMTYPE_EBI1, |
| 157 | }; |
| 158 | |
| 159 | static struct platform_device android_pmem_audio_device = { |
| 160 | .name = "android_pmem", |
| 161 | .id = 4, |
| 162 | .dev = { .platform_data = &android_pmem_audio_pdata }, |
| 163 | }; |
Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 164 | #endif |
| 165 | |
| 166 | static struct memtype_reserve apq8064_reserve_table[] __initdata = { |
| 167 | [MEMTYPE_SMI] = { |
| 168 | }, |
| 169 | [MEMTYPE_EBI0] = { |
| 170 | .flags = MEMTYPE_FLAGS_1M_ALIGN, |
| 171 | }, |
| 172 | [MEMTYPE_EBI1] = { |
| 173 | .flags = MEMTYPE_FLAGS_1M_ALIGN, |
| 174 | }, |
| 175 | }; |
Kevin Chan | 13be4e2 | 2011-10-20 11:30:32 -0700 | [diff] [blame] | 176 | |
| 177 | static void __init size_pmem_devices(void) |
| 178 | { |
Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 179 | #ifdef CONFIG_ANDROID_PMEM |
| 180 | #ifndef CONFIG_MSM_MULTIMEDIA_USE_ION |
Kevin Chan | 13be4e2 | 2011-10-20 11:30:32 -0700 | [diff] [blame] | 181 | android_pmem_adsp_pdata.size = pmem_adsp_size; |
| 182 | android_pmem_pdata.size = pmem_size; |
Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 183 | #endif |
Kevin Chan | 13be4e2 | 2011-10-20 11:30:32 -0700 | [diff] [blame] | 184 | android_pmem_audio_pdata.size = MSM_PMEM_AUDIO_SIZE; |
Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 185 | #endif |
Kevin Chan | 13be4e2 | 2011-10-20 11:30:32 -0700 | [diff] [blame] | 186 | } |
| 187 | |
| 188 | static void __init reserve_memory_for(struct android_pmem_platform_data *p) |
| 189 | { |
| 190 | apq8064_reserve_table[p->memory_type].size += p->size; |
| 191 | } |
| 192 | |
Kevin Chan | 13be4e2 | 2011-10-20 11:30:32 -0700 | [diff] [blame] | 193 | static void __init reserve_pmem_memory(void) |
| 194 | { |
Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 195 | #ifdef CONFIG_ANDROID_PMEM |
| 196 | #ifndef CONFIG_MSM_MULTIMEDIA_USE_ION |
Kevin Chan | 13be4e2 | 2011-10-20 11:30:32 -0700 | [diff] [blame] | 197 | reserve_memory_for(&android_pmem_adsp_pdata); |
| 198 | reserve_memory_for(&android_pmem_pdata); |
Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 199 | #endif |
Kevin Chan | 13be4e2 | 2011-10-20 11:30:32 -0700 | [diff] [blame] | 200 | reserve_memory_for(&android_pmem_audio_pdata); |
| 201 | apq8064_reserve_table[MEMTYPE_EBI1].size += pmem_kernel_ebi1_size; |
Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 202 | #endif |
| 203 | } |
| 204 | |
| 205 | static int apq8064_paddr_to_memtype(unsigned int paddr) |
| 206 | { |
| 207 | return MEMTYPE_EBI1; |
| 208 | } |
| 209 | |
| 210 | #ifdef CONFIG_ION_MSM |
| 211 | #ifdef CONFIG_MSM_MULTIMEDIA_USE_ION |
| 212 | static struct ion_cp_heap_pdata cp_mm_ion_pdata = { |
| 213 | .permission_type = IPT_TYPE_MM_CARVEOUT, |
Olav Haugan | d3d2968 | 2012-01-19 10:57:07 -0800 | [diff] [blame] | 214 | .align = PAGE_SIZE, |
Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 215 | }; |
| 216 | |
| 217 | static struct ion_cp_heap_pdata cp_mfc_ion_pdata = { |
| 218 | .permission_type = IPT_TYPE_MFC_SHAREDMEM, |
Olav Haugan | d3d2968 | 2012-01-19 10:57:07 -0800 | [diff] [blame] | 219 | .align = PAGE_SIZE, |
Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 220 | }; |
| 221 | |
| 222 | static struct ion_co_heap_pdata co_ion_pdata = { |
Olav Haugan | d3d2968 | 2012-01-19 10:57:07 -0800 | [diff] [blame] | 223 | .adjacent_mem_id = INVALID_HEAP_ID, |
| 224 | .align = PAGE_SIZE, |
| 225 | }; |
| 226 | |
| 227 | static struct ion_co_heap_pdata fw_co_ion_pdata = { |
| 228 | .adjacent_mem_id = ION_CP_MM_HEAP_ID, |
| 229 | .align = SZ_128K, |
Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 230 | }; |
| 231 | #endif |
| 232 | static struct ion_platform_data ion_pdata = { |
| 233 | .nr = MSM_ION_HEAP_NUM, |
| 234 | .heaps = { |
| 235 | { |
| 236 | .id = ION_SYSTEM_HEAP_ID, |
| 237 | .type = ION_HEAP_TYPE_SYSTEM, |
| 238 | .name = ION_VMALLOC_HEAP_NAME, |
| 239 | }, |
| 240 | #ifdef CONFIG_MSM_MULTIMEDIA_USE_ION |
| 241 | { |
| 242 | .id = ION_SF_HEAP_ID, |
| 243 | .type = ION_HEAP_TYPE_CARVEOUT, |
| 244 | .name = ION_SF_HEAP_NAME, |
| 245 | .size = MSM_ION_SF_SIZE, |
| 246 | .memory_type = ION_EBI_TYPE, |
| 247 | .extra_data = (void *) &co_ion_pdata, |
| 248 | }, |
| 249 | { |
| 250 | .id = ION_CP_MM_HEAP_ID, |
| 251 | .type = ION_HEAP_TYPE_CP, |
| 252 | .name = ION_MM_HEAP_NAME, |
| 253 | .size = MSM_ION_MM_SIZE, |
| 254 | .memory_type = ION_EBI_TYPE, |
| 255 | .extra_data = (void *) &cp_mm_ion_pdata, |
| 256 | }, |
| 257 | { |
Olav Haugan | d3d2968 | 2012-01-19 10:57:07 -0800 | [diff] [blame] | 258 | .id = ION_MM_FIRMWARE_HEAP_ID, |
| 259 | .type = ION_HEAP_TYPE_CARVEOUT, |
| 260 | .name = ION_MM_FIRMWARE_HEAP_NAME, |
| 261 | .size = MSM_ION_MM_FW_SIZE, |
| 262 | .memory_type = ION_EBI_TYPE, |
| 263 | .extra_data = (void *) &fw_co_ion_pdata, |
| 264 | }, |
| 265 | { |
Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 266 | .id = ION_CP_MFC_HEAP_ID, |
| 267 | .type = ION_HEAP_TYPE_CP, |
| 268 | .name = ION_MFC_HEAP_NAME, |
| 269 | .size = MSM_ION_MFC_SIZE, |
| 270 | .memory_type = ION_EBI_TYPE, |
| 271 | .extra_data = (void *) &cp_mfc_ion_pdata, |
| 272 | }, |
| 273 | { |
| 274 | .id = ION_IOMMU_HEAP_ID, |
| 275 | .type = ION_HEAP_TYPE_IOMMU, |
| 276 | .name = ION_IOMMU_HEAP_NAME, |
| 277 | }, |
Olav Haugan | f45e214 | 2012-01-19 11:01:01 -0800 | [diff] [blame] | 278 | { |
| 279 | .id = ION_QSECOM_HEAP_ID, |
| 280 | .type = ION_HEAP_TYPE_CARVEOUT, |
| 281 | .name = ION_QSECOM_HEAP_NAME, |
| 282 | .size = MSM_ION_QSECOM_SIZE, |
| 283 | .memory_type = ION_EBI_TYPE, |
| 284 | .extra_data = (void *) &co_ion_pdata, |
| 285 | }, |
Olav Haugan | 2c43fac | 2012-01-19 11:06:37 -0800 | [diff] [blame] | 286 | { |
| 287 | .id = ION_AUDIO_HEAP_ID, |
| 288 | .type = ION_HEAP_TYPE_CARVEOUT, |
| 289 | .name = ION_AUDIO_HEAP_NAME, |
| 290 | .size = MSM_ION_AUDIO_SIZE, |
| 291 | .memory_type = ION_EBI_TYPE, |
| 292 | .extra_data = (void *) &co_ion_pdata, |
| 293 | }, |
Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 294 | #endif |
| 295 | } |
| 296 | }; |
| 297 | |
| 298 | static struct platform_device ion_dev = { |
| 299 | .name = "ion-msm", |
| 300 | .id = 1, |
| 301 | .dev = { .platform_data = &ion_pdata }, |
| 302 | }; |
| 303 | #endif |
| 304 | |
| 305 | static void reserve_ion_memory(void) |
| 306 | { |
| 307 | #if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION) |
| 308 | apq8064_reserve_table[MEMTYPE_EBI1].size += MSM_ION_MM_SIZE; |
Olav Haugan | d3d2968 | 2012-01-19 10:57:07 -0800 | [diff] [blame] | 309 | apq8064_reserve_table[MEMTYPE_EBI1].size += MSM_ION_MM_FW_SIZE; |
Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 310 | apq8064_reserve_table[MEMTYPE_EBI1].size += MSM_ION_SF_SIZE; |
| 311 | apq8064_reserve_table[MEMTYPE_EBI1].size += MSM_ION_MFC_SIZE; |
Olav Haugan | f45e214 | 2012-01-19 11:01:01 -0800 | [diff] [blame] | 312 | apq8064_reserve_table[MEMTYPE_EBI1].size += MSM_ION_QSECOM_SIZE; |
Olav Haugan | 2c43fac | 2012-01-19 11:06:37 -0800 | [diff] [blame] | 313 | apq8064_reserve_table[MEMTYPE_EBI1].size += MSM_ION_AUDIO_SIZE; |
Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 314 | #endif |
Kevin Chan | 13be4e2 | 2011-10-20 11:30:32 -0700 | [diff] [blame] | 315 | } |
| 316 | |
Huaibin Yang | 4a084e3 | 2011-12-15 15:25:52 -0800 | [diff] [blame] | 317 | static void __init reserve_mdp_memory(void) |
| 318 | { |
| 319 | apq8064_mdp_writeback(apq8064_reserve_table); |
| 320 | } |
| 321 | |
Kevin Chan | 13be4e2 | 2011-10-20 11:30:32 -0700 | [diff] [blame] | 322 | static void __init apq8064_calculate_reserve_sizes(void) |
| 323 | { |
| 324 | size_pmem_devices(); |
| 325 | reserve_pmem_memory(); |
Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 326 | reserve_ion_memory(); |
Huaibin Yang | 4a084e3 | 2011-12-15 15:25:52 -0800 | [diff] [blame] | 327 | reserve_mdp_memory(); |
Kevin Chan | 13be4e2 | 2011-10-20 11:30:32 -0700 | [diff] [blame] | 328 | } |
| 329 | |
| 330 | static struct reserve_info apq8064_reserve_info __initdata = { |
| 331 | .memtype_reserve_table = apq8064_reserve_table, |
| 332 | .calculate_reserve_sizes = apq8064_calculate_reserve_sizes, |
| 333 | .paddr_to_memtype = apq8064_paddr_to_memtype, |
| 334 | }; |
| 335 | |
| 336 | static int apq8064_memory_bank_size(void) |
| 337 | { |
| 338 | return 1<<29; |
| 339 | } |
| 340 | |
| 341 | static void __init locate_unstable_memory(void) |
| 342 | { |
| 343 | struct membank *mb = &meminfo.bank[meminfo.nr_banks - 1]; |
| 344 | unsigned long bank_size; |
| 345 | unsigned long low, high; |
| 346 | |
| 347 | bank_size = apq8064_memory_bank_size(); |
| 348 | low = meminfo.bank[0].start; |
| 349 | high = mb->start + mb->size; |
Olav Haugan | d76e3a8 | 2012-01-16 16:55:07 -0800 | [diff] [blame] | 350 | |
| 351 | /* Check if 32 bit overflow occured */ |
| 352 | if (high < mb->start) |
| 353 | high = ~0UL; |
| 354 | |
Kevin Chan | 13be4e2 | 2011-10-20 11:30:32 -0700 | [diff] [blame] | 355 | low &= ~(bank_size - 1); |
| 356 | |
| 357 | if (high - low <= bank_size) |
| 358 | return; |
Jack Cheung | 46bfffa | 2012-01-19 15:26:24 -0800 | [diff] [blame] | 359 | apq8064_reserve_info.low_unstable_address = mb->start - |
| 360 | MIN_MEMORY_BLOCK_SIZE + mb->size; |
| 361 | apq8064_reserve_info.max_unstable_size = MIN_MEMORY_BLOCK_SIZE; |
| 362 | |
Kevin Chan | 13be4e2 | 2011-10-20 11:30:32 -0700 | [diff] [blame] | 363 | apq8064_reserve_info.bank_size = bank_size; |
| 364 | pr_info("low unstable address %lx max size %lx bank size %lx\n", |
| 365 | apq8064_reserve_info.low_unstable_address, |
| 366 | apq8064_reserve_info.max_unstable_size, |
| 367 | apq8064_reserve_info.bank_size); |
| 368 | } |
| 369 | |
| 370 | static void __init apq8064_reserve(void) |
| 371 | { |
| 372 | reserve_info = &apq8064_reserve_info; |
| 373 | locate_unstable_memory(); |
| 374 | msm_reserve(); |
| 375 | } |
| 376 | |
Hemant Kumar | 4933b07 | 2011-10-17 23:43:11 -0700 | [diff] [blame] | 377 | static struct platform_device android_usb_device = { |
| 378 | .name = "android_usb", |
| 379 | .id = -1, |
| 380 | }; |
| 381 | |
| 382 | static struct msm_otg_platform_data msm_otg_pdata = { |
| 383 | .mode = USB_PERIPHERAL, |
| 384 | .otg_control = OTG_PHY_CONTROL, |
| 385 | .phy_type = SNPS_28NM_INTEGRATED_PHY, |
Hemant Kumar | 4933b07 | 2011-10-17 23:43:11 -0700 | [diff] [blame] | 386 | }; |
| 387 | |
Swaminathan Sathappan | 2f51a75 | 2011-12-05 12:51:19 -0800 | [diff] [blame] | 388 | #define TABLA_INTERRUPT_BASE (NR_MSM_IRQS + NR_GPIO_IRQS + NR_PM8921_IRQS) |
| 389 | |
| 390 | /* Micbias setting is based on 8660 CDP/MTP/FLUID requirement |
| 391 | * 4 micbiases are used to power various analog and digital |
| 392 | * microphones operating at 1800 mV. Technically, all micbiases |
| 393 | * can source from single cfilter since all microphones operate |
| 394 | * at the same voltage level. The arrangement below is to make |
| 395 | * sure all cfilters are exercised. LDO_H regulator ouput level |
| 396 | * does not need to be as high as 2.85V. It is choosen for |
| 397 | * microphone sensitivity purpose. |
| 398 | */ |
| 399 | static struct tabla_pdata apq8064_tabla_platform_data = { |
| 400 | .slimbus_slave_device = { |
| 401 | .name = "tabla-slave", |
| 402 | .e_addr = {0, 0, 0x10, 0, 0x17, 2}, |
| 403 | }, |
Swaminathan Sathappan | cef966d | 2011-12-15 17:27:04 -0800 | [diff] [blame] | 404 | .irq = MSM_GPIO_TO_INT(42), |
Swaminathan Sathappan | 2f51a75 | 2011-12-05 12:51:19 -0800 | [diff] [blame] | 405 | .irq_base = TABLA_INTERRUPT_BASE, |
| 406 | .num_irqs = NR_TABLA_IRQS, |
| 407 | .reset_gpio = PM8921_GPIO_PM_TO_SYS(34), |
| 408 | .micbias = { |
| 409 | .ldoh_v = TABLA_LDOH_2P85_V, |
| 410 | .cfilt1_mv = 1800, |
| 411 | .cfilt2_mv = 1800, |
| 412 | .cfilt3_mv = 1800, |
| 413 | .bias1_cfilt_sel = TABLA_CFILT1_SEL, |
| 414 | .bias2_cfilt_sel = TABLA_CFILT2_SEL, |
| 415 | .bias3_cfilt_sel = TABLA_CFILT3_SEL, |
| 416 | .bias4_cfilt_sel = TABLA_CFILT3_SEL, |
| 417 | } |
| 418 | }; |
| 419 | |
| 420 | static struct slim_device apq8064_slim_tabla = { |
| 421 | .name = "tabla-slim", |
| 422 | .e_addr = {0, 1, 0x10, 0, 0x17, 2}, |
| 423 | .dev = { |
| 424 | .platform_data = &apq8064_tabla_platform_data, |
| 425 | }, |
| 426 | }; |
| 427 | |
Swaminathan Sathappan | cef966d | 2011-12-15 17:27:04 -0800 | [diff] [blame] | 428 | static struct tabla_pdata apq8064_tabla20_platform_data = { |
| 429 | .slimbus_slave_device = { |
| 430 | .name = "tabla-slave", |
| 431 | .e_addr = {0, 0, 0x60, 0, 0x17, 2}, |
| 432 | }, |
| 433 | .irq = MSM_GPIO_TO_INT(42), |
| 434 | .irq_base = TABLA_INTERRUPT_BASE, |
| 435 | .num_irqs = NR_TABLA_IRQS, |
| 436 | .reset_gpio = PM8921_GPIO_PM_TO_SYS(34), |
| 437 | .micbias = { |
| 438 | .ldoh_v = TABLA_LDOH_2P85_V, |
| 439 | .cfilt1_mv = 1800, |
| 440 | .cfilt2_mv = 1800, |
| 441 | .cfilt3_mv = 1800, |
| 442 | .bias1_cfilt_sel = TABLA_CFILT1_SEL, |
| 443 | .bias2_cfilt_sel = TABLA_CFILT2_SEL, |
| 444 | .bias3_cfilt_sel = TABLA_CFILT3_SEL, |
| 445 | .bias4_cfilt_sel = TABLA_CFILT3_SEL, |
| 446 | } |
| 447 | }; |
| 448 | |
| 449 | static struct slim_device apq8064_slim_tabla20 = { |
| 450 | .name = "tabla2x-slim", |
| 451 | .e_addr = {0, 1, 0x60, 0, 0x17, 2}, |
| 452 | .dev = { |
| 453 | .platform_data = &apq8064_tabla20_platform_data, |
| 454 | }, |
| 455 | }; |
| 456 | |
Ramesh Masavarapu | 2831191 | 2011-10-27 11:04:12 -0700 | [diff] [blame] | 457 | #if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \ |
| 458 | defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \ |
| 459 | defined(CONFIG_CRYPTO_DEV_QCEDEV) || \ |
| 460 | defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE) |
| 461 | |
| 462 | #define QCE_SIZE 0x10000 |
| 463 | #define QCE_0_BASE 0x11000000 |
| 464 | |
| 465 | #define QCE_HW_KEY_SUPPORT 0 |
| 466 | #define QCE_SHA_HMAC_SUPPORT 1 |
| 467 | #define QCE_SHARE_CE_RESOURCE 3 |
| 468 | #define QCE_CE_SHARED 0 |
| 469 | |
| 470 | static struct resource qcrypto_resources[] = { |
| 471 | [0] = { |
| 472 | .start = QCE_0_BASE, |
| 473 | .end = QCE_0_BASE + QCE_SIZE - 1, |
| 474 | .flags = IORESOURCE_MEM, |
| 475 | }, |
| 476 | [1] = { |
| 477 | .name = "crypto_channels", |
| 478 | .start = DMOV8064_CE_IN_CHAN, |
| 479 | .end = DMOV8064_CE_OUT_CHAN, |
| 480 | .flags = IORESOURCE_DMA, |
| 481 | }, |
| 482 | [2] = { |
| 483 | .name = "crypto_crci_in", |
| 484 | .start = DMOV8064_CE_IN_CRCI, |
| 485 | .end = DMOV8064_CE_IN_CRCI, |
| 486 | .flags = IORESOURCE_DMA, |
| 487 | }, |
| 488 | [3] = { |
| 489 | .name = "crypto_crci_out", |
| 490 | .start = DMOV8064_CE_OUT_CRCI, |
| 491 | .end = DMOV8064_CE_OUT_CRCI, |
| 492 | .flags = IORESOURCE_DMA, |
| 493 | }, |
| 494 | }; |
| 495 | |
| 496 | static struct resource qcedev_resources[] = { |
| 497 | [0] = { |
| 498 | .start = QCE_0_BASE, |
| 499 | .end = QCE_0_BASE + QCE_SIZE - 1, |
| 500 | .flags = IORESOURCE_MEM, |
| 501 | }, |
| 502 | [1] = { |
| 503 | .name = "crypto_channels", |
| 504 | .start = DMOV8064_CE_IN_CHAN, |
| 505 | .end = DMOV8064_CE_OUT_CHAN, |
| 506 | .flags = IORESOURCE_DMA, |
| 507 | }, |
| 508 | [2] = { |
| 509 | .name = "crypto_crci_in", |
| 510 | .start = DMOV8064_CE_IN_CRCI, |
| 511 | .end = DMOV8064_CE_IN_CRCI, |
| 512 | .flags = IORESOURCE_DMA, |
| 513 | }, |
| 514 | [3] = { |
| 515 | .name = "crypto_crci_out", |
| 516 | .start = DMOV8064_CE_OUT_CRCI, |
| 517 | .end = DMOV8064_CE_OUT_CRCI, |
| 518 | .flags = IORESOURCE_DMA, |
| 519 | }, |
| 520 | }; |
| 521 | |
| 522 | #endif |
| 523 | |
| 524 | #if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \ |
| 525 | defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) |
| 526 | |
| 527 | static struct msm_ce_hw_support qcrypto_ce_hw_suppport = { |
| 528 | .ce_shared = QCE_CE_SHARED, |
| 529 | .shared_ce_resource = QCE_SHARE_CE_RESOURCE, |
| 530 | .hw_key_support = QCE_HW_KEY_SUPPORT, |
| 531 | .sha_hmac = QCE_SHA_HMAC_SUPPORT, |
Ramesh Masavarapu | 4925968 | 2011-12-02 14:00:18 -0800 | [diff] [blame] | 532 | .bus_scale_table = NULL, |
Ramesh Masavarapu | 2831191 | 2011-10-27 11:04:12 -0700 | [diff] [blame] | 533 | }; |
| 534 | |
| 535 | static struct platform_device qcrypto_device = { |
| 536 | .name = "qcrypto", |
| 537 | .id = 0, |
| 538 | .num_resources = ARRAY_SIZE(qcrypto_resources), |
| 539 | .resource = qcrypto_resources, |
| 540 | .dev = { |
| 541 | .coherent_dma_mask = DMA_BIT_MASK(32), |
| 542 | .platform_data = &qcrypto_ce_hw_suppport, |
| 543 | }, |
| 544 | }; |
| 545 | #endif |
| 546 | |
| 547 | #if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \ |
| 548 | defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE) |
| 549 | |
| 550 | static struct msm_ce_hw_support qcedev_ce_hw_suppport = { |
| 551 | .ce_shared = QCE_CE_SHARED, |
| 552 | .shared_ce_resource = QCE_SHARE_CE_RESOURCE, |
| 553 | .hw_key_support = QCE_HW_KEY_SUPPORT, |
| 554 | .sha_hmac = QCE_SHA_HMAC_SUPPORT, |
Ramesh Masavarapu | 4925968 | 2011-12-02 14:00:18 -0800 | [diff] [blame] | 555 | .bus_scale_table = NULL, |
Ramesh Masavarapu | 2831191 | 2011-10-27 11:04:12 -0700 | [diff] [blame] | 556 | }; |
| 557 | |
| 558 | static struct platform_device qcedev_device = { |
| 559 | .name = "qce", |
| 560 | .id = 0, |
| 561 | .num_resources = ARRAY_SIZE(qcedev_resources), |
| 562 | .resource = qcedev_resources, |
| 563 | .dev = { |
| 564 | .coherent_dma_mask = DMA_BIT_MASK(32), |
| 565 | .platform_data = &qcedev_ce_hw_suppport, |
| 566 | }, |
| 567 | }; |
| 568 | #endif |
| 569 | |
| 570 | |
Jeff Hugo | 0c0f5e9 | 2011-09-28 13:55:45 -0600 | [diff] [blame] | 571 | #define MSM_SHARED_RAM_PHYS 0x80000000 |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 572 | static void __init apq8064_map_io(void) |
| 573 | { |
Jeff Hugo | 0c0f5e9 | 2011-09-28 13:55:45 -0600 | [diff] [blame] | 574 | msm_shared_ram_phys = MSM_SHARED_RAM_PHYS; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 575 | msm_map_apq8064_io(); |
Jeff Ohlstein | 3a77f9f | 2011-09-06 14:50:20 -0700 | [diff] [blame] | 576 | if (socinfo_init() < 0) |
| 577 | pr_err("socinfo_init() failed!\n"); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 578 | } |
| 579 | |
| 580 | static void __init apq8064_init_irq(void) |
| 581 | { |
Praveen Chidambaram | 7849901 | 2011-11-01 17:15:17 -0600 | [diff] [blame] | 582 | struct msm_mpm_device_data *data = NULL; |
| 583 | |
| 584 | #ifdef CONFIG_MSM_MPM |
| 585 | data = &apq8064_mpm_dev_data; |
| 586 | #endif |
| 587 | |
| 588 | msm_mpm_irq_extn_init(data); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 589 | gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE, |
| 590 | (void *)MSM_QGIC_CPU_BASE); |
| 591 | |
| 592 | /* Edge trigger PPIs except AVS_SVICINT and AVS_SVICINTSWDONE */ |
| 593 | writel_relaxed(0xFFFFD7FF, MSM_QGIC_DIST_BASE + GIC_DIST_CONFIG + 4); |
| 594 | |
| 595 | writel_relaxed(0x0000FFFF, MSM_QGIC_DIST_BASE + GIC_DIST_ENABLE_SET); |
| 596 | mb(); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 597 | } |
| 598 | |
Jay Chokshi | 7805b5a | 2011-11-07 15:55:30 -0800 | [diff] [blame] | 599 | static struct platform_device msm8064_device_saw_regulator_core0 = { |
| 600 | .name = "saw-regulator", |
| 601 | .id = 0, |
| 602 | .dev = { |
| 603 | .platform_data = &msm8064_saw_regulator_pdata_8921_s5, |
| 604 | }, |
| 605 | }; |
| 606 | |
| 607 | static struct platform_device msm8064_device_saw_regulator_core1 = { |
| 608 | .name = "saw-regulator", |
| 609 | .id = 1, |
| 610 | .dev = { |
| 611 | .platform_data = &msm8064_saw_regulator_pdata_8921_s6, |
| 612 | }, |
| 613 | }; |
| 614 | |
| 615 | static struct platform_device msm8064_device_saw_regulator_core2 = { |
| 616 | .name = "saw-regulator", |
| 617 | .id = 2, |
| 618 | .dev = { |
| 619 | .platform_data = &msm8064_saw_regulator_pdata_8821_s0, |
| 620 | }, |
| 621 | }; |
| 622 | |
| 623 | static struct platform_device msm8064_device_saw_regulator_core3 = { |
| 624 | .name = "saw-regulator", |
| 625 | .id = 3, |
| 626 | .dev = { |
| 627 | .platform_data = &msm8064_saw_regulator_pdata_8821_s1, |
Praveen Chidambaram | 7849901 | 2011-11-01 17:15:17 -0600 | [diff] [blame] | 628 | |
| 629 | }, |
| 630 | }; |
| 631 | |
| 632 | static struct msm_rpmrs_level msm_rpmrs_levels[] __initdata = { |
| 633 | { |
| 634 | MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT, |
| 635 | MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE), |
| 636 | true, |
| 637 | 100, 8000, 100000, 1, |
| 638 | }, |
| 639 | |
| 640 | { |
| 641 | MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE, |
| 642 | MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE), |
| 643 | true, |
| 644 | 2000, 6000, 60100000, 3000, |
| 645 | }, |
| 646 | |
| 647 | { |
| 648 | MSM_PM_SLEEP_MODE_POWER_COLLAPSE, |
| 649 | MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE), |
| 650 | false, |
| 651 | 4200, 5000, 60350000, 3500, |
| 652 | }, |
| 653 | |
| 654 | { |
| 655 | MSM_PM_SLEEP_MODE_POWER_COLLAPSE, |
| 656 | MSM_RPMRS_LIMITS(ON, HSFS_OPEN, MAX, ACTIVE), |
| 657 | false, |
| 658 | 6300, 4500, 65350000, 4800, |
| 659 | }, |
| 660 | |
| 661 | { |
| 662 | MSM_PM_SLEEP_MODE_POWER_COLLAPSE, |
| 663 | MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE), |
| 664 | false, |
| 665 | 11700, 2500, 67850000, 5500, |
| 666 | }, |
| 667 | |
| 668 | { |
| 669 | MSM_PM_SLEEP_MODE_POWER_COLLAPSE, |
| 670 | MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE), |
| 671 | false, |
| 672 | 13800, 2000, 71850000, 6800, |
| 673 | }, |
| 674 | |
| 675 | { |
| 676 | MSM_PM_SLEEP_MODE_POWER_COLLAPSE, |
| 677 | MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH), |
| 678 | false, |
| 679 | 29700, 500, 75850000, 8800, |
| 680 | }, |
| 681 | |
| 682 | { |
| 683 | MSM_PM_SLEEP_MODE_POWER_COLLAPSE, |
| 684 | MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW), |
| 685 | false, |
| 686 | 29700, 0, 76350000, 9800, |
| 687 | }, |
| 688 | }; |
| 689 | |
| 690 | static struct msm_pm_boot_platform_data msm_pm_boot_pdata __initdata = { |
| 691 | .mode = MSM_PM_BOOT_CONFIG_TZ, |
| 692 | }; |
| 693 | |
| 694 | static struct msm_rpmrs_platform_data msm_rpmrs_data __initdata = { |
| 695 | .levels = &msm_rpmrs_levels[0], |
| 696 | .num_levels = ARRAY_SIZE(msm_rpmrs_levels), |
| 697 | .vdd_mem_levels = { |
| 698 | [MSM_RPMRS_VDD_MEM_RET_LOW] = 750000, |
| 699 | [MSM_RPMRS_VDD_MEM_RET_HIGH] = 750000, |
| 700 | [MSM_RPMRS_VDD_MEM_ACTIVE] = 1050000, |
| 701 | [MSM_RPMRS_VDD_MEM_MAX] = 1150000, |
| 702 | }, |
| 703 | .vdd_dig_levels = { |
| 704 | [MSM_RPMRS_VDD_DIG_RET_LOW] = 500000, |
| 705 | [MSM_RPMRS_VDD_DIG_RET_HIGH] = 750000, |
| 706 | [MSM_RPMRS_VDD_DIG_ACTIVE] = 950000, |
| 707 | [MSM_RPMRS_VDD_DIG_MAX] = 1150000, |
| 708 | }, |
| 709 | .vdd_mask = 0x7FFFFF, |
| 710 | .rpmrs_target_id = { |
| 711 | [MSM_RPMRS_ID_PXO_CLK] = MSM_RPM_ID_PXO_CLK, |
| 712 | [MSM_RPMRS_ID_L2_CACHE_CTL] = MSM_RPM_ID_LAST, |
| 713 | [MSM_RPMRS_ID_VDD_DIG_0] = MSM_RPM_ID_PM8921_S3_0, |
| 714 | [MSM_RPMRS_ID_VDD_DIG_1] = MSM_RPM_ID_PM8921_S3_1, |
| 715 | [MSM_RPMRS_ID_VDD_MEM_0] = MSM_RPM_ID_PM8921_L24_0, |
| 716 | [MSM_RPMRS_ID_VDD_MEM_1] = MSM_RPM_ID_PM8921_L24_1, |
| 717 | [MSM_RPMRS_ID_RPM_CTL] = MSM_RPM_ID_RPM_CTL, |
| 718 | }, |
| 719 | }; |
| 720 | |
| 721 | static struct msm_cpuidle_state msm_cstates[] __initdata = { |
| 722 | {0, 0, "C0", "WFI", |
| 723 | MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT}, |
| 724 | |
| 725 | {0, 1, "C1", "STANDALONE_POWER_COLLAPSE", |
| 726 | MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE}, |
| 727 | |
| 728 | {0, 2, "C2", "POWER_COLLAPSE", |
| 729 | MSM_PM_SLEEP_MODE_POWER_COLLAPSE}, |
| 730 | |
| 731 | {1, 0, "C0", "WFI", |
| 732 | MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT}, |
| 733 | |
| 734 | {1, 1, "C1", "STANDALONE_POWER_COLLAPSE", |
| 735 | MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE}, |
| 736 | |
| 737 | {2, 0, "C0", "WFI", |
| 738 | MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT}, |
| 739 | |
| 740 | {2, 1, "C1", "STANDALONE_POWER_COLLAPSE", |
| 741 | MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE}, |
| 742 | |
| 743 | {3, 0, "C0", "WFI", |
| 744 | MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT}, |
| 745 | |
| 746 | {3, 1, "C1", "STANDALONE_POWER_COLLAPSE", |
| 747 | MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE}, |
| 748 | }; |
| 749 | |
| 750 | static struct msm_pm_platform_data msm_pm_data[] = { |
| 751 | [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = { |
| 752 | .idle_supported = 1, |
| 753 | .suspend_supported = 1, |
| 754 | .idle_enabled = 0, |
| 755 | .suspend_enabled = 0, |
| 756 | }, |
| 757 | |
| 758 | [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = { |
| 759 | .idle_supported = 1, |
| 760 | .suspend_supported = 1, |
| 761 | .idle_enabled = 0, |
| 762 | .suspend_enabled = 0, |
| 763 | }, |
| 764 | |
| 765 | [MSM_PM_MODE(0, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = { |
| 766 | .idle_supported = 1, |
| 767 | .suspend_supported = 1, |
| 768 | .idle_enabled = 1, |
| 769 | .suspend_enabled = 1, |
| 770 | }, |
| 771 | |
| 772 | [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = { |
| 773 | .idle_supported = 0, |
| 774 | .suspend_supported = 1, |
| 775 | .idle_enabled = 0, |
| 776 | .suspend_enabled = 0, |
| 777 | }, |
| 778 | |
| 779 | [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = { |
| 780 | .idle_supported = 1, |
| 781 | .suspend_supported = 1, |
| 782 | .idle_enabled = 0, |
| 783 | .suspend_enabled = 0, |
| 784 | }, |
| 785 | |
| 786 | [MSM_PM_MODE(1, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = { |
| 787 | .idle_supported = 1, |
| 788 | .suspend_supported = 0, |
| 789 | .idle_enabled = 1, |
| 790 | .suspend_enabled = 0, |
| 791 | }, |
| 792 | |
| 793 | [MSM_PM_MODE(2, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = { |
| 794 | .idle_supported = 0, |
| 795 | .suspend_supported = 1, |
| 796 | .idle_enabled = 0, |
| 797 | .suspend_enabled = 0, |
| 798 | }, |
| 799 | |
| 800 | [MSM_PM_MODE(2, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = { |
| 801 | .idle_supported = 1, |
| 802 | .suspend_supported = 1, |
| 803 | .idle_enabled = 0, |
| 804 | .suspend_enabled = 0, |
| 805 | }, |
| 806 | |
| 807 | [MSM_PM_MODE(2, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = { |
| 808 | .idle_supported = 1, |
| 809 | .suspend_supported = 0, |
| 810 | .idle_enabled = 1, |
| 811 | .suspend_enabled = 0, |
| 812 | }, |
| 813 | |
| 814 | [MSM_PM_MODE(3, MSM_PM_SLEEP_MODE_POWER_COLLAPSE)] = { |
| 815 | .idle_supported = 0, |
| 816 | .suspend_supported = 1, |
| 817 | .idle_enabled = 0, |
| 818 | .suspend_enabled = 0, |
| 819 | }, |
| 820 | |
| 821 | [MSM_PM_MODE(3, MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE)] = { |
| 822 | .idle_supported = 1, |
| 823 | .suspend_supported = 1, |
| 824 | .idle_enabled = 0, |
| 825 | .suspend_enabled = 0, |
| 826 | }, |
| 827 | |
| 828 | [MSM_PM_MODE(3, MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)] = { |
| 829 | .idle_supported = 1, |
| 830 | .suspend_supported = 0, |
| 831 | .idle_enabled = 1, |
| 832 | .suspend_enabled = 0, |
| 833 | }, |
| 834 | }; |
| 835 | |
| 836 | static uint8_t spm_wfi_cmd_sequence[] __initdata = { |
| 837 | 0x03, 0x0f, |
| 838 | }; |
| 839 | |
| 840 | static uint8_t spm_power_collapse_without_rpm[] __initdata = { |
| 841 | 0x00, 0x24, 0x54, 0x10, |
| 842 | 0x09, 0x03, 0x01, |
| 843 | 0x10, 0x54, 0x30, 0x0C, |
| 844 | 0x24, 0x30, 0x0f, |
| 845 | }; |
| 846 | |
| 847 | static uint8_t spm_power_collapse_with_rpm[] __initdata = { |
| 848 | 0x00, 0x24, 0x54, 0x10, |
| 849 | 0x09, 0x07, 0x01, 0x0B, |
| 850 | 0x10, 0x54, 0x30, 0x0C, |
| 851 | 0x24, 0x30, 0x0f, |
| 852 | }; |
| 853 | |
| 854 | static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = { |
| 855 | [0] = { |
| 856 | .mode = MSM_SPM_MODE_CLOCK_GATING, |
| 857 | .notify_rpm = false, |
| 858 | .cmd = spm_wfi_cmd_sequence, |
| 859 | }, |
| 860 | [1] = { |
| 861 | .mode = MSM_SPM_MODE_POWER_COLLAPSE, |
| 862 | .notify_rpm = false, |
| 863 | .cmd = spm_power_collapse_without_rpm, |
| 864 | }, |
| 865 | [2] = { |
| 866 | .mode = MSM_SPM_MODE_POWER_COLLAPSE, |
| 867 | .notify_rpm = true, |
| 868 | .cmd = spm_power_collapse_with_rpm, |
| 869 | }, |
| 870 | }; |
| 871 | |
| 872 | static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = { |
| 873 | 0x00, 0x20, 0x03, 0x20, |
| 874 | 0x00, 0x0f, |
| 875 | }; |
| 876 | |
| 877 | static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = { |
| 878 | 0x00, 0x20, 0x34, 0x64, |
| 879 | 0x48, 0x07, 0x48, 0x20, |
| 880 | 0x50, 0x64, 0x04, 0x34, |
| 881 | 0x50, 0x0f, |
| 882 | }; |
| 883 | static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = { |
| 884 | 0x00, 0x10, 0x34, 0x64, |
| 885 | 0x48, 0x07, 0x48, 0x10, |
| 886 | 0x50, 0x64, 0x04, 0x34, |
| 887 | 0x50, 0x0F, |
| 888 | }; |
| 889 | |
| 890 | static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = { |
| 891 | [0] = { |
| 892 | .mode = MSM_SPM_L2_MODE_RETENTION, |
| 893 | .notify_rpm = false, |
| 894 | .cmd = l2_spm_wfi_cmd_sequence, |
| 895 | }, |
| 896 | [1] = { |
| 897 | .mode = MSM_SPM_L2_MODE_GDHS, |
| 898 | .notify_rpm = true, |
| 899 | .cmd = l2_spm_gdhs_cmd_sequence, |
| 900 | }, |
| 901 | [2] = { |
| 902 | .mode = MSM_SPM_L2_MODE_POWER_COLLAPSE, |
| 903 | .notify_rpm = true, |
| 904 | .cmd = l2_spm_power_off_cmd_sequence, |
| 905 | }, |
| 906 | }; |
| 907 | |
| 908 | |
| 909 | static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = { |
| 910 | [0] = { |
| 911 | .reg_base_addr = MSM_SAW_L2_BASE, |
| 912 | .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00, |
| 913 | .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00, |
| 914 | .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202, |
| 915 | .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE, |
| 916 | .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020, |
| 917 | .modes = msm_spm_l2_seq_list, |
| 918 | .num_modes = ARRAY_SIZE(msm_spm_l2_seq_list), |
| 919 | }, |
| 920 | }; |
| 921 | |
| 922 | static struct msm_spm_platform_data msm_spm_data[] __initdata = { |
| 923 | [0] = { |
| 924 | .reg_base_addr = MSM_SAW0_BASE, |
| 925 | .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00, |
| 926 | .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F, |
| 927 | .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0x9C, |
| 928 | #if defined(CONFIG_MSM_AVS_HW) |
| 929 | .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00, |
| 930 | .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00, |
| 931 | #endif |
| 932 | .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01, |
| 933 | .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202, |
| 934 | .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C, |
| 935 | .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C, |
| 936 | .vctl_timeout_us = 50, |
| 937 | .num_modes = ARRAY_SIZE(msm_spm_seq_list), |
| 938 | .modes = msm_spm_seq_list, |
| 939 | }, |
| 940 | [1] = { |
| 941 | .reg_base_addr = MSM_SAW1_BASE, |
| 942 | .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00, |
| 943 | .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F, |
| 944 | .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0x9C, |
| 945 | #if defined(CONFIG_MSM_AVS_HW) |
| 946 | .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00, |
| 947 | .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00, |
| 948 | #endif |
| 949 | .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01, |
| 950 | .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202, |
| 951 | .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C, |
| 952 | .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C, |
| 953 | .vctl_timeout_us = 50, |
| 954 | .num_modes = ARRAY_SIZE(msm_spm_seq_list), |
| 955 | .modes = msm_spm_seq_list, |
| 956 | }, |
| 957 | [2] = { |
| 958 | .reg_base_addr = MSM_SAW2_BASE, |
| 959 | .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00, |
| 960 | .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F, |
| 961 | .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0x9C, |
| 962 | #if defined(CONFIG_MSM_AVS_HW) |
| 963 | .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00, |
| 964 | .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00, |
| 965 | #endif |
| 966 | .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01, |
| 967 | .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202, |
| 968 | .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C, |
| 969 | .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C, |
| 970 | .vctl_timeout_us = 50, |
| 971 | .num_modes = ARRAY_SIZE(msm_spm_seq_list), |
| 972 | .modes = msm_spm_seq_list, |
| 973 | }, |
| 974 | [3] = { |
| 975 | .reg_base_addr = MSM_SAW3_BASE, |
| 976 | .reg_init_values[MSM_SPM_REG_SAW2_SECURE] = 0x00, |
| 977 | .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F, |
| 978 | .reg_init_values[MSM_SPM_REG_SAW2_VCTL] = 0x9C, |
| 979 | #if defined(CONFIG_MSM_AVS_HW) |
| 980 | .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00, |
| 981 | .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00, |
| 982 | #endif |
| 983 | .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01, |
| 984 | .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020202, |
| 985 | .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C, |
| 986 | .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C, |
| 987 | .vctl_timeout_us = 50, |
| 988 | .num_modes = ARRAY_SIZE(msm_spm_seq_list), |
| 989 | .modes = msm_spm_seq_list, |
Jay Chokshi | 7805b5a | 2011-11-07 15:55:30 -0800 | [diff] [blame] | 990 | }, |
| 991 | }; |
| 992 | |
Gagan Mac | 8a7a5d3 | 2011-11-11 16:43:06 -0700 | [diff] [blame] | 993 | static void __init apq8064_init_buses(void) |
| 994 | { |
| 995 | msm_bus_rpm_set_mt_mask(); |
| 996 | msm_bus_8064_apps_fabric_pdata.rpm_enabled = 1; |
| 997 | msm_bus_8064_sys_fabric_pdata.rpm_enabled = 1; |
| 998 | msm_bus_8064_mm_fabric_pdata.rpm_enabled = 1; |
| 999 | msm_bus_8064_apps_fabric.dev.platform_data = |
| 1000 | &msm_bus_8064_apps_fabric_pdata; |
| 1001 | msm_bus_8064_sys_fabric.dev.platform_data = |
| 1002 | &msm_bus_8064_sys_fabric_pdata; |
| 1003 | msm_bus_8064_mm_fabric.dev.platform_data = |
| 1004 | &msm_bus_8064_mm_fabric_pdata; |
| 1005 | msm_bus_8064_sys_fpb.dev.platform_data = &msm_bus_8064_sys_fpb_pdata; |
| 1006 | msm_bus_8064_cpss_fpb.dev.platform_data = &msm_bus_8064_cpss_fpb_pdata; |
| 1007 | } |
| 1008 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1009 | static struct platform_device *common_devices[] __initdata = { |
Jin Hong | 01f2dbb | 2011-11-03 22:13:51 -0700 | [diff] [blame] | 1010 | &apq8064_device_dmov, |
Kenneth Heitke | 748593a | 2011-07-15 15:45:11 -0600 | [diff] [blame] | 1011 | &apq8064_device_qup_i2c_gsbi4, |
Harini Jayaraman | c4c5869 | 2011-07-19 14:50:10 -0600 | [diff] [blame] | 1012 | &apq8064_device_qup_spi_gsbi5, |
Sagar Dharia | 8bdcdaf | 2011-09-16 16:01:15 -0600 | [diff] [blame] | 1013 | &apq8064_slim_ctrl, |
Jay Chokshi | 9c25f07 | 2011-09-23 18:19:15 -0700 | [diff] [blame] | 1014 | &apq8064_device_ssbi_pmic1, |
| 1015 | &apq8064_device_ssbi_pmic2, |
Jeff Hugo | 0c0f5e9 | 2011-09-28 13:55:45 -0600 | [diff] [blame] | 1016 | &msm_device_smd_apq8064, |
Hemant Kumar | 4933b07 | 2011-10-17 23:43:11 -0700 | [diff] [blame] | 1017 | &apq8064_device_otg, |
| 1018 | &apq8064_device_gadget_peripheral, |
| 1019 | &android_usb_device, |
Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 1020 | #ifdef CONFIG_ANDROID_PMEM |
| 1021 | #ifndef CONFIG_MSM_MULTIMEDIA_USE_ION |
Kevin Chan | 13be4e2 | 2011-10-20 11:30:32 -0700 | [diff] [blame] | 1022 | &android_pmem_device, |
| 1023 | &android_pmem_adsp_device, |
Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 1024 | #endif |
Kevin Chan | 13be4e2 | 2011-10-20 11:30:32 -0700 | [diff] [blame] | 1025 | &android_pmem_audio_device, |
Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 1026 | #endif |
| 1027 | #ifdef CONFIG_ION_MSM |
| 1028 | &ion_dev, |
| 1029 | #endif |
Jeff Ohlstein | 7e66855 | 2011-10-06 16:17:25 -0700 | [diff] [blame] | 1030 | &msm8064_device_watchdog, |
Jay Chokshi | 7805b5a | 2011-11-07 15:55:30 -0800 | [diff] [blame] | 1031 | &msm8064_device_saw_regulator_core0, |
| 1032 | &msm8064_device_saw_regulator_core1, |
| 1033 | &msm8064_device_saw_regulator_core2, |
| 1034 | &msm8064_device_saw_regulator_core3, |
Ramesh Masavarapu | 2831191 | 2011-10-27 11:04:12 -0700 | [diff] [blame] | 1035 | #if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \ |
| 1036 | defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) |
| 1037 | &qcrypto_device, |
| 1038 | #endif |
| 1039 | |
| 1040 | #if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \ |
| 1041 | defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE) |
| 1042 | &qcedev_device, |
| 1043 | #endif |
Ramesh Masavarapu | f46be1b | 2011-11-03 11:13:41 -0700 | [diff] [blame] | 1044 | |
| 1045 | #ifdef CONFIG_HW_RANDOM_MSM |
| 1046 | &apq8064_device_rng, |
| 1047 | #endif |
Bharath Ramachandramurthy | b8e797f | 2011-11-30 12:08:42 -0800 | [diff] [blame] | 1048 | &apq_pcm, |
| 1049 | &apq_pcm_routing, |
| 1050 | &apq_cpudai0, |
| 1051 | &apq_cpudai1, |
| 1052 | &apq_cpudai_hdmi_rx, |
| 1053 | &apq_cpudai_bt_rx, |
| 1054 | &apq_cpudai_bt_tx, |
| 1055 | &apq_cpudai_fm_rx, |
| 1056 | &apq_cpudai_fm_tx, |
| 1057 | &apq_cpu_fe, |
| 1058 | &apq_stub_codec, |
| 1059 | &apq_voice, |
| 1060 | &apq_voip, |
| 1061 | &apq_lpa_pcm, |
| 1062 | &apq_pcm_hostless, |
| 1063 | &apq_cpudai_afe_01_rx, |
| 1064 | &apq_cpudai_afe_01_tx, |
| 1065 | &apq_cpudai_afe_02_rx, |
| 1066 | &apq_cpudai_afe_02_tx, |
| 1067 | &apq_pcm_afe, |
| 1068 | &apq_cpudai_auxpcm_rx, |
| 1069 | &apq_cpudai_auxpcm_tx, |
Praveen Chidambaram | 7849901 | 2011-11-01 17:15:17 -0600 | [diff] [blame] | 1070 | &apq8064_rpm_device, |
| 1071 | &apq8064_rpm_log_device, |
| 1072 | &apq8064_rpm_stat_device, |
Gagan Mac | 8a7a5d3 | 2011-11-11 16:43:06 -0700 | [diff] [blame] | 1073 | &msm_bus_8064_apps_fabric, |
| 1074 | &msm_bus_8064_sys_fabric, |
| 1075 | &msm_bus_8064_mm_fabric, |
| 1076 | &msm_bus_8064_sys_fpb, |
| 1077 | &msm_bus_8064_cpss_fpb, |
Rajesh Sastrula | aee8af3 | 2012-01-20 11:46:31 -0800 | [diff] [blame] | 1078 | &msm_device_vidc, |
Harini Jayaraman | c4c5869 | 2011-07-19 14:50:10 -0600 | [diff] [blame] | 1079 | }; |
| 1080 | |
Joel King | 4e7ad22 | 2011-08-17 15:47:38 -0700 | [diff] [blame] | 1081 | static struct platform_device *sim_devices[] __initdata = { |
Stepan Moskovchenko | 2701a44 | 2011-08-19 13:47:22 -0700 | [diff] [blame] | 1082 | &apq8064_device_uart_gsbi3, |
Yan He | 06913ce | 2011-08-26 16:33:46 -0700 | [diff] [blame] | 1083 | &msm_device_sps_apq8064, |
Stepan Moskovchenko | 2701a44 | 2011-08-19 13:47:22 -0700 | [diff] [blame] | 1084 | }; |
| 1085 | |
| 1086 | static struct platform_device *rumi3_devices[] __initdata = { |
| 1087 | &apq8064_device_uart_gsbi1, |
Yan He | 435ed61 | 2011-11-23 17:34:59 -0800 | [diff] [blame] | 1088 | &msm_device_sps_apq8064, |
Huaibin Yang | 4a084e3 | 2011-12-15 15:25:52 -0800 | [diff] [blame] | 1089 | #ifdef CONFIG_MSM_ROTATOR |
| 1090 | &msm_rotator_device, |
| 1091 | #endif |
Joel King | 4e7ad22 | 2011-08-17 15:47:38 -0700 | [diff] [blame] | 1092 | }; |
| 1093 | |
Joel King | 82b7e3f | 2012-01-05 10:03:27 -0800 | [diff] [blame] | 1094 | static struct platform_device *cdp_devices[] __initdata = { |
| 1095 | &apq8064_device_uart_gsbi1, |
| 1096 | &msm_device_sps_apq8064, |
| 1097 | }; |
| 1098 | |
Harini Jayaraman | c4c5869 | 2011-07-19 14:50:10 -0600 | [diff] [blame] | 1099 | static struct msm_spi_platform_data apq8064_qup_spi_gsbi5_pdata = { |
Harini Jayaraman | 60ee14c | 2011-11-09 18:53:27 -0700 | [diff] [blame] | 1100 | .max_clock_speed = 24000000, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1101 | }; |
| 1102 | |
Stepan Moskovchenko | eed82a5 | 2011-09-02 13:19:23 -0700 | [diff] [blame] | 1103 | #define KS8851_IRQ_GPIO 43 |
| 1104 | |
| 1105 | static struct spi_board_info spi_board_info[] __initdata = { |
| 1106 | { |
| 1107 | .modalias = "ks8851", |
| 1108 | .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO), |
| 1109 | .max_speed_hz = 19200000, |
| 1110 | .bus_num = 0, |
| 1111 | .chip_select = 2, |
| 1112 | .mode = SPI_MODE_0, |
| 1113 | }, |
| 1114 | }; |
| 1115 | |
Sagar Dharia | 8bdcdaf | 2011-09-16 16:01:15 -0600 | [diff] [blame] | 1116 | static struct slim_boardinfo apq8064_slim_devices[] = { |
Swaminathan Sathappan | 2f51a75 | 2011-12-05 12:51:19 -0800 | [diff] [blame] | 1117 | { |
Swaminathan Sathappan | cef966d | 2011-12-15 17:27:04 -0800 | [diff] [blame] | 1118 | .bus_num = 1, |
| 1119 | .slim_slave = &apq8064_slim_tabla, |
| 1120 | }, |
| 1121 | { |
| 1122 | .bus_num = 1, |
| 1123 | .slim_slave = &apq8064_slim_tabla20, |
Swaminathan Sathappan | 2f51a75 | 2011-12-05 12:51:19 -0800 | [diff] [blame] | 1124 | }, |
| 1125 | /* add more slimbus slaves as needed */ |
Sagar Dharia | 8bdcdaf | 2011-09-16 16:01:15 -0600 | [diff] [blame] | 1126 | }; |
| 1127 | |
Kenneth Heitke | 748593a | 2011-07-15 15:45:11 -0600 | [diff] [blame] | 1128 | static struct msm_i2c_platform_data apq8064_i2c_qup_gsbi4_pdata = { |
| 1129 | .clk_freq = 100000, |
| 1130 | .src_clk_rate = 24000000, |
Kenneth Heitke | 748593a | 2011-07-15 15:45:11 -0600 | [diff] [blame] | 1131 | }; |
| 1132 | |
| 1133 | static void __init apq8064_i2c_init(void) |
| 1134 | { |
| 1135 | apq8064_device_qup_i2c_gsbi4.dev.platform_data = |
| 1136 | &apq8064_i2c_qup_gsbi4_pdata; |
| 1137 | } |
| 1138 | |
Stepan Moskovchenko | eed82a5 | 2011-09-02 13:19:23 -0700 | [diff] [blame] | 1139 | #ifdef CONFIG_KS8851 |
| 1140 | static int ethernet_init(void) |
| 1141 | { |
| 1142 | int ret; |
| 1143 | ret = gpio_request(KS8851_IRQ_GPIO, "ks8851_irq"); |
| 1144 | if (ret) { |
| 1145 | pr_err("ks8851 gpio_request failed: %d\n", ret); |
| 1146 | goto fail; |
| 1147 | } |
| 1148 | |
| 1149 | return 0; |
| 1150 | fail: |
| 1151 | return ret; |
| 1152 | } |
| 1153 | #else |
| 1154 | static int ethernet_init(void) |
| 1155 | { |
| 1156 | return 0; |
| 1157 | } |
| 1158 | #endif |
| 1159 | |
Tianyi Gou | 41515e2 | 2011-09-01 19:37:43 -0700 | [diff] [blame] | 1160 | static void __init apq8064_clock_init(void) |
| 1161 | { |
| 1162 | if (machine_is_apq8064_sim()) |
| 1163 | msm_clock_init(&apq8064_clock_init_data); |
| 1164 | else |
| 1165 | msm_clock_init(&apq8064_dummy_clock_init_data); |
| 1166 | } |
| 1167 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1168 | static void __init apq8064_common_init(void) |
| 1169 | { |
| 1170 | if (socinfo_init() < 0) |
| 1171 | pr_err("socinfo_init() failed!\n"); |
Praveen Chidambaram | 7849901 | 2011-11-01 17:15:17 -0600 | [diff] [blame] | 1172 | BUG_ON(msm_rpm_init(&apq8064_rpm_data)); |
| 1173 | BUG_ON(msm_rpmrs_levels_init(&msm_rpmrs_data)); |
Tianyi Gou | 41515e2 | 2011-09-01 19:37:43 -0700 | [diff] [blame] | 1174 | apq8064_clock_init(); |
Stepan Moskovchenko | 2327a95 | 2011-12-14 16:31:28 -0800 | [diff] [blame] | 1175 | apq8064_init_gpiomux(); |
Kenneth Heitke | 748593a | 2011-07-15 15:45:11 -0600 | [diff] [blame] | 1176 | apq8064_i2c_init(); |
Kenneth Heitke | 36920d3 | 2011-07-20 16:44:30 -0600 | [diff] [blame] | 1177 | |
Harini Jayaraman | c4c5869 | 2011-07-19 14:50:10 -0600 | [diff] [blame] | 1178 | apq8064_device_qup_spi_gsbi5.dev.platform_data = |
| 1179 | &apq8064_qup_spi_gsbi5_pdata; |
Stepan Moskovchenko | c1074f0 | 2011-12-14 17:51:57 -0800 | [diff] [blame] | 1180 | apq8064_init_pmic(); |
Stepan Moskovchenko | 14aa649 | 2011-08-08 15:15:01 -0700 | [diff] [blame] | 1181 | apq8064_device_otg.dev.platform_data = &msm_otg_pdata; |
Gagan Mac | 8a7a5d3 | 2011-11-11 16:43:06 -0700 | [diff] [blame] | 1182 | apq8064_init_buses(); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1183 | platform_add_devices(common_devices, ARRAY_SIZE(common_devices)); |
Sahitya Tummala | 3586ed9 | 2011-08-03 09:13:23 +0530 | [diff] [blame] | 1184 | apq8064_init_mmc(); |
Sagar Dharia | 8bdcdaf | 2011-09-16 16:01:15 -0600 | [diff] [blame] | 1185 | slim_register_board_info(apq8064_slim_devices, |
| 1186 | ARRAY_SIZE(apq8064_slim_devices)); |
Praveen Chidambaram | 7849901 | 2011-11-01 17:15:17 -0600 | [diff] [blame] | 1187 | msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data)); |
Mahesh Sivasubramanian | cbce1ec | 2012-01-24 10:32:44 -0700 | [diff] [blame^] | 1188 | acpuclk_init(&acpuclk_8064_soc_data); |
Praveen Chidambaram | 7849901 | 2011-11-01 17:15:17 -0600 | [diff] [blame] | 1189 | msm_spm_l2_init(msm_spm_l2_data); |
| 1190 | msm_pm_set_platform_data(msm_pm_data, ARRAY_SIZE(msm_pm_data)); |
| 1191 | msm_pm_set_rpm_wakeup_irq(RPM_APCC_CPU0_WAKE_UP_IRQ); |
| 1192 | msm_cpuidle_set_states(msm_cstates, ARRAY_SIZE(msm_cstates), |
| 1193 | msm_pm_data); |
| 1194 | BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata)); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1195 | } |
| 1196 | |
Huaibin Yang | 4a084e3 | 2011-12-15 15:25:52 -0800 | [diff] [blame] | 1197 | static void __init apq8064_allocate_memory_regions(void) |
| 1198 | { |
| 1199 | apq8064_allocate_fb_region(); |
| 1200 | } |
| 1201 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1202 | static void __init apq8064_sim_init(void) |
| 1203 | { |
Jeff Ohlstein | 7e66855 | 2011-10-06 16:17:25 -0700 | [diff] [blame] | 1204 | struct msm_watchdog_pdata *wdog_pdata = (struct msm_watchdog_pdata *) |
| 1205 | &msm8064_device_watchdog.dev.platform_data; |
| 1206 | |
| 1207 | wdog_pdata->bark_time = 15000; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1208 | apq8064_common_init(); |
Joel King | 4e7ad22 | 2011-08-17 15:47:38 -0700 | [diff] [blame] | 1209 | platform_add_devices(sim_devices, ARRAY_SIZE(sim_devices)); |
| 1210 | } |
| 1211 | |
| 1212 | static void __init apq8064_rumi3_init(void) |
| 1213 | { |
| 1214 | apq8064_common_init(); |
Stepan Moskovchenko | eed82a5 | 2011-09-02 13:19:23 -0700 | [diff] [blame] | 1215 | ethernet_init(); |
Stepan Moskovchenko | 2701a44 | 2011-08-19 13:47:22 -0700 | [diff] [blame] | 1216 | platform_add_devices(rumi3_devices, ARRAY_SIZE(rumi3_devices)); |
Stepan Moskovchenko | eed82a5 | 2011-09-02 13:19:23 -0700 | [diff] [blame] | 1217 | spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info)); |
Huaibin Yang | 4a084e3 | 2011-12-15 15:25:52 -0800 | [diff] [blame] | 1218 | apq8064_init_fb(); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1219 | } |
| 1220 | |
Joel King | 82b7e3f | 2012-01-05 10:03:27 -0800 | [diff] [blame] | 1221 | static void __init apq8064_cdp_init(void) |
| 1222 | { |
| 1223 | apq8064_common_init(); |
| 1224 | ethernet_init(); |
| 1225 | platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices)); |
| 1226 | spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info)); |
| 1227 | } |
| 1228 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1229 | MACHINE_START(APQ8064_SIM, "QCT APQ8064 SIMULATOR") |
| 1230 | .map_io = apq8064_map_io, |
Kevin Chan | 13be4e2 | 2011-10-20 11:30:32 -0700 | [diff] [blame] | 1231 | .reserve = apq8064_reserve, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1232 | .init_irq = apq8064_init_irq, |
Marc Zyngier | 89bdafd1 | 2011-12-22 11:39:20 +0530 | [diff] [blame] | 1233 | .handle_irq = gic_handle_irq, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1234 | .timer = &msm_timer, |
| 1235 | .init_machine = apq8064_sim_init, |
| 1236 | MACHINE_END |
| 1237 | |
Joel King | 4e7ad22 | 2011-08-17 15:47:38 -0700 | [diff] [blame] | 1238 | MACHINE_START(APQ8064_RUMI3, "QCT APQ8064 RUMI3") |
| 1239 | .map_io = apq8064_map_io, |
Kevin Chan | 13be4e2 | 2011-10-20 11:30:32 -0700 | [diff] [blame] | 1240 | .reserve = apq8064_reserve, |
Joel King | 4e7ad22 | 2011-08-17 15:47:38 -0700 | [diff] [blame] | 1241 | .init_irq = apq8064_init_irq, |
Marc Zyngier | 89bdafd1 | 2011-12-22 11:39:20 +0530 | [diff] [blame] | 1242 | .handle_irq = gic_handle_irq, |
Joel King | 4e7ad22 | 2011-08-17 15:47:38 -0700 | [diff] [blame] | 1243 | .timer = &msm_timer, |
| 1244 | .init_machine = apq8064_rumi3_init, |
Huaibin Yang | 4a084e3 | 2011-12-15 15:25:52 -0800 | [diff] [blame] | 1245 | .init_early = apq8064_allocate_memory_regions, |
Joel King | 4e7ad22 | 2011-08-17 15:47:38 -0700 | [diff] [blame] | 1246 | MACHINE_END |
| 1247 | |
Joel King | 82b7e3f | 2012-01-05 10:03:27 -0800 | [diff] [blame] | 1248 | MACHINE_START(APQ8064_CDP, "QCT APQ8064 CDP") |
| 1249 | .map_io = apq8064_map_io, |
| 1250 | .reserve = apq8064_reserve, |
| 1251 | .init_irq = apq8064_init_irq, |
| 1252 | .handle_irq = gic_handle_irq, |
| 1253 | .timer = &msm_timer, |
| 1254 | .init_machine = apq8064_cdp_init, |
| 1255 | MACHINE_END |
| 1256 | |
| 1257 | MACHINE_START(APQ8064_MTP, "QCT APQ8064 MTP") |
| 1258 | .map_io = apq8064_map_io, |
| 1259 | .reserve = apq8064_reserve, |
| 1260 | .init_irq = apq8064_init_irq, |
| 1261 | .handle_irq = gic_handle_irq, |
| 1262 | .timer = &msm_timer, |
| 1263 | .init_machine = apq8064_cdp_init, |
| 1264 | MACHINE_END |
| 1265 | |
| 1266 | MACHINE_START(APQ8064_LIQUID, "QCT APQ8064 LIQUID") |
| 1267 | .map_io = apq8064_map_io, |
| 1268 | .reserve = apq8064_reserve, |
| 1269 | .init_irq = apq8064_init_irq, |
| 1270 | .handle_irq = gic_handle_irq, |
| 1271 | .timer = &msm_timer, |
| 1272 | .init_machine = apq8064_cdp_init, |
| 1273 | MACHINE_END |
| 1274 | |