PageRenderTime 72ms CodeModel.GetById 31ms RepoModel.GetById 0ms app.codeStats 1ms

/arch/arm/mach-msm/board-8064.c

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