blob: 0fe94d5d2b6278bd8190757d1b41789266e49e5a [file] [log] [blame]
Abhimanyu Kapur440cdde2012-12-04 00:05:40 -08001/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved.
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002 *
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 */
Abhimanyu Kapur440cdde2012-12-04 00:05:40 -080013#include <linux/err.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070014#include <linux/kernel.h>
Niranjana Vishwanathapurac1edd402012-06-28 15:32:50 -060015#include <linux/bitops.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070016#include <linux/platform_device.h>
Steve Mucklef132c6c2012-06-06 18:30:57 -070017#include <linux/gpio.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070018#include <linux/io.h>
19#include <linux/irq.h>
Kenneth Heitke748593a2011-07-15 15:45:11 -060020#include <linux/i2c.h>
David Keitel2f613d92012-02-15 11:29:16 -080021#include <linux/i2c/smb349.h>
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -080022#include <linux/i2c/sx150x.h>
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -060023#include <linux/slimbus/slimbus.h>
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +053024#include <linux/mfd/wcd9xxx/core.h>
25#include <linux/mfd/wcd9xxx/pdata.h>
Amy Maloche70090f992012-02-16 16:35:26 -080026#include <linux/mfd/pm8xxx/misc.h>
Kenneth Heitke36920d32011-07-20 16:44:30 -060027#include <linux/msm_ssbi.h>
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -070028#include <linux/spi/spi.h>
Laura Abbott744e3f82012-08-10 10:49:33 -070029#include <linux/dma-contiguous.h>
Ramesh Masavarapu28311912011-10-27 11:04:12 -070030#include <linux/dma-mapping.h>
31#include <linux/platform_data/qcom_crypto_device.h>
Mitchel Humpherysca983d82012-09-06 11:32:54 -070032#include <linux/msm_ion.h>
Jack Cheung46bfffa2012-01-19 15:26:24 -080033#include <linux/memory.h>
Larry Bassel67b921d2012-04-06 10:23:27 -070034#include <linux/memblock.h>
Praveen Chidambaram877d7a42012-06-05 14:33:20 -060035#include <linux/msm_thermal.h>
Jing Lin21ed4de2012-02-05 15:53:28 -080036#include <linux/i2c/atmel_mxt_ts.h>
Steve Mucklef132c6c2012-06-06 18:30:57 -070037#include <linux/cyttsp-qc.h>
Amy Maloche70090f992012-02-16 16:35:26 -080038#include <linux/i2c/isa1200.h>
Mohan Pallaka474b94b2012-01-25 12:59:58 +053039#include <linux/gpio_keys.h>
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -080040#include <linux/epm_adc.h>
Jay Chokshie7d8d4f2012-04-04 14:47:57 -070041#include <linux/i2c/sx150x.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070042#include <asm/mach-types.h>
43#include <asm/mach/arch.h>
44#include <asm/hardware/gic.h>
Sahitya Tummala3586ed92011-08-03 09:13:23 +053045#include <asm/mach/mmc.h>
Ankit Verma6b7e2ba2012-01-26 15:48:54 -080046#include <linux/platform_data/qcom_wcnss_device.h>
Bar Weinerf82c5872012-10-23 14:31:26 +020047#include <linux/ci-bridge-spi.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070048
49#include <mach/board.h>
50#include <mach/msm_iomap.h>
Olav Haugan7c6aa742012-01-16 16:47:37 -080051#include <mach/ion.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070052#include <linux/usb/msm_hsusb.h>
53#include <linux/usb/android.h>
54#include <mach/socinfo.h>
Harini Jayaramanc4c58692011-07-19 14:50:10 -060055#include <mach/msm_spi.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070056#include "timer.h"
57#include "devices.h"
Joel King4ebccc62011-07-22 09:43:22 -070058#include <mach/gpiomux.h>
Praveen Chidambaram78499012011-11-01 17:15:17 -060059#include <mach/rpm.h>
Kevin Chan13be4e22011-10-20 11:30:32 -070060#include <mach/msm_memtypes.h>
61#include <linux/bootmem.h>
62#include <asm/setup.h>
Ramesh Masavarapu28311912011-10-27 11:04:12 -070063#include <mach/dma.h>
Jin Hongd3024e62012-02-09 16:13:32 -080064#include <mach/msm_dsps.h>
Gagan Mac8a7a5d32011-11-11 16:43:06 -070065#include <mach/msm_bus_board.h>
Praveen Chidambaram78499012011-11-01 17:15:17 -060066#include <mach/cpuidle.h>
Joel Kingdacbc822012-01-25 13:30:57 -080067#include <mach/mdm2.h>
Siddartha Mohanadosscaeaa922012-02-07 16:41:38 -080068#include <linux/msm_tsens.h>
Stephen Boyd4d0d2582012-02-10 14:49:40 -080069#include <mach/msm_xo.h>
Laura Abbott350c8362012-02-28 14:46:52 -080070#include <mach/msm_rtb.h>
Mayank Rana262e9032012-05-10 15:14:00 -070071#include <mach/msm_serial_hs.h>
Santosh Mardieff9a742012-04-09 23:23:39 +053072#include <sound/cs8427.h>
Ravi Kumar V05931a22012-04-04 17:09:37 +053073#include <media/gpio-ir-recv.h>
Larry Bassel67b921d2012-04-06 10:23:27 -070074#include <linux/fmem.h>
Niranjana Vishwanathapura06f89332012-05-03 17:11:13 -060075#include <mach/msm_pcie.h>
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -070076#include <mach/restart.h>
Niranjana Vishwanathapurac1edd402012-06-28 15:32:50 -060077#include <mach/msm_iomap.h>
Joel King4ebccc62011-07-22 09:43:22 -070078
Jeff Ohlstein7e668552011-10-06 16:17:25 -070079#include "msm_watchdog.h"
Stepan Moskovchenko5a83dba2011-12-05 17:30:17 -080080#include "board-8064.h"
Matt Wagantall33d01f52012-02-23 23:27:44 -080081#include "clock.h"
Praveen Chidambaram78499012011-11-01 17:15:17 -060082#include "spm.h"
Subhash Jadavani909e04f2012-04-12 10:52:50 +053083#include <mach/mpm.h>
Praveen Chidambaram78499012011-11-01 17:15:17 -060084#include "rpm_resources.h"
Matt Wagantall7cca4642012-02-01 16:43:24 -080085#include "pm.h"
Praveen Chidambaram78499012011-11-01 17:15:17 -060086#include "pm-boot.h"
Rajesh Sastrulaaee8af32012-01-20 11:46:31 -080087#include "devices-msm8x60.h"
Hanumant Singh50440d42012-04-23 19:27:16 -070088#include "smd_private.h"
Syed Rameez Mustafa9de46342012-11-30 11:00:08 -080089#include "platsmp.h"
Jay Chokshiea67c622011-07-29 17:12:26 -070090
Abhishek Kharbanda72dc72e2012-06-07 13:41:37 -070091#define MHL_GPIO_INT 30
92#define MHL_GPIO_RESET 35
93
Olav Haugan7c6aa742012-01-16 16:47:37 -080094#define MSM_PMEM_ADSP_SIZE 0x7800000
Bharath Ramachandramurthy2fd017a2012-03-13 10:21:09 -070095#define MSM_PMEM_AUDIO_SIZE 0x4CF000
Olav Haugan7c6aa742012-01-16 16:47:37 -080096#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
97#define MSM_PMEM_SIZE 0x4000000 /* 64 Mbytes */
98#else
Chetan Kalyan72aac4f2012-02-23 14:56:54 -080099#define MSM_PMEM_SIZE 0x4000000 /* 64 Mbytes */
Olav Haugan7c6aa742012-01-16 16:47:37 -0800100#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700101
Olav Haugan7c6aa742012-01-16 16:47:37 -0800102#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
Hanumant Singheadb7502012-05-15 18:14:04 -0700103#define HOLE_SIZE 0x20000
Rajeshwar Kurapatyc3e190a2012-12-04 19:28:05 +0530104#define MSM_ION_MFC_META_SIZE 0x40000 /* 256 Kbytes */
Mitchel Humpherys05e58812012-08-13 14:24:13 -0700105#define MSM_CONTIG_MEM_SIZE 0x65000
Olav Haugan129992c2012-03-22 09:54:01 -0700106#ifdef CONFIG_MSM_IOMMU
107#define MSM_ION_MM_SIZE 0x3800000
108#define MSM_ION_SF_SIZE 0
Olav Haugan39477bb2012-05-14 16:05:36 -0700109#define MSM_ION_QSECOM_SIZE 0x780000 /* (7.5MB) */
Laura Abbott98e8ddc2013-02-09 09:35:30 -0800110#define MSM_ION_HEAP_NUM 8
Olav Haugan129992c2012-03-22 09:54:01 -0700111#else
Olav Haugan7c6aa742012-01-16 16:47:37 -0800112#define MSM_ION_MM_SIZE MSM_PMEM_ADSP_SIZE
Olav Haugan129992c2012-03-22 09:54:01 -0700113#define MSM_ION_SF_SIZE MSM_PMEM_SIZE
Olav Haugan39477bb2012-05-14 16:05:36 -0700114#define MSM_ION_QSECOM_SIZE 0x600000 /* (6MB) */
Olav Haugan129992c2012-03-22 09:54:01 -0700115#define MSM_ION_HEAP_NUM 8
116#endif
Hanumant Singheadb7502012-05-15 18:14:04 -0700117#define MSM_ION_MM_FW_SIZE (0x200000 - HOLE_SIZE) /* (2MB - 128KB) */
Rajeshwar Kurapatyc3e190a2012-12-04 19:28:05 +0530118#define MSM_ION_MFC_SIZE (SZ_8K + MSM_ION_MFC_META_SIZE)
Olav Haugan2c43fac2012-01-19 11:06:37 -0800119#define MSM_ION_AUDIO_SIZE MSM_PMEM_AUDIO_SIZE
Olav Haugan7c6aa742012-01-16 16:47:37 -0800120#else
Mitchel Humpherys05e58812012-08-13 14:24:13 -0700121#define MSM_CONTIG_MEM_SIZE 0x110C000
Olav Haugan7c6aa742012-01-16 16:47:37 -0800122#define MSM_ION_HEAP_NUM 1
123#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700124
Hanumant Singheadb7502012-05-15 18:14:04 -0700125#define APQ8064_FIXED_AREA_START (0xa0000000 - (MSM_ION_MM_FW_SIZE + \
126 HOLE_SIZE))
Larry Bassel67b921d2012-04-06 10:23:27 -0700127#define MAX_FIXED_AREA_SIZE 0x10000000
Hanumant Singheadb7502012-05-15 18:14:04 -0700128#define MSM_MM_FW_SIZE (0x200000 - HOLE_SIZE)
129#define APQ8064_FW_START APQ8064_FIXED_AREA_START
Laura Abbott98e8ddc2013-02-09 09:35:30 -0800130#define MSM_ION_ADSP_SIZE SZ_8M
Larry Bassel67b921d2012-04-06 10:23:27 -0700131
Niranjana Vishwanathapurac1edd402012-06-28 15:32:50 -0600132#define QFPROM_RAW_FEAT_CONFIG_ROW0_MSB (MSM_QFPROM_BASE + 0x23c)
133#define QFPROM_RAW_OEM_CONFIG_ROW0_LSB (MSM_QFPROM_BASE + 0x220)
134
Niranjana Vishwanathapura68210ff2012-06-24 18:03:49 -0600135/* PCIE AXI address space */
136#define PCIE_AXI_BAR_PHYS 0x08000000
137#define PCIE_AXI_BAR_SIZE SZ_128M
138
Niranjana Vishwanathapura459a27d2012-07-20 12:23:55 -0600139/* PCIe pmic gpios */
140#define PCIE_WAKE_N_PMIC_GPIO 12
Niranjana Vishwanathapura06f89332012-05-03 17:11:13 -0600141#define PCIE_PWR_EN_PMIC_GPIO 13
142#define PCIE_RST_N_PMIC_MPP 1
Yan Hedbc96ce2013-01-29 12:39:33 -0800143#define PCIE_WAKE_N_PMIC_GPIO_HRD 22
144#define PCIE_PWR_EN_PMIC_GPIO_HRD 23
Niranjana Vishwanathapura06f89332012-05-03 17:11:13 -0600145
Rohit Vaswani4375c802013-01-09 13:38:19 -0800146/* PCIe pmic gpios for fsm8064_ep */
147/* Unused pin. The WAKE feature is not supported on fsm8064_ep */
148#define PCIE_EP_WAKE_N_PMIC_GPIO 11
149#define PCIE_EP_RST_N_PMIC_GPIO 37
150
Mitchel Humpherys05e58812012-08-13 14:24:13 -0700151#ifdef CONFIG_KERNEL_MSM_CONTIG_MEM_REGION
152static unsigned msm_contig_mem_size = MSM_CONTIG_MEM_SIZE;
153static int __init msm_contig_mem_size_setup(char *p)
Kevin Chan13be4e22011-10-20 11:30:32 -0700154{
Mitchel Humpherys05e58812012-08-13 14:24:13 -0700155 msm_contig_mem_size = memparse(p, NULL);
Olav Haugan7c6aa742012-01-16 16:47:37 -0800156 return 0;
Kevin Chan13be4e22011-10-20 11:30:32 -0700157}
Mitchel Humpherys05e58812012-08-13 14:24:13 -0700158early_param("msm_contig_mem_size", msm_contig_mem_size_setup);
Olav Haugan7c6aa742012-01-16 16:47:37 -0800159#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700160
Binqiang Qiuf165c922012-08-15 18:00:18 -0700161#ifdef CONFIG_BATTERY_BCL
162static struct platform_device battery_bcl_device = {
163 .name = "battery_current_limit",
164 .id = -1,
165};
166#endif
167
Larry Bassel67b921d2012-04-06 10:23:27 -0700168struct fmem_platform_data apq8064_fmem_pdata = {
169};
170
Olav Haugan7c6aa742012-01-16 16:47:37 -0800171static struct memtype_reserve apq8064_reserve_table[] __initdata = {
172 [MEMTYPE_SMI] = {
173 },
174 [MEMTYPE_EBI0] = {
175 .flags = MEMTYPE_FLAGS_1M_ALIGN,
176 },
177 [MEMTYPE_EBI1] = {
178 .flags = MEMTYPE_FLAGS_1M_ALIGN,
179 },
180};
Kevin Chan13be4e22011-10-20 11:30:32 -0700181
Laura Abbott350c8362012-02-28 14:46:52 -0800182static void __init reserve_rtb_memory(void)
183{
184#if defined(CONFIG_MSM_RTB)
Laura Abbottb93525f2012-04-12 09:57:19 -0700185 apq8064_reserve_table[MEMTYPE_EBI1].size += apq8064_rtb_pdata.size;
Laura Abbott350c8362012-02-28 14:46:52 -0800186#endif
187}
188
Laura Abbott938d7502013-04-09 10:44:16 -0700189static int apq8064_paddr_to_memtype(phys_addr_t paddr)
Olav Haugan7c6aa742012-01-16 16:47:37 -0800190{
191 return MEMTYPE_EBI1;
192}
193
Steve Mucklef132c6c2012-06-06 18:30:57 -0700194#define FMEM_ENABLED 0
Larry Bassel67b921d2012-04-06 10:23:27 -0700195
Olav Haugan7c6aa742012-01-16 16:47:37 -0800196#ifdef CONFIG_ION_MSM
197#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
Laura Abbottb93525f2012-04-12 09:57:19 -0700198static struct ion_cp_heap_pdata cp_mm_apq8064_ion_pdata = {
Olav Haugan7c6aa742012-01-16 16:47:37 -0800199 .permission_type = IPT_TYPE_MM_CARVEOUT,
Olav Haugand3d29682012-01-19 10:57:07 -0800200 .align = PAGE_SIZE,
Larry Bassel67b921d2012-04-06 10:23:27 -0700201 .reusable = FMEM_ENABLED,
202 .mem_is_fmem = FMEM_ENABLED,
203 .fixed_position = FIXED_MIDDLE,
Olav Haugan7c6aa742012-01-16 16:47:37 -0800204};
205
Laura Abbottb93525f2012-04-12 09:57:19 -0700206static struct ion_cp_heap_pdata cp_mfc_apq8064_ion_pdata = {
Olav Haugan7c6aa742012-01-16 16:47:37 -0800207 .permission_type = IPT_TYPE_MFC_SHAREDMEM,
Olav Haugand3d29682012-01-19 10:57:07 -0800208 .align = PAGE_SIZE,
Larry Bassel67b921d2012-04-06 10:23:27 -0700209 .reusable = 0,
210 .mem_is_fmem = FMEM_ENABLED,
211 .fixed_position = FIXED_HIGH,
Olav Haugan7c6aa742012-01-16 16:47:37 -0800212};
213
Laura Abbottb93525f2012-04-12 09:57:19 -0700214static struct ion_co_heap_pdata co_apq8064_ion_pdata = {
Olav Haugand3d29682012-01-19 10:57:07 -0800215 .adjacent_mem_id = INVALID_HEAP_ID,
216 .align = PAGE_SIZE,
Larry Bassel67b921d2012-04-06 10:23:27 -0700217 .mem_is_fmem = 0,
Olav Haugand3d29682012-01-19 10:57:07 -0800218};
219
Laura Abbottb93525f2012-04-12 09:57:19 -0700220static struct ion_co_heap_pdata fw_co_apq8064_ion_pdata = {
Olav Haugand3d29682012-01-19 10:57:07 -0800221 .adjacent_mem_id = ION_CP_MM_HEAP_ID,
222 .align = SZ_128K,
Larry Bassel67b921d2012-04-06 10:23:27 -0700223 .mem_is_fmem = FMEM_ENABLED,
224 .fixed_position = FIXED_LOW,
Olav Haugan7c6aa742012-01-16 16:47:37 -0800225};
226#endif
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800227
Laura Abbott744e3f82012-08-10 10:49:33 -0700228static u64 msm_dmamask = DMA_BIT_MASK(32);
229
230static struct platform_device ion_mm_heap_device = {
231 .name = "ion-mm-heap-device",
232 .id = -1,
233 .dev = {
234 .dma_mask = &msm_dmamask,
235 .coherent_dma_mask = DMA_BIT_MASK(32),
236 }
237};
238
Laura Abbott98e8ddc2013-02-09 09:35:30 -0800239static struct platform_device ion_adsp_heap_device = {
240 .name = "ion-adsp-heap-device",
241 .id = -1,
242 .dev = {
243 .dma_mask = &msm_dmamask,
244 .coherent_dma_mask = DMA_BIT_MASK(32),
245 }
246};
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800247/**
248 * These heaps are listed in the order they will be allocated. Due to
249 * video hardware restrictions and content protection the FW heap has to
250 * be allocated adjacent (below) the MM heap and the MFC heap has to be
251 * allocated after the MM heap to ensure MFC heap is not more than 256MB
252 * away from the base address of the FW heap.
253 * However, the order of FW heap and MM heap doesn't matter since these
254 * two heaps are taken care of by separate code to ensure they are adjacent
255 * to each other.
256 * Don't swap the order unless you know what you are doing!
257 */
Benjamin Gaignard63d81032012-06-25 15:27:30 -0700258struct ion_platform_heap apq8064_heaps[] = {
Olav Haugan7c6aa742012-01-16 16:47:37 -0800259 {
260 .id = ION_SYSTEM_HEAP_ID,
261 .type = ION_HEAP_TYPE_SYSTEM,
262 .name = ION_VMALLOC_HEAP_NAME,
263 },
264#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
265 {
Olav Haugan7c6aa742012-01-16 16:47:37 -0800266 .id = ION_CP_MM_HEAP_ID,
267 .type = ION_HEAP_TYPE_CP,
268 .name = ION_MM_HEAP_NAME,
269 .size = MSM_ION_MM_SIZE,
270 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700271 .extra_data = (void *) &cp_mm_apq8064_ion_pdata,
Laura Abbott744e3f82012-08-10 10:49:33 -0700272 .priv = &ion_mm_heap_device.dev
Olav Haugan7c6aa742012-01-16 16:47:37 -0800273 },
274 {
Olav Haugand3d29682012-01-19 10:57:07 -0800275 .id = ION_MM_FIRMWARE_HEAP_ID,
276 .type = ION_HEAP_TYPE_CARVEOUT,
277 .name = ION_MM_FIRMWARE_HEAP_NAME,
278 .size = MSM_ION_MM_FW_SIZE,
279 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700280 .extra_data = (void *) &fw_co_apq8064_ion_pdata,
Olav Haugand3d29682012-01-19 10:57:07 -0800281 },
282 {
Olav Haugan7c6aa742012-01-16 16:47:37 -0800283 .id = ION_CP_MFC_HEAP_ID,
284 .type = ION_HEAP_TYPE_CP,
285 .name = ION_MFC_HEAP_NAME,
286 .size = MSM_ION_MFC_SIZE,
287 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700288 .extra_data = (void *) &cp_mfc_apq8064_ion_pdata,
Olav Haugan7c6aa742012-01-16 16:47:37 -0800289 },
Olav Haugan129992c2012-03-22 09:54:01 -0700290#ifndef CONFIG_MSM_IOMMU
Olav Haugan7c6aa742012-01-16 16:47:37 -0800291 {
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800292 .id = ION_SF_HEAP_ID,
293 .type = ION_HEAP_TYPE_CARVEOUT,
294 .name = ION_SF_HEAP_NAME,
295 .size = MSM_ION_SF_SIZE,
296 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700297 .extra_data = (void *) &co_apq8064_ion_pdata,
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800298 },
Olav Haugan129992c2012-03-22 09:54:01 -0700299#endif
Olav Haugan9cdfc2f2012-02-15 09:52:57 -0800300 {
Olav Haugan7c6aa742012-01-16 16:47:37 -0800301 .id = ION_IOMMU_HEAP_ID,
302 .type = ION_HEAP_TYPE_IOMMU,
303 .name = ION_IOMMU_HEAP_NAME,
304 },
Olav Hauganf45e2142012-01-19 11:01:01 -0800305 {
306 .id = ION_QSECOM_HEAP_ID,
307 .type = ION_HEAP_TYPE_CARVEOUT,
308 .name = ION_QSECOM_HEAP_NAME,
309 .size = MSM_ION_QSECOM_SIZE,
310 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700311 .extra_data = (void *) &co_apq8064_ion_pdata,
Olav Hauganf45e2142012-01-19 11:01:01 -0800312 },
Olav Haugan2c43fac2012-01-19 11:06:37 -0800313 {
314 .id = ION_AUDIO_HEAP_ID,
315 .type = ION_HEAP_TYPE_CARVEOUT,
316 .name = ION_AUDIO_HEAP_NAME,
317 .size = MSM_ION_AUDIO_SIZE,
318 .memory_type = ION_EBI_TYPE,
Laura Abbottb93525f2012-04-12 09:57:19 -0700319 .extra_data = (void *) &co_apq8064_ion_pdata,
Olav Haugan2c43fac2012-01-19 11:06:37 -0800320 },
Laura Abbott98e8ddc2013-02-09 09:35:30 -0800321 {
322 .id = ION_ADSP_HEAP_ID,
323 .type = ION_HEAP_TYPE_DMA,
324 .name = ION_ADSP_HEAP_NAME,
325 .size = MSM_ION_ADSP_SIZE,
326 .memory_type = ION_EBI_TYPE,
327 .extra_data = (void *) &co_apq8064_ion_pdata,
328 .priv = &ion_adsp_heap_device.dev,
329 },
Olav Haugan7c6aa742012-01-16 16:47:37 -0800330#endif
Benjamin Gaignard63d81032012-06-25 15:27:30 -0700331};
332
333static struct ion_platform_data apq8064_ion_pdata = {
334 .nr = MSM_ION_HEAP_NUM,
335 .heaps = apq8064_heaps,
Olav Haugan7c6aa742012-01-16 16:47:37 -0800336};
337
Laura Abbottb93525f2012-04-12 09:57:19 -0700338static struct platform_device apq8064_ion_dev = {
Olav Haugan7c6aa742012-01-16 16:47:37 -0800339 .name = "ion-msm",
340 .id = 1,
Laura Abbottb93525f2012-04-12 09:57:19 -0700341 .dev = { .platform_data = &apq8064_ion_pdata },
Olav Haugan7c6aa742012-01-16 16:47:37 -0800342};
343#endif
344
Larry Bassel67b921d2012-04-06 10:23:27 -0700345static struct platform_device apq8064_fmem_device = {
346 .name = "fmem",
347 .id = 1,
348 .dev = { .platform_data = &apq8064_fmem_pdata },
349};
350
351static void __init reserve_mem_for_ion(enum ion_memory_types mem_type,
352 unsigned long size)
353{
354 apq8064_reserve_table[mem_type].size += size;
355}
356
357static void __init apq8064_reserve_fixed_area(unsigned long fixed_area_size)
358{
359#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
360 int ret;
361
362 if (fixed_area_size > MAX_FIXED_AREA_SIZE)
363 panic("fixed area size is larger than %dM\n",
364 MAX_FIXED_AREA_SIZE >> 20);
365
366 reserve_info->fixed_area_size = fixed_area_size;
367 reserve_info->fixed_area_start = APQ8064_FW_START;
368
369 ret = memblock_remove(reserve_info->fixed_area_start,
370 reserve_info->fixed_area_size);
371 BUG_ON(ret);
372#endif
373}
374
375/**
376 * Reserve memory for ION and calculate amount of reusable memory for fmem.
377 * We only reserve memory for heaps that are not reusable. However, we only
378 * support one reusable heap at the moment so we ignore the reusable flag for
379 * other than the first heap with reusable flag set. Also handle special case
380 * for video heaps (MM,FW, and MFC). Video requires heaps MM and MFC to be
381 * at a higher address than FW in addition to not more than 256MB away from the
382 * base address of the firmware. This means that if MM is reusable the other
383 * two heaps must be allocated in the same region as FW. This is handled by the
384 * mem_is_fmem flag in the platform data. In addition the MM heap must be
385 * adjacent to the FW heap for content protection purposes.
386 */
Stephen Boyd668d7652012-04-25 11:31:01 -0700387static void __init reserve_ion_memory(void)
Olav Haugan7c6aa742012-01-16 16:47:37 -0800388{
389#if defined(CONFIG_ION_MSM) && defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
Larry Bassel67b921d2012-04-06 10:23:27 -0700390 unsigned int i;
Laura Abbott744e3f82012-08-10 10:49:33 -0700391 unsigned int ret;
Larry Bassel67b921d2012-04-06 10:23:27 -0700392 unsigned int fixed_size = 0;
393 unsigned int fixed_low_size, fixed_middle_size, fixed_high_size;
394 unsigned long fixed_low_start, fixed_middle_start, fixed_high_start;
Laura Abbott744e3f82012-08-10 10:49:33 -0700395 unsigned long cma_alignment;
396 unsigned int low_use_cma = 0;
397 unsigned int middle_use_cma = 0;
398 unsigned int high_use_cma = 0;
399
Larry Bassel67b921d2012-04-06 10:23:27 -0700400
Larry Bassel67b921d2012-04-06 10:23:27 -0700401 fixed_low_size = 0;
402 fixed_middle_size = 0;
403 fixed_high_size = 0;
404
Laura Abbott744e3f82012-08-10 10:49:33 -0700405 cma_alignment = PAGE_SIZE << max(MAX_ORDER, pageblock_order);
406
Larry Bassel67b921d2012-04-06 10:23:27 -0700407 for (i = 0; i < apq8064_ion_pdata.nr; ++i) {
Laura Abbott744e3f82012-08-10 10:49:33 -0700408 struct ion_platform_heap *heap =
Larry Bassel67b921d2012-04-06 10:23:27 -0700409 &(apq8064_ion_pdata.heaps[i]);
Laura Abbott744e3f82012-08-10 10:49:33 -0700410 int use_cma = 0;
411
Larry Bassel67b921d2012-04-06 10:23:27 -0700412
413 if (heap->extra_data) {
414 int fixed_position = NOT_FIXED;
Larry Bassel67b921d2012-04-06 10:23:27 -0700415
Mitchel Humpherys362b52b2012-09-13 10:53:22 -0700416 switch ((int)heap->type) {
Larry Bassel67b921d2012-04-06 10:23:27 -0700417 case ION_HEAP_TYPE_CP:
Laura Abbott744e3f82012-08-10 10:49:33 -0700418 if (((struct ion_cp_heap_pdata *)
419 heap->extra_data)->is_cma) {
420 heap->size = ALIGN(heap->size,
421 cma_alignment);
422 use_cma = 1;
423 }
Larry Bassel67b921d2012-04-06 10:23:27 -0700424 fixed_position = ((struct ion_cp_heap_pdata *)
425 heap->extra_data)->fixed_position;
426 break;
Laura Abbott744e3f82012-08-10 10:49:33 -0700427 case ION_HEAP_TYPE_DMA:
428 use_cma = 1;
429 /* Purposely fall through here */
Larry Bassel67b921d2012-04-06 10:23:27 -0700430 case ION_HEAP_TYPE_CARVEOUT:
Larry Bassel67b921d2012-04-06 10:23:27 -0700431 fixed_position = ((struct ion_co_heap_pdata *)
432 heap->extra_data)->fixed_position;
433 break;
434 default:
435 break;
436 }
437
438 if (fixed_position != NOT_FIXED)
439 fixed_size += heap->size;
440 else
441 reserve_mem_for_ion(MEMTYPE_EBI1, heap->size);
442
Laura Abbott744e3f82012-08-10 10:49:33 -0700443 if (fixed_position == FIXED_LOW) {
Larry Bassel67b921d2012-04-06 10:23:27 -0700444 fixed_low_size += heap->size;
Laura Abbott744e3f82012-08-10 10:49:33 -0700445 low_use_cma = use_cma;
446 } else if (fixed_position == FIXED_MIDDLE) {
Larry Bassel67b921d2012-04-06 10:23:27 -0700447 fixed_middle_size += heap->size;
Laura Abbott744e3f82012-08-10 10:49:33 -0700448 middle_use_cma = use_cma;
449 } else if (fixed_position == FIXED_HIGH) {
Larry Bassel67b921d2012-04-06 10:23:27 -0700450 fixed_high_size += heap->size;
Laura Abbott744e3f82012-08-10 10:49:33 -0700451 high_use_cma = use_cma;
452 } else if (use_cma) {
453 /*
454 * Heaps that use CMA but are not part of the
455 * fixed set. Create wherever.
456 */
457 dma_declare_contiguous(
458 heap->priv,
459 heap->size,
460 0,
461 0xb0000000);
462
463 }
Larry Bassel67b921d2012-04-06 10:23:27 -0700464 }
465 }
466
467 if (!fixed_size)
468 return;
469
Laura Abbott744e3f82012-08-10 10:49:33 -0700470 /*
471 * Given the setup for the fixed area, we can't round up all sizes.
472 * Some sizes must be set up exactly and aligned correctly. Incorrect
473 * alignments are considered a configuration issue
Larry Bassel67b921d2012-04-06 10:23:27 -0700474 */
Larry Bassel67b921d2012-04-06 10:23:27 -0700475
476 fixed_low_start = APQ8064_FIXED_AREA_START;
Laura Abbott744e3f82012-08-10 10:49:33 -0700477 if (low_use_cma) {
478 BUG_ON(!IS_ALIGNED(fixed_low_size + HOLE_SIZE, cma_alignment));
479 BUG_ON(!IS_ALIGNED(fixed_low_start, cma_alignment));
480 } else {
481 BUG_ON(!IS_ALIGNED(fixed_low_size + HOLE_SIZE, SECTION_SIZE));
482 ret = memblock_remove(fixed_low_start,
483 fixed_low_size + HOLE_SIZE);
484 BUG_ON(ret);
485 }
486
Hanumant Singheadb7502012-05-15 18:14:04 -0700487 fixed_middle_start = fixed_low_start + fixed_low_size + HOLE_SIZE;
Laura Abbott744e3f82012-08-10 10:49:33 -0700488 if (middle_use_cma) {
489 BUG_ON(!IS_ALIGNED(fixed_middle_start, cma_alignment));
490 BUG_ON(!IS_ALIGNED(fixed_middle_size, cma_alignment));
491 } else {
492 BUG_ON(!IS_ALIGNED(fixed_middle_size, SECTION_SIZE));
493 ret = memblock_remove(fixed_middle_start, fixed_middle_size);
494 BUG_ON(ret);
495 }
496
Larry Bassel67b921d2012-04-06 10:23:27 -0700497 fixed_high_start = fixed_middle_start + fixed_middle_size;
Laura Abbott744e3f82012-08-10 10:49:33 -0700498 if (high_use_cma) {
499 fixed_high_size = ALIGN(fixed_high_size, cma_alignment);
500 BUG_ON(!IS_ALIGNED(fixed_high_start, cma_alignment));
501 } else {
502 /* This is the end of the fixed area so it's okay to round up */
503 fixed_high_size = ALIGN(fixed_high_size, SECTION_SIZE);
504 ret = memblock_remove(fixed_high_start, fixed_high_size);
505 BUG_ON(ret);
506 }
Larry Bassel67b921d2012-04-06 10:23:27 -0700507
508 for (i = 0; i < apq8064_ion_pdata.nr; ++i) {
509 struct ion_platform_heap *heap = &(apq8064_ion_pdata.heaps[i]);
510
511 if (heap->extra_data) {
512 int fixed_position = NOT_FIXED;
Steve Mucklef132c6c2012-06-06 18:30:57 -0700513 struct ion_cp_heap_pdata *pdata = NULL;
Larry Bassel67b921d2012-04-06 10:23:27 -0700514
Mitchel Humpherys362b52b2012-09-13 10:53:22 -0700515 switch ((int) heap->type) {
Larry Bassel67b921d2012-04-06 10:23:27 -0700516 case ION_HEAP_TYPE_CP:
Hanumant Singheadb7502012-05-15 18:14:04 -0700517 pdata =
518 (struct ion_cp_heap_pdata *)heap->extra_data;
519 fixed_position = pdata->fixed_position;
Larry Bassel67b921d2012-04-06 10:23:27 -0700520 break;
521 case ION_HEAP_TYPE_CARVEOUT:
Laura Abbott744e3f82012-08-10 10:49:33 -0700522 case ION_HEAP_TYPE_DMA:
Larry Bassel67b921d2012-04-06 10:23:27 -0700523 fixed_position = ((struct ion_co_heap_pdata *)
524 heap->extra_data)->fixed_position;
525 break;
526 default:
527 break;
528 }
529
530 switch (fixed_position) {
531 case FIXED_LOW:
532 heap->base = fixed_low_start;
533 break;
534 case FIXED_MIDDLE:
535 heap->base = fixed_middle_start;
Laura Abbott744e3f82012-08-10 10:49:33 -0700536 if (middle_use_cma) {
537 ret = dma_declare_contiguous(
538 heap->priv,
539 heap->size,
540 fixed_middle_start,
541 0xa0000000);
542 WARN_ON(ret);
543 }
Hanumant Singheadb7502012-05-15 18:14:04 -0700544 pdata->secure_base = fixed_middle_start
545 - HOLE_SIZE;
546 pdata->secure_size = HOLE_SIZE + heap->size;
Larry Bassel67b921d2012-04-06 10:23:27 -0700547 break;
548 case FIXED_HIGH:
549 heap->base = fixed_high_start;
550 break;
551 default:
552 break;
553 }
554 }
555 }
Olav Haugan7c6aa742012-01-16 16:47:37 -0800556#endif
Kevin Chan13be4e22011-10-20 11:30:32 -0700557}
558
Huaibin Yang4a084e32011-12-15 15:25:52 -0800559static void __init reserve_mdp_memory(void)
560{
561 apq8064_mdp_writeback(apq8064_reserve_table);
562}
563
Laura Abbott93a4a352012-05-25 09:26:35 -0700564static void __init reserve_cache_dump_memory(void)
565{
566#ifdef CONFIG_MSM_CACHE_DUMP
567 unsigned int total;
568
569 total = apq8064_cache_dump_pdata.l1_size +
570 apq8064_cache_dump_pdata.l2_size;
571 apq8064_reserve_table[MEMTYPE_EBI1].size += total;
572#endif
573}
574
Abhijeet Dharmapurikardca26f72012-09-13 11:02:03 -0700575static void __init reserve_mpdcvs_memory(void)
576{
577 apq8064_reserve_table[MEMTYPE_EBI1].size += SZ_32K;
578}
579
Kevin Chan13be4e22011-10-20 11:30:32 -0700580static void __init apq8064_calculate_reserve_sizes(void)
581{
Olav Haugan7c6aa742012-01-16 16:47:37 -0800582 reserve_ion_memory();
Huaibin Yang4a084e32011-12-15 15:25:52 -0800583 reserve_mdp_memory();
Laura Abbott350c8362012-02-28 14:46:52 -0800584 reserve_rtb_memory();
Laura Abbott93a4a352012-05-25 09:26:35 -0700585 reserve_cache_dump_memory();
Abhijeet Dharmapurikardca26f72012-09-13 11:02:03 -0700586 reserve_mpdcvs_memory();
Laura Abbottf3aada42013-03-08 14:44:52 -0800587 apq8064_reserve_table[MEMTYPE_EBI1].size += msm_contig_mem_size;
Kevin Chan13be4e22011-10-20 11:30:32 -0700588}
589
590static struct reserve_info apq8064_reserve_info __initdata = {
591 .memtype_reserve_table = apq8064_reserve_table,
592 .calculate_reserve_sizes = apq8064_calculate_reserve_sizes,
Larry Bassel67b921d2012-04-06 10:23:27 -0700593 .reserve_fixed_area = apq8064_reserve_fixed_area,
Kevin Chan13be4e22011-10-20 11:30:32 -0700594 .paddr_to_memtype = apq8064_paddr_to_memtype,
595};
596
Aravind Venkateswaran8ac7f412012-03-16 17:57:30 -0700597static char prim_panel_name[PANEL_NAME_MAX_LEN];
598static char ext_panel_name[PANEL_NAME_MAX_LEN];
Ajay Singh Parmar6b82d2b2012-07-19 17:23:26 +0530599
600static int ext_resolution;
601
Aravind Venkateswaran8ac7f412012-03-16 17:57:30 -0700602static int __init prim_display_setup(char *param)
603{
604 if (strnlen(param, PANEL_NAME_MAX_LEN))
605 strlcpy(prim_panel_name, param, PANEL_NAME_MAX_LEN);
606 return 0;
607}
608early_param("prim_display", prim_display_setup);
609
610static int __init ext_display_setup(char *param)
611{
612 if (strnlen(param, PANEL_NAME_MAX_LEN))
613 strlcpy(ext_panel_name, param, PANEL_NAME_MAX_LEN);
614 return 0;
615}
616early_param("ext_display", ext_display_setup);
617
Ajay Singh Parmar6b82d2b2012-07-19 17:23:26 +0530618static int __init hdmi_resulution_setup(char *param)
619{
620 int ret;
621 ret = kstrtoint(param, 10, &ext_resolution);
622 return ret;
623}
624early_param("ext_resolution", hdmi_resulution_setup);
625
Kevin Chan13be4e22011-10-20 11:30:32 -0700626static void __init apq8064_reserve(void)
627{
Ajay Singh Parmar6b82d2b2012-07-19 17:23:26 +0530628 apq8064_set_display_params(prim_panel_name, ext_panel_name,
629 ext_resolution);
Kevin Chan13be4e22011-10-20 11:30:32 -0700630 msm_reserve();
631}
632
Laura Abbott6988cef2012-03-15 14:27:13 -0700633static void __init apq8064_early_reserve(void)
634{
635 reserve_info = &apq8064_reserve_info;
Laura Abbott6988cef2012-03-15 14:27:13 -0700636}
Hemant Kumara945b472012-01-25 15:08:06 -0800637#ifdef CONFIG_USB_EHCI_MSM_HSIC
Hemant Kumare6275972012-02-29 20:06:21 -0800638/* Bandwidth requests (zero) if no vote placed */
639static struct msm_bus_vectors hsic_init_vectors[] = {
640 {
641 .src = MSM_BUS_MASTER_SPS,
Hemant Kumare6275972012-02-29 20:06:21 -0800642 .dst = MSM_BUS_SLAVE_SPS,
643 .ab = 0,
644 .ib = 0,
645 },
646};
647
648/* Bus bandwidth requests in Bytes/sec */
649static struct msm_bus_vectors hsic_max_vectors[] = {
650 {
651 .src = MSM_BUS_MASTER_SPS,
Hemant Kumare6275972012-02-29 20:06:21 -0800652 .dst = MSM_BUS_SLAVE_SPS,
653 .ab = 0,
Hemant Kumar3b743cd2012-10-17 13:48:10 -0700654 .ib = 256000000, /*vote for 32Mhz dfab clk rate*/
Hemant Kumare6275972012-02-29 20:06:21 -0800655 },
656};
657
658static struct msm_bus_paths hsic_bus_scale_usecases[] = {
659 {
660 ARRAY_SIZE(hsic_init_vectors),
661 hsic_init_vectors,
662 },
663 {
664 ARRAY_SIZE(hsic_max_vectors),
665 hsic_max_vectors,
666 },
667};
668
669static struct msm_bus_scale_pdata hsic_bus_scale_pdata = {
670 hsic_bus_scale_usecases,
671 ARRAY_SIZE(hsic_bus_scale_usecases),
672 .name = "hsic",
673};
674
Hemant Kumara945b472012-01-25 15:08:06 -0800675static struct msm_hsic_host_platform_data msm_hsic_pdata = {
Hemant Kumare6275972012-02-29 20:06:21 -0800676 .strobe = 88,
677 .data = 89,
Manu Gautam3c598392013-03-22 16:59:10 +0530678 .phy_sof_workaround = true,
Hemant Kumare6275972012-02-29 20:06:21 -0800679 .bus_scale_table = &hsic_bus_scale_pdata,
Hemant Kumara945b472012-01-25 15:08:06 -0800680};
681#else
682static struct msm_hsic_host_platform_data msm_hsic_pdata;
683#endif
684
Hemant Kumarcb7d8a12012-01-25 12:25:55 -0800685#define PID_MAGIC_ID 0x71432909
686#define SERIAL_NUM_MAGIC_ID 0x61945374
687#define SERIAL_NUMBER_LENGTH 127
688#define DLOAD_USB_BASE_ADD 0x2A03F0C8
689
690struct magic_num_struct {
691 uint32_t pid;
692 uint32_t serial_num;
693};
694
695struct dload_struct {
696 uint32_t reserved1;
697 uint32_t reserved2;
698 uint32_t reserved3;
699 uint16_t reserved4;
700 uint16_t pid;
701 char serial_number[SERIAL_NUMBER_LENGTH];
702 uint16_t reserved5;
703 struct magic_num_struct magic_struct;
704};
705
706static int usb_diag_update_pid_and_serial_num(uint32_t pid, const char *snum)
707{
708 struct dload_struct __iomem *dload = 0;
709
710 dload = ioremap(DLOAD_USB_BASE_ADD, sizeof(*dload));
711 if (!dload) {
712 pr_err("%s: cannot remap I/O memory region: %08x\n",
713 __func__, DLOAD_USB_BASE_ADD);
714 return -ENXIO;
715 }
716
717 pr_debug("%s: dload:%p pid:%x serial_num:%s\n",
718 __func__, dload, pid, snum);
719 /* update pid */
720 dload->magic_struct.pid = PID_MAGIC_ID;
721 dload->pid = pid;
722
723 /* update serial number */
724 dload->magic_struct.serial_num = 0;
725 if (!snum) {
726 memset(dload->serial_number, 0, SERIAL_NUMBER_LENGTH);
727 goto out;
728 }
729
730 dload->magic_struct.serial_num = SERIAL_NUM_MAGIC_ID;
731 strlcpy(dload->serial_number, snum, SERIAL_NUMBER_LENGTH);
732out:
733 iounmap(dload);
734 return 0;
735}
736
737static struct android_usb_platform_data android_usb_pdata = {
738 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
739};
740
Hemant Kumar4933b072011-10-17 23:43:11 -0700741static struct platform_device android_usb_device = {
Hemant Kumarcb7d8a12012-01-25 12:25:55 -0800742 .name = "android_usb",
743 .id = -1,
744 .dev = {
745 .platform_data = &android_usb_pdata,
746 },
Hemant Kumar4933b072011-10-17 23:43:11 -0700747};
748
Hemant Kumar7620eed2012-02-26 09:08:43 -0800749/* Bandwidth requests (zero) if no vote placed */
750static struct msm_bus_vectors usb_init_vectors[] = {
751 {
752 .src = MSM_BUS_MASTER_SPS,
753 .dst = MSM_BUS_SLAVE_EBI_CH0,
754 .ab = 0,
755 .ib = 0,
756 },
757};
758
759/* Bus bandwidth requests in Bytes/sec */
760static struct msm_bus_vectors usb_max_vectors[] = {
761 {
762 .src = MSM_BUS_MASTER_SPS,
763 .dst = MSM_BUS_SLAVE_EBI_CH0,
764 .ab = 60000000, /* At least 480Mbps on bus. */
765 .ib = 960000000, /* MAX bursts rate */
766 },
767};
768
769static struct msm_bus_paths usb_bus_scale_usecases[] = {
770 {
771 ARRAY_SIZE(usb_init_vectors),
772 usb_init_vectors,
773 },
774 {
775 ARRAY_SIZE(usb_max_vectors),
776 usb_max_vectors,
777 },
778};
779
780static struct msm_bus_scale_pdata usb_bus_scale_pdata = {
781 usb_bus_scale_usecases,
782 ARRAY_SIZE(usb_bus_scale_usecases),
783 .name = "usb",
784};
785
Vamsi Krishna1f8704c2012-03-29 18:24:24 -0700786static int phy_init_seq[] = {
Chiranjeevi Velempatif983aeb2012-08-23 08:16:50 +0530787 0x68, 0x81, /* update DC voltage level */
Vamsi Krishna1f8704c2012-03-29 18:24:24 -0700788 0x24, 0x82, /* set pre-emphasis and rise/fall time */
789 -1
790};
791
Vijayavardhan Vennapusa4fa13692012-08-02 14:35:03 +0530792#define PMIC_GPIO_DP 27 /* PMIC GPIO for D+ change */
793#define PMIC_GPIO_DP_IRQ PM8921_GPIO_IRQ(PM8921_IRQ_BASE, PMIC_GPIO_DP)
Jack Pham87f202f2012-08-06 00:24:22 -0700794#define MSM_MPM_PIN_USB1_OTGSESSVLD 40
795
Hemant Kumar4933b072011-10-17 23:43:11 -0700796static struct msm_otg_platform_data msm_otg_pdata = {
Hemant Kumard86c4882012-01-24 19:39:37 -0800797 .mode = USB_OTG,
798 .otg_control = OTG_PMIC_CONTROL,
Hemant Kumar4933b072011-10-17 23:43:11 -0700799 .phy_type = SNPS_28NM_INTEGRATED_PHY,
Hemant Kumard86c4882012-01-24 19:39:37 -0800800 .pmic_id_irq = PM8921_USB_ID_IN_IRQ(PM8921_IRQ_BASE),
801 .power_budget = 750,
Hemant Kumar7620eed2012-02-26 09:08:43 -0800802 .bus_scale_table = &usb_bus_scale_pdata,
Vamsi Krishna1f8704c2012-03-29 18:24:24 -0700803 .phy_init_seq = phy_init_seq,
Jack Pham87f202f2012-08-06 00:24:22 -0700804 .mpm_otgsessvld_int = MSM_MPM_PIN_USB1_OTGSESSVLD,
Hemant Kumar4933b072011-10-17 23:43:11 -0700805};
806
Hemant Kumar1d66e1c2012-02-13 15:24:59 -0800807static struct msm_usb_host_platform_data msm_ehci_host_pdata3 = {
Manu Gautam91223e02011-11-08 15:27:22 +0530808 .power_budget = 500,
809};
810
Hemant Kumar1d66e1c2012-02-13 15:24:59 -0800811#ifdef CONFIG_USB_EHCI_MSM_HOST4
812static struct msm_usb_host_platform_data msm_ehci_host_pdata4;
813#endif
814
Manu Gautam91223e02011-11-08 15:27:22 +0530815static void __init apq8064_ehci_host_init(void)
816{
Chiranjeevi Velempatib822fa32012-05-23 22:05:59 +0530817 if (machine_is_apq8064_liquid() || machine_is_mpq8064_cdp() ||
Chiranjeevi Velempatidd4dbaa2012-10-05 16:22:04 +0530818 machine_is_mpq8064_hrd() || machine_is_mpq8064_dtv() ||
Rohit Vaswani4375c802013-01-09 13:38:19 -0800819 machine_is_apq8064_cdp() || machine_is_fsm8064_ep()) {
Chiranjeevi Velempatib822fa32012-05-23 22:05:59 +0530820 if (machine_is_apq8064_liquid())
821 msm_ehci_host_pdata3.dock_connect_irq =
822 PM8921_MPP_IRQ(PM8921_IRQ_BASE, 9);
Vijayavardhan Vennapusa4fa13692012-08-02 14:35:03 +0530823 else
824 msm_ehci_host_pdata3.pmic_gpio_dp_irq =
825 PMIC_GPIO_DP_IRQ;
Hemant Kumar56925352012-02-13 16:59:52 -0800826
Manu Gautam91223e02011-11-08 15:27:22 +0530827 apq8064_device_ehci_host3.dev.platform_data =
Hemant Kumar1d66e1c2012-02-13 15:24:59 -0800828 &msm_ehci_host_pdata3;
Manu Gautam91223e02011-11-08 15:27:22 +0530829 platform_device_register(&apq8064_device_ehci_host3);
Hemant Kumar1d66e1c2012-02-13 15:24:59 -0800830
831#ifdef CONFIG_USB_EHCI_MSM_HOST4
832 apq8064_device_ehci_host4.dev.platform_data =
833 &msm_ehci_host_pdata4;
834 platform_device_register(&apq8064_device_ehci_host4);
835#endif
Manu Gautam91223e02011-11-08 15:27:22 +0530836 }
837}
838
David Keitel2f613d92012-02-15 11:29:16 -0800839static struct smb349_platform_data smb349_data __initdata = {
840 .en_n_gpio = PM8921_GPIO_PM_TO_SYS(37),
841 .chg_susp_gpio = PM8921_GPIO_PM_TO_SYS(30),
842 .chg_current_ma = 2200,
843};
844
845static struct i2c_board_info smb349_charger_i2c_info[] __initdata = {
846 {
847 I2C_BOARD_INFO(SMB349_NAME, 0x1B),
848 .platform_data = &smb349_data,
849 },
850};
851
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -0800852struct sx150x_platform_data apq8064_sx150x_data[] = {
853 [SX150X_EPM] = {
854 .gpio_base = GPIO_EPM_EXPANDER_BASE,
855 .oscio_is_gpo = false,
856 .io_pullup_ena = 0x0,
857 .io_pulldn_ena = 0x0,
858 .io_open_drain_ena = 0x0,
859 .io_polarity = 0,
860 .irq_summary = -1,
861 },
862};
863
864static struct epm_chan_properties ads_adc_channel_data[] = {
Yan He44c59962012-08-31 11:14:58 -0700865 {10, 100}, {1000, 1}, {10, 100}, {1000, 1},
866 {10, 100}, {1000, 1}, {10, 100}, {1000, 1},
867 {10, 100}, {20, 100}, {500, 100}, {5, 100},
868 {1000, 1}, {200, 100}, {50, 100}, {10, 100},
869 {510, 100}, {50, 100}, {20, 100}, {100, 100},
870 {510, 100}, {20, 100}, {50, 100}, {200, 100},
871 {10, 100}, {20, 100}, {1000, 1}, {10, 100},
872 {200, 100}, {510, 100}, {1000, 100}, {200, 100},
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -0800873};
874
875static struct epm_adc_platform_data epm_adc_pdata = {
876 .channel = ads_adc_channel_data,
877 .bus_id = 0x0,
878 .epm_i2c_board_info = {
879 .type = "sx1509q",
880 .addr = 0x3e,
881 .platform_data = &apq8064_sx150x_data[SX150X_EPM],
882 },
883 .gpio_expander_base_addr = GPIO_EPM_EXPANDER_BASE,
884};
885
886static struct platform_device epm_adc_device = {
887 .name = "epm_adc",
888 .id = -1,
889 .dev = {
890 .platform_data = &epm_adc_pdata,
891 },
892};
893
894static void __init apq8064_epm_adc_init(void)
895{
896 epm_adc_pdata.num_channels = 32;
897 epm_adc_pdata.num_adc = 2;
898 epm_adc_pdata.chan_per_adc = 16;
899 epm_adc_pdata.chan_per_mux = 8;
900};
901
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -0800902/* Micbias setting is based on 8660 CDP/MTP/FLUID requirement
903 * 4 micbiases are used to power various analog and digital
904 * microphones operating at 1800 mV. Technically, all micbiases
905 * can source from single cfilter since all microphones operate
906 * at the same voltage level. The arrangement below is to make
907 * sure all cfilters are exercised. LDO_H regulator ouput level
908 * does not need to be as high as 2.85V. It is choosen for
909 * microphone sensitivity purpose.
910 */
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530911static struct wcd9xxx_pdata apq8064_tabla_platform_data = {
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -0800912 .slimbus_slave_device = {
913 .name = "tabla-slave",
914 .e_addr = {0, 0, 0x10, 0, 0x17, 2},
915 },
Swaminathan Sathappancef966d2011-12-15 17:27:04 -0800916 .irq = MSM_GPIO_TO_INT(42),
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -0800917 .irq_base = TABLA_INTERRUPT_BASE,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530918 .num_irqs = NR_WCD9XXX_IRQS,
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -0800919 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
920 .micbias = {
921 .ldoh_v = TABLA_LDOH_2P85_V,
922 .cfilt1_mv = 1800,
Bhalchandra Gajare975c53a2012-08-10 12:16:49 -0700923 .cfilt2_mv = 2700,
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -0800924 .cfilt3_mv = 1800,
925 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
926 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
927 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
928 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530929 },
930 .regulator = {
931 {
932 .name = "CDC_VDD_CP",
933 .min_uV = 1800000,
934 .max_uV = 1800000,
935 .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX,
936 },
937 {
938 .name = "CDC_VDDA_RX",
939 .min_uV = 1800000,
940 .max_uV = 1800000,
941 .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX,
942 },
943 {
944 .name = "CDC_VDDA_TX",
945 .min_uV = 1800000,
946 .max_uV = 1800000,
947 .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX,
948 },
949 {
950 .name = "VDDIO_CDC",
951 .min_uV = 1800000,
952 .max_uV = 1800000,
953 .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX,
954 },
955 {
956 .name = "VDDD_CDC_D",
957 .min_uV = 1225000,
David Collins62debe82012-06-06 17:01:03 -0700958 .max_uV = 1250000,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530959 .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
960 },
961 {
962 .name = "CDC_VDDA_A_1P2V",
963 .min_uV = 1225000,
David Collins62debe82012-06-06 17:01:03 -0700964 .max_uV = 1250000,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530965 .optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX,
966 },
967 },
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -0800968};
969
970static struct slim_device apq8064_slim_tabla = {
971 .name = "tabla-slim",
972 .e_addr = {0, 1, 0x10, 0, 0x17, 2},
973 .dev = {
974 .platform_data = &apq8064_tabla_platform_data,
975 },
976};
977
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530978static struct wcd9xxx_pdata apq8064_tabla20_platform_data = {
Swaminathan Sathappancef966d2011-12-15 17:27:04 -0800979 .slimbus_slave_device = {
980 .name = "tabla-slave",
981 .e_addr = {0, 0, 0x60, 0, 0x17, 2},
982 },
983 .irq = MSM_GPIO_TO_INT(42),
984 .irq_base = TABLA_INTERRUPT_BASE,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530985 .num_irqs = NR_WCD9XXX_IRQS,
Swaminathan Sathappancef966d2011-12-15 17:27:04 -0800986 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
987 .micbias = {
988 .ldoh_v = TABLA_LDOH_2P85_V,
989 .cfilt1_mv = 1800,
Bhalchandra Gajare975c53a2012-08-10 12:16:49 -0700990 .cfilt2_mv = 2700,
Swaminathan Sathappancef966d2011-12-15 17:27:04 -0800991 .cfilt3_mv = 1800,
992 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
993 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
994 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
995 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +0530996 },
997 .regulator = {
998 {
999 .name = "CDC_VDD_CP",
1000 .min_uV = 1800000,
1001 .max_uV = 1800000,
1002 .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX,
1003 },
1004 {
1005 .name = "CDC_VDDA_RX",
1006 .min_uV = 1800000,
1007 .max_uV = 1800000,
1008 .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX,
1009 },
1010 {
1011 .name = "CDC_VDDA_TX",
1012 .min_uV = 1800000,
1013 .max_uV = 1800000,
1014 .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX,
1015 },
1016 {
1017 .name = "VDDIO_CDC",
1018 .min_uV = 1800000,
1019 .max_uV = 1800000,
1020 .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX,
1021 },
1022 {
1023 .name = "VDDD_CDC_D",
1024 .min_uV = 1225000,
David Collins62debe82012-06-06 17:01:03 -07001025 .max_uV = 1250000,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +05301026 .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
1027 },
1028 {
1029 .name = "CDC_VDDA_A_1P2V",
1030 .min_uV = 1225000,
David Collins62debe82012-06-06 17:01:03 -07001031 .max_uV = 1250000,
Asish Bhattacharyab1aeae22012-02-15 08:29:28 +05301032 .optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX,
1033 },
1034 },
Swaminathan Sathappancef966d2011-12-15 17:27:04 -08001035};
1036
1037static struct slim_device apq8064_slim_tabla20 = {
1038 .name = "tabla2x-slim",
1039 .e_addr = {0, 1, 0x60, 0, 0x17, 2},
1040 .dev = {
1041 .platform_data = &apq8064_tabla20_platform_data,
1042 },
1043};
1044
Kuirong Wangf8c5e142012-06-21 16:17:32 -07001045static struct wcd9xxx_pdata apq8064_tabla_i2c_platform_data = {
1046 .irq = MSM_GPIO_TO_INT(77),
1047 .irq_base = TABLA_INTERRUPT_BASE,
1048 .num_irqs = NR_WCD9XXX_IRQS,
1049 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
1050 .micbias = {
1051 .ldoh_v = TABLA_LDOH_2P85_V,
1052 .cfilt1_mv = 1800,
1053 .cfilt2_mv = 1800,
1054 .cfilt3_mv = 1800,
1055 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
1056 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
1057 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
1058 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
1059 },
1060 .regulator = {
1061 {
1062 .name = "CDC_VDD_CP",
1063 .min_uV = 1800000,
1064 .max_uV = 1800000,
1065 .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX,
1066 },
1067 {
1068 .name = "CDC_VDDA_RX",
1069 .min_uV = 1800000,
1070 .max_uV = 1800000,
1071 .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX,
1072 },
1073 {
1074 .name = "CDC_VDDA_TX",
1075 .min_uV = 1800000,
1076 .max_uV = 1800000,
1077 .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX,
1078 },
1079 {
1080 .name = "VDDIO_CDC",
1081 .min_uV = 1800000,
1082 .max_uV = 1800000,
1083 .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX,
1084 },
1085 {
1086 .name = "VDDD_CDC_D",
1087 .min_uV = 1225000,
1088 .max_uV = 1250000,
1089 .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
1090 },
1091 {
1092 .name = "CDC_VDDA_A_1P2V",
1093 .min_uV = 1225000,
1094 .max_uV = 1250000,
1095 .optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX,
1096 },
1097 },
1098};
1099
1100static struct i2c_board_info apq8064_tabla_i2c_device_info[] __initdata = {
1101 {
1102 I2C_BOARD_INFO("tabla top level",
1103 APQ_8064_TABLA_I2C_SLAVE_ADDR),
1104 .platform_data = &apq8064_tabla_i2c_platform_data,
1105 },
1106 {
1107 I2C_BOARD_INFO("tabla analog",
1108 APQ_8064_TABLA_ANALOG_I2C_SLAVE_ADDR),
1109 .platform_data = &apq8064_tabla_i2c_platform_data,
1110 },
1111 {
1112 I2C_BOARD_INFO("tabla digital1",
1113 APQ_8064_TABLA_DIGITAL1_I2C_SLAVE_ADDR),
1114 .platform_data = &apq8064_tabla_i2c_platform_data,
1115 },
1116 {
1117 I2C_BOARD_INFO("tabla digital2",
1118 APQ_8064_TABLA_DIGITAL2_I2C_SLAVE_ADDR),
1119 .platform_data = &apq8064_tabla_i2c_platform_data,
1120 },
1121};
1122
Santosh Mardi344455a2012-09-07 13:22:16 +05301123static struct wcd9xxx_pdata mpq8064_ashiko20_platform_data = {
1124 .slimbus_slave_device = {
1125 .name = "tabla-slave",
1126 .e_addr = {0, 0, 0x60, 0, 0x17, 2},
1127 },
1128 .irq = MSM_GPIO_TO_INT(42),
1129 .irq_base = TABLA_INTERRUPT_BASE,
1130 .num_irqs = NR_WCD9XXX_IRQS,
1131 .reset_gpio = PM8921_GPIO_PM_TO_SYS(34),
1132 .micbias = {
1133 .ldoh_v = TABLA_LDOH_2P85_V,
1134 .cfilt1_mv = 1800,
1135 .cfilt2_mv = 1800,
1136 .cfilt3_mv = 1800,
1137 .bias1_cfilt_sel = TABLA_CFILT1_SEL,
1138 .bias2_cfilt_sel = TABLA_CFILT2_SEL,
1139 .bias3_cfilt_sel = TABLA_CFILT3_SEL,
1140 .bias4_cfilt_sel = TABLA_CFILT3_SEL,
1141 },
1142 .regulator = {
1143 {
1144 .name = "CDC_VDD_CP",
1145 .min_uV = 1800000,
1146 .max_uV = 1800000,
1147 .optimum_uA = WCD9XXX_CDC_VDDA_CP_CUR_MAX,
1148 },
1149 {
1150 .name = "CDC_VDDA_RX",
1151 .min_uV = 1800000,
1152 .max_uV = 1800000,
1153 .optimum_uA = WCD9XXX_CDC_VDDA_RX_CUR_MAX,
1154 },
1155 {
1156 .name = "CDC_VDDA_TX",
1157 .min_uV = 1800000,
1158 .max_uV = 1800000,
1159 .optimum_uA = WCD9XXX_CDC_VDDA_TX_CUR_MAX,
1160 },
1161 {
1162 .name = "VDDIO_CDC",
1163 .min_uV = 1800000,
1164 .max_uV = 1800000,
1165 .optimum_uA = WCD9XXX_VDDIO_CDC_CUR_MAX,
1166 },
1167 {
1168 .name = "HRD_VDDD_CDC_D",
1169 .min_uV = 1200000,
1170 .max_uV = 1200000,
1171 .optimum_uA = WCD9XXX_VDDD_CDC_D_CUR_MAX,
1172 },
1173 {
1174 .name = "HRD_CDC_VDDA_A_1P2V",
1175 .min_uV = 1200000,
1176 .max_uV = 1200000,
1177 .optimum_uA = WCD9XXX_VDDD_CDC_A_CUR_MAX,
1178 },
1179 },
1180};
1181
1182static struct slim_device mpq8064_slim_ashiko20 = {
1183 .name = "tabla2x-slim",
1184 .e_addr = {0, 1, 0x60, 0, 0x17, 2},
1185 .dev = {
1186 .platform_data = &mpq8064_ashiko20_platform_data,
1187 },
1188};
1189
1190
Santosh Mardi695be0d2012-04-10 23:21:12 +05301191/* enable the level shifter for cs8427 to make sure the I2C
1192 * clock is running at 100KHz and voltage levels are at 3.3
1193 * and 5 volts
1194 */
Aviral Gupta6bb723f2012-11-06 22:27:17 +05301195static int enable_100KHz_ls(int enable, int gpio)
Santosh Mardi695be0d2012-04-10 23:21:12 +05301196{
Aviral Gupta6bb723f2012-11-06 22:27:17 +05301197 if (enable)
1198 gpio_direction_output(gpio, 1);
1199 else
1200 gpio_direction_output(gpio, 0);
1201 return 0;
Santosh Mardi695be0d2012-04-10 23:21:12 +05301202}
1203
Santosh Mardieff9a742012-04-09 23:23:39 +05301204static struct cs8427_platform_data cs8427_i2c_platform_data = {
1205 .irq = SX150X_GPIO(1, 4),
1206 .reset_gpio = SX150X_GPIO(1, 6),
Santosh Mardi695be0d2012-04-10 23:21:12 +05301207 .enable = enable_100KHz_ls,
Aviral Gupta6bb723f2012-11-06 22:27:17 +05301208 .ls_gpio = SX150X_GPIO(1, 10),
Santosh Mardieff9a742012-04-09 23:23:39 +05301209};
1210
1211static struct i2c_board_info cs8427_device_info[] __initdata = {
1212 {
1213 I2C_BOARD_INFO("cs8427", CS8427_ADDR4),
1214 .platform_data = &cs8427_i2c_platform_data,
1215 },
1216};
1217
Amy Maloche70090f992012-02-16 16:35:26 -08001218#define HAP_SHIFT_LVL_OE_GPIO PM8921_MPP_PM_TO_SYS(8)
1219#define ISA1200_HAP_EN_GPIO PM8921_GPIO_PM_TO_SYS(33)
1220#define ISA1200_HAP_LEN_GPIO PM8921_GPIO_PM_TO_SYS(20)
David Collinsd49a1c52012-08-22 13:18:06 -07001221#define ISA1200_HAP_CLK_PM8921 PM8921_GPIO_PM_TO_SYS(44)
1222#define ISA1200_HAP_CLK_PM8917 PM8921_GPIO_PM_TO_SYS(38)
Amy Maloche70090f992012-02-16 16:35:26 -08001223
Mohan Pallaka2d877602012-05-11 13:07:30 +05301224static int isa1200_clk_enable(bool on)
Amy Maloche70090f992012-02-16 16:35:26 -08001225{
David Collinsd49a1c52012-08-22 13:18:06 -07001226 unsigned int gpio = ISA1200_HAP_CLK_PM8921;
Amy Maloche8f973892012-03-26 14:53:13 -07001227 int rc = 0;
1228
David Collinsd49a1c52012-08-22 13:18:06 -07001229 if (socinfo_get_pmic_model() == PMIC_MODEL_PM8917)
1230 gpio = ISA1200_HAP_CLK_PM8917;
1231
1232 gpio_set_value_cansleep(gpio, on);
Amy Maloche70090f992012-02-16 16:35:26 -08001233
Mohan Pallaka2d877602012-05-11 13:07:30 +05301234 if (on) {
Amy Maloche8f973892012-03-26 14:53:13 -07001235 rc = pm8xxx_aux_clk_control(CLK_MP3_2, XO_DIV_1, true);
Mohan Pallaka2d877602012-05-11 13:07:30 +05301236 if (rc) {
1237 pr_err("%s: unable to write aux clock register(%d)\n",
1238 __func__, rc);
1239 goto err_gpio_dis;
1240 }
1241 } else {
Amy Maloche8f973892012-03-26 14:53:13 -07001242 rc = pm8xxx_aux_clk_control(CLK_MP3_2, XO_DIV_NONE, true);
Mohan Pallaka2d877602012-05-11 13:07:30 +05301243 if (rc)
1244 pr_err("%s: unable to write aux clock register(%d)\n",
1245 __func__, rc);
Amy Maloche8f973892012-03-26 14:53:13 -07001246 }
1247
1248 return rc;
Mohan Pallaka2d877602012-05-11 13:07:30 +05301249
1250err_gpio_dis:
David Collinsd49a1c52012-08-22 13:18:06 -07001251 gpio_set_value_cansleep(gpio, !on);
Mohan Pallaka2d877602012-05-11 13:07:30 +05301252 return rc;
Amy Maloche70090f992012-02-16 16:35:26 -08001253}
1254
1255static int isa1200_dev_setup(bool enable)
1256{
David Collinsd49a1c52012-08-22 13:18:06 -07001257 unsigned int gpio = ISA1200_HAP_CLK_PM8921;
Amy Maloche70090f992012-02-16 16:35:26 -08001258 int rc = 0;
1259
David Collinsd49a1c52012-08-22 13:18:06 -07001260 if (socinfo_get_pmic_model() == PMIC_MODEL_PM8917)
1261 gpio = ISA1200_HAP_CLK_PM8917;
1262
Amy Maloche70090f992012-02-16 16:35:26 -08001263 if (!enable)
1264 goto free_gpio;
1265
David Collinsd49a1c52012-08-22 13:18:06 -07001266 rc = gpio_request(gpio, "haptics_clk");
Amy Maloche70090f992012-02-16 16:35:26 -08001267 if (rc) {
1268 pr_err("%s: unable to request gpio %d config(%d)\n",
David Collinsd49a1c52012-08-22 13:18:06 -07001269 __func__, gpio, rc);
Amy Maloche70090f992012-02-16 16:35:26 -08001270 return rc;
1271 }
1272
David Collinsd49a1c52012-08-22 13:18:06 -07001273 rc = gpio_direction_output(gpio, 0);
Amy Maloche70090f992012-02-16 16:35:26 -08001274 if (rc) {
1275 pr_err("%s: unable to set direction\n", __func__);
1276 goto free_gpio;
1277 }
1278
1279 return 0;
1280
1281free_gpio:
David Collinsd49a1c52012-08-22 13:18:06 -07001282 gpio_free(gpio);
Amy Maloche70090f992012-02-16 16:35:26 -08001283 return rc;
1284}
1285
1286static struct isa1200_regulator isa1200_reg_data[] = {
1287 {
1288 .name = "vddp",
1289 .min_uV = ISA_I2C_VTG_MIN_UV,
1290 .max_uV = ISA_I2C_VTG_MAX_UV,
1291 .load_uA = ISA_I2C_CURR_UA,
1292 },
1293};
1294
1295static struct isa1200_platform_data isa1200_1_pdata = {
1296 .name = "vibrator",
1297 .dev_setup = isa1200_dev_setup,
Mohan Pallaka2d877602012-05-11 13:07:30 +05301298 .clk_enable = isa1200_clk_enable,
Mohan Pallaka32f20a72012-06-14 14:41:11 +05301299 .need_pwm_clk = true,
Amy Maloche70090f992012-02-16 16:35:26 -08001300 .hap_en_gpio = ISA1200_HAP_EN_GPIO,
1301 .hap_len_gpio = ISA1200_HAP_LEN_GPIO,
1302 .max_timeout = 15000,
1303 .mode_ctrl = PWM_GEN_MODE,
1304 .pwm_fd = {
1305 .pwm_div = 256,
1306 },
1307 .is_erm = false,
1308 .smart_en = true,
1309 .ext_clk_en = true,
1310 .chip_en = 1,
1311 .regulator_info = isa1200_reg_data,
1312 .num_regulators = ARRAY_SIZE(isa1200_reg_data),
1313};
1314
1315static struct i2c_board_info isa1200_board_info[] __initdata = {
1316 {
1317 I2C_BOARD_INFO("isa1200_1", 0x90>>1),
1318 .platform_data = &isa1200_1_pdata,
1319 },
1320};
Jing Lin21ed4de2012-02-05 15:53:28 -08001321/* configuration data for mxt1386e using V2.1 firmware */
1322static const u8 mxt1386e_config_data_v2_1[] = {
1323 /* T6 Object */
1324 0, 0, 0, 0, 0, 0,
1325 /* T38 Object */
Jing Lin164f69a2012-09-21 13:26:34 -07001326 14, 4, 0, 5, 11, 12, 0, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -08001327 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1328 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1329 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1330 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1331 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1332 0, 0, 0, 0,
1333 /* T7 Object */
Jing Lin164f69a2012-09-21 13:26:34 -07001334 32, 8, 50,
Jing Lin21ed4de2012-02-05 15:53:28 -08001335 /* T8 Object */
Jing Linf1208fd2012-02-23 11:15:42 -08001336 25, 0, 20, 20, 0, 0, 0, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -08001337 /* T9 Object */
Jing Lin943fcec2012-05-25 13:58:57 -07001338 139, 0, 0, 26, 42, 0, 32, 80, 2, 5,
Jing Linc6a55cfc2012-08-31 10:54:44 -07001339 0, 5, 5, 79, 10, 30, 10, 10, 255, 2,
Jing Linf1208fd2012-02-23 11:15:42 -08001340 85, 5, 0, 5, 9, 5, 12, 35, 70, 40,
1341 20, 5, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -08001342 /* T18 Object */
1343 0, 0,
1344 /* T24 Object */
1345 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1346 0, 0, 0, 0, 0, 0, 0, 0, 0,
1347 /* T25 Object */
Jing Lin943fcec2012-05-25 13:58:57 -07001348 1, 0, 60, 115, 156, 99,
Jing Lin21ed4de2012-02-05 15:53:28 -08001349 /* T27 Object */
1350 0, 0, 0, 0, 0, 0, 0,
1351 /* T40 Object */
1352 0, 0, 0, 0, 0,
1353 /* T42 Object */
Jing Lin943fcec2012-05-25 13:58:57 -07001354 0, 0, 255, 0, 255, 0, 0, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -08001355 /* T43 Object */
1356 0, 0, 0, 0, 0, 0, 0, 64, 0, 8,
1357 16,
1358 /* T46 Object */
Jing Linf1208fd2012-02-23 11:15:42 -08001359 68, 0, 16, 16, 0, 0, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -08001360 /* T47 Object */
1361 0, 0, 0, 0, 0, 0, 3, 64, 66, 0,
1362 /* T48 Object */
Jing Lin943fcec2012-05-25 13:58:57 -07001363 1, 64, 64, 0, 0, 0, 0, 0, 0, 0,
Jing Linf1208fd2012-02-23 11:15:42 -08001364 32, 40, 0, 10, 10, 0, 0, 100, 10, 90,
1365 0, 0, 0, 0, 0, 0, 0, 10, 1, 10,
1366 52, 10, 12, 0, 33, 0, 1, 0, 0, 0,
Jing Lin21ed4de2012-02-05 15:53:28 -08001367 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1368 0, 0, 0, 0,
1369 /* T56 Object */
1370 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1371 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1372 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1373 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Jing Linf1208fd2012-02-23 11:15:42 -08001374 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1375 0,
Jing Lin21ed4de2012-02-05 15:53:28 -08001376};
1377
Jing Lin03cc5b42012-11-28 15:00:55 -08001378/* configuration data for mxt1386e using V2.4.AB firmware */
1379static const u8 mxt1386e_config_data_v2_4_AB[] = {
1380 /* T6 Object */
1381 0, 0, 0, 0, 0, 0,
1382 /* Object 38, Instance = 0 */
1383 14, 5, 0, 0,
1384 /* Object 7, Instance = 0 */
1385 32, 8, 50, 0,
1386 /* Object 8, Instance = 0 */
1387 25, 0, 20, 20, 0, 0, 0, 0, 0, 0,
1388 /* Object 9, Instance = 0 */
1389 139, 0, 0, 26, 42, 0, 32, 80, 2, 5,
1390 0, 5, 5, 79, 10, 30, 10, 10, 255, 2,
1391 85, 5, 0, 5, 9, 5, 12, 35, 70, 40,
1392 20, 5, 0, 0, 0, 0,
1393 /* Object 18, Instance = 0 */
1394 0, 0,
1395 /* Object 24, Instance = 0 */
1396 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1397 0, 0, 0, 0, 0, 0, 0, 0, 0,
1398 /* Object 25, Instance = 0 */
1399 1, 0, 60, 115, 156, 99,
1400 /* Object 27, Instance = 0 */
1401 0, 0, 0, 0, 0, 0, 0,
1402 /* Object 40, Instance = 0 */
1403 0, 0, 0, 0, 0,
1404 /* Object 42, Instance = 0 */
1405 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1406 /* Object 43, Instance = 0 */
1407 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1408 0, 0,
1409 /* Object 46, Instance = 0 */
1410 68, 0, 16, 16, 0, 0, 0, 0, 0,
1411 /* Object 47, Instance = 0 */
1412 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1413 /* Object 56, Instance = 0 */
1414 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1415 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1416 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
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,
1420 /* Object 62, Instance = 0 */
1421 1, 0, 0, 2, 0, 0, 0, 0, 10, 0,
1422 0, 0, 0, 0, 0, 0, 0, 0, 0, 32,
1423 40, 10, 52, 10, 100, 10, 10, 10, 90, 0,
1424 0, 0, 0, 0, 33, 0, 1, 0, 0, 0,
1425 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1426 0, 0, 0, 0,
1427};
1428
Jing Lin21ed4de2012-02-05 15:53:28 -08001429#define MXT_TS_GPIO_IRQ 6
1430#define MXT_TS_PWR_EN_GPIO PM8921_GPIO_PM_TO_SYS(23)
1431#define MXT_TS_RESET_GPIO 33
1432
1433static struct mxt_config_info mxt_config_array[] = {
1434 {
1435 .config = mxt1386e_config_data_v2_1,
1436 .config_length = ARRAY_SIZE(mxt1386e_config_data_v2_1),
1437 .family_id = 0xA0,
1438 .variant_id = 0x7,
1439 .version = 0x21,
1440 .build = 0xAA,
Jing Linef4aa9b2012-03-26 12:01:41 -07001441 .bootldr_id = MXT_BOOTLOADER_ID_1386E,
Jing Lin03cc5b42012-11-28 15:00:55 -08001442 .fw_name = "atmel_8064_liquid_v2_4_AB.hex",
Jing Linef4aa9b2012-03-26 12:01:41 -07001443 },
1444 {
1445 /* The config data for V2.2.AA is the same as for V2.1.AA */
1446 .config = mxt1386e_config_data_v2_1,
1447 .config_length = ARRAY_SIZE(mxt1386e_config_data_v2_1),
1448 .family_id = 0xA0,
1449 .variant_id = 0x7,
1450 .version = 0x22,
1451 .build = 0xAA,
1452 .bootldr_id = MXT_BOOTLOADER_ID_1386E,
Jing Lin03cc5b42012-11-28 15:00:55 -08001453 .fw_name = "atmel_8064_liquid_v2_4_AB.hex",
1454 },
1455 {
1456 .config = mxt1386e_config_data_v2_4_AB,
1457 .config_length = ARRAY_SIZE(mxt1386e_config_data_v2_4_AB),
1458 .family_id = 0xA0,
1459 .variant_id = 0x7,
1460 .version = 0x24,
1461 .build = 0xAB,
1462 .bootldr_id = MXT_BOOTLOADER_ID_1386E,
Jing Lin21ed4de2012-02-05 15:53:28 -08001463 },
1464};
1465
1466static struct mxt_platform_data mxt_platform_data = {
1467 .config_array = mxt_config_array,
1468 .config_array_size = ARRAY_SIZE(mxt_config_array),
Mohan Pallaka56a1a5d2012-02-23 12:05:13 -08001469 .panel_minx = 0,
1470 .panel_maxx = 1365,
1471 .panel_miny = 0,
1472 .panel_maxy = 767,
1473 .disp_minx = 0,
1474 .disp_maxx = 1365,
1475 .disp_miny = 0,
1476 .disp_maxy = 767,
Anirudh Ghayal39dbe3f2012-04-13 15:43:16 +05301477 .irqflags = IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
Jing Lin21ed4de2012-02-05 15:53:28 -08001478 .i2c_pull_up = true,
1479 .reset_gpio = MXT_TS_RESET_GPIO,
1480 .irq_gpio = MXT_TS_GPIO_IRQ,
1481};
1482
1483static struct i2c_board_info mxt_device_info[] __initdata = {
1484 {
1485 I2C_BOARD_INFO("atmel_mxt_ts", 0x5b),
1486 .platform_data = &mxt_platform_data,
1487 .irq = MSM_GPIO_TO_INT(MXT_TS_GPIO_IRQ),
1488 },
1489};
Anirudh Ghayal2917a5a2012-02-05 19:51:07 -08001490#define CYTTSP_TS_GPIO_IRQ 6
Anirudh Ghayal2917a5a2012-02-05 19:51:07 -08001491#define CYTTSP_TS_GPIO_SLEEP 33
Amy Maloche609bb5e2012-08-03 09:41:42 -07001492#define CYTTSP_TS_GPIO_SLEEP_ALT 12
Anirudh Ghayal2917a5a2012-02-05 19:51:07 -08001493
1494static ssize_t tma340_vkeys_show(struct kobject *kobj,
1495 struct kobj_attribute *attr, char *buf)
1496{
1497 return snprintf(buf, 200,
1498 __stringify(EV_KEY) ":" __stringify(KEY_BACK) ":73:1120:97:97"
1499 ":" __stringify(EV_KEY) ":" __stringify(KEY_MENU) ":230:1120:97:97"
1500 ":" __stringify(EV_KEY) ":" __stringify(KEY_HOME) ":389:1120:97:97"
1501 ":" __stringify(EV_KEY) ":" __stringify(KEY_SEARCH) ":544:1120:97:97"
1502 "\n");
1503}
1504
1505static struct kobj_attribute tma340_vkeys_attr = {
1506 .attr = {
1507 .mode = S_IRUGO,
1508 },
1509 .show = &tma340_vkeys_show,
1510};
1511
1512static struct attribute *tma340_properties_attrs[] = {
1513 &tma340_vkeys_attr.attr,
1514 NULL
1515};
1516
1517static struct attribute_group tma340_properties_attr_group = {
1518 .attrs = tma340_properties_attrs,
1519};
1520
1521static int cyttsp_platform_init(struct i2c_client *client)
1522{
1523 int rc = 0;
1524 static struct kobject *tma340_properties_kobj;
1525
1526 tma340_vkeys_attr.attr.name = "virtualkeys.cyttsp-i2c";
1527 tma340_properties_kobj = kobject_create_and_add("board_properties",
1528 NULL);
1529 if (tma340_properties_kobj)
1530 rc = sysfs_create_group(tma340_properties_kobj,
1531 &tma340_properties_attr_group);
1532 if (!tma340_properties_kobj || rc)
1533 pr_err("%s: failed to create board_properties\n",
1534 __func__);
1535
1536 return 0;
1537}
1538
1539static struct cyttsp_regulator cyttsp_regulator_data[] = {
1540 {
1541 .name = "vdd",
1542 .min_uV = CY_TMA300_VTG_MIN_UV,
1543 .max_uV = CY_TMA300_VTG_MAX_UV,
1544 .hpm_load_uA = CY_TMA300_CURR_24HZ_UA,
1545 .lpm_load_uA = CY_TMA300_CURR_24HZ_UA,
1546 },
1547 {
1548 .name = "vcc_i2c",
1549 .min_uV = CY_I2C_VTG_MIN_UV,
1550 .max_uV = CY_I2C_VTG_MAX_UV,
1551 .hpm_load_uA = CY_I2C_CURR_UA,
1552 .lpm_load_uA = CY_I2C_CURR_UA,
1553 },
1554};
1555
1556static struct cyttsp_platform_data cyttsp_pdata = {
1557 .panel_maxx = 634,
1558 .panel_maxy = 1166,
Amy Maloche700605e2012-12-05 14:28:53 -08001559 .disp_minx = 18,
1560 .disp_maxx = 617,
1561 .disp_miny = 18,
1562 .disp_maxy = 1041,
Anirudh Ghayal2917a5a2012-02-05 19:51:07 -08001563 .flags = 0x01,
1564 .gen = CY_GEN3,
1565 .use_st = CY_USE_ST,
1566 .use_mt = CY_USE_MT,
1567 .use_hndshk = CY_SEND_HNDSHK,
1568 .use_trk_id = CY_USE_TRACKING_ID,
1569 .use_sleep = CY_USE_DEEP_SLEEP_SEL,
1570 .use_gestures = CY_USE_GESTURES,
1571 .fw_fname = "cyttsp_8064_mtp.hex",
1572 /* change act_intrvl to customize the Active power state
1573 * scanning/processing refresh interval for Operating mode
1574 */
1575 .act_intrvl = CY_ACT_INTRVL_DFLT,
1576 /* change tch_tmout to customize the touch timeout for the
1577 * Active power state for Operating mode
1578 */
1579 .tch_tmout = CY_TCH_TMOUT_DFLT,
1580 /* change lp_intrvl to customize the Low Power power state
1581 * scanning/processing refresh interval for Operating mode
1582 */
1583 .lp_intrvl = CY_LP_INTRVL_DFLT,
1584 .sleep_gpio = CYTTSP_TS_GPIO_SLEEP,
Amy Maloche9ba3ffe2012-04-26 10:31:20 -07001585 .resout_gpio = -1,
Anirudh Ghayal2917a5a2012-02-05 19:51:07 -08001586 .irq_gpio = CYTTSP_TS_GPIO_IRQ,
1587 .regulator_info = cyttsp_regulator_data,
1588 .num_regulators = ARRAY_SIZE(cyttsp_regulator_data),
1589 .init = cyttsp_platform_init,
1590 .correct_fw_ver = 17,
1591};
1592
1593static struct i2c_board_info cyttsp_info[] __initdata = {
1594 {
1595 I2C_BOARD_INFO(CY_I2C_NAME, 0x24),
1596 .platform_data = &cyttsp_pdata,
1597 .irq = MSM_GPIO_TO_INT(CYTTSP_TS_GPIO_IRQ),
1598 },
1599};
Jing Lin21ed4de2012-02-05 15:53:28 -08001600
Ankit Verma6b7e2ba2012-01-26 15:48:54 -08001601#define MSM_WCNSS_PHYS 0x03000000
1602#define MSM_WCNSS_SIZE 0x280000
1603
1604static struct resource resources_wcnss_wlan[] = {
1605 {
1606 .start = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
1607 .end = RIVA_APPS_WLAN_RX_DATA_AVAIL_IRQ,
1608 .name = "wcnss_wlanrx_irq",
1609 .flags = IORESOURCE_IRQ,
1610 },
1611 {
1612 .start = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
1613 .end = RIVA_APPS_WLAN_DATA_XFER_DONE_IRQ,
1614 .name = "wcnss_wlantx_irq",
1615 .flags = IORESOURCE_IRQ,
1616 },
1617 {
1618 .start = MSM_WCNSS_PHYS,
1619 .end = MSM_WCNSS_PHYS + MSM_WCNSS_SIZE - 1,
1620 .name = "wcnss_mmio",
1621 .flags = IORESOURCE_MEM,
1622 },
1623 {
1624 .start = 64,
1625 .end = 68,
1626 .name = "wcnss_gpios_5wire",
1627 .flags = IORESOURCE_IO,
1628 },
1629};
1630
1631static struct qcom_wcnss_opts qcom_wcnss_pdata = {
1632 .has_48mhz_xo = 1,
1633};
1634
1635static struct platform_device msm_device_wcnss_wlan = {
1636 .name = "wcnss_wlan",
1637 .id = 0,
1638 .num_resources = ARRAY_SIZE(resources_wcnss_wlan),
1639 .resource = resources_wcnss_wlan,
1640 .dev = {.platform_data = &qcom_wcnss_pdata},
1641};
1642
Ankit Vermab7c26e62012-02-28 15:04:15 -08001643static struct platform_device msm_device_iris_fm __devinitdata = {
1644 .name = "iris_fm",
1645 .id = -1,
1646};
1647
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001648#ifdef CONFIG_QSEECOM
1649/* qseecom bus scaling */
1650static struct msm_bus_vectors qseecom_clks_init_vectors[] = {
1651 {
Ramesh Masavarapu1e8c7242012-09-04 11:52:57 -07001652 .src = MSM_BUS_MASTER_ADM_PORT0,
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001653 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001654 .ab = 0,
Ramesh Masavarapu1e8c7242012-09-04 11:52:57 -07001655 .ib = 0,
1656 },
1657 {
1658 .src = MSM_BUS_MASTER_ADM_PORT1,
1659 .dst = MSM_BUS_SLAVE_GSBI1_UART,
1660 .ab = 0,
1661 .ib = 0,
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001662 },
1663 {
1664 .src = MSM_BUS_MASTER_SPDM,
1665 .dst = MSM_BUS_SLAVE_SPDM,
1666 .ib = 0,
1667 .ab = 0,
1668 },
1669};
1670
1671static struct msm_bus_vectors qseecom_enable_dfab_vectors[] = {
1672 {
Ramesh Masavarapu1e8c7242012-09-04 11:52:57 -07001673 .src = MSM_BUS_MASTER_ADM_PORT0,
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001674 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ramesh Masavarapu1e8c7242012-09-04 11:52:57 -07001675 .ab = 70000000UL,
1676 .ib = 70000000UL,
1677 },
1678 {
1679 .src = MSM_BUS_MASTER_ADM_PORT1,
1680 .dst = MSM_BUS_SLAVE_GSBI1_UART,
1681 .ab = 2480000000UL,
1682 .ib = 2480000000UL,
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001683 },
1684 {
1685 .src = MSM_BUS_MASTER_SPDM,
1686 .dst = MSM_BUS_SLAVE_SPDM,
1687 .ib = 0,
1688 .ab = 0,
1689 },
1690};
1691
1692static struct msm_bus_vectors qseecom_enable_sfpb_vectors[] = {
1693 {
Ramesh Masavarapu1e8c7242012-09-04 11:52:57 -07001694 .src = MSM_BUS_MASTER_ADM_PORT0,
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001695 .dst = MSM_BUS_SLAVE_EBI_CH0,
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001696 .ab = 0,
Ramesh Masavarapu1e8c7242012-09-04 11:52:57 -07001697 .ib = 0,
1698 },
1699 {
1700 .src = MSM_BUS_MASTER_ADM_PORT1,
1701 .dst = MSM_BUS_SLAVE_GSBI1_UART,
1702 .ab = 0,
1703 .ib = 0,
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001704 },
1705 {
1706 .src = MSM_BUS_MASTER_SPDM,
1707 .dst = MSM_BUS_SLAVE_SPDM,
1708 .ib = (64 * 8) * 1000000UL,
1709 .ab = (64 * 8) * 100000UL,
1710 },
1711};
1712
Ramesh Masavarapu8d756582012-10-03 10:18:06 -07001713static struct msm_bus_vectors qseecom_enable_dfab_sfpb_vectors[] = {
1714 {
1715 .src = MSM_BUS_MASTER_ADM_PORT0,
1716 .dst = MSM_BUS_SLAVE_EBI_CH0,
1717 .ab = 70000000UL,
1718 .ib = 70000000UL,
1719 },
1720 {
1721 .src = MSM_BUS_MASTER_ADM_PORT1,
1722 .dst = MSM_BUS_SLAVE_GSBI1_UART,
1723 .ab = 2480000000UL,
1724 .ib = 2480000000UL,
1725 },
1726 {
1727 .src = MSM_BUS_MASTER_SPDM,
1728 .dst = MSM_BUS_SLAVE_SPDM,
1729 .ib = (64 * 8) * 1000000UL,
1730 .ab = (64 * 8) * 100000UL,
1731 },
1732};
1733
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001734static struct msm_bus_paths qseecom_hw_bus_scale_usecases[] = {
1735 {
1736 ARRAY_SIZE(qseecom_clks_init_vectors),
1737 qseecom_clks_init_vectors,
1738 },
1739 {
1740 ARRAY_SIZE(qseecom_enable_dfab_vectors),
Ramesh Masavarapu1e8c7242012-09-04 11:52:57 -07001741 qseecom_enable_dfab_vectors,
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001742 },
1743 {
1744 ARRAY_SIZE(qseecom_enable_sfpb_vectors),
1745 qseecom_enable_sfpb_vectors,
1746 },
Ramesh Masavarapu8d756582012-10-03 10:18:06 -07001747 {
1748 ARRAY_SIZE(qseecom_enable_dfab_sfpb_vectors),
1749 qseecom_enable_dfab_sfpb_vectors,
1750 },
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07001751};
1752
1753static struct msm_bus_scale_pdata qseecom_bus_pdata = {
1754 qseecom_hw_bus_scale_usecases,
1755 ARRAY_SIZE(qseecom_hw_bus_scale_usecases),
1756 .name = "qsee",
1757};
1758
1759static struct platform_device qseecom_device = {
1760 .name = "qseecom",
1761 .id = 0,
1762 .dev = {
1763 .platform_data = &qseecom_bus_pdata,
1764 },
1765};
1766#endif
1767
Ramesh Masavarapu28311912011-10-27 11:04:12 -07001768#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1769 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
1770 defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1771 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1772
1773#define QCE_SIZE 0x10000
1774#define QCE_0_BASE 0x11000000
1775
1776#define QCE_HW_KEY_SUPPORT 0
1777#define QCE_SHA_HMAC_SUPPORT 1
1778#define QCE_SHARE_CE_RESOURCE 3
1779#define QCE_CE_SHARED 0
1780
1781static struct resource qcrypto_resources[] = {
1782 [0] = {
1783 .start = QCE_0_BASE,
1784 .end = QCE_0_BASE + QCE_SIZE - 1,
1785 .flags = IORESOURCE_MEM,
1786 },
1787 [1] = {
1788 .name = "crypto_channels",
1789 .start = DMOV8064_CE_IN_CHAN,
1790 .end = DMOV8064_CE_OUT_CHAN,
1791 .flags = IORESOURCE_DMA,
1792 },
1793 [2] = {
1794 .name = "crypto_crci_in",
1795 .start = DMOV8064_CE_IN_CRCI,
1796 .end = DMOV8064_CE_IN_CRCI,
1797 .flags = IORESOURCE_DMA,
1798 },
1799 [3] = {
1800 .name = "crypto_crci_out",
1801 .start = DMOV8064_CE_OUT_CRCI,
1802 .end = DMOV8064_CE_OUT_CRCI,
1803 .flags = IORESOURCE_DMA,
1804 },
1805};
1806
1807static struct resource qcedev_resources[] = {
1808 [0] = {
1809 .start = QCE_0_BASE,
1810 .end = QCE_0_BASE + QCE_SIZE - 1,
1811 .flags = IORESOURCE_MEM,
1812 },
1813 [1] = {
1814 .name = "crypto_channels",
1815 .start = DMOV8064_CE_IN_CHAN,
1816 .end = DMOV8064_CE_OUT_CHAN,
1817 .flags = IORESOURCE_DMA,
1818 },
1819 [2] = {
1820 .name = "crypto_crci_in",
1821 .start = DMOV8064_CE_IN_CRCI,
1822 .end = DMOV8064_CE_IN_CRCI,
1823 .flags = IORESOURCE_DMA,
1824 },
1825 [3] = {
1826 .name = "crypto_crci_out",
1827 .start = DMOV8064_CE_OUT_CRCI,
1828 .end = DMOV8064_CE_OUT_CRCI,
1829 .flags = IORESOURCE_DMA,
1830 },
1831};
1832
1833#endif
1834
1835#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
1836 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
1837
1838static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
1839 .ce_shared = QCE_CE_SHARED,
1840 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
1841 .hw_key_support = QCE_HW_KEY_SUPPORT,
1842 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -08001843 .bus_scale_table = NULL,
Ramesh Masavarapu28311912011-10-27 11:04:12 -07001844};
1845
1846static struct platform_device qcrypto_device = {
1847 .name = "qcrypto",
1848 .id = 0,
1849 .num_resources = ARRAY_SIZE(qcrypto_resources),
1850 .resource = qcrypto_resources,
1851 .dev = {
1852 .coherent_dma_mask = DMA_BIT_MASK(32),
1853 .platform_data = &qcrypto_ce_hw_suppport,
1854 },
1855};
1856#endif
1857
1858#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
1859 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
1860
1861static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
1862 .ce_shared = QCE_CE_SHARED,
1863 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
1864 .hw_key_support = QCE_HW_KEY_SUPPORT,
1865 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -08001866 .bus_scale_table = NULL,
Ramesh Masavarapu28311912011-10-27 11:04:12 -07001867};
1868
1869static struct platform_device qcedev_device = {
1870 .name = "qce",
1871 .id = 0,
1872 .num_resources = ARRAY_SIZE(qcedev_resources),
1873 .resource = qcedev_resources,
1874 .dev = {
1875 .coherent_dma_mask = DMA_BIT_MASK(32),
1876 .platform_data = &qcedev_ce_hw_suppport,
1877 },
1878};
1879#endif
1880
Joel Kingef390842012-05-23 16:42:48 -07001881static struct mdm_vddmin_resource mdm_vddmin_rscs = {
1882 .rpm_id = MSM_RPM_ID_VDDMIN_GPIO,
1883 .ap2mdm_vddmin_gpio = 30,
1884 .modes = 0x03,
1885 .drive_strength = 8,
1886 .mdm2ap_vddmin_gpio = 80,
1887};
1888
Joel King269aa602012-07-23 08:07:35 -07001889static struct gpiomux_setting mdm2ap_status_gpio_run_cfg = {
1890 .func = GPIOMUX_FUNC_GPIO,
Taniya Dasa1a14a92013-01-21 15:14:15 +05301891 .drv = GPIOMUX_DRV_2MA,
Joel King269aa602012-07-23 08:07:35 -07001892 .pull = GPIOMUX_PULL_NONE,
1893};
1894
Joel Kingdacbc822012-01-25 13:30:57 -08001895static struct mdm_platform_data mdm_platform_data = {
1896 .mdm_version = "3.0",
1897 .ramdump_delay_ms = 2000,
Joel King14fe7fa2012-05-27 14:26:11 -07001898 .early_power_on = 1,
1899 .sfr_query = 1,
Joel Kingbf3e4b52012-09-26 09:10:34 -07001900 .send_shdn = 1,
Joel Kingef390842012-05-23 16:42:48 -07001901 .vddmin_resource = &mdm_vddmin_rscs,
Hemant Kumara945b472012-01-25 15:08:06 -08001902 .peripheral_platform_device = &apq8064_device_hsic_host,
Ameya Thakurc9a7a842012-06-24 22:47:52 -07001903 .ramdump_timeout_ms = 120000,
Joel King269aa602012-07-23 08:07:35 -07001904 .mdm2ap_status_gpio_run_cfg = &mdm2ap_status_gpio_run_cfg,
Joel Kingdacbc822012-01-25 13:30:57 -08001905};
Ramesh Masavarapu28311912011-10-27 11:04:12 -07001906
Siddartha Mohanadosscaeaa922012-02-07 16:41:38 -08001907static struct tsens_platform_data apq_tsens_pdata = {
1908 .tsens_factor = 1000,
1909 .hw_type = APQ_8064,
1910 .tsens_num_sensor = 11,
1911 .slope = {1176, 1176, 1154, 1176, 1111,
1912 1132, 1132, 1199, 1132, 1199, 1132},
1913};
1914
Siddartha Mohanadoss48cad912012-04-05 21:29:54 -07001915static struct platform_device msm_tsens_device = {
1916 .name = "tsens8960-tm",
1917 .id = -1,
1918};
1919
Praveen Chidambaram877d7a42012-06-05 14:33:20 -06001920static struct msm_thermal_data msm_thermal_pdata = {
1921 .sensor_id = 7,
Eugene Seah2ee4a5d2012-06-25 18:16:41 -06001922 .poll_ms = 250,
1923 .limit_temp_degC = 60,
1924 .temp_hysteresis_degC = 10,
1925 .freq_step = 2,
Praveen Chidambaram877d7a42012-06-05 14:33:20 -06001926};
1927
Jeff Hugo0c0f5e92011-09-28 13:55:45 -06001928#define MSM_SHARED_RAM_PHYS 0x80000000
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001929static void __init apq8064_map_io(void)
1930{
Jeff Hugo0c0f5e92011-09-28 13:55:45 -06001931 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001932 msm_map_apq8064_io();
Abhimanyu Kapur91a0a502013-01-11 19:24:59 -08001933 if (socinfo_init() < 0)
1934 pr_err("%s: socinfo_init() failed\n", __func__);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001935}
1936
1937static void __init apq8064_init_irq(void)
1938{
Praveen Chidambaram78499012011-11-01 17:15:17 -06001939 struct msm_mpm_device_data *data = NULL;
1940
1941#ifdef CONFIG_MSM_MPM
1942 data = &apq8064_mpm_dev_data;
1943#endif
1944
1945 msm_mpm_irq_extn_init(data);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001946 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
1947 (void *)MSM_QGIC_CPU_BASE);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001948}
1949
Abhishek Kharbanda72dc72e2012-06-07 13:41:37 -07001950static struct msm_mhl_platform_data mhl_platform_data = {
1951 .irq = MSM_GPIO_TO_INT(MHL_GPIO_INT),
1952 .gpio_mhl_int = MHL_GPIO_INT,
1953 .gpio_mhl_reset = MHL_GPIO_RESET,
1954 .gpio_mhl_power = 0,
1955 .gpio_hdmi_mhl_mux = 0,
1956};
1957
1958static struct i2c_board_info sii_device_info[] __initdata = {
1959 {
1960 /*
1961 * keeps SI 8334 as the default
1962 * MHL TX
1963 */
1964 I2C_BOARD_INFO("sii8334", 0x39),
1965 .platform_data = &mhl_platform_data,
1966 .flags = I2C_CLIENT_WAKE,
1967 },
1968};
1969
Jay Chokshi7805b5a2011-11-07 15:55:30 -08001970static struct platform_device msm8064_device_saw_regulator_core0 = {
1971 .name = "saw-regulator",
1972 .id = 0,
1973 .dev = {
1974 .platform_data = &msm8064_saw_regulator_pdata_8921_s5,
1975 },
1976};
1977
1978static struct platform_device msm8064_device_saw_regulator_core1 = {
1979 .name = "saw-regulator",
1980 .id = 1,
1981 .dev = {
1982 .platform_data = &msm8064_saw_regulator_pdata_8921_s6,
1983 },
1984};
1985
1986static struct platform_device msm8064_device_saw_regulator_core2 = {
1987 .name = "saw-regulator",
1988 .id = 2,
1989 .dev = {
1990 .platform_data = &msm8064_saw_regulator_pdata_8821_s0,
1991 },
1992};
1993
1994static struct platform_device msm8064_device_saw_regulator_core3 = {
1995 .name = "saw-regulator",
1996 .id = 3,
1997 .dev = {
1998 .platform_data = &msm8064_saw_regulator_pdata_8821_s1,
Praveen Chidambaram78499012011-11-01 17:15:17 -06001999
2000 },
2001};
2002
Oluwafemi Adeyemif5a31422012-03-08 16:58:45 -08002003static struct msm_rpmrs_level msm_rpmrs_levels[] = {
Praveen Chidambaram78499012011-11-01 17:15:17 -06002004 {
2005 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
2006 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
2007 true,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002008 1, 784, 180000, 100,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002009 },
2010
2011 {
Girish Mahadevan3bc98772012-08-15 10:01:27 -06002012 MSM_PM_SLEEP_MODE_RETENTION,
2013 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
2014 true,
2015 415, 715, 340827, 475,
2016 },
2017
2018 {
Praveen Chidambaram78499012011-11-01 17:15:17 -06002019 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
2020 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
2021 true,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002022 1300, 228, 1200000, 2000,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002023 },
2024
2025 {
2026 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2027 MSM_RPMRS_LIMITS(ON, GDHS, MAX, ACTIVE),
2028 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002029 2000, 138, 1208400, 3200,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002030 },
2031
2032 {
2033 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
Praveen Chidambarame3380672012-02-08 10:32:27 -07002034 MSM_RPMRS_LIMITS(ON, HSFS_OPEN, ACTIVE, RET_HIGH),
2035 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002036 6000, 119, 1850300, 9000,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002037 },
2038
2039 {
2040 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2041 MSM_RPMRS_LIMITS(OFF, GDHS, MAX, ACTIVE),
2042 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002043 9200, 68, 2839200, 16400,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002044 },
2045
2046 {
2047 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2048 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
2049 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002050 10300, 63, 3128000, 18200,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002051 },
2052
2053 {
2054 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2055 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, ACTIVE, RET_HIGH),
2056 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002057 18000, 10, 4602600, 27000,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002058 },
2059
2060 {
2061 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
2062 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
2063 false,
Girish Mahadevan9bf71562012-04-13 14:41:44 -06002064 20000, 2, 5752000, 32000,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002065 },
2066};
2067
2068static struct msm_pm_boot_platform_data msm_pm_boot_pdata __initdata = {
2069 .mode = MSM_PM_BOOT_CONFIG_TZ,
2070};
2071
2072static struct msm_rpmrs_platform_data msm_rpmrs_data __initdata = {
2073 .levels = &msm_rpmrs_levels[0],
2074 .num_levels = ARRAY_SIZE(msm_rpmrs_levels),
2075 .vdd_mem_levels = {
2076 [MSM_RPMRS_VDD_MEM_RET_LOW] = 750000,
2077 [MSM_RPMRS_VDD_MEM_RET_HIGH] = 750000,
2078 [MSM_RPMRS_VDD_MEM_ACTIVE] = 1050000,
2079 [MSM_RPMRS_VDD_MEM_MAX] = 1150000,
2080 },
2081 .vdd_dig_levels = {
2082 [MSM_RPMRS_VDD_DIG_RET_LOW] = 500000,
2083 [MSM_RPMRS_VDD_DIG_RET_HIGH] = 750000,
2084 [MSM_RPMRS_VDD_DIG_ACTIVE] = 950000,
2085 [MSM_RPMRS_VDD_DIG_MAX] = 1150000,
2086 },
2087 .vdd_mask = 0x7FFFFF,
2088 .rpmrs_target_id = {
2089 [MSM_RPMRS_ID_PXO_CLK] = MSM_RPM_ID_PXO_CLK,
2090 [MSM_RPMRS_ID_L2_CACHE_CTL] = MSM_RPM_ID_LAST,
2091 [MSM_RPMRS_ID_VDD_DIG_0] = MSM_RPM_ID_PM8921_S3_0,
2092 [MSM_RPMRS_ID_VDD_DIG_1] = MSM_RPM_ID_PM8921_S3_1,
2093 [MSM_RPMRS_ID_VDD_MEM_0] = MSM_RPM_ID_PM8921_L24_0,
2094 [MSM_RPMRS_ID_VDD_MEM_1] = MSM_RPM_ID_PM8921_L24_1,
2095 [MSM_RPMRS_ID_RPM_CTL] = MSM_RPM_ID_RPM_CTL,
2096 },
2097};
2098
Praveen Chidambaram78499012011-11-01 17:15:17 -06002099static uint8_t spm_wfi_cmd_sequence[] __initdata = {
2100 0x03, 0x0f,
2101};
2102
2103static uint8_t spm_power_collapse_without_rpm[] __initdata = {
2104 0x00, 0x24, 0x54, 0x10,
2105 0x09, 0x03, 0x01,
2106 0x10, 0x54, 0x30, 0x0C,
2107 0x24, 0x30, 0x0f,
2108};
2109
Girish Mahadevan3bc98772012-08-15 10:01:27 -06002110static uint8_t spm_retention_cmd_sequence[] __initdata = {
2111 0x00, 0x05, 0x03, 0x0D,
2112 0x0B, 0x00, 0x0f,
2113};
2114
Anji Jonnala1a1711a2013-01-29 13:34:10 +05302115static uint8_t spm_retention_with_krait_v3_cmd_sequence[] __initdata = {
2116 0x42, 0x1B, 0x00,
2117 0x05, 0x03, 0x01, 0x0B,
2118 0x00, 0x42, 0x1B,
2119 0x0f,
2120};
2121
Praveen Chidambaram78499012011-11-01 17:15:17 -06002122static uint8_t spm_power_collapse_with_rpm[] __initdata = {
2123 0x00, 0x24, 0x54, 0x10,
2124 0x09, 0x07, 0x01, 0x0B,
2125 0x10, 0x54, 0x30, 0x0C,
2126 0x24, 0x30, 0x0f,
2127};
2128
Praveen Chidambaramc3c90822012-11-07 15:43:49 -07002129/* 8064AB has a different command to assert apc_pdn */
2130static uint8_t spm_power_collapse_without_rpm_krait_v3[] __initdata = {
2131 0x00, 0x24, 0x84, 0x10,
2132 0x09, 0x03, 0x01,
2133 0x10, 0x84, 0x30, 0x0C,
2134 0x24, 0x30, 0x0f,
2135};
2136
2137static uint8_t spm_power_collapse_with_rpm_krait_v3[] __initdata = {
2138 0x00, 0x24, 0x84, 0x10,
2139 0x09, 0x07, 0x01, 0x0B,
2140 0x10, 0x84, 0x30, 0x0C,
2141 0x24, 0x30, 0x0f,
2142};
2143
Girish Mahadevan3bc98772012-08-15 10:01:27 -06002144static struct msm_spm_seq_entry msm_spm_boot_cpu_seq_list[] __initdata = {
2145 [0] = {
2146 .mode = MSM_SPM_MODE_CLOCK_GATING,
2147 .notify_rpm = false,
2148 .cmd = spm_wfi_cmd_sequence,
2149 },
2150 [1] = {
2151 .mode = MSM_SPM_MODE_POWER_RETENTION,
2152 .notify_rpm = false,
2153 .cmd = spm_retention_cmd_sequence,
2154 },
2155 [2] = {
2156 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
2157 .notify_rpm = false,
2158 .cmd = spm_power_collapse_without_rpm,
2159 },
2160 [3] = {
2161 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
2162 .notify_rpm = true,
2163 .cmd = spm_power_collapse_with_rpm,
2164 },
2165};
2166static struct msm_spm_seq_entry msm_spm_nonboot_cpu_seq_list[] __initdata = {
Praveen Chidambaram78499012011-11-01 17:15:17 -06002167 [0] = {
2168 .mode = MSM_SPM_MODE_CLOCK_GATING,
2169 .notify_rpm = false,
2170 .cmd = spm_wfi_cmd_sequence,
2171 },
2172 [1] = {
Anji Jonnala1a1711a2013-01-29 13:34:10 +05302173 .mode = MSM_SPM_MODE_POWER_RETENTION,
2174 .notify_rpm = false,
2175 .cmd = spm_retention_cmd_sequence,
2176 },
2177 [2] = {
Praveen Chidambaram78499012011-11-01 17:15:17 -06002178 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
2179 .notify_rpm = false,
2180 .cmd = spm_power_collapse_without_rpm,
2181 },
Anji Jonnala1a1711a2013-01-29 13:34:10 +05302182 [3] = {
Praveen Chidambaram78499012011-11-01 17:15:17 -06002183 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
2184 .notify_rpm = true,
2185 .cmd = spm_power_collapse_with_rpm,
2186 },
2187};
2188
2189static uint8_t l2_spm_wfi_cmd_sequence[] __initdata = {
2190 0x00, 0x20, 0x03, 0x20,
2191 0x00, 0x0f,
2192};
2193
2194static uint8_t l2_spm_gdhs_cmd_sequence[] __initdata = {
2195 0x00, 0x20, 0x34, 0x64,
2196 0x48, 0x07, 0x48, 0x20,
2197 0x50, 0x64, 0x04, 0x34,
2198 0x50, 0x0f,
2199};
2200static uint8_t l2_spm_power_off_cmd_sequence[] __initdata = {
2201 0x00, 0x10, 0x34, 0x64,
2202 0x48, 0x07, 0x48, 0x10,
2203 0x50, 0x64, 0x04, 0x34,
2204 0x50, 0x0F,
2205};
2206
2207static struct msm_spm_seq_entry msm_spm_l2_seq_list[] __initdata = {
2208 [0] = {
2209 .mode = MSM_SPM_L2_MODE_RETENTION,
2210 .notify_rpm = false,
2211 .cmd = l2_spm_wfi_cmd_sequence,
2212 },
2213 [1] = {
2214 .mode = MSM_SPM_L2_MODE_GDHS,
2215 .notify_rpm = true,
2216 .cmd = l2_spm_gdhs_cmd_sequence,
2217 },
2218 [2] = {
2219 .mode = MSM_SPM_L2_MODE_POWER_COLLAPSE,
2220 .notify_rpm = true,
2221 .cmd = l2_spm_power_off_cmd_sequence,
2222 },
2223};
2224
2225
2226static struct msm_spm_platform_data msm_spm_l2_data[] __initdata = {
2227 [0] = {
2228 .reg_base_addr = MSM_SAW_L2_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002229 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x00,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07002230 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002231 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x00A000AE,
2232 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A00020,
2233 .modes = msm_spm_l2_seq_list,
2234 .num_modes = ARRAY_SIZE(msm_spm_l2_seq_list),
2235 },
2236};
2237
2238static struct msm_spm_platform_data msm_spm_data[] __initdata = {
2239 [0] = {
2240 .reg_base_addr = MSM_SAW0_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002241 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002242#if defined(CONFIG_MSM_AVS_HW)
2243 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
2244 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
2245#endif
2246 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Girish Mahadevan3bc98772012-08-15 10:01:27 -06002247 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x03020004,
2248 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0084009C,
2249 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x00A4001C,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002250 .vctl_timeout_us = 50,
Girish Mahadevan3bc98772012-08-15 10:01:27 -06002251 .num_modes = ARRAY_SIZE(msm_spm_boot_cpu_seq_list),
2252 .modes = msm_spm_boot_cpu_seq_list,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002253 },
2254 [1] = {
2255 .reg_base_addr = MSM_SAW1_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002256 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002257#if defined(CONFIG_MSM_AVS_HW)
2258 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
2259 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
2260#endif
2261 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07002262 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002263 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
2264 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
2265 .vctl_timeout_us = 50,
Girish Mahadevan3bc98772012-08-15 10:01:27 -06002266 .num_modes = ARRAY_SIZE(msm_spm_nonboot_cpu_seq_list),
2267 .modes = msm_spm_nonboot_cpu_seq_list,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002268 },
2269 [2] = {
2270 .reg_base_addr = MSM_SAW2_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002271 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002272#if defined(CONFIG_MSM_AVS_HW)
2273 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
2274 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
2275#endif
2276 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07002277 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002278 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
2279 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
2280 .vctl_timeout_us = 50,
Girish Mahadevan3bc98772012-08-15 10:01:27 -06002281 .num_modes = ARRAY_SIZE(msm_spm_nonboot_cpu_seq_list),
2282 .modes = msm_spm_nonboot_cpu_seq_list,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002283 },
2284 [3] = {
2285 .reg_base_addr = MSM_SAW3_BASE,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002286 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002287#if defined(CONFIG_MSM_AVS_HW)
2288 .reg_init_values[MSM_SPM_REG_SAW2_AVS_CTL] = 0x00,
2289 .reg_init_values[MSM_SPM_REG_SAW2_AVS_HYSTERESIS] = 0x00,
2290#endif
2291 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Praveen Chidambarame4b9eb12012-02-28 19:39:58 -07002292 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DLY] = 0x02020204,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002293 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_0] = 0x0060009C,
2294 .reg_init_values[MSM_SPM_REG_SAW2_PMIC_DATA_1] = 0x0000001C,
2295 .vctl_timeout_us = 50,
Girish Mahadevan3bc98772012-08-15 10:01:27 -06002296 .num_modes = ARRAY_SIZE(msm_spm_nonboot_cpu_seq_list),
2297 .modes = msm_spm_nonboot_cpu_seq_list,
Jay Chokshi7805b5a2011-11-07 15:55:30 -08002298 },
2299};
2300
Praveen Chidambaramc3c90822012-11-07 15:43:49 -07002301static void __init apq8064ab_update_krait_spm(void)
2302{
2303 int i;
2304
2305 /* Update the SPM sequences for SPC and PC */
2306 for (i = 0; i < ARRAY_SIZE(msm_spm_data); i++) {
2307 int j;
2308 struct msm_spm_platform_data *pdata = &msm_spm_data[i];
2309 for (j = 0; j < pdata->num_modes; j++) {
2310 if (pdata->modes[j].cmd ==
2311 spm_power_collapse_without_rpm)
2312 pdata->modes[j].cmd =
2313 spm_power_collapse_without_rpm_krait_v3;
2314 else if (pdata->modes[j].cmd ==
2315 spm_power_collapse_with_rpm)
2316 pdata->modes[j].cmd =
2317 spm_power_collapse_with_rpm_krait_v3;
2318 }
2319 }
2320}
2321
Gagan Mac8a7a5d32011-11-11 16:43:06 -07002322static void __init apq8064_init_buses(void)
2323{
2324 msm_bus_rpm_set_mt_mask();
2325 msm_bus_8064_apps_fabric_pdata.rpm_enabled = 1;
2326 msm_bus_8064_sys_fabric_pdata.rpm_enabled = 1;
2327 msm_bus_8064_mm_fabric_pdata.rpm_enabled = 1;
2328 msm_bus_8064_apps_fabric.dev.platform_data =
2329 &msm_bus_8064_apps_fabric_pdata;
2330 msm_bus_8064_sys_fabric.dev.platform_data =
2331 &msm_bus_8064_sys_fabric_pdata;
2332 msm_bus_8064_mm_fabric.dev.platform_data =
2333 &msm_bus_8064_mm_fabric_pdata;
2334 msm_bus_8064_sys_fpb.dev.platform_data = &msm_bus_8064_sys_fpb_pdata;
2335 msm_bus_8064_cpss_fpb.dev.platform_data = &msm_bus_8064_cpss_fpb_pdata;
2336}
2337
Niranjana Vishwanathapura06f89332012-05-03 17:11:13 -06002338/* PCIe gpios */
2339static struct msm_pcie_gpio_info_t msm_pcie_gpio_info[MSM_PCIE_MAX_GPIO] = {
2340 {"rst_n", PM8921_MPP_PM_TO_SYS(PCIE_RST_N_PMIC_MPP), 0},
2341 {"pwr_en", PM8921_GPIO_PM_TO_SYS(PCIE_PWR_EN_PMIC_GPIO), 1},
2342};
2343
2344static struct msm_pcie_platform msm_pcie_platform_data = {
Niranjana Vishwanathapura68210ff2012-06-24 18:03:49 -06002345 .axi_addr = PCIE_AXI_BAR_PHYS,
2346 .axi_size = PCIE_AXI_BAR_SIZE,
Rohit Vaswaniafe48202013-03-05 15:10:47 -08002347 .parf_deemph = 0x282828,
2348 .parf_swing = 0x7F7F,
Niranjana Vishwanathapura06f89332012-05-03 17:11:13 -06002349};
2350
Rohit Vaswani4375c802013-01-09 13:38:19 -08002351/* FSM8064_EP PCIe gpios */
2352static struct msm_pcie_gpio_info_t ep_pcie_gpio_info[MSM_PCIE_MAX_GPIO] = {
2353 {"rst_n", PM8921_GPIO_PM_TO_SYS(PCIE_EP_RST_N_PMIC_GPIO), 0},
2354 {"pwr_en", PM8921_GPIO_PM_TO_SYS(PCIE_PWR_EN_PMIC_GPIO), 1},
2355};
2356
2357static struct msm_pcie_platform ep_pcie_platform_data = {
2358 .gpio = ep_pcie_gpio_info,
2359 .axi_addr = PCIE_AXI_BAR_PHYS,
2360 .axi_size = PCIE_AXI_BAR_SIZE,
2361 .wake_n = PM8921_GPIO_IRQ(PM8921_IRQ_BASE, PCIE_EP_WAKE_N_PMIC_GPIO),
Rohit Vaswaniafe48202013-03-05 15:10:47 -08002362 .vreg_n = 4,
2363 .parf_deemph = 0x101010,
2364 .parf_swing = 0x6B6B,
Rohit Vaswani4375c802013-01-09 13:38:19 -08002365};
2366
Niranjana Vishwanathapurac1edd402012-06-28 15:32:50 -06002367static int __init mpq8064_pcie_enabled(void)
2368{
2369 return !((readl_relaxed(QFPROM_RAW_FEAT_CONFIG_ROW0_MSB) & BIT(21)) ||
2370 (readl_relaxed(QFPROM_RAW_OEM_CONFIG_ROW0_LSB) & BIT(4)));
2371}
2372
Niranjana Vishwanathapura06f89332012-05-03 17:11:13 -06002373static void __init mpq8064_pcie_init(void)
2374{
Niranjana Vishwanathapurac1edd402012-06-28 15:32:50 -06002375 if (mpq8064_pcie_enabled()) {
Yan Hedbc96ce2013-01-29 12:39:33 -08002376 if (machine_is_mpq8064_hrd()) {
2377 msm_pcie_platform_data.vreg_n = 3;
2378 msm_pcie_gpio_info[1].num =
2379 PM8921_GPIO_PM_TO_SYS(PCIE_PWR_EN_PMIC_GPIO_HRD);
2380 msm_pcie_platform_data.wake_n =
2381 PM8921_GPIO_IRQ(PM8921_IRQ_BASE,
2382 PCIE_WAKE_N_PMIC_GPIO_HRD);
2383 } else {
2384 msm_pcie_platform_data.vreg_n = 4;
2385 msm_pcie_platform_data.wake_n =
2386 PM8921_GPIO_IRQ(PM8921_IRQ_BASE,
2387 PCIE_WAKE_N_PMIC_GPIO);
2388 }
2389 msm_pcie_platform_data.gpio = msm_pcie_gpio_info;
2390
Niranjana Vishwanathapurac1edd402012-06-28 15:32:50 -06002391 msm_device_pcie.dev.platform_data = &msm_pcie_platform_data;
2392 platform_device_register(&msm_device_pcie);
2393 }
Niranjana Vishwanathapura06f89332012-05-03 17:11:13 -06002394}
2395
Sujit Reddy Thummaf97e5ec2013-01-16 15:02:17 +05302396static struct platform_device mpq8064_device_ext_3p3v_vreg = {
2397 .name = "reg-fixed-voltage",
2398 .dev = {
2399 .platform_data = &mpq8064_3p3_regulator_pdata,
2400 },
2401};
2402
Stephen Boyd42517402013-01-14 16:41:42 -08002403static void __init fsm8064_ep_pcie_init(void)
2404{
2405 msm_device_pcie.dev.platform_data = &ep_pcie_platform_data;
2406 platform_device_register(&msm_device_pcie);
2407}
2408
David Collinsf0d00732012-01-25 15:46:50 -08002409static struct platform_device apq8064_device_ext_5v_vreg __devinitdata = {
2410 .name = GPIO_REGULATOR_DEV_NAME,
2411 .id = PM8921_MPP_PM_TO_SYS(7),
2412 .dev = {
2413 .platform_data
2414 = &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_5V],
2415 },
2416};
2417
Jay Chokshi1de4f9d2012-02-07 16:11:31 -08002418static struct platform_device apq8064_device_ext_mpp8_vreg __devinitdata = {
2419 .name = GPIO_REGULATOR_DEV_NAME,
2420 .id = PM8921_MPP_PM_TO_SYS(8),
2421 .dev = {
2422 .platform_data
2423 = &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_MPP8],
2424 },
2425};
2426
David Collinsf0d00732012-01-25 15:46:50 -08002427static struct platform_device apq8064_device_ext_3p3v_vreg __devinitdata = {
2428 .name = GPIO_REGULATOR_DEV_NAME,
2429 .id = APQ8064_EXT_3P3V_REG_EN_GPIO,
2430 .dev = {
2431 .platform_data =
2432 &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_3P3V],
2433 },
2434};
2435
David Collins390fc332012-02-07 14:38:16 -08002436static struct platform_device apq8064_device_ext_ts_sw_vreg __devinitdata = {
2437 .name = GPIO_REGULATOR_DEV_NAME,
2438 .id = PM8921_GPIO_PM_TO_SYS(23),
2439 .dev = {
2440 .platform_data
2441 = &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_TS_SW],
2442 },
2443};
2444
Sujit Reddy Thummab0d51e72012-12-31 15:37:16 +05302445static struct platform_device
2446apq8064_device_ext_3p3v_mpp4_vreg __devinitdata = {
2447 .name = GPIO_REGULATOR_DEV_NAME,
2448 .id = PM8921_MPP_PM_TO_SYS(4),
2449 .dev = {
2450 .platform_data =
2451 &apq8064_gpio_regulator_pdata[GPIO_VREG_ID_EXT_SATA_PWR],
2452 },
2453};
2454
David Collins2782b5c2012-02-06 10:02:42 -08002455static struct platform_device apq8064_device_rpm_regulator __devinitdata = {
2456 .name = "rpm-regulator",
David Collins793793b2012-08-21 15:43:02 -07002457 .id = 0,
David Collins2782b5c2012-02-06 10:02:42 -08002458 .dev = {
2459 .platform_data = &apq8064_rpm_regulator_pdata,
2460 },
2461};
2462
David Collins793793b2012-08-21 15:43:02 -07002463static struct platform_device
2464apq8064_pm8921_device_rpm_regulator __devinitdata = {
2465 .name = "rpm-regulator",
2466 .id = 1,
2467 .dev = {
2468 .platform_data = &apq8064_rpm_regulator_pm8921_pdata,
2469 },
2470};
2471
Ravi Kumar V05931a22012-04-04 17:09:37 +05302472static struct gpio_ir_recv_platform_data gpio_ir_recv_pdata = {
2473 .gpio_nr = 88,
2474 .active_low = 1,
Ravi Kumar V16a614c2012-10-12 20:59:56 +05302475 .can_wakeup = true,
Ravi Kumar V05931a22012-04-04 17:09:37 +05302476};
2477
2478static struct platform_device gpio_ir_recv_pdev = {
2479 .name = "gpio-rc-recv",
2480 .dev = {
2481 .platform_data = &gpio_ir_recv_pdata,
2482 },
2483};
2484
Terence Hampson36b70722012-05-10 13:18:16 -04002485static struct platform_device *common_not_mpq_devices[] __initdata = {
David Keitel3c40fc52012-02-09 17:53:52 -08002486 &apq8064_device_qup_i2c_gsbi1,
Jing Lin04601f92012-02-05 15:36:07 -08002487 &apq8064_device_qup_i2c_gsbi3,
Kenneth Heitke748593a2011-07-15 15:45:11 -06002488 &apq8064_device_qup_i2c_gsbi4,
Terence Hampson36b70722012-05-10 13:18:16 -04002489};
2490
Kuirong Wangf8c5e142012-06-21 16:17:32 -07002491static struct platform_device *common_mpq_devices[] __initdata = {
2492 &mpq_cpudai_sec_i2s_rx,
2493 &mpq_cpudai_mi2s_tx,
Aviral Guptabfa97882012-10-16 12:15:59 +05302494 &mpq_cpudai_pseudo,
Kuirong Wangf8c5e142012-06-21 16:17:32 -07002495};
2496
Rohit Vaswani4375c802013-01-09 13:38:19 -08002497static struct platform_device *ep_devices[] __initdata = {
2498 &msm_device_smd_apq8064,
2499 &apq8064_device_gadget_peripheral,
2500 &apq8064_device_hsusb_host,
2501 &android_usb_device,
2502 &msm_device_wcnss_wlan,
Rohit Vaswani4375c802013-01-09 13:38:19 -08002503 &apq8064_fmem_device,
Rohit Vaswani4375c802013-01-09 13:38:19 -08002504#ifdef CONFIG_ION_MSM
2505 &apq8064_ion_dev,
2506#endif
2507 &msm8064_device_watchdog,
2508 &msm8064_device_saw_regulator_core0,
2509 &msm8064_device_saw_regulator_core1,
2510 &msm8064_device_saw_regulator_core2,
2511 &msm8064_device_saw_regulator_core3,
2512#if defined(CONFIG_QSEECOM)
2513 &qseecom_device,
2514#endif
2515
2516 &msm_8064_device_tsif[0],
2517 &msm_8064_device_tsif[1],
2518
2519#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
2520 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
2521 &qcrypto_device,
2522#endif
2523
2524#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
2525 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
2526 &qcedev_device,
2527#endif
2528
2529#ifdef CONFIG_HW_RANDOM_MSM
2530 &apq8064_device_rng,
2531#endif
2532 &apq_pcm,
2533 &apq_pcm_routing,
2534 &apq8064_rpm_device,
2535 &apq8064_rpm_log_device,
2536 &apq8064_rpm_stat_device,
2537 &apq8064_rpm_master_stat_device,
2538 &apq_device_tz_log,
2539 &msm_bus_8064_apps_fabric,
2540 &msm_bus_8064_sys_fabric,
2541 &msm_bus_8064_mm_fabric,
2542 &msm_bus_8064_sys_fpb,
2543 &msm_bus_8064_cpss_fpb,
2544 &msm_pil_dsps,
2545 &msm_8960_q6_lpass,
Rohit Vaswani4375c802013-01-09 13:38:19 -08002546 &apq8064_rtb_device,
2547 &apq8064_dcvs_device,
2548 &apq8064_msm_gov_device,
2549 &apq8064_device_cache_erp,
2550 &msm8960_device_ebi1_ch0_erp,
2551 &msm8960_device_ebi1_ch1_erp,
2552 &epm_adc_device,
2553 &coresight_tpiu_device,
2554 &coresight_etb_device,
2555 &apq8064_coresight_funnel_device,
2556 &coresight_etm0_device,
2557 &coresight_etm1_device,
2558 &coresight_etm2_device,
2559 &coresight_etm3_device,
2560#ifdef CONFIG_MSM_GEMINI
2561 &msm8960_gemini_device,
2562#endif
2563 &msm_tsens_device,
2564 &apq8064_cache_dump_device,
2565 &msm_8064_device_tspp,
2566#ifdef CONFIG_BATTERY_BCL
2567 &battery_bcl_device,
2568#endif
2569 &apq8064_msm_mpd_device,
2570 &apq8064_device_qup_i2c_gsbi1,
2571 &apq8064_device_uart_gsbi2,
2572 &apq8064_device_uart_gsbi1,
2573 &apq8064_device_uart_gsbi4,
2574 &msm_device_sps_apq8064,
Rohit Vaswani4375c802013-01-09 13:38:19 -08002575};
2576
Kuirong Wangf8c5e142012-06-21 16:17:32 -07002577static struct platform_device *common_i2s_devices[] __initdata = {
2578 &apq_cpudai_mi2s,
2579 &apq_cpudai_i2s_rx,
2580 &apq_cpudai_i2s_tx,
2581};
2582
David Collins793793b2012-08-21 15:43:02 -07002583static struct platform_device *early_common_devices[] __initdata = {
Matt Wagantallf5cc3892012-06-07 19:47:02 -07002584 &apq8064_device_acpuclk,
Terence Hampson36b70722012-05-10 13:18:16 -04002585 &apq8064_device_dmov,
Harini Jayaramanc4c58692011-07-19 14:50:10 -06002586 &apq8064_device_qup_spi_gsbi5,
David Collins793793b2012-08-21 15:43:02 -07002587};
2588
2589static struct platform_device *pm8921_common_devices[] __initdata = {
David Collinsf0d00732012-01-25 15:46:50 -08002590 &apq8064_device_ext_5v_vreg,
Jay Chokshi1de4f9d2012-02-07 16:11:31 -08002591 &apq8064_device_ext_mpp8_vreg,
David Collinsf0d00732012-01-25 15:46:50 -08002592 &apq8064_device_ext_3p3v_vreg,
Jay Chokshi9c25f072011-09-23 18:19:15 -07002593 &apq8064_device_ssbi_pmic1,
2594 &apq8064_device_ssbi_pmic2,
David Collins793793b2012-08-21 15:43:02 -07002595};
2596
Bamidi RaviKirand1e9f0d2012-12-10 17:33:10 +05302597static struct platform_device *pm8921_mpq_hrd_common_devices[] __initdata = {
2598 &apq8064_device_ext_5v_vreg,
2599 &apq8064_device_ext_mpp8_vreg,
Sujit Reddy Thummaf97e5ec2013-01-16 15:02:17 +05302600 &mpq8064_device_ext_3p3v_vreg,
Bamidi RaviKirand1e9f0d2012-12-10 17:33:10 +05302601 &apq8064_device_ssbi_pmic1,
2602 &apq8064_device_ssbi_pmic2,
2603};
2604
David Collins793793b2012-08-21 15:43:02 -07002605static struct platform_device *pm8917_common_devices[] __initdata = {
2606 &apq8064_device_ext_mpp8_vreg,
2607 &apq8064_device_ext_3p3v_vreg,
2608 &apq8064_device_ssbi_pmic1,
2609 &apq8064_device_ssbi_pmic2,
David Collins793793b2012-08-21 15:43:02 -07002610};
2611
2612static struct platform_device *common_devices[] __initdata = {
Jeff Hugo0c0f5e92011-09-28 13:55:45 -06002613 &msm_device_smd_apq8064,
Hemant Kumar4933b072011-10-17 23:43:11 -07002614 &apq8064_device_otg,
2615 &apq8064_device_gadget_peripheral,
Hemant Kumard86c4882012-01-24 19:39:37 -08002616 &apq8064_device_hsusb_host,
Hemant Kumar4933b072011-10-17 23:43:11 -07002617 &android_usb_device,
Ankit Verma6b7e2ba2012-01-26 15:48:54 -08002618 &msm_device_wcnss_wlan,
Ankit Vermab7c26e62012-02-28 15:04:15 -08002619 &msm_device_iris_fm,
Larry Bassel67b921d2012-04-06 10:23:27 -07002620 &apq8064_fmem_device,
Olav Haugan7c6aa742012-01-16 16:47:37 -08002621#ifdef CONFIG_ION_MSM
Laura Abbottb93525f2012-04-12 09:57:19 -07002622 &apq8064_ion_dev,
Olav Haugan7c6aa742012-01-16 16:47:37 -08002623#endif
Jeff Ohlstein7e668552011-10-06 16:17:25 -07002624 &msm8064_device_watchdog,
Jay Chokshi7805b5a2011-11-07 15:55:30 -08002625 &msm8064_device_saw_regulator_core0,
2626 &msm8064_device_saw_regulator_core1,
2627 &msm8064_device_saw_regulator_core2,
2628 &msm8064_device_saw_regulator_core3,
Ramesh Masavarapua26cce72012-04-09 12:32:25 -07002629#if defined(CONFIG_QSEECOM)
2630 &qseecom_device,
2631#endif
2632
Joel Nider6b9a7bc2012-06-26 11:19:19 +03002633 &msm_8064_device_tsif[0],
2634 &msm_8064_device_tsif[1],
2635
Ramesh Masavarapu28311912011-10-27 11:04:12 -07002636#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
2637 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
2638 &qcrypto_device,
2639#endif
2640
2641#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
2642 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
2643 &qcedev_device,
2644#endif
Ramesh Masavarapuf46be1b2011-11-03 11:13:41 -07002645
2646#ifdef CONFIG_HW_RANDOM_MSM
2647 &apq8064_device_rng,
2648#endif
Bharath Ramachandramurthyb8e797f2011-11-30 12:08:42 -08002649 &apq_pcm,
2650 &apq_pcm_routing,
2651 &apq_cpudai0,
2652 &apq_cpudai1,
2653 &apq_cpudai_hdmi_rx,
2654 &apq_cpudai_bt_rx,
2655 &apq_cpudai_bt_tx,
2656 &apq_cpudai_fm_rx,
2657 &apq_cpudai_fm_tx,
2658 &apq_cpu_fe,
2659 &apq_stub_codec,
2660 &apq_voice,
2661 &apq_voip,
2662 &apq_lpa_pcm,
Krishnankutty Kolathappilly4374e332012-03-18 22:27:30 -07002663 &apq_compr_dsp,
2664 &apq_multi_ch_pcm,
Jayasena Sangaraboina99bf09c2012-07-17 12:03:08 -07002665 &apq_lowlatency_pcm,
Bharath Ramachandramurthyb8e797f2011-11-30 12:08:42 -08002666 &apq_pcm_hostless,
2667 &apq_cpudai_afe_01_rx,
2668 &apq_cpudai_afe_01_tx,
2669 &apq_cpudai_afe_02_rx,
2670 &apq_cpudai_afe_02_tx,
2671 &apq_pcm_afe,
2672 &apq_cpudai_auxpcm_rx,
2673 &apq_cpudai_auxpcm_tx,
Neema Shetty8427c262012-02-16 11:23:43 -08002674 &apq_cpudai_stub,
Neema Shetty3c9d2862012-03-11 01:25:32 -08002675 &apq_cpudai_slimbus_1_rx,
2676 &apq_cpudai_slimbus_1_tx,
Kiran Kandi97fe19d2012-05-20 22:34:04 -07002677 &apq_cpudai_slimbus_2_rx,
Kiran Kandi1e6371d2012-03-29 11:48:57 -07002678 &apq_cpudai_slimbus_2_tx,
Neema Shettyc9d86c32012-05-09 12:01:39 -07002679 &apq_cpudai_slimbus_3_rx,
Helen Zeng38c3c962012-05-17 14:56:20 -07002680 &apq_cpudai_slimbus_3_tx,
Praveen Chidambaram78499012011-11-01 17:15:17 -06002681 &apq8064_rpm_device,
2682 &apq8064_rpm_log_device,
2683 &apq8064_rpm_stat_device,
Anji Jonnala93129922012-10-09 20:57:53 +05302684 &apq8064_rpm_master_stat_device,
Ramesh Masavarapuf31ff242012-05-10 18:55:21 -07002685 &apq_device_tz_log,
Gagan Mac8a7a5d32011-11-11 16:43:06 -07002686 &msm_bus_8064_apps_fabric,
2687 &msm_bus_8064_sys_fabric,
2688 &msm_bus_8064_mm_fabric,
2689 &msm_bus_8064_sys_fpb,
2690 &msm_bus_8064_cpss_fpb,
Mohan Kumar Gubbihalli Lachma Naik7f72edd2012-02-06 17:26:47 -08002691 &apq8064_msm_device_vidc,
Stephen Boyd25c4a0b2011-09-20 00:12:36 -07002692 &msm_pil_dsps,
Matt Wagantallb94b9a52012-02-02 21:59:54 -08002693 &msm_8960_q6_lpass,
Stephen Boyd7b973de2012-03-09 12:26:16 -08002694 &msm_pil_vidc,
Matt Wagantall292aace2012-01-26 19:12:34 -08002695 &msm_gss,
Laura Abbottb93525f2012-04-12 09:57:19 -07002696 &apq8064_rtb_device,
Steve Mucklef9a87492012-11-02 15:41:00 -07002697 &apq8064_dcvs_device,
Abhijeet Dharmapurikarfb4a2f82012-08-23 14:36:59 -07002698 &apq8064_msm_gov_device,
Stepan Moskovchenko28662c52012-03-01 12:48:45 -08002699 &apq8064_device_cache_erp,
Stepan Moskovchenko0f3de112012-06-08 18:11:46 -07002700 &msm8960_device_ebi1_ch0_erp,
2701 &msm8960_device_ebi1_ch1_erp,
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -08002702 &epm_adc_device,
Pratik Patel3b0ca882012-06-01 16:54:14 -07002703 &coresight_tpiu_device,
2704 &coresight_etb_device,
2705 &apq8064_coresight_funnel_device,
2706 &coresight_etm0_device,
2707 &coresight_etm1_device,
2708 &coresight_etm2_device,
2709 &coresight_etm3_device,
Helen Zeng8f925502012-03-05 16:50:17 -08002710 &apq_cpudai_slim_4_rx,
2711 &apq_cpudai_slim_4_tx,
Steve Mucklef132c6c2012-06-06 18:30:57 -07002712#ifdef CONFIG_MSM_GEMINI
Jignesh Mehta921649d2012-04-19 06:57:23 -07002713 &msm8960_gemini_device,
Steve Mucklef132c6c2012-06-06 18:30:57 -07002714#endif
Laura Abbott0577d7b2012-04-17 11:14:30 -07002715 &apq8064_iommu_domain_device,
Siddartha Mohanadoss48cad912012-04-05 21:29:54 -07002716 &msm_tsens_device,
Laura Abbott93a4a352012-05-25 09:26:35 -07002717 &apq8064_cache_dump_device,
Joel Nider0e4a16d2012-08-05 14:20:11 +03002718 &msm_8064_device_tspp,
Binqiang Qiuf165c922012-08-15 18:00:18 -07002719#ifdef CONFIG_BATTERY_BCL
2720 &battery_bcl_device,
2721#endif
Abhijeet Dharmapurikarfb4a2f82012-08-23 14:36:59 -07002722 &apq8064_msm_mpd_device,
Harini Jayaramanc4c58692011-07-19 14:50:10 -06002723};
2724
Joel King82b7e3f2012-01-05 10:03:27 -08002725static struct platform_device *cdp_devices[] __initdata = {
2726 &apq8064_device_uart_gsbi1,
Jin Hong4bbbfba2012-02-02 21:48:07 -08002727 &apq8064_device_uart_gsbi7,
Joel King82b7e3f2012-01-05 10:03:27 -08002728 &msm_device_sps_apq8064,
Aravind Venkateswaran4ca27532012-02-16 14:27:05 -08002729#ifdef CONFIG_MSM_ROTATOR
2730 &msm_rotator_device,
2731#endif
Anji Jonnalaf91d8972013-02-26 17:55:50 +05302732 &msm8064_cpu_slp_status,
Joel King82b7e3f2012-01-05 10:03:27 -08002733};
2734
Jay Chokshi1b7eaa92012-04-04 14:53:14 -07002735static struct platform_device
Jay Chokshi1b7eaa92012-04-04 14:53:14 -07002736mpq8064_device_ext_1p2_buck_vreg __devinitdata = {
2737 .name = GPIO_REGULATOR_DEV_NAME,
2738 .id = SX150X_GPIO(4, 2),
2739 .dev = {
2740 .platform_data =
2741 &mpq8064_gpio_regulator_pdata[GPIO_VREG_ID_AVC_1P2V],
2742 },
2743};
2744
2745static struct platform_device
2746mpq8064_device_ext_1p8_buck_vreg __devinitdata = {
2747 .name = GPIO_REGULATOR_DEV_NAME,
2748 .id = SX150X_GPIO(4, 4),
2749 .dev = {
2750 .platform_data =
2751 &mpq8064_gpio_regulator_pdata[GPIO_VREG_ID_AVC_1P8V],
2752 },
2753};
2754
2755static struct platform_device
2756mpq8064_device_ext_2p2_buck_vreg __devinitdata = {
2757 .name = GPIO_REGULATOR_DEV_NAME,
2758 .id = SX150X_GPIO(4, 14),
2759 .dev = {
2760 .platform_data =
2761 &mpq8064_gpio_regulator_pdata[GPIO_VREG_ID_AVC_2P2V],
2762 },
2763};
2764
2765static struct platform_device
2766mpq8064_device_ext_5v_buck_vreg __devinitdata = {
2767 .name = GPIO_REGULATOR_DEV_NAME,
2768 .id = SX150X_GPIO(4, 3),
2769 .dev = {
2770 .platform_data =
2771 &mpq8064_gpio_regulator_pdata[GPIO_VREG_ID_AVC_5V],
2772 },
2773};
2774
2775static struct platform_device
2776mpq8064_device_ext_3p3v_ldo_vreg __devinitdata = {
2777 .name = GPIO_REGULATOR_DEV_NAME,
2778 .id = SX150X_GPIO(4, 15),
2779 .dev = {
2780 .platform_data =
2781 &mpq8064_gpio_regulator_pdata[GPIO_VREG_ID_AVC_3P3V],
2782 },
2783};
2784
Ravi Kumar V1c903012012-05-15 16:11:35 +05302785static struct platform_device rc_input_loopback_pdev = {
2786 .name = "rc-user-input",
2787 .id = -1,
2788};
2789
Bamidi RaviKiran206ddb62012-10-08 09:53:56 +05302790static struct platform_device sp_input_loopback_pdev = {
2791 .name = "sp-user-input",
2792 .id = -1,
2793};
2794
Ravi Kumar V040eeff2012-05-23 21:29:23 +05302795static int rf4ce_gpio_init(void)
2796{
Ravi Kumar V92b2b6c2012-08-14 17:18:11 +05302797 if (!machine_is_mpq8064_cdp() &&
2798 !machine_is_mpq8064_hrd() &&
2799 !machine_is_mpq8064_dtv())
Ravi Kumar V040eeff2012-05-23 21:29:23 +05302800 return -EINVAL;
2801
2802 /* CC2533 SRDY Input */
2803 if (!gpio_request(SX150X_GPIO(4, 6), "rf4ce_srdy")) {
2804 gpio_direction_input(SX150X_GPIO(4, 6));
2805 gpio_export(SX150X_GPIO(4, 6), true);
2806 }
2807
2808 /* CC2533 MRDY Output */
2809 if (!gpio_request(SX150X_GPIO(4, 5), "rf4ce_mrdy")) {
2810 gpio_direction_output(SX150X_GPIO(4, 5), 1);
2811 gpio_export(SX150X_GPIO(4, 5), true);
2812 }
2813
2814 /* CC2533 Reset Output */
2815 if (!gpio_request(SX150X_GPIO(4, 7), "rf4ce_reset")) {
2816 gpio_direction_output(SX150X_GPIO(4, 7), 0);
2817 gpio_export(SX150X_GPIO(4, 7), true);
2818 }
2819
2820 return 0;
2821}
2822late_initcall(rf4ce_gpio_init);
2823
Mayank Rana262e9032012-05-10 15:14:00 -07002824#ifdef CONFIG_SERIAL_MSM_HS
2825static int configure_uart_gpios(int on)
2826{
2827 int ret = 0, i;
2828 int uart_gpios[] = {14, 15, 16, 17};
2829
2830 for (i = 0; i < ARRAY_SIZE(uart_gpios); i++) {
2831 if (on) {
2832 ret = gpio_request(uart_gpios[i], NULL);
2833 if (ret) {
2834 pr_err("%s:unable to request uart gpio[%d]\n",
2835 __func__, uart_gpios[i]);
2836 break;
2837 }
2838 } else {
2839 gpio_free(uart_gpios[i]);
2840 }
2841 }
2842
2843 if (ret && on && i)
2844 for (; i >= 0; i--)
2845 gpio_free(uart_gpios[i]);
2846 return ret;
2847}
2848
2849static struct msm_serial_hs_platform_data mpq8064_gsbi6_uartdm_pdata = {
2850 .inject_rx_on_wakeup = 1,
2851 .rx_to_inject = 0xFD,
2852 .gpio_config = configure_uart_gpios,
2853};
2854#else
2855static struct msm_serial_hs_platform_data msm_uart_dm9_pdata;
2856#endif
2857
Jay Chokshi1b7eaa92012-04-04 14:53:14 -07002858static struct platform_device *mpq_devices[] __initdata = {
Saket Saurabhd425a5d2012-11-06 16:08:28 +05302859 &mpq8064_device_uart_gsbi5,
Jay Chokshi1b7eaa92012-04-04 14:53:14 -07002860 &msm_device_sps_apq8064,
2861 &mpq8064_device_qup_i2c_gsbi5,
2862#ifdef CONFIG_MSM_ROTATOR
2863 &msm_rotator_device,
2864#endif
Ravi Kumar V05931a22012-04-04 17:09:37 +05302865 &gpio_ir_recv_pdev,
Jay Chokshi1b7eaa92012-04-04 14:53:14 -07002866 &mpq8064_device_ext_1p2_buck_vreg,
2867 &mpq8064_device_ext_1p8_buck_vreg,
2868 &mpq8064_device_ext_2p2_buck_vreg,
2869 &mpq8064_device_ext_5v_buck_vreg,
2870 &mpq8064_device_ext_3p3v_ldo_vreg,
Terence Hampson2e1705f2012-04-11 19:55:29 -04002871#ifdef CONFIG_MSM_VCAP
2872 &msm8064_device_vcap,
2873#endif
Ravi Kumar V1c903012012-05-15 16:11:35 +05302874 &rc_input_loopback_pdev,
Bar Weinerf82c5872012-10-23 14:31:26 +02002875 &mpq8064_device_qup_spi_gsbi6,
Bamidi RaviKiran206ddb62012-10-08 09:53:56 +05302876 &sp_input_loopback_pdev,
Jay Chokshi1b7eaa92012-04-04 14:53:14 -07002877};
2878
Harini Jayaramanc4c58692011-07-19 14:50:10 -06002879static struct msm_spi_platform_data apq8064_qup_spi_gsbi5_pdata = {
Stepan Moskovchenkoc71c9792012-01-31 18:12:44 -08002880 .max_clock_speed = 1100000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002881};
2882
Bar Weinerf82c5872012-10-23 14:31:26 +02002883static struct msm_spi_platform_data mpq8064_qup_spi_gsbi6_pdata = {
Bar Weinerbb315492012-10-30 15:02:37 +02002884 .max_clock_speed = 10800000,
Bar Weinerf82c5872012-10-23 14:31:26 +02002885};
2886
2887static struct ci_bridge_platform_data mpq8064_ci_bridge_pdata = {
2888 .reset_pin = 260,
2889 .interrupt_pin = 261,
2890};
2891
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07002892#define KS8851_IRQ_GPIO 43
2893
2894static struct spi_board_info spi_board_info[] __initdata = {
2895 {
2896 .modalias = "ks8851",
2897 .irq = MSM_GPIO_TO_INT(KS8851_IRQ_GPIO),
2898 .max_speed_hz = 19200000,
2899 .bus_num = 0,
2900 .chip_select = 2,
2901 .mode = SPI_MODE_0,
2902 },
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -08002903 {
2904 .modalias = "epm_adc",
2905 .max_speed_hz = 1100000,
2906 .bus_num = 0,
2907 .chip_select = 3,
2908 .mode = SPI_MODE_0,
Bar Weinerf82c5872012-10-23 14:31:26 +02002909 }
2910};
2911
2912static struct spi_board_info mpq8064_spi_board_info[] __initdata = {
2913 {
2914 .modalias = "ci_bridge_spi",
2915 .max_speed_hz = 1000000,
2916 .bus_num = 1,
2917 .chip_select = 0,
2918 .mode = SPI_MODE_0,
2919 .platform_data = &mpq8064_ci_bridge_pdata,
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -08002920 },
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07002921};
2922
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -06002923static struct slim_boardinfo apq8064_slim_devices[] = {
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -08002924 {
Swaminathan Sathappancef966d2011-12-15 17:27:04 -08002925 .bus_num = 1,
2926 .slim_slave = &apq8064_slim_tabla,
2927 },
2928 {
2929 .bus_num = 1,
2930 .slim_slave = &apq8064_slim_tabla20,
Swaminathan Sathappan2f51a752011-12-05 12:51:19 -08002931 },
2932 /* add more slimbus slaves as needed */
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -06002933};
2934
David Keitel3c40fc52012-02-09 17:53:52 -08002935static struct msm_i2c_platform_data apq8064_i2c_qup_gsbi1_pdata = {
2936 .clk_freq = 100000,
2937 .src_clk_rate = 24000000,
2938};
2939
Jing Lin04601f92012-02-05 15:36:07 -08002940static struct msm_i2c_platform_data apq8064_i2c_qup_gsbi3_pdata = {
Anirudh Ghayalc2163472012-04-10 14:58:14 +05302941 .clk_freq = 384000,
Jing Lin04601f92012-02-05 15:36:07 -08002942 .src_clk_rate = 24000000,
2943};
2944
Kenneth Heitke748593a2011-07-15 15:45:11 -06002945static struct msm_i2c_platform_data apq8064_i2c_qup_gsbi4_pdata = {
2946 .clk_freq = 100000,
2947 .src_clk_rate = 24000000,
Kenneth Heitke748593a2011-07-15 15:45:11 -06002948};
2949
Joel King8f839b92012-04-01 14:37:46 -07002950static struct msm_i2c_platform_data mpq8064_i2c_qup_gsbi5_pdata = {
2951 .clk_freq = 100000,
2952 .src_clk_rate = 24000000,
2953};
2954
David Keitel3c40fc52012-02-09 17:53:52 -08002955#define GSBI_DUAL_MODE_CODE 0x60
2956#define MSM_GSBI1_PHYS 0x12440000
Saket Saurabhd425a5d2012-11-06 16:08:28 +05302957#define MSM_GSBI5_PHYS 0x1A200000
Kenneth Heitke748593a2011-07-15 15:45:11 -06002958static void __init apq8064_i2c_init(void)
2959{
David Keitel3c40fc52012-02-09 17:53:52 -08002960 void __iomem *gsbi_mem;
Saket Saurabhd425a5d2012-11-06 16:08:28 +05302961 if (machine_is_mpq8064_cdp() || machine_is_mpq8064_hrd() ||
2962 machine_is_mpq8064_dtv()) {
2963 gsbi_mem = ioremap_nocache(MSM_GSBI5_PHYS, 4);
2964 writel_relaxed(GSBI_DUAL_MODE_CODE, gsbi_mem);
2965 /* Ensure protocol code is written before proceeding */
2966 wmb();
2967 iounmap(gsbi_mem);
2968 mpq8064_i2c_qup_gsbi5_pdata.use_gsbi_shared_mode = 1;
2969 mpq8064_device_qup_i2c_gsbi5.dev.platform_data =
2970 &mpq8064_i2c_qup_gsbi5_pdata;
2971 }
David Keitel3c40fc52012-02-09 17:53:52 -08002972 apq8064_device_qup_i2c_gsbi1.dev.platform_data =
2973 &apq8064_i2c_qup_gsbi1_pdata;
2974 gsbi_mem = ioremap_nocache(MSM_GSBI1_PHYS, 4);
2975 writel_relaxed(GSBI_DUAL_MODE_CODE, gsbi_mem);
2976 /* Ensure protocol code is written before proceeding */
2977 wmb();
2978 iounmap(gsbi_mem);
2979 apq8064_i2c_qup_gsbi1_pdata.use_gsbi_shared_mode = 1;
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -08002980 apq8064_device_qup_i2c_gsbi1.dev.platform_data =
2981 &apq8064_i2c_qup_gsbi1_pdata;
Rohit Vaswani4375c802013-01-09 13:38:19 -08002982 if (!machine_is_fsm8064_ep()) {
2983 apq8064_device_qup_i2c_gsbi3.dev.platform_data =
2984 &apq8064_i2c_qup_gsbi3_pdata;
2985 apq8064_device_qup_i2c_gsbi4.dev.platform_data =
2986 &apq8064_i2c_qup_gsbi4_pdata;
2987 }
Joel King8f839b92012-04-01 14:37:46 -07002988 mpq8064_device_qup_i2c_gsbi5.dev.platform_data =
2989 &mpq8064_i2c_qup_gsbi5_pdata;
Kenneth Heitke748593a2011-07-15 15:45:11 -06002990}
2991
Stepan Moskovchenkoc71c9792012-01-31 18:12:44 -08002992#if defined(CONFIG_KS8851) || defined(CONFIG_KS8851_MODULE)
Stepan Moskovchenkoeed82a52011-09-02 13:19:23 -07002993static int ethernet_init(void)
2994{
2995 int ret;
2996 ret = gpio_request(KS8851_IRQ_GPIO, "ks8851_irq");
2997 if (ret) {
2998 pr_err("ks8851 gpio_request failed: %d\n", ret);
2999 goto fail;
3000 }
3001
3002 return 0;
3003fail:
3004 return ret;
3005}
3006#else
3007static int ethernet_init(void)
3008{
3009 return 0;
3010}
3011#endif
3012
David Collinsd49a1c52012-08-22 13:18:06 -07003013#define GPIO_KEY_HOME PM8921_GPIO_PM_TO_SYS(27)
3014#define GPIO_KEY_VOLUME_UP PM8921_GPIO_PM_TO_SYS(35)
3015#define GPIO_KEY_VOLUME_DOWN_PM8921 PM8921_GPIO_PM_TO_SYS(38)
3016#define GPIO_KEY_VOLUME_DOWN_PM8917 PM8921_GPIO_PM_TO_SYS(30)
3017#define GPIO_KEY_CAM_FOCUS PM8921_GPIO_PM_TO_SYS(3)
3018#define GPIO_KEY_CAM_SNAP PM8921_GPIO_PM_TO_SYS(4)
3019#define GPIO_KEY_ROTATION_PM8921 PM8921_GPIO_PM_TO_SYS(42)
3020#define GPIO_KEY_ROTATION_PM8917 PM8921_GPIO_PM_TO_SYS(8)
Mohan Pallaka474b94b2012-01-25 12:59:58 +05303021
David Collinsd49a1c52012-08-22 13:18:06 -07003022static struct gpio_keys_button cdp_keys_pm8921[] = {
Mohan Pallaka474b94b2012-01-25 12:59:58 +05303023 {
3024 .code = KEY_HOME,
3025 .gpio = GPIO_KEY_HOME,
3026 .desc = "home_key",
3027 .active_low = 1,
3028 .type = EV_KEY,
3029 .wakeup = 1,
3030 .debounce_interval = 15,
3031 },
3032 {
3033 .code = KEY_VOLUMEUP,
3034 .gpio = GPIO_KEY_VOLUME_UP,
3035 .desc = "volume_up_key",
3036 .active_low = 1,
3037 .type = EV_KEY,
3038 .wakeup = 1,
3039 .debounce_interval = 15,
3040 },
3041 {
3042 .code = KEY_VOLUMEDOWN,
David Collinsd49a1c52012-08-22 13:18:06 -07003043 .gpio = GPIO_KEY_VOLUME_DOWN_PM8921,
Mohan Pallaka474b94b2012-01-25 12:59:58 +05303044 .desc = "volume_down_key",
3045 .active_low = 1,
3046 .type = EV_KEY,
3047 .wakeup = 1,
3048 .debounce_interval = 15,
3049 },
3050 {
3051 .code = SW_ROTATE_LOCK,
David Collinsd49a1c52012-08-22 13:18:06 -07003052 .gpio = GPIO_KEY_ROTATION_PM8921,
3053 .desc = "rotate_key",
3054 .active_low = 1,
3055 .type = EV_SW,
3056 .debounce_interval = 15,
3057 },
3058};
3059
3060static struct gpio_keys_button cdp_keys_pm8917[] = {
3061 {
3062 .code = KEY_HOME,
3063 .gpio = GPIO_KEY_HOME,
3064 .desc = "home_key",
3065 .active_low = 1,
3066 .type = EV_KEY,
3067 .wakeup = 1,
3068 .debounce_interval = 15,
3069 },
3070 {
3071 .code = KEY_VOLUMEUP,
3072 .gpio = GPIO_KEY_VOLUME_UP,
3073 .desc = "volume_up_key",
3074 .active_low = 1,
3075 .type = EV_KEY,
3076 .wakeup = 1,
3077 .debounce_interval = 15,
3078 },
3079 {
3080 .code = KEY_VOLUMEDOWN,
3081 .gpio = GPIO_KEY_VOLUME_DOWN_PM8917,
3082 .desc = "volume_down_key",
3083 .active_low = 1,
3084 .type = EV_KEY,
3085 .wakeup = 1,
3086 .debounce_interval = 15,
3087 },
3088 {
3089 .code = SW_ROTATE_LOCK,
3090 .gpio = GPIO_KEY_ROTATION_PM8917,
Mohan Pallaka474b94b2012-01-25 12:59:58 +05303091 .desc = "rotate_key",
3092 .active_low = 1,
3093 .type = EV_SW,
3094 .debounce_interval = 15,
3095 },
3096};
3097
3098static struct gpio_keys_platform_data cdp_keys_data = {
David Collinsd49a1c52012-08-22 13:18:06 -07003099 .buttons = cdp_keys_pm8921,
3100 .nbuttons = ARRAY_SIZE(cdp_keys_pm8921),
Mohan Pallaka474b94b2012-01-25 12:59:58 +05303101};
3102
3103static struct platform_device cdp_kp_pdev = {
3104 .name = "gpio-keys",
3105 .id = -1,
3106 .dev = {
3107 .platform_data = &cdp_keys_data,
3108 },
3109};
3110
3111static struct gpio_keys_button mtp_keys[] = {
3112 {
3113 .code = KEY_CAMERA_FOCUS,
3114 .gpio = GPIO_KEY_CAM_FOCUS,
3115 .desc = "cam_focus_key",
3116 .active_low = 1,
3117 .type = EV_KEY,
3118 .wakeup = 1,
3119 .debounce_interval = 15,
3120 },
3121 {
3122 .code = KEY_VOLUMEUP,
3123 .gpio = GPIO_KEY_VOLUME_UP,
3124 .desc = "volume_up_key",
3125 .active_low = 1,
3126 .type = EV_KEY,
3127 .wakeup = 1,
3128 .debounce_interval = 15,
3129 },
3130 {
3131 .code = KEY_VOLUMEDOWN,
David Collinsd49a1c52012-08-22 13:18:06 -07003132 .gpio = GPIO_KEY_VOLUME_DOWN_PM8921,
Mohan Pallaka474b94b2012-01-25 12:59:58 +05303133 .desc = "volume_down_key",
3134 .active_low = 1,
3135 .type = EV_KEY,
3136 .wakeup = 1,
3137 .debounce_interval = 15,
3138 },
3139 {
3140 .code = KEY_CAMERA_SNAPSHOT,
3141 .gpio = GPIO_KEY_CAM_SNAP,
3142 .desc = "cam_snap_key",
3143 .active_low = 1,
3144 .type = EV_KEY,
3145 .debounce_interval = 15,
3146 },
3147};
3148
3149static struct gpio_keys_platform_data mtp_keys_data = {
3150 .buttons = mtp_keys,
3151 .nbuttons = ARRAY_SIZE(mtp_keys),
3152};
3153
3154static struct platform_device mtp_kp_pdev = {
3155 .name = "gpio-keys",
3156 .id = -1,
3157 .dev = {
3158 .platform_data = &mtp_keys_data,
3159 },
3160};
3161
Mohan Pallakab8aa8282012-10-04 14:26:21 +05303162#define MPQ_HRD_HOME_GPIO SX150X_EXP2_GPIO_BASE
3163#define MPQ_HRD_VOL_UP_GPIO (SX150X_EXP2_GPIO_BASE + 1)
3164#define MPQ_HRD_VOL_DOWN_GPIO (SX150X_EXP2_GPIO_BASE + 2)
3165#define MPQ_HRD_RIGHT_GPIO (SX150X_EXP2_GPIO_BASE + 3)
3166#define MPQ_HRD_LEFT_GPIO (SX150X_EXP2_GPIO_BASE + 4)
3167#define MPQ_HRD_ENTER_GPIO (SX150X_EXP2_GPIO_BASE + 5)
3168
3169static struct gpio_keys_button mpq_hrd_keys[] = {
3170 {
3171 .code = KEY_HOME,
3172 .gpio = MPQ_HRD_HOME_GPIO,
3173 .desc = "home_key",
3174 .active_low = 1,
3175 .type = EV_KEY,
3176 .wakeup = 1,
3177 .debounce_interval = 15,
3178 },
3179 {
3180 .code = KEY_VOLUMEUP,
3181 .gpio = MPQ_HRD_VOL_UP_GPIO,
3182 .desc = "volume_up_key",
3183 .active_low = 1,
3184 .type = EV_KEY,
3185 .wakeup = 1,
3186 .debounce_interval = 15,
3187 },
3188 {
3189 .code = KEY_VOLUMEDOWN,
3190 .gpio = MPQ_HRD_VOL_DOWN_GPIO,
3191 .desc = "volume_down_key",
3192 .active_low = 1,
3193 .type = EV_KEY,
3194 .wakeup = 1,
3195 .debounce_interval = 15,
3196 },
3197 {
3198 .code = KEY_RIGHT,
3199 .gpio = MPQ_HRD_RIGHT_GPIO,
3200 .desc = "right_key",
3201 .active_low = 1,
3202 .type = EV_KEY,
3203 .wakeup = 1,
3204 .debounce_interval = 15,
3205 },
3206 {
3207 .code = KEY_LEFT,
3208 .gpio = MPQ_HRD_LEFT_GPIO,
3209 .desc = "left_key",
3210 .active_low = 1,
3211 .type = EV_KEY,
3212 .wakeup = 1,
3213 .debounce_interval = 15,
3214 },
3215 {
3216 .code = KEY_ENTER,
3217 .gpio = MPQ_HRD_ENTER_GPIO,
3218 .desc = "enter_key",
3219 .active_low = 1,
3220 .type = EV_KEY,
3221 .wakeup = 1,
3222 .debounce_interval = 15,
3223 },
3224};
3225
3226static struct gpio_keys_platform_data mpq_hrd_keys_pdata = {
3227 .buttons = mpq_hrd_keys,
3228 .nbuttons = ARRAY_SIZE(mpq_hrd_keys),
3229};
3230
3231static struct platform_device mpq_hrd_keys_pdev = {
3232 .name = "gpio-keys",
3233 .id = -1,
3234 .dev = {
3235 .platform_data = &mpq_hrd_keys_pdata,
3236 },
3237};
3238
Anirudh Ghayal32ea6252012-04-26 16:39:50 +05303239static struct gpio_keys_button mpq_keys[] = {
3240 {
3241 .code = KEY_VOLUMEDOWN,
David Collinsd49a1c52012-08-22 13:18:06 -07003242 .gpio = GPIO_KEY_VOLUME_DOWN_PM8921,
Anirudh Ghayal32ea6252012-04-26 16:39:50 +05303243 .desc = "volume_down_key",
3244 .active_low = 1,
3245 .type = EV_KEY,
3246 .wakeup = 1,
3247 .debounce_interval = 15,
3248 },
3249 {
3250 .code = KEY_VOLUMEUP,
3251 .gpio = GPIO_KEY_VOLUME_UP,
3252 .desc = "volume_up_key",
3253 .active_low = 1,
3254 .type = EV_KEY,
3255 .wakeup = 1,
3256 .debounce_interval = 15,
3257 },
3258};
3259
3260static struct gpio_keys_platform_data mpq_keys_data = {
3261 .buttons = mpq_keys,
3262 .nbuttons = ARRAY_SIZE(mpq_keys),
3263};
3264
3265static struct platform_device mpq_gpio_keys_pdev = {
3266 .name = "gpio-keys",
3267 .id = -1,
3268 .dev = {
3269 .platform_data = &mpq_keys_data,
3270 },
3271};
3272
3273#define MPQ_KP_ROW_BASE SX150X_EXP2_GPIO_BASE
3274#define MPQ_KP_COL_BASE (SX150X_EXP2_GPIO_BASE + 4)
3275
3276static unsigned int mpq_row_gpios[] = {MPQ_KP_ROW_BASE, MPQ_KP_ROW_BASE + 1,
3277 MPQ_KP_ROW_BASE + 2, MPQ_KP_ROW_BASE + 3};
3278static unsigned int mpq_col_gpios[] = {MPQ_KP_COL_BASE, MPQ_KP_COL_BASE + 1,
3279 MPQ_KP_COL_BASE + 2};
3280
3281static const unsigned int mpq_keymap[] = {
3282 KEY(0, 0, KEY_UP),
3283 KEY(0, 1, KEY_ENTER),
3284 KEY(0, 2, KEY_3),
3285
3286 KEY(1, 0, KEY_DOWN),
3287 KEY(1, 1, KEY_EXIT),
3288 KEY(1, 2, KEY_4),
3289
3290 KEY(2, 0, KEY_LEFT),
3291 KEY(2, 1, KEY_1),
3292 KEY(2, 2, KEY_5),
3293
3294 KEY(3, 0, KEY_RIGHT),
3295 KEY(3, 1, KEY_2),
3296 KEY(3, 2, KEY_6),
3297};
3298
3299static struct matrix_keymap_data mpq_keymap_data = {
3300 .keymap_size = ARRAY_SIZE(mpq_keymap),
3301 .keymap = mpq_keymap,
3302};
3303
3304static struct matrix_keypad_platform_data mpq_keypad_data = {
3305 .keymap_data = &mpq_keymap_data,
3306 .row_gpios = mpq_row_gpios,
3307 .col_gpios = mpq_col_gpios,
3308 .num_row_gpios = ARRAY_SIZE(mpq_row_gpios),
3309 .num_col_gpios = ARRAY_SIZE(mpq_col_gpios),
3310 .col_scan_delay_us = 32000,
3311 .debounce_ms = 20,
3312 .wakeup = 1,
3313 .active_low = 1,
3314 .no_autorepeat = 1,
3315};
3316
3317static struct platform_device mpq_keypad_device = {
3318 .name = "matrix-keypad",
3319 .id = -1,
3320 .dev = {
3321 .platform_data = &mpq_keypad_data,
3322 },
3323};
3324
Srikanth Uyyala7d4f7212012-10-12 17:45:36 +05303325static struct platform_device msm_dev_avtimer_device = {
3326 .name = "dev_avtimer",
3327 .dev = { .platform_data = &dev_avtimer_pdata },
3328};
3329
Jin Hongd3024e62012-02-09 16:13:32 -08003330/* Sensors DSPS platform data */
3331#define DSPS_PIL_GENERIC_NAME "dsps"
3332static void __init apq8064_init_dsps(void)
3333{
3334 struct msm_dsps_platform_data *pdata =
3335 msm_dsps_device_8064.dev.platform_data;
3336 pdata->pil_name = DSPS_PIL_GENERIC_NAME;
3337 pdata->gpios = NULL;
3338 pdata->gpios_num = 0;
3339
3340 platform_device_register(&msm_dsps_device_8064);
3341}
Mohan Pallaka474b94b2012-01-25 12:59:58 +05303342
Jing Lin417fa452012-02-05 14:31:06 -08003343#define I2C_SURF 1
3344#define I2C_FFA (1 << 1)
3345#define I2C_RUMI (1 << 2)
3346#define I2C_SIM (1 << 3)
3347#define I2C_LIQUID (1 << 4)
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07003348#define I2C_MPQ_CDP BIT(5)
3349#define I2C_MPQ_HRD BIT(6)
3350#define I2C_MPQ_DTV BIT(7)
Jing Lin417fa452012-02-05 14:31:06 -08003351
3352struct i2c_registry {
3353 u8 machs;
3354 int bus;
3355 struct i2c_board_info *info;
3356 int len;
3357};
3358
3359static struct i2c_registry apq8064_i2c_devices[] __initdata = {
Jing Lin21ed4de2012-02-05 15:53:28 -08003360 {
David Keitel2f613d92012-02-15 11:29:16 -08003361 I2C_LIQUID,
3362 APQ_8064_GSBI1_QUP_I2C_BUS_ID,
3363 smb349_charger_i2c_info,
3364 ARRAY_SIZE(smb349_charger_i2c_info)
3365 },
3366 {
Jing Lin21ed4de2012-02-05 15:53:28 -08003367 I2C_SURF | I2C_LIQUID,
3368 APQ_8064_GSBI3_QUP_I2C_BUS_ID,
3369 mxt_device_info,
3370 ARRAY_SIZE(mxt_device_info),
3371 },
Anirudh Ghayal2917a5a2012-02-05 19:51:07 -08003372 {
3373 I2C_FFA,
3374 APQ_8064_GSBI3_QUP_I2C_BUS_ID,
3375 cyttsp_info,
3376 ARRAY_SIZE(cyttsp_info),
3377 },
Amy Maloche70090f992012-02-16 16:35:26 -08003378 {
3379 I2C_FFA | I2C_LIQUID,
3380 APQ_8064_GSBI1_QUP_I2C_BUS_ID,
3381 isa1200_board_info,
3382 ARRAY_SIZE(isa1200_board_info),
3383 },
Santosh Mardieff9a742012-04-09 23:23:39 +05303384 {
3385 I2C_MPQ_CDP,
3386 APQ_8064_GSBI5_QUP_I2C_BUS_ID,
3387 cs8427_device_info,
3388 ARRAY_SIZE(cs8427_device_info),
3389 },
Abhishek Kharbanda72dc72e2012-06-07 13:41:37 -07003390 {
3391 I2C_SURF | I2C_FFA | I2C_LIQUID,
3392 APQ_8064_GSBI1_QUP_I2C_BUS_ID,
3393 sii_device_info,
3394 ARRAY_SIZE(sii_device_info),
3395 }
Jing Lin417fa452012-02-05 14:31:06 -08003396};
3397
Kuirong Wangf8c5e142012-06-21 16:17:32 -07003398static struct i2c_registry apq8064_tabla_i2c_devices[] __initdata = {
3399 {
3400 .bus = APQ_8064_GSBI1_QUP_I2C_BUS_ID,
3401 .info = apq8064_tabla_i2c_device_info,
3402 .len = ARRAY_SIZE(apq8064_tabla_i2c_device_info),
3403 },
3404};
3405
Jay Chokshi607f61b2012-04-25 18:21:21 -07003406#define SX150X_EXP1_INT_N PM8921_MPP_IRQ(PM8921_IRQ_BASE, 9)
Anirudh Ghayal9f1aaa72012-04-26 18:15:08 +05303407#define SX150X_EXP2_INT_N MSM_GPIO_TO_INT(81)
Jay Chokshi607f61b2012-04-25 18:21:21 -07003408
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07003409struct sx150x_platform_data mpq8064_sx150x_pdata[] = {
3410 [SX150X_EXP1] = {
3411 .gpio_base = SX150X_EXP1_GPIO_BASE,
3412 .oscio_is_gpo = false,
3413 .io_pullup_ena = 0x0,
3414 .io_pulldn_ena = 0x0,
3415 .io_open_drain_ena = 0x0,
3416 .io_polarity = 0,
Jay Chokshi607f61b2012-04-25 18:21:21 -07003417 .irq_summary = SX150X_EXP1_INT_N,
3418 .irq_base = SX150X_EXP1_IRQ_BASE,
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07003419 },
3420 [SX150X_EXP2] = {
3421 .gpio_base = SX150X_EXP2_GPIO_BASE,
3422 .oscio_is_gpo = false,
Anirudh Ghayal32ea6252012-04-26 16:39:50 +05303423 .io_pullup_ena = 0x0f,
3424 .io_pulldn_ena = 0x70,
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07003425 .io_open_drain_ena = 0x0,
3426 .io_polarity = 0,
Anirudh Ghayal9f1aaa72012-04-26 18:15:08 +05303427 .irq_summary = SX150X_EXP2_INT_N,
3428 .irq_base = SX150X_EXP2_IRQ_BASE,
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07003429 },
3430 [SX150X_EXP3] = {
3431 .gpio_base = SX150X_EXP3_GPIO_BASE,
3432 .oscio_is_gpo = false,
3433 .io_pullup_ena = 0x0,
3434 .io_pulldn_ena = 0x0,
3435 .io_open_drain_ena = 0x0,
3436 .io_polarity = 0,
3437 .irq_summary = -1,
3438 },
3439 [SX150X_EXP4] = {
3440 .gpio_base = SX150X_EXP4_GPIO_BASE,
3441 .oscio_is_gpo = false,
3442 .io_pullup_ena = 0x0,
3443 .io_pulldn_ena = 0x0,
3444 .io_open_drain_ena = 0x0,
3445 .io_polarity = 0,
3446 .irq_summary = -1,
3447 },
3448};
3449
3450static struct i2c_board_info sx150x_gpio_exp_info[] = {
3451 {
3452 I2C_BOARD_INFO("sx1509q", 0x70),
3453 .platform_data = &mpq8064_sx150x_pdata[SX150X_EXP1],
3454 },
3455 {
3456 I2C_BOARD_INFO("sx1508q", 0x23),
3457 .platform_data = &mpq8064_sx150x_pdata[SX150X_EXP2],
3458 },
3459 {
3460 I2C_BOARD_INFO("sx1508q", 0x22),
3461 .platform_data = &mpq8064_sx150x_pdata[SX150X_EXP3],
3462 },
3463 {
3464 I2C_BOARD_INFO("sx1509q", 0x3E),
3465 .platform_data = &mpq8064_sx150x_pdata[SX150X_EXP4],
3466 },
3467};
3468
3469#define MPQ8064_I2C_GSBI5_BUS_ID 5
3470
3471static struct i2c_registry mpq8064_i2c_devices[] __initdata = {
3472 {
3473 I2C_MPQ_CDP,
3474 MPQ8064_I2C_GSBI5_BUS_ID,
3475 sx150x_gpio_exp_info,
3476 ARRAY_SIZE(sx150x_gpio_exp_info),
3477 },
3478};
3479
Jing Lin417fa452012-02-05 14:31:06 -08003480static void __init register_i2c_devices(void)
3481{
3482 u8 mach_mask = 0;
3483 int i;
Kuirong Wangf8c5e142012-06-21 16:17:32 -07003484 u32 version;
Jing Lin417fa452012-02-05 14:31:06 -08003485
Kevin Chand07220e2012-02-13 15:52:22 -08003486#ifdef CONFIG_MSM_CAMERA
3487 struct i2c_registry apq8064_camera_i2c_devices = {
3488 I2C_SURF | I2C_FFA | I2C_LIQUID | I2C_RUMI,
3489 APQ_8064_GSBI4_QUP_I2C_BUS_ID,
3490 apq8064_camera_board_info.board_info,
3491 apq8064_camera_board_info.num_i2c_board_info,
3492 };
3493#endif
Jing Lin417fa452012-02-05 14:31:06 -08003494 /* Build the matching 'supported_machs' bitmask */
3495 if (machine_is_apq8064_cdp())
3496 mach_mask = I2C_SURF;
3497 else if (machine_is_apq8064_mtp())
3498 mach_mask = I2C_FFA;
3499 else if (machine_is_apq8064_liquid())
3500 mach_mask = I2C_LIQUID;
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07003501 else if (PLATFORM_IS_MPQ8064())
3502 mach_mask = I2C_MPQ_CDP;
Rohit Vaswani4375c802013-01-09 13:38:19 -08003503 else if (machine_is_fsm8064_ep())
3504 mach_mask = I2C_SURF;
Jing Lin417fa452012-02-05 14:31:06 -08003505 else
3506 pr_err("unmatched machine ID in register_i2c_devices\n");
3507
3508 /* Run the array and install devices as appropriate */
3509 for (i = 0; i < ARRAY_SIZE(apq8064_i2c_devices); ++i) {
3510 if (apq8064_i2c_devices[i].machs & mach_mask)
3511 i2c_register_board_info(apq8064_i2c_devices[i].bus,
3512 apq8064_i2c_devices[i].info,
3513 apq8064_i2c_devices[i].len);
3514 }
Kevin Chand07220e2012-02-13 15:52:22 -08003515#ifdef CONFIG_MSM_CAMERA
3516 if (apq8064_camera_i2c_devices.machs & mach_mask)
3517 i2c_register_board_info(apq8064_camera_i2c_devices.bus,
3518 apq8064_camera_i2c_devices.info,
3519 apq8064_camera_i2c_devices.len);
3520#endif
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07003521
3522 for (i = 0; i < ARRAY_SIZE(mpq8064_i2c_devices); ++i) {
3523 if (mpq8064_i2c_devices[i].machs & mach_mask)
3524 i2c_register_board_info(
3525 mpq8064_i2c_devices[i].bus,
3526 mpq8064_i2c_devices[i].info,
3527 mpq8064_i2c_devices[i].len);
3528 }
Kuirong Wangf8c5e142012-06-21 16:17:32 -07003529
3530 if (machine_is_apq8064_mtp()) {
3531 version = socinfo_get_platform_version();
3532 if (SOCINFO_VERSION_MINOR(version) == 1)
3533 for (i = 0; i < ARRAY_SIZE(apq8064_tabla_i2c_devices);
3534 ++i)
3535 i2c_register_board_info(
3536 apq8064_tabla_i2c_devices[i].bus,
3537 apq8064_tabla_i2c_devices[i].info,
3538 apq8064_tabla_i2c_devices[i].len);
3539 }
3540
Jing Lin417fa452012-02-05 14:31:06 -08003541}
3542
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07003543static void enable_avc_i2c_bus(void)
3544{
3545 int avc_i2c_en_mpp = PM8921_MPP_PM_TO_SYS(8);
3546 int rc;
3547
3548 rc = gpio_request(avc_i2c_en_mpp, "avc_i2c_en");
3549 if (rc)
3550 pr_err("request for avc_i2c_en mpp failed,"
3551 "rc=%d\n", rc);
3552 else
3553 gpio_set_value_cansleep(avc_i2c_en_mpp, 1);
3554}
3555
David Collinsd49a1c52012-08-22 13:18:06 -07003556/* Modify platform data values to match requirements for PM8917. */
3557static void __init apq8064_pm8917_pdata_fixup(void)
3558{
3559 cdp_keys_data.buttons = cdp_keys_pm8917;
3560 cdp_keys_data.nbuttons = ARRAY_SIZE(cdp_keys_pm8917);
3561}
3562
Anji Jonnala1a1711a2013-01-29 13:34:10 +05303563static void __init apq8064ab_update_retention_spm(void)
3564{
3565 int i;
3566
3567 /* Update the SPM sequences for krait retention on all cores */
3568 for (i = 0; i < ARRAY_SIZE(msm_spm_data); i++) {
3569 int j;
3570 struct msm_spm_platform_data *pdata = &msm_spm_data[i];
3571 for (j = 0; j < pdata->num_modes; j++) {
3572 if (pdata->modes[j].cmd ==
3573 spm_retention_cmd_sequence)
3574 pdata->modes[j].cmd =
3575 spm_retention_with_krait_v3_cmd_sequence;
3576 }
3577 }
3578}
3579
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003580static void __init apq8064_common_init(void)
3581{
Kuirong Wangf8c5e142012-06-21 16:17:32 -07003582 u32 platform_version = socinfo_get_platform_version();
Hemant Kumarbc8bdf62012-10-17 12:29:51 -07003583 struct msm_rpmrs_level rpmrs_level;
David Collinsd49a1c52012-08-22 13:18:06 -07003584
3585 if (socinfo_get_pmic_model() == PMIC_MODEL_PM8917)
3586 apq8064_pm8917_pdata_fixup();
Rohit Vaswanib1cc4932012-07-23 21:30:11 -07003587 platform_device_register(&msm_gpio_device);
Joel King8f839b92012-04-01 14:37:46 -07003588 msm_tsens_early_init(&apq_tsens_pdata);
Praveen Chidambaram877d7a42012-06-05 14:33:20 -06003589 msm_thermal_init(&msm_thermal_pdata);
Abhimanyu Kapur91a0a502013-01-11 19:24:59 -08003590 if (socinfo_init() < 0)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003591 pr_err("socinfo_init() failed!\n");
Praveen Chidambaram78499012011-11-01 17:15:17 -06003592 BUG_ON(msm_rpm_init(&apq8064_rpm_data));
3593 BUG_ON(msm_rpmrs_levels_init(&msm_rpmrs_data));
David Collins2782b5c2012-02-06 10:02:42 -08003594 regulator_suppress_info_printing();
David Collins793793b2012-08-21 15:43:02 -07003595 if (socinfo_get_pmic_model() == PMIC_MODEL_PM8917)
3596 configure_apq8064_pm8917_power_grid();
David Collins2782b5c2012-02-06 10:02:42 -08003597 platform_device_register(&apq8064_device_rpm_regulator);
David Collins793793b2012-08-21 15:43:02 -07003598 if (socinfo_get_pmic_model() != PMIC_MODEL_PM8917)
3599 platform_device_register(&apq8064_pm8921_device_rpm_regulator);
Stephen Boyd4d0d2582012-02-10 14:49:40 -08003600 if (msm_xo_init())
3601 pr_err("Failed to initialize XO votes\n");
Matt Wagantallc51e5602012-02-27 17:25:25 -08003602 msm_clock_init(&apq8064_clock_init_data);
Stepan Moskovchenko2327a952011-12-14 16:31:28 -08003603 apq8064_init_gpiomux();
Kenneth Heitke748593a2011-07-15 15:45:11 -06003604 apq8064_i2c_init();
Mohan Pallakab8aa8282012-10-04 14:26:21 +05303605
3606 /* configure sx150x parameters for HRD */
3607 if (machine_is_mpq8064_hrd()) {
3608 mpq8064_sx150x_pdata[SX150X_EXP2].irq_summary =
3609 PM8921_GPIO_IRQ(PM8921_IRQ_BASE, 40);
3610 mpq8064_sx150x_pdata[SX150X_EXP2].io_pullup_ena = 0xff;
3611 mpq8064_sx150x_pdata[SX150X_EXP2].io_pulldn_ena = 0x00;
3612 }
3613
Jing Lin417fa452012-02-05 14:31:06 -08003614 register_i2c_devices();
Kenneth Heitke36920d32011-07-20 16:44:30 -06003615
Harini Jayaramanc4c58692011-07-19 14:50:10 -06003616 apq8064_device_qup_spi_gsbi5.dev.platform_data =
3617 &apq8064_qup_spi_gsbi5_pdata;
Stepan Moskovchenkoc1074f02011-12-14 17:51:57 -08003618 apq8064_init_pmic();
Hemant Kumar94e7da22012-02-03 16:52:29 -08003619 if (machine_is_apq8064_liquid())
3620 msm_otg_pdata.mhl_enable = true;
Vamsi Krishnad9863eb2012-03-26 17:34:48 -07003621
Abhishek Kharbanda72dc72e2012-06-07 13:41:37 -07003622 if (apq8064_mhl_display_enabled())
3623 mhl_platform_data.mhl_enabled = true;
3624
Ofir Cohen94213a72012-05-03 14:26:32 +03003625 android_usb_pdata.swfi_latency =
3626 msm_rpmrs_levels[0].latency_us;
Vamsi Krishnad9863eb2012-03-26 17:34:48 -07003627
Stepan Moskovchenko14aa6492011-08-08 15:15:01 -07003628 apq8064_device_otg.dev.platform_data = &msm_otg_pdata;
Manu Gautam91223e02011-11-08 15:27:22 +05303629 apq8064_ehci_host_init();
Gagan Mac8a7a5d32011-11-11 16:43:06 -07003630 apq8064_init_buses();
David Collins793793b2012-08-21 15:43:02 -07003631
3632 platform_add_devices(early_common_devices,
3633 ARRAY_SIZE(early_common_devices));
Bamidi RaviKirand1e9f0d2012-12-10 17:33:10 +05303634 if (socinfo_get_pmic_model() != PMIC_MODEL_PM8917) {
3635 if (!machine_is_mpq8064_hrd())
3636 platform_add_devices(pm8921_common_devices,
3637 ARRAY_SIZE(pm8921_common_devices));
3638 else
3639 platform_add_devices(pm8921_mpq_hrd_common_devices,
3640 ARRAY_SIZE(pm8921_mpq_hrd_common_devices));
3641 }
David Collins793793b2012-08-21 15:43:02 -07003642 else
3643 platform_add_devices(pm8917_common_devices,
3644 ARRAY_SIZE(pm8917_common_devices));
David Collins03c16372012-10-04 15:57:28 -07003645 if (machine_is_apq8064_cdp() || machine_is_apq8064_liquid())
3646 platform_device_register(&apq8064_device_ext_ts_sw_vreg);
Rohit Vaswani4375c802013-01-09 13:38:19 -08003647 if (!machine_is_fsm8064_ep())
3648 platform_add_devices(common_devices,
3649 ARRAY_SIZE(common_devices));
Terence Hampson36b70722012-05-10 13:18:16 -04003650 if (!(machine_is_mpq8064_cdp() || machine_is_mpq8064_hrd() ||
Rohit Vaswani4375c802013-01-09 13:38:19 -08003651 machine_is_mpq8064_dtv() || machine_is_fsm8064_ep()))
Terence Hampson36b70722012-05-10 13:18:16 -04003652 platform_add_devices(common_not_mpq_devices,
3653 ARRAY_SIZE(common_not_mpq_devices));
Kuirong Wangf8c5e142012-06-21 16:17:32 -07003654
3655 if ((machine_is_mpq8064_cdp() || machine_is_mpq8064_hrd() ||
3656 machine_is_mpq8064_dtv()))
3657 platform_add_devices(common_mpq_devices,
3658 ARRAY_SIZE(common_mpq_devices));
3659
3660 if (machine_is_apq8064_mtp()) {
3661 if (SOCINFO_VERSION_MINOR(platform_version) == 1)
3662 platform_add_devices(common_i2s_devices,
3663 ARRAY_SIZE(common_i2s_devices));
3664 }
3665
Hemant Kumarbc8bdf62012-10-17 12:29:51 -07003666 rpmrs_level =
3667 msm_rpmrs_levels[MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT];
3668 msm_hsic_pdata.swfi_latency = rpmrs_level.latency_us;
3669 rpmrs_level =
3670 msm_rpmrs_levels[MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE];
3671 msm_hsic_pdata.standalone_latency = rpmrs_level.latency_us;
Hemant Kumarf1ca9192012-02-07 18:59:33 -08003672 if (machine_is_apq8064_mtp()) {
Hemant Kumar30d361c2012-08-20 14:44:40 -07003673 msm_hsic_pdata.log2_irq_thresh = 5,
Hemant Kumarf1ca9192012-02-07 18:59:33 -08003674 apq8064_device_hsic_host.dev.platform_data = &msm_hsic_pdata;
3675 device_initialize(&apq8064_device_hsic_host.dev);
3676 }
Jay Chokshie8741282012-01-25 15:22:55 -08003677 apq8064_pm8xxx_gpio_mpp_init();
Sahitya Tummala3586ed92011-08-03 09:13:23 +05303678 apq8064_init_mmc();
Swaminathan Sathappan144b4882012-02-06 17:01:20 -08003679
3680 if (machine_is_apq8064_mtp()) {
3681 mdm_8064_device.dev.platform_data = &mdm_platform_data;
Ameya Thakure155ece2012-07-09 12:08:37 -07003682 if (SOCINFO_VERSION_MINOR(platform_version) == 1) {
3683 i2s_mdm_8064_device.dev.platform_data =
3684 &mdm_platform_data;
3685 platform_device_register(&i2s_mdm_8064_device);
3686 } else {
3687 mdm_8064_device.dev.platform_data = &mdm_platform_data;
3688 platform_device_register(&mdm_8064_device);
3689 }
Swaminathan Sathappan144b4882012-02-06 17:01:20 -08003690 }
3691 platform_device_register(&apq8064_slim_ctrl);
Santosh Mardi344455a2012-09-07 13:22:16 +05303692 if (machine_is_mpq8064_hrd() || machine_is_mpq8064_dtv()) {
3693 apq8064_slim_devices[ARRAY_SIZE(apq8064_slim_devices) - 1].\
3694 slim_slave = &mpq8064_slim_ashiko20;
3695 }
Sagar Dharia8bdcdaf2011-09-16 16:01:15 -06003696 slim_register_board_info(apq8064_slim_devices,
3697 ARRAY_SIZE(apq8064_slim_devices));
Taniya Dasbbf633d2012-07-31 16:07:47 +05303698 if (!PLATFORM_IS_MPQ8064()) {
Taniya Das30cae292012-07-31 15:56:12 +05303699 apq8064_init_dsps();
Taniya Dasbbf633d2012-07-31 16:07:47 +05303700 platform_device_register(&msm_8960_riva);
3701 }
Praveen Chidambaramc3c90822012-11-07 15:43:49 -07003702 if (cpu_is_apq8064ab())
3703 apq8064ab_update_krait_spm();
Anji Jonnala1a1711a2013-01-29 13:34:10 +05303704 if (cpu_is_krait_v3()) {
Praveen Chidambaramf27a5152013-02-01 11:44:53 -07003705 struct msm_pm_init_data_type *pdata =
3706 msm8064_pm_8x60.dev.platform_data;
3707 pdata->retention_calls_tz = false;
Anji Jonnala1a1711a2013-01-29 13:34:10 +05303708 apq8064ab_update_retention_spm();
Anji Jonnala1a1711a2013-01-29 13:34:10 +05303709 }
Praveen Chidambaramf27a5152013-02-01 11:44:53 -07003710 platform_device_register(&msm8064_pm_8x60);
3711
Praveen Chidambaram78499012011-11-01 17:15:17 -06003712 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
3713 msm_spm_l2_init(msm_spm_l2_data);
Praveen Chidambaram78499012011-11-01 17:15:17 -06003714 BUG_ON(msm_pm_boot_init(&msm_pm_boot_pdata));
Siddartha Mohanadossb9df4942012-02-08 09:58:21 -08003715 apq8064_epm_adc_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07003716}
3717
Huaibin Yang4a084e32011-12-15 15:25:52 -08003718static void __init apq8064_allocate_memory_regions(void)
3719{
3720 apq8064_allocate_fb_region();
3721}
3722
Joel King82b7e3f2012-01-05 10:03:27 -08003723static void __init apq8064_cdp_init(void)
3724{
Hanumant Singh50440d42012-04-23 19:27:16 -07003725 if (meminfo_init(SYS_MEMORY, SZ_256M) < 0)
3726 pr_err("meminfo_init() failed!\n");
Amy Maloche609bb5e2012-08-03 09:41:42 -07003727 if (machine_is_apq8064_mtp() &&
3728 SOCINFO_VERSION_MINOR(socinfo_get_platform_version()) == 1)
3729 cyttsp_pdata.sleep_gpio = CYTTSP_TS_GPIO_SLEEP_ALT;
Joel King82b7e3f2012-01-05 10:03:27 -08003730 apq8064_common_init();
Joel King8f839b92012-04-01 14:37:46 -07003731 if (machine_is_mpq8064_cdp() || machine_is_mpq8064_hrd() ||
3732 machine_is_mpq8064_dtv()) {
Ravi Kumar V16a614c2012-10-12 20:59:56 +05303733 gpio_ir_recv_pdata.swfi_latency =
3734 msm_rpmrs_levels[0].latency_us;
Jay Chokshie7d8d4f2012-04-04 14:47:57 -07003735 enable_avc_i2c_bus();
Olav Hauganef95ae32012-05-15 09:50:30 -07003736 msm_rotator_set_split_iommu_domain();
Bar Weinerf82c5872012-10-23 14:31:26 +02003737
3738 mpq8064_device_qup_spi_gsbi6.dev.platform_data =
3739 &mpq8064_qup_spi_gsbi6_pdata;
3740
Joel King8f839b92012-04-01 14:37:46 -07003741 platform_add_devices(mpq_devices, ARRAY_SIZE(mpq_devices));
Niranjana Vishwanathapura06f89332012-05-03 17:11:13 -06003742 mpq8064_pcie_init();
Bar Weinerf82c5872012-10-23 14:31:26 +02003743 spi_register_board_info(mpq8064_spi_board_info,
3744 ARRAY_SIZE(mpq8064_spi_board_info));
Joel King8f839b92012-04-01 14:37:46 -07003745 } else {
3746 ethernet_init();
Olav Hauganef95ae32012-05-15 09:50:30 -07003747 msm_rotator_set_split_iommu_domain();
Joel King8f839b92012-04-01 14:37:46 -07003748 platform_add_devices(cdp_devices, ARRAY_SIZE(cdp_devices));
3749 spi_register_board_info(spi_board_info,
3750 ARRAY_SIZE(spi_board_info));
3751 }
Ravishangar Kalyanamc2fee312012-02-09 19:11:22 -08003752 apq8064_init_fb();
Jordan Crouseb3115fe2012-02-01 22:11:12 -07003753 apq8064_init_gpu();
Matt Wagantall1f65d9d2012-04-25 14:24:20 -07003754 platform_add_devices(apq8064_footswitch, apq8064_num_footswitch);
Steve Mucklef132c6c2012-06-06 18:30:57 -07003755#ifdef CONFIG_MSM_CAMERA
Kevin Chand07220e2012-02-13 15:52:22 -08003756 apq8064_init_cam();
Steve Mucklef132c6c2012-06-06 18:30:57 -07003757#endif
Mohan Pallaka474b94b2012-01-25 12:59:58 +05303758
Mayank Rana262e9032012-05-10 15:14:00 -07003759 if (machine_is_mpq8064_hrd() || machine_is_mpq8064_dtv()) {
3760 platform_device_register(&mpq8064_device_uartdm_gsbi6);
3761#ifdef CONFIG_SERIAL_MSM_HS
3762 /* GSBI6(2) - UARTDM_RX */
3763 mpq8064_gsbi6_uartdm_pdata.wakeup_irq = gpio_to_irq(15);
3764 mpq8064_device_uartdm_gsbi6.dev.platform_data =
3765 &mpq8064_gsbi6_uartdm_pdata;
3766#endif
3767 }
3768
Ankit Verma6fe41b02012-09-13 16:12:11 +05303769#if defined(CONFIG_BT) && defined(CONFIG_MARIMBA_CORE)
3770 if (machine_is_mpq8064_hrd())
3771 apq8064_bt_power_init();
3772#endif
3773
Mohan Pallaka474b94b2012-01-25 12:59:58 +05303774 if (machine_is_apq8064_cdp() || machine_is_apq8064_liquid())
3775 platform_device_register(&cdp_kp_pdev);
3776
3777 if (machine_is_apq8064_mtp())
3778 platform_device_register(&mtp_kp_pdev);
Hanumant Singh50440d42012-04-23 19:27:16 -07003779
Anirudh Ghayal32ea6252012-04-26 16:39:50 +05303780 if (machine_is_mpq8064_cdp()) {
3781 platform_device_register(&mpq_gpio_keys_pdev);
3782 platform_device_register(&mpq_keypad_device);
Mohan Pallakab8aa8282012-10-04 14:26:21 +05303783 } else if (machine_is_mpq8064_hrd())
3784 platform_device_register(&mpq_hrd_keys_pdev);
Srikanth Uyyala7d4f7212012-10-12 17:45:36 +05303785 if (machine_is_mpq8064_cdp() || machine_is_mpq8064_hrd() ||
3786 machine_is_mpq8064_dtv())
3787 platform_device_register(&msm_dev_avtimer_device);
Sujit Reddy Thummab0d51e72012-12-31 15:37:16 +05303788
3789 if (machine_is_apq8064_cdp() || machine_is_mpq8064_hrd()) {
3790 int ret;
3791 struct pm8xxx_mpp_config_data sata_pwr_cfg = {
3792 .type = PM8XXX_MPP_TYPE_D_OUTPUT,
3793 .level = PM8921_MPP_DIG_LEVEL_VPH,
3794 .control = PM8XXX_MPP_DOUT_CTRL_HIGH,
3795 };
3796
3797 /* Apply MPP-4 init only when it is used to control SATA PWR */
3798 ret = pm8xxx_mpp_config(PM8921_MPP_PM_TO_SYS(4), &sata_pwr_cfg);
3799 if (ret)
3800 pr_err("%s: pm8921 MPP %d init config failed(%d)\n",
3801 __func__, PM8921_MPP_PM_TO_SYS(4), ret);
3802 platform_device_register(&apq8064_device_ext_3p3v_mpp4_vreg);
3803 platform_device_register(&apq8064_device_sata);
3804 }
Joel King82b7e3f2012-01-05 10:03:27 -08003805}
3806
Rohit Vaswani4375c802013-01-09 13:38:19 -08003807static void __init fsm8064_ep_init(void)
3808{
3809 if (meminfo_init(SYS_MEMORY, SZ_256M) < 0)
3810 pr_err("meminfo_init() failed!\n");
3811
Rohit Vaswanie2579ad2013-04-04 17:23:05 -07003812 msm_thermal_pdata.limit_temp_degC = 80;
3813
Rohit Vaswani4375c802013-01-09 13:38:19 -08003814 apq8064_common_init();
3815 ethernet_init();
Rohit Vaswani4375c802013-01-09 13:38:19 -08003816 fsm8064_ep_pcie_init();
3817 platform_add_devices(ep_devices, ARRAY_SIZE(ep_devices));
3818 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
3819 apq8064_init_gpu();
Rohit Vaswani4375c802013-01-09 13:38:19 -08003820 platform_device_register(&cdp_kp_pdev);
3821#ifdef CONFIG_MSM_CAMERA
3822 apq8064_init_cam();
3823#endif
Rohit Vaswani4375c802013-01-09 13:38:19 -08003824}
3825
Joel King82b7e3f2012-01-05 10:03:27 -08003826MACHINE_START(APQ8064_CDP, "QCT APQ8064 CDP")
3827 .map_io = apq8064_map_io,
3828 .reserve = apq8064_reserve,
3829 .init_irq = apq8064_init_irq,
3830 .handle_irq = gic_handle_irq,
3831 .timer = &msm_timer,
3832 .init_machine = apq8064_cdp_init,
Ravishangar Kalyanamc2fee312012-02-09 19:11:22 -08003833 .init_early = apq8064_allocate_memory_regions,
Laura Abbott6988cef2012-03-15 14:27:13 -07003834 .init_very_early = apq8064_early_reserve,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07003835 .restart = msm_restart,
Syed Rameez Mustafa9de46342012-11-30 11:00:08 -08003836 .smp = &msm8960_smp_ops,
Joel King82b7e3f2012-01-05 10:03:27 -08003837MACHINE_END
3838
Rohit Vaswani4375c802013-01-09 13:38:19 -08003839MACHINE_START(FSM8064_EP, "QCT FSM8064 EP")
3840 .map_io = apq8064_map_io,
3841 .reserve = apq8064_reserve,
3842 .init_irq = apq8064_init_irq,
3843 .handle_irq = gic_handle_irq,
3844 .timer = &msm_timer,
3845 .init_machine = fsm8064_ep_init,
3846 .init_early = apq8064_allocate_memory_regions,
3847 .init_very_early = apq8064_early_reserve,
3848 .restart = msm_restart,
Rohit Vaswanie836b132013-03-05 14:59:48 -08003849 .smp = &msm8960_smp_ops,
Rohit Vaswani4375c802013-01-09 13:38:19 -08003850MACHINE_END
3851
Joel King82b7e3f2012-01-05 10:03:27 -08003852MACHINE_START(APQ8064_MTP, "QCT APQ8064 MTP")
3853 .map_io = apq8064_map_io,
3854 .reserve = apq8064_reserve,
3855 .init_irq = apq8064_init_irq,
3856 .handle_irq = gic_handle_irq,
3857 .timer = &msm_timer,
3858 .init_machine = apq8064_cdp_init,
Ravishangar Kalyanamc2fee312012-02-09 19:11:22 -08003859 .init_early = apq8064_allocate_memory_regions,
Laura Abbott6988cef2012-03-15 14:27:13 -07003860 .init_very_early = apq8064_early_reserve,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07003861 .restart = msm_restart,
Syed Rameez Mustafa9de46342012-11-30 11:00:08 -08003862 .smp = &msm8960_smp_ops,
Joel King82b7e3f2012-01-05 10:03:27 -08003863MACHINE_END
3864
3865MACHINE_START(APQ8064_LIQUID, "QCT APQ8064 LIQUID")
3866 .map_io = apq8064_map_io,
3867 .reserve = apq8064_reserve,
3868 .init_irq = apq8064_init_irq,
3869 .handle_irq = gic_handle_irq,
3870 .timer = &msm_timer,
3871 .init_machine = apq8064_cdp_init,
Ravishangar Kalyanamc2fee312012-02-09 19:11:22 -08003872 .init_early = apq8064_allocate_memory_regions,
Laura Abbott6988cef2012-03-15 14:27:13 -07003873 .init_very_early = apq8064_early_reserve,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07003874 .restart = msm_restart,
Syed Rameez Mustafa9de46342012-11-30 11:00:08 -08003875 .smp = &msm8960_smp_ops,
Joel King82b7e3f2012-01-05 10:03:27 -08003876MACHINE_END
3877
Joel King064bbf82012-04-01 13:23:39 -07003878MACHINE_START(MPQ8064_CDP, "QCT MPQ8064 CDP")
3879 .map_io = apq8064_map_io,
3880 .reserve = apq8064_reserve,
3881 .init_irq = apq8064_init_irq,
3882 .handle_irq = gic_handle_irq,
3883 .timer = &msm_timer,
3884 .init_machine = apq8064_cdp_init,
3885 .init_early = apq8064_allocate_memory_regions,
3886 .init_very_early = apq8064_early_reserve,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07003887 .restart = msm_restart,
Syed Rameez Mustafa9de46342012-11-30 11:00:08 -08003888 .smp = &msm8960_smp_ops,
Joel King064bbf82012-04-01 13:23:39 -07003889MACHINE_END
3890
Joel King11ca8202012-02-13 16:19:03 -08003891MACHINE_START(MPQ8064_HRD, "QCT MPQ8064 HRD")
3892 .map_io = apq8064_map_io,
3893 .reserve = apq8064_reserve,
3894 .init_irq = apq8064_init_irq,
3895 .handle_irq = gic_handle_irq,
3896 .timer = &msm_timer,
3897 .init_machine = apq8064_cdp_init,
Joel King3a57e772012-05-28 11:22:55 -07003898 .init_early = apq8064_allocate_memory_regions,
Laura Abbott6988cef2012-03-15 14:27:13 -07003899 .init_very_early = apq8064_early_reserve,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07003900 .restart = msm_restart,
Syed Rameez Mustafa9de46342012-11-30 11:00:08 -08003901 .smp = &msm8960_smp_ops,
Joel King11ca8202012-02-13 16:19:03 -08003902MACHINE_END
3903
3904MACHINE_START(MPQ8064_DTV, "QCT MPQ8064 DTV")
3905 .map_io = apq8064_map_io,
3906 .reserve = apq8064_reserve,
3907 .init_irq = apq8064_init_irq,
3908 .handle_irq = gic_handle_irq,
3909 .timer = &msm_timer,
3910 .init_machine = apq8064_cdp_init,
Joel King3a57e772012-05-28 11:22:55 -07003911 .init_early = apq8064_allocate_memory_regions,
Laura Abbott6988cef2012-03-15 14:27:13 -07003912 .init_very_early = apq8064_early_reserve,
Jeff Ohlsteindd0dd9b2012-05-29 17:47:21 -07003913 .restart = msm_restart,
Syed Rameez Mustafa9de46342012-11-30 11:00:08 -08003914 .smp = &msm8960_smp_ops,
Joel King11ca8202012-02-13 16:19:03 -08003915MACHINE_END