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