db8500-prcmu.h 22 KB

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