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> |
Niranjana Vishwanathapura | c1edd40 | 2012-06-28 15:32:50 -0600 | [diff] [blame] | 14 | #include <linux/bitops.h> |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 15 | #include <linux/platform_device.h> |
Steve Muckle | f132c6c | 2012-06-06 18:30:57 -0700 | [diff] [blame] | 16 | #include <linux/gpio.h> |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 17 | #include <linux/io.h> |
| 18 | #include <linux/irq.h> |
Kenneth Heitke | 748593a | 2011-07-15 15:45:11 -0600 | [diff] [blame] | 19 | #include <linux/i2c.h> |
David Keitel | 2f613d9 | 2012-02-15 11:29:16 -0800 | [diff] [blame] | 20 | #include <linux/i2c/smb349.h> |
Siddartha Mohanadoss | b9df494 | 2012-02-08 09:58:21 -0800 | [diff] [blame] | 21 | #include <linux/i2c/sx150x.h> |
Sagar Dharia | 8bdcdaf | 2011-09-16 16:01:15 -0600 | [diff] [blame] | 22 | #include <linux/slimbus/slimbus.h> |
Asish Bhattacharya | b1aeae2 | 2012-02-15 08:29:28 +0530 | [diff] [blame] | 23 | #include <linux/mfd/wcd9xxx/core.h> |
| 24 | #include <linux/mfd/wcd9xxx/pdata.h> |
Amy Maloche | 70090f99 | 2012-02-16 16:35:26 -0800 | [diff] [blame] | 25 | #include <linux/mfd/pm8xxx/misc.h> |
Kenneth Heitke | 36920d3 | 2011-07-20 16:44:30 -0600 | [diff] [blame] | 26 | #include <linux/msm_ssbi.h> |
Stepan Moskovchenko | eed82a5 | 2011-09-02 13:19:23 -0700 | [diff] [blame] | 27 | #include <linux/spi/spi.h> |
Ramesh Masavarapu | 2831191 | 2011-10-27 11:04:12 -0700 | [diff] [blame] | 28 | #include <linux/dma-mapping.h> |
| 29 | #include <linux/platform_data/qcom_crypto_device.h> |
Mitchel Humpherys | ca983d8 | 2012-09-06 11:32:54 -0700 | [diff] [blame^] | 30 | #include <linux/msm_ion.h> |
Jack Cheung | 46bfffa | 2012-01-19 15:26:24 -0800 | [diff] [blame] | 31 | #include <linux/memory.h> |
Larry Bassel | 67b921d | 2012-04-06 10:23:27 -0700 | [diff] [blame] | 32 | #include <linux/memblock.h> |
Praveen Chidambaram | 877d7a4 | 2012-06-05 14:33:20 -0600 | [diff] [blame] | 33 | #include <linux/msm_thermal.h> |
Jing Lin | 21ed4de | 2012-02-05 15:53:28 -0800 | [diff] [blame] | 34 | #include <linux/i2c/atmel_mxt_ts.h> |
Steve Muckle | f132c6c | 2012-06-06 18:30:57 -0700 | [diff] [blame] | 35 | #include <linux/cyttsp-qc.h> |
Amy Maloche | 70090f99 | 2012-02-16 16:35:26 -0800 | [diff] [blame] | 36 | #include <linux/i2c/isa1200.h> |
Mohan Pallaka | 474b94b | 2012-01-25 12:59:58 +0530 | [diff] [blame] | 37 | #include <linux/gpio_keys.h> |
Siddartha Mohanadoss | b9df494 | 2012-02-08 09:58:21 -0800 | [diff] [blame] | 38 | #include <linux/epm_adc.h> |
Jay Chokshi | e7d8d4f | 2012-04-04 14:47:57 -0700 | [diff] [blame] | 39 | #include <linux/i2c/sx150x.h> |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 40 | #include <asm/mach-types.h> |
| 41 | #include <asm/mach/arch.h> |
| 42 | #include <asm/hardware/gic.h> |
Sahitya Tummala | 3586ed9 | 2011-08-03 09:13:23 +0530 | [diff] [blame] | 43 | #include <asm/mach/mmc.h> |
Ankit Verma | 6b7e2ba | 2012-01-26 15:48:54 -0800 | [diff] [blame] | 44 | #include <linux/platform_data/qcom_wcnss_device.h> |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 45 | |
| 46 | #include <mach/board.h> |
| 47 | #include <mach/msm_iomap.h> |
Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 48 | #include <mach/ion.h> |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 49 | #include <linux/usb/msm_hsusb.h> |
| 50 | #include <linux/usb/android.h> |
| 51 | #include <mach/socinfo.h> |
Harini Jayaraman | c4c5869 | 2011-07-19 14:50:10 -0600 | [diff] [blame] | 52 | #include <mach/msm_spi.h> |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 53 | #include "timer.h" |
| 54 | #include "devices.h" |
Joel King | 4ebccc6 | 2011-07-22 09:43:22 -0700 | [diff] [blame] | 55 | #include <mach/gpiomux.h> |
Praveen Chidambaram | 7849901 | 2011-11-01 17:15:17 -0600 | [diff] [blame] | 56 | #include <mach/rpm.h> |
Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 57 | #ifdef CONFIG_ANDROID_PMEM |
Kevin Chan | 13be4e2 | 2011-10-20 11:30:32 -0700 | [diff] [blame] | 58 | #include <linux/android_pmem.h> |
Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 59 | #endif |
Kevin Chan | 13be4e2 | 2011-10-20 11:30:32 -0700 | [diff] [blame] | 60 | #include <mach/msm_memtypes.h> |
| 61 | #include <linux/bootmem.h> |
| 62 | #include <asm/setup.h> |
Ramesh Masavarapu | 2831191 | 2011-10-27 11:04:12 -0700 | [diff] [blame] | 63 | #include <mach/dma.h> |
Jin Hong | d3024e6 | 2012-02-09 16:13:32 -0800 | [diff] [blame] | 64 | #include <mach/msm_dsps.h> |
Gagan Mac | 8a7a5d3 | 2011-11-11 16:43:06 -0700 | [diff] [blame] | 65 | #include <mach/msm_bus_board.h> |
Praveen Chidambaram | 7849901 | 2011-11-01 17:15:17 -0600 | [diff] [blame] | 66 | #include <mach/cpuidle.h> |
Joel King | dacbc82 | 2012-01-25 13:30:57 -0800 | [diff] [blame] | 67 | #include <mach/mdm2.h> |
Siddartha Mohanadoss | caeaa92 | 2012-02-07 16:41:38 -0800 | [diff] [blame] | 68 | #include <linux/msm_tsens.h> |
Stephen Boyd | 4d0d258 | 2012-02-10 14:49:40 -0800 | [diff] [blame] | 69 | #include <mach/msm_xo.h> |
Laura Abbott | 350c836 | 2012-02-28 14:46:52 -0800 | [diff] [blame] | 70 | #include <mach/msm_rtb.h> |
Mayank Rana | 262e903 | 2012-05-10 15:14:00 -0700 | [diff] [blame] | 71 | #include <mach/msm_serial_hs.h> |
Santosh Mardi | eff9a74 | 2012-04-09 23:23:39 +0530 | [diff] [blame] | 72 | #include <sound/cs8427.h> |
Ravi Kumar V | 05931a2 | 2012-04-04 17:09:37 +0530 | [diff] [blame] | 73 | #include <media/gpio-ir-recv.h> |
Larry Bassel | 67b921d | 2012-04-06 10:23:27 -0700 | [diff] [blame] | 74 | #include <linux/fmem.h> |
Niranjana Vishwanathapura | 06f8933 | 2012-05-03 17:11:13 -0600 | [diff] [blame] | 75 | #include <mach/msm_pcie.h> |
Jeff Ohlstein | dd0dd9b | 2012-05-29 17:47:21 -0700 | [diff] [blame] | 76 | #include <mach/restart.h> |
Niranjana Vishwanathapura | c1edd40 | 2012-06-28 15:32:50 -0600 | [diff] [blame] | 77 | #include <mach/msm_iomap.h> |
Joel King | 4ebccc6 | 2011-07-22 09:43:22 -0700 | [diff] [blame] | 78 | |
Jeff Ohlstein | 7e66855 | 2011-10-06 16:17:25 -0700 | [diff] [blame] | 79 | #include "msm_watchdog.h" |
Stepan Moskovchenko | 5a83dba | 2011-12-05 17:30:17 -0800 | [diff] [blame] | 80 | #include "board-8064.h" |
Praveen Chidambaram | 7849901 | 2011-11-01 17:15:17 -0600 | [diff] [blame] | 81 | #include "spm.h" |
Subhash Jadavani | 909e04f | 2012-04-12 10:52:50 +0530 | [diff] [blame] | 82 | #include <mach/mpm.h> |
Praveen Chidambaram | 7849901 | 2011-11-01 17:15:17 -0600 | [diff] [blame] | 83 | #include "rpm_resources.h" |
Matt Wagantall | 7cca464 | 2012-02-01 16:43:24 -0800 | [diff] [blame] | 84 | #include "pm.h" |
Praveen Chidambaram | 7849901 | 2011-11-01 17:15:17 -0600 | [diff] [blame] | 85 | #include "pm-boot.h" |
Rajesh Sastrula | aee8af3 | 2012-01-20 11:46:31 -0800 | [diff] [blame] | 86 | #include "devices-msm8x60.h" |
Hanumant Singh | 50440d4 | 2012-04-23 19:27:16 -0700 | [diff] [blame] | 87 | #include "smd_private.h" |
Jay Chokshi | ea67c62 | 2011-07-29 17:12:26 -0700 | [diff] [blame] | 88 | |
Abhishek Kharbanda | 72dc72e | 2012-06-07 13:41:37 -0700 | [diff] [blame] | 89 | #define MHL_GPIO_INT 30 |
| 90 | #define MHL_GPIO_RESET 35 |
| 91 | |
Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 92 | #define MSM_PMEM_ADSP_SIZE 0x7800000 |
Bharath Ramachandramurthy | 2fd017a | 2012-03-13 10:21:09 -0700 | [diff] [blame] | 93 | #define MSM_PMEM_AUDIO_SIZE 0x4CF000 |
Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 94 | #ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY |
| 95 | #define MSM_PMEM_SIZE 0x4000000 /* 64 Mbytes */ |
| 96 | #else |
Chetan Kalyan | 72aac4f | 2012-02-23 14:56:54 -0800 | [diff] [blame] | 97 | #define MSM_PMEM_SIZE 0x4000000 /* 64 Mbytes */ |
Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 98 | #endif |
Kevin Chan | 13be4e2 | 2011-10-20 11:30:32 -0700 | [diff] [blame] | 99 | |
Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 100 | #ifdef CONFIG_MSM_MULTIMEDIA_USE_ION |
Hanumant Singh | eadb750 | 2012-05-15 18:14:04 -0700 | [diff] [blame] | 101 | #define HOLE_SIZE 0x20000 |
Mitchel Humpherys | 05e5881 | 2012-08-13 14:24:13 -0700 | [diff] [blame] | 102 | #define MSM_CONTIG_MEM_SIZE 0x65000 |
Olav Haugan | 129992c | 2012-03-22 09:54:01 -0700 | [diff] [blame] | 103 | #ifdef CONFIG_MSM_IOMMU |
| 104 | #define MSM_ION_MM_SIZE 0x3800000 |
| 105 | #define MSM_ION_SF_SIZE 0 |
Olav Haugan | 39477bb | 2012-05-14 16:05:36 -0700 | [diff] [blame] | 106 | #define MSM_ION_QSECOM_SIZE 0x780000 /* (7.5MB) */ |
Olav Haugan | 129992c | 2012-03-22 09:54:01 -0700 | [diff] [blame] | 107 | #define MSM_ION_HEAP_NUM 7 |
| 108 | #else |
Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 109 | #define MSM_ION_MM_SIZE MSM_PMEM_ADSP_SIZE |
Olav Haugan | 129992c | 2012-03-22 09:54:01 -0700 | [diff] [blame] | 110 | #define MSM_ION_SF_SIZE MSM_PMEM_SIZE |
Olav Haugan | 39477bb | 2012-05-14 16:05:36 -0700 | [diff] [blame] | 111 | #define MSM_ION_QSECOM_SIZE 0x600000 /* (6MB) */ |
Olav Haugan | 129992c | 2012-03-22 09:54:01 -0700 | [diff] [blame] | 112 | #define MSM_ION_HEAP_NUM 8 |
| 113 | #endif |
Hanumant Singh | eadb750 | 2012-05-15 18:14:04 -0700 | [diff] [blame] | 114 | #define MSM_ION_MM_FW_SIZE (0x200000 - HOLE_SIZE) /* (2MB - 128KB) */ |
Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 115 | #define MSM_ION_MFC_SIZE SZ_8K |
Olav Haugan | 2c43fac | 2012-01-19 11:06:37 -0800 | [diff] [blame] | 116 | #define MSM_ION_AUDIO_SIZE MSM_PMEM_AUDIO_SIZE |
Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 117 | #else |
Mitchel Humpherys | 05e5881 | 2012-08-13 14:24:13 -0700 | [diff] [blame] | 118 | #define MSM_CONTIG_MEM_SIZE 0x110C000 |
Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 119 | #define MSM_ION_HEAP_NUM 1 |
| 120 | #endif |
Kevin Chan | 13be4e2 | 2011-10-20 11:30:32 -0700 | [diff] [blame] | 121 | |
Hanumant Singh | eadb750 | 2012-05-15 18:14:04 -0700 | [diff] [blame] | 122 | #define APQ8064_FIXED_AREA_START (0xa0000000 - (MSM_ION_MM_FW_SIZE + \ |
| 123 | HOLE_SIZE)) |
Larry Bassel | 67b921d | 2012-04-06 10:23:27 -0700 | [diff] [blame] | 124 | #define MAX_FIXED_AREA_SIZE 0x10000000 |
Hanumant Singh | eadb750 | 2012-05-15 18:14:04 -0700 | [diff] [blame] | 125 | #define MSM_MM_FW_SIZE (0x200000 - HOLE_SIZE) |
| 126 | #define APQ8064_FW_START APQ8064_FIXED_AREA_START |
Larry Bassel | 67b921d | 2012-04-06 10:23:27 -0700 | [diff] [blame] | 127 | |
Niranjana Vishwanathapura | c1edd40 | 2012-06-28 15:32:50 -0600 | [diff] [blame] | 128 | #define QFPROM_RAW_FEAT_CONFIG_ROW0_MSB (MSM_QFPROM_BASE + 0x23c) |
| 129 | #define QFPROM_RAW_OEM_CONFIG_ROW0_LSB (MSM_QFPROM_BASE + 0x220) |
| 130 | |
Niranjana Vishwanathapura | 68210ff | 2012-06-24 18:03:49 -0600 | [diff] [blame] | 131 | /* PCIE AXI address space */ |
| 132 | #define PCIE_AXI_BAR_PHYS 0x08000000 |
| 133 | #define PCIE_AXI_BAR_SIZE SZ_128M |
| 134 | |
Niranjana Vishwanathapura | 459a27d | 2012-07-20 12:23:55 -0600 | [diff] [blame] | 135 | /* PCIe pmic gpios */ |
| 136 | #define PCIE_WAKE_N_PMIC_GPIO 12 |
Niranjana Vishwanathapura | 06f8933 | 2012-05-03 17:11:13 -0600 | [diff] [blame] | 137 | #define PCIE_PWR_EN_PMIC_GPIO 13 |
| 138 | #define PCIE_RST_N_PMIC_MPP 1 |
| 139 | |
Mitchel Humpherys | 05e5881 | 2012-08-13 14:24:13 -0700 | [diff] [blame] | 140 | #ifdef CONFIG_KERNEL_MSM_CONTIG_MEM_REGION |
| 141 | static unsigned msm_contig_mem_size = MSM_CONTIG_MEM_SIZE; |
| 142 | static int __init msm_contig_mem_size_setup(char *p) |
Kevin Chan | 13be4e2 | 2011-10-20 11:30:32 -0700 | [diff] [blame] | 143 | { |
Mitchel Humpherys | 05e5881 | 2012-08-13 14:24:13 -0700 | [diff] [blame] | 144 | msm_contig_mem_size = memparse(p, NULL); |
Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 145 | return 0; |
Kevin Chan | 13be4e2 | 2011-10-20 11:30:32 -0700 | [diff] [blame] | 146 | } |
Mitchel Humpherys | 05e5881 | 2012-08-13 14:24:13 -0700 | [diff] [blame] | 147 | early_param("msm_contig_mem_size", msm_contig_mem_size_setup); |
Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 148 | #endif |
Kevin Chan | 13be4e2 | 2011-10-20 11:30:32 -0700 | [diff] [blame] | 149 | |
Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 150 | #ifdef CONFIG_ANDROID_PMEM |
Kevin Chan | 13be4e2 | 2011-10-20 11:30:32 -0700 | [diff] [blame] | 151 | static unsigned pmem_size = MSM_PMEM_SIZE; |
| 152 | static int __init pmem_size_setup(char *p) |
| 153 | { |
| 154 | pmem_size = memparse(p, NULL); |
| 155 | return 0; |
| 156 | } |
| 157 | early_param("pmem_size", pmem_size_setup); |
| 158 | |
| 159 | static unsigned pmem_adsp_size = MSM_PMEM_ADSP_SIZE; |
| 160 | |
| 161 | static int __init pmem_adsp_size_setup(char *p) |
| 162 | { |
| 163 | pmem_adsp_size = memparse(p, NULL); |
| 164 | return 0; |
| 165 | } |
| 166 | early_param("pmem_adsp_size", pmem_adsp_size_setup); |
| 167 | |
| 168 | static unsigned pmem_audio_size = MSM_PMEM_AUDIO_SIZE; |
| 169 | |
| 170 | static int __init pmem_audio_size_setup(char *p) |
| 171 | { |
| 172 | pmem_audio_size = memparse(p, NULL); |
| 173 | return 0; |
| 174 | } |
| 175 | early_param("pmem_audio_size", pmem_audio_size_setup); |
Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 176 | #endif |
Kevin Chan | 13be4e2 | 2011-10-20 11:30:32 -0700 | [diff] [blame] | 177 | |
Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 178 | #ifdef CONFIG_ANDROID_PMEM |
| 179 | #ifndef CONFIG_MSM_MULTIMEDIA_USE_ION |
Kevin Chan | 13be4e2 | 2011-10-20 11:30:32 -0700 | [diff] [blame] | 180 | static struct android_pmem_platform_data android_pmem_pdata = { |
| 181 | .name = "pmem", |
| 182 | .allocator_type = PMEM_ALLOCATORTYPE_ALLORNOTHING, |
| 183 | .cached = 1, |
| 184 | .memory_type = MEMTYPE_EBI1, |
| 185 | }; |
| 186 | |
Laura Abbott | b93525f | 2012-04-12 09:57:19 -0700 | [diff] [blame] | 187 | static struct platform_device apq8064_android_pmem_device = { |
Kevin Chan | 13be4e2 | 2011-10-20 11:30:32 -0700 | [diff] [blame] | 188 | .name = "android_pmem", |
| 189 | .id = 0, |
| 190 | .dev = {.platform_data = &android_pmem_pdata}, |
| 191 | }; |
| 192 | |
| 193 | static struct android_pmem_platform_data android_pmem_adsp_pdata = { |
| 194 | .name = "pmem_adsp", |
| 195 | .allocator_type = PMEM_ALLOCATORTYPE_BITMAP, |
| 196 | .cached = 0, |
| 197 | .memory_type = MEMTYPE_EBI1, |
| 198 | }; |
Laura Abbott | b93525f | 2012-04-12 09:57:19 -0700 | [diff] [blame] | 199 | static struct platform_device apq8064_android_pmem_adsp_device = { |
Kevin Chan | 13be4e2 | 2011-10-20 11:30:32 -0700 | [diff] [blame] | 200 | .name = "android_pmem", |
| 201 | .id = 2, |
| 202 | .dev = { .platform_data = &android_pmem_adsp_pdata }, |
| 203 | }; |
| 204 | |
| 205 | static struct android_pmem_platform_data android_pmem_audio_pdata = { |
| 206 | .name = "pmem_audio", |
| 207 | .allocator_type = PMEM_ALLOCATORTYPE_BITMAP, |
| 208 | .cached = 0, |
| 209 | .memory_type = MEMTYPE_EBI1, |
| 210 | }; |
| 211 | |
Laura Abbott | b93525f | 2012-04-12 09:57:19 -0700 | [diff] [blame] | 212 | static struct platform_device apq8064_android_pmem_audio_device = { |
Kevin Chan | 13be4e2 | 2011-10-20 11:30:32 -0700 | [diff] [blame] | 213 | .name = "android_pmem", |
| 214 | .id = 4, |
| 215 | .dev = { .platform_data = &android_pmem_audio_pdata }, |
| 216 | }; |
Bharath Ramachandramurthy | 4a3fa91 | 2012-03-13 19:16:24 -0700 | [diff] [blame] | 217 | #endif /* CONFIG_MSM_MULTIMEDIA_USE_ION */ |
| 218 | #endif /* CONFIG_ANDROID_PMEM */ |
Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 219 | |
Larry Bassel | 67b921d | 2012-04-06 10:23:27 -0700 | [diff] [blame] | 220 | struct fmem_platform_data apq8064_fmem_pdata = { |
| 221 | }; |
| 222 | |
Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 223 | static struct memtype_reserve apq8064_reserve_table[] __initdata = { |
| 224 | [MEMTYPE_SMI] = { |
| 225 | }, |
| 226 | [MEMTYPE_EBI0] = { |
| 227 | .flags = MEMTYPE_FLAGS_1M_ALIGN, |
| 228 | }, |
| 229 | [MEMTYPE_EBI1] = { |
| 230 | .flags = MEMTYPE_FLAGS_1M_ALIGN, |
| 231 | }, |
| 232 | }; |
Kevin Chan | 13be4e2 | 2011-10-20 11:30:32 -0700 | [diff] [blame] | 233 | |
Laura Abbott | 350c836 | 2012-02-28 14:46:52 -0800 | [diff] [blame] | 234 | static void __init reserve_rtb_memory(void) |
| 235 | { |
| 236 | #if defined(CONFIG_MSM_RTB) |
Laura Abbott | b93525f | 2012-04-12 09:57:19 -0700 | [diff] [blame] | 237 | apq8064_reserve_table[MEMTYPE_EBI1].size += apq8064_rtb_pdata.size; |
Laura Abbott | 350c836 | 2012-02-28 14:46:52 -0800 | [diff] [blame] | 238 | #endif |
| 239 | } |
| 240 | |
| 241 | |
Kevin Chan | 13be4e2 | 2011-10-20 11:30:32 -0700 | [diff] [blame] | 242 | static void __init size_pmem_devices(void) |
| 243 | { |
Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 244 | #ifdef CONFIG_ANDROID_PMEM |
| 245 | #ifndef CONFIG_MSM_MULTIMEDIA_USE_ION |
Kevin Chan | 13be4e2 | 2011-10-20 11:30:32 -0700 | [diff] [blame] | 246 | android_pmem_adsp_pdata.size = pmem_adsp_size; |
| 247 | android_pmem_pdata.size = pmem_size; |
| 248 | android_pmem_audio_pdata.size = MSM_PMEM_AUDIO_SIZE; |
Bharath Ramachandramurthy | 4a3fa91 | 2012-03-13 19:16:24 -0700 | [diff] [blame] | 249 | #endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/ |
| 250 | #endif /*CONFIG_ANDROID_PMEM*/ |
Kevin Chan | 13be4e2 | 2011-10-20 11:30:32 -0700 | [diff] [blame] | 251 | } |
| 252 | |
Bharath Ramachandramurthy | 4a3fa91 | 2012-03-13 19:16:24 -0700 | [diff] [blame] | 253 | #ifdef CONFIG_ANDROID_PMEM |
| 254 | #ifndef CONFIG_MSM_MULTIMEDIA_USE_ION |
Kevin Chan | 13be4e2 | 2011-10-20 11:30:32 -0700 | [diff] [blame] | 255 | static void __init reserve_memory_for(struct android_pmem_platform_data *p) |
| 256 | { |
| 257 | apq8064_reserve_table[p->memory_type].size += p->size; |
| 258 | } |
Bharath Ramachandramurthy | 4a3fa91 | 2012-03-13 19:16:24 -0700 | [diff] [blame] | 259 | #endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/ |
| 260 | #endif /*CONFIG_ANDROID_PMEM*/ |
Kevin Chan | 13be4e2 | 2011-10-20 11:30:32 -0700 | [diff] [blame] | 261 | |
Kevin Chan | 13be4e2 | 2011-10-20 11:30:32 -0700 | [diff] [blame] | 262 | static void __init reserve_pmem_memory(void) |
| 263 | { |
Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 264 | #ifdef CONFIG_ANDROID_PMEM |
| 265 | #ifndef CONFIG_MSM_MULTIMEDIA_USE_ION |
Kevin Chan | 13be4e2 | 2011-10-20 11:30:32 -0700 | [diff] [blame] | 266 | reserve_memory_for(&android_pmem_adsp_pdata); |
| 267 | reserve_memory_for(&android_pmem_pdata); |
| 268 | reserve_memory_for(&android_pmem_audio_pdata); |
Bharath Ramachandramurthy | 4a3fa91 | 2012-03-13 19:16:24 -0700 | [diff] [blame] | 269 | #endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/ |
Mitchel Humpherys | 05e5881 | 2012-08-13 14:24:13 -0700 | [diff] [blame] | 270 | apq8064_reserve_table[MEMTYPE_EBI1].size += msm_contig_mem_size; |
Bharath Ramachandramurthy | 4a3fa91 | 2012-03-13 19:16:24 -0700 | [diff] [blame] | 271 | #endif /*CONFIG_ANDROID_PMEM*/ |
Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 272 | } |
| 273 | |
| 274 | static int apq8064_paddr_to_memtype(unsigned int paddr) |
| 275 | { |
| 276 | return MEMTYPE_EBI1; |
| 277 | } |
| 278 | |
Steve Muckle | f132c6c | 2012-06-06 18:30:57 -0700 | [diff] [blame] | 279 | #define FMEM_ENABLED 0 |
Larry Bassel | 67b921d | 2012-04-06 10:23:27 -0700 | [diff] [blame] | 280 | |
Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 281 | #ifdef CONFIG_ION_MSM |
| 282 | #ifdef CONFIG_MSM_MULTIMEDIA_USE_ION |
Laura Abbott | b93525f | 2012-04-12 09:57:19 -0700 | [diff] [blame] | 283 | static struct ion_cp_heap_pdata cp_mm_apq8064_ion_pdata = { |
Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 284 | .permission_type = IPT_TYPE_MM_CARVEOUT, |
Olav Haugan | d3d2968 | 2012-01-19 10:57:07 -0800 | [diff] [blame] | 285 | .align = PAGE_SIZE, |
Larry Bassel | 67b921d | 2012-04-06 10:23:27 -0700 | [diff] [blame] | 286 | .reusable = FMEM_ENABLED, |
| 287 | .mem_is_fmem = FMEM_ENABLED, |
| 288 | .fixed_position = FIXED_MIDDLE, |
Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 289 | }; |
| 290 | |
Laura Abbott | b93525f | 2012-04-12 09:57:19 -0700 | [diff] [blame] | 291 | static struct ion_cp_heap_pdata cp_mfc_apq8064_ion_pdata = { |
Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 292 | .permission_type = IPT_TYPE_MFC_SHAREDMEM, |
Olav Haugan | d3d2968 | 2012-01-19 10:57:07 -0800 | [diff] [blame] | 293 | .align = PAGE_SIZE, |
Larry Bassel | 67b921d | 2012-04-06 10:23:27 -0700 | [diff] [blame] | 294 | .reusable = 0, |
| 295 | .mem_is_fmem = FMEM_ENABLED, |
| 296 | .fixed_position = FIXED_HIGH, |
Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 297 | }; |
| 298 | |
Laura Abbott | b93525f | 2012-04-12 09:57:19 -0700 | [diff] [blame] | 299 | static struct ion_co_heap_pdata co_apq8064_ion_pdata = { |
Olav Haugan | d3d2968 | 2012-01-19 10:57:07 -0800 | [diff] [blame] | 300 | .adjacent_mem_id = INVALID_HEAP_ID, |
| 301 | .align = PAGE_SIZE, |
Larry Bassel | 67b921d | 2012-04-06 10:23:27 -0700 | [diff] [blame] | 302 | .mem_is_fmem = 0, |
Olav Haugan | d3d2968 | 2012-01-19 10:57:07 -0800 | [diff] [blame] | 303 | }; |
| 304 | |
Laura Abbott | b93525f | 2012-04-12 09:57:19 -0700 | [diff] [blame] | 305 | static struct ion_co_heap_pdata fw_co_apq8064_ion_pdata = { |
Olav Haugan | d3d2968 | 2012-01-19 10:57:07 -0800 | [diff] [blame] | 306 | .adjacent_mem_id = ION_CP_MM_HEAP_ID, |
| 307 | .align = SZ_128K, |
Larry Bassel | 67b921d | 2012-04-06 10:23:27 -0700 | [diff] [blame] | 308 | .mem_is_fmem = FMEM_ENABLED, |
| 309 | .fixed_position = FIXED_LOW, |
Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 310 | }; |
| 311 | #endif |
Olav Haugan | 9cdfc2f | 2012-02-15 09:52:57 -0800 | [diff] [blame] | 312 | |
| 313 | /** |
| 314 | * These heaps are listed in the order they will be allocated. Due to |
| 315 | * video hardware restrictions and content protection the FW heap has to |
| 316 | * be allocated adjacent (below) the MM heap and the MFC heap has to be |
| 317 | * allocated after the MM heap to ensure MFC heap is not more than 256MB |
| 318 | * away from the base address of the FW heap. |
| 319 | * However, the order of FW heap and MM heap doesn't matter since these |
| 320 | * two heaps are taken care of by separate code to ensure they are adjacent |
| 321 | * to each other. |
| 322 | * Don't swap the order unless you know what you are doing! |
| 323 | */ |
Laura Abbott | b93525f | 2012-04-12 09:57:19 -0700 | [diff] [blame] | 324 | static struct ion_platform_data apq8064_ion_pdata = { |
Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 325 | .nr = MSM_ION_HEAP_NUM, |
| 326 | .heaps = { |
| 327 | { |
| 328 | .id = ION_SYSTEM_HEAP_ID, |
| 329 | .type = ION_HEAP_TYPE_SYSTEM, |
| 330 | .name = ION_VMALLOC_HEAP_NAME, |
| 331 | }, |
| 332 | #ifdef CONFIG_MSM_MULTIMEDIA_USE_ION |
| 333 | { |
Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 334 | .id = ION_CP_MM_HEAP_ID, |
| 335 | .type = ION_HEAP_TYPE_CP, |
| 336 | .name = ION_MM_HEAP_NAME, |
| 337 | .size = MSM_ION_MM_SIZE, |
| 338 | .memory_type = ION_EBI_TYPE, |
Laura Abbott | b93525f | 2012-04-12 09:57:19 -0700 | [diff] [blame] | 339 | .extra_data = (void *) &cp_mm_apq8064_ion_pdata, |
Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 340 | }, |
| 341 | { |
Olav Haugan | d3d2968 | 2012-01-19 10:57:07 -0800 | [diff] [blame] | 342 | .id = ION_MM_FIRMWARE_HEAP_ID, |
| 343 | .type = ION_HEAP_TYPE_CARVEOUT, |
| 344 | .name = ION_MM_FIRMWARE_HEAP_NAME, |
| 345 | .size = MSM_ION_MM_FW_SIZE, |
| 346 | .memory_type = ION_EBI_TYPE, |
Laura Abbott | b93525f | 2012-04-12 09:57:19 -0700 | [diff] [blame] | 347 | .extra_data = (void *) &fw_co_apq8064_ion_pdata, |
Olav Haugan | d3d2968 | 2012-01-19 10:57:07 -0800 | [diff] [blame] | 348 | }, |
| 349 | { |
Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 350 | .id = ION_CP_MFC_HEAP_ID, |
| 351 | .type = ION_HEAP_TYPE_CP, |
| 352 | .name = ION_MFC_HEAP_NAME, |
| 353 | .size = MSM_ION_MFC_SIZE, |
| 354 | .memory_type = ION_EBI_TYPE, |
Laura Abbott | b93525f | 2012-04-12 09:57:19 -0700 | [diff] [blame] | 355 | .extra_data = (void *) &cp_mfc_apq8064_ion_pdata, |
Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 356 | }, |
Olav Haugan | 129992c | 2012-03-22 09:54:01 -0700 | [diff] [blame] | 357 | #ifndef CONFIG_MSM_IOMMU |
Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 358 | { |
Olav Haugan | 9cdfc2f | 2012-02-15 09:52:57 -0800 | [diff] [blame] | 359 | .id = ION_SF_HEAP_ID, |
| 360 | .type = ION_HEAP_TYPE_CARVEOUT, |
| 361 | .name = ION_SF_HEAP_NAME, |
| 362 | .size = MSM_ION_SF_SIZE, |
| 363 | .memory_type = ION_EBI_TYPE, |
Laura Abbott | b93525f | 2012-04-12 09:57:19 -0700 | [diff] [blame] | 364 | .extra_data = (void *) &co_apq8064_ion_pdata, |
Olav Haugan | 9cdfc2f | 2012-02-15 09:52:57 -0800 | [diff] [blame] | 365 | }, |
Olav Haugan | 129992c | 2012-03-22 09:54:01 -0700 | [diff] [blame] | 366 | #endif |
Olav Haugan | 9cdfc2f | 2012-02-15 09:52:57 -0800 | [diff] [blame] | 367 | { |
Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 368 | .id = ION_IOMMU_HEAP_ID, |
| 369 | .type = ION_HEAP_TYPE_IOMMU, |
| 370 | .name = ION_IOMMU_HEAP_NAME, |
| 371 | }, |
Olav Haugan | f45e214 | 2012-01-19 11:01:01 -0800 | [diff] [blame] | 372 | { |
| 373 | .id = ION_QSECOM_HEAP_ID, |
| 374 | .type = ION_HEAP_TYPE_CARVEOUT, |
| 375 | .name = ION_QSECOM_HEAP_NAME, |
| 376 | .size = MSM_ION_QSECOM_SIZE, |
| 377 | .memory_type = ION_EBI_TYPE, |
Laura Abbott | b93525f | 2012-04-12 09:57:19 -0700 | [diff] [blame] | 378 | .extra_data = (void *) &co_apq8064_ion_pdata, |
Olav Haugan | f45e214 | 2012-01-19 11:01:01 -0800 | [diff] [blame] | 379 | }, |
Olav Haugan | 2c43fac | 2012-01-19 11:06:37 -0800 | [diff] [blame] | 380 | { |
| 381 | .id = ION_AUDIO_HEAP_ID, |
| 382 | .type = ION_HEAP_TYPE_CARVEOUT, |
| 383 | .name = ION_AUDIO_HEAP_NAME, |
| 384 | .size = MSM_ION_AUDIO_SIZE, |
| 385 | .memory_type = ION_EBI_TYPE, |
Laura Abbott | b93525f | 2012-04-12 09:57:19 -0700 | [diff] [blame] | 386 | .extra_data = (void *) &co_apq8064_ion_pdata, |
Olav Haugan | 2c43fac | 2012-01-19 11:06:37 -0800 | [diff] [blame] | 387 | }, |
Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 388 | #endif |
| 389 | } |
| 390 | }; |
| 391 | |
Laura Abbott | b93525f | 2012-04-12 09:57:19 -0700 | [diff] [blame] | 392 | static struct platform_device apq8064_ion_dev = { |
Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 393 | .name = "ion-msm", |
| 394 | .id = 1, |
Laura Abbott | b93525f | 2012-04-12 09:57:19 -0700 | [diff] [blame] | 395 | .dev = { .platform_data = &apq8064_ion_pdata }, |
Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 396 | }; |
| 397 | #endif |
| 398 | |
Larry Bassel | 67b921d | 2012-04-06 10:23:27 -0700 | [diff] [blame] | 399 | static struct platform_device apq8064_fmem_device = { |
| 400 | .name = "fmem", |
| 401 | .id = 1, |
| 402 | .dev = { .platform_data = &apq8064_fmem_pdata }, |
| 403 | }; |
| 404 | |
| 405 | static void __init reserve_mem_for_ion(enum ion_memory_types mem_type, |
| 406 | unsigned long size) |
| 407 | { |
| 408 | apq8064_reserve_table[mem_type].size += size; |
| 409 | } |
| 410 | |
| 411 | static void __init apq8064_reserve_fixed_area(unsigned long fixed_area_size) |
| 412 | { |
| 413 | #if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION) |
| 414 | int ret; |
| 415 | |
| 416 | if (fixed_area_size > MAX_FIXED_AREA_SIZE) |
| 417 | panic("fixed area size is larger than %dM\n", |
| 418 | MAX_FIXED_AREA_SIZE >> 20); |
| 419 | |
| 420 | reserve_info->fixed_area_size = fixed_area_size; |
| 421 | reserve_info->fixed_area_start = APQ8064_FW_START; |
| 422 | |
| 423 | ret = memblock_remove(reserve_info->fixed_area_start, |
| 424 | reserve_info->fixed_area_size); |
| 425 | BUG_ON(ret); |
| 426 | #endif |
| 427 | } |
| 428 | |
| 429 | /** |
| 430 | * Reserve memory for ION and calculate amount of reusable memory for fmem. |
| 431 | * We only reserve memory for heaps that are not reusable. However, we only |
| 432 | * support one reusable heap at the moment so we ignore the reusable flag for |
| 433 | * other than the first heap with reusable flag set. Also handle special case |
| 434 | * for video heaps (MM,FW, and MFC). Video requires heaps MM and MFC to be |
| 435 | * at a higher address than FW in addition to not more than 256MB away from the |
| 436 | * base address of the firmware. This means that if MM is reusable the other |
| 437 | * two heaps must be allocated in the same region as FW. This is handled by the |
| 438 | * mem_is_fmem flag in the platform data. In addition the MM heap must be |
| 439 | * adjacent to the FW heap for content protection purposes. |
| 440 | */ |
Stephen Boyd | 668d765 | 2012-04-25 11:31:01 -0700 | [diff] [blame] | 441 | static void __init reserve_ion_memory(void) |
Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 442 | { |
| 443 | #if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION) |
Larry Bassel | 67b921d | 2012-04-06 10:23:27 -0700 | [diff] [blame] | 444 | unsigned int i; |
| 445 | unsigned int reusable_count = 0; |
| 446 | unsigned int fixed_size = 0; |
| 447 | unsigned int fixed_low_size, fixed_middle_size, fixed_high_size; |
| 448 | unsigned long fixed_low_start, fixed_middle_start, fixed_high_start; |
| 449 | |
| 450 | apq8064_fmem_pdata.size = 0; |
| 451 | apq8064_fmem_pdata.reserved_size_low = 0; |
| 452 | apq8064_fmem_pdata.reserved_size_high = 0; |
Olav Haugan | 6243625 | 2012-05-16 09:09:43 -0700 | [diff] [blame] | 453 | apq8064_fmem_pdata.align = PAGE_SIZE; |
Larry Bassel | 67b921d | 2012-04-06 10:23:27 -0700 | [diff] [blame] | 454 | fixed_low_size = 0; |
| 455 | fixed_middle_size = 0; |
| 456 | fixed_high_size = 0; |
| 457 | |
| 458 | /* We only support 1 reusable heap. Check if more than one heap |
| 459 | * is specified as reusable and set as non-reusable if found. |
| 460 | */ |
| 461 | for (i = 0; i < apq8064_ion_pdata.nr; ++i) { |
| 462 | const struct ion_platform_heap *heap = |
| 463 | &(apq8064_ion_pdata.heaps[i]); |
| 464 | |
| 465 | if (heap->type == ION_HEAP_TYPE_CP && heap->extra_data) { |
| 466 | struct ion_cp_heap_pdata *data = heap->extra_data; |
| 467 | |
| 468 | reusable_count += (data->reusable) ? 1 : 0; |
| 469 | |
| 470 | if (data->reusable && reusable_count > 1) { |
| 471 | pr_err("%s: Too many heaps specified as " |
| 472 | "reusable. Heap %s was not configured " |
| 473 | "as reusable.\n", __func__, heap->name); |
| 474 | data->reusable = 0; |
| 475 | } |
| 476 | } |
| 477 | } |
| 478 | |
| 479 | for (i = 0; i < apq8064_ion_pdata.nr; ++i) { |
| 480 | const struct ion_platform_heap *heap = |
| 481 | &(apq8064_ion_pdata.heaps[i]); |
| 482 | |
| 483 | if (heap->extra_data) { |
| 484 | int fixed_position = NOT_FIXED; |
| 485 | int mem_is_fmem = 0; |
| 486 | |
| 487 | switch (heap->type) { |
| 488 | case ION_HEAP_TYPE_CP: |
| 489 | mem_is_fmem = ((struct ion_cp_heap_pdata *) |
| 490 | heap->extra_data)->mem_is_fmem; |
| 491 | fixed_position = ((struct ion_cp_heap_pdata *) |
| 492 | heap->extra_data)->fixed_position; |
| 493 | break; |
| 494 | case ION_HEAP_TYPE_CARVEOUT: |
| 495 | mem_is_fmem = ((struct ion_co_heap_pdata *) |
| 496 | heap->extra_data)->mem_is_fmem; |
| 497 | fixed_position = ((struct ion_co_heap_pdata *) |
| 498 | heap->extra_data)->fixed_position; |
| 499 | break; |
| 500 | default: |
| 501 | break; |
| 502 | } |
| 503 | |
| 504 | if (fixed_position != NOT_FIXED) |
| 505 | fixed_size += heap->size; |
| 506 | else |
| 507 | reserve_mem_for_ion(MEMTYPE_EBI1, heap->size); |
| 508 | |
| 509 | if (fixed_position == FIXED_LOW) |
| 510 | fixed_low_size += heap->size; |
| 511 | else if (fixed_position == FIXED_MIDDLE) |
| 512 | fixed_middle_size += heap->size; |
| 513 | else if (fixed_position == FIXED_HIGH) |
| 514 | fixed_high_size += heap->size; |
| 515 | |
| 516 | if (mem_is_fmem) |
| 517 | apq8064_fmem_pdata.size += heap->size; |
| 518 | } |
| 519 | } |
| 520 | |
| 521 | if (!fixed_size) |
| 522 | return; |
| 523 | |
| 524 | if (apq8064_fmem_pdata.size) { |
Hanumant Singh | eadb750 | 2012-05-15 18:14:04 -0700 | [diff] [blame] | 525 | apq8064_fmem_pdata.reserved_size_low = fixed_low_size + |
| 526 | HOLE_SIZE; |
Larry Bassel | 67b921d | 2012-04-06 10:23:27 -0700 | [diff] [blame] | 527 | apq8064_fmem_pdata.reserved_size_high = fixed_high_size; |
| 528 | } |
| 529 | |
| 530 | /* Since the fixed area may be carved out of lowmem, |
| 531 | * make sure the length is a multiple of 1M. |
| 532 | */ |
Hanumant Singh | eadb750 | 2012-05-15 18:14:04 -0700 | [diff] [blame] | 533 | fixed_size = (fixed_size + HOLE_SIZE + SECTION_SIZE - 1) |
Larry Bassel | 67b921d | 2012-04-06 10:23:27 -0700 | [diff] [blame] | 534 | & SECTION_MASK; |
| 535 | apq8064_reserve_fixed_area(fixed_size); |
| 536 | |
| 537 | fixed_low_start = APQ8064_FIXED_AREA_START; |
Hanumant Singh | eadb750 | 2012-05-15 18:14:04 -0700 | [diff] [blame] | 538 | fixed_middle_start = fixed_low_start + fixed_low_size + HOLE_SIZE; |
Larry Bassel | 67b921d | 2012-04-06 10:23:27 -0700 | [diff] [blame] | 539 | fixed_high_start = fixed_middle_start + fixed_middle_size; |
| 540 | |
| 541 | for (i = 0; i < apq8064_ion_pdata.nr; ++i) { |
| 542 | struct ion_platform_heap *heap = &(apq8064_ion_pdata.heaps[i]); |
| 543 | |
| 544 | if (heap->extra_data) { |
| 545 | int fixed_position = NOT_FIXED; |
Steve Muckle | f132c6c | 2012-06-06 18:30:57 -0700 | [diff] [blame] | 546 | struct ion_cp_heap_pdata *pdata = NULL; |
Larry Bassel | 67b921d | 2012-04-06 10:23:27 -0700 | [diff] [blame] | 547 | |
| 548 | switch (heap->type) { |
| 549 | case ION_HEAP_TYPE_CP: |
Hanumant Singh | eadb750 | 2012-05-15 18:14:04 -0700 | [diff] [blame] | 550 | pdata = |
| 551 | (struct ion_cp_heap_pdata *)heap->extra_data; |
| 552 | fixed_position = pdata->fixed_position; |
Larry Bassel | 67b921d | 2012-04-06 10:23:27 -0700 | [diff] [blame] | 553 | break; |
| 554 | case ION_HEAP_TYPE_CARVEOUT: |
| 555 | fixed_position = ((struct ion_co_heap_pdata *) |
| 556 | heap->extra_data)->fixed_position; |
| 557 | break; |
| 558 | default: |
| 559 | break; |
| 560 | } |
| 561 | |
| 562 | switch (fixed_position) { |
| 563 | case FIXED_LOW: |
| 564 | heap->base = fixed_low_start; |
| 565 | break; |
| 566 | case FIXED_MIDDLE: |
| 567 | heap->base = fixed_middle_start; |
Hanumant Singh | eadb750 | 2012-05-15 18:14:04 -0700 | [diff] [blame] | 568 | pdata->secure_base = fixed_middle_start |
| 569 | - HOLE_SIZE; |
| 570 | pdata->secure_size = HOLE_SIZE + heap->size; |
Larry Bassel | 67b921d | 2012-04-06 10:23:27 -0700 | [diff] [blame] | 571 | break; |
| 572 | case FIXED_HIGH: |
| 573 | heap->base = fixed_high_start; |
| 574 | break; |
| 575 | default: |
| 576 | break; |
| 577 | } |
| 578 | } |
| 579 | } |
Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 580 | #endif |
Kevin Chan | 13be4e2 | 2011-10-20 11:30:32 -0700 | [diff] [blame] | 581 | } |
| 582 | |
Huaibin Yang | 4a084e3 | 2011-12-15 15:25:52 -0800 | [diff] [blame] | 583 | static void __init reserve_mdp_memory(void) |
| 584 | { |
| 585 | apq8064_mdp_writeback(apq8064_reserve_table); |
| 586 | } |
| 587 | |
Laura Abbott | 93a4a35 | 2012-05-25 09:26:35 -0700 | [diff] [blame] | 588 | static void __init reserve_cache_dump_memory(void) |
| 589 | { |
| 590 | #ifdef CONFIG_MSM_CACHE_DUMP |
| 591 | unsigned int total; |
| 592 | |
| 593 | total = apq8064_cache_dump_pdata.l1_size + |
| 594 | apq8064_cache_dump_pdata.l2_size; |
| 595 | apq8064_reserve_table[MEMTYPE_EBI1].size += total; |
| 596 | #endif |
| 597 | } |
| 598 | |
Kevin Chan | 13be4e2 | 2011-10-20 11:30:32 -0700 | [diff] [blame] | 599 | static void __init apq8064_calculate_reserve_sizes(void) |
| 600 | { |
| 601 | size_pmem_devices(); |
| 602 | reserve_pmem_memory(); |
Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 603 | reserve_ion_memory(); |
Huaibin Yang | 4a084e3 | 2011-12-15 15:25:52 -0800 | [diff] [blame] | 604 | reserve_mdp_memory(); |
Laura Abbott | 350c836 | 2012-02-28 14:46:52 -0800 | [diff] [blame] | 605 | reserve_rtb_memory(); |
Laura Abbott | 93a4a35 | 2012-05-25 09:26:35 -0700 | [diff] [blame] | 606 | reserve_cache_dump_memory(); |
Kevin Chan | 13be4e2 | 2011-10-20 11:30:32 -0700 | [diff] [blame] | 607 | } |
| 608 | |
| 609 | static struct reserve_info apq8064_reserve_info __initdata = { |
| 610 | .memtype_reserve_table = apq8064_reserve_table, |
| 611 | .calculate_reserve_sizes = apq8064_calculate_reserve_sizes, |
Larry Bassel | 67b921d | 2012-04-06 10:23:27 -0700 | [diff] [blame] | 612 | .reserve_fixed_area = apq8064_reserve_fixed_area, |
Kevin Chan | 13be4e2 | 2011-10-20 11:30:32 -0700 | [diff] [blame] | 613 | .paddr_to_memtype = apq8064_paddr_to_memtype, |
| 614 | }; |
| 615 | |
| 616 | static int apq8064_memory_bank_size(void) |
| 617 | { |
| 618 | return 1<<29; |
| 619 | } |
| 620 | |
| 621 | static void __init locate_unstable_memory(void) |
| 622 | { |
| 623 | struct membank *mb = &meminfo.bank[meminfo.nr_banks - 1]; |
| 624 | unsigned long bank_size; |
| 625 | unsigned long low, high; |
| 626 | |
| 627 | bank_size = apq8064_memory_bank_size(); |
| 628 | low = meminfo.bank[0].start; |
| 629 | high = mb->start + mb->size; |
Olav Haugan | d76e3a8 | 2012-01-16 16:55:07 -0800 | [diff] [blame] | 630 | |
| 631 | /* Check if 32 bit overflow occured */ |
| 632 | if (high < mb->start) |
Larry Bassel | 67b921d | 2012-04-06 10:23:27 -0700 | [diff] [blame] | 633 | high = -PAGE_SIZE; |
Olav Haugan | d76e3a8 | 2012-01-16 16:55:07 -0800 | [diff] [blame] | 634 | |
Kevin Chan | 13be4e2 | 2011-10-20 11:30:32 -0700 | [diff] [blame] | 635 | low &= ~(bank_size - 1); |
| 636 | |
| 637 | if (high - low <= bank_size) |
Larry Bassel | 67b921d | 2012-04-06 10:23:27 -0700 | [diff] [blame] | 638 | goto no_dmm; |
| 639 | |
| 640 | #ifdef CONFIG_ENABLE_DMM |
Jack Cheung | 46bfffa | 2012-01-19 15:26:24 -0800 | [diff] [blame] | 641 | apq8064_reserve_info.low_unstable_address = mb->start - |
| 642 | MIN_MEMORY_BLOCK_SIZE + mb->size; |
| 643 | apq8064_reserve_info.max_unstable_size = MIN_MEMORY_BLOCK_SIZE; |
| 644 | |
Kevin Chan | 13be4e2 | 2011-10-20 11:30:32 -0700 | [diff] [blame] | 645 | apq8064_reserve_info.bank_size = bank_size; |
| 646 | pr_info("low unstable address %lx max size %lx bank size %lx\n", |
| 647 | apq8064_reserve_info.low_unstable_address, |
| 648 | apq8064_reserve_info.max_unstable_size, |
| 649 | apq8064_reserve_info.bank_size); |
Larry Bassel | 67b921d | 2012-04-06 10:23:27 -0700 | [diff] [blame] | 650 | return; |
| 651 | #endif |
| 652 | no_dmm: |
| 653 | apq8064_reserve_info.low_unstable_address = high; |
| 654 | apq8064_reserve_info.max_unstable_size = 0; |
Kevin Chan | 13be4e2 | 2011-10-20 11:30:32 -0700 | [diff] [blame] | 655 | } |
| 656 | |
Hanumant Singh | 50440d4 | 2012-04-23 19:27:16 -0700 | [diff] [blame] | 657 | static int apq8064_change_memory_power(u64 start, u64 size, |
| 658 | int change_type) |
| 659 | { |
| 660 | return soc_change_memory_power(start, size, change_type); |
| 661 | } |
| 662 | |
Aravind Venkateswaran | 8ac7f41 | 2012-03-16 17:57:30 -0700 | [diff] [blame] | 663 | static char prim_panel_name[PANEL_NAME_MAX_LEN]; |
| 664 | static char ext_panel_name[PANEL_NAME_MAX_LEN]; |
Ajay Singh Parmar | 6b82d2b | 2012-07-19 17:23:26 +0530 | [diff] [blame] | 665 | |
| 666 | static int ext_resolution; |
| 667 | |
Aravind Venkateswaran | 8ac7f41 | 2012-03-16 17:57:30 -0700 | [diff] [blame] | 668 | static int __init prim_display_setup(char *param) |
| 669 | { |
| 670 | if (strnlen(param, PANEL_NAME_MAX_LEN)) |
| 671 | strlcpy(prim_panel_name, param, PANEL_NAME_MAX_LEN); |
| 672 | return 0; |
| 673 | } |
| 674 | early_param("prim_display", prim_display_setup); |
| 675 | |
| 676 | static int __init ext_display_setup(char *param) |
| 677 | { |
| 678 | if (strnlen(param, PANEL_NAME_MAX_LEN)) |
| 679 | strlcpy(ext_panel_name, param, PANEL_NAME_MAX_LEN); |
| 680 | return 0; |
| 681 | } |
| 682 | early_param("ext_display", ext_display_setup); |
| 683 | |
Ajay Singh Parmar | 6b82d2b | 2012-07-19 17:23:26 +0530 | [diff] [blame] | 684 | static int __init hdmi_resulution_setup(char *param) |
| 685 | { |
| 686 | int ret; |
| 687 | ret = kstrtoint(param, 10, &ext_resolution); |
| 688 | return ret; |
| 689 | } |
| 690 | early_param("ext_resolution", hdmi_resulution_setup); |
| 691 | |
Kevin Chan | 13be4e2 | 2011-10-20 11:30:32 -0700 | [diff] [blame] | 692 | static void __init apq8064_reserve(void) |
| 693 | { |
Ajay Singh Parmar | 6b82d2b | 2012-07-19 17:23:26 +0530 | [diff] [blame] | 694 | apq8064_set_display_params(prim_panel_name, ext_panel_name, |
| 695 | ext_resolution); |
Kevin Chan | 13be4e2 | 2011-10-20 11:30:32 -0700 | [diff] [blame] | 696 | msm_reserve(); |
Larry Bassel | 67b921d | 2012-04-06 10:23:27 -0700 | [diff] [blame] | 697 | if (apq8064_fmem_pdata.size) { |
| 698 | #if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION) |
| 699 | if (reserve_info->fixed_area_size) { |
| 700 | apq8064_fmem_pdata.phys = |
| 701 | reserve_info->fixed_area_start + MSM_MM_FW_SIZE; |
| 702 | pr_info("mm fw at %lx (fixed) size %x\n", |
| 703 | reserve_info->fixed_area_start, MSM_MM_FW_SIZE); |
| 704 | pr_info("fmem start %lx (fixed) size %lx\n", |
| 705 | apq8064_fmem_pdata.phys, |
| 706 | apq8064_fmem_pdata.size); |
| 707 | } |
| 708 | #endif |
| 709 | } |
Kevin Chan | 13be4e2 | 2011-10-20 11:30:32 -0700 | [diff] [blame] | 710 | } |
| 711 | |
Laura Abbott | 6988cef | 2012-03-15 14:27:13 -0700 | [diff] [blame] | 712 | static void __init place_movable_zone(void) |
| 713 | { |
Larry Bassel | 67b921d | 2012-04-06 10:23:27 -0700 | [diff] [blame] | 714 | #ifdef CONFIG_ENABLE_DMM |
Laura Abbott | 6988cef | 2012-03-15 14:27:13 -0700 | [diff] [blame] | 715 | movable_reserved_start = apq8064_reserve_info.low_unstable_address; |
| 716 | movable_reserved_size = apq8064_reserve_info.max_unstable_size; |
| 717 | pr_info("movable zone start %lx size %lx\n", |
| 718 | movable_reserved_start, movable_reserved_size); |
Larry Bassel | 67b921d | 2012-04-06 10:23:27 -0700 | [diff] [blame] | 719 | #endif |
Laura Abbott | 6988cef | 2012-03-15 14:27:13 -0700 | [diff] [blame] | 720 | } |
| 721 | |
| 722 | static void __init apq8064_early_reserve(void) |
| 723 | { |
| 724 | reserve_info = &apq8064_reserve_info; |
| 725 | locate_unstable_memory(); |
| 726 | place_movable_zone(); |
| 727 | |
| 728 | } |
Hemant Kumar | a945b47 | 2012-01-25 15:08:06 -0800 | [diff] [blame] | 729 | #ifdef CONFIG_USB_EHCI_MSM_HSIC |
Hemant Kumar | e627597 | 2012-02-29 20:06:21 -0800 | [diff] [blame] | 730 | /* Bandwidth requests (zero) if no vote placed */ |
| 731 | static struct msm_bus_vectors hsic_init_vectors[] = { |
| 732 | { |
| 733 | .src = MSM_BUS_MASTER_SPS, |
| 734 | .dst = MSM_BUS_SLAVE_EBI_CH0, |
| 735 | .ab = 0, |
| 736 | .ib = 0, |
| 737 | }, |
| 738 | { |
| 739 | .src = MSM_BUS_MASTER_SPS, |
| 740 | .dst = MSM_BUS_SLAVE_SPS, |
| 741 | .ab = 0, |
| 742 | .ib = 0, |
| 743 | }, |
| 744 | }; |
| 745 | |
| 746 | /* Bus bandwidth requests in Bytes/sec */ |
| 747 | static struct msm_bus_vectors hsic_max_vectors[] = { |
| 748 | { |
| 749 | .src = MSM_BUS_MASTER_SPS, |
| 750 | .dst = MSM_BUS_SLAVE_EBI_CH0, |
| 751 | .ab = 60000000, /* At least 480Mbps on bus. */ |
| 752 | .ib = 960000000, /* MAX bursts rate */ |
| 753 | }, |
| 754 | { |
| 755 | .src = MSM_BUS_MASTER_SPS, |
| 756 | .dst = MSM_BUS_SLAVE_SPS, |
| 757 | .ab = 0, |
| 758 | .ib = 512000000, /*vote for 64Mhz dfab clk rate*/ |
| 759 | }, |
| 760 | }; |
| 761 | |
| 762 | static struct msm_bus_paths hsic_bus_scale_usecases[] = { |
| 763 | { |
| 764 | ARRAY_SIZE(hsic_init_vectors), |
| 765 | hsic_init_vectors, |
| 766 | }, |
| 767 | { |
| 768 | ARRAY_SIZE(hsic_max_vectors), |
| 769 | hsic_max_vectors, |
| 770 | }, |
| 771 | }; |
| 772 | |
| 773 | static struct msm_bus_scale_pdata hsic_bus_scale_pdata = { |
| 774 | hsic_bus_scale_usecases, |
| 775 | ARRAY_SIZE(hsic_bus_scale_usecases), |
| 776 | .name = "hsic", |
| 777 | }; |
| 778 | |
Hemant Kumar | a945b47 | 2012-01-25 15:08:06 -0800 | [diff] [blame] | 779 | static struct msm_hsic_host_platform_data msm_hsic_pdata = { |
Hemant Kumar | e627597 | 2012-02-29 20:06:21 -0800 | [diff] [blame] | 780 | .strobe = 88, |
| 781 | .data = 89, |
| 782 | .bus_scale_table = &hsic_bus_scale_pdata, |
Hemant Kumar | a945b47 | 2012-01-25 15:08:06 -0800 | [diff] [blame] | 783 | }; |
| 784 | #else |
| 785 | static struct msm_hsic_host_platform_data msm_hsic_pdata; |
| 786 | #endif |
| 787 | |
Hemant Kumar | cb7d8a1 | 2012-01-25 12:25:55 -0800 | [diff] [blame] | 788 | #define PID_MAGIC_ID 0x71432909 |
| 789 | #define SERIAL_NUM_MAGIC_ID 0x61945374 |
| 790 | #define SERIAL_NUMBER_LENGTH 127 |
| 791 | #define DLOAD_USB_BASE_ADD 0x2A03F0C8 |
| 792 | |
| 793 | struct magic_num_struct { |
| 794 | uint32_t pid; |
| 795 | uint32_t serial_num; |
| 796 | }; |
| 797 | |
| 798 | struct dload_struct { |
| 799 | uint32_t reserved1; |
| 800 | uint32_t reserved2; |
| 801 | uint32_t reserved3; |
| 802 | uint16_t reserved4; |
| 803 | uint16_t pid; |
| 804 | char serial_number[SERIAL_NUMBER_LENGTH]; |
| 805 | uint16_t reserved5; |
| 806 | struct magic_num_struct magic_struct; |
| 807 | }; |
| 808 | |
| 809 | static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum) |
| 810 | { |
| 811 | struct dload_struct __iomem *dload = 0; |
| 812 | |
| 813 | dload = ioremap(DLOAD_USB_BASE_ADD, sizeof(*dload)); |
| 814 | if (!dload) { |
| 815 | pr_err("%s: cannot remap I/O memory region: %08x\n", |
| 816 | __func__, DLOAD_USB_BASE_ADD); |
| 817 | return -ENXIO; |
| 818 | } |
| 819 | |
| 820 | pr_debug("%s: dload:%p pid:%x serial_num:%s\n", |
| 821 | __func__, dload, pid, snum); |
| 822 | /* update pid */ |
| 823 | dload->magic_struct.pid = PID_MAGIC_ID; |
| 824 | dload->pid = pid; |
| 825 | |
| 826 | /* update serial number */ |
| 827 | dload->magic_struct.serial_num = 0; |
| 828 | if (!snum) { |
| 829 | memset(dload->serial_number, 0, SERIAL_NUMBER_LENGTH); |
| 830 | goto out; |
| 831 | } |
| 832 | |
| 833 | dload->magic_struct.serial_num = SERIAL_NUM_MAGIC_ID; |
| 834 | strlcpy(dload->serial_number, snum, SERIAL_NUMBER_LENGTH); |
| 835 | out: |
| 836 | iounmap(dload); |
| 837 | return 0; |
| 838 | } |
| 839 | |
| 840 | static struct android_usb_platform_data android_usb_pdata = { |
| 841 | .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num, |
| 842 | }; |
| 843 | |
Hemant Kumar | 4933b07 | 2011-10-17 23:43:11 -0700 | [diff] [blame] | 844 | static struct platform_device android_usb_device = { |
Hemant Kumar | cb7d8a1 | 2012-01-25 12:25:55 -0800 | [diff] [blame] | 845 | .name = "android_usb", |
| 846 | .id = -1, |
| 847 | .dev = { |
| 848 | .platform_data = &android_usb_pdata, |
| 849 | }, |
Hemant Kumar | 4933b07 | 2011-10-17 23:43:11 -0700 | [diff] [blame] | 850 | }; |
| 851 | |
Hemant Kumar | 7620eed | 2012-02-26 09:08:43 -0800 | [diff] [blame] | 852 | /* Bandwidth requests (zero) if no vote placed */ |
| 853 | static struct msm_bus_vectors usb_init_vectors[] = { |
| 854 | { |
| 855 | .src = MSM_BUS_MASTER_SPS, |
| 856 | .dst = MSM_BUS_SLAVE_EBI_CH0, |
| 857 | .ab = 0, |
| 858 | .ib = 0, |
| 859 | }, |
| 860 | }; |
| 861 | |
| 862 | /* Bus bandwidth requests in Bytes/sec */ |
| 863 | static struct msm_bus_vectors usb_max_vectors[] = { |
| 864 | { |
| 865 | .src = MSM_BUS_MASTER_SPS, |
| 866 | .dst = MSM_BUS_SLAVE_EBI_CH0, |
| 867 | .ab = 60000000, /* At least 480Mbps on bus. */ |
| 868 | .ib = 960000000, /* MAX bursts rate */ |
| 869 | }, |
| 870 | }; |
| 871 | |
| 872 | static struct msm_bus_paths usb_bus_scale_usecases[] = { |
| 873 | { |
| 874 | ARRAY_SIZE(usb_init_vectors), |
| 875 | usb_init_vectors, |
| 876 | }, |
| 877 | { |
| 878 | ARRAY_SIZE(usb_max_vectors), |
| 879 | usb_max_vectors, |
| 880 | }, |
| 881 | }; |
| 882 | |
| 883 | static struct msm_bus_scale_pdata usb_bus_scale_pdata = { |
| 884 | usb_bus_scale_usecases, |
| 885 | ARRAY_SIZE(usb_bus_scale_usecases), |
| 886 | .name = "usb", |
| 887 | }; |
| 888 | |
Vamsi Krishna | 1f8704c | 2012-03-29 18:24:24 -0700 | [diff] [blame] | 889 | static int phy_init_seq[] = { |
Chiranjeevi Velempati | f983aeb | 2012-08-23 08:16:50 +0530 | [diff] [blame] | 890 | 0x68, 0x81, /* update DC voltage level */ |
Vamsi Krishna | 1f8704c | 2012-03-29 18:24:24 -0700 | [diff] [blame] | 891 | 0x24, 0x82, /* set pre-emphasis and rise/fall time */ |
| 892 | -1 |
| 893 | }; |
| 894 | |
Vijayavardhan Vennapusa | 4fa1369 | 2012-08-02 14:35:03 +0530 | [diff] [blame] | 895 | #define PMIC_GPIO_DP 27 /* PMIC GPIO for D+ change */ |
| 896 | #define PMIC_GPIO_DP_IRQ PM8921_GPIO_IRQ(PM8921_IRQ_BASE, PMIC_GPIO_DP) |
Jack Pham | 87f202f | 2012-08-06 00:24:22 -0700 | [diff] [blame] | 897 | #define MSM_MPM_PIN_USB1_OTGSESSVLD 40 |
| 898 | |
Hemant Kumar | 4933b07 | 2011-10-17 23:43:11 -0700 | [diff] [blame] | 899 | static struct msm_otg_platform_data msm_otg_pdata = { |
Hemant Kumar | d86c488 | 2012-01-24 19:39:37 -0800 | [diff] [blame] | 900 | .mode = USB_OTG, |
| 901 | .otg_control = OTG_PMIC_CONTROL, |
Hemant Kumar | 4933b07 | 2011-10-17 23:43:11 -0700 | [diff] [blame] | 902 | .phy_type = SNPS_28NM_INTEGRATED_PHY, |
Hemant Kumar | d86c488 | 2012-01-24 19:39:37 -0800 | [diff] [blame] | 903 | .pmic_id_irq = PM8921_USB_ID_IN_IRQ(PM8921_IRQ_BASE), |
| 904 | .power_budget = 750, |
Hemant Kumar | 7620eed | 2012-02-26 09:08:43 -0800 | [diff] [blame] | 905 | .bus_scale_table = &usb_bus_scale_pdata, |
Vamsi Krishna | 1f8704c | 2012-03-29 18:24:24 -0700 | [diff] [blame] | 906 | .phy_init_seq = phy_init_seq, |
Jack Pham | 87f202f | 2012-08-06 00:24:22 -0700 | [diff] [blame] | 907 | .mpm_otgsessvld_int = MSM_MPM_PIN_USB1_OTGSESSVLD, |
Hemant Kumar | 4933b07 | 2011-10-17 23:43:11 -0700 | [diff] [blame] | 908 | }; |
| 909 | |
Hemant Kumar | 1d66e1c | 2012-02-13 15:24:59 -0800 | [diff] [blame] | 910 | static struct msm_usb_host_platform_data msm_ehci_host_pdata3 = { |
Manu Gautam | 91223e0 | 2011-11-08 15:27:22 +0530 | [diff] [blame] | 911 | .power_budget = 500, |
| 912 | }; |
| 913 | |
Hemant Kumar | 1d66e1c | 2012-02-13 15:24:59 -0800 | [diff] [blame] | 914 | #ifdef CONFIG_USB_EHCI_MSM_HOST4 |
| 915 | static struct msm_usb_host_platform_data msm_ehci_host_pdata4; |
| 916 | #endif |
| 917 | |
Manu Gautam | 91223e0 | 2011-11-08 15:27:22 +0530 | [diff] [blame] | 918 | static void __init apq8064_ehci_host_init(void) |
| 919 | { |
Chiranjeevi Velempati | b822fa3 | 2012-05-23 22:05:59 +0530 | [diff] [blame] | 920 | if (machine_is_apq8064_liquid() || machine_is_mpq8064_cdp() || |
| 921 | machine_is_mpq8064_hrd() || machine_is_mpq8064_dtv()) { |
| 922 | if (machine_is_apq8064_liquid()) |
| 923 | msm_ehci_host_pdata3.dock_connect_irq = |
| 924 | PM8921_MPP_IRQ(PM8921_IRQ_BASE, 9); |
Vijayavardhan Vennapusa | 4fa1369 | 2012-08-02 14:35:03 +0530 | [diff] [blame] | 925 | else |
| 926 | msm_ehci_host_pdata3.pmic_gpio_dp_irq = |
| 927 | PMIC_GPIO_DP_IRQ; |
Hemant Kumar | 5692535 | 2012-02-13 16:59:52 -0800 | [diff] [blame] | 928 | |
Manu Gautam | 91223e0 | 2011-11-08 15:27:22 +0530 | [diff] [blame] | 929 | apq8064_device_ehci_host3.dev.platform_data = |
Hemant Kumar | 1d66e1c | 2012-02-13 15:24:59 -0800 | [diff] [blame] | 930 | &msm_ehci_host_pdata3; |
Manu Gautam | 91223e0 | 2011-11-08 15:27:22 +0530 | [diff] [blame] | 931 | platform_device_register(&apq8064_device_ehci_host3); |
Hemant Kumar | 1d66e1c | 2012-02-13 15:24:59 -0800 | [diff] [blame] | 932 | |
| 933 | #ifdef CONFIG_USB_EHCI_MSM_HOST4 |
| 934 | apq8064_device_ehci_host4.dev.platform_data = |
| 935 | &msm_ehci_host_pdata4; |
| 936 | platform_device_register(&apq8064_device_ehci_host4); |
| 937 | #endif |
Manu Gautam | 91223e0 | 2011-11-08 15:27:22 +0530 | [diff] [blame] | 938 | } |
| 939 | } |
| 940 | |
David Keitel | 2f613d9 | 2012-02-15 11:29:16 -0800 | [diff] [blame] | 941 | static struct smb349_platform_data smb349_data __initdata = { |
| 942 | .en_n_gpio = PM8921_GPIO_PM_TO_SYS(37), |
| 943 | .chg_susp_gpio = PM8921_GPIO_PM_TO_SYS(30), |
| 944 | .chg_current_ma = 2200, |
| 945 | }; |
| 946 | |
| 947 | static struct i2c_board_info smb349_charger_i2c_info[] __initdata = { |
| 948 | { |
| 949 | I2C_BOARD_INFO(SMB349_NAME, 0x1B), |
| 950 | .platform_data = &smb349_data, |
| 951 | }, |
| 952 | }; |
| 953 | |
Siddartha Mohanadoss | b9df494 | 2012-02-08 09:58:21 -0800 | [diff] [blame] | 954 | struct sx150x_platform_data apq8064_sx150x_data[] = { |
| 955 | [SX150X_EPM] = { |
| 956 | .gpio_base = GPIO_EPM_EXPANDER_BASE, |
| 957 | .oscio_is_gpo = false, |
| 958 | .io_pullup_ena = 0x0, |
| 959 | .io_pulldn_ena = 0x0, |
| 960 | .io_open_drain_ena = 0x0, |
| 961 | .io_polarity = 0, |
| 962 | .irq_summary = -1, |
| 963 | }, |
| 964 | }; |
| 965 | |
| 966 | static struct epm_chan_properties ads_adc_channel_data[] = { |
| 967 | {10, 100}, {500, 50}, {1, 1}, {1, 1}, |
| 968 | {20, 50}, {10, 100}, {1, 1}, {1, 1}, |
| 969 | {10, 100}, {10, 100}, {100, 100}, {200, 100}, |
| 970 | {100, 50}, {2000, 50}, {1000, 50}, {200, 50}, |
| 971 | {200, 100}, {1, 1}, {20, 50}, {500, 50}, |
| 972 | {50, 50}, {200, 100}, {500, 100}, {20, 50}, |
| 973 | {200, 50}, {2000, 100}, {1000, 50}, {100, 50}, |
| 974 | {200, 100}, {500, 50}, {1000, 100}, {200, 50}, |
| 975 | {1000, 50}, {50, 50}, {100, 50}, {100, 50}, |
| 976 | {1, 1}, {1, 1}, {20, 100}, {20, 50}, |
| 977 | {500, 100}, {1000, 100}, {100, 50}, {1000, 50}, |
| 978 | {100, 50}, {1000, 100}, {100, 50}, {100, 50}, |
| 979 | }; |
| 980 | |
| 981 | static struct epm_adc_platform_data epm_adc_pdata = { |
| 982 | .channel = ads_adc_channel_data, |
| 983 | .bus_id = 0x0, |
| 984 | .epm_i2c_board_info = { |
| 985 | .type = "sx1509q", |
| 986 | .addr = 0x3e, |
| 987 | .platform_data = &apq8064_sx150x_data[SX150X_EPM], |
| 988 | }, |
| 989 | .gpio_expander_base_addr = GPIO_EPM_EXPANDER_BASE, |
| 990 | }; |
| 991 | |
| 992 | static struct platform_device epm_adc_device = { |
| 993 | .name = "epm_adc", |
| 994 | .id = -1, |
| 995 | .dev = { |
| 996 | .platform_data = &epm_adc_pdata, |
| 997 | }, |
| 998 | }; |
| 999 | |
| 1000 | static void __init apq8064_epm_adc_init(void) |
| 1001 | { |
| 1002 | epm_adc_pdata.num_channels = 32; |
| 1003 | epm_adc_pdata.num_adc = 2; |
| 1004 | epm_adc_pdata.chan_per_adc = 16; |
| 1005 | epm_adc_pdata.chan_per_mux = 8; |
| 1006 | }; |
| 1007 | |
Swaminathan Sathappan | 2f51a75 | 2011-12-05 12:51:19 -0800 | [diff] [blame] | 1008 | /* Micbias setting is based on 8660 CDP/MTP/FLUID requirement |
| 1009 | * 4 micbiases are used to power various analog and digital |
| 1010 | * microphones operating at 1800 mV. Technically, all micbiases |
| 1011 | * can source from single cfilter since all microphones operate |
| 1012 | * at the same voltage level. The arrangement below is to make |
| 1013 | * sure all cfilters are exercised. LDO_H regulator ouput level |
| 1014 | * does not need to be as high as 2.85V. It is choosen for |
| 1015 | * microphone sensitivity purpose. |
| 1016 | */ |
Asish Bhattacharya | b1aeae2 | 2012-02-15 08:29:28 +0530 | [diff] [blame] | 1017 | static struct wcd9xxx_pdata apq8064_tabla_platform_data = { |
Swaminathan Sathappan | 2f51a75 | 2011-12-05 12:51:19 -0800 | [diff] [blame] | 1018 | .slimbus_slave_device = { |
| 1019 | .name = "tabla-slave", |
| 1020 | .e_addr = {0, 0, 0x10, 0, 0x17, 2}, |
| 1021 | }, |
Swaminathan Sathappan | cef966d | 2011-12-15 17:27:04 -0800 | [diff] [blame] | 1022 | .irq = MSM_GPIO_TO_INT(42), |
Swaminathan Sathappan | 2f51a75 | 2011-12-05 12:51:19 -0800 | [diff] [blame] | 1023 | .irq_base = TABLA_INTERRUPT_BASE, |
Asish Bhattacharya | b1aeae2 | 2012-02-15 08:29:28 +0530 | [diff] [blame] | 1024 | .num_irqs = NR_WCD9XXX_IRQS, |
Swaminathan Sathappan | 2f51a75 | 2011-12-05 12:51:19 -0800 | [diff] [blame] | 1025 | .reset_gpio = PM8921_GPIO_PM_TO_SYS(34), |
| 1026 | .micbias = { |
| 1027 | .ldoh_v = TABLA_LDOH_2P85_V, |
| 1028 | .cfilt1_mv = 1800, |
Bhalchandra Gajare | 975c53a | 2012-08-10 12:16:49 -0700 | [diff] [blame] | 1029 | .cfilt2_mv = 2700, |
Swaminathan Sathappan | 2f51a75 | 2011-12-05 12:51:19 -0800 | [diff] [blame] | 1030 | .cfilt3_mv = 1800, |
| 1031 | .bias1_cfilt_sel = TABLA_CFILT1_SEL, |
| 1032 | .bias2_cfilt_sel = TABLA_CFILT2_SEL, |
| 1033 | .bias3_cfilt_sel = TABLA_CFILT3_SEL, |
| 1034 | .bias4_cfilt_sel = TABLA_CFILT3_SEL, |
Asish Bhattacharya | b1aeae2 | 2012-02-15 08:29:28 +0530 | [diff] [blame] | 1035 | }, |
| 1036 | .regulator = { |
| 1037 | { |
| 1038 | .name = "CDC_VDD_CP", |
| 1039 | .min_uV = 1800000, |
| 1040 | .max_uV = 1800000, |
| 1041 | .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX, |
| 1042 | }, |
| 1043 | { |
| 1044 | .name = "CDC_VDDA_RX", |
| 1045 | .min_uV = 1800000, |
| 1046 | .max_uV = 1800000, |
| 1047 | .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX, |
| 1048 | }, |
| 1049 | { |
| 1050 | .name = "CDC_VDDA_TX", |
| 1051 | .min_uV = 1800000, |
| 1052 | .max_uV = 1800000, |
| 1053 | .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX, |
| 1054 | }, |
| 1055 | { |
| 1056 | .name = "VDDIO_CDC", |
| 1057 | .min_uV = 1800000, |
| 1058 | .max_uV = 1800000, |
| 1059 | .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX, |
| 1060 | }, |
| 1061 | { |
| 1062 | .name = "VDDD_CDC_D", |
| 1063 | .min_uV = 1225000, |
David Collins | 62debe8 | 2012-06-06 17:01:03 -0700 | [diff] [blame] | 1064 | .max_uV = 1250000, |
Asish Bhattacharya | b1aeae2 | 2012-02-15 08:29:28 +0530 | [diff] [blame] | 1065 | .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX, |
| 1066 | }, |
| 1067 | { |
| 1068 | .name = "CDC_VDDA_A_1P2V", |
| 1069 | .min_uV = 1225000, |
David Collins | 62debe8 | 2012-06-06 17:01:03 -0700 | [diff] [blame] | 1070 | .max_uV = 1250000, |
Asish Bhattacharya | b1aeae2 | 2012-02-15 08:29:28 +0530 | [diff] [blame] | 1071 | .optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX, |
| 1072 | }, |
| 1073 | }, |
Swaminathan Sathappan | 2f51a75 | 2011-12-05 12:51:19 -0800 | [diff] [blame] | 1074 | }; |
| 1075 | |
| 1076 | static struct slim_device apq8064_slim_tabla = { |
| 1077 | .name = "tabla-slim", |
| 1078 | .e_addr = {0, 1, 0x10, 0, 0x17, 2}, |
| 1079 | .dev = { |
| 1080 | .platform_data = &apq8064_tabla_platform_data, |
| 1081 | }, |
| 1082 | }; |
| 1083 | |
Asish Bhattacharya | b1aeae2 | 2012-02-15 08:29:28 +0530 | [diff] [blame] | 1084 | static struct wcd9xxx_pdata apq8064_tabla20_platform_data = { |
Swaminathan Sathappan | cef966d | 2011-12-15 17:27:04 -0800 | [diff] [blame] | 1085 | .slimbus_slave_device = { |
| 1086 | .name = "tabla-slave", |
| 1087 | .e_addr = {0, 0, 0x60, 0, 0x17, 2}, |
| 1088 | }, |
| 1089 | .irq = MSM_GPIO_TO_INT(42), |
| 1090 | .irq_base = TABLA_INTERRUPT_BASE, |
Asish Bhattacharya | b1aeae2 | 2012-02-15 08:29:28 +0530 | [diff] [blame] | 1091 | .num_irqs = NR_WCD9XXX_IRQS, |
Swaminathan Sathappan | cef966d | 2011-12-15 17:27:04 -0800 | [diff] [blame] | 1092 | .reset_gpio = PM8921_GPIO_PM_TO_SYS(34), |
| 1093 | .micbias = { |
| 1094 | .ldoh_v = TABLA_LDOH_2P85_V, |
| 1095 | .cfilt1_mv = 1800, |
Bhalchandra Gajare | 975c53a | 2012-08-10 12:16:49 -0700 | [diff] [blame] | 1096 | .cfilt2_mv = 2700, |
Swaminathan Sathappan | cef966d | 2011-12-15 17:27:04 -0800 | [diff] [blame] | 1097 | .cfilt3_mv = 1800, |
| 1098 | .bias1_cfilt_sel = TABLA_CFILT1_SEL, |
| 1099 | .bias2_cfilt_sel = TABLA_CFILT2_SEL, |
| 1100 | .bias3_cfilt_sel = TABLA_CFILT3_SEL, |
| 1101 | .bias4_cfilt_sel = TABLA_CFILT3_SEL, |
Asish Bhattacharya | b1aeae2 | 2012-02-15 08:29:28 +0530 | [diff] [blame] | 1102 | }, |
| 1103 | .regulator = { |
| 1104 | { |
| 1105 | .name = "CDC_VDD_CP", |
| 1106 | .min_uV = 1800000, |
| 1107 | .max_uV = 1800000, |
| 1108 | .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX, |
| 1109 | }, |
| 1110 | { |
| 1111 | .name = "CDC_VDDA_RX", |
| 1112 | .min_uV = 1800000, |
| 1113 | .max_uV = 1800000, |
| 1114 | .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX, |
| 1115 | }, |
| 1116 | { |
| 1117 | .name = "CDC_VDDA_TX", |
| 1118 | .min_uV = 1800000, |
| 1119 | .max_uV = 1800000, |
| 1120 | .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX, |
| 1121 | }, |
| 1122 | { |
| 1123 | .name = "VDDIO_CDC", |
| 1124 | .min_uV = 1800000, |
| 1125 | .max_uV = 1800000, |
| 1126 | .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX, |
| 1127 | }, |
| 1128 | { |
| 1129 | .name = "VDDD_CDC_D", |
| 1130 | .min_uV = 1225000, |
David Collins | 62debe8 | 2012-06-06 17:01:03 -0700 | [diff] [blame] | 1131 | .max_uV = 1250000, |
Asish Bhattacharya | b1aeae2 | 2012-02-15 08:29:28 +0530 | [diff] [blame] | 1132 | .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX, |
| 1133 | }, |
| 1134 | { |
| 1135 | .name = "CDC_VDDA_A_1P2V", |
| 1136 | .min_uV = 1225000, |
David Collins | 62debe8 | 2012-06-06 17:01:03 -0700 | [diff] [blame] | 1137 | .max_uV = 1250000, |
Asish Bhattacharya | b1aeae2 | 2012-02-15 08:29:28 +0530 | [diff] [blame] | 1138 | .optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX, |
| 1139 | }, |
| 1140 | }, |
Swaminathan Sathappan | cef966d | 2011-12-15 17:27:04 -0800 | [diff] [blame] | 1141 | }; |
| 1142 | |
| 1143 | static struct slim_device apq8064_slim_tabla20 = { |
| 1144 | .name = "tabla2x-slim", |
| 1145 | .e_addr = {0, 1, 0x60, 0, 0x17, 2}, |
| 1146 | .dev = { |
| 1147 | .platform_data = &apq8064_tabla20_platform_data, |
| 1148 | }, |
| 1149 | }; |
| 1150 | |
Kuirong Wang | f8c5e14 | 2012-06-21 16:17:32 -0700 | [diff] [blame] | 1151 | static struct wcd9xxx_pdata apq8064_tabla_i2c_platform_data = { |
| 1152 | .irq = MSM_GPIO_TO_INT(77), |
| 1153 | .irq_base = TABLA_INTERRUPT_BASE, |
| 1154 | .num_irqs = NR_WCD9XXX_IRQS, |
| 1155 | .reset_gpio = PM8921_GPIO_PM_TO_SYS(34), |
| 1156 | .micbias = { |
| 1157 | .ldoh_v = TABLA_LDOH_2P85_V, |
| 1158 | .cfilt1_mv = 1800, |
| 1159 | .cfilt2_mv = 1800, |
| 1160 | .cfilt3_mv = 1800, |
| 1161 | .bias1_cfilt_sel = TABLA_CFILT1_SEL, |
| 1162 | .bias2_cfilt_sel = TABLA_CFILT2_SEL, |
| 1163 | .bias3_cfilt_sel = TABLA_CFILT3_SEL, |
| 1164 | .bias4_cfilt_sel = TABLA_CFILT3_SEL, |
| 1165 | }, |
| 1166 | .regulator = { |
| 1167 | { |
| 1168 | .name = "CDC_VDD_CP", |
| 1169 | .min_uV = 1800000, |
| 1170 | .max_uV = 1800000, |
| 1171 | .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX, |
| 1172 | }, |
| 1173 | { |
| 1174 | .name = "CDC_VDDA_RX", |
| 1175 | .min_uV = 1800000, |
| 1176 | .max_uV = 1800000, |
| 1177 | .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX, |
| 1178 | }, |
| 1179 | { |
| 1180 | .name = "CDC_VDDA_TX", |
| 1181 | .min_uV = 1800000, |
| 1182 | .max_uV = 1800000, |
| 1183 | .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX, |
| 1184 | }, |
| 1185 | { |
| 1186 | .name = "VDDIO_CDC", |
| 1187 | .min_uV = 1800000, |
| 1188 | .max_uV = 1800000, |
| 1189 | .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX, |
| 1190 | }, |
| 1191 | { |
| 1192 | .name = "VDDD_CDC_D", |
| 1193 | .min_uV = 1225000, |
| 1194 | .max_uV = 1250000, |
| 1195 | .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX, |
| 1196 | }, |
| 1197 | { |
| 1198 | .name = "CDC_VDDA_A_1P2V", |
| 1199 | .min_uV = 1225000, |
| 1200 | .max_uV = 1250000, |
| 1201 | .optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX, |
| 1202 | }, |
| 1203 | }, |
| 1204 | }; |
| 1205 | |
| 1206 | static struct i2c_board_info apq8064_tabla_i2c_device_info[] __initdata = { |
| 1207 | { |
| 1208 | I2C_BOARD_INFO("tabla top level", |
| 1209 | APQ_8064_TABLA_I2C_SLAVE_ADDR), |
| 1210 | .platform_data = &apq8064_tabla_i2c_platform_data, |
| 1211 | }, |
| 1212 | { |
| 1213 | I2C_BOARD_INFO("tabla analog", |
| 1214 | APQ_8064_TABLA_ANALOG_I2C_SLAVE_ADDR), |
| 1215 | .platform_data = &apq8064_tabla_i2c_platform_data, |
| 1216 | }, |
| 1217 | { |
| 1218 | I2C_BOARD_INFO("tabla digital1", |
| 1219 | APQ_8064_TABLA_DIGITAL1_I2C_SLAVE_ADDR), |
| 1220 | .platform_data = &apq8064_tabla_i2c_platform_data, |
| 1221 | }, |
| 1222 | { |
| 1223 | I2C_BOARD_INFO("tabla digital2", |
| 1224 | APQ_8064_TABLA_DIGITAL2_I2C_SLAVE_ADDR), |
| 1225 | .platform_data = &apq8064_tabla_i2c_platform_data, |
| 1226 | }, |
| 1227 | }; |
| 1228 | |
Santosh Mardi | 695be0d | 2012-04-10 23:21:12 +0530 | [diff] [blame] | 1229 | /* enable the level shifter for cs8427 to make sure the I2C |
| 1230 | * clock is running at 100KHz and voltage levels are at 3.3 |
| 1231 | * and 5 volts |
| 1232 | */ |
| 1233 | static int enable_100KHz_ls(int enable) |
| 1234 | { |
| 1235 | int ret = 0; |
| 1236 | if (enable) { |
| 1237 | ret = gpio_request(SX150X_GPIO(1, 10), |
| 1238 | "cs8427_100KHZ_ENABLE"); |
| 1239 | if (ret) { |
| 1240 | pr_err("%s: Failed to request gpio %d\n", __func__, |
| 1241 | SX150X_GPIO(1, 10)); |
| 1242 | return ret; |
| 1243 | } |
| 1244 | gpio_direction_output(SX150X_GPIO(1, 10), 1); |
Santosh Mardi | 3896ed3 | 2012-08-31 19:26:54 +0530 | [diff] [blame] | 1245 | } else { |
| 1246 | gpio_direction_output(SX150X_GPIO(1, 10), 0); |
Santosh Mardi | 695be0d | 2012-04-10 23:21:12 +0530 | [diff] [blame] | 1247 | gpio_free(SX150X_GPIO(1, 10)); |
Santosh Mardi | 3896ed3 | 2012-08-31 19:26:54 +0530 | [diff] [blame] | 1248 | } |
Santosh Mardi | 695be0d | 2012-04-10 23:21:12 +0530 | [diff] [blame] | 1249 | return ret; |
| 1250 | } |
| 1251 | |
Santosh Mardi | eff9a74 | 2012-04-09 23:23:39 +0530 | [diff] [blame] | 1252 | static struct cs8427_platform_data cs8427_i2c_platform_data = { |
| 1253 | .irq = SX150X_GPIO(1, 4), |
| 1254 | .reset_gpio = SX150X_GPIO(1, 6), |
Santosh Mardi | 695be0d | 2012-04-10 23:21:12 +0530 | [diff] [blame] | 1255 | .enable = enable_100KHz_ls, |
Santosh Mardi | eff9a74 | 2012-04-09 23:23:39 +0530 | [diff] [blame] | 1256 | }; |
| 1257 | |
| 1258 | static struct i2c_board_info cs8427_device_info[] __initdata = { |
| 1259 | { |
| 1260 | I2C_BOARD_INFO("cs8427", CS8427_ADDR4), |
| 1261 | .platform_data = &cs8427_i2c_platform_data, |
| 1262 | }, |
| 1263 | }; |
| 1264 | |
Amy Maloche | 70090f99 | 2012-02-16 16:35:26 -0800 | [diff] [blame] | 1265 | #define HAP_SHIFT_LVL_OE_GPIO PM8921_MPP_PM_TO_SYS(8) |
| 1266 | #define ISA1200_HAP_EN_GPIO PM8921_GPIO_PM_TO_SYS(33) |
| 1267 | #define ISA1200_HAP_LEN_GPIO PM8921_GPIO_PM_TO_SYS(20) |
David Collins | d49a1c5 | 2012-08-22 13:18:06 -0700 | [diff] [blame] | 1268 | #define ISA1200_HAP_CLK_PM8921 PM8921_GPIO_PM_TO_SYS(44) |
| 1269 | #define ISA1200_HAP_CLK_PM8917 PM8921_GPIO_PM_TO_SYS(38) |
Amy Maloche | 70090f99 | 2012-02-16 16:35:26 -0800 | [diff] [blame] | 1270 | |
Mohan Pallaka | 2d87760 | 2012-05-11 13:07:30 +0530 | [diff] [blame] | 1271 | static int isa1200_clk_enable(bool on) |
Amy Maloche | 70090f99 | 2012-02-16 16:35:26 -0800 | [diff] [blame] | 1272 | { |
David Collins | d49a1c5 | 2012-08-22 13:18:06 -0700 | [diff] [blame] | 1273 | unsigned int gpio = ISA1200_HAP_CLK_PM8921; |
Amy Maloche | 8f97389 | 2012-03-26 14:53:13 -0700 | [diff] [blame] | 1274 | int rc = 0; |
| 1275 | |
David Collins | d49a1c5 | 2012-08-22 13:18:06 -0700 | [diff] [blame] | 1276 | if (socinfo_get_pmic_model() == PMIC_MODEL_PM8917) |
| 1277 | gpio = ISA1200_HAP_CLK_PM8917; |
| 1278 | |
| 1279 | gpio_set_value_cansleep(gpio, on); |
Amy Maloche | 70090f99 | 2012-02-16 16:35:26 -0800 | [diff] [blame] | 1280 | |
Mohan Pallaka | 2d87760 | 2012-05-11 13:07:30 +0530 | [diff] [blame] | 1281 | if (on) { |
Amy Maloche | 8f97389 | 2012-03-26 14:53:13 -0700 | [diff] [blame] | 1282 | rc = pm8xxx_aux_clk_control(CLK_MP3_2, XO_DIV_1, true); |
Mohan Pallaka | 2d87760 | 2012-05-11 13:07:30 +0530 | [diff] [blame] | 1283 | if (rc) { |
| 1284 | pr_err("%s: unable to write aux clock register(%d)\n", |
| 1285 | __func__, rc); |
| 1286 | goto err_gpio_dis; |
| 1287 | } |
| 1288 | } else { |
Amy Maloche | 8f97389 | 2012-03-26 14:53:13 -0700 | [diff] [blame] | 1289 | rc = pm8xxx_aux_clk_control(CLK_MP3_2, XO_DIV_NONE, true); |
Mohan Pallaka | 2d87760 | 2012-05-11 13:07:30 +0530 | [diff] [blame] | 1290 | if (rc) |
| 1291 | pr_err("%s: unable to write aux clock register(%d)\n", |
| 1292 | __func__, rc); |
Amy Maloche | 8f97389 | 2012-03-26 14:53:13 -0700 | [diff] [blame] | 1293 | } |
| 1294 | |
| 1295 | return rc; |
Mohan Pallaka | 2d87760 | 2012-05-11 13:07:30 +0530 | [diff] [blame] | 1296 | |
| 1297 | err_gpio_dis: |
David Collins | d49a1c5 | 2012-08-22 13:18:06 -0700 | [diff] [blame] | 1298 | gpio_set_value_cansleep(gpio, !on); |
Mohan Pallaka | 2d87760 | 2012-05-11 13:07:30 +0530 | [diff] [blame] | 1299 | return rc; |
Amy Maloche | 70090f99 | 2012-02-16 16:35:26 -0800 | [diff] [blame] | 1300 | } |
| 1301 | |
| 1302 | static int isa1200_dev_setup(bool enable) |
| 1303 | { |
David Collins | d49a1c5 | 2012-08-22 13:18:06 -0700 | [diff] [blame] | 1304 | unsigned int gpio = ISA1200_HAP_CLK_PM8921; |
Amy Maloche | 70090f99 | 2012-02-16 16:35:26 -0800 | [diff] [blame] | 1305 | int rc = 0; |
| 1306 | |
David Collins | d49a1c5 | 2012-08-22 13:18:06 -0700 | [diff] [blame] | 1307 | if (socinfo_get_pmic_model() == PMIC_MODEL_PM8917) |
| 1308 | gpio = ISA1200_HAP_CLK_PM8917; |
| 1309 | |
Amy Maloche | 70090f99 | 2012-02-16 16:35:26 -0800 | [diff] [blame] | 1310 | if (!enable) |
| 1311 | goto free_gpio; |
| 1312 | |
David Collins | d49a1c5 | 2012-08-22 13:18:06 -0700 | [diff] [blame] | 1313 | rc = gpio_request(gpio, "haptics_clk"); |
Amy Maloche | 70090f99 | 2012-02-16 16:35:26 -0800 | [diff] [blame] | 1314 | if (rc) { |
| 1315 | pr_err("%s: unable to request gpio %d config(%d)\n", |
David Collins | d49a1c5 | 2012-08-22 13:18:06 -0700 | [diff] [blame] | 1316 | __func__, gpio, rc); |
Amy Maloche | 70090f99 | 2012-02-16 16:35:26 -0800 | [diff] [blame] | 1317 | return rc; |
| 1318 | } |
| 1319 | |
David Collins | d49a1c5 | 2012-08-22 13:18:06 -0700 | [diff] [blame] | 1320 | rc = gpio_direction_output(gpio, 0); |
Amy Maloche | 70090f99 | 2012-02-16 16:35:26 -0800 | [diff] [blame] | 1321 | if (rc) { |
| 1322 | pr_err("%s: unable to set direction\n", __func__); |
| 1323 | goto free_gpio; |
| 1324 | } |
| 1325 | |
| 1326 | return 0; |
| 1327 | |
| 1328 | free_gpio: |
David Collins | d49a1c5 | 2012-08-22 13:18:06 -0700 | [diff] [blame] | 1329 | gpio_free(gpio); |
Amy Maloche | 70090f99 | 2012-02-16 16:35:26 -0800 | [diff] [blame] | 1330 | return rc; |
| 1331 | } |
| 1332 | |
| 1333 | static struct isa1200_regulator isa1200_reg_data[] = { |
| 1334 | { |
| 1335 | .name = "vddp", |
| 1336 | .min_uV = ISA_I2C_VTG_MIN_UV, |
| 1337 | .max_uV = ISA_I2C_VTG_MAX_UV, |
| 1338 | .load_uA = ISA_I2C_CURR_UA, |
| 1339 | }, |
| 1340 | }; |
| 1341 | |
| 1342 | static struct isa1200_platform_data isa1200_1_pdata = { |
| 1343 | .name = "vibrator", |
| 1344 | .dev_setup = isa1200_dev_setup, |
Mohan Pallaka | 2d87760 | 2012-05-11 13:07:30 +0530 | [diff] [blame] | 1345 | .clk_enable = isa1200_clk_enable, |
Mohan Pallaka | 32f20a7 | 2012-06-14 14:41:11 +0530 | [diff] [blame] | 1346 | .need_pwm_clk = true, |
Amy Maloche | 70090f99 | 2012-02-16 16:35:26 -0800 | [diff] [blame] | 1347 | .hap_en_gpio = ISA1200_HAP_EN_GPIO, |
| 1348 | .hap_len_gpio = ISA1200_HAP_LEN_GPIO, |
| 1349 | .max_timeout = 15000, |
| 1350 | .mode_ctrl = PWM_GEN_MODE, |
| 1351 | .pwm_fd = { |
| 1352 | .pwm_div = 256, |
| 1353 | }, |
| 1354 | .is_erm = false, |
| 1355 | .smart_en = true, |
| 1356 | .ext_clk_en = true, |
| 1357 | .chip_en = 1, |
| 1358 | .regulator_info = isa1200_reg_data, |
| 1359 | .num_regulators = ARRAY_SIZE(isa1200_reg_data), |
| 1360 | }; |
| 1361 | |
| 1362 | static struct i2c_board_info isa1200_board_info[] __initdata = { |
| 1363 | { |
| 1364 | I2C_BOARD_INFO("isa1200_1", 0x90>>1), |
| 1365 | .platform_data = &isa1200_1_pdata, |
| 1366 | }, |
| 1367 | }; |
Jing Lin | 21ed4de | 2012-02-05 15:53:28 -0800 | [diff] [blame] | 1368 | /* configuration data for mxt1386e using V2.1 firmware */ |
| 1369 | static const u8 mxt1386e_config_data_v2_1[] = { |
| 1370 | /* T6 Object */ |
| 1371 | 0, 0, 0, 0, 0, 0, |
| 1372 | /* T38 Object */ |
Jing Lin | c6a55cfc | 2012-08-31 10:54:44 -0700 | [diff] [blame] | 1373 | 14, 3, 0, 5, 7, 12, 0, 0, 0, 0, |
Jing Lin | 21ed4de | 2012-02-05 15:53:28 -0800 | [diff] [blame] | 1374 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 1375 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 1376 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 1377 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 1378 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 1379 | 0, 0, 0, 0, |
| 1380 | /* T7 Object */ |
Jing Lin | c6a55cfc | 2012-08-31 10:54:44 -0700 | [diff] [blame] | 1381 | 32, 10, 50, |
Jing Lin | 21ed4de | 2012-02-05 15:53:28 -0800 | [diff] [blame] | 1382 | /* T8 Object */ |
Jing Lin | f1208fd | 2012-02-23 11:15:42 -0800 | [diff] [blame] | 1383 | 25, 0, 20, 20, 0, 0, 0, 0, 0, 0, |
Jing Lin | 21ed4de | 2012-02-05 15:53:28 -0800 | [diff] [blame] | 1384 | /* T9 Object */ |
Jing Lin | 943fcec | 2012-05-25 13:58:57 -0700 | [diff] [blame] | 1385 | 139, 0, 0, 26, 42, 0, 32, 80, 2, 5, |
Jing Lin | c6a55cfc | 2012-08-31 10:54:44 -0700 | [diff] [blame] | 1386 | 0, 5, 5, 79, 10, 30, 10, 10, 255, 2, |
Jing Lin | f1208fd | 2012-02-23 11:15:42 -0800 | [diff] [blame] | 1387 | 85, 5, 0, 5, 9, 5, 12, 35, 70, 40, |
| 1388 | 20, 5, 0, 0, 0, |
Jing Lin | 21ed4de | 2012-02-05 15:53:28 -0800 | [diff] [blame] | 1389 | /* T18 Object */ |
| 1390 | 0, 0, |
| 1391 | /* T24 Object */ |
| 1392 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 1393 | 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 1394 | /* T25 Object */ |
Jing Lin | 943fcec | 2012-05-25 13:58:57 -0700 | [diff] [blame] | 1395 | 1, 0, 60, 115, 156, 99, |
Jing Lin | 21ed4de | 2012-02-05 15:53:28 -0800 | [diff] [blame] | 1396 | /* T27 Object */ |
| 1397 | 0, 0, 0, 0, 0, 0, 0, |
| 1398 | /* T40 Object */ |
| 1399 | 0, 0, 0, 0, 0, |
| 1400 | /* T42 Object */ |
Jing Lin | 943fcec | 2012-05-25 13:58:57 -0700 | [diff] [blame] | 1401 | 0, 0, 255, 0, 255, 0, 0, 0, 0, 0, |
Jing Lin | 21ed4de | 2012-02-05 15:53:28 -0800 | [diff] [blame] | 1402 | /* T43 Object */ |
| 1403 | 0, 0, 0, 0, 0, 0, 0, 64, 0, 8, |
| 1404 | 16, |
| 1405 | /* T46 Object */ |
Jing Lin | f1208fd | 2012-02-23 11:15:42 -0800 | [diff] [blame] | 1406 | 68, 0, 16, 16, 0, 0, 0, 0, 0, |
Jing Lin | 21ed4de | 2012-02-05 15:53:28 -0800 | [diff] [blame] | 1407 | /* T47 Object */ |
| 1408 | 0, 0, 0, 0, 0, 0, 3, 64, 66, 0, |
| 1409 | /* T48 Object */ |
Jing Lin | 943fcec | 2012-05-25 13:58:57 -0700 | [diff] [blame] | 1410 | 1, 64, 64, 0, 0, 0, 0, 0, 0, 0, |
Jing Lin | f1208fd | 2012-02-23 11:15:42 -0800 | [diff] [blame] | 1411 | 32, 40, 0, 10, 10, 0, 0, 100, 10, 90, |
| 1412 | 0, 0, 0, 0, 0, 0, 0, 10, 1, 10, |
| 1413 | 52, 10, 12, 0, 33, 0, 1, 0, 0, 0, |
Jing Lin | 21ed4de | 2012-02-05 15:53:28 -0800 | [diff] [blame] | 1414 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 1415 | 0, 0, 0, 0, |
| 1416 | /* T56 Object */ |
| 1417 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 1418 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 1419 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 1420 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
Jing Lin | f1208fd | 2012-02-23 11:15:42 -0800 | [diff] [blame] | 1421 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 1422 | 0, |
Jing Lin | 21ed4de | 2012-02-05 15:53:28 -0800 | [diff] [blame] | 1423 | }; |
| 1424 | |
| 1425 | #define MXT_TS_GPIO_IRQ 6 |
| 1426 | #define MXT_TS_PWR_EN_GPIO PM8921_GPIO_PM_TO_SYS(23) |
| 1427 | #define MXT_TS_RESET_GPIO 33 |
| 1428 | |
| 1429 | static struct mxt_config_info mxt_config_array[] = { |
| 1430 | { |
| 1431 | .config = mxt1386e_config_data_v2_1, |
| 1432 | .config_length = ARRAY_SIZE(mxt1386e_config_data_v2_1), |
| 1433 | .family_id = 0xA0, |
| 1434 | .variant_id = 0x7, |
| 1435 | .version = 0x21, |
| 1436 | .build = 0xAA, |
Jing Lin | ef4aa9b | 2012-03-26 12:01:41 -0700 | [diff] [blame] | 1437 | .bootldr_id = MXT_BOOTLOADER_ID_1386E, |
| 1438 | .fw_name = "atmel_8064_liquid_v2_2_AA.hex", |
| 1439 | }, |
| 1440 | { |
| 1441 | /* The config data for V2.2.AA is the same as for V2.1.AA */ |
| 1442 | .config = mxt1386e_config_data_v2_1, |
| 1443 | .config_length = ARRAY_SIZE(mxt1386e_config_data_v2_1), |
| 1444 | .family_id = 0xA0, |
| 1445 | .variant_id = 0x7, |
| 1446 | .version = 0x22, |
| 1447 | .build = 0xAA, |
| 1448 | .bootldr_id = MXT_BOOTLOADER_ID_1386E, |
Jing Lin | 21ed4de | 2012-02-05 15:53:28 -0800 | [diff] [blame] | 1449 | }, |
| 1450 | }; |
| 1451 | |
| 1452 | static struct mxt_platform_data mxt_platform_data = { |
| 1453 | .config_array = mxt_config_array, |
| 1454 | .config_array_size = ARRAY_SIZE(mxt_config_array), |
Mohan Pallaka | 56a1a5d | 2012-02-23 12:05:13 -0800 | [diff] [blame] | 1455 | .panel_minx = 0, |
| 1456 | .panel_maxx = 1365, |
| 1457 | .panel_miny = 0, |
| 1458 | .panel_maxy = 767, |
| 1459 | .disp_minx = 0, |
| 1460 | .disp_maxx = 1365, |
| 1461 | .disp_miny = 0, |
| 1462 | .disp_maxy = 767, |
Anirudh Ghayal | 39dbe3f | 2012-04-13 15:43:16 +0530 | [diff] [blame] | 1463 | .irqflags = IRQF_TRIGGER_FALLING | IRQF_ONESHOT, |
Jing Lin | 21ed4de | 2012-02-05 15:53:28 -0800 | [diff] [blame] | 1464 | .i2c_pull_up = true, |
| 1465 | .reset_gpio = MXT_TS_RESET_GPIO, |
| 1466 | .irq_gpio = MXT_TS_GPIO_IRQ, |
| 1467 | }; |
| 1468 | |
| 1469 | static struct i2c_board_info mxt_device_info[] __initdata = { |
| 1470 | { |
| 1471 | I2C_BOARD_INFO("atmel_mxt_ts", 0x5b), |
| 1472 | .platform_data = &mxt_platform_data, |
| 1473 | .irq = MSM_GPIO_TO_INT(MXT_TS_GPIO_IRQ), |
| 1474 | }, |
| 1475 | }; |
Anirudh Ghayal | 2917a5a | 2012-02-05 19:51:07 -0800 | [diff] [blame] | 1476 | #define CYTTSP_TS_GPIO_IRQ 6 |
Anirudh Ghayal | 2917a5a | 2012-02-05 19:51:07 -0800 | [diff] [blame] | 1477 | #define CYTTSP_TS_GPIO_SLEEP 33 |
Amy Maloche | 609bb5e | 2012-08-03 09:41:42 -0700 | [diff] [blame] | 1478 | #define CYTTSP_TS_GPIO_SLEEP_ALT 12 |
Anirudh Ghayal | 2917a5a | 2012-02-05 19:51:07 -0800 | [diff] [blame] | 1479 | |
| 1480 | static ssize_t tma340_vkeys_show(struct kobject *kobj, |
| 1481 | struct kobj_attribute *attr, char *buf) |
| 1482 | { |
| 1483 | return snprintf(buf, 200, |
| 1484 | __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":73:1120:97:97" |
| 1485 | ":" __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":230:1120:97:97" |
| 1486 | ":" __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":389:1120:97:97" |
| 1487 | ":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":544:1120:97:97" |
| 1488 | "\n"); |
| 1489 | } |
| 1490 | |
| 1491 | static struct kobj_attribute tma340_vkeys_attr = { |
| 1492 | .attr = { |
| 1493 | .mode = S_IRUGO, |
| 1494 | }, |
| 1495 | .show = &tma340_vkeys_show, |
| 1496 | }; |
| 1497 | |
| 1498 | static struct attribute *tma340_properties_attrs[] = { |
| 1499 | &tma340_vkeys_attr.attr, |
| 1500 | NULL |
| 1501 | }; |
| 1502 | |
| 1503 | static struct attribute_group tma340_properties_attr_group = { |
| 1504 | .attrs = tma340_properties_attrs, |
| 1505 | }; |
| 1506 | |
| 1507 | static int cyttsp_platform_init(struct i2c_client *client) |
| 1508 | { |
| 1509 | int rc = 0; |
| 1510 | static struct kobject *tma340_properties_kobj; |
| 1511 | |
| 1512 | tma340_vkeys_attr.attr.name = "virtualkeys.cyttsp-i2c"; |
| 1513 | tma340_properties_kobj = kobject_create_and_add("board_properties", |
| 1514 | NULL); |
| 1515 | if (tma340_properties_kobj) |
| 1516 | rc = sysfs_create_group(tma340_properties_kobj, |
| 1517 | &tma340_properties_attr_group); |
| 1518 | if (!tma340_properties_kobj || rc) |
| 1519 | pr_err("%s: failed to create board_properties\n", |
| 1520 | __func__); |
| 1521 | |
| 1522 | return 0; |
| 1523 | } |
| 1524 | |
| 1525 | static struct cyttsp_regulator cyttsp_regulator_data[] = { |
| 1526 | { |
| 1527 | .name = "vdd", |
| 1528 | .min_uV = CY_TMA300_VTG_MIN_UV, |
| 1529 | .max_uV = CY_TMA300_VTG_MAX_UV, |
| 1530 | .hpm_load_uA = CY_TMA300_CURR_24HZ_UA, |
| 1531 | .lpm_load_uA = CY_TMA300_CURR_24HZ_UA, |
| 1532 | }, |
| 1533 | { |
| 1534 | .name = "vcc_i2c", |
| 1535 | .min_uV = CY_I2C_VTG_MIN_UV, |
| 1536 | .max_uV = CY_I2C_VTG_MAX_UV, |
| 1537 | .hpm_load_uA = CY_I2C_CURR_UA, |
| 1538 | .lpm_load_uA = CY_I2C_CURR_UA, |
| 1539 | }, |
| 1540 | }; |
| 1541 | |
| 1542 | static struct cyttsp_platform_data cyttsp_pdata = { |
| 1543 | .panel_maxx = 634, |
| 1544 | .panel_maxy = 1166, |
| 1545 | .disp_maxx = 599, |
| 1546 | .disp_maxy = 1023, |
| 1547 | .disp_minx = 0, |
| 1548 | .disp_miny = 0, |
| 1549 | .flags = 0x01, |
| 1550 | .gen = CY_GEN3, |
| 1551 | .use_st = CY_USE_ST, |
| 1552 | .use_mt = CY_USE_MT, |
| 1553 | .use_hndshk = CY_SEND_HNDSHK, |
| 1554 | .use_trk_id = CY_USE_TRACKING_ID, |
| 1555 | .use_sleep = CY_USE_DEEP_SLEEP_SEL, |
| 1556 | .use_gestures = CY_USE_GESTURES, |
| 1557 | .fw_fname = "cyttsp_8064_mtp.hex", |
| 1558 | /* change act_intrvl to customize the Active power state |
| 1559 | * scanning/processing refresh interval for Operating mode |
| 1560 | */ |
| 1561 | .act_intrvl = CY_ACT_INTRVL_DFLT, |
| 1562 | /* change tch_tmout to customize the touch timeout for the |
| 1563 | * Active power state for Operating mode |
| 1564 | */ |
| 1565 | .tch_tmout = CY_TCH_TMOUT_DFLT, |
| 1566 | /* change lp_intrvl to customize the Low Power power state |
| 1567 | * scanning/processing refresh interval for Operating mode |
| 1568 | */ |
| 1569 | .lp_intrvl = CY_LP_INTRVL_DFLT, |
| 1570 | .sleep_gpio = CYTTSP_TS_GPIO_SLEEP, |
Amy Maloche | 9ba3ffe | 2012-04-26 10:31:20 -0700 | [diff] [blame] | 1571 | .resout_gpio = -1, |
Anirudh Ghayal | 2917a5a | 2012-02-05 19:51:07 -0800 | [diff] [blame] | 1572 | .irq_gpio = CYTTSP_TS_GPIO_IRQ, |
| 1573 | .regulator_info = cyttsp_regulator_data, |
| 1574 | .num_regulators = ARRAY_SIZE(cyttsp_regulator_data), |
| 1575 | .init = cyttsp_platform_init, |
| 1576 | .correct_fw_ver = 17, |
| 1577 | }; |
| 1578 | |
| 1579 | static struct i2c_board_info cyttsp_info[] __initdata = { |
| 1580 | { |
| 1581 | I2C_BOARD_INFO(CY_I2C_NAME, 0x24), |
| 1582 | .platform_data = &cyttsp_pdata, |
| 1583 | .irq = MSM_GPIO_TO_INT(CYTTSP_TS_GPIO_IRQ), |
| 1584 | }, |
| 1585 | }; |
Jing Lin | 21ed4de | 2012-02-05 15:53:28 -0800 | [diff] [blame] | 1586 | |
Ankit Verma | 6b7e2ba | 2012-01-26 15:48:54 -0800 | [diff] [blame] | 1587 | #define MSM_WCNSS_PHYS 0x03000000 |
| 1588 | #define MSM_WCNSS_SIZE 0x280000 |
| 1589 | |
| 1590 | static struct resource resources_wcnss_wlan[] = { |
| 1591 | { |
| 1592 | .start = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ, |
| 1593 | .end = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ, |
| 1594 | .name = "wcnss_wlanrx_irq", |
| 1595 | .flags = IORESOURCE_IRQ, |
| 1596 | }, |
| 1597 | { |
| 1598 | .start = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ, |
| 1599 | .end = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ, |
| 1600 | .name = "wcnss_wlantx_irq", |
| 1601 | .flags = IORESOURCE_IRQ, |
| 1602 | }, |
| 1603 | { |
| 1604 | .start = MSM_WCNSS_PHYS, |
| 1605 | .end = MSM_WCNSS_PHYS + MSM_WCNSS_SIZE - 1, |
| 1606 | .name = "wcnss_mmio", |
| 1607 | .flags = IORESOURCE_MEM, |
| 1608 | }, |
| 1609 | { |
| 1610 | .start = 64, |
| 1611 | .end = 68, |
| 1612 | .name = "wcnss_gpios_5wire", |
| 1613 | .flags = IORESOURCE_IO, |
| 1614 | }, |
| 1615 | }; |
| 1616 | |
| 1617 | static struct qcom_wcnss_opts qcom_wcnss_pdata = { |
| 1618 | .has_48mhz_xo = 1, |
| 1619 | }; |
| 1620 | |
| 1621 | static struct platform_device msm_device_wcnss_wlan = { |
| 1622 | .name = "wcnss_wlan", |
| 1623 | .id = 0, |
| 1624 | .num_resources = ARRAY_SIZE(resources_wcnss_wlan), |
| 1625 | .resource = resources_wcnss_wlan, |
| 1626 | .dev = {.platform_data = &qcom_wcnss_pdata}, |
| 1627 | }; |
| 1628 | |
Ankit Verma | b7c26e6 | 2012-02-28 15:04:15 -0800 | [diff] [blame] | 1629 | static struct platform_device msm_device_iris_fm __devinitdata = { |
| 1630 | .name = "iris_fm", |
| 1631 | .id = -1, |
| 1632 | }; |
| 1633 | |
Ramesh Masavarapu | a26cce7 | 2012-04-09 12:32:25 -0700 | [diff] [blame] | 1634 | #ifdef CONFIG_QSEECOM |
| 1635 | /* qseecom bus scaling */ |
| 1636 | static struct msm_bus_vectors qseecom_clks_init_vectors[] = { |
| 1637 | { |
| 1638 | .src = MSM_BUS_MASTER_SPS, |
| 1639 | .dst = MSM_BUS_SLAVE_EBI_CH0, |
| 1640 | .ib = 0, |
| 1641 | .ab = 0, |
| 1642 | }, |
| 1643 | { |
| 1644 | .src = MSM_BUS_MASTER_SPDM, |
| 1645 | .dst = MSM_BUS_SLAVE_SPDM, |
| 1646 | .ib = 0, |
| 1647 | .ab = 0, |
| 1648 | }, |
| 1649 | }; |
| 1650 | |
| 1651 | static struct msm_bus_vectors qseecom_enable_dfab_vectors[] = { |
| 1652 | { |
| 1653 | .src = MSM_BUS_MASTER_SPS, |
| 1654 | .dst = MSM_BUS_SLAVE_EBI_CH0, |
| 1655 | .ib = (492 * 8) * 1000000UL, |
| 1656 | .ab = (492 * 8) * 100000UL, |
| 1657 | }, |
| 1658 | { |
| 1659 | .src = MSM_BUS_MASTER_SPDM, |
| 1660 | .dst = MSM_BUS_SLAVE_SPDM, |
| 1661 | .ib = 0, |
| 1662 | .ab = 0, |
| 1663 | }, |
| 1664 | }; |
| 1665 | |
| 1666 | static struct msm_bus_vectors qseecom_enable_sfpb_vectors[] = { |
| 1667 | { |
| 1668 | .src = MSM_BUS_MASTER_SPS, |
| 1669 | .dst = MSM_BUS_SLAVE_EBI_CH0, |
| 1670 | .ib = 0, |
| 1671 | .ab = 0, |
| 1672 | }, |
| 1673 | { |
| 1674 | .src = MSM_BUS_MASTER_SPDM, |
| 1675 | .dst = MSM_BUS_SLAVE_SPDM, |
| 1676 | .ib = (64 * 8) * 1000000UL, |
| 1677 | .ab = (64 * 8) * 100000UL, |
| 1678 | }, |
| 1679 | }; |
| 1680 | |
| 1681 | static struct msm_bus_paths qseecom_hw_bus_scale_usecases[] = { |
| 1682 | { |
| 1683 | ARRAY_SIZE(qseecom_clks_init_vectors), |
| 1684 | qseecom_clks_init_vectors, |
| 1685 | }, |
| 1686 | { |
| 1687 | ARRAY_SIZE(qseecom_enable_dfab_vectors), |
| 1688 | qseecom_enable_sfpb_vectors, |
| 1689 | }, |
| 1690 | { |
| 1691 | ARRAY_SIZE(qseecom_enable_sfpb_vectors), |
| 1692 | qseecom_enable_sfpb_vectors, |
| 1693 | }, |
| 1694 | }; |
| 1695 | |
| 1696 | static struct msm_bus_scale_pdata qseecom_bus_pdata = { |
| 1697 | qseecom_hw_bus_scale_usecases, |
| 1698 | ARRAY_SIZE(qseecom_hw_bus_scale_usecases), |
| 1699 | .name = "qsee", |
| 1700 | }; |
| 1701 | |
| 1702 | static struct platform_device qseecom_device = { |
| 1703 | .name = "qseecom", |
| 1704 | .id = 0, |
| 1705 | .dev = { |
| 1706 | .platform_data = &qseecom_bus_pdata, |
| 1707 | }, |
| 1708 | }; |
| 1709 | #endif |
| 1710 | |
Ramesh Masavarapu | 2831191 | 2011-10-27 11:04:12 -0700 | [diff] [blame] | 1711 | #if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \ |
| 1712 | defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \ |
| 1713 | defined(CONFIG_CRYPTO_DEV_QCEDEV) || \ |
| 1714 | defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE) |
| 1715 | |
| 1716 | #define QCE_SIZE 0x10000 |
| 1717 | #define QCE_0_BASE 0x11000000 |
| 1718 | |
| 1719 | #define QCE_HW_KEY_SUPPORT 0 |
| 1720 | #define QCE_SHA_HMAC_SUPPORT 1 |
| 1721 | #define QCE_SHARE_CE_RESOURCE 3 |
| 1722 | #define QCE_CE_SHARED 0 |
| 1723 | |
| 1724 | static struct resource qcrypto_resources[] = { |
| 1725 | [0] = { |
| 1726 | .start = QCE_0_BASE, |
| 1727 | .end = QCE_0_BASE + QCE_SIZE - 1, |
| 1728 | .flags = IORESOURCE_MEM, |
| 1729 | }, |
| 1730 | [1] = { |
| 1731 | .name = "crypto_channels", |
| 1732 | .start = DMOV8064_CE_IN_CHAN, |
| 1733 | .end = DMOV8064_CE_OUT_CHAN, |
| 1734 | .flags = IORESOURCE_DMA, |
| 1735 | }, |
| 1736 | [2] = { |
| 1737 | .name = "crypto_crci_in", |
| 1738 | .start = DMOV8064_CE_IN_CRCI, |
| 1739 | .end = DMOV8064_CE_IN_CRCI, |
| 1740 | .flags = IORESOURCE_DMA, |
| 1741 | }, |
| 1742 | [3] = { |
| 1743 | .name = "crypto_crci_out", |
| 1744 | .start = DMOV8064_CE_OUT_CRCI, |
| 1745 | .end = DMOV8064_CE_OUT_CRCI, |
| 1746 | .flags = IORESOURCE_DMA, |
| 1747 | }, |
| 1748 | }; |
| 1749 | |
| 1750 | static struct resource qcedev_resources[] = { |
| 1751 | [0] = { |
| 1752 | .start = QCE_0_BASE, |
| 1753 | .end = QCE_0_BASE + QCE_SIZE - 1, |
| 1754 | .flags = IORESOURCE_MEM, |
| 1755 | }, |
| 1756 | [1] = { |
| 1757 | .name = "crypto_channels", |
| 1758 | .start = DMOV8064_CE_IN_CHAN, |
| 1759 | .end = DMOV8064_CE_OUT_CHAN, |
| 1760 | .flags = IORESOURCE_DMA, |
| 1761 | }, |
| 1762 | [2] = { |
| 1763 | .name = "crypto_crci_in", |
| 1764 | .start = DMOV8064_CE_IN_CRCI, |
| 1765 | .end = DMOV8064_CE_IN_CRCI, |
| 1766 | .flags = IORESOURCE_DMA, |
| 1767 | }, |
| 1768 | [3] = { |
| 1769 | .name = "crypto_crci_out", |
| 1770 | .start = DMOV8064_CE_OUT_CRCI, |
| 1771 | .end = DMOV8064_CE_OUT_CRCI, |
| 1772 | .flags = IORESOURCE_DMA, |
| 1773 | }, |
| 1774 | }; |
| 1775 | |
| 1776 | #endif |
| 1777 | |
| 1778 | #if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \ |
| 1779 | defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) |
| 1780 | |
| 1781 | static struct msm_ce_hw_support qcrypto_ce_hw_suppport = { |
| 1782 | .ce_shared = QCE_CE_SHARED, |
| 1783 | .shared_ce_resource = QCE_SHARE_CE_RESOURCE, |
| 1784 | .hw_key_support = QCE_HW_KEY_SUPPORT, |
| 1785 | .sha_hmac = QCE_SHA_HMAC_SUPPORT, |
Ramesh Masavarapu | 4925968 | 2011-12-02 14:00:18 -0800 | [diff] [blame] | 1786 | .bus_scale_table = NULL, |
Ramesh Masavarapu | 2831191 | 2011-10-27 11:04:12 -0700 | [diff] [blame] | 1787 | }; |
| 1788 | |
| 1789 | static struct platform_device qcrypto_device = { |
| 1790 | .name = "qcrypto", |
| 1791 | .id = 0, |
| 1792 | .num_resources = ARRAY_SIZE(qcrypto_resources), |
| 1793 | .resource = qcrypto_resources, |
| 1794 | .dev = { |
| 1795 | .coherent_dma_mask = DMA_BIT_MASK(32), |
| 1796 | .platform_data = &qcrypto_ce_hw_suppport, |
| 1797 | }, |
| 1798 | }; |
| 1799 | #endif |
| 1800 | |
| 1801 | #if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \ |
| 1802 | defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE) |
| 1803 | |
| 1804 | static struct msm_ce_hw_support qcedev_ce_hw_suppport = { |
| 1805 | .ce_shared = QCE_CE_SHARED, |
| 1806 | .shared_ce_resource = QCE_SHARE_CE_RESOURCE, |
| 1807 | .hw_key_support = QCE_HW_KEY_SUPPORT, |
| 1808 | .sha_hmac = QCE_SHA_HMAC_SUPPORT, |
Ramesh Masavarapu | 4925968 | 2011-12-02 14:00:18 -0800 | [diff] [blame] | 1809 | .bus_scale_table = NULL, |
Ramesh Masavarapu | 2831191 | 2011-10-27 11:04:12 -0700 | [diff] [blame] | 1810 | }; |
| 1811 | |
| 1812 | static struct platform_device qcedev_device = { |
| 1813 | .name = "qce", |
| 1814 | .id = 0, |
| 1815 | .num_resources = ARRAY_SIZE(qcedev_resources), |
| 1816 | .resource = qcedev_resources, |
| 1817 | .dev = { |
| 1818 | .coherent_dma_mask = DMA_BIT_MASK(32), |
| 1819 | .platform_data = &qcedev_ce_hw_suppport, |
| 1820 | }, |
| 1821 | }; |
| 1822 | #endif |
| 1823 | |
Joel King | ef39084 | 2012-05-23 16:42:48 -0700 | [diff] [blame] | 1824 | static struct mdm_vddmin_resource mdm_vddmin_rscs = { |
| 1825 | .rpm_id = MSM_RPM_ID_VDDMIN_GPIO, |
| 1826 | .ap2mdm_vddmin_gpio = 30, |
| 1827 | .modes = 0x03, |
| 1828 | .drive_strength = 8, |
| 1829 | .mdm2ap_vddmin_gpio = 80, |
| 1830 | }; |
| 1831 | |
Joel King | 269aa60 | 2012-07-23 08:07:35 -0700 | [diff] [blame] | 1832 | static struct gpiomux_setting mdm2ap_status_gpio_run_cfg = { |
| 1833 | .func = GPIOMUX_FUNC_GPIO, |
| 1834 | .drv = GPIOMUX_DRV_8MA, |
| 1835 | .pull = GPIOMUX_PULL_NONE, |
| 1836 | }; |
| 1837 | |
Joel King | dacbc82 | 2012-01-25 13:30:57 -0800 | [diff] [blame] | 1838 | static struct mdm_platform_data mdm_platform_data = { |
| 1839 | .mdm_version = "3.0", |
| 1840 | .ramdump_delay_ms = 2000, |
Joel King | 14fe7fa | 2012-05-27 14:26:11 -0700 | [diff] [blame] | 1841 | .early_power_on = 1, |
| 1842 | .sfr_query = 1, |
Joel King | ef39084 | 2012-05-23 16:42:48 -0700 | [diff] [blame] | 1843 | .vddmin_resource = &mdm_vddmin_rscs, |
Hemant Kumar | a945b47 | 2012-01-25 15:08:06 -0800 | [diff] [blame] | 1844 | .peripheral_platform_device = &apq8064_device_hsic_host, |
Ameya Thakur | c9a7a84 | 2012-06-24 22:47:52 -0700 | [diff] [blame] | 1845 | .ramdump_timeout_ms = 120000, |
Joel King | 269aa60 | 2012-07-23 08:07:35 -0700 | [diff] [blame] | 1846 | .mdm2ap_status_gpio_run_cfg = &mdm2ap_status_gpio_run_cfg, |
Joel King | dacbc82 | 2012-01-25 13:30:57 -0800 | [diff] [blame] | 1847 | }; |
Ramesh Masavarapu | 2831191 | 2011-10-27 11:04:12 -0700 | [diff] [blame] | 1848 | |
Siddartha Mohanadoss | caeaa92 | 2012-02-07 16:41:38 -0800 | [diff] [blame] | 1849 | static struct tsens_platform_data apq_tsens_pdata = { |
| 1850 | .tsens_factor = 1000, |
| 1851 | .hw_type = APQ_8064, |
| 1852 | .tsens_num_sensor = 11, |
| 1853 | .slope = {1176, 1176, 1154, 1176, 1111, |
| 1854 | 1132, 1132, 1199, 1132, 1199, 1132}, |
| 1855 | }; |
| 1856 | |
Siddartha Mohanadoss | 48cad91 | 2012-04-05 21:29:54 -0700 | [diff] [blame] | 1857 | static struct platform_device msm_tsens_device = { |
| 1858 | .name = "tsens8960-tm", |
| 1859 | .id = -1, |
| 1860 | }; |
| 1861 | |
Praveen Chidambaram | 877d7a4 | 2012-06-05 14:33:20 -0600 | [diff] [blame] | 1862 | static struct msm_thermal_data msm_thermal_pdata = { |
| 1863 | .sensor_id = 7, |
Eugene Seah | 2ee4a5d | 2012-06-25 18:16:41 -0600 | [diff] [blame] | 1864 | .poll_ms = 250, |
| 1865 | .limit_temp_degC = 60, |
| 1866 | .temp_hysteresis_degC = 10, |
| 1867 | .freq_step = 2, |
Praveen Chidambaram | 877d7a4 | 2012-06-05 14:33:20 -0600 | [diff] [blame] | 1868 | }; |
| 1869 | |
Jeff Hugo | 0c0f5e9 | 2011-09-28 13:55:45 -0600 | [diff] [blame] | 1870 | #define MSM_SHARED_RAM_PHYS 0x80000000 |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1871 | static void __init apq8064_map_io(void) |
| 1872 | { |
Jeff Hugo | 0c0f5e9 | 2011-09-28 13:55:45 -0600 | [diff] [blame] | 1873 | msm_shared_ram_phys = MSM_SHARED_RAM_PHYS; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1874 | msm_map_apq8064_io(); |
Jeff Ohlstein | 3a77f9f | 2011-09-06 14:50:20 -0700 | [diff] [blame] | 1875 | if (socinfo_init() < 0) |
| 1876 | pr_err("socinfo_init() failed!\n"); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1877 | } |
| 1878 | |
| 1879 | static void __init apq8064_init_irq(void) |
| 1880 | { |
Praveen Chidambaram | 7849901 | 2011-11-01 17:15:17 -0600 | [diff] [blame] | 1881 | struct msm_mpm_device_data *data = NULL; |
| 1882 | |
| 1883 | #ifdef CONFIG_MSM_MPM |
| 1884 | data = &apq8064_mpm_dev_data; |
| 1885 | #endif |
| 1886 | |
| 1887 | msm_mpm_irq_extn_init(data); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1888 | gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE, |
| 1889 | (void *)MSM_QGIC_CPU_BASE); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1890 | } |
| 1891 | |
Abhishek Kharbanda | 72dc72e | 2012-06-07 13:41:37 -0700 | [diff] [blame] | 1892 | static struct msm_mhl_platform_data mhl_platform_data = { |
| 1893 | .irq = MSM_GPIO_TO_INT(MHL_GPIO_INT), |
| 1894 | .gpio_mhl_int = MHL_GPIO_INT, |
| 1895 | .gpio_mhl_reset = MHL_GPIO_RESET, |
| 1896 | .gpio_mhl_power = 0, |
| 1897 | .gpio_hdmi_mhl_mux = 0, |
| 1898 | }; |
| 1899 | |
| 1900 | static struct i2c_board_info sii_device_info[] __initdata = { |
| 1901 | { |
| 1902 | /* |
| 1903 | * keeps SI 8334 as the default |
| 1904 | * MHL TX |
| 1905 | */ |
| 1906 | I2C_BOARD_INFO("sii8334", 0x39), |
| 1907 | .platform_data = &mhl_platform_data, |
| 1908 | .flags = I2C_CLIENT_WAKE, |
| 1909 | }, |
| 1910 | }; |
| 1911 | |
Jay Chokshi | 7805b5a | 2011-11-07 15:55:30 -0800 | [diff] [blame] | 1912 | static struct platform_device msm8064_device_saw_regulator_core0 = { |
| 1913 | .name = "saw-regulator", |
| 1914 | .id = 0, |
| 1915 | .dev = { |
| 1916 | .platform_data = &msm8064_saw_regulator_pdata_8921_s5, |
| 1917 | }, |
| 1918 | }; |
| 1919 | |
| 1920 | static struct platform_device msm8064_device_saw_regulator_core1 = { |
| 1921 | .name = "saw-regulator", |
| 1922 | .id = 1, |
| 1923 | .dev = { |
| 1924 | .platform_data = &msm8064_saw_regulator_pdata_8921_s6, |
| 1925 | }, |
| 1926 | }; |
| 1927 | |
| 1928 | static struct platform_device msm8064_device_saw_regulator_core2 = { |
| 1929 | .name = "saw-regulator", |
| 1930 | .id = 2, |
| 1931 | .dev = { |
| 1932 | .platform_data = &msm8064_saw_regulator_pdata_8821_s0, |
| 1933 | }, |
| 1934 | }; |
| 1935 | |
| 1936 | static struct platform_device msm8064_device_saw_regulator_core3 = { |
| 1937 | .name = "saw-regulator", |
| 1938 | .id = 3, |
| 1939 | .dev = { |
| 1940 | .platform_data = &msm8064_saw_regulator_pdata_8821_s1, |
Praveen Chidambaram | 7849901 | 2011-11-01 17:15:17 -0600 | [diff] [blame] | 1941 | |
| 1942 | }, |
| 1943 | }; |
| 1944 | |
Oluwafemi Adeyemi | f5a3142 | 2012-03-08 16:58:45 -0800 | [diff] [blame] | 1945 | static struct msm_rpmrs_level msm_rpmrs_levels[] = { |
Praveen Chidambaram | 7849901 | 2011-11-01 17:15:17 -0600 | [diff] [blame] | 1946 | { |
| 1947 | MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT, |
| 1948 | MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE), |
| 1949 | true, |
Girish Mahadevan | 9bf7156 | 2012-04-13 14:41:44 -0600 | [diff] [blame] | 1950 | 1, 784, 180000, 100, |
Praveen Chidambaram | 7849901 | 2011-11-01 17:15:17 -0600 | [diff] [blame] | 1951 | }, |
| 1952 | |
| 1953 | { |
Girish Mahadevan | 3bc9877 | 2012-08-15 10:01:27 -0600 | [diff] [blame] | 1954 | MSM_PM_SLEEP_MODE_RETENTION, |
| 1955 | MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE), |
| 1956 | true, |
| 1957 | 415, 715, 340827, 475, |
| 1958 | }, |
| 1959 | |
| 1960 | { |
Praveen Chidambaram | 7849901 | 2011-11-01 17:15:17 -0600 | [diff] [blame] | 1961 | MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE, |
| 1962 | MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE), |
| 1963 | true, |
Girish Mahadevan | 9bf7156 | 2012-04-13 14:41:44 -0600 | [diff] [blame] | 1964 | 1300, 228, 1200000, 2000, |
Praveen Chidambaram | 7849901 | 2011-11-01 17:15:17 -0600 | [diff] [blame] | 1965 | }, |
| 1966 | |
| 1967 | { |
| 1968 | MSM_PM_SLEEP_MODE_POWER_COLLAPSE, |
| 1969 | MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE), |
| 1970 | false, |
Girish Mahadevan | 9bf7156 | 2012-04-13 14:41:44 -0600 | [diff] [blame] | 1971 | 2000, 138, 1208400, 3200, |
Praveen Chidambaram | 7849901 | 2011-11-01 17:15:17 -0600 | [diff] [blame] | 1972 | }, |
| 1973 | |
| 1974 | { |
| 1975 | MSM_PM_SLEEP_MODE_POWER_COLLAPSE, |
Praveen Chidambaram | e338067 | 2012-02-08 10:32:27 -0700 | [diff] [blame] | 1976 | MSM_RPMRS_LIMITS(ON, HSFS_OPEN, ACTIVE, RET_HIGH), |
| 1977 | false, |
Girish Mahadevan | 9bf7156 | 2012-04-13 14:41:44 -0600 | [diff] [blame] | 1978 | 6000, 119, 1850300, 9000, |
Praveen Chidambaram | 7849901 | 2011-11-01 17:15:17 -0600 | [diff] [blame] | 1979 | }, |
| 1980 | |
| 1981 | { |
| 1982 | MSM_PM_SLEEP_MODE_POWER_COLLAPSE, |
| 1983 | MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE), |
| 1984 | false, |
Girish Mahadevan | 9bf7156 | 2012-04-13 14:41:44 -0600 | [diff] [blame] | 1985 | 9200, 68, 2839200, 16400, |
Praveen Chidambaram | 7849901 | 2011-11-01 17:15:17 -0600 | [diff] [blame] | 1986 | }, |
| 1987 | |
| 1988 | { |
| 1989 | MSM_PM_SLEEP_MODE_POWER_COLLAPSE, |
| 1990 | MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE), |
| 1991 | false, |
Girish Mahadevan | 9bf7156 | 2012-04-13 14:41:44 -0600 | [diff] [blame] | 1992 | 10300, 63, 3128000, 18200, |
Praveen Chidambaram | 7849901 | 2011-11-01 17:15:17 -0600 | [diff] [blame] | 1993 | }, |
| 1994 | |
| 1995 | { |
| 1996 | MSM_PM_SLEEP_MODE_POWER_COLLAPSE, |
| 1997 | MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH), |
| 1998 | false, |
Girish Mahadevan | 9bf7156 | 2012-04-13 14:41:44 -0600 | [diff] [blame] | 1999 | 18000, 10, 4602600, 27000, |
Praveen Chidambaram | 7849901 | 2011-11-01 17:15:17 -0600 | [diff] [blame] | 2000 | }, |
| 2001 | |
| 2002 | { |
| 2003 | MSM_PM_SLEEP_MODE_POWER_COLLAPSE, |
| 2004 | MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW), |
| 2005 | false, |
Girish Mahadevan | 9bf7156 | 2012-04-13 14:41:44 -0600 | [diff] [blame] | 2006 | 20000, 2, 5752000, 32000, |
Praveen Chidambaram | 7849901 | 2011-11-01 17:15:17 -0600 | [diff] [blame] | 2007 | }, |
| 2008 | }; |
| 2009 | |
| 2010 | static struct msm_pm_boot_platform_data msm_pm_boot_pdata __initdata = { |
| 2011 | .mode = MSM_PM_BOOT_CONFIG_TZ, |
| 2012 | }; |
| 2013 | |
| 2014 | static struct msm_rpmrs_platform_data msm_rpmrs_data __initdata = { |
| 2015 | .levels = &msm_rpmrs_levels[0], |
| 2016 | .num_levels = ARRAY_SIZE(msm_rpmrs_levels), |
| 2017 | .vdd_mem_levels = { |
| 2018 | [MSM_RPMRS_VDD_MEM_RET_LOW] = 750000, |
| 2019 | [MSM_RPMRS_VDD_MEM_RET_HIGH] = 750000, |
| 2020 | [MSM_RPMRS_VDD_MEM_ACTIVE] = 1050000, |
| 2021 | [MSM_RPMRS_VDD_MEM_MAX] = 1150000, |
| 2022 | }, |
| 2023 | .vdd_dig_levels = { |
| 2024 | [MSM_RPMRS_VDD_DIG_RET_LOW] = 500000, |
| 2025 | [MSM_RPMRS_VDD_DIG_RET_HIGH] = 750000, |
| 2026 | [MSM_RPMRS_VDD_DIG_ACTIVE] = 950000, |
| 2027 | [MSM_RPMRS_VDD_DIG_MAX] = 1150000, |
| 2028 | }, |
| 2029 | .vdd_mask = 0x7FFFFF, |
| 2030 | .rpmrs_target_id = { |
| 2031 | [MSM_RPMRS_ID_PXO_CLK] = MSM_RPM_ID_PXO_CLK, |
| 2032 | [MSM_RPMRS_ID_L2_CACHE_CTL] = MSM_RPM_ID_LAST, |
| 2033 | [MSM_RPMRS_ID_VDD_DIG_0] = MSM_RPM_ID_PM8921_S3_0, |
| 2034 | [MSM_RPMRS_ID_VDD_DIG_1] = MSM_RPM_ID_PM8921_S3_1, |
| 2035 | [MSM_RPMRS_ID_VDD_MEM_0] = MSM_RPM_ID_PM8921_L24_0, |
| 2036 | [MSM_RPMRS_ID_VDD_MEM_1] = MSM_RPM_ID_PM8921_L24_1, |
| 2037 | [MSM_RPMRS_ID_RPM_CTL] = MSM_RPM_ID_RPM_CTL, |
| 2038 | }, |
| 2039 | }; |
| 2040 | |
Praveen Chidambaram | 7849901 | 2011-11-01 17:15:17 -0600 | [diff] [blame] | 2041 | static uint8_t spm_wfi_cmd_sequence[] __initdata = { |
| 2042 | 0x03, 0x0f, |
| 2043 | }; |
| 2044 | |
| 2045 | static uint8_t spm_power_collapse_without_rpm[] __initdata = { |
| 2046 | 0x00, 0x24, 0x54, 0x10, |
| 2047 | 0x09, 0x03, 0x01, |
| 2048 | 0x10, 0x54, 0x30, 0x0C, |
| 2049 | 0x24, 0x30, 0x0f, |
| 2050 | }; |
| 2051 | |
Girish Mahadevan | 3bc9877 | 2012-08-15 10:01:27 -0600 | [diff] [blame] | 2052 | static uint8_t spm_retention_cmd_sequence[] __initdata = { |
| 2053 | 0x00, 0x05, 0x03, 0x0D, |
| 2054 | 0x0B, 0x00, 0x0f, |
| 2055 | }; |
| 2056 | |
Praveen Chidambaram | 7849901 | 2011-11-01 17:15:17 -0600 | [diff] [blame] | 2057 | static uint8_t spm_power_collapse_with_rpm[] __initdata = { |
| 2058 | 0x00, 0x24, 0x54, 0x10, |
| 2059 | 0x09, 0x07, 0x01, 0x0B, |
| 2060 | 0x10, 0x54, 0x30, 0x0C, |
| 2061 | 0x24, 0x30, 0x0f, |
| 2062 | }; |
| 2063 | |
Girish Mahadevan | 3bc9877 | 2012-08-15 10:01:27 -0600 | [diff] [blame] | 2064 | static struct msm_spm_seq_entry msm_spm_boot_cpu_seq_list[] __initdata = { |
| 2065 | [0] = { |
| 2066 | .mode = MSM_SPM_MODE_CLOCK_GATING, |
| 2067 | .notify_rpm = false, |
| 2068 | .cmd = spm_wfi_cmd_sequence, |
| 2069 | }, |
| 2070 | [1] = { |
| 2071 | .mode = MSM_SPM_MODE_POWER_RETENTION, |
| 2072 | .notify_rpm = false, |
| 2073 | .cmd = spm_retention_cmd_sequence, |
| 2074 | }, |
| 2075 | [2] = { |
| 2076 | .mode = MSM_SPM_MODE_POWER_COLLAPSE, |
| 2077 | .notify_rpm = false, |
| 2078 | .cmd = spm_power_collapse_without_rpm, |
| 2079 | }, |
| 2080 | [3] = { |
| 2081 | .mode = MSM_SPM_MODE_POWER_COLLAPSE, |
| 2082 | .notify_rpm = true, |
| 2083 | .cmd = spm_power_collapse_with_rpm, |
| 2084 | }, |
| 2085 | }; |
| 2086 | static struct msm_spm_seq_entry msm_spm_nonboot_cpu_seq_list[] __initdata = { |
Praveen Chidambaram | 7849901 | 2011-11-01 17:15:17 -0600 | [diff] [blame] | 2087 | [0] = { |
| 2088 | .mode = MSM_SPM_MODE_CLOCK_GATING, |
| 2089 | .notify_rpm = false, |
| 2090 | .cmd = spm_wfi_cmd_sequence, |
| 2091 | }, |
| 2092 | [1] = { |
| 2093 | .mode = MSM_SPM_MODE_POWER_COLLAPSE, |
| 2094 | .notify_rpm = false, |
| 2095 | .cmd = spm_power_collapse_without_rpm, |
| 2096 | }, |
| 2097 | [2] = { |
| 2098 | .mode = MSM_SPM_MODE_POWER_COLLAPSE, |
| 2099 | .notify_rpm = true, |
| 2100 | .cmd = spm_power_collapse_with_rpm, |
| 2101 | }, |
| 2102 | }; |
| 2103 | |
| 2104 | static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = { |
| 2105 | 0x00, 0x20, 0x03, 0x20, |
| 2106 | 0x00, 0x0f, |
| 2107 | }; |
| 2108 | |
| 2109 | static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = { |
| 2110 | 0x00, 0x20, 0x34, 0x64, |
| 2111 | 0x48, 0x07, 0x48, 0x20, |
| 2112 | 0x50, 0x64, 0x04, 0x34, |
| 2113 | 0x50, 0x0f, |
| 2114 | }; |
| 2115 | static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = { |
| 2116 | 0x00, 0x10, 0x34, 0x64, |
| 2117 | 0x48, 0x07, 0x48, 0x10, |
| 2118 | 0x50, 0x64, 0x04, 0x34, |
| 2119 | 0x50, 0x0F, |
| 2120 | }; |
| 2121 | |
| 2122 | static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = { |
| 2123 | [0] = { |
| 2124 | .mode = MSM_SPM_L2_MODE_RETENTION, |
| 2125 | .notify_rpm = false, |
| 2126 | .cmd = l2_spm_wfi_cmd_sequence, |
| 2127 | }, |
| 2128 | [1] = { |
| 2129 | .mode = MSM_SPM_L2_MODE_GDHS, |
| 2130 | .notify_rpm = true, |
| 2131 | .cmd = l2_spm_gdhs_cmd_sequence, |
| 2132 | }, |
| 2133 | [2] = { |
| 2134 | .mode = MSM_SPM_L2_MODE_POWER_COLLAPSE, |
| 2135 | .notify_rpm = true, |
| 2136 | .cmd = l2_spm_power_off_cmd_sequence, |
| 2137 | }, |
| 2138 | }; |
| 2139 | |
| 2140 | |
| 2141 | static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = { |
| 2142 | [0] = { |
| 2143 | .reg_base_addr = MSM_SAW_L2_BASE, |
Praveen Chidambaram | 7849901 | 2011-11-01 17:15:17 -0600 | [diff] [blame] | 2144 | .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00, |
Praveen Chidambaram | e4b9eb1 | 2012-02-28 19:39:58 -0700 | [diff] [blame] | 2145 | .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204, |
Praveen Chidambaram | 7849901 | 2011-11-01 17:15:17 -0600 | [diff] [blame] | 2146 | .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE, |
| 2147 | .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020, |
| 2148 | .modes = msm_spm_l2_seq_list, |
| 2149 | .num_modes = ARRAY_SIZE(msm_spm_l2_seq_list), |
| 2150 | }, |
| 2151 | }; |
| 2152 | |
| 2153 | static struct msm_spm_platform_data msm_spm_data[] __initdata = { |
| 2154 | [0] = { |
| 2155 | .reg_base_addr = MSM_SAW0_BASE, |
Praveen Chidambaram | 7849901 | 2011-11-01 17:15:17 -0600 | [diff] [blame] | 2156 | .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F, |
Praveen Chidambaram | 7849901 | 2011-11-01 17:15:17 -0600 | [diff] [blame] | 2157 | #if defined(CONFIG_MSM_AVS_HW) |
| 2158 | .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00, |
| 2159 | .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00, |
| 2160 | #endif |
| 2161 | .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01, |
Girish Mahadevan | 3bc9877 | 2012-08-15 10:01:27 -0600 | [diff] [blame] | 2162 | .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x03020004, |
| 2163 | .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0084009C, |
| 2164 | .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A4001C, |
Praveen Chidambaram | 7849901 | 2011-11-01 17:15:17 -0600 | [diff] [blame] | 2165 | .vctl_timeout_us = 50, |
Girish Mahadevan | 3bc9877 | 2012-08-15 10:01:27 -0600 | [diff] [blame] | 2166 | .num_modes = ARRAY_SIZE(msm_spm_boot_cpu_seq_list), |
| 2167 | .modes = msm_spm_boot_cpu_seq_list, |
Praveen Chidambaram | 7849901 | 2011-11-01 17:15:17 -0600 | [diff] [blame] | 2168 | }, |
| 2169 | [1] = { |
| 2170 | .reg_base_addr = MSM_SAW1_BASE, |
Praveen Chidambaram | 7849901 | 2011-11-01 17:15:17 -0600 | [diff] [blame] | 2171 | .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F, |
Praveen Chidambaram | 7849901 | 2011-11-01 17:15:17 -0600 | [diff] [blame] | 2172 | #if defined(CONFIG_MSM_AVS_HW) |
| 2173 | .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00, |
| 2174 | .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00, |
| 2175 | #endif |
| 2176 | .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01, |
Praveen Chidambaram | e4b9eb1 | 2012-02-28 19:39:58 -0700 | [diff] [blame] | 2177 | .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204, |
Praveen Chidambaram | 7849901 | 2011-11-01 17:15:17 -0600 | [diff] [blame] | 2178 | .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C, |
| 2179 | .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C, |
| 2180 | .vctl_timeout_us = 50, |
Girish Mahadevan | 3bc9877 | 2012-08-15 10:01:27 -0600 | [diff] [blame] | 2181 | .num_modes = ARRAY_SIZE(msm_spm_nonboot_cpu_seq_list), |
| 2182 | .modes = msm_spm_nonboot_cpu_seq_list, |
Praveen Chidambaram | 7849901 | 2011-11-01 17:15:17 -0600 | [diff] [blame] | 2183 | }, |
| 2184 | [2] = { |
| 2185 | .reg_base_addr = MSM_SAW2_BASE, |
Praveen Chidambaram | 7849901 | 2011-11-01 17:15:17 -0600 | [diff] [blame] | 2186 | .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F, |
Praveen Chidambaram | 7849901 | 2011-11-01 17:15:17 -0600 | [diff] [blame] | 2187 | #if defined(CONFIG_MSM_AVS_HW) |
| 2188 | .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00, |
| 2189 | .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00, |
| 2190 | #endif |
| 2191 | .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01, |
Praveen Chidambaram | e4b9eb1 | 2012-02-28 19:39:58 -0700 | [diff] [blame] | 2192 | .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204, |
Praveen Chidambaram | 7849901 | 2011-11-01 17:15:17 -0600 | [diff] [blame] | 2193 | .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C, |
| 2194 | .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C, |
| 2195 | .vctl_timeout_us = 50, |
Girish Mahadevan | 3bc9877 | 2012-08-15 10:01:27 -0600 | [diff] [blame] | 2196 | .num_modes = ARRAY_SIZE(msm_spm_nonboot_cpu_seq_list), |
| 2197 | .modes = msm_spm_nonboot_cpu_seq_list, |
Praveen Chidambaram | 7849901 | 2011-11-01 17:15:17 -0600 | [diff] [blame] | 2198 | }, |
| 2199 | [3] = { |
| 2200 | .reg_base_addr = MSM_SAW3_BASE, |
Praveen Chidambaram | 7849901 | 2011-11-01 17:15:17 -0600 | [diff] [blame] | 2201 | .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F, |
Praveen Chidambaram | 7849901 | 2011-11-01 17:15:17 -0600 | [diff] [blame] | 2202 | #if defined(CONFIG_MSM_AVS_HW) |
| 2203 | .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00, |
| 2204 | .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00, |
| 2205 | #endif |
| 2206 | .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01, |
Praveen Chidambaram | e4b9eb1 | 2012-02-28 19:39:58 -0700 | [diff] [blame] | 2207 | .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204, |
Praveen Chidambaram | 7849901 | 2011-11-01 17:15:17 -0600 | [diff] [blame] | 2208 | .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C, |
| 2209 | .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C, |
| 2210 | .vctl_timeout_us = 50, |
Girish Mahadevan | 3bc9877 | 2012-08-15 10:01:27 -0600 | [diff] [blame] | 2211 | .num_modes = ARRAY_SIZE(msm_spm_nonboot_cpu_seq_list), |
| 2212 | .modes = msm_spm_nonboot_cpu_seq_list, |
Jay Chokshi | 7805b5a | 2011-11-07 15:55:30 -0800 | [diff] [blame] | 2213 | }, |
| 2214 | }; |
| 2215 | |
Gagan Mac | 8a7a5d3 | 2011-11-11 16:43:06 -0700 | [diff] [blame] | 2216 | static void __init apq8064_init_buses(void) |
| 2217 | { |
| 2218 | msm_bus_rpm_set_mt_mask(); |
| 2219 | msm_bus_8064_apps_fabric_pdata.rpm_enabled = 1; |
| 2220 | msm_bus_8064_sys_fabric_pdata.rpm_enabled = 1; |
| 2221 | msm_bus_8064_mm_fabric_pdata.rpm_enabled = 1; |
| 2222 | msm_bus_8064_apps_fabric.dev.platform_data = |
| 2223 | &msm_bus_8064_apps_fabric_pdata; |
| 2224 | msm_bus_8064_sys_fabric.dev.platform_data = |
| 2225 | &msm_bus_8064_sys_fabric_pdata; |
| 2226 | msm_bus_8064_mm_fabric.dev.platform_data = |
| 2227 | &msm_bus_8064_mm_fabric_pdata; |
| 2228 | msm_bus_8064_sys_fpb.dev.platform_data = &msm_bus_8064_sys_fpb_pdata; |
| 2229 | msm_bus_8064_cpss_fpb.dev.platform_data = &msm_bus_8064_cpss_fpb_pdata; |
| 2230 | } |
| 2231 | |
Niranjana Vishwanathapura | 06f8933 | 2012-05-03 17:11:13 -0600 | [diff] [blame] | 2232 | /* PCIe gpios */ |
| 2233 | static struct msm_pcie_gpio_info_t msm_pcie_gpio_info[MSM_PCIE_MAX_GPIO] = { |
| 2234 | {"rst_n", PM8921_MPP_PM_TO_SYS(PCIE_RST_N_PMIC_MPP), 0}, |
| 2235 | {"pwr_en", PM8921_GPIO_PM_TO_SYS(PCIE_PWR_EN_PMIC_GPIO), 1}, |
| 2236 | }; |
| 2237 | |
| 2238 | static struct msm_pcie_platform msm_pcie_platform_data = { |
| 2239 | .gpio = msm_pcie_gpio_info, |
Niranjana Vishwanathapura | 68210ff | 2012-06-24 18:03:49 -0600 | [diff] [blame] | 2240 | .axi_addr = PCIE_AXI_BAR_PHYS, |
| 2241 | .axi_size = PCIE_AXI_BAR_SIZE, |
Niranjana Vishwanathapura | 459a27d | 2012-07-20 12:23:55 -0600 | [diff] [blame] | 2242 | .wake_n = PM8921_GPIO_IRQ(PM8921_IRQ_BASE, PCIE_WAKE_N_PMIC_GPIO), |
Niranjana Vishwanathapura | 06f8933 | 2012-05-03 17:11:13 -0600 | [diff] [blame] | 2243 | }; |
| 2244 | |
Niranjana Vishwanathapura | c1edd40 | 2012-06-28 15:32:50 -0600 | [diff] [blame] | 2245 | static int __init mpq8064_pcie_enabled(void) |
| 2246 | { |
| 2247 | return !((readl_relaxed(QFPROM_RAW_FEAT_CONFIG_ROW0_MSB) & BIT(21)) || |
| 2248 | (readl_relaxed(QFPROM_RAW_OEM_CONFIG_ROW0_LSB) & BIT(4))); |
| 2249 | } |
| 2250 | |
Niranjana Vishwanathapura | 06f8933 | 2012-05-03 17:11:13 -0600 | [diff] [blame] | 2251 | static void __init mpq8064_pcie_init(void) |
| 2252 | { |
Niranjana Vishwanathapura | c1edd40 | 2012-06-28 15:32:50 -0600 | [diff] [blame] | 2253 | if (mpq8064_pcie_enabled()) { |
| 2254 | msm_device_pcie.dev.platform_data = &msm_pcie_platform_data; |
| 2255 | platform_device_register(&msm_device_pcie); |
| 2256 | } |
Niranjana Vishwanathapura | 06f8933 | 2012-05-03 17:11:13 -0600 | [diff] [blame] | 2257 | } |
| 2258 | |
David Collins | f0d0073 | 2012-01-25 15:46:50 -0800 | [diff] [blame] | 2259 | static struct platform_device apq8064_device_ext_5v_vreg __devinitdata = { |
| 2260 | .name = GPIO_REGULATOR_DEV_NAME, |
| 2261 | .id = PM8921_MPP_PM_TO_SYS(7), |
| 2262 | .dev = { |
| 2263 | .platform_data |
| 2264 | = &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V], |
| 2265 | }, |
| 2266 | }; |
| 2267 | |
Jay Chokshi | 1de4f9d | 2012-02-07 16:11:31 -0800 | [diff] [blame] | 2268 | static struct platform_device apq8064_device_ext_mpp8_vreg __devinitdata = { |
| 2269 | .name = GPIO_REGULATOR_DEV_NAME, |
| 2270 | .id = PM8921_MPP_PM_TO_SYS(8), |
| 2271 | .dev = { |
| 2272 | .platform_data |
| 2273 | = &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_MPP8], |
| 2274 | }, |
| 2275 | }; |
| 2276 | |
David Collins | f0d0073 | 2012-01-25 15:46:50 -0800 | [diff] [blame] | 2277 | static struct platform_device apq8064_device_ext_3p3v_vreg __devinitdata = { |
| 2278 | .name = GPIO_REGULATOR_DEV_NAME, |
| 2279 | .id = APQ8064_EXT_3P3V_REG_EN_GPIO, |
| 2280 | .dev = { |
| 2281 | .platform_data = |
| 2282 | &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_3P3V], |
| 2283 | }, |
| 2284 | }; |
| 2285 | |
David Collins | 390fc33 | 2012-02-07 14:38:16 -0800 | [diff] [blame] | 2286 | static struct platform_device apq8064_device_ext_ts_sw_vreg __devinitdata = { |
| 2287 | .name = GPIO_REGULATOR_DEV_NAME, |
| 2288 | .id = PM8921_GPIO_PM_TO_SYS(23), |
| 2289 | .dev = { |
| 2290 | .platform_data |
| 2291 | = &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_TS_SW], |
| 2292 | }, |
| 2293 | }; |
| 2294 | |
David Collins | 2782b5c | 2012-02-06 10:02:42 -0800 | [diff] [blame] | 2295 | static struct platform_device apq8064_device_rpm_regulator __devinitdata = { |
| 2296 | .name = "rpm-regulator", |
David Collins | 793793b | 2012-08-21 15:43:02 -0700 | [diff] [blame] | 2297 | .id = 0, |
David Collins | 2782b5c | 2012-02-06 10:02:42 -0800 | [diff] [blame] | 2298 | .dev = { |
| 2299 | .platform_data = &apq8064_rpm_regulator_pdata, |
| 2300 | }, |
| 2301 | }; |
| 2302 | |
David Collins | 793793b | 2012-08-21 15:43:02 -0700 | [diff] [blame] | 2303 | static struct platform_device |
| 2304 | apq8064_pm8921_device_rpm_regulator __devinitdata = { |
| 2305 | .name = "rpm-regulator", |
| 2306 | .id = 1, |
| 2307 | .dev = { |
| 2308 | .platform_data = &apq8064_rpm_regulator_pm8921_pdata, |
| 2309 | }, |
| 2310 | }; |
| 2311 | |
Ravi Kumar V | 05931a2 | 2012-04-04 17:09:37 +0530 | [diff] [blame] | 2312 | static struct gpio_ir_recv_platform_data gpio_ir_recv_pdata = { |
| 2313 | .gpio_nr = 88, |
| 2314 | .active_low = 1, |
| 2315 | }; |
| 2316 | |
| 2317 | static struct platform_device gpio_ir_recv_pdev = { |
| 2318 | .name = "gpio-rc-recv", |
| 2319 | .dev = { |
| 2320 | .platform_data = &gpio_ir_recv_pdata, |
| 2321 | }, |
| 2322 | }; |
| 2323 | |
Terence Hampson | 36b7072 | 2012-05-10 13:18:16 -0400 | [diff] [blame] | 2324 | static struct platform_device *common_not_mpq_devices[] __initdata = { |
David Keitel | 3c40fc5 | 2012-02-09 17:53:52 -0800 | [diff] [blame] | 2325 | &apq8064_device_qup_i2c_gsbi1, |
Jing Lin | 04601f9 | 2012-02-05 15:36:07 -0800 | [diff] [blame] | 2326 | &apq8064_device_qup_i2c_gsbi3, |
Kenneth Heitke | 748593a | 2011-07-15 15:45:11 -0600 | [diff] [blame] | 2327 | &apq8064_device_qup_i2c_gsbi4, |
Terence Hampson | 36b7072 | 2012-05-10 13:18:16 -0400 | [diff] [blame] | 2328 | }; |
| 2329 | |
Kuirong Wang | f8c5e14 | 2012-06-21 16:17:32 -0700 | [diff] [blame] | 2330 | static struct platform_device *common_mpq_devices[] __initdata = { |
| 2331 | &mpq_cpudai_sec_i2s_rx, |
| 2332 | &mpq_cpudai_mi2s_tx, |
| 2333 | }; |
| 2334 | |
| 2335 | static struct platform_device *common_i2s_devices[] __initdata = { |
| 2336 | &apq_cpudai_mi2s, |
| 2337 | &apq_cpudai_i2s_rx, |
| 2338 | &apq_cpudai_i2s_tx, |
| 2339 | }; |
| 2340 | |
David Collins | 793793b | 2012-08-21 15:43:02 -0700 | [diff] [blame] | 2341 | static struct platform_device *early_common_devices[] __initdata = { |
Matt Wagantall | f5cc389 | 2012-06-07 19:47:02 -0700 | [diff] [blame] | 2342 | &apq8064_device_acpuclk, |
Terence Hampson | 36b7072 | 2012-05-10 13:18:16 -0400 | [diff] [blame] | 2343 | &apq8064_device_dmov, |
Harini Jayaraman | c4c5869 | 2011-07-19 14:50:10 -0600 | [diff] [blame] | 2344 | &apq8064_device_qup_spi_gsbi5, |
David Collins | 793793b | 2012-08-21 15:43:02 -0700 | [diff] [blame] | 2345 | }; |
| 2346 | |
| 2347 | static struct platform_device *pm8921_common_devices[] __initdata = { |
David Collins | f0d0073 | 2012-01-25 15:46:50 -0800 | [diff] [blame] | 2348 | &apq8064_device_ext_5v_vreg, |
Jay Chokshi | 1de4f9d | 2012-02-07 16:11:31 -0800 | [diff] [blame] | 2349 | &apq8064_device_ext_mpp8_vreg, |
David Collins | f0d0073 | 2012-01-25 15:46:50 -0800 | [diff] [blame] | 2350 | &apq8064_device_ext_3p3v_vreg, |
Jay Chokshi | 9c25f07 | 2011-09-23 18:19:15 -0700 | [diff] [blame] | 2351 | &apq8064_device_ssbi_pmic1, |
| 2352 | &apq8064_device_ssbi_pmic2, |
Steve Muckle | f132c6c | 2012-06-06 18:30:57 -0700 | [diff] [blame] | 2353 | &apq8064_device_ext_ts_sw_vreg, |
David Collins | 793793b | 2012-08-21 15:43:02 -0700 | [diff] [blame] | 2354 | }; |
| 2355 | |
| 2356 | static struct platform_device *pm8917_common_devices[] __initdata = { |
| 2357 | &apq8064_device_ext_mpp8_vreg, |
| 2358 | &apq8064_device_ext_3p3v_vreg, |
| 2359 | &apq8064_device_ssbi_pmic1, |
| 2360 | &apq8064_device_ssbi_pmic2, |
| 2361 | &apq8064_device_ext_ts_sw_vreg, |
| 2362 | }; |
| 2363 | |
| 2364 | static struct platform_device *common_devices[] __initdata = { |
Jeff Hugo | 0c0f5e9 | 2011-09-28 13:55:45 -0600 | [diff] [blame] | 2365 | &msm_device_smd_apq8064, |
Hemant Kumar | 4933b07 | 2011-10-17 23:43:11 -0700 | [diff] [blame] | 2366 | &apq8064_device_otg, |
| 2367 | &apq8064_device_gadget_peripheral, |
Hemant Kumar | d86c488 | 2012-01-24 19:39:37 -0800 | [diff] [blame] | 2368 | &apq8064_device_hsusb_host, |
Hemant Kumar | 4933b07 | 2011-10-17 23:43:11 -0700 | [diff] [blame] | 2369 | &android_usb_device, |
Ankit Verma | 6b7e2ba | 2012-01-26 15:48:54 -0800 | [diff] [blame] | 2370 | &msm_device_wcnss_wlan, |
Ankit Verma | b7c26e6 | 2012-02-28 15:04:15 -0800 | [diff] [blame] | 2371 | &msm_device_iris_fm, |
Larry Bassel | 67b921d | 2012-04-06 10:23:27 -0700 | [diff] [blame] | 2372 | &apq8064_fmem_device, |
Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 2373 | #ifdef CONFIG_ANDROID_PMEM |
| 2374 | #ifndef CONFIG_MSM_MULTIMEDIA_USE_ION |
Laura Abbott | b93525f | 2012-04-12 09:57:19 -0700 | [diff] [blame] | 2375 | &apq8064_android_pmem_device, |
| 2376 | &apq8064_android_pmem_adsp_device, |
| 2377 | &apq8064_android_pmem_audio_device, |
Bharath Ramachandramurthy | 4a3fa91 | 2012-03-13 19:16:24 -0700 | [diff] [blame] | 2378 | #endif /*CONFIG_MSM_MULTIMEDIA_USE_ION*/ |
| 2379 | #endif /*CONFIG_ANDROID_PMEM*/ |
Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 2380 | #ifdef CONFIG_ION_MSM |
Laura Abbott | b93525f | 2012-04-12 09:57:19 -0700 | [diff] [blame] | 2381 | &apq8064_ion_dev, |
Olav Haugan | 7c6aa74 | 2012-01-16 16:47:37 -0800 | [diff] [blame] | 2382 | #endif |
Jeff Ohlstein | 7e66855 | 2011-10-06 16:17:25 -0700 | [diff] [blame] | 2383 | &msm8064_device_watchdog, |
Jay Chokshi | 7805b5a | 2011-11-07 15:55:30 -0800 | [diff] [blame] | 2384 | &msm8064_device_saw_regulator_core0, |
| 2385 | &msm8064_device_saw_regulator_core1, |
| 2386 | &msm8064_device_saw_regulator_core2, |
| 2387 | &msm8064_device_saw_regulator_core3, |
Ramesh Masavarapu | a26cce7 | 2012-04-09 12:32:25 -0700 | [diff] [blame] | 2388 | #if defined(CONFIG_QSEECOM) |
| 2389 | &qseecom_device, |
| 2390 | #endif |
| 2391 | |
Joel Nider | 6b9a7bc | 2012-06-26 11:19:19 +0300 | [diff] [blame] | 2392 | &msm_8064_device_tsif[0], |
| 2393 | &msm_8064_device_tsif[1], |
| 2394 | |
Ramesh Masavarapu | 2831191 | 2011-10-27 11:04:12 -0700 | [diff] [blame] | 2395 | #if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \ |
| 2396 | defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) |
| 2397 | &qcrypto_device, |
| 2398 | #endif |
| 2399 | |
| 2400 | #if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \ |
| 2401 | defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE) |
| 2402 | &qcedev_device, |
| 2403 | #endif |
Ramesh Masavarapu | f46be1b | 2011-11-03 11:13:41 -0700 | [diff] [blame] | 2404 | |
| 2405 | #ifdef CONFIG_HW_RANDOM_MSM |
| 2406 | &apq8064_device_rng, |
| 2407 | #endif |
Bharath Ramachandramurthy | b8e797f | 2011-11-30 12:08:42 -0800 | [diff] [blame] | 2408 | &apq_pcm, |
| 2409 | &apq_pcm_routing, |
| 2410 | &apq_cpudai0, |
| 2411 | &apq_cpudai1, |
| 2412 | &apq_cpudai_hdmi_rx, |
| 2413 | &apq_cpudai_bt_rx, |
| 2414 | &apq_cpudai_bt_tx, |
| 2415 | &apq_cpudai_fm_rx, |
| 2416 | &apq_cpudai_fm_tx, |
| 2417 | &apq_cpu_fe, |
| 2418 | &apq_stub_codec, |
| 2419 | &apq_voice, |
| 2420 | &apq_voip, |
| 2421 | &apq_lpa_pcm, |
Krishnankutty Kolathappilly | 4374e33 | 2012-03-18 22:27:30 -0700 | [diff] [blame] | 2422 | &apq_compr_dsp, |
| 2423 | &apq_multi_ch_pcm, |
Jayasena Sangaraboina | 99bf09c | 2012-07-17 12:03:08 -0700 | [diff] [blame] | 2424 | &apq_lowlatency_pcm, |
Bharath Ramachandramurthy | b8e797f | 2011-11-30 12:08:42 -0800 | [diff] [blame] | 2425 | &apq_pcm_hostless, |
| 2426 | &apq_cpudai_afe_01_rx, |
| 2427 | &apq_cpudai_afe_01_tx, |
| 2428 | &apq_cpudai_afe_02_rx, |
| 2429 | &apq_cpudai_afe_02_tx, |
| 2430 | &apq_pcm_afe, |
| 2431 | &apq_cpudai_auxpcm_rx, |
| 2432 | &apq_cpudai_auxpcm_tx, |
Neema Shetty | 8427c26 | 2012-02-16 11:23:43 -0800 | [diff] [blame] | 2433 | &apq_cpudai_stub, |
Neema Shetty | 3c9d286 | 2012-03-11 01:25:32 -0800 | [diff] [blame] | 2434 | &apq_cpudai_slimbus_1_rx, |
| 2435 | &apq_cpudai_slimbus_1_tx, |
Kiran Kandi | 97fe19d | 2012-05-20 22:34:04 -0700 | [diff] [blame] | 2436 | &apq_cpudai_slimbus_2_rx, |
Kiran Kandi | 1e6371d | 2012-03-29 11:48:57 -0700 | [diff] [blame] | 2437 | &apq_cpudai_slimbus_2_tx, |
Neema Shetty | c9d86c3 | 2012-05-09 12:01:39 -0700 | [diff] [blame] | 2438 | &apq_cpudai_slimbus_3_rx, |
Helen Zeng | 38c3c96 | 2012-05-17 14:56:20 -0700 | [diff] [blame] | 2439 | &apq_cpudai_slimbus_3_tx, |
Praveen Chidambaram | 7849901 | 2011-11-01 17:15:17 -0600 | [diff] [blame] | 2440 | &apq8064_rpm_device, |
| 2441 | &apq8064_rpm_log_device, |
| 2442 | &apq8064_rpm_stat_device, |
Ramesh Masavarapu | f31ff24 | 2012-05-10 18:55:21 -0700 | [diff] [blame] | 2443 | &apq_device_tz_log, |
Gagan Mac | 8a7a5d3 | 2011-11-11 16:43:06 -0700 | [diff] [blame] | 2444 | &msm_bus_8064_apps_fabric, |
| 2445 | &msm_bus_8064_sys_fabric, |
| 2446 | &msm_bus_8064_mm_fabric, |
| 2447 | &msm_bus_8064_sys_fpb, |
| 2448 | &msm_bus_8064_cpss_fpb, |
Mohan Kumar Gubbihalli Lachma Naik | 7f72edd | 2012-02-06 17:26:47 -0800 | [diff] [blame] | 2449 | &apq8064_msm_device_vidc, |
Stephen Boyd | 25c4a0b | 2011-09-20 00:12:36 -0700 | [diff] [blame] | 2450 | &msm_pil_dsps, |
Matt Wagantall | b94b9a5 | 2012-02-02 21:59:54 -0800 | [diff] [blame] | 2451 | &msm_8960_q6_lpass, |
Stephen Boyd | 7b973de | 2012-03-09 12:26:16 -0800 | [diff] [blame] | 2452 | &msm_pil_vidc, |
Matt Wagantall | 292aace | 2012-01-26 19:12:34 -0800 | [diff] [blame] | 2453 | &msm_gss, |
Laura Abbott | b93525f | 2012-04-12 09:57:19 -0700 | [diff] [blame] | 2454 | &apq8064_rtb_device, |
Praveen Chidambaram | 8ea3dcd | 2011-12-07 14:46:31 -0700 | [diff] [blame] | 2455 | &apq8064_cpu_idle_device, |
Stepan Moskovchenko | 28662c5 | 2012-03-01 12:48:45 -0800 | [diff] [blame] | 2456 | &apq8064_device_cache_erp, |
Stepan Moskovchenko | 0f3de11 | 2012-06-08 18:11:46 -0700 | [diff] [blame] | 2457 | &msm8960_device_ebi1_ch0_erp, |
| 2458 | &msm8960_device_ebi1_ch1_erp, |
Siddartha Mohanadoss | b9df494 | 2012-02-08 09:58:21 -0800 | [diff] [blame] | 2459 | &epm_adc_device, |
Pratik Patel | 3b0ca88 | 2012-06-01 16:54:14 -0700 | [diff] [blame] | 2460 | &coresight_tpiu_device, |
| 2461 | &coresight_etb_device, |
| 2462 | &apq8064_coresight_funnel_device, |
| 2463 | &coresight_etm0_device, |
| 2464 | &coresight_etm1_device, |
| 2465 | &coresight_etm2_device, |
| 2466 | &coresight_etm3_device, |
Helen Zeng | 8f92550 | 2012-03-05 16:50:17 -0800 | [diff] [blame] | 2467 | &apq_cpudai_slim_4_rx, |
| 2468 | &apq_cpudai_slim_4_tx, |
Steve Muckle | f132c6c | 2012-06-06 18:30:57 -0700 | [diff] [blame] | 2469 | #ifdef CONFIG_MSM_GEMINI |
Jignesh Mehta | 921649d | 2012-04-19 06:57:23 -0700 | [diff] [blame] | 2470 | &msm8960_gemini_device, |
Steve Muckle | f132c6c | 2012-06-06 18:30:57 -0700 | [diff] [blame] | 2471 | #endif |
Laura Abbott | 0577d7b | 2012-04-17 11:14:30 -0700 | [diff] [blame] | 2472 | &apq8064_iommu_domain_device, |
Siddartha Mohanadoss | 48cad91 | 2012-04-05 21:29:54 -0700 | [diff] [blame] | 2473 | &msm_tsens_device, |
Laura Abbott | 93a4a35 | 2012-05-25 09:26:35 -0700 | [diff] [blame] | 2474 | &apq8064_cache_dump_device, |
Joel Nider | 0e4a16d | 2012-08-05 14:20:11 +0300 | [diff] [blame] | 2475 | &msm_8064_device_tspp, |
Harini Jayaraman | c4c5869 | 2011-07-19 14:50:10 -0600 | [diff] [blame] | 2476 | }; |
| 2477 | |
Joel King | 82b7e3f | 2012-01-05 10:03:27 -0800 | [diff] [blame] | 2478 | static struct platform_device *cdp_devices[] __initdata = { |
| 2479 | &apq8064_device_uart_gsbi1, |
Jin Hong | 4bbbfba | 2012-02-02 21:48:07 -0800 | [diff] [blame] | 2480 | &apq8064_device_uart_gsbi7, |
Joel King | 82b7e3f | 2012-01-05 10:03:27 -0800 | [diff] [blame] | 2481 | &msm_device_sps_apq8064, |
Aravind Venkateswaran | 4ca2753 | 2012-02-16 14:27:05 -0800 | [diff] [blame] | 2482 | #ifdef CONFIG_MSM_ROTATOR |
| 2483 | &msm_rotator_device, |
| 2484 | #endif |
Joel King | 82b7e3f | 2012-01-05 10:03:27 -0800 | [diff] [blame] | 2485 | }; |
| 2486 | |
Jay Chokshi | 1b7eaa9 | 2012-04-04 14:53:14 -0700 | [diff] [blame] | 2487 | static struct platform_device |
Jay Chokshi | 1b7eaa9 | 2012-04-04 14:53:14 -0700 | [diff] [blame] | 2488 | mpq8064_device_ext_1p2_buck_vreg __devinitdata = { |
| 2489 | .name = GPIO_REGULATOR_DEV_NAME, |
| 2490 | .id = SX150X_GPIO(4, 2), |
| 2491 | .dev = { |
| 2492 | .platform_data = |
| 2493 | &mpq8064_gpio_regulator_pdata[GPIO_VREG_ID_AVC_1P2V], |
| 2494 | }, |
| 2495 | }; |
| 2496 | |
| 2497 | static struct platform_device |
| 2498 | mpq8064_device_ext_1p8_buck_vreg __devinitdata = { |
| 2499 | .name = GPIO_REGULATOR_DEV_NAME, |
| 2500 | .id = SX150X_GPIO(4, 4), |
| 2501 | .dev = { |
| 2502 | .platform_data = |
| 2503 | &mpq8064_gpio_regulator_pdata[GPIO_VREG_ID_AVC_1P8V], |
| 2504 | }, |
| 2505 | }; |
| 2506 | |
| 2507 | static struct platform_device |
| 2508 | mpq8064_device_ext_2p2_buck_vreg __devinitdata = { |
| 2509 | .name = GPIO_REGULATOR_DEV_NAME, |
| 2510 | .id = SX150X_GPIO(4, 14), |
| 2511 | .dev = { |
| 2512 | .platform_data = |
| 2513 | &mpq8064_gpio_regulator_pdata[GPIO_VREG_ID_AVC_2P2V], |
| 2514 | }, |
| 2515 | }; |
| 2516 | |
| 2517 | static struct platform_device |
| 2518 | mpq8064_device_ext_5v_buck_vreg __devinitdata = { |
| 2519 | .name = GPIO_REGULATOR_DEV_NAME, |
| 2520 | .id = SX150X_GPIO(4, 3), |
| 2521 | .dev = { |
| 2522 | .platform_data = |
| 2523 | &mpq8064_gpio_regulator_pdata[GPIO_VREG_ID_AVC_5V], |
| 2524 | }, |
| 2525 | }; |
| 2526 | |
| 2527 | static struct platform_device |
| 2528 | mpq8064_device_ext_3p3v_ldo_vreg __devinitdata = { |
| 2529 | .name = GPIO_REGULATOR_DEV_NAME, |
| 2530 | .id = SX150X_GPIO(4, 15), |
| 2531 | .dev = { |
| 2532 | .platform_data = |
| 2533 | &mpq8064_gpio_regulator_pdata[GPIO_VREG_ID_AVC_3P3V], |
| 2534 | }, |
| 2535 | }; |
| 2536 | |
Ravi Kumar V | 1c90301 | 2012-05-15 16:11:35 +0530 | [diff] [blame] | 2537 | static struct platform_device rc_input_loopback_pdev = { |
| 2538 | .name = "rc-user-input", |
| 2539 | .id = -1, |
| 2540 | }; |
| 2541 | |
Ravi Kumar V | 040eeff | 2012-05-23 21:29:23 +0530 | [diff] [blame] | 2542 | static int rf4ce_gpio_init(void) |
| 2543 | { |
| 2544 | if (!machine_is_mpq8064_cdp()) |
| 2545 | return -EINVAL; |
| 2546 | |
| 2547 | /* CC2533 SRDY Input */ |
| 2548 | if (!gpio_request(SX150X_GPIO(4, 6), "rf4ce_srdy")) { |
| 2549 | gpio_direction_input(SX150X_GPIO(4, 6)); |
| 2550 | gpio_export(SX150X_GPIO(4, 6), true); |
| 2551 | } |
| 2552 | |
| 2553 | /* CC2533 MRDY Output */ |
| 2554 | if (!gpio_request(SX150X_GPIO(4, 5), "rf4ce_mrdy")) { |
| 2555 | gpio_direction_output(SX150X_GPIO(4, 5), 1); |
| 2556 | gpio_export(SX150X_GPIO(4, 5), true); |
| 2557 | } |
| 2558 | |
| 2559 | /* CC2533 Reset Output */ |
| 2560 | if (!gpio_request(SX150X_GPIO(4, 7), "rf4ce_reset")) { |
| 2561 | gpio_direction_output(SX150X_GPIO(4, 7), 0); |
| 2562 | gpio_export(SX150X_GPIO(4, 7), true); |
| 2563 | } |
| 2564 | |
| 2565 | return 0; |
| 2566 | } |
| 2567 | late_initcall(rf4ce_gpio_init); |
| 2568 | |
Mayank Rana | 262e903 | 2012-05-10 15:14:00 -0700 | [diff] [blame] | 2569 | #ifdef CONFIG_SERIAL_MSM_HS |
| 2570 | static int configure_uart_gpios(int on) |
| 2571 | { |
| 2572 | int ret = 0, i; |
| 2573 | int uart_gpios[] = {14, 15, 16, 17}; |
| 2574 | |
| 2575 | for (i = 0; i < ARRAY_SIZE(uart_gpios); i++) { |
| 2576 | if (on) { |
| 2577 | ret = gpio_request(uart_gpios[i], NULL); |
| 2578 | if (ret) { |
| 2579 | pr_err("%s:unable to request uart gpio[%d]\n", |
| 2580 | __func__, uart_gpios[i]); |
| 2581 | break; |
| 2582 | } |
| 2583 | } else { |
| 2584 | gpio_free(uart_gpios[i]); |
| 2585 | } |
| 2586 | } |
| 2587 | |
| 2588 | if (ret && on && i) |
| 2589 | for (; i >= 0; i--) |
| 2590 | gpio_free(uart_gpios[i]); |
| 2591 | return ret; |
| 2592 | } |
| 2593 | |
| 2594 | static struct msm_serial_hs_platform_data mpq8064_gsbi6_uartdm_pdata = { |
| 2595 | .inject_rx_on_wakeup = 1, |
| 2596 | .rx_to_inject = 0xFD, |
| 2597 | .gpio_config = configure_uart_gpios, |
| 2598 | }; |
| 2599 | #else |
| 2600 | static struct msm_serial_hs_platform_data msm_uart_dm9_pdata; |
| 2601 | #endif |
| 2602 | |
Jay Chokshi | 1b7eaa9 | 2012-04-04 14:53:14 -0700 | [diff] [blame] | 2603 | static struct platform_device *mpq_devices[] __initdata = { |
| 2604 | &msm_device_sps_apq8064, |
| 2605 | &mpq8064_device_qup_i2c_gsbi5, |
| 2606 | #ifdef CONFIG_MSM_ROTATOR |
| 2607 | &msm_rotator_device, |
| 2608 | #endif |
Ravi Kumar V | 05931a2 | 2012-04-04 17:09:37 +0530 | [diff] [blame] | 2609 | &gpio_ir_recv_pdev, |
Jay Chokshi | 1b7eaa9 | 2012-04-04 14:53:14 -0700 | [diff] [blame] | 2610 | &mpq8064_device_ext_1p2_buck_vreg, |
| 2611 | &mpq8064_device_ext_1p8_buck_vreg, |
| 2612 | &mpq8064_device_ext_2p2_buck_vreg, |
| 2613 | &mpq8064_device_ext_5v_buck_vreg, |
| 2614 | &mpq8064_device_ext_3p3v_ldo_vreg, |
Terence Hampson | 2e1705f | 2012-04-11 19:55:29 -0400 | [diff] [blame] | 2615 | #ifdef CONFIG_MSM_VCAP |
| 2616 | &msm8064_device_vcap, |
| 2617 | #endif |
Ravi Kumar V | 1c90301 | 2012-05-15 16:11:35 +0530 | [diff] [blame] | 2618 | &rc_input_loopback_pdev, |
Jay Chokshi | 1b7eaa9 | 2012-04-04 14:53:14 -0700 | [diff] [blame] | 2619 | }; |
| 2620 | |
Harini Jayaraman | c4c5869 | 2011-07-19 14:50:10 -0600 | [diff] [blame] | 2621 | static struct msm_spi_platform_data apq8064_qup_spi_gsbi5_pdata = { |
Stepan Moskovchenko | c71c979 | 2012-01-31 18:12:44 -0800 | [diff] [blame] | 2622 | .max_clock_speed = 1100000, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2623 | }; |
| 2624 | |
Stepan Moskovchenko | eed82a5 | 2011-09-02 13:19:23 -0700 | [diff] [blame] | 2625 | #define KS8851_IRQ_GPIO 43 |
| 2626 | |
| 2627 | static struct spi_board_info spi_board_info[] __initdata = { |
| 2628 | { |
| 2629 | .modalias = "ks8851", |
| 2630 | .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO), |
| 2631 | .max_speed_hz = 19200000, |
| 2632 | .bus_num = 0, |
| 2633 | .chip_select = 2, |
| 2634 | .mode = SPI_MODE_0, |
| 2635 | }, |
Siddartha Mohanadoss | b9df494 | 2012-02-08 09:58:21 -0800 | [diff] [blame] | 2636 | { |
| 2637 | .modalias = "epm_adc", |
| 2638 | .max_speed_hz = 1100000, |
| 2639 | .bus_num = 0, |
| 2640 | .chip_select = 3, |
| 2641 | .mode = SPI_MODE_0, |
| 2642 | }, |
Stepan Moskovchenko | eed82a5 | 2011-09-02 13:19:23 -0700 | [diff] [blame] | 2643 | }; |
| 2644 | |
Sagar Dharia | 8bdcdaf | 2011-09-16 16:01:15 -0600 | [diff] [blame] | 2645 | static struct slim_boardinfo apq8064_slim_devices[] = { |
Swaminathan Sathappan | 2f51a75 | 2011-12-05 12:51:19 -0800 | [diff] [blame] | 2646 | { |
Swaminathan Sathappan | cef966d | 2011-12-15 17:27:04 -0800 | [diff] [blame] | 2647 | .bus_num = 1, |
| 2648 | .slim_slave = &apq8064_slim_tabla, |
| 2649 | }, |
| 2650 | { |
| 2651 | .bus_num = 1, |
| 2652 | .slim_slave = &apq8064_slim_tabla20, |
Swaminathan Sathappan | 2f51a75 | 2011-12-05 12:51:19 -0800 | [diff] [blame] | 2653 | }, |
| 2654 | /* add more slimbus slaves as needed */ |
Sagar Dharia | 8bdcdaf | 2011-09-16 16:01:15 -0600 | [diff] [blame] | 2655 | }; |
| 2656 | |
David Keitel | 3c40fc5 | 2012-02-09 17:53:52 -0800 | [diff] [blame] | 2657 | static struct msm_i2c_platform_data apq8064_i2c_qup_gsbi1_pdata = { |
| 2658 | .clk_freq = 100000, |
| 2659 | .src_clk_rate = 24000000, |
| 2660 | }; |
| 2661 | |
Jing Lin | 04601f9 | 2012-02-05 15:36:07 -0800 | [diff] [blame] | 2662 | static struct msm_i2c_platform_data apq8064_i2c_qup_gsbi3_pdata = { |
Anirudh Ghayal | c216347 | 2012-04-10 14:58:14 +0530 | [diff] [blame] | 2663 | .clk_freq = 384000, |
Jing Lin | 04601f9 | 2012-02-05 15:36:07 -0800 | [diff] [blame] | 2664 | .src_clk_rate = 24000000, |
| 2665 | }; |
| 2666 | |
Kenneth Heitke | 748593a | 2011-07-15 15:45:11 -0600 | [diff] [blame] | 2667 | static struct msm_i2c_platform_data apq8064_i2c_qup_gsbi4_pdata = { |
| 2668 | .clk_freq = 100000, |
| 2669 | .src_clk_rate = 24000000, |
Kenneth Heitke | 748593a | 2011-07-15 15:45:11 -0600 | [diff] [blame] | 2670 | }; |
| 2671 | |
Joel King | 8f839b9 | 2012-04-01 14:37:46 -0700 | [diff] [blame] | 2672 | static struct msm_i2c_platform_data mpq8064_i2c_qup_gsbi5_pdata = { |
| 2673 | .clk_freq = 100000, |
| 2674 | .src_clk_rate = 24000000, |
| 2675 | }; |
| 2676 | |
David Keitel | 3c40fc5 | 2012-02-09 17:53:52 -0800 | [diff] [blame] | 2677 | #define GSBI_DUAL_MODE_CODE 0x60 |
| 2678 | #define MSM_GSBI1_PHYS 0x12440000 |
Kenneth Heitke | 748593a | 2011-07-15 15:45:11 -0600 | [diff] [blame] | 2679 | static void __init apq8064_i2c_init(void) |
| 2680 | { |
David Keitel | 3c40fc5 | 2012-02-09 17:53:52 -0800 | [diff] [blame] | 2681 | void __iomem *gsbi_mem; |
| 2682 | |
| 2683 | apq8064_device_qup_i2c_gsbi1.dev.platform_data = |
| 2684 | &apq8064_i2c_qup_gsbi1_pdata; |
| 2685 | gsbi_mem = ioremap_nocache(MSM_GSBI1_PHYS, 4); |
| 2686 | writel_relaxed(GSBI_DUAL_MODE_CODE, gsbi_mem); |
| 2687 | /* Ensure protocol code is written before proceeding */ |
| 2688 | wmb(); |
| 2689 | iounmap(gsbi_mem); |
| 2690 | apq8064_i2c_qup_gsbi1_pdata.use_gsbi_shared_mode = 1; |
Jing Lin | 04601f9 | 2012-02-05 15:36:07 -0800 | [diff] [blame] | 2691 | apq8064_device_qup_i2c_gsbi3.dev.platform_data = |
| 2692 | &apq8064_i2c_qup_gsbi3_pdata; |
Siddartha Mohanadoss | b9df494 | 2012-02-08 09:58:21 -0800 | [diff] [blame] | 2693 | apq8064_device_qup_i2c_gsbi1.dev.platform_data = |
| 2694 | &apq8064_i2c_qup_gsbi1_pdata; |
Kenneth Heitke | 748593a | 2011-07-15 15:45:11 -0600 | [diff] [blame] | 2695 | apq8064_device_qup_i2c_gsbi4.dev.platform_data = |
| 2696 | &apq8064_i2c_qup_gsbi4_pdata; |
Joel King | 8f839b9 | 2012-04-01 14:37:46 -0700 | [diff] [blame] | 2697 | mpq8064_device_qup_i2c_gsbi5.dev.platform_data = |
| 2698 | &mpq8064_i2c_qup_gsbi5_pdata; |
Kenneth Heitke | 748593a | 2011-07-15 15:45:11 -0600 | [diff] [blame] | 2699 | } |
| 2700 | |
Stepan Moskovchenko | c71c979 | 2012-01-31 18:12:44 -0800 | [diff] [blame] | 2701 | #if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE) |
Stepan Moskovchenko | eed82a5 | 2011-09-02 13:19:23 -0700 | [diff] [blame] | 2702 | static int ethernet_init(void) |
| 2703 | { |
| 2704 | int ret; |
| 2705 | ret = gpio_request(KS8851_IRQ_GPIO, "ks8851_irq"); |
| 2706 | if (ret) { |
| 2707 | pr_err("ks8851 gpio_request failed: %d\n", ret); |
| 2708 | goto fail; |
| 2709 | } |
| 2710 | |
| 2711 | return 0; |
| 2712 | fail: |
| 2713 | return ret; |
| 2714 | } |
| 2715 | #else |
| 2716 | static int ethernet_init(void) |
| 2717 | { |
| 2718 | return 0; |
| 2719 | } |
| 2720 | #endif |
| 2721 | |
David Collins | d49a1c5 | 2012-08-22 13:18:06 -0700 | [diff] [blame] | 2722 | #define GPIO_KEY_HOME PM8921_GPIO_PM_TO_SYS(27) |
| 2723 | #define GPIO_KEY_VOLUME_UP PM8921_GPIO_PM_TO_SYS(35) |
| 2724 | #define GPIO_KEY_VOLUME_DOWN_PM8921 PM8921_GPIO_PM_TO_SYS(38) |
| 2725 | #define GPIO_KEY_VOLUME_DOWN_PM8917 PM8921_GPIO_PM_TO_SYS(30) |
| 2726 | #define GPIO_KEY_CAM_FOCUS PM8921_GPIO_PM_TO_SYS(3) |
| 2727 | #define GPIO_KEY_CAM_SNAP PM8921_GPIO_PM_TO_SYS(4) |
| 2728 | #define GPIO_KEY_ROTATION_PM8921 PM8921_GPIO_PM_TO_SYS(42) |
| 2729 | #define GPIO_KEY_ROTATION_PM8917 PM8921_GPIO_PM_TO_SYS(8) |
Mohan Pallaka | 474b94b | 2012-01-25 12:59:58 +0530 | [diff] [blame] | 2730 | |
David Collins | d49a1c5 | 2012-08-22 13:18:06 -0700 | [diff] [blame] | 2731 | static struct gpio_keys_button cdp_keys_pm8921[] = { |
Mohan Pallaka | 474b94b | 2012-01-25 12:59:58 +0530 | [diff] [blame] | 2732 | { |
| 2733 | .code = KEY_HOME, |
| 2734 | .gpio = GPIO_KEY_HOME, |
| 2735 | .desc = "home_key", |
| 2736 | .active_low = 1, |
| 2737 | .type = EV_KEY, |
| 2738 | .wakeup = 1, |
| 2739 | .debounce_interval = 15, |
| 2740 | }, |
| 2741 | { |
| 2742 | .code = KEY_VOLUMEUP, |
| 2743 | .gpio = GPIO_KEY_VOLUME_UP, |
| 2744 | .desc = "volume_up_key", |
| 2745 | .active_low = 1, |
| 2746 | .type = EV_KEY, |
| 2747 | .wakeup = 1, |
| 2748 | .debounce_interval = 15, |
| 2749 | }, |
| 2750 | { |
| 2751 | .code = KEY_VOLUMEDOWN, |
David Collins | d49a1c5 | 2012-08-22 13:18:06 -0700 | [diff] [blame] | 2752 | .gpio = GPIO_KEY_VOLUME_DOWN_PM8921, |
Mohan Pallaka | 474b94b | 2012-01-25 12:59:58 +0530 | [diff] [blame] | 2753 | .desc = "volume_down_key", |
| 2754 | .active_low = 1, |
| 2755 | .type = EV_KEY, |
| 2756 | .wakeup = 1, |
| 2757 | .debounce_interval = 15, |
| 2758 | }, |
| 2759 | { |
| 2760 | .code = SW_ROTATE_LOCK, |
David Collins | d49a1c5 | 2012-08-22 13:18:06 -0700 | [diff] [blame] | 2761 | .gpio = GPIO_KEY_ROTATION_PM8921, |
| 2762 | .desc = "rotate_key", |
| 2763 | .active_low = 1, |
| 2764 | .type = EV_SW, |
| 2765 | .debounce_interval = 15, |
| 2766 | }, |
| 2767 | }; |
| 2768 | |
| 2769 | static struct gpio_keys_button cdp_keys_pm8917[] = { |
| 2770 | { |
| 2771 | .code = KEY_HOME, |
| 2772 | .gpio = GPIO_KEY_HOME, |
| 2773 | .desc = "home_key", |
| 2774 | .active_low = 1, |
| 2775 | .type = EV_KEY, |
| 2776 | .wakeup = 1, |
| 2777 | .debounce_interval = 15, |
| 2778 | }, |
| 2779 | { |
| 2780 | .code = KEY_VOLUMEUP, |
| 2781 | .gpio = GPIO_KEY_VOLUME_UP, |
| 2782 | .desc = "volume_up_key", |
| 2783 | .active_low = 1, |
| 2784 | .type = EV_KEY, |
| 2785 | .wakeup = 1, |
| 2786 | .debounce_interval = 15, |
| 2787 | }, |
| 2788 | { |
| 2789 | .code = KEY_VOLUMEDOWN, |
| 2790 | .gpio = GPIO_KEY_VOLUME_DOWN_PM8917, |
| 2791 | .desc = "volume_down_key", |
| 2792 | .active_low = 1, |
| 2793 | .type = EV_KEY, |
| 2794 | .wakeup = 1, |
| 2795 | .debounce_interval = 15, |
| 2796 | }, |
| 2797 | { |
| 2798 | .code = SW_ROTATE_LOCK, |
| 2799 | .gpio = GPIO_KEY_ROTATION_PM8917, |
Mohan Pallaka | 474b94b | 2012-01-25 12:59:58 +0530 | [diff] [blame] | 2800 | .desc = "rotate_key", |
| 2801 | .active_low = 1, |
| 2802 | .type = EV_SW, |
| 2803 | .debounce_interval = 15, |
| 2804 | }, |
| 2805 | }; |
| 2806 | |
| 2807 | static struct gpio_keys_platform_data cdp_keys_data = { |
David Collins | d49a1c5 | 2012-08-22 13:18:06 -0700 | [diff] [blame] | 2808 | .buttons = cdp_keys_pm8921, |
| 2809 | .nbuttons = ARRAY_SIZE(cdp_keys_pm8921), |
Mohan Pallaka | 474b94b | 2012-01-25 12:59:58 +0530 | [diff] [blame] | 2810 | }; |
| 2811 | |
| 2812 | static struct platform_device cdp_kp_pdev = { |
| 2813 | .name = "gpio-keys", |
| 2814 | .id = -1, |
| 2815 | .dev = { |
| 2816 | .platform_data = &cdp_keys_data, |
| 2817 | }, |
| 2818 | }; |
| 2819 | |
| 2820 | static struct gpio_keys_button mtp_keys[] = { |
| 2821 | { |
| 2822 | .code = KEY_CAMERA_FOCUS, |
| 2823 | .gpio = GPIO_KEY_CAM_FOCUS, |
| 2824 | .desc = "cam_focus_key", |
| 2825 | .active_low = 1, |
| 2826 | .type = EV_KEY, |
| 2827 | .wakeup = 1, |
| 2828 | .debounce_interval = 15, |
| 2829 | }, |
| 2830 | { |
| 2831 | .code = KEY_VOLUMEUP, |
| 2832 | .gpio = GPIO_KEY_VOLUME_UP, |
| 2833 | .desc = "volume_up_key", |
| 2834 | .active_low = 1, |
| 2835 | .type = EV_KEY, |
| 2836 | .wakeup = 1, |
| 2837 | .debounce_interval = 15, |
| 2838 | }, |
| 2839 | { |
| 2840 | .code = KEY_VOLUMEDOWN, |
David Collins | d49a1c5 | 2012-08-22 13:18:06 -0700 | [diff] [blame] | 2841 | .gpio = GPIO_KEY_VOLUME_DOWN_PM8921, |
Mohan Pallaka | 474b94b | 2012-01-25 12:59:58 +0530 | [diff] [blame] | 2842 | .desc = "volume_down_key", |
| 2843 | .active_low = 1, |
| 2844 | .type = EV_KEY, |
| 2845 | .wakeup = 1, |
| 2846 | .debounce_interval = 15, |
| 2847 | }, |
| 2848 | { |
| 2849 | .code = KEY_CAMERA_SNAPSHOT, |
| 2850 | .gpio = GPIO_KEY_CAM_SNAP, |
| 2851 | .desc = "cam_snap_key", |
| 2852 | .active_low = 1, |
| 2853 | .type = EV_KEY, |
| 2854 | .debounce_interval = 15, |
| 2855 | }, |
| 2856 | }; |
| 2857 | |
| 2858 | static struct gpio_keys_platform_data mtp_keys_data = { |
| 2859 | .buttons = mtp_keys, |
| 2860 | .nbuttons = ARRAY_SIZE(mtp_keys), |
| 2861 | }; |
| 2862 | |
| 2863 | static struct platform_device mtp_kp_pdev = { |
| 2864 | .name = "gpio-keys", |
| 2865 | .id = -1, |
| 2866 | .dev = { |
| 2867 | .platform_data = &mtp_keys_data, |
| 2868 | }, |
| 2869 | }; |
| 2870 | |
Anirudh Ghayal | 32ea625 | 2012-04-26 16:39:50 +0530 | [diff] [blame] | 2871 | static struct gpio_keys_button mpq_keys[] = { |
| 2872 | { |
| 2873 | .code = KEY_VOLUMEDOWN, |
David Collins | d49a1c5 | 2012-08-22 13:18:06 -0700 | [diff] [blame] | 2874 | .gpio = GPIO_KEY_VOLUME_DOWN_PM8921, |
Anirudh Ghayal | 32ea625 | 2012-04-26 16:39:50 +0530 | [diff] [blame] | 2875 | .desc = "volume_down_key", |
| 2876 | .active_low = 1, |
| 2877 | .type = EV_KEY, |
| 2878 | .wakeup = 1, |
| 2879 | .debounce_interval = 15, |
| 2880 | }, |
| 2881 | { |
| 2882 | .code = KEY_VOLUMEUP, |
| 2883 | .gpio = GPIO_KEY_VOLUME_UP, |
| 2884 | .desc = "volume_up_key", |
| 2885 | .active_low = 1, |
| 2886 | .type = EV_KEY, |
| 2887 | .wakeup = 1, |
| 2888 | .debounce_interval = 15, |
| 2889 | }, |
| 2890 | }; |
| 2891 | |
| 2892 | static struct gpio_keys_platform_data mpq_keys_data = { |
| 2893 | .buttons = mpq_keys, |
| 2894 | .nbuttons = ARRAY_SIZE(mpq_keys), |
| 2895 | }; |
| 2896 | |
| 2897 | static struct platform_device mpq_gpio_keys_pdev = { |
| 2898 | .name = "gpio-keys", |
| 2899 | .id = -1, |
| 2900 | .dev = { |
| 2901 | .platform_data = &mpq_keys_data, |
| 2902 | }, |
| 2903 | }; |
| 2904 | |
| 2905 | #define MPQ_KP_ROW_BASE SX150X_EXP2_GPIO_BASE |
| 2906 | #define MPQ_KP_COL_BASE (SX150X_EXP2_GPIO_BASE + 4) |
| 2907 | |
| 2908 | static unsigned int mpq_row_gpios[] = {MPQ_KP_ROW_BASE, MPQ_KP_ROW_BASE + 1, |
| 2909 | MPQ_KP_ROW_BASE + 2, MPQ_KP_ROW_BASE + 3}; |
| 2910 | static unsigned int mpq_col_gpios[] = {MPQ_KP_COL_BASE, MPQ_KP_COL_BASE + 1, |
| 2911 | MPQ_KP_COL_BASE + 2}; |
| 2912 | |
| 2913 | static const unsigned int mpq_keymap[] = { |
| 2914 | KEY(0, 0, KEY_UP), |
| 2915 | KEY(0, 1, KEY_ENTER), |
| 2916 | KEY(0, 2, KEY_3), |
| 2917 | |
| 2918 | KEY(1, 0, KEY_DOWN), |
| 2919 | KEY(1, 1, KEY_EXIT), |
| 2920 | KEY(1, 2, KEY_4), |
| 2921 | |
| 2922 | KEY(2, 0, KEY_LEFT), |
| 2923 | KEY(2, 1, KEY_1), |
| 2924 | KEY(2, 2, KEY_5), |
| 2925 | |
| 2926 | KEY(3, 0, KEY_RIGHT), |
| 2927 | KEY(3, 1, KEY_2), |
| 2928 | KEY(3, 2, KEY_6), |
| 2929 | }; |
| 2930 | |
| 2931 | static struct matrix_keymap_data mpq_keymap_data = { |
| 2932 | .keymap_size = ARRAY_SIZE(mpq_keymap), |
| 2933 | .keymap = mpq_keymap, |
| 2934 | }; |
| 2935 | |
| 2936 | static struct matrix_keypad_platform_data mpq_keypad_data = { |
| 2937 | .keymap_data = &mpq_keymap_data, |
| 2938 | .row_gpios = mpq_row_gpios, |
| 2939 | .col_gpios = mpq_col_gpios, |
| 2940 | .num_row_gpios = ARRAY_SIZE(mpq_row_gpios), |
| 2941 | .num_col_gpios = ARRAY_SIZE(mpq_col_gpios), |
| 2942 | .col_scan_delay_us = 32000, |
| 2943 | .debounce_ms = 20, |
| 2944 | .wakeup = 1, |
| 2945 | .active_low = 1, |
| 2946 | .no_autorepeat = 1, |
| 2947 | }; |
| 2948 | |
| 2949 | static struct platform_device mpq_keypad_device = { |
| 2950 | .name = "matrix-keypad", |
| 2951 | .id = -1, |
| 2952 | .dev = { |
| 2953 | .platform_data = &mpq_keypad_data, |
| 2954 | }, |
| 2955 | }; |
| 2956 | |
Jin Hong | d3024e6 | 2012-02-09 16:13:32 -0800 | [diff] [blame] | 2957 | /* Sensors DSPS platform data */ |
| 2958 | #define DSPS_PIL_GENERIC_NAME "dsps" |
| 2959 | static void __init apq8064_init_dsps(void) |
| 2960 | { |
| 2961 | struct msm_dsps_platform_data *pdata = |
| 2962 | msm_dsps_device_8064.dev.platform_data; |
| 2963 | pdata->pil_name = DSPS_PIL_GENERIC_NAME; |
| 2964 | pdata->gpios = NULL; |
| 2965 | pdata->gpios_num = 0; |
| 2966 | |
| 2967 | platform_device_register(&msm_dsps_device_8064); |
| 2968 | } |
Mohan Pallaka | 474b94b | 2012-01-25 12:59:58 +0530 | [diff] [blame] | 2969 | |
Jing Lin | 417fa45 | 2012-02-05 14:31:06 -0800 | [diff] [blame] | 2970 | #define I2C_SURF 1 |
| 2971 | #define I2C_FFA (1 << 1) |
| 2972 | #define I2C_RUMI (1 << 2) |
| 2973 | #define I2C_SIM (1 << 3) |
| 2974 | #define I2C_LIQUID (1 << 4) |
Jay Chokshi | e7d8d4f | 2012-04-04 14:47:57 -0700 | [diff] [blame] | 2975 | #define I2C_MPQ_CDP BIT(5) |
| 2976 | #define I2C_MPQ_HRD BIT(6) |
| 2977 | #define I2C_MPQ_DTV BIT(7) |
Jing Lin | 417fa45 | 2012-02-05 14:31:06 -0800 | [diff] [blame] | 2978 | |
| 2979 | struct i2c_registry { |
| 2980 | u8 machs; |
| 2981 | int bus; |
| 2982 | struct i2c_board_info *info; |
| 2983 | int len; |
| 2984 | }; |
| 2985 | |
| 2986 | static struct i2c_registry apq8064_i2c_devices[] __initdata = { |
Jing Lin | 21ed4de | 2012-02-05 15:53:28 -0800 | [diff] [blame] | 2987 | { |
David Keitel | 2f613d9 | 2012-02-15 11:29:16 -0800 | [diff] [blame] | 2988 | I2C_LIQUID, |
| 2989 | APQ_8064_GSBI1_QUP_I2C_BUS_ID, |
| 2990 | smb349_charger_i2c_info, |
| 2991 | ARRAY_SIZE(smb349_charger_i2c_info) |
| 2992 | }, |
| 2993 | { |
Jing Lin | 21ed4de | 2012-02-05 15:53:28 -0800 | [diff] [blame] | 2994 | I2C_SURF | I2C_LIQUID, |
| 2995 | APQ_8064_GSBI3_QUP_I2C_BUS_ID, |
| 2996 | mxt_device_info, |
| 2997 | ARRAY_SIZE(mxt_device_info), |
| 2998 | }, |
Anirudh Ghayal | 2917a5a | 2012-02-05 19:51:07 -0800 | [diff] [blame] | 2999 | { |
| 3000 | I2C_FFA, |
| 3001 | APQ_8064_GSBI3_QUP_I2C_BUS_ID, |
| 3002 | cyttsp_info, |
| 3003 | ARRAY_SIZE(cyttsp_info), |
| 3004 | }, |
Amy Maloche | 70090f99 | 2012-02-16 16:35:26 -0800 | [diff] [blame] | 3005 | { |
| 3006 | I2C_FFA | I2C_LIQUID, |
| 3007 | APQ_8064_GSBI1_QUP_I2C_BUS_ID, |
| 3008 | isa1200_board_info, |
| 3009 | ARRAY_SIZE(isa1200_board_info), |
| 3010 | }, |
Santosh Mardi | eff9a74 | 2012-04-09 23:23:39 +0530 | [diff] [blame] | 3011 | { |
| 3012 | I2C_MPQ_CDP, |
| 3013 | APQ_8064_GSBI5_QUP_I2C_BUS_ID, |
| 3014 | cs8427_device_info, |
| 3015 | ARRAY_SIZE(cs8427_device_info), |
| 3016 | }, |
Abhishek Kharbanda | 72dc72e | 2012-06-07 13:41:37 -0700 | [diff] [blame] | 3017 | { |
| 3018 | I2C_SURF | I2C_FFA | I2C_LIQUID, |
| 3019 | APQ_8064_GSBI1_QUP_I2C_BUS_ID, |
| 3020 | sii_device_info, |
| 3021 | ARRAY_SIZE(sii_device_info), |
| 3022 | } |
Jing Lin | 417fa45 | 2012-02-05 14:31:06 -0800 | [diff] [blame] | 3023 | }; |
| 3024 | |
Kuirong Wang | f8c5e14 | 2012-06-21 16:17:32 -0700 | [diff] [blame] | 3025 | static struct i2c_registry apq8064_tabla_i2c_devices[] __initdata = { |
| 3026 | { |
| 3027 | .bus = APQ_8064_GSBI1_QUP_I2C_BUS_ID, |
| 3028 | .info = apq8064_tabla_i2c_device_info, |
| 3029 | .len = ARRAY_SIZE(apq8064_tabla_i2c_device_info), |
| 3030 | }, |
| 3031 | }; |
| 3032 | |
Jay Chokshi | 607f61b | 2012-04-25 18:21:21 -0700 | [diff] [blame] | 3033 | #define SX150X_EXP1_INT_N PM8921_MPP_IRQ(PM8921_IRQ_BASE, 9) |
Anirudh Ghayal | 9f1aaa7 | 2012-04-26 18:15:08 +0530 | [diff] [blame] | 3034 | #define SX150X_EXP2_INT_N MSM_GPIO_TO_INT(81) |
Jay Chokshi | 607f61b | 2012-04-25 18:21:21 -0700 | [diff] [blame] | 3035 | |
Jay Chokshi | e7d8d4f | 2012-04-04 14:47:57 -0700 | [diff] [blame] | 3036 | struct sx150x_platform_data mpq8064_sx150x_pdata[] = { |
| 3037 | [SX150X_EXP1] = { |
| 3038 | .gpio_base = SX150X_EXP1_GPIO_BASE, |
| 3039 | .oscio_is_gpo = false, |
| 3040 | .io_pullup_ena = 0x0, |
| 3041 | .io_pulldn_ena = 0x0, |
| 3042 | .io_open_drain_ena = 0x0, |
| 3043 | .io_polarity = 0, |
Jay Chokshi | 607f61b | 2012-04-25 18:21:21 -0700 | [diff] [blame] | 3044 | .irq_summary = SX150X_EXP1_INT_N, |
| 3045 | .irq_base = SX150X_EXP1_IRQ_BASE, |
Jay Chokshi | e7d8d4f | 2012-04-04 14:47:57 -0700 | [diff] [blame] | 3046 | }, |
| 3047 | [SX150X_EXP2] = { |
| 3048 | .gpio_base = SX150X_EXP2_GPIO_BASE, |
| 3049 | .oscio_is_gpo = false, |
Anirudh Ghayal | 32ea625 | 2012-04-26 16:39:50 +0530 | [diff] [blame] | 3050 | .io_pullup_ena = 0x0f, |
| 3051 | .io_pulldn_ena = 0x70, |
Jay Chokshi | e7d8d4f | 2012-04-04 14:47:57 -0700 | [diff] [blame] | 3052 | .io_open_drain_ena = 0x0, |
| 3053 | .io_polarity = 0, |
Anirudh Ghayal | 9f1aaa7 | 2012-04-26 18:15:08 +0530 | [diff] [blame] | 3054 | .irq_summary = SX150X_EXP2_INT_N, |
| 3055 | .irq_base = SX150X_EXP2_IRQ_BASE, |
Jay Chokshi | e7d8d4f | 2012-04-04 14:47:57 -0700 | [diff] [blame] | 3056 | }, |
| 3057 | [SX150X_EXP3] = { |
| 3058 | .gpio_base = SX150X_EXP3_GPIO_BASE, |
| 3059 | .oscio_is_gpo = false, |
| 3060 | .io_pullup_ena = 0x0, |
| 3061 | .io_pulldn_ena = 0x0, |
| 3062 | .io_open_drain_ena = 0x0, |
| 3063 | .io_polarity = 0, |
| 3064 | .irq_summary = -1, |
| 3065 | }, |
| 3066 | [SX150X_EXP4] = { |
| 3067 | .gpio_base = SX150X_EXP4_GPIO_BASE, |
| 3068 | .oscio_is_gpo = false, |
| 3069 | .io_pullup_ena = 0x0, |
| 3070 | .io_pulldn_ena = 0x0, |
| 3071 | .io_open_drain_ena = 0x0, |
| 3072 | .io_polarity = 0, |
| 3073 | .irq_summary = -1, |
| 3074 | }, |
| 3075 | }; |
| 3076 | |
| 3077 | static struct i2c_board_info sx150x_gpio_exp_info[] = { |
| 3078 | { |
| 3079 | I2C_BOARD_INFO("sx1509q", 0x70), |
| 3080 | .platform_data = &mpq8064_sx150x_pdata[SX150X_EXP1], |
| 3081 | }, |
| 3082 | { |
| 3083 | I2C_BOARD_INFO("sx1508q", 0x23), |
| 3084 | .platform_data = &mpq8064_sx150x_pdata[SX150X_EXP2], |
| 3085 | }, |
| 3086 | { |
| 3087 | I2C_BOARD_INFO("sx1508q", 0x22), |
| 3088 | .platform_data = &mpq8064_sx150x_pdata[SX150X_EXP3], |
| 3089 | }, |
| 3090 | { |
| 3091 | I2C_BOARD_INFO("sx1509q", 0x3E), |
| 3092 | .platform_data = &mpq8064_sx150x_pdata[SX150X_EXP4], |
| 3093 | }, |
| 3094 | }; |
| 3095 | |
| 3096 | #define MPQ8064_I2C_GSBI5_BUS_ID 5 |
| 3097 | |
| 3098 | static struct i2c_registry mpq8064_i2c_devices[] __initdata = { |
| 3099 | { |
| 3100 | I2C_MPQ_CDP, |
| 3101 | MPQ8064_I2C_GSBI5_BUS_ID, |
| 3102 | sx150x_gpio_exp_info, |
| 3103 | ARRAY_SIZE(sx150x_gpio_exp_info), |
| 3104 | }, |
| 3105 | }; |
| 3106 | |
Jing Lin | 417fa45 | 2012-02-05 14:31:06 -0800 | [diff] [blame] | 3107 | static void __init register_i2c_devices(void) |
| 3108 | { |
| 3109 | u8 mach_mask = 0; |
| 3110 | int i; |
Kuirong Wang | f8c5e14 | 2012-06-21 16:17:32 -0700 | [diff] [blame] | 3111 | u32 version; |
Jing Lin | 417fa45 | 2012-02-05 14:31:06 -0800 | [diff] [blame] | 3112 | |
Kevin Chan | d07220e | 2012-02-13 15:52:22 -0800 | [diff] [blame] | 3113 | #ifdef CONFIG_MSM_CAMERA |
| 3114 | struct i2c_registry apq8064_camera_i2c_devices = { |
| 3115 | I2C_SURF | I2C_FFA | I2C_LIQUID | I2C_RUMI, |
| 3116 | APQ_8064_GSBI4_QUP_I2C_BUS_ID, |
| 3117 | apq8064_camera_board_info.board_info, |
| 3118 | apq8064_camera_board_info.num_i2c_board_info, |
| 3119 | }; |
| 3120 | #endif |
Jing Lin | 417fa45 | 2012-02-05 14:31:06 -0800 | [diff] [blame] | 3121 | /* Build the matching 'supported_machs' bitmask */ |
| 3122 | if (machine_is_apq8064_cdp()) |
| 3123 | mach_mask = I2C_SURF; |
| 3124 | else if (machine_is_apq8064_mtp()) |
| 3125 | mach_mask = I2C_FFA; |
| 3126 | else if (machine_is_apq8064_liquid()) |
| 3127 | mach_mask = I2C_LIQUID; |
Jay Chokshi | e7d8d4f | 2012-04-04 14:47:57 -0700 | [diff] [blame] | 3128 | else if (PLATFORM_IS_MPQ8064()) |
| 3129 | mach_mask = I2C_MPQ_CDP; |
Jing Lin | 417fa45 | 2012-02-05 14:31:06 -0800 | [diff] [blame] | 3130 | else |
| 3131 | pr_err("unmatched machine ID in register_i2c_devices\n"); |
| 3132 | |
| 3133 | /* Run the array and install devices as appropriate */ |
| 3134 | for (i = 0; i < ARRAY_SIZE(apq8064_i2c_devices); ++i) { |
| 3135 | if (apq8064_i2c_devices[i].machs & mach_mask) |
| 3136 | i2c_register_board_info(apq8064_i2c_devices[i].bus, |
| 3137 | apq8064_i2c_devices[i].info, |
| 3138 | apq8064_i2c_devices[i].len); |
| 3139 | } |
Kevin Chan | d07220e | 2012-02-13 15:52:22 -0800 | [diff] [blame] | 3140 | #ifdef CONFIG_MSM_CAMERA |
| 3141 | if (apq8064_camera_i2c_devices.machs & mach_mask) |
| 3142 | i2c_register_board_info(apq8064_camera_i2c_devices.bus, |
| 3143 | apq8064_camera_i2c_devices.info, |
| 3144 | apq8064_camera_i2c_devices.len); |
| 3145 | #endif |
Jay Chokshi | e7d8d4f | 2012-04-04 14:47:57 -0700 | [diff] [blame] | 3146 | |
| 3147 | for (i = 0; i < ARRAY_SIZE(mpq8064_i2c_devices); ++i) { |
| 3148 | if (mpq8064_i2c_devices[i].machs & mach_mask) |
| 3149 | i2c_register_board_info( |
| 3150 | mpq8064_i2c_devices[i].bus, |
| 3151 | mpq8064_i2c_devices[i].info, |
| 3152 | mpq8064_i2c_devices[i].len); |
| 3153 | } |
Kuirong Wang | f8c5e14 | 2012-06-21 16:17:32 -0700 | [diff] [blame] | 3154 | |
| 3155 | if (machine_is_apq8064_mtp()) { |
| 3156 | version = socinfo_get_platform_version(); |
| 3157 | if (SOCINFO_VERSION_MINOR(version) == 1) |
| 3158 | for (i = 0; i < ARRAY_SIZE(apq8064_tabla_i2c_devices); |
| 3159 | ++i) |
| 3160 | i2c_register_board_info( |
| 3161 | apq8064_tabla_i2c_devices[i].bus, |
| 3162 | apq8064_tabla_i2c_devices[i].info, |
| 3163 | apq8064_tabla_i2c_devices[i].len); |
| 3164 | } |
| 3165 | |
Jing Lin | 417fa45 | 2012-02-05 14:31:06 -0800 | [diff] [blame] | 3166 | } |
| 3167 | |
Jay Chokshi | 994ff12 | 2012-03-27 15:43:48 -0700 | [diff] [blame] | 3168 | static void enable_ddr3_regulator(void) |
| 3169 | { |
| 3170 | static struct regulator *ext_ddr3; |
| 3171 | |
| 3172 | /* Use MPP7 output state as a flag for PCDDR3 presence. */ |
| 3173 | if (gpio_get_value_cansleep(PM8921_MPP_PM_TO_SYS(7)) > 0) { |
| 3174 | ext_ddr3 = regulator_get(NULL, "ext_ddr3"); |
| 3175 | if (IS_ERR(ext_ddr3) || ext_ddr3 == NULL) |
| 3176 | pr_err("Could not get MPP7 regulator\n"); |
| 3177 | else |
| 3178 | regulator_enable(ext_ddr3); |
| 3179 | } |
| 3180 | } |
| 3181 | |
Jay Chokshi | e7d8d4f | 2012-04-04 14:47:57 -0700 | [diff] [blame] | 3182 | static void enable_avc_i2c_bus(void) |
| 3183 | { |
| 3184 | int avc_i2c_en_mpp = PM8921_MPP_PM_TO_SYS(8); |
| 3185 | int rc; |
| 3186 | |
| 3187 | rc = gpio_request(avc_i2c_en_mpp, "avc_i2c_en"); |
| 3188 | if (rc) |
| 3189 | pr_err("request for avc_i2c_en mpp failed," |
| 3190 | "rc=%d\n", rc); |
| 3191 | else |
| 3192 | gpio_set_value_cansleep(avc_i2c_en_mpp, 1); |
| 3193 | } |
| 3194 | |
David Collins | d49a1c5 | 2012-08-22 13:18:06 -0700 | [diff] [blame] | 3195 | /* Modify platform data values to match requirements for PM8917. */ |
| 3196 | static void __init apq8064_pm8917_pdata_fixup(void) |
| 3197 | { |
| 3198 | cdp_keys_data.buttons = cdp_keys_pm8917; |
| 3199 | cdp_keys_data.nbuttons = ARRAY_SIZE(cdp_keys_pm8917); |
| 3200 | } |
| 3201 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3202 | static void __init apq8064_common_init(void) |
| 3203 | { |
Kuirong Wang | f8c5e14 | 2012-06-21 16:17:32 -0700 | [diff] [blame] | 3204 | u32 platform_version = socinfo_get_platform_version(); |
David Collins | d49a1c5 | 2012-08-22 13:18:06 -0700 | [diff] [blame] | 3205 | |
| 3206 | if (socinfo_get_pmic_model() == PMIC_MODEL_PM8917) |
| 3207 | apq8064_pm8917_pdata_fixup(); |
Rohit Vaswani | b1cc493 | 2012-07-23 21:30:11 -0700 | [diff] [blame] | 3208 | platform_device_register(&msm_gpio_device); |
Joel King | 8f839b9 | 2012-04-01 14:37:46 -0700 | [diff] [blame] | 3209 | msm_tsens_early_init(&apq_tsens_pdata); |
Praveen Chidambaram | 877d7a4 | 2012-06-05 14:33:20 -0600 | [diff] [blame] | 3210 | msm_thermal_init(&msm_thermal_pdata); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3211 | if (socinfo_init() < 0) |
| 3212 | pr_err("socinfo_init() failed!\n"); |
Praveen Chidambaram | 7849901 | 2011-11-01 17:15:17 -0600 | [diff] [blame] | 3213 | BUG_ON(msm_rpm_init(&apq8064_rpm_data)); |
| 3214 | BUG_ON(msm_rpmrs_levels_init(&msm_rpmrs_data)); |
David Collins | 2782b5c | 2012-02-06 10:02:42 -0800 | [diff] [blame] | 3215 | regulator_suppress_info_printing(); |
David Collins | 793793b | 2012-08-21 15:43:02 -0700 | [diff] [blame] | 3216 | if (socinfo_get_pmic_model() == PMIC_MODEL_PM8917) |
| 3217 | configure_apq8064_pm8917_power_grid(); |
David Collins | 2782b5c | 2012-02-06 10:02:42 -0800 | [diff] [blame] | 3218 | platform_device_register(&apq8064_device_rpm_regulator); |
David Collins | 793793b | 2012-08-21 15:43:02 -0700 | [diff] [blame] | 3219 | if (socinfo_get_pmic_model() != PMIC_MODEL_PM8917) |
| 3220 | platform_device_register(&apq8064_pm8921_device_rpm_regulator); |
Stephen Boyd | 4d0d258 | 2012-02-10 14:49:40 -0800 | [diff] [blame] | 3221 | if (msm_xo_init()) |
| 3222 | pr_err("Failed to initialize XO votes\n"); |
Matt Wagantall | c51e560 | 2012-02-27 17:25:25 -0800 | [diff] [blame] | 3223 | msm_clock_init(&apq8064_clock_init_data); |
Stepan Moskovchenko | 2327a95 | 2011-12-14 16:31:28 -0800 | [diff] [blame] | 3224 | apq8064_init_gpiomux(); |
Kenneth Heitke | 748593a | 2011-07-15 15:45:11 -0600 | [diff] [blame] | 3225 | apq8064_i2c_init(); |
Jing Lin | 417fa45 | 2012-02-05 14:31:06 -0800 | [diff] [blame] | 3226 | register_i2c_devices(); |
Kenneth Heitke | 36920d3 | 2011-07-20 16:44:30 -0600 | [diff] [blame] | 3227 | |
Harini Jayaraman | c4c5869 | 2011-07-19 14:50:10 -0600 | [diff] [blame] | 3228 | apq8064_device_qup_spi_gsbi5.dev.platform_data = |
| 3229 | &apq8064_qup_spi_gsbi5_pdata; |
Stepan Moskovchenko | c1074f0 | 2011-12-14 17:51:57 -0800 | [diff] [blame] | 3230 | apq8064_init_pmic(); |
Hemant Kumar | 94e7da2 | 2012-02-03 16:52:29 -0800 | [diff] [blame] | 3231 | if (machine_is_apq8064_liquid()) |
| 3232 | msm_otg_pdata.mhl_enable = true; |
Vamsi Krishna | d9863eb | 2012-03-26 17:34:48 -0700 | [diff] [blame] | 3233 | |
Abhishek Kharbanda | 72dc72e | 2012-06-07 13:41:37 -0700 | [diff] [blame] | 3234 | if (apq8064_mhl_display_enabled()) |
| 3235 | mhl_platform_data.mhl_enabled = true; |
| 3236 | |
Ofir Cohen | 94213a7 | 2012-05-03 14:26:32 +0300 | [diff] [blame] | 3237 | android_usb_pdata.swfi_latency = |
| 3238 | msm_rpmrs_levels[0].latency_us; |
Vamsi Krishna | d9863eb | 2012-03-26 17:34:48 -0700 | [diff] [blame] | 3239 | |
Stepan Moskovchenko | 14aa649 | 2011-08-08 15:15:01 -0700 | [diff] [blame] | 3240 | apq8064_device_otg.dev.platform_data = &msm_otg_pdata; |
Manu Gautam | 91223e0 | 2011-11-08 15:27:22 +0530 | [diff] [blame] | 3241 | apq8064_ehci_host_init(); |
Gagan Mac | 8a7a5d3 | 2011-11-11 16:43:06 -0700 | [diff] [blame] | 3242 | apq8064_init_buses(); |
David Collins | 793793b | 2012-08-21 15:43:02 -0700 | [diff] [blame] | 3243 | |
| 3244 | platform_add_devices(early_common_devices, |
| 3245 | ARRAY_SIZE(early_common_devices)); |
| 3246 | if (socinfo_get_pmic_model() != PMIC_MODEL_PM8917) |
| 3247 | platform_add_devices(pm8921_common_devices, |
| 3248 | ARRAY_SIZE(pm8921_common_devices)); |
| 3249 | else |
| 3250 | platform_add_devices(pm8917_common_devices, |
| 3251 | ARRAY_SIZE(pm8917_common_devices)); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3252 | platform_add_devices(common_devices, ARRAY_SIZE(common_devices)); |
Terence Hampson | 36b7072 | 2012-05-10 13:18:16 -0400 | [diff] [blame] | 3253 | if (!(machine_is_mpq8064_cdp() || machine_is_mpq8064_hrd() || |
| 3254 | machine_is_mpq8064_dtv())) |
| 3255 | platform_add_devices(common_not_mpq_devices, |
| 3256 | ARRAY_SIZE(common_not_mpq_devices)); |
Kuirong Wang | f8c5e14 | 2012-06-21 16:17:32 -0700 | [diff] [blame] | 3257 | |
| 3258 | if ((machine_is_mpq8064_cdp() || machine_is_mpq8064_hrd() || |
| 3259 | machine_is_mpq8064_dtv())) |
| 3260 | platform_add_devices(common_mpq_devices, |
| 3261 | ARRAY_SIZE(common_mpq_devices)); |
| 3262 | |
| 3263 | if (machine_is_apq8064_mtp()) { |
| 3264 | if (SOCINFO_VERSION_MINOR(platform_version) == 1) |
| 3265 | platform_add_devices(common_i2s_devices, |
| 3266 | ARRAY_SIZE(common_i2s_devices)); |
| 3267 | } |
| 3268 | |
Jay Chokshi | 994ff12 | 2012-03-27 15:43:48 -0700 | [diff] [blame] | 3269 | enable_ddr3_regulator(); |
Hemant Kumar | f1ca919 | 2012-02-07 18:59:33 -0800 | [diff] [blame] | 3270 | if (machine_is_apq8064_mtp()) { |
Hemant Kumar | 30d361c | 2012-08-20 14:44:40 -0700 | [diff] [blame] | 3271 | msm_hsic_pdata.log2_irq_thresh = 5, |
Hemant Kumar | f1ca919 | 2012-02-07 18:59:33 -0800 | [diff] [blame] | 3272 | apq8064_device_hsic_host.dev.platform_data = &msm_hsic_pdata; |
| 3273 | device_initialize(&apq8064_device_hsic_host.dev); |
| 3274 | } |
Jay Chokshi | e874128 | 2012-01-25 15:22:55 -0800 | [diff] [blame] | 3275 | apq8064_pm8xxx_gpio_mpp_init(); |
Sahitya Tummala | 3586ed9 | 2011-08-03 09:13:23 +0530 | [diff] [blame] | 3276 | apq8064_init_mmc(); |
Swaminathan Sathappan | 144b488 | 2012-02-06 17:01:20 -0800 | [diff] [blame] | 3277 | |
| 3278 | if (machine_is_apq8064_mtp()) { |
| 3279 | mdm_8064_device.dev.platform_data = &mdm_platform_data; |
Ameya Thakur | e155ece | 2012-07-09 12:08:37 -0700 | [diff] [blame] | 3280 | if (SOCINFO_VERSION_MINOR(platform_version) == 1) { |
| 3281 | i2s_mdm_8064_device.dev.platform_data = |
| 3282 | &mdm_platform_data; |
| 3283 | platform_device_register(&i2s_mdm_8064_device); |
| 3284 | } else { |
| 3285 | mdm_8064_device.dev.platform_data = &mdm_platform_data; |
| 3286 | platform_device_register(&mdm_8064_device); |
| 3287 | } |
Swaminathan Sathappan | 144b488 | 2012-02-06 17:01:20 -0800 | [diff] [blame] | 3288 | } |
| 3289 | platform_device_register(&apq8064_slim_ctrl); |
Sagar Dharia | 8bdcdaf | 2011-09-16 16:01:15 -0600 | [diff] [blame] | 3290 | slim_register_board_info(apq8064_slim_devices, |
| 3291 | ARRAY_SIZE(apq8064_slim_devices)); |
Taniya Das | bbf633d | 2012-07-31 16:07:47 +0530 | [diff] [blame] | 3292 | if (!PLATFORM_IS_MPQ8064()) { |
Taniya Das | 30cae29 | 2012-07-31 15:56:12 +0530 | [diff] [blame] | 3293 | apq8064_init_dsps(); |
Taniya Das | bbf633d | 2012-07-31 16:07:47 +0530 | [diff] [blame] | 3294 | platform_device_register(&msm_8960_riva); |
| 3295 | } |
Praveen Chidambaram | 7849901 | 2011-11-01 17:15:17 -0600 | [diff] [blame] | 3296 | msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data)); |
| 3297 | msm_spm_l2_init(msm_spm_l2_data); |
Praveen Chidambaram | 7849901 | 2011-11-01 17:15:17 -0600 | [diff] [blame] | 3298 | BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata)); |
Siddartha Mohanadoss | b9df494 | 2012-02-08 09:58:21 -0800 | [diff] [blame] | 3299 | apq8064_epm_adc_init(); |
Girish Mahadevan | 3bc9877 | 2012-08-15 10:01:27 -0600 | [diff] [blame] | 3300 | msm_pm_set_tz_retention_flag(1); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 3301 | } |
| 3302 | |
Huaibin Yang | 4a084e3 | 2011-12-15 15:25:52 -0800 | [diff] [blame] | 3303 | static void __init apq8064_allocate_memory_regions(void) |
| 3304 | { |
| 3305 | apq8064_allocate_fb_region(); |
| 3306 | } |
| 3307 | |
Joel King | 82b7e3f | 2012-01-05 10:03:27 -0800 | [diff] [blame] | 3308 | static void __init apq8064_cdp_init(void) |
| 3309 | { |
Hanumant Singh | 50440d4 | 2012-04-23 19:27:16 -0700 | [diff] [blame] | 3310 | if (meminfo_init(SYS_MEMORY, SZ_256M) < 0) |
| 3311 | pr_err("meminfo_init() failed!\n"); |
Amy Maloche | 609bb5e | 2012-08-03 09:41:42 -0700 | [diff] [blame] | 3312 | if (machine_is_apq8064_mtp() && |
| 3313 | SOCINFO_VERSION_MINOR(socinfo_get_platform_version()) == 1) |
| 3314 | cyttsp_pdata.sleep_gpio = CYTTSP_TS_GPIO_SLEEP_ALT; |
Joel King | 82b7e3f | 2012-01-05 10:03:27 -0800 | [diff] [blame] | 3315 | apq8064_common_init(); |
Joel King | 8f839b9 | 2012-04-01 14:37:46 -0700 | [diff] [blame] | 3316 | if (machine_is_mpq8064_cdp() || machine_is_mpq8064_hrd() || |
| 3317 | machine_is_mpq8064_dtv()) { |
Jay Chokshi | e7d8d4f | 2012-04-04 14:47:57 -0700 | [diff] [blame] | 3318 | enable_avc_i2c_bus(); |
Olav Haugan | ef95ae3 | 2012-05-15 09:50:30 -0700 | [diff] [blame] | 3319 | msm_rotator_set_split_iommu_domain(); |
Joel King | 8f839b9 | 2012-04-01 14:37:46 -0700 | [diff] [blame] | 3320 | platform_add_devices(mpq_devices, ARRAY_SIZE(mpq_devices)); |
Niranjana Vishwanathapura | 06f8933 | 2012-05-03 17:11:13 -0600 | [diff] [blame] | 3321 | mpq8064_pcie_init(); |
Joel King | 8f839b9 | 2012-04-01 14:37:46 -0700 | [diff] [blame] | 3322 | } else { |
| 3323 | ethernet_init(); |
Olav Haugan | ef95ae3 | 2012-05-15 09:50:30 -0700 | [diff] [blame] | 3324 | msm_rotator_set_split_iommu_domain(); |
Joel King | 8f839b9 | 2012-04-01 14:37:46 -0700 | [diff] [blame] | 3325 | platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices)); |
| 3326 | spi_register_board_info(spi_board_info, |
| 3327 | ARRAY_SIZE(spi_board_info)); |
| 3328 | } |
Ravishangar Kalyanam | c2fee31 | 2012-02-09 19:11:22 -0800 | [diff] [blame] | 3329 | apq8064_init_fb(); |
Jordan Crouse | b3115fe | 2012-02-01 22:11:12 -0700 | [diff] [blame] | 3330 | apq8064_init_gpu(); |
Matt Wagantall | 1f65d9d | 2012-04-25 14:24:20 -0700 | [diff] [blame] | 3331 | platform_add_devices(apq8064_footswitch, apq8064_num_footswitch); |
Steve Muckle | f132c6c | 2012-06-06 18:30:57 -0700 | [diff] [blame] | 3332 | #ifdef CONFIG_MSM_CAMERA |
Kevin Chan | d07220e | 2012-02-13 15:52:22 -0800 | [diff] [blame] | 3333 | apq8064_init_cam(); |
Steve Muckle | f132c6c | 2012-06-06 18:30:57 -0700 | [diff] [blame] | 3334 | #endif |
Mohan Pallaka | 474b94b | 2012-01-25 12:59:58 +0530 | [diff] [blame] | 3335 | |
Mayank Rana | 262e903 | 2012-05-10 15:14:00 -0700 | [diff] [blame] | 3336 | if (machine_is_mpq8064_hrd() || machine_is_mpq8064_dtv()) { |
| 3337 | platform_device_register(&mpq8064_device_uartdm_gsbi6); |
| 3338 | #ifdef CONFIG_SERIAL_MSM_HS |
| 3339 | /* GSBI6(2) - UARTDM_RX */ |
| 3340 | mpq8064_gsbi6_uartdm_pdata.wakeup_irq = gpio_to_irq(15); |
| 3341 | mpq8064_device_uartdm_gsbi6.dev.platform_data = |
| 3342 | &mpq8064_gsbi6_uartdm_pdata; |
| 3343 | #endif |
| 3344 | } |
| 3345 | |
Mohan Pallaka | 474b94b | 2012-01-25 12:59:58 +0530 | [diff] [blame] | 3346 | if (machine_is_apq8064_cdp() || machine_is_apq8064_liquid()) |
| 3347 | platform_device_register(&cdp_kp_pdev); |
| 3348 | |
| 3349 | if (machine_is_apq8064_mtp()) |
| 3350 | platform_device_register(&mtp_kp_pdev); |
Hanumant Singh | 50440d4 | 2012-04-23 19:27:16 -0700 | [diff] [blame] | 3351 | |
| 3352 | change_memory_power = &apq8064_change_memory_power; |
Anirudh Ghayal | 32ea625 | 2012-04-26 16:39:50 +0530 | [diff] [blame] | 3353 | |
| 3354 | if (machine_is_mpq8064_cdp()) { |
| 3355 | platform_device_register(&mpq_gpio_keys_pdev); |
| 3356 | platform_device_register(&mpq_keypad_device); |
| 3357 | } |
Joel King | 82b7e3f | 2012-01-05 10:03:27 -0800 | [diff] [blame] | 3358 | } |
| 3359 | |
Joel King | 82b7e3f | 2012-01-05 10:03:27 -0800 | [diff] [blame] | 3360 | MACHINE_START(APQ8064_CDP, "QCT APQ8064 CDP") |
| 3361 | .map_io = apq8064_map_io, |
| 3362 | .reserve = apq8064_reserve, |
| 3363 | .init_irq = apq8064_init_irq, |
| 3364 | .handle_irq = gic_handle_irq, |
| 3365 | .timer = &msm_timer, |
| 3366 | .init_machine = apq8064_cdp_init, |
Ravishangar Kalyanam | c2fee31 | 2012-02-09 19:11:22 -0800 | [diff] [blame] | 3367 | .init_early = apq8064_allocate_memory_regions, |
Laura Abbott | 6988cef | 2012-03-15 14:27:13 -0700 | [diff] [blame] | 3368 | .init_very_early = apq8064_early_reserve, |
Jeff Ohlstein | dd0dd9b | 2012-05-29 17:47:21 -0700 | [diff] [blame] | 3369 | .restart = msm_restart, |
Joel King | 82b7e3f | 2012-01-05 10:03:27 -0800 | [diff] [blame] | 3370 | MACHINE_END |
| 3371 | |
| 3372 | MACHINE_START(APQ8064_MTP, "QCT APQ8064 MTP") |
| 3373 | .map_io = apq8064_map_io, |
| 3374 | .reserve = apq8064_reserve, |
| 3375 | .init_irq = apq8064_init_irq, |
| 3376 | .handle_irq = gic_handle_irq, |
| 3377 | .timer = &msm_timer, |
| 3378 | .init_machine = apq8064_cdp_init, |
Ravishangar Kalyanam | c2fee31 | 2012-02-09 19:11:22 -0800 | [diff] [blame] | 3379 | .init_early = apq8064_allocate_memory_regions, |
Laura Abbott | 6988cef | 2012-03-15 14:27:13 -0700 | [diff] [blame] | 3380 | .init_very_early = apq8064_early_reserve, |
Jeff Ohlstein | dd0dd9b | 2012-05-29 17:47:21 -0700 | [diff] [blame] | 3381 | .restart = msm_restart, |
Joel King | 82b7e3f | 2012-01-05 10:03:27 -0800 | [diff] [blame] | 3382 | MACHINE_END |
| 3383 | |
| 3384 | MACHINE_START(APQ8064_LIQUID, "QCT APQ8064 LIQUID") |
| 3385 | .map_io = apq8064_map_io, |
| 3386 | .reserve = apq8064_reserve, |
| 3387 | .init_irq = apq8064_init_irq, |
| 3388 | .handle_irq = gic_handle_irq, |
| 3389 | .timer = &msm_timer, |
| 3390 | .init_machine = apq8064_cdp_init, |
Ravishangar Kalyanam | c2fee31 | 2012-02-09 19:11:22 -0800 | [diff] [blame] | 3391 | .init_early = apq8064_allocate_memory_regions, |
Laura Abbott | 6988cef | 2012-03-15 14:27:13 -0700 | [diff] [blame] | 3392 | .init_very_early = apq8064_early_reserve, |
Jeff Ohlstein | dd0dd9b | 2012-05-29 17:47:21 -0700 | [diff] [blame] | 3393 | .restart = msm_restart, |
Joel King | 82b7e3f | 2012-01-05 10:03:27 -0800 | [diff] [blame] | 3394 | MACHINE_END |
| 3395 | |
Joel King | 064bbf8 | 2012-04-01 13:23:39 -0700 | [diff] [blame] | 3396 | MACHINE_START(MPQ8064_CDP, "QCT MPQ8064 CDP") |
| 3397 | .map_io = apq8064_map_io, |
| 3398 | .reserve = apq8064_reserve, |
| 3399 | .init_irq = apq8064_init_irq, |
| 3400 | .handle_irq = gic_handle_irq, |
| 3401 | .timer = &msm_timer, |
| 3402 | .init_machine = apq8064_cdp_init, |
| 3403 | .init_early = apq8064_allocate_memory_regions, |
| 3404 | .init_very_early = apq8064_early_reserve, |
Jeff Ohlstein | dd0dd9b | 2012-05-29 17:47:21 -0700 | [diff] [blame] | 3405 | .restart = msm_restart, |
Joel King | 064bbf8 | 2012-04-01 13:23:39 -0700 | [diff] [blame] | 3406 | MACHINE_END |
| 3407 | |
Joel King | 11ca820 | 2012-02-13 16:19:03 -0800 | [diff] [blame] | 3408 | MACHINE_START(MPQ8064_HRD, "QCT MPQ8064 HRD") |
| 3409 | .map_io = apq8064_map_io, |
| 3410 | .reserve = apq8064_reserve, |
| 3411 | .init_irq = apq8064_init_irq, |
| 3412 | .handle_irq = gic_handle_irq, |
| 3413 | .timer = &msm_timer, |
| 3414 | .init_machine = apq8064_cdp_init, |
Joel King | 3a57e77 | 2012-05-28 11:22:55 -0700 | [diff] [blame] | 3415 | .init_early = apq8064_allocate_memory_regions, |
Laura Abbott | 6988cef | 2012-03-15 14:27:13 -0700 | [diff] [blame] | 3416 | .init_very_early = apq8064_early_reserve, |
Jeff Ohlstein | dd0dd9b | 2012-05-29 17:47:21 -0700 | [diff] [blame] | 3417 | .restart = msm_restart, |
Joel King | 11ca820 | 2012-02-13 16:19:03 -0800 | [diff] [blame] | 3418 | MACHINE_END |
| 3419 | |
| 3420 | MACHINE_START(MPQ8064_DTV, "QCT MPQ8064 DTV") |
| 3421 | .map_io = apq8064_map_io, |
| 3422 | .reserve = apq8064_reserve, |
| 3423 | .init_irq = apq8064_init_irq, |
| 3424 | .handle_irq = gic_handle_irq, |
| 3425 | .timer = &msm_timer, |
| 3426 | .init_machine = apq8064_cdp_init, |
Joel King | 3a57e77 | 2012-05-28 11:22:55 -0700 | [diff] [blame] | 3427 | .init_early = apq8064_allocate_memory_regions, |
Laura Abbott | 6988cef | 2012-03-15 14:27:13 -0700 | [diff] [blame] | 3428 | .init_very_early = apq8064_early_reserve, |
Jeff Ohlstein | dd0dd9b | 2012-05-29 17:47:21 -0700 | [diff] [blame] | 3429 | .restart = msm_restart, |
Joel King | 11ca820 | 2012-02-13 16:19:03 -0800 | [diff] [blame] | 3430 | MACHINE_END |