db8500-prcmu.h 22 KB

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