db8500-prcmu.h 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833
  1. /*
  2. * Copyright (C) STMicroelectronics 2009
  3. * Copyright (C) ST-Ericsson SA 2010
  4. *
  5. * License Terms: GNU General Public License v2
  6. * Author: Kumar Sanghvi <kumar.sanghvi@stericsson.com>
  7. *
  8. * PRCMU f/w APIs
  9. */
  10. #ifndef __MFD_DB8500_PRCMU_H
  11. #define __MFD_DB8500_PRCMU_H
  12. #include <linux/interrupt.h>
  13. #include <linux/bitops.h>
  14. /*
  15. * Registers
  16. */
  17. #define DB8500_PRCM_GPIOCR 0x138
  18. #define DB8500_PRCM_GPIOCR_DBG_UARTMOD_CMD0 BIT(0)
  19. #define DB8500_PRCM_GPIOCR_DBG_STM_APE_CMD BIT(9)
  20. #define DB8500_PRCM_GPIOCR_DBG_STM_MOD_CMD1 BIT(11)
  21. #define DB8500_PRCM_GPIOCR_SPI2_SELECT BIT(23)
  22. #define DB8500_PRCM_LINE_VALUE 0x170
  23. #define DB8500_PRCM_LINE_VALUE_HSI_CAWAKE0 BIT(3)
  24. #define DB8500_PRCM_DSI_SW_RESET 0x324
  25. #define DB8500_PRCM_DSI_SW_RESET_DSI0_SW_RESETN BIT(0)
  26. #define DB8500_PRCM_DSI_SW_RESET_DSI1_SW_RESETN BIT(1)
  27. #define DB8500_PRCM_DSI_SW_RESET_DSI2_SW_RESETN BIT(2)
  28. /* This portion previously known as <mach/prcmu-fw-defs_v1.h> */
  29. /**
  30. * enum state - ON/OFF state definition
  31. * @OFF: State is ON
  32. * @ON: State is OFF
  33. *
  34. */
  35. enum state {
  36. OFF = 0x0,
  37. ON = 0x1,
  38. };
  39. /**
  40. * enum ret_state - general purpose On/Off/Retention states
  41. *
  42. */
  43. enum ret_state {
  44. OFFST = 0,
  45. ONST = 1,
  46. RETST = 2
  47. };
  48. /**
  49. * enum clk_arm - ARM Cortex A9 clock schemes
  50. * @A9_OFF:
  51. * @A9_BOOT:
  52. * @A9_OPPT1:
  53. * @A9_OPPT2:
  54. * @A9_EXTCLK:
  55. */
  56. enum clk_arm {
  57. A9_OFF,
  58. A9_BOOT,
  59. A9_OPPT1,
  60. A9_OPPT2,
  61. A9_EXTCLK
  62. };
  63. /**
  64. * enum clk_gen - GEN#0/GEN#1 clock schemes
  65. * @GEN_OFF:
  66. * @GEN_BOOT:
  67. * @GEN_OPPT1:
  68. */
  69. enum clk_gen {
  70. GEN_OFF,
  71. GEN_BOOT,
  72. GEN_OPPT1,
  73. };
  74. /* some information between arm and xp70 */
  75. /**
  76. * enum romcode_write - Romcode message written by A9 AND read by XP70
  77. * @RDY_2_DS: Value set when ApDeepSleep state can be executed by XP70
  78. * @RDY_2_XP70_RST: Value set when 0x0F has been successfully polled by the
  79. * romcode. The xp70 will go into self-reset
  80. */
  81. enum romcode_write {
  82. RDY_2_DS = 0x09,
  83. RDY_2_XP70_RST = 0x10
  84. };
  85. /**
  86. * enum romcode_read - Romcode message written by XP70 and read by A9
  87. * @INIT: Init value when romcode field is not used
  88. * @FS_2_DS: Value set when power state is going from ApExecute to
  89. * ApDeepSleep
  90. * @END_DS: Value set when ApDeepSleep power state is reached coming from
  91. * ApExecute state
  92. * @DS_TO_FS: Value set when power state is going from ApDeepSleep to
  93. * ApExecute
  94. * @END_FS: Value set when ApExecute power state is reached coming from
  95. * ApDeepSleep state
  96. * @SWR: Value set when power state is going to ApReset
  97. * @END_SWR: Value set when the xp70 finished executing ApReset actions and
  98. * waits for romcode acknowledgment to go to self-reset
  99. */
  100. enum romcode_read {
  101. INIT = 0x00,
  102. FS_2_DS = 0x0A,
  103. END_DS = 0x0B,
  104. DS_TO_FS = 0x0C,
  105. END_FS = 0x0D,
  106. SWR = 0x0E,
  107. END_SWR = 0x0F
  108. };
  109. /**
  110. * enum ap_pwrst - current power states defined in PRCMU firmware
  111. * @NO_PWRST: Current power state init
  112. * @AP_BOOT: Current power state is apBoot
  113. * @AP_EXECUTE: Current power state is apExecute
  114. * @AP_DEEP_SLEEP: Current power state is apDeepSleep
  115. * @AP_SLEEP: Current power state is apSleep
  116. * @AP_IDLE: Current power state is apIdle
  117. * @AP_RESET: Current power state is apReset
  118. */
  119. enum ap_pwrst {
  120. NO_PWRST = 0x00,
  121. AP_BOOT = 0x01,
  122. AP_EXECUTE = 0x02,
  123. AP_DEEP_SLEEP = 0x03,
  124. AP_SLEEP = 0x04,
  125. AP_IDLE = 0x05,
  126. AP_RESET = 0x06
  127. };
  128. /**
  129. * enum ap_pwrst_trans - Transition states defined in PRCMU firmware
  130. * @NO_TRANSITION: No power state transition
  131. * @APEXECUTE_TO_APSLEEP: Power state transition from ApExecute to ApSleep
  132. * @APIDLE_TO_APSLEEP: Power state transition from ApIdle to ApSleep
  133. * @APBOOT_TO_APEXECUTE: Power state transition from ApBoot to ApExecute
  134. * @APEXECUTE_TO_APDEEPSLEEP: Power state transition from ApExecute to
  135. * ApDeepSleep
  136. * @APEXECUTE_TO_APIDLE: Power state transition from ApExecute to ApIdle
  137. */
  138. enum ap_pwrst_trans {
  139. PRCMU_AP_NO_CHANGE = 0x00,
  140. APEXECUTE_TO_APSLEEP = 0x01,
  141. APIDLE_TO_APSLEEP = 0x02, /* To be removed */
  142. PRCMU_AP_SLEEP = 0x01,
  143. APBOOT_TO_APEXECUTE = 0x03,
  144. APEXECUTE_TO_APDEEPSLEEP = 0x04, /* To be removed */
  145. PRCMU_AP_DEEP_SLEEP = 0x04,
  146. APEXECUTE_TO_APIDLE = 0x05, /* To be removed */
  147. PRCMU_AP_IDLE = 0x05,
  148. PRCMU_AP_DEEP_IDLE = 0x07,
  149. };
  150. /**
  151. * enum hw_acc_state - State definition for hardware accelerator
  152. * @HW_NO_CHANGE: The hardware accelerator state must remain unchanged
  153. * @HW_OFF: The hardware accelerator must be switched off
  154. * @HW_OFF_RAMRET: The hardware accelerator must be switched off with its
  155. * internal RAM in retention
  156. * @HW_ON: The hwa hardware accelerator hwa must be switched on
  157. *
  158. * NOTE! Deprecated, to be removed when all users switched over to use the
  159. * regulator API.
  160. */
  161. enum hw_acc_state {
  162. HW_NO_CHANGE = 0x00,
  163. HW_OFF = 0x01,
  164. HW_OFF_RAMRET = 0x02,
  165. HW_ON = 0x04
  166. };
  167. /**
  168. * enum mbox_2_arm_stat - Status messages definition for mbox_arm
  169. * @BOOT_TO_EXECUTEOK: The apBoot to apExecute state transition has been
  170. * completed
  171. * @DEEPSLEEPOK: The apExecute to apDeepSleep state transition has been
  172. * completed
  173. * @SLEEPOK: The apExecute to apSleep state transition has been completed
  174. * @IDLEOK: The apExecute to apIdle state transition has been completed
  175. * @SOFTRESETOK: The A9 watchdog/ SoftReset state has been completed
  176. * @SOFTRESETGO : The A9 watchdog/SoftReset state is on going
  177. * @BOOT_TO_EXECUTE: The apBoot to apExecute state transition is on going
  178. * @EXECUTE_TO_DEEPSLEEP: The apExecute to apDeepSleep state transition is on
  179. * going
  180. * @DEEPSLEEP_TO_EXECUTE: The apDeepSleep to apExecute state transition is on
  181. * going
  182. * @DEEPSLEEP_TO_EXECUTEOK: The apDeepSleep to apExecute state transition has
  183. * been completed
  184. * @EXECUTE_TO_SLEEP: The apExecute to apSleep state transition is on going
  185. * @SLEEP_TO_EXECUTE: The apSleep to apExecute state transition is on going
  186. * @SLEEP_TO_EXECUTEOK: The apSleep to apExecute state transition has been
  187. * completed
  188. * @EXECUTE_TO_IDLE: The apExecute to apIdle state transition is on going
  189. * @IDLE_TO_EXECUTE: The apIdle to apExecute state transition is on going
  190. * @IDLE_TO_EXECUTEOK: The apIdle to apExecute state transition has been
  191. * completed
  192. * @INIT_STATUS: Status init
  193. */
  194. enum ap_pwrsttr_status {
  195. BOOT_TO_EXECUTEOK = 0xFF,
  196. DEEPSLEEPOK = 0xFE,
  197. SLEEPOK = 0xFD,
  198. IDLEOK = 0xFC,
  199. SOFTRESETOK = 0xFB,
  200. SOFTRESETGO = 0xFA,
  201. BOOT_TO_EXECUTE = 0xF9,
  202. EXECUTE_TO_DEEPSLEEP = 0xF8,
  203. DEEPSLEEP_TO_EXECUTE = 0xF7,
  204. DEEPSLEEP_TO_EXECUTEOK = 0xF6,
  205. EXECUTE_TO_SLEEP = 0xF5,
  206. SLEEP_TO_EXECUTE = 0xF4,
  207. SLEEP_TO_EXECUTEOK = 0xF3,
  208. EXECUTE_TO_IDLE = 0xF2,
  209. IDLE_TO_EXECUTE = 0xF1,
  210. IDLE_TO_EXECUTEOK = 0xF0,
  211. RDYTODS_RETURNTOEXE = 0xEF,
  212. NORDYTODS_RETURNTOEXE = 0xEE,
  213. EXETOSLEEP_RETURNTOEXE = 0xED,
  214. EXETOIDLE_RETURNTOEXE = 0xEC,
  215. INIT_STATUS = 0xEB,
  216. /*error messages */
  217. INITERROR = 0x00,
  218. PLLARMLOCKP_ER = 0x01,
  219. PLLDDRLOCKP_ER = 0x02,
  220. PLLSOCLOCKP_ER = 0x03,
  221. PLLSOCK1LOCKP_ER = 0x04,
  222. ARMWFI_ER = 0x05,
  223. SYSCLKOK_ER = 0x06,
  224. I2C_NACK_DATA_ER = 0x07,
  225. BOOT_ER = 0x08,
  226. I2C_STATUS_ALWAYS_1 = 0x0A,
  227. I2C_NACK_REG_ADDR_ER = 0x0B,
  228. I2C_NACK_DATA0123_ER = 0x1B,
  229. I2C_NACK_ADDR_ER = 0x1F,
  230. CURAPPWRSTISNOT_BOOT = 0x20,
  231. CURAPPWRSTISNOT_EXECUTE = 0x21,
  232. CURAPPWRSTISNOT_SLEEPMODE = 0x22,
  233. CURAPPWRSTISNOT_CORRECTFORIT10 = 0x23,
  234. FIFO4500WUISNOT_WUPEVENT = 0x24,
  235. PLL32KLOCKP_ER = 0x29,
  236. DDRDEEPSLEEPOK_ER = 0x2A,
  237. ROMCODEREADY_ER = 0x50,
  238. WUPBEFOREDS = 0x51,
  239. DDRCONFIG_ER = 0x52,
  240. WUPBEFORESLEEP = 0x53,
  241. WUPBEFOREIDLE = 0x54
  242. }; /* earlier called as mbox_2_arm_stat */
  243. /**
  244. * enum dvfs_stat - DVFS status messages definition
  245. * @DVFS_GO: A state transition DVFS is on going
  246. * @DVFS_ARM100OPPOK: The state transition DVFS has been completed for 100OPP
  247. * @DVFS_ARM50OPPOK: The state transition DVFS has been completed for 50OPP
  248. * @DVFS_ARMEXTCLKOK: The state transition DVFS has been completed for EXTCLK
  249. * @DVFS_NOCHGTCLKOK: The state transition DVFS has been completed for
  250. * NOCHGCLK
  251. * @DVFS_INITSTATUS: Value init
  252. */
  253. enum dvfs_stat {
  254. DVFS_GO = 0xFF,
  255. DVFS_ARM100OPPOK = 0xFE,
  256. DVFS_ARM50OPPOK = 0xFD,
  257. DVFS_ARMEXTCLKOK = 0xFC,
  258. DVFS_NOCHGTCLKOK = 0xFB,
  259. DVFS_INITSTATUS = 0x00
  260. };
  261. /**
  262. * enum sva_mmdsp_stat - SVA MMDSP status messages
  263. * @SVA_MMDSP_GO: SVAMMDSP interrupt has happened
  264. * @SVA_MMDSP_INIT: Status init
  265. */
  266. enum sva_mmdsp_stat {
  267. SVA_MMDSP_GO = 0xFF,
  268. SVA_MMDSP_INIT = 0x00
  269. };
  270. /**
  271. * enum sia_mmdsp_stat - SIA MMDSP status messages
  272. * @SIA_MMDSP_GO: SIAMMDSP interrupt has happened
  273. * @SIA_MMDSP_INIT: Status init
  274. */
  275. enum sia_mmdsp_stat {
  276. SIA_MMDSP_GO = 0xFF,
  277. SIA_MMDSP_INIT = 0x00
  278. };
  279. /**
  280. * enum mbox_to_arm_err - Error messages definition
  281. * @INIT_ERR: Init value
  282. * @PLLARMLOCKP_ERR: PLLARM has not been correctly locked in given time
  283. * @PLLDDRLOCKP_ERR: PLLDDR has not been correctly locked in the given time
  284. * @PLLSOC0LOCKP_ERR: PLLSOC0 has not been correctly locked in the given time
  285. * @PLLSOC1LOCKP_ERR: PLLSOC1 has not been correctly locked in the given time
  286. * @ARMWFI_ERR: The ARM WFI has not been correctly executed in the given time
  287. * @SYSCLKOK_ERR: The SYSCLK is not available in the given time
  288. * @BOOT_ERR: Romcode has not validated the XP70 self reset in the given time
  289. * @ROMCODESAVECONTEXT: The Romcode didn.t correctly save it secure context
  290. * @VARMHIGHSPEEDVALTO_ERR: The ARM high speed supply value transfered
  291. * through I2C has not been correctly executed in the given time
  292. * @VARMHIGHSPEEDACCESS_ERR: The command value of VarmHighSpeedVal transfered
  293. * through I2C has not been correctly executed in the given time
  294. * @VARMLOWSPEEDVALTO_ERR:The ARM low speed supply value transfered through
  295. * I2C has not been correctly executed in the given time
  296. * @VARMLOWSPEEDACCESS_ERR: The command value of VarmLowSpeedVal transfered
  297. * through I2C has not been correctly executed in the given time
  298. * @VARMRETENTIONVALTO_ERR: The ARM retention supply value transfered through
  299. * I2C has not been correctly executed in the given time
  300. * @VARMRETENTIONACCESS_ERR: The command value of VarmRetentionVal transfered
  301. * through I2C has not been correctly executed in the given time
  302. * @VAPEHIGHSPEEDVALTO_ERR: The APE highspeed supply value transfered through
  303. * I2C has not been correctly executed in the given time
  304. * @VSAFEHPVALTO_ERR: The SAFE high power supply value transfered through I2C
  305. * has not been correctly executed in the given time
  306. * @VMODSEL1VALTO_ERR: The MODEM sel1 supply value transfered through I2C has
  307. * not been correctly executed in the given time
  308. * @VMODSEL2VALTO_ERR: The MODEM sel2 supply value transfered through I2C has
  309. * not been correctly executed in the given time
  310. * @VARMOFFACCESS_ERR: The command value of Varm ON/OFF transfered through
  311. * I2C has not been correctly executed in the given time
  312. * @VAPEOFFACCESS_ERR: The command value of Vape ON/OFF transfered through
  313. * I2C has not been correctly executed in the given time
  314. * @VARMRETACCES_ERR: The command value of Varm retention ON/OFF transfered
  315. * through I2C has not been correctly executed in the given time
  316. * @CURAPPWRSTISNOTBOOT:Generated when Arm want to do power state transition
  317. * ApBoot to ApExecute but the power current state is not Apboot
  318. * @CURAPPWRSTISNOTEXECUTE: Generated when Arm want to do power state
  319. * transition from ApExecute to others power state but the
  320. * power current state is not ApExecute
  321. * @CURAPPWRSTISNOTSLEEPMODE: Generated when wake up events are transmitted
  322. * but the power current state is not ApDeepSleep/ApSleep/ApIdle
  323. * @CURAPPWRSTISNOTCORRECTDBG: Generated when wake up events are transmitted
  324. * but the power current state is not correct
  325. * @ARMREGU1VALTO_ERR:The ArmRegu1 value transferred through I2C has not
  326. * been correctly executed in the given time
  327. * @ARMREGU2VALTO_ERR: The ArmRegu2 value transferred through I2C has not
  328. * been correctly executed in the given time
  329. * @VAPEREGUVALTO_ERR: The VApeRegu value transfered through I2C has not
  330. * been correctly executed in the given time
  331. * @VSMPS3REGUVALTO_ERR: The VSmps3Regu value transfered through I2C has not
  332. * been correctly executed in the given time
  333. * @VMODREGUVALTO_ERR: The VModemRegu value transfered through I2C has not
  334. * been correctly executed in the given time
  335. */
  336. enum mbox_to_arm_err {
  337. INIT_ERR = 0x00,
  338. PLLARMLOCKP_ERR = 0x01,
  339. PLLDDRLOCKP_ERR = 0x02,
  340. PLLSOC0LOCKP_ERR = 0x03,
  341. PLLSOC1LOCKP_ERR = 0x04,
  342. ARMWFI_ERR = 0x05,
  343. SYSCLKOK_ERR = 0x06,
  344. BOOT_ERR = 0x07,
  345. ROMCODESAVECONTEXT = 0x08,
  346. VARMHIGHSPEEDVALTO_ERR = 0x10,
  347. VARMHIGHSPEEDACCESS_ERR = 0x11,
  348. VARMLOWSPEEDVALTO_ERR = 0x12,
  349. VARMLOWSPEEDACCESS_ERR = 0x13,
  350. VARMRETENTIONVALTO_ERR = 0x14,
  351. VARMRETENTIONACCESS_ERR = 0x15,
  352. VAPEHIGHSPEEDVALTO_ERR = 0x16,
  353. VSAFEHPVALTO_ERR = 0x17,
  354. VMODSEL1VALTO_ERR = 0x18,
  355. VMODSEL2VALTO_ERR = 0x19,
  356. VARMOFFACCESS_ERR = 0x1A,
  357. VAPEOFFACCESS_ERR = 0x1B,
  358. VARMRETACCES_ERR = 0x1C,
  359. CURAPPWRSTISNOTBOOT = 0x20,
  360. CURAPPWRSTISNOTEXECUTE = 0x21,
  361. CURAPPWRSTISNOTSLEEPMODE = 0x22,
  362. CURAPPWRSTISNOTCORRECTDBG = 0x23,
  363. ARMREGU1VALTO_ERR = 0x24,
  364. ARMREGU2VALTO_ERR = 0x25,
  365. VAPEREGUVALTO_ERR = 0x26,
  366. VSMPS3REGUVALTO_ERR = 0x27,
  367. VMODREGUVALTO_ERR = 0x28
  368. };
  369. enum hw_acc {
  370. SVAMMDSP = 0,
  371. SVAPIPE = 1,
  372. SIAMMDSP = 2,
  373. SIAPIPE = 3,
  374. SGA = 4,
  375. B2R2MCDE = 5,
  376. ESRAM12 = 6,
  377. ESRAM34 = 7,
  378. };
  379. enum cs_pwrmgt {
  380. PWRDNCS0 = 0,
  381. WKUPCS0 = 1,
  382. PWRDNCS1 = 2,
  383. WKUPCS1 = 3
  384. };
  385. /* Defs related to autonomous power management */
  386. /**
  387. * enum sia_sva_pwr_policy - Power policy
  388. * @NO_CHGT: No change
  389. * @DSPOFF_HWPOFF:
  390. * @DSPOFFRAMRET_HWPOFF:
  391. * @DSPCLKOFF_HWPOFF:
  392. * @DSPCLKOFF_HWPCLKOFF:
  393. *
  394. */
  395. enum sia_sva_pwr_policy {
  396. NO_CHGT = 0x0,
  397. DSPOFF_HWPOFF = 0x1,
  398. DSPOFFRAMRET_HWPOFF = 0x2,
  399. DSPCLKOFF_HWPOFF = 0x3,
  400. DSPCLKOFF_HWPCLKOFF = 0x4,
  401. };
  402. /**
  403. * enum auto_enable - Auto Power enable
  404. * @AUTO_OFF:
  405. * @AUTO_ON:
  406. *
  407. */
  408. enum auto_enable {
  409. AUTO_OFF = 0x0,
  410. AUTO_ON = 0x1,
  411. };
  412. /* End of file previously known as prcmu-fw-defs_v1.h */
  413. /**
  414. * enum hw_acc_dev - enum for hw accelerators
  415. * @HW_ACC_SVAMMDSP: for SVAMMDSP
  416. * @HW_ACC_SVAPIPE: for SVAPIPE
  417. * @HW_ACC_SIAMMDSP: for SIAMMDSP
  418. * @HW_ACC_SIAPIPE: for SIAPIPE
  419. * @HW_ACC_SGA: for SGA
  420. * @HW_ACC_B2R2: for B2R2
  421. * @HW_ACC_MCDE: for MCDE
  422. * @HW_ACC_ESRAM1: for ESRAM1
  423. * @HW_ACC_ESRAM2: for ESRAM2
  424. * @HW_ACC_ESRAM3: for ESRAM3
  425. * @HW_ACC_ESRAM4: for ESRAM4
  426. * @NUM_HW_ACC: number of hardware accelerators
  427. *
  428. * Different hw accelerators which can be turned ON/
  429. * OFF or put into retention (MMDSPs and ESRAMs).
  430. * Used with EPOD API.
  431. *
  432. * NOTE! Deprecated, to be removed when all users switched over to use the
  433. * regulator API.
  434. */
  435. enum hw_acc_dev {
  436. HW_ACC_SVAMMDSP,
  437. HW_ACC_SVAPIPE,
  438. HW_ACC_SIAMMDSP,
  439. HW_ACC_SIAPIPE,
  440. HW_ACC_SGA,
  441. HW_ACC_B2R2,
  442. HW_ACC_MCDE,
  443. HW_ACC_ESRAM1,
  444. HW_ACC_ESRAM2,
  445. HW_ACC_ESRAM3,
  446. HW_ACC_ESRAM4,
  447. NUM_HW_ACC
  448. };
  449. /**
  450. * enum prcmu_power_status - results from set_power_state
  451. * @PRCMU_SLEEP_OK: Sleep went ok
  452. * @PRCMU_DEEP_SLEEP_OK: DeepSleep went ok
  453. * @PRCMU_IDLE_OK: Idle went ok
  454. * @PRCMU_DEEPIDLE_OK: DeepIdle went ok
  455. * @PRCMU_PRCMU2ARMPENDINGIT_ER: Pending interrupt detected
  456. * @PRCMU_ARMPENDINGIT_ER: Pending interrupt detected
  457. *
  458. */
  459. enum prcmu_power_status {
  460. PRCMU_SLEEP_OK = 0xf3,
  461. PRCMU_DEEP_SLEEP_OK = 0xf6,
  462. PRCMU_IDLE_OK = 0xf0,
  463. PRCMU_DEEPIDLE_OK = 0xe3,
  464. PRCMU_PRCMU2ARMPENDINGIT_ER = 0x91,
  465. PRCMU_ARMPENDINGIT_ER = 0x93,
  466. };
  467. /*
  468. * Definitions for autonomous power management configuration.
  469. */
  470. #define PRCMU_AUTO_PM_OFF 0
  471. #define PRCMU_AUTO_PM_ON 1
  472. #define PRCMU_AUTO_PM_POWER_ON_HSEM BIT(0)
  473. #define PRCMU_AUTO_PM_POWER_ON_ABB_FIFO_IT BIT(1)
  474. enum prcmu_auto_pm_policy {
  475. PRCMU_AUTO_PM_POLICY_NO_CHANGE,
  476. PRCMU_AUTO_PM_POLICY_DSP_OFF_HWP_OFF,
  477. PRCMU_AUTO_PM_POLICY_DSP_OFF_RAMRET_HWP_OFF,
  478. PRCMU_AUTO_PM_POLICY_DSP_CLK_OFF_HWP_OFF,
  479. PRCMU_AUTO_PM_POLICY_DSP_CLK_OFF_HWP_CLK_OFF,
  480. };
  481. /**
  482. * struct prcmu_auto_pm_config - Autonomous power management configuration.
  483. * @sia_auto_pm_enable: SIA autonomous pm enable. (PRCMU_AUTO_PM_{OFF,ON})
  484. * @sia_power_on: SIA power ON enable. (PRCMU_AUTO_PM_POWER_ON_* bitmask)
  485. * @sia_policy: SIA power policy. (enum prcmu_auto_pm_policy)
  486. * @sva_auto_pm_enable: SVA autonomous pm enable. (PRCMU_AUTO_PM_{OFF,ON})
  487. * @sva_power_on: SVA power ON enable. (PRCMU_AUTO_PM_POWER_ON_* bitmask)
  488. * @sva_policy: SVA power policy. (enum prcmu_auto_pm_policy)
  489. */
  490. struct prcmu_auto_pm_config {
  491. u8 sia_auto_pm_enable;
  492. u8 sia_power_on;
  493. u8 sia_policy;
  494. u8 sva_auto_pm_enable;
  495. u8 sva_power_on;
  496. u8 sva_policy;
  497. };
  498. #define PRCMU_FW_PROJECT_U8500 2
  499. #define PRCMU_FW_PROJECT_U9500 4
  500. #define PRCMU_FW_PROJECT_U8500_C2 7
  501. #define PRCMU_FW_PROJECT_U9500_C2 11
  502. struct prcmu_fw_version {
  503. u8 project;
  504. u8 api_version;
  505. u8 func_version;
  506. u8 errata;
  507. };
  508. #ifdef CONFIG_MFD_DB8500_PRCMU
  509. void db8500_prcmu_early_init(void);
  510. int prcmu_set_rc_a2p(enum romcode_write);
  511. enum romcode_read prcmu_get_rc_p2a(void);
  512. enum ap_pwrst prcmu_get_xp70_current_state(void);
  513. bool prcmu_has_arm_maxopp(void);
  514. struct prcmu_fw_version *prcmu_get_fw_version(void);
  515. int prcmu_request_ape_opp_100_voltage(bool enable);
  516. int prcmu_release_usb_wakeup_state(void);
  517. /* NOTE! Use regulator framework instead */
  518. int prcmu_set_hwacc(u16 hw_acc_dev, u8 state);
  519. void prcmu_configure_auto_pm(struct prcmu_auto_pm_config *sleep,
  520. struct prcmu_auto_pm_config *idle);
  521. bool prcmu_is_auto_pm_enabled(void);
  522. int prcmu_config_clkout(u8 clkout, u8 source, u8 div);
  523. int prcmu_set_clock_divider(u8 clock, u8 divider);
  524. int db8500_prcmu_config_hotdog(u8 threshold);
  525. int db8500_prcmu_config_hotmon(u8 low, u8 high);
  526. int db8500_prcmu_start_temp_sense(u16 cycles32k);
  527. int db8500_prcmu_stop_temp_sense(void);
  528. int prcmu_abb_read(u8 slave, u8 reg, u8 *value, u8 size);
  529. int prcmu_abb_write(u8 slave, u8 reg, u8 *value, u8 size);
  530. void prcmu_ac_wake_req(void);
  531. void prcmu_ac_sleep_req(void);
  532. void db8500_prcmu_modem_reset(void);
  533. int db8500_prcmu_config_a9wdog(u8 num, bool sleep_auto_off);
  534. int db8500_prcmu_enable_a9wdog(u8 id);
  535. int db8500_prcmu_disable_a9wdog(u8 id);
  536. int db8500_prcmu_kick_a9wdog(u8 id);
  537. int db8500_prcmu_load_a9wdog(u8 id, u32 val);
  538. void db8500_prcmu_system_reset(u16 reset_code);
  539. int db8500_prcmu_set_power_state(u8 state, bool keep_ulp_clk, bool keep_ap_pll);
  540. u8 db8500_prcmu_get_power_state_result(void);
  541. int db8500_prcmu_gic_decouple(void);
  542. int db8500_prcmu_gic_recouple(void);
  543. bool db8500_prcmu_gic_pending_irq(void);
  544. void db8500_prcmu_enable_wakeups(u32 wakeups);
  545. int db8500_prcmu_set_epod(u16 epod_id, u8 epod_state);
  546. int db8500_prcmu_request_clock(u8 clock, bool enable);
  547. int db8500_prcmu_set_display_clocks(void);
  548. int db8500_prcmu_disable_dsipll(void);
  549. int db8500_prcmu_enable_dsipll(void);
  550. void db8500_prcmu_config_abb_event_readout(u32 abb_events);
  551. void db8500_prcmu_get_abb_event_buffer(void __iomem **buf);
  552. int db8500_prcmu_config_esram0_deep_sleep(u8 state);
  553. u16 db8500_prcmu_get_reset_code(void);
  554. bool db8500_prcmu_is_ac_wake_requested(void);
  555. int db8500_prcmu_set_arm_opp(u8 opp);
  556. int db8500_prcmu_get_arm_opp(void);
  557. int db8500_prcmu_set_ape_opp(u8 opp);
  558. int db8500_prcmu_get_ape_opp(void);
  559. int db8500_prcmu_set_ddr_opp(u8 opp);
  560. int db8500_prcmu_get_ddr_opp(void);
  561. u32 db8500_prcmu_read(unsigned int reg);
  562. void db8500_prcmu_write(unsigned int reg, u32 value);
  563. void db8500_prcmu_write_masked(unsigned int reg, u32 mask, u32 value);
  564. #else /* !CONFIG_MFD_DB8500_PRCMU */
  565. static inline void db8500_prcmu_early_init(void) {}
  566. static inline int prcmu_set_rc_a2p(enum romcode_write code)
  567. {
  568. return 0;
  569. }
  570. static inline enum romcode_read prcmu_get_rc_p2a(void)
  571. {
  572. return INIT;
  573. }
  574. static inline enum ap_pwrst prcmu_get_xp70_current_state(void)
  575. {
  576. return AP_EXECUTE;
  577. }
  578. static inline bool prcmu_has_arm_maxopp(void)
  579. {
  580. return false;
  581. }
  582. static inline struct prcmu_fw_version *prcmu_get_fw_version(void)
  583. {
  584. return NULL;
  585. }
  586. static inline int db8500_prcmu_set_ape_opp(u8 opp)
  587. {
  588. return 0;
  589. }
  590. static inline int db8500_prcmu_get_ape_opp(void)
  591. {
  592. return APE_100_OPP;
  593. }
  594. static inline int prcmu_request_ape_opp_100_voltage(bool enable)
  595. {
  596. return 0;
  597. }
  598. static inline int prcmu_release_usb_wakeup_state(void)
  599. {
  600. return 0;
  601. }
  602. static inline int db8500_prcmu_set_ddr_opp(u8 opp)
  603. {
  604. return 0;
  605. }
  606. static inline int db8500_prcmu_get_ddr_opp(void)
  607. {
  608. return DDR_100_OPP;
  609. }
  610. static inline int prcmu_set_hwacc(u16 hw_acc_dev, u8 state)
  611. {
  612. return 0;
  613. }
  614. static inline void prcmu_configure_auto_pm(struct prcmu_auto_pm_config *sleep,
  615. struct prcmu_auto_pm_config *idle)
  616. {
  617. }
  618. static inline bool prcmu_is_auto_pm_enabled(void)
  619. {
  620. return false;
  621. }
  622. static inline int prcmu_config_clkout(u8 clkout, u8 source, u8 div)
  623. {
  624. return 0;
  625. }
  626. static inline int prcmu_set_clock_divider(u8 clock, u8 divider)
  627. {
  628. return 0;
  629. }
  630. static inline int db8500_prcmu_config_hotdog(u8 threshold)
  631. {
  632. return 0;
  633. }
  634. static inline int db8500_prcmu_config_hotmon(u8 low, u8 high)
  635. {
  636. return 0;
  637. }
  638. static inline int db8500_prcmu_start_temp_sense(u16 cycles32k)
  639. {
  640. return 0;
  641. }
  642. static inline int db8500_prcmu_stop_temp_sense(void)
  643. {
  644. return 0;
  645. }
  646. static inline int prcmu_abb_read(u8 slave, u8 reg, u8 *value, u8 size)
  647. {
  648. return -ENOSYS;
  649. }
  650. static inline int prcmu_abb_write(u8 slave, u8 reg, u8 *value, u8 size)
  651. {
  652. return -ENOSYS;
  653. }
  654. static inline void prcmu_ac_wake_req(void) {}
  655. static inline void prcmu_ac_sleep_req(void) {}
  656. static inline void db8500_prcmu_modem_reset(void) {}
  657. static inline void db8500_prcmu_system_reset(u16 reset_code) {}
  658. static inline int db8500_prcmu_set_power_state(u8 state, bool keep_ulp_clk,
  659. bool keep_ap_pll)
  660. {
  661. return 0;
  662. }
  663. static inline u8 db8500_prcmu_get_power_state_result(void)
  664. {
  665. return 0;
  666. }
  667. static inline void db8500_prcmu_enable_wakeups(u32 wakeups) {}
  668. static inline int db8500_prcmu_set_epod(u16 epod_id, u8 epod_state)
  669. {
  670. return 0;
  671. }
  672. static inline int db8500_prcmu_request_clock(u8 clock, bool enable)
  673. {
  674. return 0;
  675. }
  676. static inline int db8500_prcmu_set_display_clocks(void)
  677. {
  678. return 0;
  679. }
  680. static inline int db8500_prcmu_disable_dsipll(void)
  681. {
  682. return 0;
  683. }
  684. static inline int db8500_prcmu_enable_dsipll(void)
  685. {
  686. return 0;
  687. }
  688. static inline int db8500_prcmu_config_esram0_deep_sleep(u8 state)
  689. {
  690. return 0;
  691. }
  692. static inline void db8500_prcmu_config_abb_event_readout(u32 abb_events) {}
  693. static inline void db8500_prcmu_get_abb_event_buffer(void __iomem **buf) {}
  694. static inline u16 db8500_prcmu_get_reset_code(void)
  695. {
  696. return 0;
  697. }
  698. static inline int db8500_prcmu_config_a9wdog(u8 num, bool sleep_auto_off)
  699. {
  700. return 0;
  701. }
  702. static inline int db8500_prcmu_enable_a9wdog(u8 id)
  703. {
  704. return 0;
  705. }
  706. static inline int db8500_prcmu_disable_a9wdog(u8 id)
  707. {
  708. return 0;
  709. }
  710. static inline int db8500_prcmu_kick_a9wdog(u8 id)
  711. {
  712. return 0;
  713. }
  714. static inline int db8500_prcmu_load_a9wdog(u8 id, u32 val)
  715. {
  716. return 0;
  717. }
  718. static inline bool db8500_prcmu_is_ac_wake_requested(void)
  719. {
  720. return 0;
  721. }
  722. static inline int db8500_prcmu_set_arm_opp(u8 opp)
  723. {
  724. return 0;
  725. }
  726. static inline int db8500_prcmu_get_arm_opp(void)
  727. {
  728. return 0;
  729. }
  730. static inline u32 db8500_prcmu_read(unsigned int reg)
  731. {
  732. return 0;
  733. }
  734. static inline void db8500_prcmu_write(unsigned int reg, u32 value) {}
  735. static inline void db8500_prcmu_write_masked(unsigned int reg, u32 mask,
  736. u32 value) {}
  737. #endif /* !CONFIG_MFD_DB8500_PRCMU */
  738. #endif /* __MFD_DB8500_PRCMU_H */