mtk-dbg.c 63 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979
  1. // SPDX-License-Identifier: GPL-2.0
  2. /*
  3. * Copyright (C) 2019 MediaTek Inc.
  4. * Copyright (C) 2021 XiaoMi, Inc.
  5. * Author: Argus Lin <argus.lin@mediatek.com>
  6. */
  7. #define DEBUG
  8. #include <linux/clk.h>
  9. #include <linux/interrupt.h>
  10. #include <linux/io.h>
  11. #include <linux/regmap.h>
  12. #include <linux/reset.h>
  13. #include <linux/delay.h>
  14. #include <linux/err.h>
  15. #include <linux/kernel.h>
  16. #include <linux/module.h>
  17. #include <linux/of.h>
  18. #include <linux/of_device.h>
  19. #include <linux/of_address.h>
  20. #include <linux/platform_device.h>
  21. #include <linux/slab.h>
  22. #include <linux/sched/clock.h>
  23. #include <linux/seq_file.h>
  24. #include <linux/uaccess.h>
  25. #include <linux/debugfs.h>
  26. #include <spmi_sw.h>
  27. #include <mt-plat/aee.h>
  28. enum pmif_dbg_regs {
  29. PMIF_INIT_DONE,
  30. PMIF_INF_BUSY_STA,
  31. PMIF_OTHER_BUSY_STA_0,
  32. PMIF_OTHER_BUSY_STA_1,
  33. PMIF_IRQ_EVENT_EN_0,
  34. PMIF_IRQ_FLAG_0,
  35. PMIF_IRQ_CLR_0,
  36. PMIF_IRQ_EVENT_EN_1,
  37. PMIF_IRQ_FLAG_1,
  38. PMIF_IRQ_CLR_1,
  39. PMIF_IRQ_EVENT_EN_2,
  40. PMIF_IRQ_FLAG_2,
  41. PMIF_IRQ_CLR_2,
  42. PMIF_IRQ_EVENT_EN_3,
  43. PMIF_IRQ_FLAG_3,
  44. PMIF_IRQ_CLR_3,
  45. PMIF_IRQ_EVENT_EN_4,
  46. PMIF_IRQ_FLAG_4,
  47. PMIF_IRQ_CLR_4,
  48. PMIF_WDT_EVENT_EN_0,
  49. PMIF_WDT_FLAG_0,
  50. PMIF_WDT_EVENT_EN_1,
  51. PMIF_WDT_FLAG_1,
  52. PMIF_MONITOR_CTRL,
  53. PMIF_MONITOR_TARGET_CHAN_0,
  54. PMIF_MONITOR_TARGET_CHAN_1,
  55. PMIF_MONITOR_TARGET_CHAN_2,
  56. PMIF_MONITOR_TARGET_CHAN_3,
  57. PMIF_MONITOR_TARGET_CHAN_4,
  58. PMIF_MONITOR_TARGET_CHAN_5,
  59. PMIF_MONITOR_TARGET_CHAN_6,
  60. PMIF_MONITOR_TARGET_CHAN_7,
  61. PMIF_MONITOR_TARGET_WRITE,
  62. PMIF_MONITOR_TARGET_SLVID_0,
  63. PMIF_MONITOR_TARGET_SLVID_1,
  64. PMIF_MONITOR_TARGET_ADDR_0,
  65. PMIF_MONITOR_TARGET_ADDR_1,
  66. PMIF_MONITOR_TARGET_ADDR_2,
  67. PMIF_MONITOR_TARGET_ADDR_3,
  68. PMIF_MONITOR_TARGET_ADDR_4,
  69. PMIF_MONITOR_TARGET_ADDR_5,
  70. PMIF_MONITOR_TARGET_ADDR_6,
  71. PMIF_MONITOR_TARGET_ADDR_7,
  72. PMIF_MONITOR_TARGET_WDATA_0,
  73. PMIF_MONITOR_TARGET_WDATA_1,
  74. PMIF_MONITOR_TARGET_WDATA_2,
  75. PMIF_MONITOR_TARGET_WDATA_3,
  76. PMIF_MONITOR_TARGET_WDATA_4,
  77. PMIF_MONITOR_TARGET_WDATA_5,
  78. PMIF_MONITOR_TARGET_WDATA_6,
  79. PMIF_MONITOR_TARGET_WDATA_7,
  80. PMIF_MONITOR_STA,
  81. PMIF_MONITOR_RECORD_0_0,
  82. PMIF_MONITOR_RECORD_0_1,
  83. PMIF_MONITOR_RECORD_0_2,
  84. PMIF_MONITOR_RECORD_0_3,
  85. PMIF_MONITOR_RECORD_0_4,
  86. PMIF_MONITOR_RECORD_1_0,
  87. PMIF_MONITOR_RECORD_1_1,
  88. PMIF_MONITOR_RECORD_1_2,
  89. PMIF_MONITOR_RECORD_1_3,
  90. PMIF_MONITOR_RECORD_1_4,
  91. PMIF_MONITOR_RECORD_2_0,
  92. PMIF_MONITOR_RECORD_2_1,
  93. PMIF_MONITOR_RECORD_2_2,
  94. PMIF_MONITOR_RECORD_2_3,
  95. PMIF_MONITOR_RECORD_2_4,
  96. PMIF_MONITOR_RECORD_3_0,
  97. PMIF_MONITOR_RECORD_3_1,
  98. PMIF_MONITOR_RECORD_3_2,
  99. PMIF_MONITOR_RECORD_3_3,
  100. PMIF_MONITOR_RECORD_3_4,
  101. PMIF_MONITOR_RECORD_4_0,
  102. PMIF_MONITOR_RECORD_4_1,
  103. PMIF_MONITOR_RECORD_4_2,
  104. PMIF_MONITOR_RECORD_4_3,
  105. PMIF_MONITOR_RECORD_4_4,
  106. PMIF_MONITOR_RECORD_5_0,
  107. PMIF_MONITOR_RECORD_5_1,
  108. PMIF_MONITOR_RECORD_5_2,
  109. PMIF_MONITOR_RECORD_5_3,
  110. PMIF_MONITOR_RECORD_5_4,
  111. PMIF_MONITOR_RECORD_6_0,
  112. PMIF_MONITOR_RECORD_6_1,
  113. PMIF_MONITOR_RECORD_6_2,
  114. PMIF_MONITOR_RECORD_6_3,
  115. PMIF_MONITOR_RECORD_6_4,
  116. PMIF_MONITOR_RECORD_7_0,
  117. PMIF_MONITOR_RECORD_7_1,
  118. PMIF_MONITOR_RECORD_7_2,
  119. PMIF_MONITOR_RECORD_7_3,
  120. PMIF_MONITOR_RECORD_7_4,
  121. PMIF_MONITOR_RECORD_8_0,
  122. PMIF_MONITOR_RECORD_8_1,
  123. PMIF_MONITOR_RECORD_8_2,
  124. PMIF_MONITOR_RECORD_8_3,
  125. PMIF_MONITOR_RECORD_8_4,
  126. PMIF_MONITOR_RECORD_9_0,
  127. PMIF_MONITOR_RECORD_9_1,
  128. PMIF_MONITOR_RECORD_9_2,
  129. PMIF_MONITOR_RECORD_9_3,
  130. PMIF_MONITOR_RECORD_9_4,
  131. PMIF_MONITOR_RECORD_10_0,
  132. PMIF_MONITOR_RECORD_10_1,
  133. PMIF_MONITOR_RECORD_10_2,
  134. PMIF_MONITOR_RECORD_10_3,
  135. PMIF_MONITOR_RECORD_10_4,
  136. PMIF_MONITOR_RECORD_11_0,
  137. PMIF_MONITOR_RECORD_11_1,
  138. PMIF_MONITOR_RECORD_11_2,
  139. PMIF_MONITOR_RECORD_11_3,
  140. PMIF_MONITOR_RECORD_11_4,
  141. PMIF_MONITOR_RECORD_12_0,
  142. PMIF_MONITOR_RECORD_12_1,
  143. PMIF_MONITOR_RECORD_12_2,
  144. PMIF_MONITOR_RECORD_12_3,
  145. PMIF_MONITOR_RECORD_12_4,
  146. PMIF_MONITOR_RECORD_13_0,
  147. PMIF_MONITOR_RECORD_13_1,
  148. PMIF_MONITOR_RECORD_13_2,
  149. PMIF_MONITOR_RECORD_13_3,
  150. PMIF_MONITOR_RECORD_13_4,
  151. PMIF_MONITOR_RECORD_14_0,
  152. PMIF_MONITOR_RECORD_14_1,
  153. PMIF_MONITOR_RECORD_14_2,
  154. PMIF_MONITOR_RECORD_14_3,
  155. PMIF_MONITOR_RECORD_14_4,
  156. PMIF_MONITOR_RECORD_15_0,
  157. PMIF_MONITOR_RECORD_15_1,
  158. PMIF_MONITOR_RECORD_15_2,
  159. PMIF_MONITOR_RECORD_15_3,
  160. PMIF_MONITOR_RECORD_15_4,
  161. PMIF_MONITOR_RECORD_16_0,
  162. PMIF_MONITOR_RECORD_16_1,
  163. PMIF_MONITOR_RECORD_16_2,
  164. PMIF_MONITOR_RECORD_16_3,
  165. PMIF_MONITOR_RECORD_16_4,
  166. PMIF_MONITOR_RECORD_17_0,
  167. PMIF_MONITOR_RECORD_17_1,
  168. PMIF_MONITOR_RECORD_17_2,
  169. PMIF_MONITOR_RECORD_17_3,
  170. PMIF_MONITOR_RECORD_17_4,
  171. PMIF_MONITOR_RECORD_18_0,
  172. PMIF_MONITOR_RECORD_18_1,
  173. PMIF_MONITOR_RECORD_18_2,
  174. PMIF_MONITOR_RECORD_18_3,
  175. PMIF_MONITOR_RECORD_18_4,
  176. PMIF_MONITOR_RECORD_19_0,
  177. PMIF_MONITOR_RECORD_19_1,
  178. PMIF_MONITOR_RECORD_19_2,
  179. PMIF_MONITOR_RECORD_19_3,
  180. PMIF_MONITOR_RECORD_19_4,
  181. PMIF_MONITOR_RECORD_20_0,
  182. PMIF_MONITOR_RECORD_20_1,
  183. PMIF_MONITOR_RECORD_20_2,
  184. PMIF_MONITOR_RECORD_20_3,
  185. PMIF_MONITOR_RECORD_20_4,
  186. PMIF_MONITOR_RECORD_21_0,
  187. PMIF_MONITOR_RECORD_21_1,
  188. PMIF_MONITOR_RECORD_21_2,
  189. PMIF_MONITOR_RECORD_21_3,
  190. PMIF_MONITOR_RECORD_21_4,
  191. PMIF_MONITOR_RECORD_22_0,
  192. PMIF_MONITOR_RECORD_22_1,
  193. PMIF_MONITOR_RECORD_22_2,
  194. PMIF_MONITOR_RECORD_22_3,
  195. PMIF_MONITOR_RECORD_22_4,
  196. PMIF_MONITOR_RECORD_23_0,
  197. PMIF_MONITOR_RECORD_23_1,
  198. PMIF_MONITOR_RECORD_23_2,
  199. PMIF_MONITOR_RECORD_23_3,
  200. PMIF_MONITOR_RECORD_23_4,
  201. PMIF_MONITOR_RECORD_24_0,
  202. PMIF_MONITOR_RECORD_24_1,
  203. PMIF_MONITOR_RECORD_24_2,
  204. PMIF_MONITOR_RECORD_24_3,
  205. PMIF_MONITOR_RECORD_24_4,
  206. PMIF_MONITOR_RECORD_25_0,
  207. PMIF_MONITOR_RECORD_25_1,
  208. PMIF_MONITOR_RECORD_25_2,
  209. PMIF_MONITOR_RECORD_25_3,
  210. PMIF_MONITOR_RECORD_25_4,
  211. PMIF_MONITOR_RECORD_26_0,
  212. PMIF_MONITOR_RECORD_26_1,
  213. PMIF_MONITOR_RECORD_26_2,
  214. PMIF_MONITOR_RECORD_26_3,
  215. PMIF_MONITOR_RECORD_26_4,
  216. PMIF_MONITOR_RECORD_27_0,
  217. PMIF_MONITOR_RECORD_27_1,
  218. PMIF_MONITOR_RECORD_27_2,
  219. PMIF_MONITOR_RECORD_27_3,
  220. PMIF_MONITOR_RECORD_27_4,
  221. PMIF_MONITOR_RECORD_28_0,
  222. PMIF_MONITOR_RECORD_28_1,
  223. PMIF_MONITOR_RECORD_28_2,
  224. PMIF_MONITOR_RECORD_28_3,
  225. PMIF_MONITOR_RECORD_28_4,
  226. PMIF_MONITOR_RECORD_29_0,
  227. PMIF_MONITOR_RECORD_29_1,
  228. PMIF_MONITOR_RECORD_29_2,
  229. PMIF_MONITOR_RECORD_29_3,
  230. PMIF_MONITOR_RECORD_29_4,
  231. PMIF_MONITOR_RECORD_30_0,
  232. PMIF_MONITOR_RECORD_30_1,
  233. PMIF_MONITOR_RECORD_30_2,
  234. PMIF_MONITOR_RECORD_30_3,
  235. PMIF_MONITOR_RECORD_30_4,
  236. PMIF_MONITOR_RECORD_31_0,
  237. PMIF_MONITOR_RECORD_31_1,
  238. PMIF_MONITOR_RECORD_31_2,
  239. PMIF_MONITOR_RECORD_31_3,
  240. PMIF_MONITOR_RECORD_31_4,
  241. PMIF_DEBUG_CTRL,
  242. PMIF_RESERVED_0,
  243. PMIF_SWINF_0_ACC,
  244. PMIF_SWINF_0_WDATA_31_0,
  245. PMIF_SWINF_0_WDATA_63_32,
  246. PMIF_SWINF_0_RDATA_31_0,
  247. PMIF_SWINF_0_RDATA_63_32,
  248. PMIF_SWINF_0_VLD_CLR,
  249. PMIF_SWINF_0_STA,
  250. PMIF_SWINF_1_ACC,
  251. PMIF_SWINF_1_WDATA_31_0,
  252. PMIF_SWINF_1_WDATA_63_32,
  253. PMIF_SWINF_1_RDATA_31_0,
  254. PMIF_SWINF_1_RDATA_63_32,
  255. PMIF_SWINF_1_VLD_CLR,
  256. PMIF_SWINF_1_STA,
  257. PMIF_SWINF_2_ACC,
  258. PMIF_SWINF_2_WDATA_31_0,
  259. PMIF_SWINF_2_WDATA_63_32,
  260. PMIF_SWINF_2_RDATA_31_0,
  261. PMIF_SWINF_2_RDATA_63_32,
  262. PMIF_SWINF_2_VLD_CLR,
  263. PMIF_SWINF_2_STA,
  264. PMIF_SWINF_3_ACC,
  265. PMIF_SWINF_3_WDATA_31_0,
  266. PMIF_SWINF_3_WDATA_63_32,
  267. PMIF_SWINF_3_RDATA_31_0,
  268. PMIF_SWINF_3_RDATA_63_32,
  269. PMIF_SWINF_3_VLD_CLR,
  270. PMIF_SWINF_3_STA,
  271. PMIC_ACC_VIO_INFO_0,
  272. PMIC_ACC_VIO_INFO_1,
  273. PMIC_ACC_VIO_INFO_2,
  274. PMIC_ACC_VIO_INFO_3,
  275. PMIC_ACC_VIO_INFO_4,
  276. PMIC_ACC_VIO_INFO_5,
  277. PMIC_ACC_SCP_VIO_INFO_0,
  278. PMIC_ACC_SCP_VIO_INFO_1,
  279. PMIC_ACC_SCP_VIO_INFO_2,
  280. PMIC_ACC_SCP_VIO_INFO_3,
  281. PMIC_ACC_SCP_VIO_INFO_4,
  282. PMIC_ACC_SCP_VIO_INFO_5,
  283. PMIF_ACC_VIO_INFO_0,
  284. PMIF_ACC_VIO_INFO_1,
  285. PMIF_ACC_VIO_INFO_2,
  286. /* MT6853 new register */
  287. PMIC_ALL_ACC_VIO_INFO_0,
  288. PMIC_ALL_ACC_VIO_INFO_1
  289. };
  290. static const u32 mt6xxx_pmif_dbg_regs[] = {
  291. [PMIF_INIT_DONE] = 0x0000,
  292. [PMIF_INF_BUSY_STA] = 0x0018,
  293. [PMIF_OTHER_BUSY_STA_0] = 0x001C,
  294. [PMIF_OTHER_BUSY_STA_1] = 0x0020,
  295. [PMIF_IRQ_EVENT_EN_0] = 0x0418,
  296. [PMIF_IRQ_FLAG_0] = 0x0420,
  297. [PMIF_IRQ_CLR_0] = 0x0424,
  298. [PMIF_IRQ_EVENT_EN_1] = 0x0428,
  299. [PMIF_IRQ_FLAG_1] = 0x0430,
  300. [PMIF_IRQ_CLR_1] = 0x0434,
  301. [PMIF_IRQ_EVENT_EN_2] = 0x0438,
  302. [PMIF_IRQ_FLAG_2] = 0x0440,
  303. [PMIF_IRQ_CLR_2] = 0x0444,
  304. [PMIF_IRQ_EVENT_EN_3] = 0x0448,
  305. [PMIF_IRQ_FLAG_3] = 0x0450,
  306. [PMIF_IRQ_CLR_3] = 0x0454,
  307. [PMIF_IRQ_EVENT_EN_4] = 0x0458,
  308. [PMIF_IRQ_FLAG_4] = 0x0460,
  309. [PMIF_IRQ_CLR_4] = 0x0464,
  310. [PMIF_WDT_EVENT_EN_0] = 0x046C,
  311. [PMIF_WDT_FLAG_0] = 0x0470,
  312. [PMIF_WDT_EVENT_EN_1] = 0x0474,
  313. [PMIF_WDT_FLAG_1] = 0x0478,
  314. [PMIF_MONITOR_CTRL] = 0x047C,
  315. [PMIF_MONITOR_TARGET_CHAN_0] = 0x0480,
  316. [PMIF_MONITOR_TARGET_CHAN_1] = 0x0484,
  317. [PMIF_MONITOR_TARGET_CHAN_2] = 0x0488,
  318. [PMIF_MONITOR_TARGET_CHAN_3] = 0x048C,
  319. [PMIF_MONITOR_TARGET_CHAN_4] = 0x0490,
  320. [PMIF_MONITOR_TARGET_CHAN_5] = 0x0494,
  321. [PMIF_MONITOR_TARGET_CHAN_6] = 0x0498,
  322. [PMIF_MONITOR_TARGET_CHAN_7] = 0x049C,
  323. [PMIF_MONITOR_TARGET_WRITE] = 0x04A0,
  324. [PMIF_MONITOR_TARGET_SLVID_0] = 0x04A4,
  325. [PMIF_MONITOR_TARGET_SLVID_1] = 0x04A8,
  326. [PMIF_MONITOR_TARGET_ADDR_0] = 0x04AC,
  327. [PMIF_MONITOR_TARGET_ADDR_1] = 0x04B0,
  328. [PMIF_MONITOR_TARGET_ADDR_2] = 0x04B4,
  329. [PMIF_MONITOR_TARGET_ADDR_3] = 0x04B8,
  330. [PMIF_MONITOR_TARGET_ADDR_4] = 0x04BC,
  331. [PMIF_MONITOR_TARGET_ADDR_5] = 0x04C0,
  332. [PMIF_MONITOR_TARGET_ADDR_6] = 0x04C4,
  333. [PMIF_MONITOR_TARGET_ADDR_7] = 0x04C8,
  334. [PMIF_MONITOR_TARGET_WDATA_0] = 0x04CC,
  335. [PMIF_MONITOR_TARGET_WDATA_1] = 0x04D0,
  336. [PMIF_MONITOR_TARGET_WDATA_2] = 0x04D4,
  337. [PMIF_MONITOR_TARGET_WDATA_3] = 0x04D8,
  338. [PMIF_MONITOR_TARGET_WDATA_4] = 0x04DC,
  339. [PMIF_MONITOR_TARGET_WDATA_5] = 0x04E0,
  340. [PMIF_MONITOR_TARGET_WDATA_6] = 0x04E4,
  341. [PMIF_MONITOR_TARGET_WDATA_7] = 0x04E8,
  342. [PMIF_MONITOR_STA] = 0x04EC,
  343. [PMIF_MONITOR_RECORD_0_0] = 0x04F0,
  344. [PMIF_MONITOR_RECORD_0_1] = 0x04F4,
  345. [PMIF_MONITOR_RECORD_0_2] = 0x04F8,
  346. [PMIF_MONITOR_RECORD_0_3] = 0x04FC,
  347. [PMIF_MONITOR_RECORD_0_4] = 0x0500,
  348. [PMIF_MONITOR_RECORD_1_0] = 0x0504,
  349. [PMIF_MONITOR_RECORD_1_1] = 0x0508,
  350. [PMIF_MONITOR_RECORD_1_2] = 0x050C,
  351. [PMIF_MONITOR_RECORD_1_3] = 0x0510,
  352. [PMIF_MONITOR_RECORD_1_4] = 0x0514,
  353. [PMIF_MONITOR_RECORD_2_0] = 0x0518,
  354. [PMIF_MONITOR_RECORD_2_1] = 0x051C,
  355. [PMIF_MONITOR_RECORD_2_2] = 0x0520,
  356. [PMIF_MONITOR_RECORD_2_3] = 0x0524,
  357. [PMIF_MONITOR_RECORD_2_4] = 0x0528,
  358. [PMIF_MONITOR_RECORD_3_0] = 0x052C,
  359. [PMIF_MONITOR_RECORD_3_1] = 0x0530,
  360. [PMIF_MONITOR_RECORD_3_2] = 0x0534,
  361. [PMIF_MONITOR_RECORD_3_3] = 0x0538,
  362. [PMIF_MONITOR_RECORD_3_4] = 0x053C,
  363. [PMIF_MONITOR_RECORD_4_0] = 0x0540,
  364. [PMIF_MONITOR_RECORD_4_1] = 0x0544,
  365. [PMIF_MONITOR_RECORD_4_2] = 0x0548,
  366. [PMIF_MONITOR_RECORD_4_3] = 0x054C,
  367. [PMIF_MONITOR_RECORD_4_4] = 0x0550,
  368. [PMIF_MONITOR_RECORD_5_0] = 0x0554,
  369. [PMIF_MONITOR_RECORD_5_1] = 0x0558,
  370. [PMIF_MONITOR_RECORD_5_2] = 0x055C,
  371. [PMIF_MONITOR_RECORD_5_3] = 0x0560,
  372. [PMIF_MONITOR_RECORD_5_4] = 0x0564,
  373. [PMIF_MONITOR_RECORD_6_0] = 0x0568,
  374. [PMIF_MONITOR_RECORD_6_1] = 0x056C,
  375. [PMIF_MONITOR_RECORD_6_2] = 0x0570,
  376. [PMIF_MONITOR_RECORD_6_3] = 0x0574,
  377. [PMIF_MONITOR_RECORD_6_4] = 0x0578,
  378. [PMIF_MONITOR_RECORD_7_0] = 0x057C,
  379. [PMIF_MONITOR_RECORD_7_1] = 0x0580,
  380. [PMIF_MONITOR_RECORD_7_2] = 0x0584,
  381. [PMIF_MONITOR_RECORD_7_3] = 0x0588,
  382. [PMIF_MONITOR_RECORD_7_4] = 0x058C,
  383. [PMIF_MONITOR_RECORD_8_0] = 0x0590,
  384. [PMIF_MONITOR_RECORD_8_1] = 0x0594,
  385. [PMIF_MONITOR_RECORD_8_2] = 0x0598,
  386. [PMIF_MONITOR_RECORD_8_3] = 0x059C,
  387. [PMIF_MONITOR_RECORD_8_4] = 0x05A0,
  388. [PMIF_MONITOR_RECORD_9_0] = 0x05A4,
  389. [PMIF_MONITOR_RECORD_9_1] = 0x05A8,
  390. [PMIF_MONITOR_RECORD_9_2] = 0x05AC,
  391. [PMIF_MONITOR_RECORD_9_3] = 0x05B0,
  392. [PMIF_MONITOR_RECORD_9_4] = 0x05B4,
  393. [PMIF_MONITOR_RECORD_10_0] = 0x05B8,
  394. [PMIF_MONITOR_RECORD_10_1] = 0x05BC,
  395. [PMIF_MONITOR_RECORD_10_2] = 0x05C0,
  396. [PMIF_MONITOR_RECORD_10_3] = 0x05C4,
  397. [PMIF_MONITOR_RECORD_10_4] = 0x05C8,
  398. [PMIF_MONITOR_RECORD_11_0] = 0x05CC,
  399. [PMIF_MONITOR_RECORD_11_1] = 0x05D0,
  400. [PMIF_MONITOR_RECORD_11_2] = 0x05D4,
  401. [PMIF_MONITOR_RECORD_11_3] = 0x05D8,
  402. [PMIF_MONITOR_RECORD_11_4] = 0x05DC,
  403. [PMIF_MONITOR_RECORD_12_0] = 0x05E0,
  404. [PMIF_MONITOR_RECORD_12_1] = 0x05E4,
  405. [PMIF_MONITOR_RECORD_12_2] = 0x05E8,
  406. [PMIF_MONITOR_RECORD_12_3] = 0x05EC,
  407. [PMIF_MONITOR_RECORD_12_4] = 0x05F0,
  408. [PMIF_MONITOR_RECORD_13_0] = 0x05F4,
  409. [PMIF_MONITOR_RECORD_13_1] = 0x05F8,
  410. [PMIF_MONITOR_RECORD_13_2] = 0x05FC,
  411. [PMIF_MONITOR_RECORD_13_3] = 0x0600,
  412. [PMIF_MONITOR_RECORD_13_4] = 0x0604,
  413. [PMIF_MONITOR_RECORD_14_0] = 0x0608,
  414. [PMIF_MONITOR_RECORD_14_1] = 0x060C,
  415. [PMIF_MONITOR_RECORD_14_2] = 0x0610,
  416. [PMIF_MONITOR_RECORD_14_3] = 0x0614,
  417. [PMIF_MONITOR_RECORD_14_4] = 0x0618,
  418. [PMIF_MONITOR_RECORD_15_0] = 0x061C,
  419. [PMIF_MONITOR_RECORD_15_1] = 0x0620,
  420. [PMIF_MONITOR_RECORD_15_2] = 0x0624,
  421. [PMIF_MONITOR_RECORD_15_3] = 0x0628,
  422. [PMIF_MONITOR_RECORD_15_4] = 0x062C,
  423. [PMIF_MONITOR_RECORD_16_0] = 0x0630,
  424. [PMIF_MONITOR_RECORD_16_1] = 0x0634,
  425. [PMIF_MONITOR_RECORD_16_2] = 0x0638,
  426. [PMIF_MONITOR_RECORD_16_3] = 0x063C,
  427. [PMIF_MONITOR_RECORD_16_4] = 0x0640,
  428. [PMIF_MONITOR_RECORD_17_0] = 0x0644,
  429. [PMIF_MONITOR_RECORD_17_1] = 0x0648,
  430. [PMIF_MONITOR_RECORD_17_2] = 0x064C,
  431. [PMIF_MONITOR_RECORD_17_3] = 0x0650,
  432. [PMIF_MONITOR_RECORD_17_4] = 0x0654,
  433. [PMIF_MONITOR_RECORD_18_0] = 0x0658,
  434. [PMIF_MONITOR_RECORD_18_1] = 0x065C,
  435. [PMIF_MONITOR_RECORD_18_2] = 0x0660,
  436. [PMIF_MONITOR_RECORD_18_3] = 0x0664,
  437. [PMIF_MONITOR_RECORD_18_4] = 0x0668,
  438. [PMIF_MONITOR_RECORD_19_0] = 0x066C,
  439. [PMIF_MONITOR_RECORD_19_1] = 0x0670,
  440. [PMIF_MONITOR_RECORD_19_2] = 0x0674,
  441. [PMIF_MONITOR_RECORD_19_3] = 0x0678,
  442. [PMIF_MONITOR_RECORD_19_4] = 0x067C,
  443. [PMIF_MONITOR_RECORD_20_0] = 0x0680,
  444. [PMIF_MONITOR_RECORD_20_1] = 0x0684,
  445. [PMIF_MONITOR_RECORD_20_2] = 0x0688,
  446. [PMIF_MONITOR_RECORD_20_3] = 0x068C,
  447. [PMIF_MONITOR_RECORD_20_4] = 0x0690,
  448. [PMIF_MONITOR_RECORD_21_0] = 0x0694,
  449. [PMIF_MONITOR_RECORD_21_1] = 0x0698,
  450. [PMIF_MONITOR_RECORD_21_2] = 0x069C,
  451. [PMIF_MONITOR_RECORD_21_3] = 0x06A0,
  452. [PMIF_MONITOR_RECORD_21_4] = 0x06A4,
  453. [PMIF_MONITOR_RECORD_22_0] = 0x06A8,
  454. [PMIF_MONITOR_RECORD_22_1] = 0x06AC,
  455. [PMIF_MONITOR_RECORD_22_2] = 0x06B0,
  456. [PMIF_MONITOR_RECORD_22_3] = 0x06B4,
  457. [PMIF_MONITOR_RECORD_22_4] = 0x06B8,
  458. [PMIF_MONITOR_RECORD_23_0] = 0x06BC,
  459. [PMIF_MONITOR_RECORD_23_1] = 0x06C0,
  460. [PMIF_MONITOR_RECORD_23_2] = 0x06C4,
  461. [PMIF_MONITOR_RECORD_23_3] = 0x06C8,
  462. [PMIF_MONITOR_RECORD_23_4] = 0x06CC,
  463. [PMIF_MONITOR_RECORD_24_0] = 0x06D0,
  464. [PMIF_MONITOR_RECORD_24_1] = 0x06D4,
  465. [PMIF_MONITOR_RECORD_24_2] = 0x06D8,
  466. [PMIF_MONITOR_RECORD_24_3] = 0x06DC,
  467. [PMIF_MONITOR_RECORD_24_4] = 0x06E0,
  468. [PMIF_MONITOR_RECORD_25_0] = 0x06E4,
  469. [PMIF_MONITOR_RECORD_25_1] = 0x06E8,
  470. [PMIF_MONITOR_RECORD_25_2] = 0x06EC,
  471. [PMIF_MONITOR_RECORD_25_3] = 0x06F0,
  472. [PMIF_MONITOR_RECORD_25_4] = 0x06F4,
  473. [PMIF_MONITOR_RECORD_26_0] = 0x06F8,
  474. [PMIF_MONITOR_RECORD_26_1] = 0x06FC,
  475. [PMIF_MONITOR_RECORD_26_2] = 0x0700,
  476. [PMIF_MONITOR_RECORD_26_3] = 0x0704,
  477. [PMIF_MONITOR_RECORD_26_4] = 0x0708,
  478. [PMIF_MONITOR_RECORD_27_0] = 0x070C,
  479. [PMIF_MONITOR_RECORD_27_1] = 0x0710,
  480. [PMIF_MONITOR_RECORD_27_2] = 0x0714,
  481. [PMIF_MONITOR_RECORD_27_3] = 0x0718,
  482. [PMIF_MONITOR_RECORD_27_4] = 0x071C,
  483. [PMIF_MONITOR_RECORD_28_0] = 0x0720,
  484. [PMIF_MONITOR_RECORD_28_1] = 0x0724,
  485. [PMIF_MONITOR_RECORD_28_2] = 0x0728,
  486. [PMIF_MONITOR_RECORD_28_3] = 0x072C,
  487. [PMIF_MONITOR_RECORD_28_4] = 0x0730,
  488. [PMIF_MONITOR_RECORD_29_0] = 0x0734,
  489. [PMIF_MONITOR_RECORD_29_1] = 0x0738,
  490. [PMIF_MONITOR_RECORD_29_2] = 0x073C,
  491. [PMIF_MONITOR_RECORD_29_3] = 0x0740,
  492. [PMIF_MONITOR_RECORD_29_4] = 0x0744,
  493. [PMIF_MONITOR_RECORD_30_0] = 0x0748,
  494. [PMIF_MONITOR_RECORD_30_1] = 0x074C,
  495. [PMIF_MONITOR_RECORD_30_2] = 0x0750,
  496. [PMIF_MONITOR_RECORD_30_3] = 0x0754,
  497. [PMIF_MONITOR_RECORD_30_4] = 0x0758,
  498. [PMIF_MONITOR_RECORD_31_0] = 0x075C,
  499. [PMIF_MONITOR_RECORD_31_1] = 0x0760,
  500. [PMIF_MONITOR_RECORD_31_2] = 0x0764,
  501. [PMIF_MONITOR_RECORD_31_3] = 0x0768,
  502. [PMIF_MONITOR_RECORD_31_4] = 0x076C,
  503. [PMIF_DEBUG_CTRL] = 0x0770,
  504. [PMIF_RESERVED_0] = 0x0778,
  505. [PMIF_SWINF_0_ACC] = 0x0C00,
  506. [PMIF_SWINF_0_WDATA_31_0] = 0x0C04,
  507. [PMIF_SWINF_0_WDATA_63_32] = 0x0C08,
  508. [PMIF_SWINF_0_RDATA_31_0] = 0x0C14,
  509. [PMIF_SWINF_0_RDATA_63_32] = 0x0C18,
  510. [PMIF_SWINF_0_VLD_CLR] = 0x0C24,
  511. [PMIF_SWINF_0_STA] = 0x0C28,
  512. [PMIF_SWINF_1_ACC] = 0x0C40,
  513. [PMIF_SWINF_1_WDATA_31_0] = 0x0C44,
  514. [PMIF_SWINF_1_WDATA_63_32] = 0x0C48,
  515. [PMIF_SWINF_1_RDATA_31_0] = 0x0C54,
  516. [PMIF_SWINF_1_RDATA_63_32] = 0x0C58,
  517. [PMIF_SWINF_1_VLD_CLR] = 0x0C64,
  518. [PMIF_SWINF_1_STA] = 0x0C68,
  519. [PMIF_SWINF_2_ACC] = 0x0C80,
  520. [PMIF_SWINF_2_WDATA_31_0] = 0x0C84,
  521. [PMIF_SWINF_2_WDATA_63_32] = 0x0C88,
  522. [PMIF_SWINF_2_RDATA_31_0] = 0x0C94,
  523. [PMIF_SWINF_2_RDATA_63_32] = 0x0C98,
  524. [PMIF_SWINF_2_VLD_CLR] = 0x0CA4,
  525. [PMIF_SWINF_2_STA] = 0x0CA8,
  526. [PMIF_SWINF_3_ACC] = 0x0CC0,
  527. [PMIF_SWINF_3_WDATA_31_0] = 0x0CC4,
  528. [PMIF_SWINF_3_WDATA_63_32] = 0x0CC8,
  529. [PMIF_SWINF_3_RDATA_31_0] = 0x0CD4,
  530. [PMIF_SWINF_3_RDATA_63_32] = 0x0CD8,
  531. [PMIF_SWINF_3_VLD_CLR] = 0x0CE4,
  532. [PMIF_SWINF_3_STA] = 0x0CE8,
  533. [PMIC_ACC_VIO_INFO_0] = 0x0F50,
  534. [PMIC_ACC_VIO_INFO_1] = 0x0F54,
  535. [PMIC_ACC_VIO_INFO_2] = 0x0F58,
  536. [PMIC_ACC_VIO_INFO_3] = 0x0F5C,
  537. [PMIC_ACC_VIO_INFO_4] = 0x0F60,
  538. [PMIC_ACC_VIO_INFO_5] = 0x0F64,
  539. [PMIC_ACC_SCP_VIO_INFO_0] = 0x0F68,
  540. [PMIC_ACC_SCP_VIO_INFO_1] = 0x0F6C,
  541. [PMIC_ACC_SCP_VIO_INFO_2] = 0x0F70,
  542. [PMIC_ACC_SCP_VIO_INFO_3] = 0x0F74,
  543. [PMIC_ACC_SCP_VIO_INFO_4] = 0x0F78,
  544. [PMIC_ACC_SCP_VIO_INFO_5] = 0x0F7C,
  545. [PMIF_ACC_VIO_INFO_0] = 0x0F80,
  546. [PMIF_ACC_VIO_INFO_1] = 0x0F84,
  547. [PMIF_ACC_VIO_INFO_2] = 0x0F88,
  548. };
  549. static const u32 mt6833_pmif_dbg_regs[] = {
  550. [PMIF_INIT_DONE] = 0x0000,
  551. [PMIF_INF_BUSY_STA] = 0x0018,
  552. [PMIF_OTHER_BUSY_STA_0] = 0x001C,
  553. [PMIF_OTHER_BUSY_STA_1] = 0x0020,
  554. [PMIF_IRQ_EVENT_EN_0] = 0x0420,
  555. [PMIF_IRQ_FLAG_0] = 0x0428,
  556. [PMIF_IRQ_CLR_0] = 0x042C,
  557. [PMIF_IRQ_EVENT_EN_1] = 0x0430,
  558. [PMIF_IRQ_FLAG_1] = 0x0438,
  559. [PMIF_IRQ_CLR_1] = 0x043C,
  560. [PMIF_IRQ_EVENT_EN_2] = 0x0440,
  561. [PMIF_IRQ_FLAG_2] = 0x0448,
  562. [PMIF_IRQ_CLR_2] = 0x044C,
  563. [PMIF_IRQ_EVENT_EN_3] = 0x0450,
  564. [PMIF_IRQ_FLAG_3] = 0x0458,
  565. [PMIF_IRQ_CLR_3] = 0x045C,
  566. [PMIF_IRQ_EVENT_EN_4] = 0x0460,
  567. [PMIF_IRQ_FLAG_4] = 0x0468,
  568. [PMIF_IRQ_CLR_4] = 0x046C,
  569. [PMIF_WDT_EVENT_EN_0] = 0x0474,
  570. [PMIF_WDT_FLAG_0] = 0x0478,
  571. [PMIF_WDT_EVENT_EN_1] = 0x047C,
  572. [PMIF_WDT_FLAG_1] = 0x0480,
  573. [PMIF_MONITOR_CTRL] = 0x0484,
  574. [PMIF_MONITOR_TARGET_CHAN_0] = 0x0488,
  575. [PMIF_MONITOR_TARGET_CHAN_1] = 0x048C,
  576. [PMIF_MONITOR_TARGET_CHAN_2] = 0x0490,
  577. [PMIF_MONITOR_TARGET_CHAN_3] = 0x0494,
  578. [PMIF_MONITOR_TARGET_CHAN_4] = 0x0498,
  579. [PMIF_MONITOR_TARGET_CHAN_5] = 0x049C,
  580. [PMIF_MONITOR_TARGET_CHAN_6] = 0x04A0,
  581. [PMIF_MONITOR_TARGET_CHAN_7] = 0x04A4,
  582. [PMIF_MONITOR_TARGET_WRITE] = 0x04A8,
  583. [PMIF_MONITOR_TARGET_SLVID_0] = 0x04AC,
  584. [PMIF_MONITOR_TARGET_SLVID_1] = 0x04B0,
  585. [PMIF_MONITOR_TARGET_ADDR_0] = 0x04B4,
  586. [PMIF_MONITOR_TARGET_ADDR_1] = 0x04B8,
  587. [PMIF_MONITOR_TARGET_ADDR_2] = 0x04BC,
  588. [PMIF_MONITOR_TARGET_ADDR_3] = 0x04C0,
  589. [PMIF_MONITOR_TARGET_ADDR_4] = 0x04C4,
  590. [PMIF_MONITOR_TARGET_ADDR_5] = 0x04C8,
  591. [PMIF_MONITOR_TARGET_ADDR_6] = 0x04CC,
  592. [PMIF_MONITOR_TARGET_ADDR_7] = 0x04D0,
  593. [PMIF_MONITOR_TARGET_WDATA_0] = 0x04D4,
  594. [PMIF_MONITOR_TARGET_WDATA_1] = 0x04D8,
  595. [PMIF_MONITOR_TARGET_WDATA_2] = 0x04DC,
  596. [PMIF_MONITOR_TARGET_WDATA_3] = 0x04E0,
  597. [PMIF_MONITOR_TARGET_WDATA_4] = 0x04E4,
  598. [PMIF_MONITOR_TARGET_WDATA_5] = 0x04E8,
  599. [PMIF_MONITOR_TARGET_WDATA_6] = 0x04EC,
  600. [PMIF_MONITOR_TARGET_WDATA_7] = 0x04F0,
  601. [PMIF_MONITOR_STA] = 0x04F4,
  602. [PMIF_MONITOR_RECORD_0_0] = 0x04F8,
  603. [PMIF_MONITOR_RECORD_0_1] = 0x04FC,
  604. [PMIF_MONITOR_RECORD_0_2] = 0x0500,
  605. [PMIF_MONITOR_RECORD_0_3] = 0x0504,
  606. [PMIF_MONITOR_RECORD_0_4] = 0x0508,
  607. [PMIF_MONITOR_RECORD_1_0] = 0x050C,
  608. [PMIF_MONITOR_RECORD_1_1] = 0x0510,
  609. [PMIF_MONITOR_RECORD_1_2] = 0x0514,
  610. [PMIF_MONITOR_RECORD_1_3] = 0x0518,
  611. [PMIF_MONITOR_RECORD_1_4] = 0x051C,
  612. [PMIF_MONITOR_RECORD_2_0] = 0x0520,
  613. [PMIF_MONITOR_RECORD_2_1] = 0x0524,
  614. [PMIF_MONITOR_RECORD_2_2] = 0x0528,
  615. [PMIF_MONITOR_RECORD_2_3] = 0x052C,
  616. [PMIF_MONITOR_RECORD_2_4] = 0x0530,
  617. [PMIF_MONITOR_RECORD_3_0] = 0x0534,
  618. [PMIF_MONITOR_RECORD_3_1] = 0x0538,
  619. [PMIF_MONITOR_RECORD_3_2] = 0x053C,
  620. [PMIF_MONITOR_RECORD_3_3] = 0x0540,
  621. [PMIF_MONITOR_RECORD_3_4] = 0x0544,
  622. [PMIF_MONITOR_RECORD_4_0] = 0x0548,
  623. [PMIF_MONITOR_RECORD_4_1] = 0x054C,
  624. [PMIF_MONITOR_RECORD_4_2] = 0x0550,
  625. [PMIF_MONITOR_RECORD_4_3] = 0x0554,
  626. [PMIF_MONITOR_RECORD_4_4] = 0x0558,
  627. [PMIF_MONITOR_RECORD_5_0] = 0x055C,
  628. [PMIF_MONITOR_RECORD_5_1] = 0x0560,
  629. [PMIF_MONITOR_RECORD_5_2] = 0x0564,
  630. [PMIF_MONITOR_RECORD_5_3] = 0x0568,
  631. [PMIF_MONITOR_RECORD_5_4] = 0x056C,
  632. [PMIF_MONITOR_RECORD_6_0] = 0x0570,
  633. [PMIF_MONITOR_RECORD_6_1] = 0x0574,
  634. [PMIF_MONITOR_RECORD_6_2] = 0x0578,
  635. [PMIF_MONITOR_RECORD_6_3] = 0x057C,
  636. [PMIF_MONITOR_RECORD_6_4] = 0x0580,
  637. [PMIF_MONITOR_RECORD_7_0] = 0x0584,
  638. [PMIF_MONITOR_RECORD_7_1] = 0x0588,
  639. [PMIF_MONITOR_RECORD_7_2] = 0x058C,
  640. [PMIF_MONITOR_RECORD_7_3] = 0x0590,
  641. [PMIF_MONITOR_RECORD_7_4] = 0x0594,
  642. [PMIF_MONITOR_RECORD_8_0] = 0x0598,
  643. [PMIF_MONITOR_RECORD_8_1] = 0x059C,
  644. [PMIF_MONITOR_RECORD_8_2] = 0x05A0,
  645. [PMIF_MONITOR_RECORD_8_3] = 0x05A4,
  646. [PMIF_MONITOR_RECORD_8_4] = 0x05A8,
  647. [PMIF_MONITOR_RECORD_9_0] = 0x05AC,
  648. [PMIF_MONITOR_RECORD_9_1] = 0x05B0,
  649. [PMIF_MONITOR_RECORD_9_2] = 0x05B4,
  650. [PMIF_MONITOR_RECORD_9_3] = 0x05B8,
  651. [PMIF_MONITOR_RECORD_9_4] = 0x05BC,
  652. [PMIF_MONITOR_RECORD_10_0] = 0x05C0,
  653. [PMIF_MONITOR_RECORD_10_1] = 0x05C4,
  654. [PMIF_MONITOR_RECORD_10_2] = 0x05C8,
  655. [PMIF_MONITOR_RECORD_10_3] = 0x05CC,
  656. [PMIF_MONITOR_RECORD_10_4] = 0x05D0,
  657. [PMIF_MONITOR_RECORD_11_0] = 0x05D4,
  658. [PMIF_MONITOR_RECORD_11_1] = 0x05D8,
  659. [PMIF_MONITOR_RECORD_11_2] = 0x05DC,
  660. [PMIF_MONITOR_RECORD_11_3] = 0x05E0,
  661. [PMIF_MONITOR_RECORD_11_4] = 0x05E4,
  662. [PMIF_MONITOR_RECORD_12_0] = 0x05E8,
  663. [PMIF_MONITOR_RECORD_12_1] = 0x05EC,
  664. [PMIF_MONITOR_RECORD_12_2] = 0x05F0,
  665. [PMIF_MONITOR_RECORD_12_3] = 0x05F4,
  666. [PMIF_MONITOR_RECORD_12_4] = 0x05F8,
  667. [PMIF_MONITOR_RECORD_13_0] = 0x05FC,
  668. [PMIF_MONITOR_RECORD_13_1] = 0x0600,
  669. [PMIF_MONITOR_RECORD_13_2] = 0x0604,
  670. [PMIF_MONITOR_RECORD_13_3] = 0x0608,
  671. [PMIF_MONITOR_RECORD_13_4] = 0x060C,
  672. [PMIF_MONITOR_RECORD_14_0] = 0x0610,
  673. [PMIF_MONITOR_RECORD_14_1] = 0x0614,
  674. [PMIF_MONITOR_RECORD_14_2] = 0x0618,
  675. [PMIF_MONITOR_RECORD_14_3] = 0x061C,
  676. [PMIF_MONITOR_RECORD_14_4] = 0x0620,
  677. [PMIF_MONITOR_RECORD_15_0] = 0x0624,
  678. [PMIF_MONITOR_RECORD_15_1] = 0x0628,
  679. [PMIF_MONITOR_RECORD_15_2] = 0x062C,
  680. [PMIF_MONITOR_RECORD_15_3] = 0x0630,
  681. [PMIF_MONITOR_RECORD_15_4] = 0x0634,
  682. [PMIF_MONITOR_RECORD_16_0] = 0x0638,
  683. [PMIF_MONITOR_RECORD_16_1] = 0x063C,
  684. [PMIF_MONITOR_RECORD_16_2] = 0x0640,
  685. [PMIF_MONITOR_RECORD_16_3] = 0x0644,
  686. [PMIF_MONITOR_RECORD_16_4] = 0x0648,
  687. [PMIF_MONITOR_RECORD_17_0] = 0x064C,
  688. [PMIF_MONITOR_RECORD_17_1] = 0x0650,
  689. [PMIF_MONITOR_RECORD_17_2] = 0x0654,
  690. [PMIF_MONITOR_RECORD_17_3] = 0x0658,
  691. [PMIF_MONITOR_RECORD_17_4] = 0x065C,
  692. [PMIF_MONITOR_RECORD_18_0] = 0x0660,
  693. [PMIF_MONITOR_RECORD_18_1] = 0x0664,
  694. [PMIF_MONITOR_RECORD_18_2] = 0x0668,
  695. [PMIF_MONITOR_RECORD_18_3] = 0x066C,
  696. [PMIF_MONITOR_RECORD_18_4] = 0x0670,
  697. [PMIF_MONITOR_RECORD_19_0] = 0x0674,
  698. [PMIF_MONITOR_RECORD_19_1] = 0x0678,
  699. [PMIF_MONITOR_RECORD_19_2] = 0x067C,
  700. [PMIF_MONITOR_RECORD_19_3] = 0x0680,
  701. [PMIF_MONITOR_RECORD_19_4] = 0x0684,
  702. [PMIF_MONITOR_RECORD_20_0] = 0x0688,
  703. [PMIF_MONITOR_RECORD_20_1] = 0x068C,
  704. [PMIF_MONITOR_RECORD_20_2] = 0x0690,
  705. [PMIF_MONITOR_RECORD_20_3] = 0x0694,
  706. [PMIF_MONITOR_RECORD_20_4] = 0x0698,
  707. [PMIF_MONITOR_RECORD_21_0] = 0x069C,
  708. [PMIF_MONITOR_RECORD_21_1] = 0x06A0,
  709. [PMIF_MONITOR_RECORD_21_2] = 0x06A4,
  710. [PMIF_MONITOR_RECORD_21_3] = 0x06A8,
  711. [PMIF_MONITOR_RECORD_21_4] = 0x06AC,
  712. [PMIF_MONITOR_RECORD_22_0] = 0x06B0,
  713. [PMIF_MONITOR_RECORD_22_1] = 0x06B4,
  714. [PMIF_MONITOR_RECORD_22_2] = 0x06B8,
  715. [PMIF_MONITOR_RECORD_22_3] = 0x06BC,
  716. [PMIF_MONITOR_RECORD_22_4] = 0x06C0,
  717. [PMIF_MONITOR_RECORD_23_0] = 0x06C4,
  718. [PMIF_MONITOR_RECORD_23_1] = 0x06C8,
  719. [PMIF_MONITOR_RECORD_23_2] = 0x06CC,
  720. [PMIF_MONITOR_RECORD_23_3] = 0x06D0,
  721. [PMIF_MONITOR_RECORD_23_4] = 0x06D4,
  722. [PMIF_MONITOR_RECORD_24_0] = 0x06D8,
  723. [PMIF_MONITOR_RECORD_24_1] = 0x06DC,
  724. [PMIF_MONITOR_RECORD_24_2] = 0x06E0,
  725. [PMIF_MONITOR_RECORD_24_3] = 0x06E4,
  726. [PMIF_MONITOR_RECORD_24_4] = 0x06E8,
  727. [PMIF_MONITOR_RECORD_25_0] = 0x06EC,
  728. [PMIF_MONITOR_RECORD_25_1] = 0x06F0,
  729. [PMIF_MONITOR_RECORD_25_2] = 0x06F4,
  730. [PMIF_MONITOR_RECORD_25_3] = 0x06F8,
  731. [PMIF_MONITOR_RECORD_25_4] = 0x06FC,
  732. [PMIF_MONITOR_RECORD_26_0] = 0x0700,
  733. [PMIF_MONITOR_RECORD_26_1] = 0x0704,
  734. [PMIF_MONITOR_RECORD_26_2] = 0x0708,
  735. [PMIF_MONITOR_RECORD_26_3] = 0x070C,
  736. [PMIF_MONITOR_RECORD_26_4] = 0x0710,
  737. [PMIF_MONITOR_RECORD_27_0] = 0x0714,
  738. [PMIF_MONITOR_RECORD_27_1] = 0x0718,
  739. [PMIF_MONITOR_RECORD_27_2] = 0x071C,
  740. [PMIF_MONITOR_RECORD_27_3] = 0x0720,
  741. [PMIF_MONITOR_RECORD_27_4] = 0x0724,
  742. [PMIF_MONITOR_RECORD_28_0] = 0x0728,
  743. [PMIF_MONITOR_RECORD_28_1] = 0x072C,
  744. [PMIF_MONITOR_RECORD_28_2] = 0x0730,
  745. [PMIF_MONITOR_RECORD_28_3] = 0x0734,
  746. [PMIF_MONITOR_RECORD_28_4] = 0x0738,
  747. [PMIF_MONITOR_RECORD_29_0] = 0x073C,
  748. [PMIF_MONITOR_RECORD_29_1] = 0x0740,
  749. [PMIF_MONITOR_RECORD_29_2] = 0x0744,
  750. [PMIF_MONITOR_RECORD_29_3] = 0x0748,
  751. [PMIF_MONITOR_RECORD_29_4] = 0x074C,
  752. [PMIF_MONITOR_RECORD_30_0] = 0x0750,
  753. [PMIF_MONITOR_RECORD_30_1] = 0x0754,
  754. [PMIF_MONITOR_RECORD_30_2] = 0x0758,
  755. [PMIF_MONITOR_RECORD_30_3] = 0x075C,
  756. [PMIF_MONITOR_RECORD_30_4] = 0x0760,
  757. [PMIF_MONITOR_RECORD_31_0] = 0x0764,
  758. [PMIF_MONITOR_RECORD_31_1] = 0x0768,
  759. [PMIF_MONITOR_RECORD_31_2] = 0x076C,
  760. [PMIF_MONITOR_RECORD_31_3] = 0x0770,
  761. [PMIF_MONITOR_RECORD_31_4] = 0x0774,
  762. [PMIF_DEBUG_CTRL] = 0x0778,
  763. [PMIF_RESERVED_0] = 0x0780,
  764. [PMIF_SWINF_0_ACC] = 0x0800,
  765. [PMIF_SWINF_0_WDATA_31_0] = 0x0804,
  766. [PMIF_SWINF_0_RDATA_31_0] = 0x0814,
  767. [PMIF_SWINF_0_VLD_CLR] = 0x0824,
  768. [PMIF_SWINF_0_STA] = 0x0828,
  769. [PMIF_SWINF_1_ACC] = 0x0840,
  770. [PMIF_SWINF_1_WDATA_31_0] = 0x0844,
  771. [PMIF_SWINF_1_RDATA_31_0] = 0x0854,
  772. [PMIF_SWINF_1_VLD_CLR] = 0x0864,
  773. [PMIF_SWINF_1_STA] = 0x0868,
  774. [PMIF_SWINF_2_ACC] = 0x0880,
  775. [PMIF_SWINF_2_WDATA_31_0] = 0x0884,
  776. [PMIF_SWINF_2_RDATA_31_0] = 0x0894,
  777. [PMIF_SWINF_2_VLD_CLR] = 0x08A4,
  778. [PMIF_SWINF_2_STA] = 0x08A8,
  779. [PMIF_SWINF_3_ACC] = 0x08C0,
  780. [PMIF_SWINF_3_WDATA_31_0] = 0x08C4,
  781. [PMIF_SWINF_3_RDATA_31_0] = 0x08D4,
  782. [PMIF_SWINF_3_VLD_CLR] = 0x08E4,
  783. [PMIF_SWINF_3_STA] = 0x08E8,
  784. [PMIC_ACC_VIO_INFO_0] = 0x0950,
  785. [PMIC_ACC_VIO_INFO_1] = 0x0954,
  786. [PMIC_ACC_VIO_INFO_2] = 0x0958,
  787. [PMIC_ACC_VIO_INFO_3] = 0x095C,
  788. [PMIC_ACC_VIO_INFO_4] = 0x0960,
  789. [PMIC_ACC_VIO_INFO_5] = 0x0964,
  790. [PMIC_ACC_SCP_VIO_INFO_0] = 0x0968,
  791. [PMIC_ACC_SCP_VIO_INFO_1] = 0x096C,
  792. [PMIC_ACC_SCP_VIO_INFO_2] = 0x0970,
  793. [PMIC_ACC_SCP_VIO_INFO_3] = 0x0974,
  794. [PMIC_ACC_SCP_VIO_INFO_4] = 0x0978,
  795. [PMIC_ACC_SCP_VIO_INFO_5] = 0x097C,
  796. [PMIF_ACC_VIO_INFO_0] = 0x0980,
  797. [PMIF_ACC_VIO_INFO_1] = 0x0984,
  798. [PMIF_ACC_VIO_INFO_2] = 0x0988,
  799. [PMIC_ALL_ACC_VIO_INFO_0] = 0x09A4,
  800. [PMIC_ALL_ACC_VIO_INFO_1] = 0x09A8,
  801. };
  802. static const u32 mt6853_pmif_dbg_regs[] = {
  803. [PMIF_INIT_DONE] = 0x0000,
  804. [PMIF_INF_BUSY_STA] = 0x0018,
  805. [PMIF_OTHER_BUSY_STA_0] = 0x001C,
  806. [PMIF_OTHER_BUSY_STA_1] = 0x0020,
  807. [PMIF_IRQ_EVENT_EN_0] = 0x0420,
  808. [PMIF_IRQ_FLAG_0] = 0x0428,
  809. [PMIF_IRQ_CLR_0] = 0x042C,
  810. [PMIF_IRQ_EVENT_EN_1] = 0x0430,
  811. [PMIF_IRQ_FLAG_1] = 0x0438,
  812. [PMIF_IRQ_CLR_1] = 0x043C,
  813. [PMIF_IRQ_EVENT_EN_2] = 0x0440,
  814. [PMIF_IRQ_FLAG_2] = 0x0448,
  815. [PMIF_IRQ_CLR_2] = 0x044C,
  816. [PMIF_IRQ_EVENT_EN_3] = 0x0450,
  817. [PMIF_IRQ_FLAG_3] = 0x0458,
  818. [PMIF_IRQ_CLR_3] = 0x045C,
  819. [PMIF_IRQ_EVENT_EN_4] = 0x0460,
  820. [PMIF_IRQ_FLAG_4] = 0x0468,
  821. [PMIF_IRQ_CLR_4] = 0x046C,
  822. [PMIF_WDT_EVENT_EN_0] = 0x0474,
  823. [PMIF_WDT_FLAG_0] = 0x0478,
  824. [PMIF_WDT_EVENT_EN_1] = 0x047C,
  825. [PMIF_WDT_FLAG_1] = 0x0480,
  826. [PMIF_MONITOR_CTRL] = 0x0484,
  827. [PMIF_MONITOR_TARGET_CHAN_0] = 0x0488,
  828. [PMIF_MONITOR_TARGET_CHAN_1] = 0x048C,
  829. [PMIF_MONITOR_TARGET_CHAN_2] = 0x0490,
  830. [PMIF_MONITOR_TARGET_CHAN_3] = 0x0494,
  831. [PMIF_MONITOR_TARGET_CHAN_4] = 0x0498,
  832. [PMIF_MONITOR_TARGET_CHAN_5] = 0x049C,
  833. [PMIF_MONITOR_TARGET_CHAN_6] = 0x04A0,
  834. [PMIF_MONITOR_TARGET_CHAN_7] = 0x04A4,
  835. [PMIF_MONITOR_TARGET_WRITE] = 0x04A8,
  836. [PMIF_MONITOR_TARGET_SLVID_0] = 0x04AC,
  837. [PMIF_MONITOR_TARGET_SLVID_1] = 0x04B0,
  838. [PMIF_MONITOR_TARGET_ADDR_0] = 0x04B4,
  839. [PMIF_MONITOR_TARGET_ADDR_1] = 0x04B8,
  840. [PMIF_MONITOR_TARGET_ADDR_2] = 0x04BC,
  841. [PMIF_MONITOR_TARGET_ADDR_3] = 0x04C0,
  842. [PMIF_MONITOR_TARGET_ADDR_4] = 0x04C4,
  843. [PMIF_MONITOR_TARGET_ADDR_5] = 0x04C8,
  844. [PMIF_MONITOR_TARGET_ADDR_6] = 0x04CC,
  845. [PMIF_MONITOR_TARGET_ADDR_7] = 0x04D0,
  846. [PMIF_MONITOR_TARGET_WDATA_0] = 0x04D4,
  847. [PMIF_MONITOR_TARGET_WDATA_1] = 0x04D8,
  848. [PMIF_MONITOR_TARGET_WDATA_2] = 0x04DC,
  849. [PMIF_MONITOR_TARGET_WDATA_3] = 0x04E0,
  850. [PMIF_MONITOR_TARGET_WDATA_4] = 0x04E4,
  851. [PMIF_MONITOR_TARGET_WDATA_5] = 0x04E8,
  852. [PMIF_MONITOR_TARGET_WDATA_6] = 0x04EC,
  853. [PMIF_MONITOR_TARGET_WDATA_7] = 0x04F0,
  854. [PMIF_MONITOR_STA] = 0x04F4,
  855. [PMIF_MONITOR_RECORD_0_0] = 0x04F8,
  856. [PMIF_MONITOR_RECORD_0_1] = 0x04FC,
  857. [PMIF_MONITOR_RECORD_0_2] = 0x0500,
  858. [PMIF_MONITOR_RECORD_0_3] = 0x0504,
  859. [PMIF_MONITOR_RECORD_0_4] = 0x0508,
  860. [PMIF_MONITOR_RECORD_1_0] = 0x050C,
  861. [PMIF_MONITOR_RECORD_1_1] = 0x0510,
  862. [PMIF_MONITOR_RECORD_1_2] = 0x0514,
  863. [PMIF_MONITOR_RECORD_1_3] = 0x0518,
  864. [PMIF_MONITOR_RECORD_1_4] = 0x051C,
  865. [PMIF_MONITOR_RECORD_2_0] = 0x0520,
  866. [PMIF_MONITOR_RECORD_2_1] = 0x0524,
  867. [PMIF_MONITOR_RECORD_2_2] = 0x0528,
  868. [PMIF_MONITOR_RECORD_2_3] = 0x052C,
  869. [PMIF_MONITOR_RECORD_2_4] = 0x0530,
  870. [PMIF_MONITOR_RECORD_3_0] = 0x0534,
  871. [PMIF_MONITOR_RECORD_3_1] = 0x0538,
  872. [PMIF_MONITOR_RECORD_3_2] = 0x053C,
  873. [PMIF_MONITOR_RECORD_3_3] = 0x0540,
  874. [PMIF_MONITOR_RECORD_3_4] = 0x0544,
  875. [PMIF_MONITOR_RECORD_4_0] = 0x0548,
  876. [PMIF_MONITOR_RECORD_4_1] = 0x054C,
  877. [PMIF_MONITOR_RECORD_4_2] = 0x0550,
  878. [PMIF_MONITOR_RECORD_4_3] = 0x0554,
  879. [PMIF_MONITOR_RECORD_4_4] = 0x0558,
  880. [PMIF_MONITOR_RECORD_5_0] = 0x055C,
  881. [PMIF_MONITOR_RECORD_5_1] = 0x0560,
  882. [PMIF_MONITOR_RECORD_5_2] = 0x0564,
  883. [PMIF_MONITOR_RECORD_5_3] = 0x0568,
  884. [PMIF_MONITOR_RECORD_5_4] = 0x056C,
  885. [PMIF_MONITOR_RECORD_6_0] = 0x0570,
  886. [PMIF_MONITOR_RECORD_6_1] = 0x0574,
  887. [PMIF_MONITOR_RECORD_6_2] = 0x0578,
  888. [PMIF_MONITOR_RECORD_6_3] = 0x057C,
  889. [PMIF_MONITOR_RECORD_6_4] = 0x0580,
  890. [PMIF_MONITOR_RECORD_7_0] = 0x0584,
  891. [PMIF_MONITOR_RECORD_7_1] = 0x0588,
  892. [PMIF_MONITOR_RECORD_7_2] = 0x058C,
  893. [PMIF_MONITOR_RECORD_7_3] = 0x0590,
  894. [PMIF_MONITOR_RECORD_7_4] = 0x0594,
  895. [PMIF_MONITOR_RECORD_8_0] = 0x0598,
  896. [PMIF_MONITOR_RECORD_8_1] = 0x059C,
  897. [PMIF_MONITOR_RECORD_8_2] = 0x05A0,
  898. [PMIF_MONITOR_RECORD_8_3] = 0x05A4,
  899. [PMIF_MONITOR_RECORD_8_4] = 0x05A8,
  900. [PMIF_MONITOR_RECORD_9_0] = 0x05AC,
  901. [PMIF_MONITOR_RECORD_9_1] = 0x05B0,
  902. [PMIF_MONITOR_RECORD_9_2] = 0x05B4,
  903. [PMIF_MONITOR_RECORD_9_3] = 0x05B8,
  904. [PMIF_MONITOR_RECORD_9_4] = 0x05BC,
  905. [PMIF_MONITOR_RECORD_10_0] = 0x05C0,
  906. [PMIF_MONITOR_RECORD_10_1] = 0x05C4,
  907. [PMIF_MONITOR_RECORD_10_2] = 0x05C8,
  908. [PMIF_MONITOR_RECORD_10_3] = 0x05CC,
  909. [PMIF_MONITOR_RECORD_10_4] = 0x05D0,
  910. [PMIF_MONITOR_RECORD_11_0] = 0x05D4,
  911. [PMIF_MONITOR_RECORD_11_1] = 0x05D8,
  912. [PMIF_MONITOR_RECORD_11_2] = 0x05DC,
  913. [PMIF_MONITOR_RECORD_11_3] = 0x05E0,
  914. [PMIF_MONITOR_RECORD_11_4] = 0x05E4,
  915. [PMIF_MONITOR_RECORD_12_0] = 0x05E8,
  916. [PMIF_MONITOR_RECORD_12_1] = 0x05EC,
  917. [PMIF_MONITOR_RECORD_12_2] = 0x05F0,
  918. [PMIF_MONITOR_RECORD_12_3] = 0x05F4,
  919. [PMIF_MONITOR_RECORD_12_4] = 0x05F8,
  920. [PMIF_MONITOR_RECORD_13_0] = 0x05FC,
  921. [PMIF_MONITOR_RECORD_13_1] = 0x0600,
  922. [PMIF_MONITOR_RECORD_13_2] = 0x0604,
  923. [PMIF_MONITOR_RECORD_13_3] = 0x0608,
  924. [PMIF_MONITOR_RECORD_13_4] = 0x060C,
  925. [PMIF_MONITOR_RECORD_14_0] = 0x0610,
  926. [PMIF_MONITOR_RECORD_14_1] = 0x0614,
  927. [PMIF_MONITOR_RECORD_14_2] = 0x0618,
  928. [PMIF_MONITOR_RECORD_14_3] = 0x061C,
  929. [PMIF_MONITOR_RECORD_14_4] = 0x0620,
  930. [PMIF_MONITOR_RECORD_15_0] = 0x0624,
  931. [PMIF_MONITOR_RECORD_15_1] = 0x0628,
  932. [PMIF_MONITOR_RECORD_15_2] = 0x062C,
  933. [PMIF_MONITOR_RECORD_15_3] = 0x0630,
  934. [PMIF_MONITOR_RECORD_15_4] = 0x0634,
  935. [PMIF_MONITOR_RECORD_16_0] = 0x0638,
  936. [PMIF_MONITOR_RECORD_16_1] = 0x063C,
  937. [PMIF_MONITOR_RECORD_16_2] = 0x0640,
  938. [PMIF_MONITOR_RECORD_16_3] = 0x0644,
  939. [PMIF_MONITOR_RECORD_16_4] = 0x0648,
  940. [PMIF_MONITOR_RECORD_17_0] = 0x064C,
  941. [PMIF_MONITOR_RECORD_17_1] = 0x0650,
  942. [PMIF_MONITOR_RECORD_17_2] = 0x0654,
  943. [PMIF_MONITOR_RECORD_17_3] = 0x0658,
  944. [PMIF_MONITOR_RECORD_17_4] = 0x065C,
  945. [PMIF_MONITOR_RECORD_18_0] = 0x0660,
  946. [PMIF_MONITOR_RECORD_18_1] = 0x0664,
  947. [PMIF_MONITOR_RECORD_18_2] = 0x0668,
  948. [PMIF_MONITOR_RECORD_18_3] = 0x066C,
  949. [PMIF_MONITOR_RECORD_18_4] = 0x0670,
  950. [PMIF_MONITOR_RECORD_19_0] = 0x0674,
  951. [PMIF_MONITOR_RECORD_19_1] = 0x0678,
  952. [PMIF_MONITOR_RECORD_19_2] = 0x067C,
  953. [PMIF_MONITOR_RECORD_19_3] = 0x0680,
  954. [PMIF_MONITOR_RECORD_19_4] = 0x0684,
  955. [PMIF_MONITOR_RECORD_20_0] = 0x0688,
  956. [PMIF_MONITOR_RECORD_20_1] = 0x068C,
  957. [PMIF_MONITOR_RECORD_20_2] = 0x0690,
  958. [PMIF_MONITOR_RECORD_20_3] = 0x0694,
  959. [PMIF_MONITOR_RECORD_20_4] = 0x0698,
  960. [PMIF_MONITOR_RECORD_21_0] = 0x069C,
  961. [PMIF_MONITOR_RECORD_21_1] = 0x06A0,
  962. [PMIF_MONITOR_RECORD_21_2] = 0x06A4,
  963. [PMIF_MONITOR_RECORD_21_3] = 0x06A8,
  964. [PMIF_MONITOR_RECORD_21_4] = 0x06AC,
  965. [PMIF_MONITOR_RECORD_22_0] = 0x06B0,
  966. [PMIF_MONITOR_RECORD_22_1] = 0x06B4,
  967. [PMIF_MONITOR_RECORD_22_2] = 0x06B8,
  968. [PMIF_MONITOR_RECORD_22_3] = 0x06BC,
  969. [PMIF_MONITOR_RECORD_22_4] = 0x06C0,
  970. [PMIF_MONITOR_RECORD_23_0] = 0x06C4,
  971. [PMIF_MONITOR_RECORD_23_1] = 0x06C8,
  972. [PMIF_MONITOR_RECORD_23_2] = 0x06CC,
  973. [PMIF_MONITOR_RECORD_23_3] = 0x06D0,
  974. [PMIF_MONITOR_RECORD_23_4] = 0x06D4,
  975. [PMIF_MONITOR_RECORD_24_0] = 0x06D8,
  976. [PMIF_MONITOR_RECORD_24_1] = 0x06DC,
  977. [PMIF_MONITOR_RECORD_24_2] = 0x06E0,
  978. [PMIF_MONITOR_RECORD_24_3] = 0x06E4,
  979. [PMIF_MONITOR_RECORD_24_4] = 0x06E8,
  980. [PMIF_MONITOR_RECORD_25_0] = 0x06EC,
  981. [PMIF_MONITOR_RECORD_25_1] = 0x06F0,
  982. [PMIF_MONITOR_RECORD_25_2] = 0x06F4,
  983. [PMIF_MONITOR_RECORD_25_3] = 0x06F8,
  984. [PMIF_MONITOR_RECORD_25_4] = 0x06FC,
  985. [PMIF_MONITOR_RECORD_26_0] = 0x0700,
  986. [PMIF_MONITOR_RECORD_26_1] = 0x0704,
  987. [PMIF_MONITOR_RECORD_26_2] = 0x0708,
  988. [PMIF_MONITOR_RECORD_26_3] = 0x070C,
  989. [PMIF_MONITOR_RECORD_26_4] = 0x0710,
  990. [PMIF_MONITOR_RECORD_27_0] = 0x0714,
  991. [PMIF_MONITOR_RECORD_27_1] = 0x0718,
  992. [PMIF_MONITOR_RECORD_27_2] = 0x071C,
  993. [PMIF_MONITOR_RECORD_27_3] = 0x0720,
  994. [PMIF_MONITOR_RECORD_27_4] = 0x0724,
  995. [PMIF_MONITOR_RECORD_28_0] = 0x0728,
  996. [PMIF_MONITOR_RECORD_28_1] = 0x072C,
  997. [PMIF_MONITOR_RECORD_28_2] = 0x0730,
  998. [PMIF_MONITOR_RECORD_28_3] = 0x0734,
  999. [PMIF_MONITOR_RECORD_28_4] = 0x0738,
  1000. [PMIF_MONITOR_RECORD_29_0] = 0x073C,
  1001. [PMIF_MONITOR_RECORD_29_1] = 0x0740,
  1002. [PMIF_MONITOR_RECORD_29_2] = 0x0744,
  1003. [PMIF_MONITOR_RECORD_29_3] = 0x0748,
  1004. [PMIF_MONITOR_RECORD_29_4] = 0x074C,
  1005. [PMIF_MONITOR_RECORD_30_0] = 0x0750,
  1006. [PMIF_MONITOR_RECORD_30_1] = 0x0754,
  1007. [PMIF_MONITOR_RECORD_30_2] = 0x0758,
  1008. [PMIF_MONITOR_RECORD_30_3] = 0x075C,
  1009. [PMIF_MONITOR_RECORD_30_4] = 0x0760,
  1010. [PMIF_MONITOR_RECORD_31_0] = 0x0764,
  1011. [PMIF_MONITOR_RECORD_31_1] = 0x0768,
  1012. [PMIF_MONITOR_RECORD_31_2] = 0x076C,
  1013. [PMIF_MONITOR_RECORD_31_3] = 0x0770,
  1014. [PMIF_MONITOR_RECORD_31_4] = 0x0774,
  1015. [PMIF_DEBUG_CTRL] = 0x0778,
  1016. [PMIF_RESERVED_0] = 0x0780,
  1017. [PMIF_SWINF_0_ACC] = 0x0C00,
  1018. [PMIF_SWINF_0_WDATA_31_0] = 0x0C04,
  1019. [PMIF_SWINF_0_WDATA_63_32] = 0x0C08,
  1020. [PMIF_SWINF_0_RDATA_31_0] = 0x0C14,
  1021. [PMIF_SWINF_0_RDATA_63_32] = 0x0C18,
  1022. [PMIF_SWINF_0_VLD_CLR] = 0x0C24,
  1023. [PMIF_SWINF_0_STA] = 0x0C28,
  1024. [PMIF_SWINF_1_ACC] = 0x0C40,
  1025. [PMIF_SWINF_1_WDATA_31_0] = 0x0C44,
  1026. [PMIF_SWINF_1_WDATA_63_32] = 0x0C48,
  1027. [PMIF_SWINF_1_RDATA_31_0] = 0x0C54,
  1028. [PMIF_SWINF_1_RDATA_63_32] = 0x0C58,
  1029. [PMIF_SWINF_1_VLD_CLR] = 0x0C64,
  1030. [PMIF_SWINF_1_STA] = 0x0C68,
  1031. [PMIF_SWINF_2_ACC] = 0x0C80,
  1032. [PMIF_SWINF_2_WDATA_31_0] = 0x0C84,
  1033. [PMIF_SWINF_2_WDATA_63_32] = 0x0C88,
  1034. [PMIF_SWINF_2_RDATA_31_0] = 0x0C94,
  1035. [PMIF_SWINF_2_RDATA_63_32] = 0x0C98,
  1036. [PMIF_SWINF_2_VLD_CLR] = 0x0CA4,
  1037. [PMIF_SWINF_2_STA] = 0x0CA8,
  1038. [PMIF_SWINF_3_ACC] = 0x0CC0,
  1039. [PMIF_SWINF_3_WDATA_31_0] = 0x0CC4,
  1040. [PMIF_SWINF_3_WDATA_63_32] = 0x0CC8,
  1041. [PMIF_SWINF_3_RDATA_31_0] = 0x0CD4,
  1042. [PMIF_SWINF_3_RDATA_63_32] = 0x0CD8,
  1043. [PMIF_SWINF_3_VLD_CLR] = 0x0CE4,
  1044. [PMIF_SWINF_3_STA] = 0x0CE8,
  1045. [PMIC_ACC_VIO_INFO_0] = 0x0F50,
  1046. [PMIC_ACC_VIO_INFO_1] = 0x0F54,
  1047. [PMIC_ACC_VIO_INFO_2] = 0x0F58,
  1048. [PMIC_ACC_VIO_INFO_3] = 0x0F5C,
  1049. [PMIC_ACC_VIO_INFO_4] = 0x0F60,
  1050. [PMIC_ACC_VIO_INFO_5] = 0x0F64,
  1051. [PMIC_ACC_SCP_VIO_INFO_0] = 0x0F68,
  1052. [PMIC_ACC_SCP_VIO_INFO_1] = 0x0F6C,
  1053. [PMIC_ACC_SCP_VIO_INFO_2] = 0x0F70,
  1054. [PMIC_ACC_SCP_VIO_INFO_3] = 0x0F74,
  1055. [PMIC_ACC_SCP_VIO_INFO_4] = 0x0F78,
  1056. [PMIC_ACC_SCP_VIO_INFO_5] = 0x0F7C,
  1057. [PMIF_ACC_VIO_INFO_0] = 0x0F80,
  1058. [PMIF_ACC_VIO_INFO_1] = 0x0F84,
  1059. [PMIF_ACC_VIO_INFO_2] = 0x0F88,
  1060. [PMIC_ALL_ACC_VIO_INFO_0] = 0x0F8C,
  1061. [PMIC_ALL_ACC_VIO_INFO_1] = 0x0F90,
  1062. };
  1063. static const u32 mt6885_pmif_dbg_regs[] = {
  1064. [PMIF_INIT_DONE] = 0x0000,
  1065. [PMIF_INF_BUSY_STA] = 0x0018,
  1066. [PMIF_OTHER_BUSY_STA_0] = 0x001C,
  1067. [PMIF_OTHER_BUSY_STA_1] = 0x0020,
  1068. [PMIF_IRQ_EVENT_EN_0] = 0x0418,
  1069. [PMIF_IRQ_FLAG_0] = 0x0420,
  1070. [PMIF_IRQ_CLR_0] = 0x0424,
  1071. [PMIF_IRQ_EVENT_EN_1] = 0x0428,
  1072. [PMIF_IRQ_FLAG_1] = 0x0430,
  1073. [PMIF_IRQ_CLR_1] = 0x0434,
  1074. [PMIF_IRQ_EVENT_EN_2] = 0x0438,
  1075. [PMIF_IRQ_FLAG_2] = 0x0440,
  1076. [PMIF_IRQ_CLR_2] = 0x0444,
  1077. [PMIF_IRQ_EVENT_EN_3] = 0x0448,
  1078. [PMIF_IRQ_FLAG_3] = 0x0450,
  1079. [PMIF_IRQ_CLR_3] = 0x0454,
  1080. [PMIF_IRQ_EVENT_EN_4] = 0x0458,
  1081. [PMIF_IRQ_FLAG_4] = 0x0460,
  1082. [PMIF_IRQ_CLR_4] = 0x0464,
  1083. [PMIF_WDT_EVENT_EN_0] = 0x046C,
  1084. [PMIF_WDT_FLAG_0] = 0x0470,
  1085. [PMIF_WDT_EVENT_EN_1] = 0x0474,
  1086. [PMIF_WDT_FLAG_1] = 0x0478,
  1087. [PMIF_MONITOR_CTRL] = 0x047C,
  1088. [PMIF_MONITOR_TARGET_CHAN_0] = 0x0480,
  1089. [PMIF_MONITOR_TARGET_CHAN_1] = 0x0484,
  1090. [PMIF_MONITOR_TARGET_CHAN_2] = 0x0488,
  1091. [PMIF_MONITOR_TARGET_CHAN_3] = 0x048C,
  1092. [PMIF_MONITOR_TARGET_CHAN_4] = 0x0490,
  1093. [PMIF_MONITOR_TARGET_CHAN_5] = 0x0494,
  1094. [PMIF_MONITOR_TARGET_CHAN_6] = 0x0498,
  1095. [PMIF_MONITOR_TARGET_CHAN_7] = 0x049C,
  1096. [PMIF_MONITOR_TARGET_WRITE] = 0x04A0,
  1097. [PMIF_MONITOR_TARGET_ADDR_0] = 0x04A4,
  1098. [PMIF_MONITOR_TARGET_ADDR_1] = 0x04A8,
  1099. [PMIF_MONITOR_TARGET_ADDR_2] = 0x04AC,
  1100. [PMIF_MONITOR_TARGET_ADDR_3] = 0x04B0,
  1101. [PMIF_MONITOR_TARGET_ADDR_4] = 0x04B4,
  1102. [PMIF_MONITOR_TARGET_ADDR_5] = 0x04B8,
  1103. [PMIF_MONITOR_TARGET_ADDR_6] = 0x04BC,
  1104. [PMIF_MONITOR_TARGET_ADDR_7] = 0x04C0,
  1105. [PMIF_MONITOR_TARGET_WDATA_0] = 0x04C4,
  1106. [PMIF_MONITOR_TARGET_WDATA_1] = 0x04C8,
  1107. [PMIF_MONITOR_TARGET_WDATA_2] = 0x04CC,
  1108. [PMIF_MONITOR_TARGET_WDATA_3] = 0x04D0,
  1109. [PMIF_MONITOR_TARGET_WDATA_4] = 0x04D4,
  1110. [PMIF_MONITOR_TARGET_WDATA_5] = 0x04D8,
  1111. [PMIF_MONITOR_TARGET_WDATA_6] = 0x04DC,
  1112. [PMIF_MONITOR_TARGET_WDATA_7] = 0x04E0,
  1113. [PMIF_MONITOR_STA] = 0x04E4,
  1114. [PMIF_MONITOR_RECORD_0_0] = 0x04E8,
  1115. [PMIF_MONITOR_RECORD_0_1] = 0x04EC,
  1116. [PMIF_MONITOR_RECORD_0_2] = 0x04F0,
  1117. [PMIF_MONITOR_RECORD_0_3] = 0x04F4,
  1118. [PMIF_MONITOR_RECORD_0_4] = 0x04F8,
  1119. [PMIF_MONITOR_RECORD_1_0] = 0x04FC,
  1120. [PMIF_MONITOR_RECORD_1_1] = 0x0500,
  1121. [PMIF_MONITOR_RECORD_1_2] = 0x0504,
  1122. [PMIF_MONITOR_RECORD_1_3] = 0x0508,
  1123. [PMIF_MONITOR_RECORD_1_4] = 0x050C,
  1124. [PMIF_MONITOR_RECORD_2_0] = 0x0510,
  1125. [PMIF_MONITOR_RECORD_2_1] = 0x0514,
  1126. [PMIF_MONITOR_RECORD_2_2] = 0x0518,
  1127. [PMIF_MONITOR_RECORD_2_3] = 0x051C,
  1128. [PMIF_MONITOR_RECORD_2_4] = 0x0520,
  1129. [PMIF_MONITOR_RECORD_3_0] = 0x0524,
  1130. [PMIF_MONITOR_RECORD_3_1] = 0x0528,
  1131. [PMIF_MONITOR_RECORD_3_2] = 0x052C,
  1132. [PMIF_MONITOR_RECORD_3_3] = 0x0530,
  1133. [PMIF_MONITOR_RECORD_3_4] = 0x0534,
  1134. [PMIF_MONITOR_RECORD_4_0] = 0x0538,
  1135. [PMIF_MONITOR_RECORD_4_1] = 0x053C,
  1136. [PMIF_MONITOR_RECORD_4_2] = 0x0540,
  1137. [PMIF_MONITOR_RECORD_4_3] = 0x0544,
  1138. [PMIF_MONITOR_RECORD_4_4] = 0x0548,
  1139. [PMIF_MONITOR_RECORD_5_0] = 0x054C,
  1140. [PMIF_MONITOR_RECORD_5_1] = 0x0550,
  1141. [PMIF_MONITOR_RECORD_5_2] = 0x0554,
  1142. [PMIF_MONITOR_RECORD_5_3] = 0x0558,
  1143. [PMIF_MONITOR_RECORD_5_4] = 0x055C,
  1144. [PMIF_MONITOR_RECORD_6_0] = 0x0560,
  1145. [PMIF_MONITOR_RECORD_6_1] = 0x0564,
  1146. [PMIF_MONITOR_RECORD_6_2] = 0x0568,
  1147. [PMIF_MONITOR_RECORD_6_3] = 0x056C,
  1148. [PMIF_MONITOR_RECORD_6_4] = 0x0570,
  1149. [PMIF_MONITOR_RECORD_7_0] = 0x0574,
  1150. [PMIF_MONITOR_RECORD_7_1] = 0x0578,
  1151. [PMIF_MONITOR_RECORD_7_2] = 0x057C,
  1152. [PMIF_MONITOR_RECORD_7_3] = 0x0580,
  1153. [PMIF_MONITOR_RECORD_7_4] = 0x0584,
  1154. [PMIF_MONITOR_RECORD_8_0] = 0x0588,
  1155. [PMIF_MONITOR_RECORD_8_1] = 0x058C,
  1156. [PMIF_MONITOR_RECORD_8_2] = 0x0590,
  1157. [PMIF_MONITOR_RECORD_8_3] = 0x0594,
  1158. [PMIF_MONITOR_RECORD_8_4] = 0x0598,
  1159. [PMIF_MONITOR_RECORD_9_0] = 0x059C,
  1160. [PMIF_MONITOR_RECORD_9_1] = 0x05A0,
  1161. [PMIF_MONITOR_RECORD_9_2] = 0x05A4,
  1162. [PMIF_MONITOR_RECORD_9_3] = 0x05A8,
  1163. [PMIF_MONITOR_RECORD_9_4] = 0x05AC,
  1164. [PMIF_MONITOR_RECORD_10_0] = 0x05B0,
  1165. [PMIF_MONITOR_RECORD_10_1] = 0x05B4,
  1166. [PMIF_MONITOR_RECORD_10_2] = 0x05B8,
  1167. [PMIF_MONITOR_RECORD_10_3] = 0x05BC,
  1168. [PMIF_MONITOR_RECORD_10_4] = 0x05C0,
  1169. [PMIF_MONITOR_RECORD_11_0] = 0x05C4,
  1170. [PMIF_MONITOR_RECORD_11_1] = 0x05C8,
  1171. [PMIF_MONITOR_RECORD_11_2] = 0x05CC,
  1172. [PMIF_MONITOR_RECORD_11_3] = 0x05D0,
  1173. [PMIF_MONITOR_RECORD_11_4] = 0x05D4,
  1174. [PMIF_MONITOR_RECORD_12_0] = 0x05D8,
  1175. [PMIF_MONITOR_RECORD_12_1] = 0x05DC,
  1176. [PMIF_MONITOR_RECORD_12_2] = 0x05E0,
  1177. [PMIF_MONITOR_RECORD_12_3] = 0x05E4,
  1178. [PMIF_MONITOR_RECORD_12_4] = 0x05E8,
  1179. [PMIF_MONITOR_RECORD_13_0] = 0x05EC,
  1180. [PMIF_MONITOR_RECORD_13_1] = 0x05F0,
  1181. [PMIF_MONITOR_RECORD_13_2] = 0x05F4,
  1182. [PMIF_MONITOR_RECORD_13_3] = 0x05F8,
  1183. [PMIF_MONITOR_RECORD_13_4] = 0x05FC,
  1184. [PMIF_MONITOR_RECORD_14_0] = 0x0600,
  1185. [PMIF_MONITOR_RECORD_14_1] = 0x0604,
  1186. [PMIF_MONITOR_RECORD_14_2] = 0x0608,
  1187. [PMIF_MONITOR_RECORD_14_3] = 0x060C,
  1188. [PMIF_MONITOR_RECORD_14_4] = 0x0610,
  1189. [PMIF_MONITOR_RECORD_15_0] = 0x0614,
  1190. [PMIF_MONITOR_RECORD_15_1] = 0x0618,
  1191. [PMIF_MONITOR_RECORD_15_2] = 0x061C,
  1192. [PMIF_MONITOR_RECORD_15_3] = 0x0620,
  1193. [PMIF_MONITOR_RECORD_15_4] = 0x0624,
  1194. [PMIF_MONITOR_RECORD_16_0] = 0x0628,
  1195. [PMIF_MONITOR_RECORD_16_1] = 0x062C,
  1196. [PMIF_MONITOR_RECORD_16_2] = 0x0630,
  1197. [PMIF_MONITOR_RECORD_16_3] = 0x0634,
  1198. [PMIF_MONITOR_RECORD_16_4] = 0x0638,
  1199. [PMIF_MONITOR_RECORD_17_0] = 0x063C,
  1200. [PMIF_MONITOR_RECORD_17_1] = 0x0640,
  1201. [PMIF_MONITOR_RECORD_17_2] = 0x0644,
  1202. [PMIF_MONITOR_RECORD_17_3] = 0x0648,
  1203. [PMIF_MONITOR_RECORD_17_4] = 0x064C,
  1204. [PMIF_MONITOR_RECORD_18_0] = 0x0650,
  1205. [PMIF_MONITOR_RECORD_18_1] = 0x0654,
  1206. [PMIF_MONITOR_RECORD_18_2] = 0x0658,
  1207. [PMIF_MONITOR_RECORD_18_3] = 0x065C,
  1208. [PMIF_MONITOR_RECORD_18_4] = 0x0660,
  1209. [PMIF_MONITOR_RECORD_19_0] = 0x0664,
  1210. [PMIF_MONITOR_RECORD_19_1] = 0x0668,
  1211. [PMIF_MONITOR_RECORD_19_2] = 0x066C,
  1212. [PMIF_MONITOR_RECORD_19_3] = 0x0670,
  1213. [PMIF_MONITOR_RECORD_19_4] = 0x0674,
  1214. [PMIF_MONITOR_RECORD_20_0] = 0x0678,
  1215. [PMIF_MONITOR_RECORD_20_1] = 0x067C,
  1216. [PMIF_MONITOR_RECORD_20_2] = 0x0680,
  1217. [PMIF_MONITOR_RECORD_20_3] = 0x0684,
  1218. [PMIF_MONITOR_RECORD_20_4] = 0x0688,
  1219. [PMIF_MONITOR_RECORD_21_0] = 0x068C,
  1220. [PMIF_MONITOR_RECORD_21_1] = 0x0690,
  1221. [PMIF_MONITOR_RECORD_21_2] = 0x0694,
  1222. [PMIF_MONITOR_RECORD_21_3] = 0x0698,
  1223. [PMIF_MONITOR_RECORD_21_4] = 0x069C,
  1224. [PMIF_MONITOR_RECORD_22_0] = 0x06A0,
  1225. [PMIF_MONITOR_RECORD_22_1] = 0x06A4,
  1226. [PMIF_MONITOR_RECORD_22_2] = 0x06A8,
  1227. [PMIF_MONITOR_RECORD_22_3] = 0x06AC,
  1228. [PMIF_MONITOR_RECORD_22_4] = 0x06B0,
  1229. [PMIF_MONITOR_RECORD_23_0] = 0x06B4,
  1230. [PMIF_MONITOR_RECORD_23_1] = 0x06B8,
  1231. [PMIF_MONITOR_RECORD_23_2] = 0x06BC,
  1232. [PMIF_MONITOR_RECORD_23_3] = 0x06C0,
  1233. [PMIF_MONITOR_RECORD_23_4] = 0x06C4,
  1234. [PMIF_MONITOR_RECORD_24_0] = 0x06C8,
  1235. [PMIF_MONITOR_RECORD_24_1] = 0x06CC,
  1236. [PMIF_MONITOR_RECORD_24_2] = 0x06D0,
  1237. [PMIF_MONITOR_RECORD_24_3] = 0x06D4,
  1238. [PMIF_MONITOR_RECORD_24_4] = 0x06D8,
  1239. [PMIF_MONITOR_RECORD_25_0] = 0x06DC,
  1240. [PMIF_MONITOR_RECORD_25_1] = 0x06E0,
  1241. [PMIF_MONITOR_RECORD_25_2] = 0x06E4,
  1242. [PMIF_MONITOR_RECORD_25_3] = 0x06E8,
  1243. [PMIF_MONITOR_RECORD_25_4] = 0x06EC,
  1244. [PMIF_MONITOR_RECORD_26_0] = 0x06F0,
  1245. [PMIF_MONITOR_RECORD_26_1] = 0x06F4,
  1246. [PMIF_MONITOR_RECORD_26_2] = 0x06F8,
  1247. [PMIF_MONITOR_RECORD_26_3] = 0x06FC,
  1248. [PMIF_MONITOR_RECORD_26_4] = 0x0700,
  1249. [PMIF_MONITOR_RECORD_27_0] = 0x0704,
  1250. [PMIF_MONITOR_RECORD_27_1] = 0x0708,
  1251. [PMIF_MONITOR_RECORD_27_2] = 0x070C,
  1252. [PMIF_MONITOR_RECORD_27_3] = 0x0710,
  1253. [PMIF_MONITOR_RECORD_27_4] = 0x0714,
  1254. [PMIF_MONITOR_RECORD_28_0] = 0x0718,
  1255. [PMIF_MONITOR_RECORD_28_1] = 0x071C,
  1256. [PMIF_MONITOR_RECORD_28_2] = 0x0720,
  1257. [PMIF_MONITOR_RECORD_28_3] = 0x0724,
  1258. [PMIF_MONITOR_RECORD_28_4] = 0x0728,
  1259. [PMIF_MONITOR_RECORD_29_0] = 0x072C,
  1260. [PMIF_MONITOR_RECORD_29_1] = 0x0730,
  1261. [PMIF_MONITOR_RECORD_29_2] = 0x0734,
  1262. [PMIF_MONITOR_RECORD_29_3] = 0x0738,
  1263. [PMIF_MONITOR_RECORD_29_4] = 0x073C,
  1264. [PMIF_MONITOR_RECORD_30_0] = 0x0740,
  1265. [PMIF_MONITOR_RECORD_30_1] = 0x0744,
  1266. [PMIF_MONITOR_RECORD_30_2] = 0x0748,
  1267. [PMIF_MONITOR_RECORD_30_3] = 0x074C,
  1268. [PMIF_MONITOR_RECORD_30_4] = 0x0750,
  1269. [PMIF_MONITOR_RECORD_31_0] = 0x0754,
  1270. [PMIF_MONITOR_RECORD_31_1] = 0x0758,
  1271. [PMIF_MONITOR_RECORD_31_2] = 0x075C,
  1272. [PMIF_MONITOR_RECORD_31_3] = 0x0760,
  1273. [PMIF_MONITOR_RECORD_31_4] = 0x0764,
  1274. [PMIF_DEBUG_CTRL] = 0x0768,
  1275. [PMIF_RESERVED_0] = 0x0770,
  1276. [PMIF_SWINF_0_ACC] = 0x0C00,
  1277. [PMIF_SWINF_0_WDATA_31_0] = 0x0C04,
  1278. [PMIF_SWINF_0_WDATA_63_32] = 0x0C08,
  1279. [PMIF_SWINF_0_RDATA_31_0] = 0x0C14,
  1280. [PMIF_SWINF_0_RDATA_63_32] = 0x0C18,
  1281. [PMIF_SWINF_0_VLD_CLR] = 0x0C24,
  1282. [PMIF_SWINF_0_STA] = 0x0C28,
  1283. [PMIF_SWINF_1_ACC] = 0x0C40,
  1284. [PMIF_SWINF_1_WDATA_31_0] = 0x0C44,
  1285. [PMIF_SWINF_1_WDATA_63_32] = 0x0C48,
  1286. [PMIF_SWINF_1_RDATA_31_0] = 0x0C54,
  1287. [PMIF_SWINF_1_RDATA_63_32] = 0x0C58,
  1288. [PMIF_SWINF_1_VLD_CLR] = 0x0C64,
  1289. [PMIF_SWINF_1_STA] = 0x0C68,
  1290. [PMIF_SWINF_2_ACC] = 0x0C80,
  1291. [PMIF_SWINF_2_WDATA_31_0] = 0x0C84,
  1292. [PMIF_SWINF_2_WDATA_63_32] = 0x0C88,
  1293. [PMIF_SWINF_2_RDATA_31_0] = 0x0C94,
  1294. [PMIF_SWINF_2_RDATA_63_32] = 0x0C98,
  1295. [PMIF_SWINF_2_VLD_CLR] = 0x0CA4,
  1296. [PMIF_SWINF_2_STA] = 0x0CA8,
  1297. [PMIF_SWINF_3_ACC] = 0x0CC0,
  1298. [PMIF_SWINF_3_WDATA_31_0] = 0x0CC4,
  1299. [PMIF_SWINF_3_WDATA_63_32] = 0x0CC8,
  1300. [PMIF_SWINF_3_RDATA_31_0] = 0x0CD4,
  1301. [PMIF_SWINF_3_RDATA_63_32] = 0x0CD8,
  1302. [PMIF_SWINF_3_VLD_CLR] = 0x0CE4,
  1303. [PMIF_SWINF_3_STA] = 0x0CE8,
  1304. [PMIC_ACC_VIO_INFO_0] = 0x0F50,
  1305. [PMIC_ACC_VIO_INFO_1] = 0x0F54,
  1306. [PMIC_ACC_VIO_INFO_2] = 0x0F58,
  1307. [PMIC_ACC_VIO_INFO_3] = 0x0F5C,
  1308. [PMIC_ACC_VIO_INFO_4] = 0x0F60,
  1309. [PMIC_ACC_VIO_INFO_5] = 0x0F64,
  1310. [PMIC_ACC_SCP_VIO_INFO_0] = 0x0F68,
  1311. [PMIC_ACC_SCP_VIO_INFO_1] = 0x0F6C,
  1312. [PMIC_ACC_SCP_VIO_INFO_2] = 0x0F70,
  1313. [PMIC_ACC_SCP_VIO_INFO_3] = 0x0F74,
  1314. [PMIC_ACC_SCP_VIO_INFO_4] = 0x0F78,
  1315. [PMIC_ACC_SCP_VIO_INFO_5] = 0x0F7C,
  1316. [PMIF_ACC_VIO_INFO_0] = 0x0F80,
  1317. [PMIF_ACC_VIO_INFO_1] = 0x0F84,
  1318. [PMIF_ACC_VIO_INFO_2] = 0x0F88,
  1319. };
  1320. static char d_log_buf[1280];
  1321. static struct spmi_controller *dbg_ctrl;
  1322. static int is_drv_attr;
  1323. static char *wp;
  1324. /*
  1325. * Function : mtk_spmi_readl_d()
  1326. * Description : mtk spmi controller read api
  1327. * Parameter :
  1328. * Return :
  1329. */
  1330. static u32 mtk_spmi_readl_d(struct pmif *arb, enum spmi_regs reg)
  1331. {
  1332. return readl(arb->spmimst_base + arb->spmimst_regs[reg]);
  1333. }
  1334. #if 0
  1335. /*
  1336. * Function : mtk_spmi_writel_d()
  1337. * Description : mtk spmi controller write api
  1338. * Parameter :
  1339. * Return :
  1340. */
  1341. static void mtk_spmi_writel_d(struct pmif *arb, u32 val,
  1342. enum spmi_regs reg)
  1343. {
  1344. writel(val, arb->spmimst_base + arb->spmimst_regs[reg]);
  1345. }
  1346. #endif
  1347. /* spmi & pmif debug mechanism */
  1348. void spmi_dump_wdt_reg(void)
  1349. {
  1350. struct pmif *arb = spmi_controller_get_drvdata(dbg_ctrl);
  1351. unsigned int offset, tmp_dat;
  1352. unsigned int start, end, log_size = 0;
  1353. start = arb->dbgregs[PMIF_WDT_EVENT_EN_0];
  1354. end = arb->dbgregs[PMIF_WDT_FLAG_1];
  1355. log_size += sprintf(wp, "");
  1356. for (offset = start; offset <= end; offset += 4) {
  1357. tmp_dat = readl(arb->base + offset);
  1358. log_size += sprintf(wp + log_size, "(0x%x)=0x%x ",
  1359. offset, tmp_dat);
  1360. }
  1361. log_size += sprintf(wp + log_size, "\n");
  1362. pr_info("[PMIF] %s", wp);
  1363. }
  1364. void spmi_dump_pmif_acc_vio_reg(void)
  1365. {
  1366. struct pmif *arb = spmi_controller_get_drvdata(dbg_ctrl);
  1367. unsigned int offset, tmp_dat;
  1368. unsigned int start, end, log_size = 0;
  1369. start = arb->dbgregs[PMIF_ACC_VIO_INFO_0];
  1370. if (arb->dbgver == 2)
  1371. end = arb->dbgregs[PMIC_ALL_ACC_VIO_INFO_1];
  1372. else
  1373. end = arb->dbgregs[PMIF_ACC_VIO_INFO_2];
  1374. log_size += sprintf(wp, "");
  1375. for (offset = start; offset <= end; offset += 4) {
  1376. tmp_dat = readl(arb->base + offset);
  1377. log_size += sprintf(wp + log_size, "(0x%x)=0x%x ",
  1378. offset, tmp_dat);
  1379. }
  1380. log_size += sprintf(wp + log_size, "\n");
  1381. pr_info("[PMIF] %s %s", __func__, wp);
  1382. }
  1383. void spmi_dump_pmic_acc_vio_reg(void)
  1384. {
  1385. struct pmif *arb = spmi_controller_get_drvdata(dbg_ctrl);
  1386. unsigned int offset, tmp_dat;
  1387. unsigned int start, end, log_size = 0;
  1388. start = arb->dbgregs[PMIC_ACC_VIO_INFO_0];
  1389. end = arb->dbgregs[PMIC_ACC_VIO_INFO_5];
  1390. log_size += sprintf(wp, "");
  1391. for (offset = start; offset <= end; offset += 4) {
  1392. tmp_dat = readl(arb->base + offset);
  1393. log_size += sprintf(wp + log_size, "(0x%x)=0x%x ",
  1394. offset, tmp_dat);
  1395. }
  1396. log_size += sprintf(wp + log_size, "\n");
  1397. pr_info("[PMIF] %s %s", __func__, wp);
  1398. }
  1399. static char *get_pmif_busy_reg_dump(void)
  1400. {
  1401. struct pmif *arb = spmi_controller_get_drvdata(dbg_ctrl);
  1402. unsigned int offset, tmp_dat;
  1403. unsigned int start, end, log_size = 0;
  1404. start = arb->dbgregs[PMIF_INF_BUSY_STA];
  1405. end = arb->dbgregs[PMIF_OTHER_BUSY_STA_1];
  1406. log_size += sprintf(wp, "");
  1407. for (offset = start; offset <= end; offset += 4) {
  1408. tmp_dat = readl(arb->base + offset);
  1409. log_size += sprintf(wp + log_size, "(0x%x)=0x%x ",
  1410. offset, tmp_dat);
  1411. }
  1412. log_size += sprintf(wp + log_size, "\n");
  1413. return wp;
  1414. }
  1415. static char *get_pmif_swinf_reg_dump(void)
  1416. {
  1417. struct pmif *arb = spmi_controller_get_drvdata(dbg_ctrl);
  1418. unsigned int swinf = 0, step, offset, tmp_dat, log_size = 0;
  1419. unsigned int cmd, is_write, slvid, bytecnt, addr;
  1420. unsigned int wd_31_0, rd_31_0;
  1421. unsigned int err, sbusy, done, qfillcnt, qfreecnt, qempty, qfull;
  1422. unsigned int req, fsm, en;
  1423. step = arb->dbgregs[PMIF_SWINF_1_ACC] - arb->dbgregs[PMIF_SWINF_0_ACC];
  1424. log_size += sprintf(wp, "");
  1425. for (swinf = 0; swinf < 4; swinf++) {
  1426. offset = arb->dbgregs[PMIF_SWINF_0_ACC] + swinf * step;
  1427. tmp_dat = readl(arb->base + offset);
  1428. cmd = (tmp_dat & (0x3 << 30)) >> 30;
  1429. is_write = (tmp_dat & (0x1 << 29)) >> 29;
  1430. slvid = (tmp_dat & (0xf << 24)) >> 24;
  1431. bytecnt = (tmp_dat & (0xf << 16)) >> 16;
  1432. addr = (tmp_dat & (0xffff << 0)) >> 0;
  1433. offset = arb->dbgregs[PMIF_SWINF_0_WDATA_31_0] + swinf * step;
  1434. wd_31_0 = readl(arb->base + offset);
  1435. offset = arb->dbgregs[PMIF_SWINF_0_RDATA_31_0] + swinf * step;
  1436. rd_31_0 = readl(arb->base + offset);
  1437. offset = arb->dbgregs[PMIF_SWINF_0_STA] + swinf * step;
  1438. tmp_dat = readl(arb->base + offset);
  1439. err = (tmp_dat & (0x1 << 18)) >> 18;
  1440. sbusy = (tmp_dat & (0x1 << 17)) >> 17;
  1441. done = (tmp_dat & (0x1 << 15)) >> 15;
  1442. qfillcnt = (tmp_dat & (0xf << 11)) >> 11;
  1443. qfreecnt = (tmp_dat & (0xf << 7)) >> 7;
  1444. qempty = (tmp_dat & (0x1 << 6)) >> 6;
  1445. qfull = (tmp_dat & (0x1 << 5)) >> 5;
  1446. req = (tmp_dat & (0x1 << 4)) >> 4;
  1447. fsm = (tmp_dat & (0x7 << 1)) >> 1;
  1448. en = (tmp_dat & (0x1 << 0)) >> 0;
  1449. log_size += sprintf(
  1450. wp + log_size,
  1451. "[swinf:%d, cmd:0x%x, is_write:%d, slvid:%d ",
  1452. swinf, cmd, is_write, slvid);
  1453. if (is_write) {
  1454. log_size += sprintf(
  1455. wp + log_size,
  1456. "bytecnt:%d (write addr 0x%x=0x%x)]\n",
  1457. bytecnt, addr, wd_31_0);
  1458. } else {
  1459. log_size += sprintf(
  1460. wp + log_size,
  1461. "bytecnt:%d (read addr 0x%x=0x%x)]\n",
  1462. bytecnt, addr, rd_31_0);
  1463. }
  1464. log_size += sprintf(
  1465. wp + log_size,
  1466. "[err:%d, sbusy:%d, done:%d, qfillcnt:%d ",
  1467. err, sbusy, done, qfillcnt);
  1468. log_size += sprintf(
  1469. wp + log_size,
  1470. "qfreecnt:%d, qempty:%d, qfull:%d, req:%d ",
  1471. qfreecnt, qempty, qfull, req);
  1472. log_size += sprintf(wp + log_size, "fsm:%d, en:%d]\n", fsm, en);
  1473. }
  1474. log_size += sprintf(wp + log_size, "\n");
  1475. return wp;
  1476. }
  1477. static char *get_spmimst_all_reg_dump(void)
  1478. {
  1479. struct pmif *arb = spmi_controller_get_drvdata(dbg_ctrl);
  1480. unsigned int offset, tmp_dat;
  1481. unsigned int start, end, log_size = 0;
  1482. int i = 0;
  1483. start = arb->spmimst_regs[SPMI_OP_ST_CTRL];
  1484. end = arb->spmimst_regs[SPMI_REC4];
  1485. log_size += sprintf(wp, "\n[SPMI] ");
  1486. for (offset = start; offset <= end; offset += 4) {
  1487. tmp_dat = readl(arb->spmimst_base + offset);
  1488. log_size += sprintf(wp + log_size,
  1489. "(0x%x)=0x%x ", offset, tmp_dat);
  1490. i++;
  1491. if (i % 8 == 0)
  1492. log_size += sprintf(wp + log_size, "\n[SPMI] ");
  1493. }
  1494. #if SPMI_RCS_SUPPORT
  1495. offset = arb->spmimst_regs[SPMI_DEC_DBG];
  1496. tmp_dat = readl(arb->spmimst_base + offset);
  1497. log_size += sprintf(wp + log_size, "(0x%x)=0x%x ", offset, tmp_dat);
  1498. #endif
  1499. offset = arb->spmimst_regs[SPMI_MST_DBG];
  1500. tmp_dat = readl(arb->spmimst_base + offset);
  1501. log_size += sprintf(wp + log_size, "(0x%x)=0x%x\n", offset, tmp_dat);
  1502. return wp;
  1503. }
  1504. void spmi_dump_pmif_busy_reg(void)
  1505. {
  1506. pr_info("[PMIF] %s", get_pmif_busy_reg_dump());
  1507. }
  1508. static void spmi_dump_pmif_busy_reg_d(struct seq_file *m)
  1509. {
  1510. seq_puts(m, get_pmif_busy_reg_dump());
  1511. }
  1512. void spmi_dump_pmif_swinf_reg(void)
  1513. {
  1514. pr_info("[PMIF]\n%s", get_pmif_swinf_reg_dump());
  1515. }
  1516. static void spmi_dump_pmif_swinf_reg_d(struct seq_file *m)
  1517. {
  1518. seq_puts(m, get_pmif_swinf_reg_dump());
  1519. }
  1520. void spmi_dump_pmif_all_reg(void)
  1521. {
  1522. struct pmif *arb = spmi_controller_get_drvdata(dbg_ctrl);
  1523. unsigned int offset, tmp_dat, log_size = 0;
  1524. unsigned int start, end;
  1525. int i = 0;
  1526. start = arb->dbgregs[PMIF_INIT_DONE];
  1527. end = arb->dbgregs[PMIF_RESERVED_0];
  1528. log_size += sprintf(wp, "");
  1529. for (offset = start; offset <= end; offset += 4) {
  1530. tmp_dat = readl(arb->base + offset);
  1531. log_size += sprintf(wp + log_size, "(0x%x)=0x%x ",
  1532. offset, tmp_dat);
  1533. i++;
  1534. if (i % 64 == 0) {
  1535. pr_notice("\n[PMIF] %s", wp);
  1536. log_size = 0;
  1537. } else if (i % 8 == 0)
  1538. log_size += sprintf(wp + log_size, "\n[PMIF] ");
  1539. }
  1540. pr_notice("\n[PMIF] %s", wp);
  1541. }
  1542. static void spmi_dump_pmif_all_reg_d(struct seq_file *m)
  1543. {
  1544. struct pmif *arb = spmi_controller_get_drvdata(dbg_ctrl);
  1545. unsigned int offset, tmp_dat, log_size = 0;
  1546. unsigned int start, end;
  1547. int i = 0;
  1548. start = arb->dbgregs[PMIF_INIT_DONE];
  1549. end = arb->dbgregs[PMIF_RESERVED_0];
  1550. for (offset = start; offset <= end; offset += 4) {
  1551. tmp_dat = readl(arb->base + offset);
  1552. seq_printf(m, "(0x%x)=0x%x ", offset, tmp_dat);
  1553. }
  1554. seq_puts(m, "\n");
  1555. }
  1556. void spmi_dump_pmif_record_reg(void)
  1557. {
  1558. struct pmif *arb = spmi_controller_get_drvdata(dbg_ctrl);
  1559. unsigned int i = 0, step, offset, tmp_dat;
  1560. unsigned int chan, cmd, is_write, slvid, bytecnt, addr;
  1561. unsigned int wd_31_0, log_size = 0;
  1562. step = arb->dbgregs[PMIF_MONITOR_RECORD_1_0] -
  1563. arb->dbgregs[PMIF_MONITOR_RECORD_0_0];
  1564. log_size += sprintf(wp, "");
  1565. for (i = 0; i < 32; i++) {
  1566. offset = arb->dbgregs[PMIF_MONITOR_RECORD_0_0] + i * step;
  1567. tmp_dat = readl(arb->base + offset);
  1568. chan = (tmp_dat & (0xf8 << 27)) >> 27;
  1569. cmd = (tmp_dat & (0x3 << 25)) >> 25;
  1570. is_write = (tmp_dat & (0x1 << 24)) >> 24;
  1571. slvid = (tmp_dat & (0xf << 20)) >> 20;
  1572. bytecnt = (tmp_dat & (0xf << 16)) >> 16;
  1573. addr = (tmp_dat & (0xffff << 0)) >> 0;
  1574. offset = arb->dbgregs[PMIF_MONITOR_RECORD_0_1] + i * step;
  1575. wd_31_0 = readl(arb->base + offset);
  1576. log_size += sprintf(wp + log_size,
  1577. "[PMIF] (%d)[swinf:%d, cmd:0x%x, rw:0x%x, slvid:%d, ",
  1578. i, chan, cmd, is_write, slvid);
  1579. log_size += sprintf(wp + log_size,
  1580. "bytecnt:%d, (addr 0x%x=0x%x)]\n",
  1581. bytecnt, addr, wd_31_0);
  1582. if ((i + 1) % 8 == 0) {
  1583. pr_info("\n%s", wp);
  1584. log_size = 0;
  1585. }
  1586. }
  1587. /* logging mode no need to clear record */
  1588. }
  1589. static void spmi_dump_pmif_record_reg_d(struct seq_file *m)
  1590. {
  1591. struct pmif *arb = spmi_controller_get_drvdata(dbg_ctrl);
  1592. unsigned int i = 0, step, offset, tmp_dat;
  1593. unsigned int chan, cmd, is_write, slvid, bytecnt, addr;
  1594. unsigned int wd_31_0;
  1595. step = arb->dbgregs[PMIF_MONITOR_RECORD_1_0] -
  1596. arb->dbgregs[PMIF_MONITOR_RECORD_0_0];
  1597. for (i = 0; i < 32; i++) {
  1598. offset = arb->dbgregs[PMIF_MONITOR_RECORD_0_0] + i * step;
  1599. tmp_dat = readl(arb->base + offset);
  1600. chan = (tmp_dat & (0xf8 << 27)) >> 27;
  1601. cmd = (tmp_dat & (0x3 << 25)) >> 25;
  1602. is_write = (tmp_dat & (0x1 << 24)) >> 24;
  1603. slvid = (tmp_dat & (0xf << 20)) >> 20;
  1604. bytecnt = (tmp_dat & (0xf << 16)) >> 16;
  1605. addr = (tmp_dat & (0xffff << 0)) >> 0;
  1606. offset = arb->dbgregs[PMIF_MONITOR_RECORD_0_1] + i * step;
  1607. wd_31_0 = readl(arb->base + offset);
  1608. seq_printf(m, "(%d)[swinf:%d, cmd:0x%x, rw:0x%x, slvid:%d, ",
  1609. i, chan, cmd, is_write, slvid);
  1610. seq_printf(m, "bytecnt:%d, (addr 0x%x=0x%x)]\n",
  1611. bytecnt, addr, wd_31_0);
  1612. }
  1613. /* logging mode no need to clear record */
  1614. }
  1615. void spmi_dump_spmimst_all_reg(void)
  1616. {
  1617. pr_notice("%s", get_spmimst_all_reg_dump());
  1618. }
  1619. static void spmi_dump_spmimst_all_reg_d(struct seq_file *m)
  1620. {
  1621. seq_puts(m, get_spmimst_all_reg_dump());
  1622. }
  1623. /*
  1624. * PMIF dump busy register log
  1625. */
  1626. static int proc_dump_pmif_busy_reg_show(struct seq_file *m, void *v)
  1627. {
  1628. seq_puts(m, "********** PMIF dump busy register**********\n");
  1629. spmi_dump_pmif_busy_reg();
  1630. spmi_dump_pmif_busy_reg_d(m);
  1631. return 0;
  1632. }
  1633. static int proc_dump_pmif_busy_reg_open(struct inode *inode, struct file *file)
  1634. {
  1635. return single_open(file, proc_dump_pmif_busy_reg_show, NULL);
  1636. }
  1637. static const struct file_operations dump_pmif_busy_reg_proc_fops = {
  1638. .open = proc_dump_pmif_busy_reg_open,
  1639. .read = seq_read,
  1640. };
  1641. /*
  1642. * PMIF dump swinf log
  1643. */
  1644. static int proc_dump_pmif_swinf_show(struct seq_file *m, void *v)
  1645. {
  1646. seq_puts(m, "********** PMIF dump swinf register**********\n");
  1647. spmi_dump_pmif_swinf_reg();
  1648. spmi_dump_pmif_swinf_reg_d(m);
  1649. return 0;
  1650. }
  1651. static int proc_dump_pmif_swinf_open(struct inode *inode, struct file *file)
  1652. {
  1653. return single_open(file, proc_dump_pmif_swinf_show, NULL);
  1654. }
  1655. static const struct file_operations dump_pmif_swinf_proc_fops = {
  1656. .open = proc_dump_pmif_swinf_open,
  1657. .read = seq_read,
  1658. };
  1659. /*
  1660. * PMIF dump all register log
  1661. */
  1662. static int proc_dump_pmif_all_reg_show(struct seq_file *m, void *v)
  1663. {
  1664. seq_puts(m, "********** PMIF dump all register**********\n");
  1665. spmi_dump_pmif_all_reg();
  1666. spmi_dump_pmif_all_reg_d(m);
  1667. return 0;
  1668. }
  1669. static int proc_dump_pmif_all_reg_open(struct inode *inode, struct file *file)
  1670. {
  1671. return single_open(file, proc_dump_pmif_all_reg_show, NULL);
  1672. }
  1673. static const struct file_operations dump_pmif_all_reg_proc_fops = {
  1674. .open = proc_dump_pmif_all_reg_open,
  1675. .read = seq_read,
  1676. };
  1677. /*
  1678. * PMIF dump record register log
  1679. */
  1680. static int proc_dump_pmif_record_reg_show(struct seq_file *m, void *v)
  1681. {
  1682. seq_puts(m, "********** PMIF dump record register**********\n");
  1683. seq_puts(m, "*swinf:4=MD,swinf:5:GZ,swinf:6:AP,swinf:7:RSV\n");
  1684. spmi_dump_pmif_record_reg();
  1685. spmi_dump_pmif_record_reg_d(m);
  1686. return 0;
  1687. }
  1688. static int proc_dump_pmif_record_reg_open(struct inode *inode,
  1689. struct file *file)
  1690. {
  1691. return single_open(file, proc_dump_pmif_record_reg_show, NULL);
  1692. }
  1693. static const struct file_operations dump_pmif_record_reg_proc_fops = {
  1694. .open = proc_dump_pmif_record_reg_open,
  1695. .read = seq_read,
  1696. };
  1697. /*
  1698. * SPMIMST dump all register log
  1699. */
  1700. static int proc_dump_spmimst_all_reg_show(struct seq_file *m, void *v)
  1701. {
  1702. seq_puts(m, "********** SPMIMST dump all register**********\n");
  1703. spmi_dump_spmimst_all_reg();
  1704. spmi_dump_spmimst_all_reg_d(m);
  1705. return 0;
  1706. }
  1707. static int proc_dump_spmimst_all_reg_open(struct inode *inode,
  1708. struct file *file)
  1709. {
  1710. return single_open(file, proc_dump_spmimst_all_reg_show, NULL);
  1711. }
  1712. static const struct file_operations dump_spmimst_all_reg_proc_fops = {
  1713. .open = proc_dump_spmimst_all_reg_open,
  1714. .read = seq_read,
  1715. };
  1716. static u32 gpmif_of;
  1717. static u32 gpmif_val;
  1718. static ssize_t pmif_access_show(struct device_driver *ddri, char *buf)
  1719. {
  1720. int ret = 0;
  1721. if (buf == NULL) {
  1722. pr_notice("[%s] *buf is NULL!\n", __func__);
  1723. return -EINVAL;
  1724. }
  1725. ret = sprintf(buf, "[%s] [0x%x]=0x%x\n", __func__, gpmif_of, gpmif_val);
  1726. if (ret < 0)
  1727. pr_notice("sprintf failed\n");
  1728. return strlen(buf);
  1729. }
  1730. static ssize_t pmif_access_store(struct device_driver *ddri,
  1731. const char *buf, size_t count)
  1732. {
  1733. struct pmif *arb = spmi_controller_get_drvdata(dbg_ctrl);
  1734. int ret = 0;
  1735. u32 offset = 0;
  1736. u32 value = 0;
  1737. pr_info("[%s]\n", __func__);
  1738. if (buf != NULL && count != 0) {
  1739. pr_info("[%s] size is %d, buf is %s\n",
  1740. __func__, (int)count, buf);
  1741. if (strlen(buf) < 3) {
  1742. pr_notice("%s() Invalid input!!\n", __func__);
  1743. return -EINVAL;
  1744. }
  1745. ret = sscanf(buf, "0x%x 0x%x", &offset, &value);
  1746. if (ret < 0)
  1747. return ret;
  1748. if (value) {
  1749. if (offset > arb->dbgregs[PMIF_SWINF_3_STA]) {
  1750. pr_notice("%s() Illegal offset[0x%x]!!\n",
  1751. __func__, offset);
  1752. } else {
  1753. pr_info("%s() set offset[0x%x]=0x%x\n",
  1754. __func__, arb->base + offset, value);
  1755. writel(value, arb->base + offset);
  1756. }
  1757. }
  1758. gpmif_of = offset;
  1759. gpmif_val = readl(arb->base + offset);
  1760. }
  1761. return count;
  1762. }
  1763. static u32 gspmi_of;
  1764. static u32 gspmi_val;
  1765. static ssize_t spmi_access_show(struct device_driver *ddri, char *buf)
  1766. {
  1767. int ret = 0;
  1768. if (buf == NULL) {
  1769. pr_notice("[%s] *buf is NULL!\n", __func__);
  1770. return -EINVAL;
  1771. }
  1772. ret = sprintf(buf, "[%s] [0x%x]=0x%x\n", __func__, gspmi_of, gspmi_val);
  1773. if (ret < 0)
  1774. pr_notice("sprintf failed\n");
  1775. return strlen(buf);
  1776. }
  1777. static ssize_t spmi_access_store(struct device_driver *ddri,
  1778. const char *buf, size_t count)
  1779. {
  1780. struct pmif *arb = spmi_controller_get_drvdata(dbg_ctrl);
  1781. int ret = 0;
  1782. u32 offset = 0;
  1783. u32 value = 0;
  1784. pr_info("[%s]\n", __func__);
  1785. if (buf != NULL && count != 0) {
  1786. pr_info("[%s] size is %d, buf is %s\n",
  1787. __func__, (int)count, buf);
  1788. if (strlen(buf) < 3) {
  1789. pr_notice("%s() Invalid input!!\n", __func__);
  1790. return -EINVAL;
  1791. }
  1792. ret = sscanf(buf, "0x%x 0x%x", &offset, &value);
  1793. if (ret < 0)
  1794. return ret;
  1795. if (value) {
  1796. if (offset > arb->spmimst_regs[SPMI_MST_DBG]) {
  1797. pr_notice("%s() Illegal offset[0x%x]!!\n",
  1798. __func__, offset);
  1799. } else {
  1800. pr_info("%s() set offset[0x%x]=0x%x\n",
  1801. __func__, arb->spmimst_base + offset,
  1802. value);
  1803. writel(value, arb->spmimst_base + offset);
  1804. }
  1805. }
  1806. gspmi_of = offset;
  1807. gspmi_val = readl(arb->spmimst_base + offset);
  1808. }
  1809. return count;
  1810. }
  1811. static DRIVER_ATTR_RW(pmif_access);
  1812. static DRIVER_ATTR_RW(spmi_access);
  1813. static struct driver_attribute *spmi_pmif_attr_list[] = {
  1814. &driver_attr_pmif_access,
  1815. &driver_attr_spmi_access,
  1816. };
  1817. int spmi_pmif_create_attr(struct device_driver *driver)
  1818. {
  1819. int idx, err;
  1820. int num = ARRAY_SIZE(spmi_pmif_attr_list);
  1821. struct dentry *mtk_spmi_dir;
  1822. mtk_spmi_dir = debugfs_create_dir("mtk_spmi", NULL);
  1823. if (!mtk_spmi_dir) {
  1824. pr_notice("fail to mkdir /sys/kernel/debug/mtk_spmi\n");
  1825. return -ENOMEM;
  1826. }
  1827. /*--/sys/kernel/debug/mtk_spmi--*/
  1828. debugfs_create_file("dump_pmif_busy_reg", 0644,
  1829. mtk_spmi_dir, NULL,
  1830. &dump_pmif_busy_reg_proc_fops);
  1831. debugfs_create_file("dump_pmif_swinf", 0644,
  1832. mtk_spmi_dir, NULL,
  1833. &dump_pmif_swinf_proc_fops);
  1834. debugfs_create_file("dump_pmif_all_reg", 0644,
  1835. mtk_spmi_dir, NULL,
  1836. &dump_pmif_all_reg_proc_fops);
  1837. debugfs_create_file("dump_pmif_record_reg", 0644,
  1838. mtk_spmi_dir, NULL,
  1839. &dump_pmif_record_reg_proc_fops);
  1840. debugfs_create_file("dump_spmimst_all_reg", 0644,
  1841. mtk_spmi_dir, NULL,
  1842. &dump_spmimst_all_reg_proc_fops);
  1843. if (driver == NULL)
  1844. return -EINVAL;
  1845. /*--/sys/devices/platform/10027000.spmi/driver--*/
  1846. for (idx = 0; idx < num; idx++) {
  1847. err = driver_create_file(driver, spmi_pmif_attr_list[idx]);
  1848. if (err) {
  1849. pr_notice("%s() driver_create_file %s err:%d\n",
  1850. __func__, spmi_pmif_attr_list[idx]->attr.name, err);
  1851. break;
  1852. }
  1853. }
  1854. return err;
  1855. }
  1856. int spmi_pmif_dbg_init(struct spmi_controller *ctrl)
  1857. {
  1858. struct pmif *arb = spmi_controller_get_drvdata(ctrl);
  1859. dbg_ctrl = ctrl;
  1860. wp = d_log_buf;
  1861. if (of_device_is_compatible(ctrl->dev.parent->of_node,
  1862. "mediatek,mt6885-pmif")) {
  1863. arb->dbgregs = mt6885_pmif_dbg_regs;
  1864. arb->dbgver = 1;
  1865. } else if (of_device_is_compatible(ctrl->dev.parent->of_node,
  1866. "mediatek,mt6833-pmif-m")) {
  1867. arb->dbgregs = mt6833_pmif_dbg_regs;
  1868. arb->dbgver = 2;
  1869. } else if (of_device_is_compatible(ctrl->dev.parent->of_node,
  1870. "mediatek,mt6853-pmif-m")) {
  1871. arb->dbgregs = mt6853_pmif_dbg_regs;
  1872. arb->dbgver = 2;
  1873. } else if (of_device_is_compatible(ctrl->dev.parent->of_node,
  1874. "mediatek,mt6853-pmif-p")) {
  1875. arb->dbgregs = mt6853_pmif_dbg_regs;
  1876. arb->dbgver = 2;
  1877. } else {
  1878. arb->dbgregs = mt6xxx_pmif_dbg_regs;
  1879. arb->dbgver = 1;
  1880. }
  1881. return 0;
  1882. }