db8500-prcmu.h 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786
  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. * Definitions for autonomous power management configuration.
  436. */
  437. #define PRCMU_AUTO_PM_OFF 0
  438. #define PRCMU_AUTO_PM_ON 1
  439. #define PRCMU_AUTO_PM_POWER_ON_HSEM BIT(0)
  440. #define PRCMU_AUTO_PM_POWER_ON_ABB_FIFO_IT BIT(1)
  441. enum prcmu_auto_pm_policy {
  442. PRCMU_AUTO_PM_POLICY_NO_CHANGE,
  443. PRCMU_AUTO_PM_POLICY_DSP_OFF_HWP_OFF,
  444. PRCMU_AUTO_PM_POLICY_DSP_OFF_RAMRET_HWP_OFF,
  445. PRCMU_AUTO_PM_POLICY_DSP_CLK_OFF_HWP_OFF,
  446. PRCMU_AUTO_PM_POLICY_DSP_CLK_OFF_HWP_CLK_OFF,
  447. };
  448. /**
  449. * struct prcmu_auto_pm_config - Autonomous power management configuration.
  450. * @sia_auto_pm_enable: SIA autonomous pm enable. (PRCMU_AUTO_PM_{OFF,ON})
  451. * @sia_power_on: SIA power ON enable. (PRCMU_AUTO_PM_POWER_ON_* bitmask)
  452. * @sia_policy: SIA power policy. (enum prcmu_auto_pm_policy)
  453. * @sva_auto_pm_enable: SVA autonomous pm enable. (PRCMU_AUTO_PM_{OFF,ON})
  454. * @sva_power_on: SVA power ON enable. (PRCMU_AUTO_PM_POWER_ON_* bitmask)
  455. * @sva_policy: SVA power policy. (enum prcmu_auto_pm_policy)
  456. */
  457. struct prcmu_auto_pm_config {
  458. u8 sia_auto_pm_enable;
  459. u8 sia_power_on;
  460. u8 sia_policy;
  461. u8 sva_auto_pm_enable;
  462. u8 sva_power_on;
  463. u8 sva_policy;
  464. };
  465. #define PRCMU_FW_PROJECT_U8500 2
  466. #define PRCMU_FW_PROJECT_U9500 4
  467. #define PRCMU_FW_PROJECT_U8500_C2 7
  468. #define PRCMU_FW_PROJECT_U9500_C2 11
  469. struct prcmu_fw_version {
  470. u8 project;
  471. u8 api_version;
  472. u8 func_version;
  473. u8 errata;
  474. };
  475. #ifdef CONFIG_MFD_DB8500_PRCMU
  476. void db8500_prcmu_early_init(void);
  477. int prcmu_set_rc_a2p(enum romcode_write);
  478. enum romcode_read prcmu_get_rc_p2a(void);
  479. enum ap_pwrst prcmu_get_xp70_current_state(void);
  480. bool prcmu_has_arm_maxopp(void);
  481. int prcmu_set_ape_opp(u8 opp);
  482. int prcmu_get_ape_opp(void);
  483. struct prcmu_fw_version *prcmu_get_fw_version(void);
  484. int prcmu_request_ape_opp_100_voltage(bool enable);
  485. int prcmu_release_usb_wakeup_state(void);
  486. int prcmu_set_ddr_opp(u8 opp);
  487. int prcmu_get_ddr_opp(void);
  488. /* NOTE! Use regulator framework instead */
  489. int prcmu_set_hwacc(u16 hw_acc_dev, u8 state);
  490. void prcmu_configure_auto_pm(struct prcmu_auto_pm_config *sleep,
  491. struct prcmu_auto_pm_config *idle);
  492. bool prcmu_is_auto_pm_enabled(void);
  493. int prcmu_config_clkout(u8 clkout, u8 source, u8 div);
  494. int prcmu_set_clock_divider(u8 clock, u8 divider);
  495. int prcmu_config_hotdog(u8 threshold);
  496. int prcmu_config_hotmon(u8 low, u8 high);
  497. int prcmu_start_temp_sense(u16 cycles32k);
  498. int prcmu_stop_temp_sense(void);
  499. int prcmu_abb_read(u8 slave, u8 reg, u8 *value, u8 size);
  500. int prcmu_abb_write(u8 slave, u8 reg, u8 *value, u8 size);
  501. void prcmu_ac_wake_req(void);
  502. void prcmu_ac_sleep_req(void);
  503. void prcmu_modem_reset(void);
  504. void prcmu_enable_spi2(void);
  505. void prcmu_disable_spi2(void);
  506. int prcmu_config_a9wdog(u8 num, bool sleep_auto_off);
  507. int prcmu_enable_a9wdog(u8 id);
  508. int prcmu_disable_a9wdog(u8 id);
  509. int prcmu_kick_a9wdog(u8 id);
  510. int prcmu_load_a9wdog(u8 id, u32 val);
  511. void db8500_prcmu_system_reset(u16 reset_code);
  512. int db8500_prcmu_set_power_state(u8 state, bool keep_ulp_clk, bool keep_ap_pll);
  513. void db8500_prcmu_enable_wakeups(u32 wakeups);
  514. int db8500_prcmu_set_epod(u16 epod_id, u8 epod_state);
  515. int db8500_prcmu_request_clock(u8 clock, bool enable);
  516. int db8500_prcmu_set_display_clocks(void);
  517. int db8500_prcmu_disable_dsipll(void);
  518. int db8500_prcmu_enable_dsipll(void);
  519. void db8500_prcmu_config_abb_event_readout(u32 abb_events);
  520. void db8500_prcmu_get_abb_event_buffer(void __iomem **buf);
  521. int db8500_prcmu_config_esram0_deep_sleep(u8 state);
  522. u16 db8500_prcmu_get_reset_code(void);
  523. bool db8500_prcmu_is_ac_wake_requested(void);
  524. int db8500_prcmu_set_arm_opp(u8 opp);
  525. int db8500_prcmu_get_arm_opp(void);
  526. #else /* !CONFIG_MFD_DB8500_PRCMU */
  527. static inline void db8500_prcmu_early_init(void) {}
  528. static inline int prcmu_set_rc_a2p(enum romcode_write code)
  529. {
  530. return 0;
  531. }
  532. static inline enum romcode_read prcmu_get_rc_p2a(void)
  533. {
  534. return INIT;
  535. }
  536. static inline enum ap_pwrst prcmu_get_xp70_current_state(void)
  537. {
  538. return AP_EXECUTE;
  539. }
  540. static inline bool prcmu_has_arm_maxopp(void)
  541. {
  542. return false;
  543. }
  544. static inline struct prcmu_fw_version *prcmu_get_fw_version(void)
  545. {
  546. return NULL;
  547. }
  548. static inline int prcmu_set_ape_opp(u8 opp)
  549. {
  550. return 0;
  551. }
  552. static inline int prcmu_get_ape_opp(void)
  553. {
  554. return APE_100_OPP;
  555. }
  556. static inline int prcmu_request_ape_opp_100_voltage(bool enable)
  557. {
  558. return 0;
  559. }
  560. static inline int prcmu_release_usb_wakeup_state(void)
  561. {
  562. return 0;
  563. }
  564. static inline int prcmu_set_ddr_opp(u8 opp)
  565. {
  566. return 0;
  567. }
  568. static inline int prcmu_get_ddr_opp(void)
  569. {
  570. return DDR_100_OPP;
  571. }
  572. static inline int prcmu_set_hwacc(u16 hw_acc_dev, u8 state)
  573. {
  574. return 0;
  575. }
  576. static inline void prcmu_configure_auto_pm(struct prcmu_auto_pm_config *sleep,
  577. struct prcmu_auto_pm_config *idle)
  578. {
  579. }
  580. static inline bool prcmu_is_auto_pm_enabled(void)
  581. {
  582. return false;
  583. }
  584. static inline int prcmu_config_clkout(u8 clkout, u8 source, u8 div)
  585. {
  586. return 0;
  587. }
  588. static inline int prcmu_set_clock_divider(u8 clock, u8 divider)
  589. {
  590. return 0;
  591. }
  592. static inline int prcmu_config_hotdog(u8 threshold)
  593. {
  594. return 0;
  595. }
  596. static inline int prcmu_config_hotmon(u8 low, u8 high)
  597. {
  598. return 0;
  599. }
  600. static inline int prcmu_start_temp_sense(u16 cycles32k)
  601. {
  602. return 0;
  603. }
  604. static inline int prcmu_stop_temp_sense(void)
  605. {
  606. return 0;
  607. }
  608. static inline int prcmu_abb_read(u8 slave, u8 reg, u8 *value, u8 size)
  609. {
  610. return -ENOSYS;
  611. }
  612. static inline int prcmu_abb_write(u8 slave, u8 reg, u8 *value, u8 size)
  613. {
  614. return -ENOSYS;
  615. }
  616. static inline void prcmu_ac_wake_req(void) {}
  617. static inline void prcmu_ac_sleep_req(void) {}
  618. static inline void prcmu_modem_reset(void) {}
  619. static inline int prcmu_enable_spi2(void)
  620. {
  621. return 0;
  622. }
  623. static inline int prcmu_disable_spi2(void)
  624. {
  625. return 0;
  626. }
  627. static inline void db8500_prcmu_system_reset(u16 reset_code) {}
  628. static inline int db8500_prcmu_set_power_state(u8 state, bool keep_ulp_clk,
  629. bool keep_ap_pll)
  630. {
  631. return 0;
  632. }
  633. static inline void db8500_prcmu_enable_wakeups(u32 wakeups) {}
  634. static inline int db8500_prcmu_set_epod(u16 epod_id, u8 epod_state)
  635. {
  636. return 0;
  637. }
  638. static inline int db8500_prcmu_request_clock(u8 clock, bool enable)
  639. {
  640. return 0;
  641. }
  642. static inline int db8500_prcmu_set_display_clocks(void)
  643. {
  644. return 0;
  645. }
  646. static inline int db8500_prcmu_disable_dsipll(void)
  647. {
  648. return 0;
  649. }
  650. static inline int db8500_prcmu_enable_dsipll(void)
  651. {
  652. return 0;
  653. }
  654. static inline int db8500_prcmu_config_esram0_deep_sleep(u8 state)
  655. {
  656. return 0;
  657. }
  658. static inline void db8500_prcmu_config_abb_event_readout(u32 abb_events) {}
  659. static inline void db8500_prcmu_get_abb_event_buffer(void __iomem **buf) {}
  660. static inline u16 db8500_prcmu_get_reset_code(void)
  661. {
  662. return 0;
  663. }
  664. static inline int prcmu_config_a9wdog(u8 num, bool sleep_auto_off)
  665. {
  666. return 0;
  667. }
  668. static inline int prcmu_enable_a9wdog(u8 id)
  669. {
  670. return 0;
  671. }
  672. static inline int prcmu_disable_a9wdog(u8 id)
  673. {
  674. return 0;
  675. }
  676. static inline int prcmu_kick_a9wdog(u8 id)
  677. {
  678. return 0;
  679. }
  680. static inline int prcmu_load_a9wdog(u8 id, u32 val)
  681. {
  682. return 0;
  683. }
  684. static inline bool db8500_prcmu_is_ac_wake_requested(void)
  685. {
  686. return 0;
  687. }
  688. static inline int db8500_prcmu_set_arm_opp(u8 opp)
  689. {
  690. return 0;
  691. }
  692. static inline int db8500_prcmu_get_arm_opp(void)
  693. {
  694. return 0;
  695. }
  696. #endif /* !CONFIG_MFD_DB8500_PRCMU */
  697. #endif /* __MFD_DB8500_PRCMU_H */