Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1 | /* Copyright (c) 2011, Code Aurora Forum. All rights reserved. |
| 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> |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 25 | #include <asm/mach-types.h> |
| 26 | #include <asm/mach/arch.h> |
| 27 | #include <asm/hardware/gic.h> |
Sahitya Tummala | 3586ed9 | 2011-08-03 09:13:23 +0530 | [diff] [blame] | 28 | #include <asm/mach/mmc.h> |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 29 | |
| 30 | #include <mach/board.h> |
| 31 | #include <mach/msm_iomap.h> |
| 32 | #include <linux/usb/msm_hsusb.h> |
| 33 | #include <linux/usb/android.h> |
| 34 | #include <mach/socinfo.h> |
Harini Jayaraman | c4c5869 | 2011-07-19 14:50:10 -0600 | [diff] [blame] | 35 | #include <mach/msm_spi.h> |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 36 | #include "timer.h" |
| 37 | #include "devices.h" |
Joel King | 4ebccc6 | 2011-07-22 09:43:22 -0700 | [diff] [blame] | 38 | #include <mach/gpio.h> |
| 39 | #include <mach/gpiomux.h> |
Kevin Chan | 13be4e2 | 2011-10-20 11:30:32 -0700 | [diff] [blame] | 40 | #include <linux/android_pmem.h> |
| 41 | #include <mach/msm_memtypes.h> |
| 42 | #include <linux/bootmem.h> |
| 43 | #include <asm/setup.h> |
Ramesh Masavarapu | 2831191 | 2011-10-27 11:04:12 -0700 | [diff] [blame] | 44 | #include <mach/dma.h> |
Joel King | 4ebccc6 | 2011-07-22 09:43:22 -0700 | [diff] [blame] | 45 | |
Jeff Ohlstein | 7e66855 | 2011-10-06 16:17:25 -0700 | [diff] [blame] | 46 | #include "msm_watchdog.h" |
Stepan Moskovchenko | 5a83dba | 2011-12-05 17:30:17 -0800 | [diff] [blame] | 47 | #include "board-8064.h" |
Jay Chokshi | ea67c62 | 2011-07-29 17:12:26 -0700 | [diff] [blame] | 48 | |
Kevin Chan | 13be4e2 | 2011-10-20 11:30:32 -0700 | [diff] [blame] | 49 | #define MSM_PMEM_KERNEL_EBI1_SIZE 0x600000 |
| 50 | #define MSM_PMEM_ADSP_SIZE 0x3800000 |
Ben Romberger | 3ffcd81 | 2011-12-08 19:12:10 -0800 | [diff] [blame] | 51 | #define MSM_PMEM_AUDIO_SIZE 0x2B4000 |
Kevin Chan | 13be4e2 | 2011-10-20 11:30:32 -0700 | [diff] [blame] | 52 | #define MSM_PMEM_SIZE 0x1800000 /* 24 Mbytes */ |
| 53 | |
| 54 | static struct memtype_reserve apq8064_reserve_table[] __initdata = { |
| 55 | [MEMTYPE_SMI] = { |
| 56 | }, |
| 57 | [MEMTYPE_EBI0] = { |
| 58 | .flags = MEMTYPE_FLAGS_1M_ALIGN, |
| 59 | }, |
| 60 | [MEMTYPE_EBI1] = { |
| 61 | .flags = MEMTYPE_FLAGS_1M_ALIGN, |
| 62 | }, |
| 63 | }; |
| 64 | |
| 65 | static int apq8064_paddr_to_memtype(unsigned int paddr) |
| 66 | { |
| 67 | return MEMTYPE_EBI1; |
| 68 | } |
| 69 | |
| 70 | static unsigned pmem_size = MSM_PMEM_SIZE; |
| 71 | static int __init pmem_size_setup(char *p) |
| 72 | { |
| 73 | pmem_size = memparse(p, NULL); |
| 74 | return 0; |
| 75 | } |
| 76 | early_param("pmem_size", pmem_size_setup); |
| 77 | |
| 78 | static unsigned pmem_adsp_size = MSM_PMEM_ADSP_SIZE; |
| 79 | |
| 80 | static int __init pmem_adsp_size_setup(char *p) |
| 81 | { |
| 82 | pmem_adsp_size = memparse(p, NULL); |
| 83 | return 0; |
| 84 | } |
| 85 | early_param("pmem_adsp_size", pmem_adsp_size_setup); |
| 86 | |
| 87 | static unsigned pmem_audio_size = MSM_PMEM_AUDIO_SIZE; |
| 88 | |
| 89 | static int __init pmem_audio_size_setup(char *p) |
| 90 | { |
| 91 | pmem_audio_size = memparse(p, NULL); |
| 92 | return 0; |
| 93 | } |
| 94 | early_param("pmem_audio_size", pmem_audio_size_setup); |
| 95 | |
| 96 | static struct android_pmem_platform_data android_pmem_pdata = { |
| 97 | .name = "pmem", |
| 98 | .allocator_type = PMEM_ALLOCATORTYPE_ALLORNOTHING, |
| 99 | .cached = 1, |
| 100 | .memory_type = MEMTYPE_EBI1, |
| 101 | }; |
| 102 | |
| 103 | static struct platform_device android_pmem_device = { |
| 104 | .name = "android_pmem", |
| 105 | .id = 0, |
| 106 | .dev = {.platform_data = &android_pmem_pdata}, |
| 107 | }; |
| 108 | |
| 109 | static struct android_pmem_platform_data android_pmem_adsp_pdata = { |
| 110 | .name = "pmem_adsp", |
| 111 | .allocator_type = PMEM_ALLOCATORTYPE_BITMAP, |
| 112 | .cached = 0, |
| 113 | .memory_type = MEMTYPE_EBI1, |
| 114 | }; |
| 115 | |
| 116 | static unsigned pmem_kernel_ebi1_size = MSM_PMEM_KERNEL_EBI1_SIZE; |
| 117 | static int __init pmem_kernel_ebi1_size_setup(char *p) |
| 118 | { |
| 119 | pmem_kernel_ebi1_size = memparse(p, NULL); |
| 120 | return 0; |
| 121 | } |
| 122 | early_param("pmem_kernel_ebi1_size", pmem_kernel_ebi1_size_setup); |
| 123 | |
| 124 | static struct platform_device android_pmem_adsp_device = { |
| 125 | .name = "android_pmem", |
| 126 | .id = 2, |
| 127 | .dev = { .platform_data = &android_pmem_adsp_pdata }, |
| 128 | }; |
| 129 | |
| 130 | static struct android_pmem_platform_data android_pmem_audio_pdata = { |
| 131 | .name = "pmem_audio", |
| 132 | .allocator_type = PMEM_ALLOCATORTYPE_BITMAP, |
| 133 | .cached = 0, |
| 134 | .memory_type = MEMTYPE_EBI1, |
| 135 | }; |
| 136 | |
| 137 | static struct platform_device android_pmem_audio_device = { |
| 138 | .name = "android_pmem", |
| 139 | .id = 4, |
| 140 | .dev = { .platform_data = &android_pmem_audio_pdata }, |
| 141 | }; |
| 142 | |
| 143 | static void __init size_pmem_devices(void) |
| 144 | { |
| 145 | android_pmem_adsp_pdata.size = pmem_adsp_size; |
| 146 | android_pmem_pdata.size = pmem_size; |
| 147 | android_pmem_audio_pdata.size = MSM_PMEM_AUDIO_SIZE; |
| 148 | } |
| 149 | |
| 150 | static void __init reserve_memory_for(struct android_pmem_platform_data *p) |
| 151 | { |
| 152 | apq8064_reserve_table[p->memory_type].size += p->size; |
| 153 | } |
| 154 | |
Kevin Chan | 13be4e2 | 2011-10-20 11:30:32 -0700 | [diff] [blame] | 155 | static void __init reserve_pmem_memory(void) |
| 156 | { |
| 157 | reserve_memory_for(&android_pmem_adsp_pdata); |
| 158 | reserve_memory_for(&android_pmem_pdata); |
| 159 | reserve_memory_for(&android_pmem_audio_pdata); |
| 160 | apq8064_reserve_table[MEMTYPE_EBI1].size += pmem_kernel_ebi1_size; |
| 161 | } |
| 162 | |
| 163 | static void __init apq8064_calculate_reserve_sizes(void) |
| 164 | { |
| 165 | size_pmem_devices(); |
| 166 | reserve_pmem_memory(); |
| 167 | } |
| 168 | |
| 169 | static struct reserve_info apq8064_reserve_info __initdata = { |
| 170 | .memtype_reserve_table = apq8064_reserve_table, |
| 171 | .calculate_reserve_sizes = apq8064_calculate_reserve_sizes, |
| 172 | .paddr_to_memtype = apq8064_paddr_to_memtype, |
| 173 | }; |
| 174 | |
| 175 | static int apq8064_memory_bank_size(void) |
| 176 | { |
| 177 | return 1<<29; |
| 178 | } |
| 179 | |
| 180 | static void __init locate_unstable_memory(void) |
| 181 | { |
| 182 | struct membank *mb = &meminfo.bank[meminfo.nr_banks - 1]; |
| 183 | unsigned long bank_size; |
| 184 | unsigned long low, high; |
| 185 | |
| 186 | bank_size = apq8064_memory_bank_size(); |
| 187 | low = meminfo.bank[0].start; |
| 188 | high = mb->start + mb->size; |
| 189 | low &= ~(bank_size - 1); |
| 190 | |
| 191 | if (high - low <= bank_size) |
| 192 | return; |
| 193 | apq8064_reserve_info.low_unstable_address = low + bank_size; |
| 194 | apq8064_reserve_info.max_unstable_size = high - low - bank_size; |
| 195 | apq8064_reserve_info.bank_size = bank_size; |
| 196 | pr_info("low unstable address %lx max size %lx bank size %lx\n", |
| 197 | apq8064_reserve_info.low_unstable_address, |
| 198 | apq8064_reserve_info.max_unstable_size, |
| 199 | apq8064_reserve_info.bank_size); |
| 200 | } |
| 201 | |
| 202 | static void __init apq8064_reserve(void) |
| 203 | { |
| 204 | reserve_info = &apq8064_reserve_info; |
| 205 | locate_unstable_memory(); |
| 206 | msm_reserve(); |
| 207 | } |
| 208 | |
Hemant Kumar | 4933b07 | 2011-10-17 23:43:11 -0700 | [diff] [blame] | 209 | static struct platform_device android_usb_device = { |
| 210 | .name = "android_usb", |
| 211 | .id = -1, |
| 212 | }; |
| 213 | |
| 214 | static struct msm_otg_platform_data msm_otg_pdata = { |
| 215 | .mode = USB_PERIPHERAL, |
| 216 | .otg_control = OTG_PHY_CONTROL, |
| 217 | .phy_type = SNPS_28NM_INTEGRATED_PHY, |
| 218 | .pclk_src_name = "dfab_usb_hs_clk", |
| 219 | }; |
| 220 | |
Swaminathan Sathappan | 2f51a75 | 2011-12-05 12:51:19 -0800 | [diff] [blame] | 221 | #define TABLA_INTERRUPT_BASE (NR_MSM_IRQS + NR_GPIO_IRQS + NR_PM8921_IRQS) |
| 222 | |
| 223 | /* Micbias setting is based on 8660 CDP/MTP/FLUID requirement |
| 224 | * 4 micbiases are used to power various analog and digital |
| 225 | * microphones operating at 1800 mV. Technically, all micbiases |
| 226 | * can source from single cfilter since all microphones operate |
| 227 | * at the same voltage level. The arrangement below is to make |
| 228 | * sure all cfilters are exercised. LDO_H regulator ouput level |
| 229 | * does not need to be as high as 2.85V. It is choosen for |
| 230 | * microphone sensitivity purpose. |
| 231 | */ |
| 232 | static struct tabla_pdata apq8064_tabla_platform_data = { |
| 233 | .slimbus_slave_device = { |
| 234 | .name = "tabla-slave", |
| 235 | .e_addr = {0, 0, 0x10, 0, 0x17, 2}, |
| 236 | }, |
Swaminathan Sathappan | cef966d | 2011-12-15 17:27:04 -0800 | [diff] [blame^] | 237 | .irq = MSM_GPIO_TO_INT(42), |
Swaminathan Sathappan | 2f51a75 | 2011-12-05 12:51:19 -0800 | [diff] [blame] | 238 | .irq_base = TABLA_INTERRUPT_BASE, |
| 239 | .num_irqs = NR_TABLA_IRQS, |
| 240 | .reset_gpio = PM8921_GPIO_PM_TO_SYS(34), |
| 241 | .micbias = { |
| 242 | .ldoh_v = TABLA_LDOH_2P85_V, |
| 243 | .cfilt1_mv = 1800, |
| 244 | .cfilt2_mv = 1800, |
| 245 | .cfilt3_mv = 1800, |
| 246 | .bias1_cfilt_sel = TABLA_CFILT1_SEL, |
| 247 | .bias2_cfilt_sel = TABLA_CFILT2_SEL, |
| 248 | .bias3_cfilt_sel = TABLA_CFILT3_SEL, |
| 249 | .bias4_cfilt_sel = TABLA_CFILT3_SEL, |
| 250 | } |
| 251 | }; |
| 252 | |
| 253 | static struct slim_device apq8064_slim_tabla = { |
| 254 | .name = "tabla-slim", |
| 255 | .e_addr = {0, 1, 0x10, 0, 0x17, 2}, |
| 256 | .dev = { |
| 257 | .platform_data = &apq8064_tabla_platform_data, |
| 258 | }, |
| 259 | }; |
| 260 | |
Swaminathan Sathappan | cef966d | 2011-12-15 17:27:04 -0800 | [diff] [blame^] | 261 | static struct tabla_pdata apq8064_tabla20_platform_data = { |
| 262 | .slimbus_slave_device = { |
| 263 | .name = "tabla-slave", |
| 264 | .e_addr = {0, 0, 0x60, 0, 0x17, 2}, |
| 265 | }, |
| 266 | .irq = MSM_GPIO_TO_INT(42), |
| 267 | .irq_base = TABLA_INTERRUPT_BASE, |
| 268 | .num_irqs = NR_TABLA_IRQS, |
| 269 | .reset_gpio = PM8921_GPIO_PM_TO_SYS(34), |
| 270 | .micbias = { |
| 271 | .ldoh_v = TABLA_LDOH_2P85_V, |
| 272 | .cfilt1_mv = 1800, |
| 273 | .cfilt2_mv = 1800, |
| 274 | .cfilt3_mv = 1800, |
| 275 | .bias1_cfilt_sel = TABLA_CFILT1_SEL, |
| 276 | .bias2_cfilt_sel = TABLA_CFILT2_SEL, |
| 277 | .bias3_cfilt_sel = TABLA_CFILT3_SEL, |
| 278 | .bias4_cfilt_sel = TABLA_CFILT3_SEL, |
| 279 | } |
| 280 | }; |
| 281 | |
| 282 | static struct slim_device apq8064_slim_tabla20 = { |
| 283 | .name = "tabla2x-slim", |
| 284 | .e_addr = {0, 1, 0x60, 0, 0x17, 2}, |
| 285 | .dev = { |
| 286 | .platform_data = &apq8064_tabla20_platform_data, |
| 287 | }, |
| 288 | }; |
| 289 | |
Ramesh Masavarapu | 2831191 | 2011-10-27 11:04:12 -0700 | [diff] [blame] | 290 | #if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \ |
| 291 | defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \ |
| 292 | defined(CONFIG_CRYPTO_DEV_QCEDEV) || \ |
| 293 | defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE) |
| 294 | |
| 295 | #define QCE_SIZE 0x10000 |
| 296 | #define QCE_0_BASE 0x11000000 |
| 297 | |
| 298 | #define QCE_HW_KEY_SUPPORT 0 |
| 299 | #define QCE_SHA_HMAC_SUPPORT 1 |
| 300 | #define QCE_SHARE_CE_RESOURCE 3 |
| 301 | #define QCE_CE_SHARED 0 |
| 302 | |
| 303 | static struct resource qcrypto_resources[] = { |
| 304 | [0] = { |
| 305 | .start = QCE_0_BASE, |
| 306 | .end = QCE_0_BASE + QCE_SIZE - 1, |
| 307 | .flags = IORESOURCE_MEM, |
| 308 | }, |
| 309 | [1] = { |
| 310 | .name = "crypto_channels", |
| 311 | .start = DMOV8064_CE_IN_CHAN, |
| 312 | .end = DMOV8064_CE_OUT_CHAN, |
| 313 | .flags = IORESOURCE_DMA, |
| 314 | }, |
| 315 | [2] = { |
| 316 | .name = "crypto_crci_in", |
| 317 | .start = DMOV8064_CE_IN_CRCI, |
| 318 | .end = DMOV8064_CE_IN_CRCI, |
| 319 | .flags = IORESOURCE_DMA, |
| 320 | }, |
| 321 | [3] = { |
| 322 | .name = "crypto_crci_out", |
| 323 | .start = DMOV8064_CE_OUT_CRCI, |
| 324 | .end = DMOV8064_CE_OUT_CRCI, |
| 325 | .flags = IORESOURCE_DMA, |
| 326 | }, |
| 327 | }; |
| 328 | |
| 329 | static struct resource qcedev_resources[] = { |
| 330 | [0] = { |
| 331 | .start = QCE_0_BASE, |
| 332 | .end = QCE_0_BASE + QCE_SIZE - 1, |
| 333 | .flags = IORESOURCE_MEM, |
| 334 | }, |
| 335 | [1] = { |
| 336 | .name = "crypto_channels", |
| 337 | .start = DMOV8064_CE_IN_CHAN, |
| 338 | .end = DMOV8064_CE_OUT_CHAN, |
| 339 | .flags = IORESOURCE_DMA, |
| 340 | }, |
| 341 | [2] = { |
| 342 | .name = "crypto_crci_in", |
| 343 | .start = DMOV8064_CE_IN_CRCI, |
| 344 | .end = DMOV8064_CE_IN_CRCI, |
| 345 | .flags = IORESOURCE_DMA, |
| 346 | }, |
| 347 | [3] = { |
| 348 | .name = "crypto_crci_out", |
| 349 | .start = DMOV8064_CE_OUT_CRCI, |
| 350 | .end = DMOV8064_CE_OUT_CRCI, |
| 351 | .flags = IORESOURCE_DMA, |
| 352 | }, |
| 353 | }; |
| 354 | |
| 355 | #endif |
| 356 | |
| 357 | #if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \ |
| 358 | defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) |
| 359 | |
| 360 | static struct msm_ce_hw_support qcrypto_ce_hw_suppport = { |
| 361 | .ce_shared = QCE_CE_SHARED, |
| 362 | .shared_ce_resource = QCE_SHARE_CE_RESOURCE, |
| 363 | .hw_key_support = QCE_HW_KEY_SUPPORT, |
| 364 | .sha_hmac = QCE_SHA_HMAC_SUPPORT, |
Ramesh Masavarapu | 4925968 | 2011-12-02 14:00:18 -0800 | [diff] [blame] | 365 | .bus_scale_table = NULL, |
Ramesh Masavarapu | 2831191 | 2011-10-27 11:04:12 -0700 | [diff] [blame] | 366 | }; |
| 367 | |
| 368 | static struct platform_device qcrypto_device = { |
| 369 | .name = "qcrypto", |
| 370 | .id = 0, |
| 371 | .num_resources = ARRAY_SIZE(qcrypto_resources), |
| 372 | .resource = qcrypto_resources, |
| 373 | .dev = { |
| 374 | .coherent_dma_mask = DMA_BIT_MASK(32), |
| 375 | .platform_data = &qcrypto_ce_hw_suppport, |
| 376 | }, |
| 377 | }; |
| 378 | #endif |
| 379 | |
| 380 | #if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \ |
| 381 | defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE) |
| 382 | |
| 383 | static struct msm_ce_hw_support qcedev_ce_hw_suppport = { |
| 384 | .ce_shared = QCE_CE_SHARED, |
| 385 | .shared_ce_resource = QCE_SHARE_CE_RESOURCE, |
| 386 | .hw_key_support = QCE_HW_KEY_SUPPORT, |
| 387 | .sha_hmac = QCE_SHA_HMAC_SUPPORT, |
Ramesh Masavarapu | 4925968 | 2011-12-02 14:00:18 -0800 | [diff] [blame] | 388 | .bus_scale_table = NULL, |
Ramesh Masavarapu | 2831191 | 2011-10-27 11:04:12 -0700 | [diff] [blame] | 389 | }; |
| 390 | |
| 391 | static struct platform_device qcedev_device = { |
| 392 | .name = "qce", |
| 393 | .id = 0, |
| 394 | .num_resources = ARRAY_SIZE(qcedev_resources), |
| 395 | .resource = qcedev_resources, |
| 396 | .dev = { |
| 397 | .coherent_dma_mask = DMA_BIT_MASK(32), |
| 398 | .platform_data = &qcedev_ce_hw_suppport, |
| 399 | }, |
| 400 | }; |
| 401 | #endif |
| 402 | |
| 403 | |
Jeff Hugo | 0c0f5e9 | 2011-09-28 13:55:45 -0600 | [diff] [blame] | 404 | #define MSM_SHARED_RAM_PHYS 0x80000000 |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 405 | static void __init apq8064_map_io(void) |
| 406 | { |
Jeff Hugo | 0c0f5e9 | 2011-09-28 13:55:45 -0600 | [diff] [blame] | 407 | msm_shared_ram_phys = MSM_SHARED_RAM_PHYS; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 408 | msm_map_apq8064_io(); |
Jeff Ohlstein | 3a77f9f | 2011-09-06 14:50:20 -0700 | [diff] [blame] | 409 | if (socinfo_init() < 0) |
| 410 | pr_err("socinfo_init() failed!\n"); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 411 | } |
| 412 | |
| 413 | static void __init apq8064_init_irq(void) |
| 414 | { |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 415 | gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE, |
| 416 | (void *)MSM_QGIC_CPU_BASE); |
| 417 | |
| 418 | /* Edge trigger PPIs except AVS_SVICINT and AVS_SVICINTSWDONE */ |
| 419 | writel_relaxed(0xFFFFD7FF, MSM_QGIC_DIST_BASE + GIC_DIST_CONFIG + 4); |
| 420 | |
| 421 | writel_relaxed(0x0000FFFF, MSM_QGIC_DIST_BASE + GIC_DIST_ENABLE_SET); |
| 422 | mb(); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 423 | } |
| 424 | |
Jay Chokshi | 7805b5a | 2011-11-07 15:55:30 -0800 | [diff] [blame] | 425 | static struct platform_device msm8064_device_saw_regulator_core0 = { |
| 426 | .name = "saw-regulator", |
| 427 | .id = 0, |
| 428 | .dev = { |
| 429 | .platform_data = &msm8064_saw_regulator_pdata_8921_s5, |
| 430 | }, |
| 431 | }; |
| 432 | |
| 433 | static struct platform_device msm8064_device_saw_regulator_core1 = { |
| 434 | .name = "saw-regulator", |
| 435 | .id = 1, |
| 436 | .dev = { |
| 437 | .platform_data = &msm8064_saw_regulator_pdata_8921_s6, |
| 438 | }, |
| 439 | }; |
| 440 | |
| 441 | static struct platform_device msm8064_device_saw_regulator_core2 = { |
| 442 | .name = "saw-regulator", |
| 443 | .id = 2, |
| 444 | .dev = { |
| 445 | .platform_data = &msm8064_saw_regulator_pdata_8821_s0, |
| 446 | }, |
| 447 | }; |
| 448 | |
| 449 | static struct platform_device msm8064_device_saw_regulator_core3 = { |
| 450 | .name = "saw-regulator", |
| 451 | .id = 3, |
| 452 | .dev = { |
| 453 | .platform_data = &msm8064_saw_regulator_pdata_8821_s1, |
| 454 | }, |
| 455 | }; |
| 456 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 457 | static struct platform_device *common_devices[] __initdata = { |
Jin Hong | 01f2dbb | 2011-11-03 22:13:51 -0700 | [diff] [blame] | 458 | &apq8064_device_dmov, |
Kenneth Heitke | 748593a | 2011-07-15 15:45:11 -0600 | [diff] [blame] | 459 | &apq8064_device_qup_i2c_gsbi4, |
Harini Jayaraman | c4c5869 | 2011-07-19 14:50:10 -0600 | [diff] [blame] | 460 | &apq8064_device_qup_spi_gsbi5, |
Sagar Dharia | 8bdcdaf | 2011-09-16 16:01:15 -0600 | [diff] [blame] | 461 | &apq8064_slim_ctrl, |
Jay Chokshi | 9c25f07 | 2011-09-23 18:19:15 -0700 | [diff] [blame] | 462 | &apq8064_device_ssbi_pmic1, |
| 463 | &apq8064_device_ssbi_pmic2, |
Jeff Hugo | 0c0f5e9 | 2011-09-28 13:55:45 -0600 | [diff] [blame] | 464 | &msm_device_smd_apq8064, |
Hemant Kumar | 4933b07 | 2011-10-17 23:43:11 -0700 | [diff] [blame] | 465 | &apq8064_device_otg, |
| 466 | &apq8064_device_gadget_peripheral, |
| 467 | &android_usb_device, |
Kevin Chan | 13be4e2 | 2011-10-20 11:30:32 -0700 | [diff] [blame] | 468 | &android_pmem_device, |
| 469 | &android_pmem_adsp_device, |
| 470 | &android_pmem_audio_device, |
Jeff Ohlstein | 7e66855 | 2011-10-06 16:17:25 -0700 | [diff] [blame] | 471 | &msm8064_device_watchdog, |
Jay Chokshi | 7805b5a | 2011-11-07 15:55:30 -0800 | [diff] [blame] | 472 | &msm8064_device_saw_regulator_core0, |
| 473 | &msm8064_device_saw_regulator_core1, |
| 474 | &msm8064_device_saw_regulator_core2, |
| 475 | &msm8064_device_saw_regulator_core3, |
Ramesh Masavarapu | 2831191 | 2011-10-27 11:04:12 -0700 | [diff] [blame] | 476 | #if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \ |
| 477 | defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) |
| 478 | &qcrypto_device, |
| 479 | #endif |
| 480 | |
| 481 | #if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \ |
| 482 | defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE) |
| 483 | &qcedev_device, |
| 484 | #endif |
Ramesh Masavarapu | f46be1b | 2011-11-03 11:13:41 -0700 | [diff] [blame] | 485 | |
| 486 | #ifdef CONFIG_HW_RANDOM_MSM |
| 487 | &apq8064_device_rng, |
| 488 | #endif |
Bharath Ramachandramurthy | b8e797f | 2011-11-30 12:08:42 -0800 | [diff] [blame] | 489 | &apq_pcm, |
| 490 | &apq_pcm_routing, |
| 491 | &apq_cpudai0, |
| 492 | &apq_cpudai1, |
| 493 | &apq_cpudai_hdmi_rx, |
| 494 | &apq_cpudai_bt_rx, |
| 495 | &apq_cpudai_bt_tx, |
| 496 | &apq_cpudai_fm_rx, |
| 497 | &apq_cpudai_fm_tx, |
| 498 | &apq_cpu_fe, |
| 499 | &apq_stub_codec, |
| 500 | &apq_voice, |
| 501 | &apq_voip, |
| 502 | &apq_lpa_pcm, |
| 503 | &apq_pcm_hostless, |
| 504 | &apq_cpudai_afe_01_rx, |
| 505 | &apq_cpudai_afe_01_tx, |
| 506 | &apq_cpudai_afe_02_rx, |
| 507 | &apq_cpudai_afe_02_tx, |
| 508 | &apq_pcm_afe, |
| 509 | &apq_cpudai_auxpcm_rx, |
| 510 | &apq_cpudai_auxpcm_tx, |
Harini Jayaraman | c4c5869 | 2011-07-19 14:50:10 -0600 | [diff] [blame] | 511 | }; |
| 512 | |
Joel King | 4e7ad22 | 2011-08-17 15:47:38 -0700 | [diff] [blame] | 513 | static struct platform_device *sim_devices[] __initdata = { |
Stepan Moskovchenko | 2701a44 | 2011-08-19 13:47:22 -0700 | [diff] [blame] | 514 | &apq8064_device_uart_gsbi3, |
Yan He | 06913ce | 2011-08-26 16:33:46 -0700 | [diff] [blame] | 515 | &msm_device_sps_apq8064, |
Stepan Moskovchenko | 2701a44 | 2011-08-19 13:47:22 -0700 | [diff] [blame] | 516 | }; |
| 517 | |
| 518 | static struct platform_device *rumi3_devices[] __initdata = { |
| 519 | &apq8064_device_uart_gsbi1, |
Yan He | 435ed61 | 2011-11-23 17:34:59 -0800 | [diff] [blame] | 520 | &msm_device_sps_apq8064, |
Joel King | 4e7ad22 | 2011-08-17 15:47:38 -0700 | [diff] [blame] | 521 | }; |
| 522 | |
Harini Jayaraman | c4c5869 | 2011-07-19 14:50:10 -0600 | [diff] [blame] | 523 | static struct msm_spi_platform_data apq8064_qup_spi_gsbi5_pdata = { |
Harini Jayaraman | 60ee14c | 2011-11-09 18:53:27 -0700 | [diff] [blame] | 524 | .max_clock_speed = 24000000, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 525 | }; |
| 526 | |
Stepan Moskovchenko | eed82a5 | 2011-09-02 13:19:23 -0700 | [diff] [blame] | 527 | #define KS8851_IRQ_GPIO 43 |
| 528 | |
| 529 | static struct spi_board_info spi_board_info[] __initdata = { |
| 530 | { |
| 531 | .modalias = "ks8851", |
| 532 | .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO), |
| 533 | .max_speed_hz = 19200000, |
| 534 | .bus_num = 0, |
| 535 | .chip_select = 2, |
| 536 | .mode = SPI_MODE_0, |
| 537 | }, |
| 538 | }; |
| 539 | |
Sagar Dharia | 8bdcdaf | 2011-09-16 16:01:15 -0600 | [diff] [blame] | 540 | static struct slim_boardinfo apq8064_slim_devices[] = { |
Swaminathan Sathappan | 2f51a75 | 2011-12-05 12:51:19 -0800 | [diff] [blame] | 541 | { |
Swaminathan Sathappan | cef966d | 2011-12-15 17:27:04 -0800 | [diff] [blame^] | 542 | .bus_num = 1, |
| 543 | .slim_slave = &apq8064_slim_tabla, |
| 544 | }, |
| 545 | { |
| 546 | .bus_num = 1, |
| 547 | .slim_slave = &apq8064_slim_tabla20, |
Swaminathan Sathappan | 2f51a75 | 2011-12-05 12:51:19 -0800 | [diff] [blame] | 548 | }, |
| 549 | /* add more slimbus slaves as needed */ |
Sagar Dharia | 8bdcdaf | 2011-09-16 16:01:15 -0600 | [diff] [blame] | 550 | }; |
| 551 | |
Kenneth Heitke | 748593a | 2011-07-15 15:45:11 -0600 | [diff] [blame] | 552 | static struct msm_i2c_platform_data apq8064_i2c_qup_gsbi4_pdata = { |
| 553 | .clk_freq = 100000, |
| 554 | .src_clk_rate = 24000000, |
Kenneth Heitke | 748593a | 2011-07-15 15:45:11 -0600 | [diff] [blame] | 555 | }; |
| 556 | |
| 557 | static void __init apq8064_i2c_init(void) |
| 558 | { |
| 559 | apq8064_device_qup_i2c_gsbi4.dev.platform_data = |
| 560 | &apq8064_i2c_qup_gsbi4_pdata; |
| 561 | } |
| 562 | |
Stepan Moskovchenko | eed82a5 | 2011-09-02 13:19:23 -0700 | [diff] [blame] | 563 | #ifdef CONFIG_KS8851 |
| 564 | static int ethernet_init(void) |
| 565 | { |
| 566 | int ret; |
| 567 | ret = gpio_request(KS8851_IRQ_GPIO, "ks8851_irq"); |
| 568 | if (ret) { |
| 569 | pr_err("ks8851 gpio_request failed: %d\n", ret); |
| 570 | goto fail; |
| 571 | } |
| 572 | |
| 573 | return 0; |
| 574 | fail: |
| 575 | return ret; |
| 576 | } |
| 577 | #else |
| 578 | static int ethernet_init(void) |
| 579 | { |
| 580 | return 0; |
| 581 | } |
| 582 | #endif |
| 583 | |
Tianyi Gou | 41515e2 | 2011-09-01 19:37:43 -0700 | [diff] [blame] | 584 | static void __init apq8064_clock_init(void) |
| 585 | { |
| 586 | if (machine_is_apq8064_sim()) |
| 587 | msm_clock_init(&apq8064_clock_init_data); |
| 588 | else |
| 589 | msm_clock_init(&apq8064_dummy_clock_init_data); |
| 590 | } |
| 591 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 592 | static void __init apq8064_common_init(void) |
| 593 | { |
| 594 | if (socinfo_init() < 0) |
| 595 | pr_err("socinfo_init() failed!\n"); |
Tianyi Gou | 41515e2 | 2011-09-01 19:37:43 -0700 | [diff] [blame] | 596 | apq8064_clock_init(); |
Stepan Moskovchenko | 2327a95 | 2011-12-14 16:31:28 -0800 | [diff] [blame] | 597 | apq8064_init_gpiomux(); |
Kenneth Heitke | 748593a | 2011-07-15 15:45:11 -0600 | [diff] [blame] | 598 | apq8064_i2c_init(); |
Kenneth Heitke | 36920d3 | 2011-07-20 16:44:30 -0600 | [diff] [blame] | 599 | |
Harini Jayaraman | c4c5869 | 2011-07-19 14:50:10 -0600 | [diff] [blame] | 600 | apq8064_device_qup_spi_gsbi5.dev.platform_data = |
| 601 | &apq8064_qup_spi_gsbi5_pdata; |
Stepan Moskovchenko | c1074f0 | 2011-12-14 17:51:57 -0800 | [diff] [blame] | 602 | apq8064_init_pmic(); |
Stepan Moskovchenko | 14aa649 | 2011-08-08 15:15:01 -0700 | [diff] [blame] | 603 | apq8064_device_otg.dev.platform_data = &msm_otg_pdata; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 604 | platform_add_devices(common_devices, ARRAY_SIZE(common_devices)); |
Sahitya Tummala | 3586ed9 | 2011-08-03 09:13:23 +0530 | [diff] [blame] | 605 | apq8064_init_mmc(); |
Sagar Dharia | 8bdcdaf | 2011-09-16 16:01:15 -0600 | [diff] [blame] | 606 | slim_register_board_info(apq8064_slim_devices, |
| 607 | ARRAY_SIZE(apq8064_slim_devices)); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 608 | } |
| 609 | |
| 610 | static void __init apq8064_sim_init(void) |
| 611 | { |
Jeff Ohlstein | 7e66855 | 2011-10-06 16:17:25 -0700 | [diff] [blame] | 612 | struct msm_watchdog_pdata *wdog_pdata = (struct msm_watchdog_pdata *) |
| 613 | &msm8064_device_watchdog.dev.platform_data; |
| 614 | |
| 615 | wdog_pdata->bark_time = 15000; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 616 | apq8064_common_init(); |
Joel King | 4e7ad22 | 2011-08-17 15:47:38 -0700 | [diff] [blame] | 617 | platform_add_devices(sim_devices, ARRAY_SIZE(sim_devices)); |
| 618 | } |
| 619 | |
| 620 | static void __init apq8064_rumi3_init(void) |
| 621 | { |
| 622 | apq8064_common_init(); |
Stepan Moskovchenko | eed82a5 | 2011-09-02 13:19:23 -0700 | [diff] [blame] | 623 | ethernet_init(); |
Stepan Moskovchenko | 2701a44 | 2011-08-19 13:47:22 -0700 | [diff] [blame] | 624 | platform_add_devices(rumi3_devices, ARRAY_SIZE(rumi3_devices)); |
Stepan Moskovchenko | eed82a5 | 2011-09-02 13:19:23 -0700 | [diff] [blame] | 625 | spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info)); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 626 | } |
| 627 | |
| 628 | MACHINE_START(APQ8064_SIM, "QCT APQ8064 SIMULATOR") |
| 629 | .map_io = apq8064_map_io, |
Kevin Chan | 13be4e2 | 2011-10-20 11:30:32 -0700 | [diff] [blame] | 630 | .reserve = apq8064_reserve, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 631 | .init_irq = apq8064_init_irq, |
Marc Zyngier | 89bdafd1 | 2011-12-22 11:39:20 +0530 | [diff] [blame] | 632 | .handle_irq = gic_handle_irq, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 633 | .timer = &msm_timer, |
| 634 | .init_machine = apq8064_sim_init, |
| 635 | MACHINE_END |
| 636 | |
Joel King | 4e7ad22 | 2011-08-17 15:47:38 -0700 | [diff] [blame] | 637 | MACHINE_START(APQ8064_RUMI3, "QCT APQ8064 RUMI3") |
| 638 | .map_io = apq8064_map_io, |
Kevin Chan | 13be4e2 | 2011-10-20 11:30:32 -0700 | [diff] [blame] | 639 | .reserve = apq8064_reserve, |
Joel King | 4e7ad22 | 2011-08-17 15:47:38 -0700 | [diff] [blame] | 640 | .init_irq = apq8064_init_irq, |
Marc Zyngier | 89bdafd1 | 2011-12-22 11:39:20 +0530 | [diff] [blame] | 641 | .handle_irq = gic_handle_irq, |
Joel King | 4e7ad22 | 2011-08-17 15:47:38 -0700 | [diff] [blame] | 642 | .timer = &msm_timer, |
| 643 | .init_machine = apq8064_rumi3_init, |
| 644 | MACHINE_END |
| 645 | |