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