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> |
Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 43 | #ifdef CONFIG_ANDROID_PMEM |
Kevin Chan | 13be4e2 | 2011-10-20 11:30:32 -0700 | [diff] [blame] | 44 | #include <linux/android_pmem.h> |
Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 45 | #endif |
Kevin Chan | 13be4e2 | 2011-10-20 11:30:32 -0700 | [diff] [blame] | 46 | #include <mach/msm_memtypes.h> |
| 47 | #include <linux/bootmem.h> |
| 48 | #include <asm/setup.h> |
Ramesh Masavarapu | 2831191 | 2011-10-27 11:04:12 -0700 | [diff] [blame] | 49 | #include <mach/dma.h> |
Gagan Mac | 8a7a5d3 | 2011-11-11 16:43:06 -0700 | [diff] [blame] | 50 | #include <mach/msm_bus_board.h> |
Joel King | 4ebccc6 | 2011-07-22 09:43:22 -0700 | [diff] [blame] | 51 | |
Jeff Ohlstein | 7e66855 | 2011-10-06 16:17:25 -0700 | [diff] [blame] | 52 | #include "msm_watchdog.h" |
Stepan Moskovchenko | 5a83dba | 2011-12-05 17:30:17 -0800 | [diff] [blame] | 53 | #include "board-8064.h" |
Jay Chokshi | ea67c62 | 2011-07-29 17:12:26 -0700 | [diff] [blame] | 54 | |
Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 55 | #define MSM_PMEM_ADSP_SIZE 0x7800000 |
Ben Romberger | 3ffcd81 | 2011-12-08 19:12:10 -0800 | [diff] [blame] | 56 | #define MSM_PMEM_AUDIO_SIZE 0x2B4000 |
Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 57 | #ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY |
| 58 | #define MSM_PMEM_SIZE 0x4000000 /* 64 Mbytes */ |
| 59 | #else |
| 60 | #define MSM_PMEM_SIZE 0x2800000 /* 40 Mbytes */ |
| 61 | #endif |
Kevin Chan | 13be4e2 | 2011-10-20 11:30:32 -0700 | [diff] [blame] | 62 | |
Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 63 | #ifdef CONFIG_MSM_MULTIMEDIA_USE_ION |
| 64 | #define MSM_PMEM_KERNEL_EBI1_SIZE 0xB0C000 |
| 65 | #define MSM_ION_SF_SIZE MSM_PMEM_SIZE |
Olav Haugan | d3d2968 | 2012-01-19 10:57:07 -0800 | [diff] [blame] | 66 | #define MSM_ION_MM_FW_SIZE 0x200000 /* (2MB) */ |
Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 67 | #define MSM_ION_MM_SIZE MSM_PMEM_ADSP_SIZE |
Olav Haugan | f45e214 | 2012-01-19 11:01:01 -0800 | [diff] [blame] | 68 | #define MSM_ION_QSECOM_SIZE 0x100000 /* (1MB) */ |
Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 69 | #define MSM_ION_MFC_SIZE SZ_8K |
Olav Haugan | 2c43fac | 2012-01-19 11:06:37 -0800 | [diff] [blame^] | 70 | #define MSM_ION_AUDIO_SIZE MSM_PMEM_AUDIO_SIZE |
| 71 | #define MSM_ION_HEAP_NUM 8 |
Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 72 | #else |
| 73 | #define MSM_PMEM_KERNEL_EBI1_SIZE 0x110C000 |
| 74 | #define MSM_ION_HEAP_NUM 1 |
| 75 | #endif |
Kevin Chan | 13be4e2 | 2011-10-20 11:30:32 -0700 | [diff] [blame] | 76 | |
Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 77 | #ifdef CONFIG_KERNEL_PMEM_EBI_REGION |
| 78 | static unsigned pmem_kernel_ebi1_size = MSM_PMEM_KERNEL_EBI1_SIZE; |
| 79 | static int __init pmem_kernel_ebi1_size_setup(char *p) |
Kevin Chan | 13be4e2 | 2011-10-20 11:30:32 -0700 | [diff] [blame] | 80 | { |
Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 81 | pmem_kernel_ebi1_size = memparse(p, NULL); |
| 82 | return 0; |
Kevin Chan | 13be4e2 | 2011-10-20 11:30:32 -0700 | [diff] [blame] | 83 | } |
Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 84 | early_param("pmem_kernel_ebi1_size", pmem_kernel_ebi1_size_setup); |
| 85 | #endif |
Kevin Chan | 13be4e2 | 2011-10-20 11:30:32 -0700 | [diff] [blame] | 86 | |
Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 87 | #ifdef CONFIG_ANDROID_PMEM |
Kevin Chan | 13be4e2 | 2011-10-20 11:30:32 -0700 | [diff] [blame] | 88 | static unsigned pmem_size = MSM_PMEM_SIZE; |
| 89 | static int __init pmem_size_setup(char *p) |
| 90 | { |
| 91 | pmem_size = memparse(p, NULL); |
| 92 | return 0; |
| 93 | } |
| 94 | early_param("pmem_size", pmem_size_setup); |
| 95 | |
| 96 | static unsigned pmem_adsp_size = MSM_PMEM_ADSP_SIZE; |
| 97 | |
| 98 | static int __init pmem_adsp_size_setup(char *p) |
| 99 | { |
| 100 | pmem_adsp_size = memparse(p, NULL); |
| 101 | return 0; |
| 102 | } |
| 103 | early_param("pmem_adsp_size", pmem_adsp_size_setup); |
| 104 | |
| 105 | static unsigned pmem_audio_size = MSM_PMEM_AUDIO_SIZE; |
| 106 | |
| 107 | static int __init pmem_audio_size_setup(char *p) |
| 108 | { |
| 109 | pmem_audio_size = memparse(p, NULL); |
| 110 | return 0; |
| 111 | } |
| 112 | early_param("pmem_audio_size", pmem_audio_size_setup); |
Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 113 | #endif |
Kevin Chan | 13be4e2 | 2011-10-20 11:30:32 -0700 | [diff] [blame] | 114 | |
Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 115 | #ifdef CONFIG_ANDROID_PMEM |
| 116 | #ifndef CONFIG_MSM_MULTIMEDIA_USE_ION |
Kevin Chan | 13be4e2 | 2011-10-20 11:30:32 -0700 | [diff] [blame] | 117 | static struct android_pmem_platform_data android_pmem_pdata = { |
| 118 | .name = "pmem", |
| 119 | .allocator_type = PMEM_ALLOCATORTYPE_ALLORNOTHING, |
| 120 | .cached = 1, |
| 121 | .memory_type = MEMTYPE_EBI1, |
| 122 | }; |
| 123 | |
| 124 | static struct platform_device android_pmem_device = { |
| 125 | .name = "android_pmem", |
| 126 | .id = 0, |
| 127 | .dev = {.platform_data = &android_pmem_pdata}, |
| 128 | }; |
| 129 | |
| 130 | static struct android_pmem_platform_data android_pmem_adsp_pdata = { |
| 131 | .name = "pmem_adsp", |
| 132 | .allocator_type = PMEM_ALLOCATORTYPE_BITMAP, |
| 133 | .cached = 0, |
| 134 | .memory_type = MEMTYPE_EBI1, |
| 135 | }; |
Kevin Chan | 13be4e2 | 2011-10-20 11:30:32 -0700 | [diff] [blame] | 136 | static struct platform_device android_pmem_adsp_device = { |
| 137 | .name = "android_pmem", |
| 138 | .id = 2, |
| 139 | .dev = { .platform_data = &android_pmem_adsp_pdata }, |
| 140 | }; |
Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 141 | #endif |
Kevin Chan | 13be4e2 | 2011-10-20 11:30:32 -0700 | [diff] [blame] | 142 | |
| 143 | static struct android_pmem_platform_data android_pmem_audio_pdata = { |
| 144 | .name = "pmem_audio", |
| 145 | .allocator_type = PMEM_ALLOCATORTYPE_BITMAP, |
| 146 | .cached = 0, |
| 147 | .memory_type = MEMTYPE_EBI1, |
| 148 | }; |
| 149 | |
| 150 | static struct platform_device android_pmem_audio_device = { |
| 151 | .name = "android_pmem", |
| 152 | .id = 4, |
| 153 | .dev = { .platform_data = &android_pmem_audio_pdata }, |
| 154 | }; |
Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 155 | #endif |
| 156 | |
| 157 | static struct memtype_reserve apq8064_reserve_table[] __initdata = { |
| 158 | [MEMTYPE_SMI] = { |
| 159 | }, |
| 160 | [MEMTYPE_EBI0] = { |
| 161 | .flags = MEMTYPE_FLAGS_1M_ALIGN, |
| 162 | }, |
| 163 | [MEMTYPE_EBI1] = { |
| 164 | .flags = MEMTYPE_FLAGS_1M_ALIGN, |
| 165 | }, |
| 166 | }; |
Kevin Chan | 13be4e2 | 2011-10-20 11:30:32 -0700 | [diff] [blame] | 167 | |
| 168 | static void __init size_pmem_devices(void) |
| 169 | { |
Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 170 | #ifdef CONFIG_ANDROID_PMEM |
| 171 | #ifndef CONFIG_MSM_MULTIMEDIA_USE_ION |
Kevin Chan | 13be4e2 | 2011-10-20 11:30:32 -0700 | [diff] [blame] | 172 | android_pmem_adsp_pdata.size = pmem_adsp_size; |
| 173 | android_pmem_pdata.size = pmem_size; |
Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 174 | #endif |
Kevin Chan | 13be4e2 | 2011-10-20 11:30:32 -0700 | [diff] [blame] | 175 | android_pmem_audio_pdata.size = MSM_PMEM_AUDIO_SIZE; |
Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 176 | #endif |
Kevin Chan | 13be4e2 | 2011-10-20 11:30:32 -0700 | [diff] [blame] | 177 | } |
| 178 | |
| 179 | static void __init reserve_memory_for(struct android_pmem_platform_data *p) |
| 180 | { |
| 181 | apq8064_reserve_table[p->memory_type].size += p->size; |
| 182 | } |
| 183 | |
Kevin Chan | 13be4e2 | 2011-10-20 11:30:32 -0700 | [diff] [blame] | 184 | static void __init reserve_pmem_memory(void) |
| 185 | { |
Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 186 | #ifdef CONFIG_ANDROID_PMEM |
| 187 | #ifndef CONFIG_MSM_MULTIMEDIA_USE_ION |
Kevin Chan | 13be4e2 | 2011-10-20 11:30:32 -0700 | [diff] [blame] | 188 | reserve_memory_for(&android_pmem_adsp_pdata); |
| 189 | reserve_memory_for(&android_pmem_pdata); |
Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 190 | #endif |
Kevin Chan | 13be4e2 | 2011-10-20 11:30:32 -0700 | [diff] [blame] | 191 | reserve_memory_for(&android_pmem_audio_pdata); |
| 192 | apq8064_reserve_table[MEMTYPE_EBI1].size += pmem_kernel_ebi1_size; |
Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 193 | #endif |
| 194 | } |
| 195 | |
| 196 | static int apq8064_paddr_to_memtype(unsigned int paddr) |
| 197 | { |
| 198 | return MEMTYPE_EBI1; |
| 199 | } |
| 200 | |
| 201 | #ifdef CONFIG_ION_MSM |
| 202 | #ifdef CONFIG_MSM_MULTIMEDIA_USE_ION |
| 203 | static struct ion_cp_heap_pdata cp_mm_ion_pdata = { |
| 204 | .permission_type = IPT_TYPE_MM_CARVEOUT, |
Olav Haugan | d3d2968 | 2012-01-19 10:57:07 -0800 | [diff] [blame] | 205 | .align = PAGE_SIZE, |
Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 206 | }; |
| 207 | |
| 208 | static struct ion_cp_heap_pdata cp_mfc_ion_pdata = { |
| 209 | .permission_type = IPT_TYPE_MFC_SHAREDMEM, |
Olav Haugan | d3d2968 | 2012-01-19 10:57:07 -0800 | [diff] [blame] | 210 | .align = PAGE_SIZE, |
Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 211 | }; |
| 212 | |
| 213 | static struct ion_co_heap_pdata co_ion_pdata = { |
Olav Haugan | d3d2968 | 2012-01-19 10:57:07 -0800 | [diff] [blame] | 214 | .adjacent_mem_id = INVALID_HEAP_ID, |
| 215 | .align = PAGE_SIZE, |
| 216 | }; |
| 217 | |
| 218 | static struct ion_co_heap_pdata fw_co_ion_pdata = { |
| 219 | .adjacent_mem_id = ION_CP_MM_HEAP_ID, |
| 220 | .align = SZ_128K, |
Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 221 | }; |
| 222 | #endif |
| 223 | static struct ion_platform_data ion_pdata = { |
| 224 | .nr = MSM_ION_HEAP_NUM, |
| 225 | .heaps = { |
| 226 | { |
| 227 | .id = ION_SYSTEM_HEAP_ID, |
| 228 | .type = ION_HEAP_TYPE_SYSTEM, |
| 229 | .name = ION_VMALLOC_HEAP_NAME, |
| 230 | }, |
| 231 | #ifdef CONFIG_MSM_MULTIMEDIA_USE_ION |
| 232 | { |
| 233 | .id = ION_SF_HEAP_ID, |
| 234 | .type = ION_HEAP_TYPE_CARVEOUT, |
| 235 | .name = ION_SF_HEAP_NAME, |
| 236 | .size = MSM_ION_SF_SIZE, |
| 237 | .memory_type = ION_EBI_TYPE, |
| 238 | .extra_data = (void *) &co_ion_pdata, |
| 239 | }, |
| 240 | { |
| 241 | .id = ION_CP_MM_HEAP_ID, |
| 242 | .type = ION_HEAP_TYPE_CP, |
| 243 | .name = ION_MM_HEAP_NAME, |
| 244 | .size = MSM_ION_MM_SIZE, |
| 245 | .memory_type = ION_EBI_TYPE, |
| 246 | .extra_data = (void *) &cp_mm_ion_pdata, |
| 247 | }, |
| 248 | { |
Olav Haugan | d3d2968 | 2012-01-19 10:57:07 -0800 | [diff] [blame] | 249 | .id = ION_MM_FIRMWARE_HEAP_ID, |
| 250 | .type = ION_HEAP_TYPE_CARVEOUT, |
| 251 | .name = ION_MM_FIRMWARE_HEAP_NAME, |
| 252 | .size = MSM_ION_MM_FW_SIZE, |
| 253 | .memory_type = ION_EBI_TYPE, |
| 254 | .extra_data = (void *) &fw_co_ion_pdata, |
| 255 | }, |
| 256 | { |
Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 257 | .id = ION_CP_MFC_HEAP_ID, |
| 258 | .type = ION_HEAP_TYPE_CP, |
| 259 | .name = ION_MFC_HEAP_NAME, |
| 260 | .size = MSM_ION_MFC_SIZE, |
| 261 | .memory_type = ION_EBI_TYPE, |
| 262 | .extra_data = (void *) &cp_mfc_ion_pdata, |
| 263 | }, |
| 264 | { |
| 265 | .id = ION_IOMMU_HEAP_ID, |
| 266 | .type = ION_HEAP_TYPE_IOMMU, |
| 267 | .name = ION_IOMMU_HEAP_NAME, |
| 268 | }, |
Olav Haugan | f45e214 | 2012-01-19 11:01:01 -0800 | [diff] [blame] | 269 | { |
| 270 | .id = ION_QSECOM_HEAP_ID, |
| 271 | .type = ION_HEAP_TYPE_CARVEOUT, |
| 272 | .name = ION_QSECOM_HEAP_NAME, |
| 273 | .size = MSM_ION_QSECOM_SIZE, |
| 274 | .memory_type = ION_EBI_TYPE, |
| 275 | .extra_data = (void *) &co_ion_pdata, |
| 276 | }, |
Olav Haugan | 2c43fac | 2012-01-19 11:06:37 -0800 | [diff] [blame^] | 277 | { |
| 278 | .id = ION_AUDIO_HEAP_ID, |
| 279 | .type = ION_HEAP_TYPE_CARVEOUT, |
| 280 | .name = ION_AUDIO_HEAP_NAME, |
| 281 | .size = MSM_ION_AUDIO_SIZE, |
| 282 | .memory_type = ION_EBI_TYPE, |
| 283 | .extra_data = (void *) &co_ion_pdata, |
| 284 | }, |
Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 285 | #endif |
| 286 | } |
| 287 | }; |
| 288 | |
| 289 | static struct platform_device ion_dev = { |
| 290 | .name = "ion-msm", |
| 291 | .id = 1, |
| 292 | .dev = { .platform_data = &ion_pdata }, |
| 293 | }; |
| 294 | #endif |
| 295 | |
| 296 | static void reserve_ion_memory(void) |
| 297 | { |
| 298 | #if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION) |
| 299 | apq8064_reserve_table[MEMTYPE_EBI1].size += MSM_ION_MM_SIZE; |
Olav Haugan | d3d2968 | 2012-01-19 10:57:07 -0800 | [diff] [blame] | 300 | apq8064_reserve_table[MEMTYPE_EBI1].size += MSM_ION_MM_FW_SIZE; |
Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 301 | apq8064_reserve_table[MEMTYPE_EBI1].size += MSM_ION_SF_SIZE; |
| 302 | apq8064_reserve_table[MEMTYPE_EBI1].size += MSM_ION_MFC_SIZE; |
Olav Haugan | f45e214 | 2012-01-19 11:01:01 -0800 | [diff] [blame] | 303 | apq8064_reserve_table[MEMTYPE_EBI1].size += MSM_ION_QSECOM_SIZE; |
Olav Haugan | 2c43fac | 2012-01-19 11:06:37 -0800 | [diff] [blame^] | 304 | apq8064_reserve_table[MEMTYPE_EBI1].size += MSM_ION_AUDIO_SIZE; |
Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 305 | #endif |
Kevin Chan | 13be4e2 | 2011-10-20 11:30:32 -0700 | [diff] [blame] | 306 | } |
| 307 | |
| 308 | static void __init apq8064_calculate_reserve_sizes(void) |
| 309 | { |
| 310 | size_pmem_devices(); |
| 311 | reserve_pmem_memory(); |
Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 312 | reserve_ion_memory(); |
Kevin Chan | 13be4e2 | 2011-10-20 11:30:32 -0700 | [diff] [blame] | 313 | } |
| 314 | |
| 315 | static struct reserve_info apq8064_reserve_info __initdata = { |
| 316 | .memtype_reserve_table = apq8064_reserve_table, |
| 317 | .calculate_reserve_sizes = apq8064_calculate_reserve_sizes, |
| 318 | .paddr_to_memtype = apq8064_paddr_to_memtype, |
| 319 | }; |
| 320 | |
| 321 | static int apq8064_memory_bank_size(void) |
| 322 | { |
| 323 | return 1<<29; |
| 324 | } |
| 325 | |
| 326 | static void __init locate_unstable_memory(void) |
| 327 | { |
| 328 | struct membank *mb = &meminfo.bank[meminfo.nr_banks - 1]; |
| 329 | unsigned long bank_size; |
| 330 | unsigned long low, high; |
| 331 | |
| 332 | bank_size = apq8064_memory_bank_size(); |
| 333 | low = meminfo.bank[0].start; |
| 334 | high = mb->start + mb->size; |
Olav Haugan | d76e3a8 | 2012-01-16 16:55:07 -0800 | [diff] [blame] | 335 | |
| 336 | /* Check if 32 bit overflow occured */ |
| 337 | if (high < mb->start) |
| 338 | high = ~0UL; |
| 339 | |
Kevin Chan | 13be4e2 | 2011-10-20 11:30:32 -0700 | [diff] [blame] | 340 | low &= ~(bank_size - 1); |
| 341 | |
| 342 | if (high - low <= bank_size) |
| 343 | return; |
Jack Cheung | 46bfffa | 2012-01-19 15:26:24 -0800 | [diff] [blame] | 344 | apq8064_reserve_info.low_unstable_address = mb->start - |
| 345 | MIN_MEMORY_BLOCK_SIZE + mb->size; |
| 346 | apq8064_reserve_info.max_unstable_size = MIN_MEMORY_BLOCK_SIZE; |
| 347 | |
Kevin Chan | 13be4e2 | 2011-10-20 11:30:32 -0700 | [diff] [blame] | 348 | apq8064_reserve_info.bank_size = bank_size; |
| 349 | pr_info("low unstable address %lx max size %lx bank size %lx\n", |
| 350 | apq8064_reserve_info.low_unstable_address, |
| 351 | apq8064_reserve_info.max_unstable_size, |
| 352 | apq8064_reserve_info.bank_size); |
| 353 | } |
| 354 | |
| 355 | static void __init apq8064_reserve(void) |
| 356 | { |
| 357 | reserve_info = &apq8064_reserve_info; |
| 358 | locate_unstable_memory(); |
| 359 | msm_reserve(); |
| 360 | } |
| 361 | |
Hemant Kumar | 4933b07 | 2011-10-17 23:43:11 -0700 | [diff] [blame] | 362 | static struct platform_device android_usb_device = { |
| 363 | .name = "android_usb", |
| 364 | .id = -1, |
| 365 | }; |
| 366 | |
| 367 | static struct msm_otg_platform_data msm_otg_pdata = { |
| 368 | .mode = USB_PERIPHERAL, |
| 369 | .otg_control = OTG_PHY_CONTROL, |
| 370 | .phy_type = SNPS_28NM_INTEGRATED_PHY, |
Hemant Kumar | 4933b07 | 2011-10-17 23:43:11 -0700 | [diff] [blame] | 371 | }; |
| 372 | |
Swaminathan Sathappan | 2f51a75 | 2011-12-05 12:51:19 -0800 | [diff] [blame] | 373 | #define TABLA_INTERRUPT_BASE (NR_MSM_IRQS + NR_GPIO_IRQS + NR_PM8921_IRQS) |
| 374 | |
| 375 | /* Micbias setting is based on 8660 CDP/MTP/FLUID requirement |
| 376 | * 4 micbiases are used to power various analog and digital |
| 377 | * microphones operating at 1800 mV. Technically, all micbiases |
| 378 | * can source from single cfilter since all microphones operate |
| 379 | * at the same voltage level. The arrangement below is to make |
| 380 | * sure all cfilters are exercised. LDO_H regulator ouput level |
| 381 | * does not need to be as high as 2.85V. It is choosen for |
| 382 | * microphone sensitivity purpose. |
| 383 | */ |
| 384 | static struct tabla_pdata apq8064_tabla_platform_data = { |
| 385 | .slimbus_slave_device = { |
| 386 | .name = "tabla-slave", |
| 387 | .e_addr = {0, 0, 0x10, 0, 0x17, 2}, |
| 388 | }, |
Swaminathan Sathappan | cef966d | 2011-12-15 17:27:04 -0800 | [diff] [blame] | 389 | .irq = MSM_GPIO_TO_INT(42), |
Swaminathan Sathappan | 2f51a75 | 2011-12-05 12:51:19 -0800 | [diff] [blame] | 390 | .irq_base = TABLA_INTERRUPT_BASE, |
| 391 | .num_irqs = NR_TABLA_IRQS, |
| 392 | .reset_gpio = PM8921_GPIO_PM_TO_SYS(34), |
| 393 | .micbias = { |
| 394 | .ldoh_v = TABLA_LDOH_2P85_V, |
| 395 | .cfilt1_mv = 1800, |
| 396 | .cfilt2_mv = 1800, |
| 397 | .cfilt3_mv = 1800, |
| 398 | .bias1_cfilt_sel = TABLA_CFILT1_SEL, |
| 399 | .bias2_cfilt_sel = TABLA_CFILT2_SEL, |
| 400 | .bias3_cfilt_sel = TABLA_CFILT3_SEL, |
| 401 | .bias4_cfilt_sel = TABLA_CFILT3_SEL, |
| 402 | } |
| 403 | }; |
| 404 | |
| 405 | static struct slim_device apq8064_slim_tabla = { |
| 406 | .name = "tabla-slim", |
| 407 | .e_addr = {0, 1, 0x10, 0, 0x17, 2}, |
| 408 | .dev = { |
| 409 | .platform_data = &apq8064_tabla_platform_data, |
| 410 | }, |
| 411 | }; |
| 412 | |
Swaminathan Sathappan | cef966d | 2011-12-15 17:27:04 -0800 | [diff] [blame] | 413 | static struct tabla_pdata apq8064_tabla20_platform_data = { |
| 414 | .slimbus_slave_device = { |
| 415 | .name = "tabla-slave", |
| 416 | .e_addr = {0, 0, 0x60, 0, 0x17, 2}, |
| 417 | }, |
| 418 | .irq = MSM_GPIO_TO_INT(42), |
| 419 | .irq_base = TABLA_INTERRUPT_BASE, |
| 420 | .num_irqs = NR_TABLA_IRQS, |
| 421 | .reset_gpio = PM8921_GPIO_PM_TO_SYS(34), |
| 422 | .micbias = { |
| 423 | .ldoh_v = TABLA_LDOH_2P85_V, |
| 424 | .cfilt1_mv = 1800, |
| 425 | .cfilt2_mv = 1800, |
| 426 | .cfilt3_mv = 1800, |
| 427 | .bias1_cfilt_sel = TABLA_CFILT1_SEL, |
| 428 | .bias2_cfilt_sel = TABLA_CFILT2_SEL, |
| 429 | .bias3_cfilt_sel = TABLA_CFILT3_SEL, |
| 430 | .bias4_cfilt_sel = TABLA_CFILT3_SEL, |
| 431 | } |
| 432 | }; |
| 433 | |
| 434 | static struct slim_device apq8064_slim_tabla20 = { |
| 435 | .name = "tabla2x-slim", |
| 436 | .e_addr = {0, 1, 0x60, 0, 0x17, 2}, |
| 437 | .dev = { |
| 438 | .platform_data = &apq8064_tabla20_platform_data, |
| 439 | }, |
| 440 | }; |
| 441 | |
Ramesh Masavarapu | 2831191 | 2011-10-27 11:04:12 -0700 | [diff] [blame] | 442 | #if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \ |
| 443 | defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \ |
| 444 | defined(CONFIG_CRYPTO_DEV_QCEDEV) || \ |
| 445 | defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE) |
| 446 | |
| 447 | #define QCE_SIZE 0x10000 |
| 448 | #define QCE_0_BASE 0x11000000 |
| 449 | |
| 450 | #define QCE_HW_KEY_SUPPORT 0 |
| 451 | #define QCE_SHA_HMAC_SUPPORT 1 |
| 452 | #define QCE_SHARE_CE_RESOURCE 3 |
| 453 | #define QCE_CE_SHARED 0 |
| 454 | |
| 455 | static struct resource qcrypto_resources[] = { |
| 456 | [0] = { |
| 457 | .start = QCE_0_BASE, |
| 458 | .end = QCE_0_BASE + QCE_SIZE - 1, |
| 459 | .flags = IORESOURCE_MEM, |
| 460 | }, |
| 461 | [1] = { |
| 462 | .name = "crypto_channels", |
| 463 | .start = DMOV8064_CE_IN_CHAN, |
| 464 | .end = DMOV8064_CE_OUT_CHAN, |
| 465 | .flags = IORESOURCE_DMA, |
| 466 | }, |
| 467 | [2] = { |
| 468 | .name = "crypto_crci_in", |
| 469 | .start = DMOV8064_CE_IN_CRCI, |
| 470 | .end = DMOV8064_CE_IN_CRCI, |
| 471 | .flags = IORESOURCE_DMA, |
| 472 | }, |
| 473 | [3] = { |
| 474 | .name = "crypto_crci_out", |
| 475 | .start = DMOV8064_CE_OUT_CRCI, |
| 476 | .end = DMOV8064_CE_OUT_CRCI, |
| 477 | .flags = IORESOURCE_DMA, |
| 478 | }, |
| 479 | }; |
| 480 | |
| 481 | static struct resource qcedev_resources[] = { |
| 482 | [0] = { |
| 483 | .start = QCE_0_BASE, |
| 484 | .end = QCE_0_BASE + QCE_SIZE - 1, |
| 485 | .flags = IORESOURCE_MEM, |
| 486 | }, |
| 487 | [1] = { |
| 488 | .name = "crypto_channels", |
| 489 | .start = DMOV8064_CE_IN_CHAN, |
| 490 | .end = DMOV8064_CE_OUT_CHAN, |
| 491 | .flags = IORESOURCE_DMA, |
| 492 | }, |
| 493 | [2] = { |
| 494 | .name = "crypto_crci_in", |
| 495 | .start = DMOV8064_CE_IN_CRCI, |
| 496 | .end = DMOV8064_CE_IN_CRCI, |
| 497 | .flags = IORESOURCE_DMA, |
| 498 | }, |
| 499 | [3] = { |
| 500 | .name = "crypto_crci_out", |
| 501 | .start = DMOV8064_CE_OUT_CRCI, |
| 502 | .end = DMOV8064_CE_OUT_CRCI, |
| 503 | .flags = IORESOURCE_DMA, |
| 504 | }, |
| 505 | }; |
| 506 | |
| 507 | #endif |
| 508 | |
| 509 | #if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \ |
| 510 | defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) |
| 511 | |
| 512 | static struct msm_ce_hw_support qcrypto_ce_hw_suppport = { |
| 513 | .ce_shared = QCE_CE_SHARED, |
| 514 | .shared_ce_resource = QCE_SHARE_CE_RESOURCE, |
| 515 | .hw_key_support = QCE_HW_KEY_SUPPORT, |
| 516 | .sha_hmac = QCE_SHA_HMAC_SUPPORT, |
Ramesh Masavarapu | 4925968 | 2011-12-02 14:00:18 -0800 | [diff] [blame] | 517 | .bus_scale_table = NULL, |
Ramesh Masavarapu | 2831191 | 2011-10-27 11:04:12 -0700 | [diff] [blame] | 518 | }; |
| 519 | |
| 520 | static struct platform_device qcrypto_device = { |
| 521 | .name = "qcrypto", |
| 522 | .id = 0, |
| 523 | .num_resources = ARRAY_SIZE(qcrypto_resources), |
| 524 | .resource = qcrypto_resources, |
| 525 | .dev = { |
| 526 | .coherent_dma_mask = DMA_BIT_MASK(32), |
| 527 | .platform_data = &qcrypto_ce_hw_suppport, |
| 528 | }, |
| 529 | }; |
| 530 | #endif |
| 531 | |
| 532 | #if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \ |
| 533 | defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE) |
| 534 | |
| 535 | static struct msm_ce_hw_support qcedev_ce_hw_suppport = { |
| 536 | .ce_shared = QCE_CE_SHARED, |
| 537 | .shared_ce_resource = QCE_SHARE_CE_RESOURCE, |
| 538 | .hw_key_support = QCE_HW_KEY_SUPPORT, |
| 539 | .sha_hmac = QCE_SHA_HMAC_SUPPORT, |
Ramesh Masavarapu | 4925968 | 2011-12-02 14:00:18 -0800 | [diff] [blame] | 540 | .bus_scale_table = NULL, |
Ramesh Masavarapu | 2831191 | 2011-10-27 11:04:12 -0700 | [diff] [blame] | 541 | }; |
| 542 | |
| 543 | static struct platform_device qcedev_device = { |
| 544 | .name = "qce", |
| 545 | .id = 0, |
| 546 | .num_resources = ARRAY_SIZE(qcedev_resources), |
| 547 | .resource = qcedev_resources, |
| 548 | .dev = { |
| 549 | .coherent_dma_mask = DMA_BIT_MASK(32), |
| 550 | .platform_data = &qcedev_ce_hw_suppport, |
| 551 | }, |
| 552 | }; |
| 553 | #endif |
| 554 | |
| 555 | |
Jeff Hugo | 0c0f5e9 | 2011-09-28 13:55:45 -0600 | [diff] [blame] | 556 | #define MSM_SHARED_RAM_PHYS 0x80000000 |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 557 | static void __init apq8064_map_io(void) |
| 558 | { |
Jeff Hugo | 0c0f5e9 | 2011-09-28 13:55:45 -0600 | [diff] [blame] | 559 | msm_shared_ram_phys = MSM_SHARED_RAM_PHYS; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 560 | msm_map_apq8064_io(); |
Jeff Ohlstein | 3a77f9f | 2011-09-06 14:50:20 -0700 | [diff] [blame] | 561 | if (socinfo_init() < 0) |
| 562 | pr_err("socinfo_init() failed!\n"); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 563 | } |
| 564 | |
| 565 | static void __init apq8064_init_irq(void) |
| 566 | { |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 567 | gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE, |
| 568 | (void *)MSM_QGIC_CPU_BASE); |
| 569 | |
| 570 | /* Edge trigger PPIs except AVS_SVICINT and AVS_SVICINTSWDONE */ |
| 571 | writel_relaxed(0xFFFFD7FF, MSM_QGIC_DIST_BASE + GIC_DIST_CONFIG + 4); |
| 572 | |
| 573 | writel_relaxed(0x0000FFFF, MSM_QGIC_DIST_BASE + GIC_DIST_ENABLE_SET); |
| 574 | mb(); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 575 | } |
| 576 | |
Jay Chokshi | 7805b5a | 2011-11-07 15:55:30 -0800 | [diff] [blame] | 577 | static struct platform_device msm8064_device_saw_regulator_core0 = { |
| 578 | .name = "saw-regulator", |
| 579 | .id = 0, |
| 580 | .dev = { |
| 581 | .platform_data = &msm8064_saw_regulator_pdata_8921_s5, |
| 582 | }, |
| 583 | }; |
| 584 | |
| 585 | static struct platform_device msm8064_device_saw_regulator_core1 = { |
| 586 | .name = "saw-regulator", |
| 587 | .id = 1, |
| 588 | .dev = { |
| 589 | .platform_data = &msm8064_saw_regulator_pdata_8921_s6, |
| 590 | }, |
| 591 | }; |
| 592 | |
| 593 | static struct platform_device msm8064_device_saw_regulator_core2 = { |
| 594 | .name = "saw-regulator", |
| 595 | .id = 2, |
| 596 | .dev = { |
| 597 | .platform_data = &msm8064_saw_regulator_pdata_8821_s0, |
| 598 | }, |
| 599 | }; |
| 600 | |
| 601 | static struct platform_device msm8064_device_saw_regulator_core3 = { |
| 602 | .name = "saw-regulator", |
| 603 | .id = 3, |
| 604 | .dev = { |
| 605 | .platform_data = &msm8064_saw_regulator_pdata_8821_s1, |
| 606 | }, |
| 607 | }; |
| 608 | |
Gagan Mac | 8a7a5d3 | 2011-11-11 16:43:06 -0700 | [diff] [blame] | 609 | static void __init apq8064_init_buses(void) |
| 610 | { |
| 611 | msm_bus_rpm_set_mt_mask(); |
| 612 | msm_bus_8064_apps_fabric_pdata.rpm_enabled = 1; |
| 613 | msm_bus_8064_sys_fabric_pdata.rpm_enabled = 1; |
| 614 | msm_bus_8064_mm_fabric_pdata.rpm_enabled = 1; |
| 615 | msm_bus_8064_apps_fabric.dev.platform_data = |
| 616 | &msm_bus_8064_apps_fabric_pdata; |
| 617 | msm_bus_8064_sys_fabric.dev.platform_data = |
| 618 | &msm_bus_8064_sys_fabric_pdata; |
| 619 | msm_bus_8064_mm_fabric.dev.platform_data = |
| 620 | &msm_bus_8064_mm_fabric_pdata; |
| 621 | msm_bus_8064_sys_fpb.dev.platform_data = &msm_bus_8064_sys_fpb_pdata; |
| 622 | msm_bus_8064_cpss_fpb.dev.platform_data = &msm_bus_8064_cpss_fpb_pdata; |
| 623 | } |
| 624 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 625 | static struct platform_device *common_devices[] __initdata = { |
Jin Hong | 01f2dbb | 2011-11-03 22:13:51 -0700 | [diff] [blame] | 626 | &apq8064_device_dmov, |
Kenneth Heitke | 748593a | 2011-07-15 15:45:11 -0600 | [diff] [blame] | 627 | &apq8064_device_qup_i2c_gsbi4, |
Harini Jayaraman | c4c5869 | 2011-07-19 14:50:10 -0600 | [diff] [blame] | 628 | &apq8064_device_qup_spi_gsbi5, |
Sagar Dharia | 8bdcdaf | 2011-09-16 16:01:15 -0600 | [diff] [blame] | 629 | &apq8064_slim_ctrl, |
Jay Chokshi | 9c25f07 | 2011-09-23 18:19:15 -0700 | [diff] [blame] | 630 | &apq8064_device_ssbi_pmic1, |
| 631 | &apq8064_device_ssbi_pmic2, |
Jeff Hugo | 0c0f5e9 | 2011-09-28 13:55:45 -0600 | [diff] [blame] | 632 | &msm_device_smd_apq8064, |
Hemant Kumar | 4933b07 | 2011-10-17 23:43:11 -0700 | [diff] [blame] | 633 | &apq8064_device_otg, |
| 634 | &apq8064_device_gadget_peripheral, |
| 635 | &android_usb_device, |
Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 636 | #ifdef CONFIG_ANDROID_PMEM |
| 637 | #ifndef CONFIG_MSM_MULTIMEDIA_USE_ION |
Kevin Chan | 13be4e2 | 2011-10-20 11:30:32 -0700 | [diff] [blame] | 638 | &android_pmem_device, |
| 639 | &android_pmem_adsp_device, |
Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 640 | #endif |
Kevin Chan | 13be4e2 | 2011-10-20 11:30:32 -0700 | [diff] [blame] | 641 | &android_pmem_audio_device, |
Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 642 | #endif |
| 643 | #ifdef CONFIG_ION_MSM |
| 644 | &ion_dev, |
| 645 | #endif |
Jeff Ohlstein | 7e66855 | 2011-10-06 16:17:25 -0700 | [diff] [blame] | 646 | &msm8064_device_watchdog, |
Jay Chokshi | 7805b5a | 2011-11-07 15:55:30 -0800 | [diff] [blame] | 647 | &msm8064_device_saw_regulator_core0, |
| 648 | &msm8064_device_saw_regulator_core1, |
| 649 | &msm8064_device_saw_regulator_core2, |
| 650 | &msm8064_device_saw_regulator_core3, |
Ramesh Masavarapu | 2831191 | 2011-10-27 11:04:12 -0700 | [diff] [blame] | 651 | #if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \ |
| 652 | defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) |
| 653 | &qcrypto_device, |
| 654 | #endif |
| 655 | |
| 656 | #if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \ |
| 657 | defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE) |
| 658 | &qcedev_device, |
| 659 | #endif |
Ramesh Masavarapu | f46be1b | 2011-11-03 11:13:41 -0700 | [diff] [blame] | 660 | |
| 661 | #ifdef CONFIG_HW_RANDOM_MSM |
| 662 | &apq8064_device_rng, |
| 663 | #endif |
Bharath Ramachandramurthy | b8e797f | 2011-11-30 12:08:42 -0800 | [diff] [blame] | 664 | &apq_pcm, |
| 665 | &apq_pcm_routing, |
| 666 | &apq_cpudai0, |
| 667 | &apq_cpudai1, |
| 668 | &apq_cpudai_hdmi_rx, |
| 669 | &apq_cpudai_bt_rx, |
| 670 | &apq_cpudai_bt_tx, |
| 671 | &apq_cpudai_fm_rx, |
| 672 | &apq_cpudai_fm_tx, |
| 673 | &apq_cpu_fe, |
| 674 | &apq_stub_codec, |
| 675 | &apq_voice, |
| 676 | &apq_voip, |
| 677 | &apq_lpa_pcm, |
| 678 | &apq_pcm_hostless, |
| 679 | &apq_cpudai_afe_01_rx, |
| 680 | &apq_cpudai_afe_01_tx, |
| 681 | &apq_cpudai_afe_02_rx, |
| 682 | &apq_cpudai_afe_02_tx, |
| 683 | &apq_pcm_afe, |
| 684 | &apq_cpudai_auxpcm_rx, |
| 685 | &apq_cpudai_auxpcm_tx, |
Gagan Mac | 8a7a5d3 | 2011-11-11 16:43:06 -0700 | [diff] [blame] | 686 | &msm_bus_8064_apps_fabric, |
| 687 | &msm_bus_8064_sys_fabric, |
| 688 | &msm_bus_8064_mm_fabric, |
| 689 | &msm_bus_8064_sys_fpb, |
| 690 | &msm_bus_8064_cpss_fpb, |
Harini Jayaraman | c4c5869 | 2011-07-19 14:50:10 -0600 | [diff] [blame] | 691 | }; |
| 692 | |
Joel King | 4e7ad22 | 2011-08-17 15:47:38 -0700 | [diff] [blame] | 693 | static struct platform_device *sim_devices[] __initdata = { |
Stepan Moskovchenko | 2701a44 | 2011-08-19 13:47:22 -0700 | [diff] [blame] | 694 | &apq8064_device_uart_gsbi3, |
Yan He | 06913ce | 2011-08-26 16:33:46 -0700 | [diff] [blame] | 695 | &msm_device_sps_apq8064, |
Stepan Moskovchenko | 2701a44 | 2011-08-19 13:47:22 -0700 | [diff] [blame] | 696 | }; |
| 697 | |
| 698 | static struct platform_device *rumi3_devices[] __initdata = { |
| 699 | &apq8064_device_uart_gsbi1, |
Yan He | 435ed61 | 2011-11-23 17:34:59 -0800 | [diff] [blame] | 700 | &msm_device_sps_apq8064, |
Joel King | 4e7ad22 | 2011-08-17 15:47:38 -0700 | [diff] [blame] | 701 | }; |
| 702 | |
Joel King | 82b7e3f | 2012-01-05 10:03:27 -0800 | [diff] [blame] | 703 | static struct platform_device *cdp_devices[] __initdata = { |
| 704 | &apq8064_device_uart_gsbi1, |
| 705 | &msm_device_sps_apq8064, |
| 706 | }; |
| 707 | |
Harini Jayaraman | c4c5869 | 2011-07-19 14:50:10 -0600 | [diff] [blame] | 708 | static struct msm_spi_platform_data apq8064_qup_spi_gsbi5_pdata = { |
Harini Jayaraman | 60ee14c | 2011-11-09 18:53:27 -0700 | [diff] [blame] | 709 | .max_clock_speed = 24000000, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 710 | }; |
| 711 | |
Stepan Moskovchenko | eed82a5 | 2011-09-02 13:19:23 -0700 | [diff] [blame] | 712 | #define KS8851_IRQ_GPIO 43 |
| 713 | |
| 714 | static struct spi_board_info spi_board_info[] __initdata = { |
| 715 | { |
| 716 | .modalias = "ks8851", |
| 717 | .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO), |
| 718 | .max_speed_hz = 19200000, |
| 719 | .bus_num = 0, |
| 720 | .chip_select = 2, |
| 721 | .mode = SPI_MODE_0, |
| 722 | }, |
| 723 | }; |
| 724 | |
Sagar Dharia | 8bdcdaf | 2011-09-16 16:01:15 -0600 | [diff] [blame] | 725 | static struct slim_boardinfo apq8064_slim_devices[] = { |
Swaminathan Sathappan | 2f51a75 | 2011-12-05 12:51:19 -0800 | [diff] [blame] | 726 | { |
Swaminathan Sathappan | cef966d | 2011-12-15 17:27:04 -0800 | [diff] [blame] | 727 | .bus_num = 1, |
| 728 | .slim_slave = &apq8064_slim_tabla, |
| 729 | }, |
| 730 | { |
| 731 | .bus_num = 1, |
| 732 | .slim_slave = &apq8064_slim_tabla20, |
Swaminathan Sathappan | 2f51a75 | 2011-12-05 12:51:19 -0800 | [diff] [blame] | 733 | }, |
| 734 | /* add more slimbus slaves as needed */ |
Sagar Dharia | 8bdcdaf | 2011-09-16 16:01:15 -0600 | [diff] [blame] | 735 | }; |
| 736 | |
Kenneth Heitke | 748593a | 2011-07-15 15:45:11 -0600 | [diff] [blame] | 737 | static struct msm_i2c_platform_data apq8064_i2c_qup_gsbi4_pdata = { |
| 738 | .clk_freq = 100000, |
| 739 | .src_clk_rate = 24000000, |
Kenneth Heitke | 748593a | 2011-07-15 15:45:11 -0600 | [diff] [blame] | 740 | }; |
| 741 | |
| 742 | static void __init apq8064_i2c_init(void) |
| 743 | { |
| 744 | apq8064_device_qup_i2c_gsbi4.dev.platform_data = |
| 745 | &apq8064_i2c_qup_gsbi4_pdata; |
| 746 | } |
| 747 | |
Stepan Moskovchenko | eed82a5 | 2011-09-02 13:19:23 -0700 | [diff] [blame] | 748 | #ifdef CONFIG_KS8851 |
| 749 | static int ethernet_init(void) |
| 750 | { |
| 751 | int ret; |
| 752 | ret = gpio_request(KS8851_IRQ_GPIO, "ks8851_irq"); |
| 753 | if (ret) { |
| 754 | pr_err("ks8851 gpio_request failed: %d\n", ret); |
| 755 | goto fail; |
| 756 | } |
| 757 | |
| 758 | return 0; |
| 759 | fail: |
| 760 | return ret; |
| 761 | } |
| 762 | #else |
| 763 | static int ethernet_init(void) |
| 764 | { |
| 765 | return 0; |
| 766 | } |
| 767 | #endif |
| 768 | |
Tianyi Gou | 41515e2 | 2011-09-01 19:37:43 -0700 | [diff] [blame] | 769 | static void __init apq8064_clock_init(void) |
| 770 | { |
| 771 | if (machine_is_apq8064_sim()) |
| 772 | msm_clock_init(&apq8064_clock_init_data); |
| 773 | else |
| 774 | msm_clock_init(&apq8064_dummy_clock_init_data); |
| 775 | } |
| 776 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 777 | static void __init apq8064_common_init(void) |
| 778 | { |
| 779 | if (socinfo_init() < 0) |
| 780 | pr_err("socinfo_init() failed!\n"); |
Tianyi Gou | 41515e2 | 2011-09-01 19:37:43 -0700 | [diff] [blame] | 781 | apq8064_clock_init(); |
Stepan Moskovchenko | 2327a95 | 2011-12-14 16:31:28 -0800 | [diff] [blame] | 782 | apq8064_init_gpiomux(); |
Kenneth Heitke | 748593a | 2011-07-15 15:45:11 -0600 | [diff] [blame] | 783 | apq8064_i2c_init(); |
Kenneth Heitke | 36920d3 | 2011-07-20 16:44:30 -0600 | [diff] [blame] | 784 | |
Harini Jayaraman | c4c5869 | 2011-07-19 14:50:10 -0600 | [diff] [blame] | 785 | apq8064_device_qup_spi_gsbi5.dev.platform_data = |
| 786 | &apq8064_qup_spi_gsbi5_pdata; |
Stepan Moskovchenko | c1074f0 | 2011-12-14 17:51:57 -0800 | [diff] [blame] | 787 | apq8064_init_pmic(); |
Stepan Moskovchenko | 14aa649 | 2011-08-08 15:15:01 -0700 | [diff] [blame] | 788 | apq8064_device_otg.dev.platform_data = &msm_otg_pdata; |
Gagan Mac | 8a7a5d3 | 2011-11-11 16:43:06 -0700 | [diff] [blame] | 789 | apq8064_init_buses(); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 790 | platform_add_devices(common_devices, ARRAY_SIZE(common_devices)); |
Sahitya Tummala | 3586ed9 | 2011-08-03 09:13:23 +0530 | [diff] [blame] | 791 | apq8064_init_mmc(); |
Sagar Dharia | 8bdcdaf | 2011-09-16 16:01:15 -0600 | [diff] [blame] | 792 | slim_register_board_info(apq8064_slim_devices, |
| 793 | ARRAY_SIZE(apq8064_slim_devices)); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 794 | } |
| 795 | |
| 796 | static void __init apq8064_sim_init(void) |
| 797 | { |
Jeff Ohlstein | 7e66855 | 2011-10-06 16:17:25 -0700 | [diff] [blame] | 798 | struct msm_watchdog_pdata *wdog_pdata = (struct msm_watchdog_pdata *) |
| 799 | &msm8064_device_watchdog.dev.platform_data; |
| 800 | |
| 801 | wdog_pdata->bark_time = 15000; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 802 | apq8064_common_init(); |
Joel King | 4e7ad22 | 2011-08-17 15:47:38 -0700 | [diff] [blame] | 803 | platform_add_devices(sim_devices, ARRAY_SIZE(sim_devices)); |
| 804 | } |
| 805 | |
| 806 | static void __init apq8064_rumi3_init(void) |
| 807 | { |
| 808 | apq8064_common_init(); |
Stepan Moskovchenko | eed82a5 | 2011-09-02 13:19:23 -0700 | [diff] [blame] | 809 | ethernet_init(); |
Stepan Moskovchenko | 2701a44 | 2011-08-19 13:47:22 -0700 | [diff] [blame] | 810 | platform_add_devices(rumi3_devices, ARRAY_SIZE(rumi3_devices)); |
Stepan Moskovchenko | eed82a5 | 2011-09-02 13:19:23 -0700 | [diff] [blame] | 811 | spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info)); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 812 | } |
| 813 | |
Joel King | 82b7e3f | 2012-01-05 10:03:27 -0800 | [diff] [blame] | 814 | static void __init apq8064_cdp_init(void) |
| 815 | { |
| 816 | apq8064_common_init(); |
| 817 | ethernet_init(); |
| 818 | platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices)); |
| 819 | spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info)); |
| 820 | } |
| 821 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 822 | MACHINE_START(APQ8064_SIM, "QCT APQ8064 SIMULATOR") |
| 823 | .map_io = apq8064_map_io, |
Kevin Chan | 13be4e2 | 2011-10-20 11:30:32 -0700 | [diff] [blame] | 824 | .reserve = apq8064_reserve, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 825 | .init_irq = apq8064_init_irq, |
Marc Zyngier | 89bdafd1 | 2011-12-22 11:39:20 +0530 | [diff] [blame] | 826 | .handle_irq = gic_handle_irq, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 827 | .timer = &msm_timer, |
| 828 | .init_machine = apq8064_sim_init, |
| 829 | MACHINE_END |
| 830 | |
Joel King | 4e7ad22 | 2011-08-17 15:47:38 -0700 | [diff] [blame] | 831 | MACHINE_START(APQ8064_RUMI3, "QCT APQ8064 RUMI3") |
| 832 | .map_io = apq8064_map_io, |
Kevin Chan | 13be4e2 | 2011-10-20 11:30:32 -0700 | [diff] [blame] | 833 | .reserve = apq8064_reserve, |
Joel King | 4e7ad22 | 2011-08-17 15:47:38 -0700 | [diff] [blame] | 834 | .init_irq = apq8064_init_irq, |
Marc Zyngier | 89bdafd1 | 2011-12-22 11:39:20 +0530 | [diff] [blame] | 835 | .handle_irq = gic_handle_irq, |
Joel King | 4e7ad22 | 2011-08-17 15:47:38 -0700 | [diff] [blame] | 836 | .timer = &msm_timer, |
| 837 | .init_machine = apq8064_rumi3_init, |
| 838 | MACHINE_END |
| 839 | |
Joel King | 82b7e3f | 2012-01-05 10:03:27 -0800 | [diff] [blame] | 840 | MACHINE_START(APQ8064_CDP, "QCT APQ8064 CDP") |
| 841 | .map_io = apq8064_map_io, |
| 842 | .reserve = apq8064_reserve, |
| 843 | .init_irq = apq8064_init_irq, |
| 844 | .handle_irq = gic_handle_irq, |
| 845 | .timer = &msm_timer, |
| 846 | .init_machine = apq8064_cdp_init, |
| 847 | MACHINE_END |
| 848 | |
| 849 | MACHINE_START(APQ8064_MTP, "QCT APQ8064 MTP") |
| 850 | .map_io = apq8064_map_io, |
| 851 | .reserve = apq8064_reserve, |
| 852 | .init_irq = apq8064_init_irq, |
| 853 | .handle_irq = gic_handle_irq, |
| 854 | .timer = &msm_timer, |
| 855 | .init_machine = apq8064_cdp_init, |
| 856 | MACHINE_END |
| 857 | |
| 858 | MACHINE_START(APQ8064_LIQUID, "QCT APQ8064 LIQUID") |
| 859 | .map_io = apq8064_map_io, |
| 860 | .reserve = apq8064_reserve, |
| 861 | .init_irq = apq8064_init_irq, |
| 862 | .handle_irq = gic_handle_irq, |
| 863 | .timer = &msm_timer, |
| 864 | .init_machine = apq8064_cdp_init, |
| 865 | MACHINE_END |
| 866 | |