db8500-prcmu.h 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796
  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 prcmu_power_status - results from set_power_state
  415. * @PRCMU_SLEEP_OK: Sleep went ok
  416. * @PRCMU_DEEP_SLEEP_OK: DeepSleep went ok
  417. * @PRCMU_IDLE_OK: Idle went ok
  418. * @PRCMU_DEEPIDLE_OK: DeepIdle went ok
  419. * @PRCMU_PRCMU2ARMPENDINGIT_ER: Pending interrupt detected
  420. * @PRCMU_ARMPENDINGIT_ER: Pending interrupt detected
  421. *
  422. */
  423. enum prcmu_power_status {
  424. PRCMU_SLEEP_OK = 0xf3,
  425. PRCMU_DEEP_SLEEP_OK = 0xf6,
  426. PRCMU_IDLE_OK = 0xf0,
  427. PRCMU_DEEPIDLE_OK = 0xe3,
  428. PRCMU_PRCMU2ARMPENDINGIT_ER = 0x91,
  429. PRCMU_ARMPENDINGIT_ER = 0x93,
  430. };
  431. /*
  432. * Definitions for autonomous power management configuration.
  433. */
  434. #define PRCMU_AUTO_PM_OFF 0
  435. #define PRCMU_AUTO_PM_ON 1
  436. #define PRCMU_AUTO_PM_POWER_ON_HSEM BIT(0)
  437. #define PRCMU_AUTO_PM_POWER_ON_ABB_FIFO_IT BIT(1)
  438. enum prcmu_auto_pm_policy {
  439. PRCMU_AUTO_PM_POLICY_NO_CHANGE,
  440. PRCMU_AUTO_PM_POLICY_DSP_OFF_HWP_OFF,
  441. PRCMU_AUTO_PM_POLICY_DSP_OFF_RAMRET_HWP_OFF,
  442. PRCMU_AUTO_PM_POLICY_DSP_CLK_OFF_HWP_OFF,
  443. PRCMU_AUTO_PM_POLICY_DSP_CLK_OFF_HWP_CLK_OFF,
  444. };
  445. /**
  446. * struct prcmu_auto_pm_config - Autonomous power management configuration.
  447. * @sia_auto_pm_enable: SIA autonomous pm enable. (PRCMU_AUTO_PM_{OFF,ON})
  448. * @sia_power_on: SIA power ON enable. (PRCMU_AUTO_PM_POWER_ON_* bitmask)
  449. * @sia_policy: SIA power policy. (enum prcmu_auto_pm_policy)
  450. * @sva_auto_pm_enable: SVA autonomous pm enable. (PRCMU_AUTO_PM_{OFF,ON})
  451. * @sva_power_on: SVA power ON enable. (PRCMU_AUTO_PM_POWER_ON_* bitmask)
  452. * @sva_policy: SVA power policy. (enum prcmu_auto_pm_policy)
  453. */
  454. struct prcmu_auto_pm_config {
  455. u8 sia_auto_pm_enable;
  456. u8 sia_power_on;
  457. u8 sia_policy;
  458. u8 sva_auto_pm_enable;
  459. u8 sva_power_on;
  460. u8 sva_policy;
  461. };
  462. #define PRCMU_FW_PROJECT_U8500 2
  463. #define PRCMU_FW_PROJECT_U9500 4
  464. #define PRCMU_FW_PROJECT_U8500_C2 7
  465. #define PRCMU_FW_PROJECT_U9500_C2 11
  466. #define PRCMU_FW_PROJECT_U8520 13
  467. #define PRCMU_FW_PROJECT_U8420 14
  468. struct prcmu_fw_version {
  469. u8 project;
  470. u8 api_version;
  471. u8 func_version;
  472. u8 errata;
  473. };
  474. #ifdef CONFIG_MFD_DB8500_PRCMU
  475. void db8500_prcmu_early_init(void);
  476. int prcmu_set_rc_a2p(enum romcode_write);
  477. enum romcode_read prcmu_get_rc_p2a(void);
  478. enum ap_pwrst prcmu_get_xp70_current_state(void);
  479. bool prcmu_has_arm_maxopp(void);
  480. struct prcmu_fw_version *prcmu_get_fw_version(void);
  481. int prcmu_request_ape_opp_100_voltage(bool enable);
  482. int prcmu_release_usb_wakeup_state(void);
  483. void prcmu_configure_auto_pm(struct prcmu_auto_pm_config *sleep,
  484. struct prcmu_auto_pm_config *idle);
  485. bool prcmu_is_auto_pm_enabled(void);
  486. int prcmu_config_clkout(u8 clkout, u8 source, u8 div);
  487. int prcmu_set_clock_divider(u8 clock, u8 divider);
  488. int db8500_prcmu_config_hotdog(u8 threshold);
  489. int db8500_prcmu_config_hotmon(u8 low, u8 high);
  490. int db8500_prcmu_start_temp_sense(u16 cycles32k);
  491. int db8500_prcmu_stop_temp_sense(void);
  492. int prcmu_abb_read(u8 slave, u8 reg, u8 *value, u8 size);
  493. int prcmu_abb_write(u8 slave, u8 reg, u8 *value, u8 size);
  494. void prcmu_ac_wake_req(void);
  495. void prcmu_ac_sleep_req(void);
  496. void db8500_prcmu_modem_reset(void);
  497. int db8500_prcmu_config_a9wdog(u8 num, bool sleep_auto_off);
  498. int db8500_prcmu_enable_a9wdog(u8 id);
  499. int db8500_prcmu_disable_a9wdog(u8 id);
  500. int db8500_prcmu_kick_a9wdog(u8 id);
  501. int db8500_prcmu_load_a9wdog(u8 id, u32 val);
  502. void db8500_prcmu_system_reset(u16 reset_code);
  503. int db8500_prcmu_set_power_state(u8 state, bool keep_ulp_clk, bool keep_ap_pll);
  504. u8 db8500_prcmu_get_power_state_result(void);
  505. int db8500_prcmu_gic_decouple(void);
  506. int db8500_prcmu_gic_recouple(void);
  507. int db8500_prcmu_copy_gic_settings(void);
  508. bool db8500_prcmu_gic_pending_irq(void);
  509. bool db8500_prcmu_pending_irq(void);
  510. bool db8500_prcmu_is_cpu_in_wfi(int cpu);
  511. void db8500_prcmu_enable_wakeups(u32 wakeups);
  512. int db8500_prcmu_set_epod(u16 epod_id, u8 epod_state);
  513. int db8500_prcmu_request_clock(u8 clock, bool enable);
  514. int db8500_prcmu_set_display_clocks(void);
  515. int db8500_prcmu_disable_dsipll(void);
  516. int db8500_prcmu_enable_dsipll(void);
  517. void db8500_prcmu_config_abb_event_readout(u32 abb_events);
  518. void db8500_prcmu_get_abb_event_buffer(void __iomem **buf);
  519. int db8500_prcmu_config_esram0_deep_sleep(u8 state);
  520. u16 db8500_prcmu_get_reset_code(void);
  521. bool db8500_prcmu_is_ac_wake_requested(void);
  522. int db8500_prcmu_set_arm_opp(u8 opp);
  523. int db8500_prcmu_get_arm_opp(void);
  524. int db8500_prcmu_set_ape_opp(u8 opp);
  525. int db8500_prcmu_get_ape_opp(void);
  526. int db8500_prcmu_set_ddr_opp(u8 opp);
  527. int db8500_prcmu_get_ddr_opp(void);
  528. u32 db8500_prcmu_read(unsigned int reg);
  529. void db8500_prcmu_write(unsigned int reg, u32 value);
  530. void db8500_prcmu_write_masked(unsigned int reg, u32 mask, u32 value);
  531. #else /* !CONFIG_MFD_DB8500_PRCMU */
  532. static inline void db8500_prcmu_early_init(void) {}
  533. static inline int prcmu_set_rc_a2p(enum romcode_write code)
  534. {
  535. return 0;
  536. }
  537. static inline enum romcode_read prcmu_get_rc_p2a(void)
  538. {
  539. return INIT;
  540. }
  541. static inline enum ap_pwrst prcmu_get_xp70_current_state(void)
  542. {
  543. return AP_EXECUTE;
  544. }
  545. static inline bool prcmu_has_arm_maxopp(void)
  546. {
  547. return false;
  548. }
  549. static inline struct prcmu_fw_version *prcmu_get_fw_version(void)
  550. {
  551. return NULL;
  552. }
  553. static inline int db8500_prcmu_set_ape_opp(u8 opp)
  554. {
  555. return 0;
  556. }
  557. static inline int db8500_prcmu_get_ape_opp(void)
  558. {
  559. return APE_100_OPP;
  560. }
  561. static inline int prcmu_request_ape_opp_100_voltage(bool enable)
  562. {
  563. return 0;
  564. }
  565. static inline int prcmu_release_usb_wakeup_state(void)
  566. {
  567. return 0;
  568. }
  569. static inline int db8500_prcmu_set_ddr_opp(u8 opp)
  570. {
  571. return 0;
  572. }
  573. static inline int db8500_prcmu_get_ddr_opp(void)
  574. {
  575. return DDR_100_OPP;
  576. }
  577. static inline void prcmu_configure_auto_pm(struct prcmu_auto_pm_config *sleep,
  578. struct prcmu_auto_pm_config *idle)
  579. {
  580. }
  581. static inline bool prcmu_is_auto_pm_enabled(void)
  582. {
  583. return false;
  584. }
  585. static inline int prcmu_config_clkout(u8 clkout, u8 source, u8 div)
  586. {
  587. return 0;
  588. }
  589. static inline int prcmu_set_clock_divider(u8 clock, u8 divider)
  590. {
  591. return 0;
  592. }
  593. static inline int db8500_prcmu_config_hotdog(u8 threshold)
  594. {
  595. return 0;
  596. }
  597. static inline int db8500_prcmu_config_hotmon(u8 low, u8 high)
  598. {
  599. return 0;
  600. }
  601. static inline int db8500_prcmu_start_temp_sense(u16 cycles32k)
  602. {
  603. return 0;
  604. }
  605. static inline int db8500_prcmu_stop_temp_sense(void)
  606. {
  607. return 0;
  608. }
  609. static inline int prcmu_abb_read(u8 slave, u8 reg, u8 *value, u8 size)
  610. {
  611. return -ENOSYS;
  612. }
  613. static inline int prcmu_abb_write(u8 slave, u8 reg, u8 *value, u8 size)
  614. {
  615. return -ENOSYS;
  616. }
  617. static inline void prcmu_ac_wake_req(void) {}
  618. static inline void prcmu_ac_sleep_req(void) {}
  619. static inline void db8500_prcmu_modem_reset(void) {}
  620. static inline void db8500_prcmu_system_reset(u16 reset_code) {}
  621. static inline int db8500_prcmu_set_power_state(u8 state, bool keep_ulp_clk,
  622. bool keep_ap_pll)
  623. {
  624. return 0;
  625. }
  626. static inline u8 db8500_prcmu_get_power_state_result(void)
  627. {
  628. return 0;
  629. }
  630. static inline void db8500_prcmu_enable_wakeups(u32 wakeups) {}
  631. static inline int db8500_prcmu_set_epod(u16 epod_id, u8 epod_state)
  632. {
  633. return 0;
  634. }
  635. static inline int db8500_prcmu_request_clock(u8 clock, bool enable)
  636. {
  637. return 0;
  638. }
  639. static inline int db8500_prcmu_set_display_clocks(void)
  640. {
  641. return 0;
  642. }
  643. static inline int db8500_prcmu_disable_dsipll(void)
  644. {
  645. return 0;
  646. }
  647. static inline int db8500_prcmu_enable_dsipll(void)
  648. {
  649. return 0;
  650. }
  651. static inline int db8500_prcmu_config_esram0_deep_sleep(u8 state)
  652. {
  653. return 0;
  654. }
  655. static inline void db8500_prcmu_config_abb_event_readout(u32 abb_events) {}
  656. static inline void db8500_prcmu_get_abb_event_buffer(void __iomem **buf) {}
  657. static inline u16 db8500_prcmu_get_reset_code(void)
  658. {
  659. return 0;
  660. }
  661. static inline int db8500_prcmu_config_a9wdog(u8 num, bool sleep_auto_off)
  662. {
  663. return 0;
  664. }
  665. static inline int db8500_prcmu_enable_a9wdog(u8 id)
  666. {
  667. return 0;
  668. }
  669. static inline int db8500_prcmu_disable_a9wdog(u8 id)
  670. {
  671. return 0;
  672. }
  673. static inline int db8500_prcmu_kick_a9wdog(u8 id)
  674. {
  675. return 0;
  676. }
  677. static inline int db8500_prcmu_load_a9wdog(u8 id, u32 val)
  678. {
  679. return 0;
  680. }
  681. static inline bool db8500_prcmu_is_ac_wake_requested(void)
  682. {
  683. return 0;
  684. }
  685. static inline int db8500_prcmu_set_arm_opp(u8 opp)
  686. {
  687. return 0;
  688. }
  689. static inline int db8500_prcmu_get_arm_opp(void)
  690. {
  691. return 0;
  692. }
  693. static inline u32 db8500_prcmu_read(unsigned int reg)
  694. {
  695. return 0;
  696. }
  697. static inline void db8500_prcmu_write(unsigned int reg, u32 value) {}
  698. static inline void db8500_prcmu_write_masked(unsigned int reg, u32 mask,
  699. u32 value) {}
  700. #endif /* !CONFIG_MFD_DB8500_PRCMU */
  701. #endif /* __MFD_DB8500_PRCMU_H */