devices-msm7x27a.c 51 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201
  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. #include <linux/kernel.h>
  13. #include <linux/platform_device.h>
  14. #include <linux/dma-mapping.h>
  15. #include <mach/kgsl.h>
  16. #include <linux/regulator/machine.h>
  17. #include <linux/init.h>
  18. #include <linux/irq.h>
  19. #include <linux/notifier.h>
  20. #include <mach/irqs.h>
  21. #include <mach/msm_iomap.h>
  22. #include <mach/board.h>
  23. #include <mach/dma.h>
  24. #include <mach/dal_axi.h>
  25. #include <asm/mach/flash.h>
  26. #include <asm/hardware/gic.h>
  27. #include <asm/hardware/cache-l2x0.h>
  28. #include <asm/mach/mmc.h>
  29. #include <asm/cacheflush.h>
  30. #include <mach/rpc_hsusb.h>
  31. #include <mach/socinfo.h>
  32. #include <mach/clk-provider.h>
  33. #include "devices.h"
  34. #include "devices-msm7x2xa.h"
  35. #include "footswitch.h"
  36. #include "acpuclock.h"
  37. #include "acpuclock-8625q.h"
  38. #include "spm.h"
  39. #include "mpm-8625.h"
  40. #include "irq.h"
  41. #include "pm.h"
  42. #include "msm_cpr.h"
  43. #include "msm_smem_iface.h"
  44. /* Address of GSBI blocks */
  45. #define MSM_GSBI0_PHYS 0xA1200000
  46. #define MSM_GSBI1_PHYS 0xA1300000
  47. /* GSBI QUPe devices */
  48. #define MSM_GSBI0_QUP_PHYS (MSM_GSBI0_PHYS + 0x80000)
  49. #define MSM_GSBI1_QUP_PHYS (MSM_GSBI1_PHYS + 0x80000)
  50. #define A11S_TEST_BUS_SEL_ADDR (MSM_CSR_BASE + 0x518)
  51. #define RBCPR_CLK_MUX_SEL (1 << 13)
  52. /* Reset Address of RBCPR (Active Low)*/
  53. #define RBCPR_SW_RESET_N (MSM_CSR_BASE + 0x64)
  54. static struct resource gsbi0_qup_i2c_resources[] = {
  55. {
  56. .name = "qup_phys_addr",
  57. .start = MSM_GSBI0_QUP_PHYS,
  58. .end = MSM_GSBI0_QUP_PHYS + SZ_4K - 1,
  59. .flags = IORESOURCE_MEM,
  60. },
  61. {
  62. .name = "gsbi_qup_i2c_addr",
  63. .start = MSM_GSBI0_PHYS,
  64. .end = MSM_GSBI0_PHYS + SZ_4K - 1,
  65. .flags = IORESOURCE_MEM,
  66. },
  67. {
  68. .name = "qup_err_intr",
  69. .start = INT_PWB_I2C,
  70. .end = INT_PWB_I2C,
  71. .flags = IORESOURCE_IRQ,
  72. },
  73. };
  74. /* Use GSBI0 QUP for /dev/i2c-0 */
  75. struct platform_device msm_gsbi0_qup_i2c_device = {
  76. .name = "qup_i2c",
  77. .id = MSM_GSBI0_QUP_I2C_BUS_ID,
  78. .num_resources = ARRAY_SIZE(gsbi0_qup_i2c_resources),
  79. .resource = gsbi0_qup_i2c_resources,
  80. };
  81. static struct resource gsbi1_qup_i2c_resources[] = {
  82. {
  83. .name = "qup_phys_addr",
  84. .start = MSM_GSBI1_QUP_PHYS,
  85. .end = MSM_GSBI1_QUP_PHYS + SZ_4K - 1,
  86. .flags = IORESOURCE_MEM,
  87. },
  88. {
  89. .name = "gsbi_qup_i2c_addr",
  90. .start = MSM_GSBI1_PHYS,
  91. .end = MSM_GSBI1_PHYS + SZ_4K - 1,
  92. .flags = IORESOURCE_MEM,
  93. },
  94. {
  95. .name = "qup_err_intr",
  96. .start = INT_ARM11_DMA,
  97. .end = INT_ARM11_DMA,
  98. .flags = IORESOURCE_IRQ,
  99. },
  100. };
  101. /* Use GSBI1 QUP for /dev/i2c-1 */
  102. struct platform_device msm_gsbi1_qup_i2c_device = {
  103. .name = "qup_i2c",
  104. .id = MSM_GSBI1_QUP_I2C_BUS_ID,
  105. .num_resources = ARRAY_SIZE(gsbi1_qup_i2c_resources),
  106. .resource = gsbi1_qup_i2c_resources,
  107. };
  108. #define MSM_HSUSB_PHYS 0xA0800000
  109. static struct resource resources_hsusb_otg[] = {
  110. {
  111. .start = MSM_HSUSB_PHYS,
  112. .end = MSM_HSUSB_PHYS + SZ_1K - 1,
  113. .flags = IORESOURCE_MEM,
  114. },
  115. {
  116. .start = INT_USB_HS,
  117. .end = INT_USB_HS,
  118. .flags = IORESOURCE_IRQ,
  119. },
  120. };
  121. static u64 dma_mask = 0xffffffffULL;
  122. struct platform_device msm_device_otg = {
  123. .name = "msm_otg",
  124. .id = -1,
  125. .num_resources = ARRAY_SIZE(resources_hsusb_otg),
  126. .resource = resources_hsusb_otg,
  127. .dev = {
  128. .dma_mask = &dma_mask,
  129. .coherent_dma_mask = 0xffffffffULL,
  130. },
  131. };
  132. static struct resource resources_gadget_peripheral[] = {
  133. {
  134. .start = MSM_HSUSB_PHYS,
  135. .end = MSM_HSUSB_PHYS + SZ_1K - 1,
  136. .flags = IORESOURCE_MEM,
  137. },
  138. {
  139. .start = INT_USB_HS,
  140. .end = INT_USB_HS,
  141. .flags = IORESOURCE_IRQ,
  142. },
  143. };
  144. struct platform_device msm_device_gadget_peripheral = {
  145. .name = "msm_hsusb",
  146. .id = -1,
  147. .num_resources = ARRAY_SIZE(resources_gadget_peripheral),
  148. .resource = resources_gadget_peripheral,
  149. .dev = {
  150. .dma_mask = &dma_mask,
  151. .coherent_dma_mask = 0xffffffffULL,
  152. },
  153. };
  154. static struct resource resources_hsusb_host[] = {
  155. {
  156. .start = MSM_HSUSB_PHYS,
  157. .end = MSM_HSUSB_PHYS + SZ_1K - 1,
  158. .flags = IORESOURCE_MEM,
  159. },
  160. {
  161. .start = INT_USB_HS,
  162. .end = INT_USB_HS,
  163. .flags = IORESOURCE_IRQ,
  164. },
  165. };
  166. struct platform_device msm_device_hsusb_host = {
  167. .name = "msm_hsusb_host",
  168. .id = 0,
  169. .num_resources = ARRAY_SIZE(resources_hsusb_host),
  170. .resource = resources_hsusb_host,
  171. .dev = {
  172. .dma_mask = &dma_mask,
  173. .coherent_dma_mask = 0xffffffffULL,
  174. },
  175. };
  176. static struct platform_device *msm_host_devices[] = {
  177. &msm_device_hsusb_host,
  178. };
  179. static struct resource msm_dmov_resource[] = {
  180. {
  181. .start = INT_ADM_AARM,
  182. .flags = IORESOURCE_IRQ,
  183. },
  184. {
  185. .start = 0xA9700000,
  186. .end = 0xA9700000 + SZ_4K - 1,
  187. .flags = IORESOURCE_MEM,
  188. },
  189. };
  190. static struct msm_dmov_pdata msm_dmov_pdata = {
  191. .sd = 3,
  192. .sd_size = 0x400,
  193. };
  194. struct platform_device msm_device_dmov = {
  195. .name = "msm_dmov",
  196. .id = -1,
  197. .resource = msm_dmov_resource,
  198. .num_resources = ARRAY_SIZE(msm_dmov_resource),
  199. .dev = {
  200. .platform_data = &msm_dmov_pdata,
  201. },
  202. };
  203. static struct acpuclk_pdata msm7x27a_acpuclk_pdata = {
  204. .max_speed_delta_khz = 400000,
  205. };
  206. struct platform_device msm7x27a_device_acpuclk = {
  207. .name = "acpuclk-7627",
  208. .id = -1,
  209. .dev.platform_data = &msm7x27a_acpuclk_pdata,
  210. };
  211. static struct acpuclk_pdata msm7x27aa_acpuclk_pdata = {
  212. .max_speed_delta_khz = 504000,
  213. };
  214. struct platform_device msm7x27aa_device_acpuclk = {
  215. .name = "acpuclk-7627",
  216. .id = -1,
  217. .dev.platform_data = &msm7x27aa_acpuclk_pdata,
  218. };
  219. static struct acpuclk_pdata msm8625q_pdata = {
  220. .max_speed_delta_khz = 801600,
  221. };
  222. static struct acpuclk_pdata_8625q msm8625q_acpuclk_pdata = {
  223. .acpu_clk_data = &msm8625q_pdata,
  224. .pvs_voltage_uv = 1350000,
  225. };
  226. struct platform_device msm8625q_device_acpuclk = {
  227. .name = "acpuclock-8625q",
  228. .id = -1,
  229. .dev.platform_data = &msm8625q_acpuclk_pdata,
  230. };
  231. static struct acpuclk_pdata msm8625_acpuclk_pdata = {
  232. /* TODO: Need to update speed delta from H/w Team */
  233. .max_speed_delta_khz = 604800,
  234. };
  235. static struct acpuclk_pdata msm8625ab_acpuclk_pdata = {
  236. .max_speed_delta_khz = 801600,
  237. };
  238. struct platform_device msm8625_device_acpuclk = {
  239. .name = "acpuclk-7627",
  240. .id = -1,
  241. .dev.platform_data = &msm8625_acpuclk_pdata,
  242. };
  243. struct platform_device msm8625ab_device_acpuclk = {
  244. .name = "acpuclk-7627",
  245. .id = -1,
  246. .dev.platform_data = &msm8625ab_acpuclk_pdata,
  247. };
  248. struct platform_device msm_device_smd = {
  249. .name = "msm_smd",
  250. .id = -1,
  251. };
  252. static struct resource smd_8625_resource[] = {
  253. {
  254. .name = "a9_m2a_0",
  255. .start = MSM8625_INT_A9_M2A_0,
  256. .flags = IORESOURCE_IRQ,
  257. },
  258. {
  259. .name = "a9_m2a_5",
  260. .start = MSM8625_INT_A9_M2A_5,
  261. .flags = IORESOURCE_IRQ,
  262. },
  263. };
  264. static struct smd_subsystem_config smd_8625_config_list[] = {
  265. {
  266. .irq_config_id = SMD_MODEM,
  267. .subsys_name = "modem",
  268. .edge = SMD_APPS_MODEM,
  269. .smd_int.irq_name = "a9_m2a_0",
  270. .smd_int.flags = IRQF_TRIGGER_RISING,
  271. .smd_int.irq_id = -1,
  272. .smd_int.device_name = "smd_dev",
  273. .smd_int.dev_id = 0,
  274. .smd_int.out_bit_pos = 1,
  275. .smd_int.out_base = (void __iomem *)MSM_CSR_BASE,
  276. .smd_int.out_offset = 0x400 + (0) * 4,
  277. .smsm_int.irq_name = "a9_m2a_5",
  278. .smsm_int.flags = IRQF_TRIGGER_RISING,
  279. .smsm_int.irq_id = -1,
  280. .smsm_int.device_name = "smsm_dev",
  281. .smsm_int.dev_id = 0,
  282. .smsm_int.out_bit_pos = 1,
  283. .smsm_int.out_base = (void __iomem *)MSM_CSR_BASE,
  284. .smsm_int.out_offset = 0x400 + (5) * 4,
  285. }
  286. };
  287. static struct smd_platform smd_8625_platform_data = {
  288. .num_ss_configs = ARRAY_SIZE(smd_8625_config_list),
  289. .smd_ss_configs = smd_8625_config_list,
  290. };
  291. struct platform_device msm8625_device_smd = {
  292. .name = "msm_smd",
  293. .id = -1,
  294. .resource = smd_8625_resource,
  295. .num_resources = ARRAY_SIZE(smd_8625_resource),
  296. .dev = {
  297. .platform_data = &smd_8625_platform_data,
  298. }
  299. };
  300. static struct resource resources_adsp[] = {
  301. {
  302. .start = INT_ADSP_A9_A11,
  303. .end = INT_ADSP_A9_A11,
  304. .flags = IORESOURCE_IRQ,
  305. },
  306. };
  307. struct platform_device msm_adsp_device = {
  308. .name = "msm_adsp",
  309. .id = -1,
  310. .num_resources = ARRAY_SIZE(resources_adsp),
  311. .resource = resources_adsp,
  312. };
  313. static struct resource resources_uart1[] = {
  314. {
  315. .start = INT_UART1,
  316. .end = INT_UART1,
  317. .flags = IORESOURCE_IRQ,
  318. },
  319. {
  320. .start = MSM7XXX_UART1_PHYS,
  321. .end = MSM7XXX_UART1_PHYS + MSM7XXX_UART1_SIZE - 1,
  322. .flags = IORESOURCE_MEM,
  323. },
  324. };
  325. struct platform_device msm_device_uart1 = {
  326. .name = "msm_serial",
  327. .id = 0,
  328. .num_resources = ARRAY_SIZE(resources_uart1),
  329. .resource = resources_uart1,
  330. };
  331. #define MSM_UART1DM_PHYS 0xA0200000
  332. static struct resource msm_uart1_dm_resources[] = {
  333. {
  334. .start = MSM_UART1DM_PHYS,
  335. .end = MSM_UART1DM_PHYS + PAGE_SIZE - 1,
  336. .flags = IORESOURCE_MEM,
  337. },
  338. {
  339. .start = INT_UART1DM_IRQ,
  340. .end = INT_UART1DM_IRQ,
  341. .flags = IORESOURCE_IRQ,
  342. },
  343. {
  344. .start = INT_UART1DM_RX,
  345. .end = INT_UART1DM_RX,
  346. .flags = IORESOURCE_IRQ,
  347. },
  348. {
  349. .start = DMOV_HSUART1_TX_CHAN,
  350. .end = DMOV_HSUART1_RX_CHAN,
  351. .name = "uartdm_channels",
  352. .flags = IORESOURCE_DMA,
  353. },
  354. {
  355. .start = DMOV_HSUART1_TX_CRCI,
  356. .end = DMOV_HSUART1_RX_CRCI,
  357. .name = "uartdm_crci",
  358. .flags = IORESOURCE_DMA,
  359. },
  360. };
  361. static u64 msm_uart_dm1_dma_mask = DMA_BIT_MASK(32);
  362. struct platform_device msm_device_uart_dm1 = {
  363. .name = "msm_serial_hs",
  364. .id = 0,
  365. .num_resources = ARRAY_SIZE(msm_uart1_dm_resources),
  366. .resource = msm_uart1_dm_resources,
  367. .dev = {
  368. .dma_mask = &msm_uart_dm1_dma_mask,
  369. .coherent_dma_mask = DMA_BIT_MASK(32),
  370. },
  371. };
  372. #define MSM_UART2DM_PHYS 0xA0300000
  373. static struct resource msm_uart2dm_resources[] = {
  374. {
  375. .start = MSM_UART2DM_PHYS,
  376. .end = MSM_UART2DM_PHYS + PAGE_SIZE - 1,
  377. .name = "uartdm_resource",
  378. .flags = IORESOURCE_MEM,
  379. },
  380. {
  381. .start = INT_UART2DM_IRQ,
  382. .end = INT_UART2DM_IRQ,
  383. .flags = IORESOURCE_IRQ,
  384. },
  385. };
  386. struct platform_device msm_device_uart_dm2 = {
  387. .name = "msm_serial_hsl",
  388. .id = 0,
  389. .num_resources = ARRAY_SIZE(msm_uart2dm_resources),
  390. .resource = msm_uart2dm_resources,
  391. };
  392. #define MSM_NAND_PHYS 0xA0A00000
  393. #define MSM_NANDC01_PHYS 0xA0A40000
  394. #define MSM_NANDC10_PHYS 0xA0A80000
  395. #define MSM_NANDC11_PHYS 0xA0AC0000
  396. #define EBI2_REG_BASE 0xA0D00000
  397. static struct resource resources_nand[] = {
  398. [0] = {
  399. .name = "msm_nand_dmac",
  400. .start = DMOV_NAND_CHAN,
  401. .end = DMOV_NAND_CHAN,
  402. .flags = IORESOURCE_DMA,
  403. },
  404. [1] = {
  405. .name = "msm_nand_phys",
  406. .start = MSM_NAND_PHYS,
  407. .end = MSM_NAND_PHYS + 0x7FF,
  408. .flags = IORESOURCE_MEM,
  409. },
  410. [2] = {
  411. .name = "msm_nandc01_phys",
  412. .start = MSM_NANDC01_PHYS,
  413. .end = MSM_NANDC01_PHYS + 0x7FF,
  414. .flags = IORESOURCE_MEM,
  415. },
  416. [3] = {
  417. .name = "msm_nandc10_phys",
  418. .start = MSM_NANDC10_PHYS,
  419. .end = MSM_NANDC10_PHYS + 0x7FF,
  420. .flags = IORESOURCE_MEM,
  421. },
  422. [4] = {
  423. .name = "msm_nandc11_phys",
  424. .start = MSM_NANDC11_PHYS,
  425. .end = MSM_NANDC11_PHYS + 0x7FF,
  426. .flags = IORESOURCE_MEM,
  427. },
  428. [5] = {
  429. .name = "ebi2_reg_base",
  430. .start = EBI2_REG_BASE,
  431. .end = EBI2_REG_BASE + 0x60,
  432. .flags = IORESOURCE_MEM,
  433. },
  434. };
  435. struct flash_platform_data msm_nand_data = {
  436. .version = VERSION_2,
  437. };
  438. struct platform_device msm_device_nand = {
  439. .name = "msm_nand",
  440. .id = -1,
  441. .num_resources = ARRAY_SIZE(resources_nand),
  442. .resource = resources_nand,
  443. .dev = {
  444. .platform_data = &msm_nand_data,
  445. },
  446. };
  447. static struct msm_pm_irq_calls msm7x27a_pm_irq_calls = {
  448. .irq_pending = msm_irq_pending,
  449. .idle_sleep_allowed = msm_irq_idle_sleep_allowed,
  450. .enter_sleep1 = msm_irq_enter_sleep1,
  451. .enter_sleep2 = msm_irq_enter_sleep2,
  452. .exit_sleep1 = msm_irq_exit_sleep1,
  453. .exit_sleep2 = msm_irq_exit_sleep2,
  454. .exit_sleep3 = msm_irq_exit_sleep3,
  455. };
  456. static struct msm_pm_irq_calls msm8625_pm_irq_calls = {
  457. .irq_pending = msm_gic_spi_ppi_pending,
  458. .idle_sleep_allowed = msm_gic_irq_idle_sleep_allowed,
  459. .enter_sleep1 = msm_gic_irq_enter_sleep1,
  460. .enter_sleep2 = msm_gic_irq_enter_sleep2,
  461. .exit_sleep1 = msm_gic_irq_exit_sleep1,
  462. .exit_sleep2 = msm_gic_irq_exit_sleep2,
  463. .exit_sleep3 = msm_gic_irq_exit_sleep3,
  464. };
  465. void msm_clk_dump_debug_info(void)
  466. {
  467. pr_info("%s: GLBL_CLK_ENA: 0x%08X\n", __func__,
  468. readl_relaxed(MSM_CLK_CTL_BASE + 0x0));
  469. pr_info("%s: GLBL_CLK_STATE: 0x%08X\n", __func__,
  470. readl_relaxed(MSM_CLK_CTL_BASE + 0x4));
  471. pr_info("%s: GRP_NS_REG: 0x%08X\n", __func__,
  472. readl_relaxed(MSM_CLK_CTL_BASE + 0x84));
  473. pr_info("%s: CLK_HALT_STATEB: 0x%08X\n", __func__,
  474. readl_relaxed(MSM_CLK_CTL_BASE + 0x10C));
  475. }
  476. void __init msm_pm_register_irqs(void)
  477. {
  478. if (cpu_is_msm8625() || cpu_is_msm8625q())
  479. msm_pm_set_irq_extns(&msm8625_pm_irq_calls);
  480. else
  481. msm_pm_set_irq_extns(&msm7x27a_pm_irq_calls);
  482. }
  483. static struct msm_pm_cpr_ops msm8625_pm_cpr_ops = {
  484. .cpr_suspend = msm_cpr_pm_suspend,
  485. .cpr_resume = msm_cpr_pm_resume,
  486. };
  487. void __init msm_pm_register_cpr_ops(void)
  488. {
  489. /* CPR presents on revision >= v2.0 chipsets */
  490. if ((cpu_is_msm8625() &&
  491. SOCINFO_VERSION_MAJOR(socinfo_get_version()) >= 2)
  492. || cpu_is_msm8625q())
  493. msm_pm_set_cpr_ops(&msm8625_pm_cpr_ops);
  494. }
  495. #define MSM_SDC1_BASE 0xA0400000
  496. #define MSM_SDC2_BASE 0xA0500000
  497. #define MSM_SDC3_BASE 0xA0600000
  498. #define MSM_SDC4_BASE 0xA0700000
  499. static struct resource resources_sdc1[] = {
  500. {
  501. .name = "core_mem",
  502. .start = MSM_SDC1_BASE,
  503. .end = MSM_SDC1_BASE + SZ_4K - 1,
  504. .flags = IORESOURCE_MEM,
  505. },
  506. {
  507. .name = "core_irq",
  508. .start = INT_SDC1_0,
  509. .end = INT_SDC1_1,
  510. .flags = IORESOURCE_IRQ,
  511. },
  512. {
  513. .name = "dma_chnl",
  514. .start = DMOV_SDC1_CHAN,
  515. .end = DMOV_SDC1_CHAN,
  516. .flags = IORESOURCE_DMA,
  517. },
  518. {
  519. .name = "dma_crci",
  520. .start = DMOV_SDC1_CRCI,
  521. .end = DMOV_SDC1_CRCI,
  522. .flags = IORESOURCE_DMA,
  523. }
  524. };
  525. static struct resource resources_sdc2[] = {
  526. {
  527. .name = "core_mem",
  528. .start = MSM_SDC2_BASE,
  529. .end = MSM_SDC2_BASE + SZ_4K - 1,
  530. .flags = IORESOURCE_MEM,
  531. },
  532. {
  533. .name = "core_irq",
  534. .start = INT_SDC2_0,
  535. .end = INT_SDC2_1,
  536. .flags = IORESOURCE_IRQ,
  537. },
  538. {
  539. .name = "dma_chnl",
  540. .start = DMOV_SDC2_CHAN,
  541. .end = DMOV_SDC2_CHAN,
  542. .flags = IORESOURCE_DMA,
  543. },
  544. {
  545. .name = "dma_crci",
  546. .start = DMOV_SDC2_CRCI,
  547. .end = DMOV_SDC2_CRCI,
  548. .flags = IORESOURCE_DMA,
  549. }
  550. };
  551. static struct resource resources_sdc3[] = {
  552. {
  553. .name = "core_mem",
  554. .start = MSM_SDC3_BASE,
  555. .end = MSM_SDC3_BASE + SZ_4K - 1,
  556. .flags = IORESOURCE_MEM,
  557. },
  558. {
  559. .name = "core_irq",
  560. .start = INT_SDC3_0,
  561. .end = INT_SDC3_1,
  562. .flags = IORESOURCE_IRQ,
  563. },
  564. {
  565. .name = "dma_chnl",
  566. .start = DMOV_NAND_CHAN,
  567. .end = DMOV_NAND_CHAN,
  568. .flags = IORESOURCE_DMA,
  569. },
  570. {
  571. .name = "dma_crci",
  572. .start = DMOV_SDC3_CRCI,
  573. .end = DMOV_SDC3_CRCI,
  574. .flags = IORESOURCE_DMA,
  575. },
  576. };
  577. static struct resource resources_sdc4[] = {
  578. {
  579. .name = "core_mem",
  580. .start = MSM_SDC4_BASE,
  581. .end = MSM_SDC4_BASE + SZ_4K - 1,
  582. .flags = IORESOURCE_MEM,
  583. },
  584. {
  585. .name = "core_irq",
  586. .start = INT_SDC4_0,
  587. .end = INT_SDC4_1,
  588. .flags = IORESOURCE_IRQ,
  589. },
  590. {
  591. .name = "dma_chnl",
  592. .start = DMOV_SDC4_CHAN,
  593. .end = DMOV_SDC4_CHAN,
  594. .flags = IORESOURCE_DMA,
  595. },
  596. {
  597. .name = "dma_crci",
  598. .start = DMOV_SDC4_CRCI,
  599. .end = DMOV_SDC4_CRCI,
  600. .flags = IORESOURCE_DMA,
  601. },
  602. };
  603. struct platform_device msm_device_sdc1 = {
  604. .name = "msm_sdcc",
  605. .id = 1,
  606. .num_resources = ARRAY_SIZE(resources_sdc1),
  607. .resource = resources_sdc1,
  608. .dev = {
  609. .coherent_dma_mask = 0xffffffff,
  610. },
  611. };
  612. struct platform_device msm_device_sdc2 = {
  613. .name = "msm_sdcc",
  614. .id = 2,
  615. .num_resources = ARRAY_SIZE(resources_sdc2),
  616. .resource = resources_sdc2,
  617. .dev = {
  618. .coherent_dma_mask = 0xffffffff,
  619. },
  620. };
  621. struct platform_device msm_device_sdc3 = {
  622. .name = "msm_sdcc",
  623. .id = 3,
  624. .num_resources = ARRAY_SIZE(resources_sdc3),
  625. .resource = resources_sdc3,
  626. .dev = {
  627. .coherent_dma_mask = 0xffffffff,
  628. },
  629. };
  630. struct platform_device msm_device_sdc4 = {
  631. .name = "msm_sdcc",
  632. .id = 4,
  633. .num_resources = ARRAY_SIZE(resources_sdc4),
  634. .resource = resources_sdc4,
  635. .dev = {
  636. .coherent_dma_mask = 0xffffffff,
  637. },
  638. };
  639. static struct platform_device *msm_sdcc_devices[] __initdata = {
  640. &msm_device_sdc1,
  641. &msm_device_sdc2,
  642. &msm_device_sdc3,
  643. &msm_device_sdc4,
  644. };
  645. #ifdef CONFIG_MSM_CAMERA_V4L2
  646. static int apps_reset;
  647. static struct resource msm_csic0_resources[] = {
  648. {
  649. .name = "csic",
  650. .start = 0xA0F00000,
  651. .end = 0xA0F00000 + 0x00100000 - 1,
  652. .flags = IORESOURCE_MEM,
  653. },
  654. {
  655. .name = "csic",
  656. .start = INT_CSI_IRQ_0,
  657. .end = INT_CSI_IRQ_0,
  658. .flags = IORESOURCE_IRQ,
  659. },
  660. };
  661. static struct resource msm_csic1_resources[] = {
  662. {
  663. .name = "csic",
  664. .start = 0xA1000000,
  665. .end = 0xA1000000 + 0x00100000 - 1,
  666. .flags = IORESOURCE_MEM,
  667. },
  668. {
  669. .name = "csic",
  670. .start = INT_CSI_IRQ_1,
  671. .end = INT_CSI_IRQ_1,
  672. .flags = IORESOURCE_IRQ,
  673. },
  674. };
  675. struct platform_device msm7x27a_device_csic0 = {
  676. .name = "msm_csic",
  677. .id = 0,
  678. .resource = msm_csic0_resources,
  679. .num_resources = ARRAY_SIZE(msm_csic0_resources),
  680. };
  681. struct platform_device msm7x27a_device_csic1 = {
  682. .name = "msm_csic",
  683. .id = 1,
  684. .resource = msm_csic1_resources,
  685. .num_resources = ARRAY_SIZE(msm_csic1_resources),
  686. };
  687. static struct resource msm_clkctl_resources[] = {
  688. {
  689. .name = "clk_ctl",
  690. .start = MSM7XXX_CLK_CTL_PHYS,
  691. .end = MSM7XXX_CLK_CTL_PHYS + MSM7XXX_CLK_CTL_SIZE - 1,
  692. .flags = IORESOURCE_MEM,
  693. },
  694. };
  695. struct platform_device msm7x27a_device_clkctl = {
  696. .name = "msm_clk_ctl",
  697. .id = 0,
  698. .resource = msm_clkctl_resources,
  699. .num_resources = ARRAY_SIZE(msm_clkctl_resources),
  700. .dev = {
  701. .platform_data = &apps_reset,
  702. },
  703. };
  704. struct platform_device msm7x27a_device_vfe = {
  705. .name = "msm_vfe",
  706. .id = 0,
  707. };
  708. #endif
  709. /* Command sequence for simple WFI */
  710. static uint8_t spm_wfi_cmd_sequence[] __initdata = {
  711. 0x04, 0x03, 0x04, 0x0f,
  712. };
  713. /* Command sequence for GDFS, this won't send any interrupt to the modem */
  714. static uint8_t spm_pc_without_modem[] __initdata = {
  715. 0x20, 0x00, 0x30, 0x10,
  716. 0x03, 0x1e, 0x0e, 0x3e,
  717. 0x4e, 0x4e, 0x4e, 0x4e,
  718. 0x4e, 0x4e, 0x4e, 0x4e,
  719. 0x4e, 0x4e, 0x4e, 0x4e,
  720. 0x4e, 0x4e, 0x4e, 0x4e,
  721. 0x2E, 0x0f,
  722. };
  723. static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = {
  724. [0] = {
  725. .mode = MSM_SPM_MODE_CLOCK_GATING,
  726. .notify_rpm = false,
  727. .cmd = spm_wfi_cmd_sequence,
  728. },
  729. [1] = {
  730. .mode = MSM_SPM_MODE_POWER_COLLAPSE,
  731. .notify_rpm = false,
  732. .cmd = spm_pc_without_modem,
  733. },
  734. [2] = {
  735. .mode = MSM_SPM_MODE_POWER_COLLAPSE,
  736. .notify_rpm = false,
  737. .cmd = spm_pc_without_modem,
  738. },
  739. [3] = {
  740. .mode = MSM_SPM_MODE_POWER_COLLAPSE,
  741. .notify_rpm = false,
  742. .cmd = spm_pc_without_modem,
  743. },
  744. };
  745. static struct msm_spm_platform_data msm_spm_data[] __initdata = {
  746. [0] = {
  747. .reg_base_addr = MSM_SAW0_BASE,
  748. .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x0,
  749. .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
  750. .num_modes = ARRAY_SIZE(msm_spm_seq_list),
  751. .modes = msm_spm_seq_list,
  752. },
  753. [1] = {
  754. .reg_base_addr = MSM_SAW1_BASE,
  755. .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x0,
  756. .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
  757. .num_modes = ARRAY_SIZE(msm_spm_seq_list),
  758. .modes = msm_spm_seq_list,
  759. },
  760. [2] = {
  761. .reg_base_addr = MSM_SAW2_BASE,
  762. .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x0,
  763. .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
  764. .num_modes = ARRAY_SIZE(msm_spm_seq_list),
  765. .modes = msm_spm_seq_list,
  766. },
  767. [3] = {
  768. .reg_base_addr = MSM_SAW3_BASE,
  769. .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x0,
  770. .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
  771. .num_modes = ARRAY_SIZE(msm_spm_seq_list),
  772. .modes = msm_spm_seq_list,
  773. },
  774. };
  775. void __init msm8x25_spm_device_init(void)
  776. {
  777. msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
  778. }
  779. #define MDP_BASE 0xAA200000
  780. #define MIPI_DSI_HW_BASE 0xA1100000
  781. static struct resource msm_mipi_dsi_resources[] = {
  782. {
  783. .name = "mipi_dsi",
  784. .start = MIPI_DSI_HW_BASE,
  785. .end = MIPI_DSI_HW_BASE + 0x000F0000 - 1,
  786. .flags = IORESOURCE_MEM,
  787. },
  788. {
  789. .start = INT_DSI_IRQ,
  790. .end = INT_DSI_IRQ,
  791. .flags = IORESOURCE_IRQ,
  792. },
  793. };
  794. static struct platform_device msm_mipi_dsi_device = {
  795. .name = "mipi_dsi",
  796. .id = 1,
  797. .num_resources = ARRAY_SIZE(msm_mipi_dsi_resources),
  798. .resource = msm_mipi_dsi_resources,
  799. };
  800. static struct resource msm_mdp_resources[] = {
  801. {
  802. .name = "mdp",
  803. .start = MDP_BASE,
  804. .end = MDP_BASE + 0x000F1008 - 1,
  805. .flags = IORESOURCE_MEM,
  806. },
  807. {
  808. .start = INT_MDP,
  809. .end = INT_MDP,
  810. .flags = IORESOURCE_IRQ,
  811. },
  812. };
  813. static struct platform_device msm_mdp_device = {
  814. .name = "mdp",
  815. .id = 0,
  816. .num_resources = ARRAY_SIZE(msm_mdp_resources),
  817. .resource = msm_mdp_resources,
  818. };
  819. struct platform_device msm_lcdc_device = {
  820. .name = "lcdc",
  821. .id = 0,
  822. };
  823. static struct resource kgsl_3d0_resources[] = {
  824. {
  825. .name = KGSL_3D0_REG_MEMORY,
  826. .start = 0xA0000000,
  827. .end = 0xA001ffff,
  828. .flags = IORESOURCE_MEM,
  829. },
  830. {
  831. .name = KGSL_3D0_IRQ,
  832. .start = INT_GRAPHICS,
  833. .end = INT_GRAPHICS,
  834. .flags = IORESOURCE_IRQ,
  835. },
  836. };
  837. static struct kgsl_device_platform_data kgsl_3d0_pdata = {
  838. .pwrlevel = {
  839. {
  840. .gpu_freq = 245760000,
  841. .bus_freq = 200000000,
  842. },
  843. {
  844. .gpu_freq = 192000000,
  845. .bus_freq = 160000000,
  846. },
  847. {
  848. .gpu_freq = 133330000,
  849. .bus_freq = 0,
  850. },
  851. },
  852. .init_level = 0,
  853. .num_levels = 3,
  854. .set_grp_async = set_grp_xbar_async,
  855. .idle_timeout = HZ,
  856. .strtstp_sleepwake = true,
  857. .clk_map = KGSL_CLK_CORE | KGSL_CLK_IFACE | KGSL_CLK_MEM,
  858. };
  859. struct platform_device msm_kgsl_3d0 = {
  860. .name = "kgsl-3d0",
  861. .id = 0,
  862. .num_resources = ARRAY_SIZE(kgsl_3d0_resources),
  863. .resource = kgsl_3d0_resources,
  864. .dev = {
  865. .platform_data = &kgsl_3d0_pdata,
  866. },
  867. };
  868. void __init msm7x25a_kgsl_3d0_init(void)
  869. {
  870. if (cpu_is_msm7x25a() || cpu_is_msm7x25aa() || cpu_is_msm7x25ab()) {
  871. kgsl_3d0_pdata.num_levels = 2;
  872. kgsl_3d0_pdata.pwrlevel[0].gpu_freq = 133330000;
  873. kgsl_3d0_pdata.pwrlevel[0].bus_freq = 160000000;
  874. kgsl_3d0_pdata.pwrlevel[1].gpu_freq = 96000000;
  875. kgsl_3d0_pdata.pwrlevel[1].bus_freq = 0;
  876. }
  877. }
  878. void __init msm8x25_kgsl_3d0_init(void)
  879. {
  880. if (cpu_is_msm8625() || cpu_is_msm8625q()) {
  881. kgsl_3d0_pdata.idle_timeout = HZ/5;
  882. kgsl_3d0_pdata.strtstp_sleepwake = false;
  883. if (SOCINFO_VERSION_MAJOR(socinfo_get_version()) >= 2)
  884. /* 8x25 v2.0 & above supports a higher GPU frequency */
  885. kgsl_3d0_pdata.pwrlevel[0].gpu_freq = 320000000;
  886. else
  887. kgsl_3d0_pdata.pwrlevel[0].gpu_freq = 300000000;
  888. kgsl_3d0_pdata.pwrlevel[0].bus_freq = 200000000;
  889. }
  890. }
  891. static void __init msm_register_device(struct platform_device *pdev, void *data)
  892. {
  893. int ret;
  894. pdev->dev.platform_data = data;
  895. ret = platform_device_register(pdev);
  896. if (ret)
  897. dev_err(&pdev->dev,
  898. "%s: platform_device_register() failed = %d\n",
  899. __func__, ret);
  900. }
  901. #define PERPH_WEB_BLOCK_ADDR (0xA9D00040)
  902. #define PDM0_CTL_OFFSET (0x04)
  903. #define SIZE_8B (0x08)
  904. static struct resource resources_led[] = {
  905. {
  906. .start = PERPH_WEB_BLOCK_ADDR,
  907. .end = PERPH_WEB_BLOCK_ADDR + (SIZE_8B) - 1,
  908. .name = "led-gpio-pdm",
  909. .flags = IORESOURCE_MEM,
  910. },
  911. };
  912. static struct led_info msm_kpbl_pdm_led_pdata = {
  913. .name = "keyboard-backlight",
  914. };
  915. struct platform_device led_pdev = {
  916. .name = "leds-msm-pdm",
  917. /* use pdev id to represent pdm id */
  918. .id = 0,
  919. .num_resources = ARRAY_SIZE(resources_led),
  920. .resource = resources_led,
  921. .dev = {
  922. .platform_data = &msm_kpbl_pdm_led_pdata,
  923. },
  924. };
  925. struct platform_device asoc_msm_pcm = {
  926. .name = "msm-dsp-audio",
  927. .id = 0,
  928. };
  929. struct platform_device asoc_msm_dai0 = {
  930. .name = "msm-codec-dai",
  931. .id = 0,
  932. };
  933. struct platform_device asoc_msm_dai1 = {
  934. .name = "msm-cpu-dai",
  935. .id = 0,
  936. };
  937. static struct resource gpio_resources[] = {
  938. {
  939. .start = INT_GPIO_GROUP1,
  940. .flags = IORESOURCE_IRQ,
  941. },
  942. {
  943. .start = INT_GPIO_GROUP2,
  944. .flags = IORESOURCE_IRQ,
  945. },
  946. };
  947. static struct platform_device msm_device_gpio = {
  948. .name = "msmgpio",
  949. .id = -1,
  950. .resource = gpio_resources,
  951. .num_resources = ARRAY_SIZE(gpio_resources),
  952. };
  953. struct platform_device *msm_footswitch_devices[] = {
  954. FS_PCOM(FS_GFX3D, "vdd", "kgsl-3d0.0"),
  955. };
  956. unsigned msm_num_footswitch_devices = ARRAY_SIZE(msm_footswitch_devices);
  957. /* MSM8625 Devices */
  958. static struct resource msm8625_resources_uart1[] = {
  959. {
  960. .start = MSM8625_INT_UART1,
  961. .end = MSM8625_INT_UART1,
  962. .flags = IORESOURCE_IRQ,
  963. },
  964. {
  965. .start = MSM7XXX_UART1_PHYS,
  966. .end = MSM7XXX_UART1_PHYS + MSM7XXX_UART1_SIZE - 1,
  967. .flags = IORESOURCE_MEM,
  968. },
  969. };
  970. struct platform_device msm8625_device_uart1 = {
  971. .name = "msm_serial",
  972. .id = 0,
  973. .num_resources = ARRAY_SIZE(msm8625_resources_uart1),
  974. .resource = msm8625_resources_uart1,
  975. };
  976. static struct resource msm8625_uart1_dm_resources[] = {
  977. {
  978. .start = MSM_UART1DM_PHYS,
  979. .end = MSM_UART1DM_PHYS + PAGE_SIZE - 1,
  980. .flags = IORESOURCE_MEM,
  981. },
  982. {
  983. .start = MSM8625_INT_UART1DM_IRQ,
  984. .end = MSM8625_INT_UART1DM_IRQ,
  985. .flags = IORESOURCE_IRQ,
  986. },
  987. {
  988. .start = MSM8625_INT_UART1DM_RX,
  989. .end = MSM8625_INT_UART1DM_RX,
  990. .flags = IORESOURCE_IRQ,
  991. },
  992. {
  993. .start = DMOV_HSUART1_TX_CHAN,
  994. .end = DMOV_HSUART1_RX_CHAN,
  995. .name = "uartdm_channels",
  996. .flags = IORESOURCE_DMA,
  997. },
  998. {
  999. .start = DMOV_HSUART1_TX_CRCI,
  1000. .end = DMOV_HSUART1_RX_CRCI,
  1001. .name = "uartdm_crci",
  1002. .flags = IORESOURCE_DMA,
  1003. },
  1004. };
  1005. struct platform_device msm8625_device_uart_dm1 = {
  1006. .name = "msm_serial_hs",
  1007. .id = 0,
  1008. .num_resources = ARRAY_SIZE(msm8625_uart1_dm_resources),
  1009. .resource = msm8625_uart1_dm_resources,
  1010. .dev = {
  1011. .dma_mask = &msm_uart_dm1_dma_mask,
  1012. .coherent_dma_mask = DMA_BIT_MASK(32),
  1013. },
  1014. };
  1015. static struct resource msm8625_uart2dm_resources[] = {
  1016. {
  1017. .start = MSM_UART2DM_PHYS,
  1018. .end = MSM_UART2DM_PHYS + PAGE_SIZE - 1,
  1019. .name = "uartdm_resource",
  1020. .flags = IORESOURCE_MEM,
  1021. },
  1022. {
  1023. .start = MSM8625_INT_UART2DM_IRQ,
  1024. .end = MSM8625_INT_UART2DM_IRQ,
  1025. .flags = IORESOURCE_IRQ,
  1026. },
  1027. };
  1028. struct platform_device msm8625_device_uart_dm2 = {
  1029. .name = "msm_serial_hsl",
  1030. .id = 0,
  1031. .num_resources = ARRAY_SIZE(msm8625_uart2dm_resources),
  1032. .resource = msm8625_uart2dm_resources,
  1033. };
  1034. static struct resource msm8625_resources_adsp[] = {
  1035. {
  1036. .start = MSM8625_INT_ADSP_A9_A11,
  1037. .end = MSM8625_INT_ADSP_A9_A11,
  1038. .flags = IORESOURCE_IRQ,
  1039. },
  1040. };
  1041. struct platform_device msm8625_device_adsp = {
  1042. .name = "msm_adsp",
  1043. .id = -1,
  1044. .num_resources = ARRAY_SIZE(msm8625_resources_adsp),
  1045. .resource = msm8625_resources_adsp,
  1046. };
  1047. static struct resource msm8625_dmov_resource[] = {
  1048. {
  1049. .start = MSM8625_INT_ADM_AARM,
  1050. .flags = IORESOURCE_IRQ,
  1051. },
  1052. {
  1053. .start = 0xA9700000,
  1054. .end = 0xA9700000 + SZ_4K - 1,
  1055. .flags = IORESOURCE_MEM,
  1056. },
  1057. };
  1058. struct platform_device msm8625_device_dmov = {
  1059. .name = "msm_dmov",
  1060. .id = -1,
  1061. .resource = msm8625_dmov_resource,
  1062. .num_resources = ARRAY_SIZE(msm8625_dmov_resource),
  1063. .dev = {
  1064. .platform_data = &msm_dmov_pdata,
  1065. },
  1066. };
  1067. static struct resource gsbi0_msm8625_qup_resources[] = {
  1068. {
  1069. .name = "qup_phys_addr",
  1070. .start = MSM_GSBI0_QUP_PHYS,
  1071. .end = MSM_GSBI0_QUP_PHYS + SZ_4K - 1,
  1072. .flags = IORESOURCE_MEM,
  1073. },
  1074. {
  1075. .name = "gsbi_qup_i2c_addr",
  1076. .start = MSM_GSBI0_PHYS,
  1077. .end = MSM_GSBI0_PHYS + SZ_4K - 1,
  1078. .flags = IORESOURCE_MEM,
  1079. },
  1080. {
  1081. .name = "qup_err_intr",
  1082. .start = MSM8625_INT_PWB_I2C,
  1083. .end = MSM8625_INT_PWB_I2C,
  1084. .flags = IORESOURCE_IRQ,
  1085. },
  1086. };
  1087. /* Use GSBI0 QUP for /dev/i2c-0 */
  1088. struct platform_device msm8625_gsbi0_qup_i2c_device = {
  1089. .name = "qup_i2c",
  1090. .id = MSM_GSBI0_QUP_I2C_BUS_ID,
  1091. .num_resources = ARRAY_SIZE(gsbi0_msm8625_qup_resources),
  1092. .resource = gsbi0_msm8625_qup_resources,
  1093. };
  1094. static struct resource gsbi1_msm8625_qup_i2c_resources[] = {
  1095. {
  1096. .name = "qup_phys_addr",
  1097. .start = MSM_GSBI1_QUP_PHYS,
  1098. .end = MSM_GSBI1_QUP_PHYS + SZ_4K - 1,
  1099. .flags = IORESOURCE_MEM,
  1100. },
  1101. {
  1102. .name = "gsbi_qup_i2c_addr",
  1103. .start = MSM_GSBI1_PHYS,
  1104. .end = MSM_GSBI1_PHYS + SZ_4K - 1,
  1105. .flags = IORESOURCE_MEM,
  1106. },
  1107. {
  1108. .name = "qup_err_intr",
  1109. .start = MSM8625_INT_ARM11_DMA,
  1110. .end = MSM8625_INT_ARM11_DMA,
  1111. .flags = IORESOURCE_IRQ,
  1112. },
  1113. };
  1114. /* Use GSBI1 QUP for /dev/i2c-1 */
  1115. struct platform_device msm8625_gsbi1_qup_i2c_device = {
  1116. .name = "qup_i2c",
  1117. .id = MSM_GSBI1_QUP_I2C_BUS_ID,
  1118. .num_resources = ARRAY_SIZE(gsbi1_qup_i2c_resources),
  1119. .resource = gsbi1_msm8625_qup_i2c_resources,
  1120. };
  1121. static struct resource msm8625_gpio_resources[] = {
  1122. {
  1123. .start = MSM8625_INT_GPIO_GROUP1,
  1124. .flags = IORESOURCE_IRQ,
  1125. },
  1126. {
  1127. .start = MSM8625_INT_GPIO_GROUP2,
  1128. .flags = IORESOURCE_IRQ,
  1129. },
  1130. };
  1131. static struct platform_device msm8625_device_gpio = {
  1132. .name = "msmgpio",
  1133. .id = -1,
  1134. .resource = msm8625_gpio_resources,
  1135. .num_resources = ARRAY_SIZE(msm8625_gpio_resources),
  1136. };
  1137. static struct resource msm8625_resources_sdc1[] = {
  1138. {
  1139. .name = "core_mem",
  1140. .start = MSM_SDC1_BASE,
  1141. .end = MSM_SDC1_BASE + SZ_4K - 1,
  1142. .flags = IORESOURCE_MEM,
  1143. },
  1144. {
  1145. .name = "core_irq",
  1146. .start = MSM8625_INT_SDC1_0,
  1147. .end = MSM8625_INT_SDC1_1,
  1148. .flags = IORESOURCE_IRQ,
  1149. },
  1150. {
  1151. .name = "dma_chnl",
  1152. .start = DMOV_SDC1_CHAN,
  1153. .end = DMOV_SDC1_CHAN,
  1154. .flags = IORESOURCE_DMA,
  1155. },
  1156. {
  1157. .name = "dma_crci",
  1158. .start = DMOV_SDC1_CRCI,
  1159. .end = DMOV_SDC1_CRCI,
  1160. .flags = IORESOURCE_DMA,
  1161. }
  1162. };
  1163. static struct resource msm8625_resources_sdc2[] = {
  1164. {
  1165. .name = "core_mem",
  1166. .start = MSM_SDC2_BASE,
  1167. .end = MSM_SDC2_BASE + SZ_4K - 1,
  1168. .flags = IORESOURCE_MEM,
  1169. },
  1170. {
  1171. .name = "core_irq",
  1172. .start = MSM8625_INT_SDC2_0,
  1173. .end = MSM8625_INT_SDC2_1,
  1174. .flags = IORESOURCE_IRQ,
  1175. },
  1176. {
  1177. .name = "dma_chnl",
  1178. .start = DMOV_SDC2_CHAN,
  1179. .end = DMOV_SDC2_CHAN,
  1180. .flags = IORESOURCE_DMA,
  1181. },
  1182. {
  1183. .name = "dma_crci",
  1184. .start = DMOV_SDC2_CRCI,
  1185. .end = DMOV_SDC2_CRCI,
  1186. .flags = IORESOURCE_DMA,
  1187. }
  1188. };
  1189. static struct resource msm8625_resources_sdc3[] = {
  1190. {
  1191. .name = "core_mem",
  1192. .start = MSM_SDC3_BASE,
  1193. .end = MSM_SDC3_BASE + SZ_4K - 1,
  1194. .flags = IORESOURCE_MEM,
  1195. },
  1196. {
  1197. .name = "core_irq",
  1198. .start = MSM8625_INT_SDC3_0,
  1199. .end = MSM8625_INT_SDC3_1,
  1200. .flags = IORESOURCE_IRQ,
  1201. },
  1202. {
  1203. .name = "dma_chnl",
  1204. .start = DMOV_NAND_CHAN,
  1205. .end = DMOV_NAND_CHAN,
  1206. .flags = IORESOURCE_DMA,
  1207. },
  1208. {
  1209. .name = "dma_crci",
  1210. .start = DMOV_SDC3_CRCI,
  1211. .end = DMOV_SDC3_CRCI,
  1212. .flags = IORESOURCE_DMA,
  1213. },
  1214. };
  1215. static struct resource msm8625_resources_sdc4[] = {
  1216. {
  1217. .name = "core_mem",
  1218. .start = MSM_SDC4_BASE,
  1219. .end = MSM_SDC4_BASE + SZ_4K - 1,
  1220. .flags = IORESOURCE_MEM,
  1221. },
  1222. {
  1223. .name = "core_irq",
  1224. .start = MSM8625_INT_SDC4_0,
  1225. .end = MSM8625_INT_SDC4_1,
  1226. .flags = IORESOURCE_IRQ,
  1227. },
  1228. {
  1229. .name = "dma_chnl",
  1230. .start = DMOV_SDC4_CHAN,
  1231. .end = DMOV_SDC4_CHAN,
  1232. .flags = IORESOURCE_DMA,
  1233. },
  1234. {
  1235. .name = "dma_crci",
  1236. .start = DMOV_SDC4_CRCI,
  1237. .end = DMOV_SDC4_CRCI,
  1238. .flags = IORESOURCE_DMA,
  1239. },
  1240. };
  1241. struct platform_device msm8625_device_sdc1 = {
  1242. .name = "msm_sdcc",
  1243. .id = 1,
  1244. .num_resources = ARRAY_SIZE(msm8625_resources_sdc1),
  1245. .resource = msm8625_resources_sdc1,
  1246. .dev = {
  1247. .coherent_dma_mask = 0xffffffff,
  1248. },
  1249. };
  1250. struct platform_device msm8625_device_sdc2 = {
  1251. .name = "msm_sdcc",
  1252. .id = 2,
  1253. .num_resources = ARRAY_SIZE(msm8625_resources_sdc2),
  1254. .resource = msm8625_resources_sdc2,
  1255. .dev = {
  1256. .coherent_dma_mask = 0xffffffff,
  1257. },
  1258. };
  1259. struct platform_device msm8625_device_sdc3 = {
  1260. .name = "msm_sdcc",
  1261. .id = 3,
  1262. .num_resources = ARRAY_SIZE(msm8625_resources_sdc3),
  1263. .resource = msm8625_resources_sdc3,
  1264. .dev = {
  1265. .coherent_dma_mask = 0xffffffff,
  1266. },
  1267. };
  1268. struct platform_device msm8625_device_sdc4 = {
  1269. .name = "msm_sdcc",
  1270. .id = 4,
  1271. .num_resources = ARRAY_SIZE(msm8625_resources_sdc4),
  1272. .resource = msm8625_resources_sdc4,
  1273. .dev = {
  1274. .coherent_dma_mask = 0xffffffff,
  1275. },
  1276. };
  1277. static struct platform_device *msm8625_sdcc_devices[] __initdata = {
  1278. &msm8625_device_sdc1,
  1279. &msm8625_device_sdc2,
  1280. &msm8625_device_sdc3,
  1281. &msm8625_device_sdc4,
  1282. };
  1283. int __init msm_add_sdcc(unsigned int controller, struct mmc_platform_data *plat)
  1284. {
  1285. struct platform_device *pdev;
  1286. if (controller < 1 || controller > 4)
  1287. return -EINVAL;
  1288. if (cpu_is_msm8625() || cpu_is_msm8625q())
  1289. pdev = msm8625_sdcc_devices[controller-1];
  1290. else
  1291. pdev = msm_sdcc_devices[controller-1];
  1292. pdev->dev.platform_data = plat;
  1293. return platform_device_register(pdev);
  1294. }
  1295. static struct resource msm8625_resources_hsusb_otg[] = {
  1296. {
  1297. .start = MSM_HSUSB_PHYS,
  1298. .end = MSM_HSUSB_PHYS + SZ_1K - 1,
  1299. .flags = IORESOURCE_MEM,
  1300. },
  1301. {
  1302. .start = MSM8625_INT_USB_HS,
  1303. .end = MSM8625_INT_USB_HS,
  1304. .flags = IORESOURCE_IRQ,
  1305. },
  1306. };
  1307. struct platform_device msm8625_device_otg = {
  1308. .name = "msm_otg",
  1309. .id = -1,
  1310. .num_resources = ARRAY_SIZE(msm8625_resources_hsusb_otg),
  1311. .resource = msm8625_resources_hsusb_otg,
  1312. .dev = {
  1313. .dma_mask = &dma_mask,
  1314. .coherent_dma_mask = 0xffffffffULL,
  1315. },
  1316. };
  1317. static struct resource msm8625_resources_gadget_peripheral[] = {
  1318. {
  1319. .start = MSM_HSUSB_PHYS,
  1320. .end = MSM_HSUSB_PHYS + SZ_1K - 1,
  1321. .flags = IORESOURCE_MEM,
  1322. },
  1323. {
  1324. .start = MSM8625_INT_USB_HS,
  1325. .end = MSM8625_INT_USB_HS,
  1326. .flags = IORESOURCE_IRQ,
  1327. },
  1328. };
  1329. struct platform_device msm8625_device_gadget_peripheral = {
  1330. .name = "msm_hsusb",
  1331. .id = -1,
  1332. .num_resources = ARRAY_SIZE(msm8625_resources_gadget_peripheral),
  1333. .resource = msm8625_resources_gadget_peripheral,
  1334. .dev = {
  1335. .dma_mask = &dma_mask,
  1336. .coherent_dma_mask = 0xffffffffULL,
  1337. },
  1338. };
  1339. static struct resource msm8625_resources_hsusb_host[] = {
  1340. {
  1341. .start = MSM_HSUSB_PHYS,
  1342. .end = MSM_HSUSB_PHYS + SZ_1K - 1,
  1343. .flags = IORESOURCE_MEM,
  1344. },
  1345. {
  1346. .start = MSM8625_INT_USB_HS,
  1347. .end = MSM8625_INT_USB_HS,
  1348. .flags = IORESOURCE_IRQ,
  1349. },
  1350. };
  1351. struct platform_device msm8625_device_hsusb_host = {
  1352. .name = "msm_hsusb_host",
  1353. .id = 0,
  1354. .num_resources = ARRAY_SIZE(msm8625_resources_hsusb_host),
  1355. .resource = msm8625_resources_hsusb_host,
  1356. .dev = {
  1357. .dma_mask = &dma_mask,
  1358. .coherent_dma_mask = 0xffffffffULL,
  1359. },
  1360. };
  1361. static struct platform_device *msm8625_host_devices[] = {
  1362. &msm8625_device_hsusb_host,
  1363. };
  1364. int msm_add_host(unsigned int host, struct msm_usb_host_platform_data *plat)
  1365. {
  1366. struct platform_device *pdev;
  1367. if (cpu_is_msm8625() || cpu_is_msm8625q())
  1368. pdev = msm8625_host_devices[host];
  1369. else
  1370. pdev = msm_host_devices[host];
  1371. if (!pdev)
  1372. return -ENODEV;
  1373. pdev->dev.platform_data = plat;
  1374. return platform_device_register(pdev);
  1375. }
  1376. #ifdef CONFIG_MSM_CAMERA_V4L2
  1377. static struct resource msm8625_csic0_resources[] = {
  1378. {
  1379. .name = "csic",
  1380. .start = 0xA0F00000,
  1381. .end = 0xA0F00000 + 0x00100000 - 1,
  1382. .flags = IORESOURCE_MEM,
  1383. },
  1384. {
  1385. .name = "csic",
  1386. .start = MSM8625_INT_CSI_IRQ_0,
  1387. .end = MSM8625_INT_CSI_IRQ_0,
  1388. .flags = IORESOURCE_IRQ,
  1389. },
  1390. };
  1391. static struct resource msm8625_csic1_resources[] = {
  1392. {
  1393. .name = "csic",
  1394. .start = 0xA1000000,
  1395. .end = 0xA1000000 + 0x00100000 - 1,
  1396. .flags = IORESOURCE_MEM,
  1397. },
  1398. {
  1399. .name = "csic",
  1400. .start = MSM8625_INT_CSI_IRQ_1,
  1401. .end = MSM8625_INT_CSI_IRQ_1,
  1402. .flags = IORESOURCE_IRQ,
  1403. },
  1404. };
  1405. struct platform_device msm8625_device_csic0 = {
  1406. .name = "msm_csic",
  1407. .id = 0,
  1408. .resource = msm8625_csic0_resources,
  1409. .num_resources = ARRAY_SIZE(msm8625_csic0_resources),
  1410. };
  1411. struct platform_device msm8625_device_csic1 = {
  1412. .name = "msm_csic",
  1413. .id = 1,
  1414. .resource = msm8625_csic1_resources,
  1415. .num_resources = ARRAY_SIZE(msm8625_csic1_resources),
  1416. };
  1417. #endif
  1418. static struct resource msm8625_mipi_dsi_resources[] = {
  1419. {
  1420. .name = "mipi_dsi",
  1421. .start = MIPI_DSI_HW_BASE,
  1422. .end = MIPI_DSI_HW_BASE + 0x000F0000 - 1,
  1423. .flags = IORESOURCE_MEM,
  1424. },
  1425. {
  1426. .start = MSM8625_INT_DSI_IRQ,
  1427. .end = MSM8625_INT_DSI_IRQ,
  1428. .flags = IORESOURCE_IRQ,
  1429. },
  1430. };
  1431. static struct platform_device msm8625_mipi_dsi_device = {
  1432. .name = "mipi_dsi",
  1433. .id = 1,
  1434. .num_resources = ARRAY_SIZE(msm8625_mipi_dsi_resources),
  1435. .resource = msm8625_mipi_dsi_resources,
  1436. };
  1437. static struct resource msm8625_mdp_resources[] = {
  1438. {
  1439. .name = "mdp",
  1440. .start = MDP_BASE,
  1441. .end = MDP_BASE + 0x000F1008 - 1,
  1442. .flags = IORESOURCE_MEM,
  1443. },
  1444. {
  1445. .start = MSM8625_INT_MDP,
  1446. .end = MSM8625_INT_MDP,
  1447. .flags = IORESOURCE_IRQ,
  1448. },
  1449. };
  1450. static struct platform_device msm8625_mdp_device = {
  1451. .name = "mdp",
  1452. .id = 0,
  1453. .num_resources = ARRAY_SIZE(msm8625_mdp_resources),
  1454. .resource = msm8625_mdp_resources,
  1455. };
  1456. struct platform_device mipi_dsi_device;
  1457. void __init msm_fb_register_device(char *name, void *data)
  1458. {
  1459. if (!strncmp(name, "mdp", 3)) {
  1460. if (cpu_is_msm8625() || cpu_is_msm8625q())
  1461. msm_register_device(&msm8625_mdp_device, data);
  1462. else
  1463. msm_register_device(&msm_mdp_device, data);
  1464. } else if (!strncmp(name, "mipi_dsi", 8)) {
  1465. if (cpu_is_msm8625() || cpu_is_msm8625q()) {
  1466. msm_register_device(&msm8625_mipi_dsi_device, data);
  1467. mipi_dsi_device = msm8625_mipi_dsi_device;
  1468. } else {
  1469. msm_register_device(&msm_mipi_dsi_device, data);
  1470. mipi_dsi_device = msm_mipi_dsi_device;
  1471. }
  1472. } else if (!strncmp(name, "lcdc", 4)) {
  1473. msm_register_device(&msm_lcdc_device, data);
  1474. } else {
  1475. printk(KERN_ERR "%s: unknown device! %s\n", __func__, name);
  1476. }
  1477. }
  1478. static struct resource msm8625_kgsl_3d0_resources[] = {
  1479. {
  1480. .name = KGSL_3D0_REG_MEMORY,
  1481. .start = 0xA0000000,
  1482. .end = 0xA001ffff,
  1483. .flags = IORESOURCE_MEM,
  1484. },
  1485. {
  1486. .name = KGSL_3D0_IRQ,
  1487. .start = MSM8625_INT_GRAPHICS,
  1488. .end = MSM8625_INT_GRAPHICS,
  1489. .flags = IORESOURCE_IRQ,
  1490. },
  1491. };
  1492. struct platform_device msm8625_kgsl_3d0 = {
  1493. .name = "kgsl-3d0",
  1494. .id = 0,
  1495. .num_resources = ARRAY_SIZE(msm8625_kgsl_3d0_resources),
  1496. .resource = msm8625_kgsl_3d0_resources,
  1497. .dev = {
  1498. .platform_data = &kgsl_3d0_pdata,
  1499. },
  1500. };
  1501. static struct resource pl310_resources[] = {
  1502. {
  1503. .start = 0xC0400000,
  1504. .end = 0xC0400000 + SZ_4K - 1,
  1505. .flags = IORESOURCE_MEM,
  1506. },
  1507. {
  1508. .name = "l2_irq",
  1509. .start = MSM8625_INT_SC_SICL2PERFMONIRPTREQ,
  1510. .flags = IORESOURCE_IRQ,
  1511. },
  1512. };
  1513. static struct platform_device pl310_erp_device = {
  1514. .name = "pl310_erp",
  1515. .id = -1,
  1516. .resource = pl310_resources,
  1517. .num_resources = ARRAY_SIZE(pl310_resources),
  1518. };
  1519. enum {
  1520. MSM8625,
  1521. MSM8625A,
  1522. MSM8625AB,
  1523. };
  1524. static int __init msm8625_cpu_id(void)
  1525. {
  1526. int raw_id, cpu;
  1527. raw_id = socinfo_get_raw_id();
  1528. switch (raw_id) {
  1529. /* Part number for 1GHz part */
  1530. case 0x770:
  1531. case 0x771:
  1532. case 0x77C:
  1533. case 0x780:
  1534. case 0x785: /* Edge-only MSM8125-0 */
  1535. case 0x8D0:
  1536. cpu = MSM8625;
  1537. break;
  1538. /* Part number for 1.2GHz part */
  1539. case 0x773:
  1540. case 0x774:
  1541. case 0x781:
  1542. case 0x8D1:
  1543. cpu = MSM8625A;
  1544. break;
  1545. case 0x775:
  1546. case 0x776:
  1547. case 0x779:
  1548. case 0x77D:
  1549. case 0x782:
  1550. case 0x8D2:
  1551. cpu = MSM8625AB;
  1552. break;
  1553. default:
  1554. pr_err("Invalid Raw ID\n");
  1555. return -ENODEV;
  1556. }
  1557. return cpu;
  1558. }
  1559. static struct resource cpr_resources[] = {
  1560. {
  1561. .start = MSM8625_INT_CPR_IRQ0,
  1562. .flags = IORESOURCE_IRQ,
  1563. },
  1564. {
  1565. .start = MSM8625_CPR_PHYS,
  1566. .end = MSM8625_CPR_PHYS + SZ_4K - 1,
  1567. .flags = IORESOURCE_MEM,
  1568. },
  1569. };
  1570. /**
  1571. * These are various Vdd levels supported by PMIC
  1572. */
  1573. static uint32_t msm_c2_pmic_mv[] __initdata = {
  1574. 1350000, 1337500, 1325000, 1312500, 1300000,
  1575. 1287500, 1275000, 1262500, 1250000, 1237500,
  1576. 1225000, 1212500, 1200000, 1187500, 1175000,
  1577. 1162500, 1150000, 1137500, 1125000, 1112500,
  1578. 1100000, 1087500, 1075000, 1062500, 0,
  1579. 0, 0, 0, 0, 0,
  1580. 0, 1050000,
  1581. };
  1582. /**
  1583. * This data will be based on CPR mode of operation
  1584. */
  1585. static struct msm_cpr_mode msm_cpr_mode_data[] = {
  1586. [NORMAL_MODE] = {
  1587. .ring_osc_data = {
  1588. {0, },
  1589. {0, },
  1590. {0, },
  1591. {0, },
  1592. {0, },
  1593. {0, },
  1594. {0, },
  1595. {0, },
  1596. },
  1597. .ring_osc = 0,
  1598. .step_quot = ~0,
  1599. .tgt_volt_offset = 0,
  1600. .nom_Vmax = 1350000,
  1601. .nom_Vmin = 1250000,
  1602. .calibrated_uV = 1100000,
  1603. },
  1604. [TURBO_MODE] = {
  1605. .ring_osc_data = {
  1606. {0, },
  1607. {0, },
  1608. {0, },
  1609. {0, },
  1610. {0, },
  1611. {0, },
  1612. {0, },
  1613. {0, },
  1614. },
  1615. .ring_osc = 0,
  1616. .step_quot = ~0,
  1617. .tgt_volt_offset = 0,
  1618. .turbo_Vmax = 1350000,
  1619. .turbo_Vmin = 1150000,
  1620. .nom_Vmax = 1350000,
  1621. .nom_Vmin = 1150000,
  1622. .calibrated_uV = 1300000,
  1623. },
  1624. };
  1625. static uint32_t
  1626. msm_cpr_get_quot(uint32_t max_quot, uint32_t max_freq, uint32_t new_freq)
  1627. {
  1628. uint32_t quot;
  1629. /* This formula is as per chip characterization data */
  1630. quot = max_quot - (((max_freq - new_freq) * 7) / 10);
  1631. return quot;
  1632. }
  1633. static void msm_cpr_clk_enable(void)
  1634. {
  1635. uint32_t reg_val;
  1636. /* Select TCXO (19.2MHz) as clock source */
  1637. reg_val = readl_relaxed(A11S_TEST_BUS_SEL_ADDR);
  1638. reg_val |= RBCPR_CLK_MUX_SEL;
  1639. writel_relaxed(reg_val, A11S_TEST_BUS_SEL_ADDR);
  1640. /* Get CPR out of reset */
  1641. writel_relaxed(0x1, RBCPR_SW_RESET_N);
  1642. }
  1643. static struct msm_cpr_config msm_cpr_pdata = {
  1644. .ref_clk_khz = 19200,
  1645. .delay_us = 25000,
  1646. .irq_line = 0,
  1647. .cpr_mode_data = msm_cpr_mode_data,
  1648. .tgt_count_div_N = 1,
  1649. .floor = 0,
  1650. .ceiling = 40,
  1651. .sw_vlevel = 20,
  1652. .up_threshold = 1,
  1653. .dn_threshold = 3,
  1654. .up_margin = 0,
  1655. .dn_margin = 0,
  1656. .max_nom_freq = 700800,
  1657. .max_freq = 1401600,
  1658. .max_quot = 0,
  1659. .disable_cpr = false,
  1660. .step_size = 12500,
  1661. .get_quot = msm_cpr_get_quot,
  1662. .clk_enable = msm_cpr_clk_enable,
  1663. };
  1664. static struct platform_device msm8625_device_cpr = {
  1665. .name = "msm-cpr",
  1666. .id = -1,
  1667. .num_resources = ARRAY_SIZE(cpr_resources),
  1668. .resource = cpr_resources,
  1669. .dev = {
  1670. .platform_data = &msm_cpr_pdata,
  1671. },
  1672. };
  1673. static struct platform_device msm8625_vp_device = {
  1674. .name = "vp-regulator",
  1675. .id = -1,
  1676. };
  1677. static void __init msm_cpr_init(void)
  1678. {
  1679. struct cpr_info_type *cpr_info = NULL;
  1680. uint8_t ring_osc = 0;
  1681. cpr_info = kzalloc(sizeof(struct cpr_info_type), GFP_KERNEL);
  1682. if (!cpr_info) {
  1683. pr_err("%s: Out of memory %d\n", __func__, -ENOMEM);
  1684. return;
  1685. }
  1686. msm_smem_get_cpr_info(cpr_info);
  1687. msm_cpr_pdata.disable_cpr = cpr_info->disable_cpr;
  1688. /**
  1689. * Set the ring_osc based on efuse BIT(0)
  1690. * CPR_fuse[0] = 0 selects 2nd RO (010)
  1691. * CPR_fuse[0] = 1 select 3rd RO (011)
  1692. */
  1693. if (cpr_info->ring_osc == 0x0)
  1694. ring_osc = 0x2;
  1695. else if (cpr_info->ring_osc == 0x1)
  1696. ring_osc = 0x3;
  1697. msm_cpr_mode_data[TURBO_MODE].ring_osc = ring_osc;
  1698. msm_cpr_mode_data[NORMAL_MODE].ring_osc = ring_osc;
  1699. /* GCNT = 1000 nsec/52nsec (@TCX0=19.2Mhz) = 19.2 */
  1700. msm_cpr_mode_data[TURBO_MODE].ring_osc_data[ring_osc].gcnt = 19;
  1701. msm_cpr_mode_data[NORMAL_MODE].ring_osc_data[ring_osc].gcnt = 19;
  1702. /**
  1703. * The scaling factor and offset are as per chip characterization data
  1704. * This formula is used since available fuse bits in the chip are not
  1705. * enough to represent the value of maximum quot
  1706. */
  1707. msm_cpr_pdata.max_quot = cpr_info->turbo_quot * 10 + 600;
  1708. /**
  1709. * Fused Quot value for 1.2GHz on a 1.2GHz part is lower than
  1710. * the quot value calculated using the scaling factor formula for
  1711. * 1.2GHz when running on a 1.4GHz part. So, prop up the Quot for
  1712. * a 1.2GHz part by a chip characterization recommended value.
  1713. * Ditto for a 1.0GHz part.
  1714. */
  1715. if (msm8625_cpu_id() == MSM8625A) {
  1716. msm_cpr_pdata.max_quot += 30;
  1717. if (msm_cpr_pdata.max_quot > 1400)
  1718. msm_cpr_pdata.max_quot = 1400;
  1719. } else if (msm8625_cpu_id() == MSM8625) {
  1720. msm_cpr_pdata.max_quot += 50;
  1721. if (msm_cpr_pdata.max_quot > 1350)
  1722. msm_cpr_pdata.max_quot = 1350;
  1723. }
  1724. /**
  1725. * Bits 4:0 of pvs_fuse provide mapping to the safe boot up voltage.
  1726. * Boot up mode is by default Turbo.
  1727. */
  1728. msm_cpr_mode_data[TURBO_MODE].calibrated_uV =
  1729. msm_c2_pmic_mv[cpr_info->pvs_fuse & 0x1F];
  1730. if ((cpr_info->floor_fuse & 0x3) == 0x0) {
  1731. msm_cpr_mode_data[TURBO_MODE].nom_Vmin = 1000000;
  1732. msm_cpr_mode_data[TURBO_MODE].turbo_Vmin = 1100000;
  1733. } else if ((cpr_info->floor_fuse & 0x3) == 0x1) {
  1734. msm_cpr_mode_data[TURBO_MODE].nom_Vmin = 1050000;
  1735. msm_cpr_mode_data[TURBO_MODE].turbo_Vmin = 1100000;
  1736. } else if ((cpr_info->floor_fuse & 0x3) == 0x2) {
  1737. msm_cpr_mode_data[TURBO_MODE].nom_Vmin = 1100000;
  1738. msm_cpr_mode_data[TURBO_MODE].turbo_Vmin = 1100000;
  1739. }
  1740. pr_debug("%s: cpr: ring_osc: 0x%x\n", __func__,
  1741. msm_cpr_mode_data[TURBO_MODE].ring_osc);
  1742. pr_debug("%s: cpr: turbo_quot: 0x%x\n", __func__, cpr_info->turbo_quot);
  1743. pr_debug("%s: cpr: pvs_fuse: 0x%x\n", __func__, cpr_info->pvs_fuse);
  1744. pr_debug("%s: cpr: floor_fuse: 0x%x\n", __func__, cpr_info->floor_fuse);
  1745. pr_debug("%s: cpr: nom_Vmin: %d, turbo_Vmin: %d\n", __func__,
  1746. msm_cpr_mode_data[TURBO_MODE].nom_Vmin,
  1747. msm_cpr_mode_data[TURBO_MODE].turbo_Vmin);
  1748. kfree(cpr_info);
  1749. if (msm8625_cpu_id() == MSM8625A)
  1750. msm_cpr_pdata.max_freq = 1209600;
  1751. else if (msm8625_cpu_id() == MSM8625)
  1752. msm_cpr_pdata.max_freq = 1008000;
  1753. if (machine_is_qrd_skud_prime() || cpu_is_msm8625q())
  1754. msm_cpr_pdata.step_size = 6250;
  1755. platform_device_register(&msm8625_vp_device);
  1756. platform_device_register(&msm8625_device_cpr);
  1757. }
  1758. static struct clk_lookup msm_clock_8625_dummy[] = {
  1759. CLK_DUMMY("core_clk", adm_clk.c, "msm_dmov", 0),
  1760. CLK_DUMMY("adsp_clk", adsp_clk.c, NULL, 0),
  1761. CLK_DUMMY("ahb_m_clk", ahb_m_clk.c, NULL, 0),
  1762. CLK_DUMMY("ahb_s_clk", ahb_s_clk.c, NULL, 0),
  1763. CLK_DUMMY("cam_m_clk", cam_m_clk.c, NULL, 0),
  1764. CLK_DUMMY("csi_clk", csi1_clk.c, NULL, 0),
  1765. CLK_DUMMY("csi_pclk", csi1_p_clk.c, NULL, 0),
  1766. CLK_DUMMY("csi_vfe_clk", csi1_vfe_clk.c, NULL, 0),
  1767. CLK_DUMMY("dsi_byte_clk", dsi_byte_clk.c, NULL, 0),
  1768. CLK_DUMMY("dsi_clk", dsi_clk.c, NULL, 0),
  1769. CLK_DUMMY("dsi_esc_clk", dsi_esc_clk.c, NULL, 0),
  1770. CLK_DUMMY("dsi_pixel_clk", dsi_pixel_clk.c, NULL, 0),
  1771. CLK_DUMMY("dsi_ref_clk", dsi_ref_clk.c, NULL, 0),
  1772. CLK_DUMMY("ebi1_clk", ebi1_clk.c, NULL, 0),
  1773. CLK_DUMMY("ebi2_clk", ebi2_clk.c, NULL, 0),
  1774. CLK_DUMMY("ecodec_clk", ecodec_clk.c, NULL, 0),
  1775. CLK_DUMMY("gp_clk", gp_clk.c, NULL, 0),
  1776. CLK_DUMMY("core_clk", gsbi1_qup_clk.c, "qup_i2c.0", 0),
  1777. CLK_DUMMY("core_clk", gsbi2_qup_clk.c, "qup_i2c.1", 0),
  1778. CLK_DUMMY("iface_clk", gsbi1_qup_p_clk.c, "qup_i2c.0", 0),
  1779. CLK_DUMMY("iface_clk", gsbi2_qup_p_clk.c, "qup_i2c.1", 0),
  1780. CLK_DUMMY("icodec_rx_clk", icodec_rx_clk.c, NULL, 0),
  1781. CLK_DUMMY("icodec_tx_clk", icodec_tx_clk.c, NULL, 0),
  1782. CLK_DUMMY("mem_clk", imem_clk.c, NULL, 0),
  1783. CLK_DUMMY("mddi_clk", pmdh_clk.c, NULL, 0),
  1784. CLK_DUMMY("mdp_clk", mdp_clk.c, NULL, 0),
  1785. CLK_DUMMY("mdp_lcdc_pclk_clk", mdp_lcdc_pclk_clk.c, NULL, 0),
  1786. CLK_DUMMY("mdp_lcdc_pad_pclk_clk", mdp_lcdc_pad_pclk_clk.c, NULL, 0),
  1787. CLK_DUMMY("mdp_vsync_clk", mdp_vsync_clk.c, NULL, 0),
  1788. CLK_DUMMY("mdp_dsi_pclk", mdp_dsi_p_clk.c, NULL, 0),
  1789. CLK_DUMMY("pbus_clk", pbus_clk.c, NULL, 0),
  1790. CLK_DUMMY("pcm_clk", pcm_clk.c, NULL, 0),
  1791. CLK_DUMMY("sdac_clk", sdac_clk.c, NULL, 0),
  1792. CLK_DUMMY("core_clk", sdc1_clk.c, "msm_sdcc.1", 0),
  1793. CLK_DUMMY("iface_clk", sdc1_p_clk.c, "msm_sdcc.1", 0),
  1794. CLK_DUMMY("core_clk", sdc2_clk.c, "msm_sdcc.2", 0),
  1795. CLK_DUMMY("iface_clk", sdc2_p_clk.c, "msm_sdcc.2", 0),
  1796. CLK_DUMMY("core_clk", sdc3_clk.c, "msm_sdcc.3", 0),
  1797. CLK_DUMMY("iface_clk", sdc3_p_clk.c, "msm_sdcc.3", 0),
  1798. CLK_DUMMY("core_clk", sdc4_clk.c, "msm_sdcc.4", 0),
  1799. CLK_DUMMY("iface_clk", sdc4_p_clk.c, "msm_sdcc.4", 0),
  1800. CLK_DUMMY("ref_clk", tsif_ref_clk.c, "msm_tsif.0", 0),
  1801. CLK_DUMMY("iface_clk", tsif_p_clk.c, "msm_tsif.0", 0),
  1802. CLK_DUMMY("core_clk", uart1_clk.c, "msm_serial.0", 0),
  1803. CLK_DUMMY("core_clk", uart2_clk.c, "msm_serial.1", 0),
  1804. CLK_DUMMY("core_clk", uart1dm_clk.c, "msm_serial_hs.0", 0),
  1805. CLK_DUMMY("core_clk", uart2dm_clk.c, "msm_serial_hsl.0", 0),
  1806. CLK_DUMMY("usb_hs_core_clk", usb_hs_core_clk.c, NULL, 0),
  1807. CLK_DUMMY("usb_hs2_clk", usb_hs2_clk.c, NULL, 0),
  1808. CLK_DUMMY("usb_hs_clk", usb_hs_clk.c, NULL, 0),
  1809. CLK_DUMMY("usb_hs_pclk", usb_hs_p_clk.c, NULL, 0),
  1810. CLK_DUMMY("usb_phy_clk", usb_phy_clk.c, NULL, 0),
  1811. CLK_DUMMY("vdc_clk", vdc_clk.c, NULL, 0),
  1812. CLK_DUMMY("ebi1_acpu_clk", ebi_acpu_clk.c, NULL, 0),
  1813. CLK_DUMMY("ebi1_lcdc_clk", ebi_lcdc_clk.c, NULL, 0),
  1814. CLK_DUMMY("ebi1_mddi_clk", ebi_mddi_clk.c, NULL, 0),
  1815. CLK_DUMMY("ebi1_usb_clk", ebi_usb_clk.c, NULL, 0),
  1816. CLK_DUMMY("ebi1_vfe_clk", ebi_vfe_clk.c, NULL, 0),
  1817. CLK_DUMMY("mem_clk", ebi_adm_clk.c, "msm_dmov", 0),
  1818. };
  1819. struct clock_init_data msm8625_dummy_clock_init_data __initdata = {
  1820. .table = msm_clock_8625_dummy,
  1821. .size = ARRAY_SIZE(msm_clock_8625_dummy),
  1822. };
  1823. static int __init msm_gpio_config_gps(void)
  1824. {
  1825. unsigned int gps_gpio = 7;
  1826. int ret = 0;
  1827. if (!machine_is_msm8625_evb())
  1828. return ret;
  1829. ret = gpio_tlmm_config(GPIO_CFG(gps_gpio, 0, GPIO_CFG_OUTPUT,
  1830. GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), GPIO_CFG_ENABLE);
  1831. if (ret < 0) {
  1832. pr_err("gpio tlmm failed for gpio-%d\n", gps_gpio);
  1833. return ret;
  1834. }
  1835. ret = gpio_request(gps_gpio, "gnss-gpio");
  1836. if (ret < 0) {
  1837. pr_err("failed to request gpio-%d\n", gps_gpio);
  1838. return ret;
  1839. }
  1840. ret = gpio_direction_input(gps_gpio);
  1841. if (ret < 0) {
  1842. pr_err("failed to change direction for gpio-%d\n", gps_gpio);
  1843. return ret;
  1844. }
  1845. ret = gpio_export(gps_gpio, true);
  1846. if (ret < 0)
  1847. pr_err("failed to export gpio for user\n");
  1848. return ret;
  1849. }
  1850. static int __init msm_acpuclock_init(bool flag)
  1851. {
  1852. struct cpr_info_type *acpu_info = NULL;
  1853. acpu_info = kzalloc(sizeof(struct cpr_info_type), GFP_KERNEL);
  1854. if (!acpu_info) {
  1855. pr_err("%s: Out of memory %d\n", __func__, -ENOMEM);
  1856. return -ENOMEM;
  1857. }
  1858. msm_smem_get_cpr_info(acpu_info);
  1859. msm8625q_acpuclk_pdata.pvs_voltage_uv =
  1860. msm_c2_pmic_mv[acpu_info->pvs_fuse & 0x1F];
  1861. kfree(acpu_info);
  1862. msm8625q_acpuclk_pdata.flag = flag;
  1863. return 0;
  1864. }
  1865. int __init msm7x2x_misc_init(void)
  1866. {
  1867. if (machine_is_msm8625_rumi3()) {
  1868. msm_clock_init(&msm8625_dummy_clock_init_data);
  1869. msm_cpr_init();
  1870. return 0;
  1871. }
  1872. msm_clock_init(&msm7x27a_clock_init_data);
  1873. if (cpu_is_msm7x27aa() || cpu_is_msm7x25ab())
  1874. platform_device_register(&msm7x27aa_device_acpuclk);
  1875. else if (cpu_is_msm8625q()) {
  1876. msm_acpuclock_init(1);
  1877. platform_device_register(&msm8625q_device_acpuclk);
  1878. } else if (cpu_is_msm8625()) {
  1879. if (machine_is_qrd_skud_prime()) {
  1880. msm_acpuclock_init(0);
  1881. platform_device_register(&msm8625q_device_acpuclk);
  1882. } else if (msm8625_cpu_id() == MSM8625)
  1883. platform_device_register(&msm7x27aa_device_acpuclk);
  1884. else if (msm8625_cpu_id() == MSM8625A)
  1885. platform_device_register(&msm8625_device_acpuclk);
  1886. else if (msm8625_cpu_id() == MSM8625AB)
  1887. platform_device_register(&msm8625ab_device_acpuclk);
  1888. } else {
  1889. platform_device_register(&msm7x27a_device_acpuclk);
  1890. }
  1891. if (cpu_is_msm8625() || (cpu_is_msm8625q() &&
  1892. SOCINFO_VERSION_MAJOR(socinfo_get_version()) >= 2))
  1893. msm_cpr_init();
  1894. if (!cpu_is_msm8625() && !cpu_is_msm8625q())
  1895. pl310_resources[1].start = SC_SICL2PERFMONIRPTREQ;
  1896. platform_device_register(&pl310_erp_device);
  1897. if (msm_gpio_config_gps() < 0)
  1898. pr_err("Error for gpio config for GPS gpio\n");
  1899. return 0;
  1900. }
  1901. #ifdef CONFIG_CACHE_L2X0
  1902. static int __init msm7x27x_cache_init(void)
  1903. {
  1904. int aux_ctrl = 0;
  1905. int pctrl = 0;
  1906. /* Way Size 010(0x2) 32KB */
  1907. aux_ctrl = (0x1 << L2X0_AUX_CTRL_SHARE_OVERRIDE_SHIFT) | \
  1908. (0x2 << L2X0_AUX_CTRL_WAY_SIZE_SHIFT) | \
  1909. (0x1 << L2X0_AUX_CTRL_EVNT_MON_BUS_EN_SHIFT);
  1910. if (cpu_is_msm8625() || cpu_is_msm8625q()) {
  1911. /* Way Size 011(0x3) 64KB */
  1912. aux_ctrl |= (0x3 << L2X0_AUX_CTRL_WAY_SIZE_SHIFT) | \
  1913. (0x1 << L2X0_AUX_CTRL_DATA_PREFETCH_SHIFT) | \
  1914. (0X1 << L2X0_AUX_CTRL_INSTR_PREFETCH_SHIFT) | \
  1915. (0x1 << L2X0_AUX_CTRL_L2_FORCE_NWA_SHIFT);
  1916. /* Write Prefetch Control settings */
  1917. pctrl = readl_relaxed(MSM_L2CC_BASE + L2X0_PREFETCH_CTRL);
  1918. pctrl |= (0x3 << L2X0_PREFETCH_CTRL_OFFSET_SHIFT) | \
  1919. (0x1 << L2X0_PREFETCH_CTRL_WRAP8_INC_SHIFT) | \
  1920. (0x1 << L2X0_PREFETCH_CTRL_WRAP8_SHIFT);
  1921. writel_relaxed(pctrl , MSM_L2CC_BASE + L2X0_PREFETCH_CTRL);
  1922. }
  1923. l2x0_init(MSM_L2CC_BASE, aux_ctrl, L2X0_AUX_CTRL_MASK);
  1924. if (cpu_is_msm8625() || cpu_is_msm8625q()) {
  1925. pctrl = readl_relaxed(MSM_L2CC_BASE + L2X0_PREFETCH_CTRL);
  1926. pr_info("Prfetch Ctrl: 0x%08x\n", pctrl);
  1927. }
  1928. return 0;
  1929. }
  1930. #else
  1931. static int __init msm7x27x_cache_init(void){ return 0; }
  1932. #endif
  1933. void __init msm_common_io_init(void)
  1934. {
  1935. msm_map_common_io();
  1936. if (socinfo_init() < 0)
  1937. pr_err("socinfo_init() failed!\n");
  1938. msm7x27x_cache_init();
  1939. }
  1940. void __init msm8625_init_irq(void)
  1941. {
  1942. msm_gic_irq_extn_init();
  1943. gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
  1944. (void *)MSM_QGIC_CPU_BASE);
  1945. }
  1946. void __init msm8625_map_io(void)
  1947. {
  1948. msm_map_msm8625_io();
  1949. if (socinfo_init() < 0)
  1950. pr_err("socinfo_init() failed!\n");
  1951. msm7x27x_cache_init();
  1952. }
  1953. static int msm7627a_init_gpio(void)
  1954. {
  1955. if (cpu_is_msm8625() || cpu_is_msm8625q())
  1956. platform_device_register(&msm8625_device_gpio);
  1957. else
  1958. platform_device_register(&msm_device_gpio);
  1959. return 0;
  1960. }
  1961. postcore_initcall(msm7627a_init_gpio);
  1962. static int msm7627a_panic_handler(struct notifier_block *this,
  1963. unsigned long event, void *ptr)
  1964. {
  1965. msm_clk_dump_debug_info();
  1966. flush_cache_all();
  1967. outer_flush_all();
  1968. return NOTIFY_DONE;
  1969. }
  1970. static struct notifier_block panic_handler = {
  1971. .notifier_call = msm7627a_panic_handler,
  1972. .priority = INT_MAX,
  1973. };
  1974. static int __init panic_register(void)
  1975. {
  1976. atomic_notifier_chain_register(&panic_notifier_list,
  1977. &panic_handler);
  1978. return 0;
  1979. }
  1980. module_init(panic_register);