db8500-prcmu.h 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978
  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/notifier.h>
  14. /* This portion previously known as <mach/prcmu-fw-defs_v1.h> */
  15. /**
  16. * enum state - ON/OFF state definition
  17. * @OFF: State is ON
  18. * @ON: State is OFF
  19. *
  20. */
  21. enum state {
  22. OFF = 0x0,
  23. ON = 0x1,
  24. };
  25. /**
  26. * enum ret_state - general purpose On/Off/Retention states
  27. *
  28. */
  29. enum ret_state {
  30. OFFST = 0,
  31. ONST = 1,
  32. RETST = 2
  33. };
  34. /**
  35. * enum clk_arm - ARM Cortex A9 clock schemes
  36. * @A9_OFF:
  37. * @A9_BOOT:
  38. * @A9_OPPT1:
  39. * @A9_OPPT2:
  40. * @A9_EXTCLK:
  41. */
  42. enum clk_arm {
  43. A9_OFF,
  44. A9_BOOT,
  45. A9_OPPT1,
  46. A9_OPPT2,
  47. A9_EXTCLK
  48. };
  49. /**
  50. * enum clk_gen - GEN#0/GEN#1 clock schemes
  51. * @GEN_OFF:
  52. * @GEN_BOOT:
  53. * @GEN_OPPT1:
  54. */
  55. enum clk_gen {
  56. GEN_OFF,
  57. GEN_BOOT,
  58. GEN_OPPT1,
  59. };
  60. /* some information between arm and xp70 */
  61. /**
  62. * enum romcode_write - Romcode message written by A9 AND read by XP70
  63. * @RDY_2_DS: Value set when ApDeepSleep state can be executed by XP70
  64. * @RDY_2_XP70_RST: Value set when 0x0F has been successfully polled by the
  65. * romcode. The xp70 will go into self-reset
  66. */
  67. enum romcode_write {
  68. RDY_2_DS = 0x09,
  69. RDY_2_XP70_RST = 0x10
  70. };
  71. /**
  72. * enum romcode_read - Romcode message written by XP70 and read by A9
  73. * @INIT: Init value when romcode field is not used
  74. * @FS_2_DS: Value set when power state is going from ApExecute to
  75. * ApDeepSleep
  76. * @END_DS: Value set when ApDeepSleep power state is reached coming from
  77. * ApExecute state
  78. * @DS_TO_FS: Value set when power state is going from ApDeepSleep to
  79. * ApExecute
  80. * @END_FS: Value set when ApExecute power state is reached coming from
  81. * ApDeepSleep state
  82. * @SWR: Value set when power state is going to ApReset
  83. * @END_SWR: Value set when the xp70 finished executing ApReset actions and
  84. * waits for romcode acknowledgment to go to self-reset
  85. */
  86. enum romcode_read {
  87. INIT = 0x00,
  88. FS_2_DS = 0x0A,
  89. END_DS = 0x0B,
  90. DS_TO_FS = 0x0C,
  91. END_FS = 0x0D,
  92. SWR = 0x0E,
  93. END_SWR = 0x0F
  94. };
  95. /**
  96. * enum ap_pwrst - current power states defined in PRCMU firmware
  97. * @NO_PWRST: Current power state init
  98. * @AP_BOOT: Current power state is apBoot
  99. * @AP_EXECUTE: Current power state is apExecute
  100. * @AP_DEEP_SLEEP: Current power state is apDeepSleep
  101. * @AP_SLEEP: Current power state is apSleep
  102. * @AP_IDLE: Current power state is apIdle
  103. * @AP_RESET: Current power state is apReset
  104. */
  105. enum ap_pwrst {
  106. NO_PWRST = 0x00,
  107. AP_BOOT = 0x01,
  108. AP_EXECUTE = 0x02,
  109. AP_DEEP_SLEEP = 0x03,
  110. AP_SLEEP = 0x04,
  111. AP_IDLE = 0x05,
  112. AP_RESET = 0x06
  113. };
  114. /**
  115. * enum ap_pwrst_trans - Transition states defined in PRCMU firmware
  116. * @NO_TRANSITION: No power state transition
  117. * @APEXECUTE_TO_APSLEEP: Power state transition from ApExecute to ApSleep
  118. * @APIDLE_TO_APSLEEP: Power state transition from ApIdle to ApSleep
  119. * @APBOOT_TO_APEXECUTE: Power state transition from ApBoot to ApExecute
  120. * @APEXECUTE_TO_APDEEPSLEEP: Power state transition from ApExecute to
  121. * ApDeepSleep
  122. * @APEXECUTE_TO_APIDLE: Power state transition from ApExecute to ApIdle
  123. */
  124. enum ap_pwrst_trans {
  125. NO_TRANSITION = 0x00,
  126. APEXECUTE_TO_APSLEEP = 0x01,
  127. APIDLE_TO_APSLEEP = 0x02, /* To be removed */
  128. PRCMU_AP_SLEEP = 0x01,
  129. APBOOT_TO_APEXECUTE = 0x03,
  130. APEXECUTE_TO_APDEEPSLEEP = 0x04, /* To be removed */
  131. PRCMU_AP_DEEP_SLEEP = 0x04,
  132. APEXECUTE_TO_APIDLE = 0x05, /* To be removed */
  133. PRCMU_AP_IDLE = 0x05,
  134. PRCMU_AP_DEEP_IDLE = 0x07,
  135. };
  136. /**
  137. * enum ddr_pwrst - DDR power states definition
  138. * @DDR_PWR_STATE_UNCHANGED: SDRAM and DDR controller state is unchanged
  139. * @DDR_PWR_STATE_ON:
  140. * @DDR_PWR_STATE_OFFLOWLAT:
  141. * @DDR_PWR_STATE_OFFHIGHLAT:
  142. */
  143. enum ddr_pwrst {
  144. DDR_PWR_STATE_UNCHANGED = 0x00,
  145. DDR_PWR_STATE_ON = 0x01,
  146. DDR_PWR_STATE_OFFLOWLAT = 0x02,
  147. DDR_PWR_STATE_OFFHIGHLAT = 0x03
  148. };
  149. /**
  150. * enum arm_opp - ARM OPP states definition
  151. * @ARM_OPP_INIT:
  152. * @ARM_NO_CHANGE: The ARM operating point is unchanged
  153. * @ARM_100_OPP: The new ARM operating point is arm100opp
  154. * @ARM_50_OPP: The new ARM operating point is arm50opp
  155. * @ARM_MAX_OPP: Operating point is "max" (more than 100)
  156. * @ARM_MAX_FREQ100OPP: Set max opp if available, else 100
  157. * @ARM_EXTCLK: The new ARM operating point is armExtClk
  158. */
  159. enum arm_opp {
  160. ARM_OPP_INIT = 0x00,
  161. ARM_NO_CHANGE = 0x01,
  162. ARM_100_OPP = 0x02,
  163. ARM_50_OPP = 0x03,
  164. ARM_MAX_OPP = 0x04,
  165. ARM_MAX_FREQ100OPP = 0x05,
  166. ARM_EXTCLK = 0x07
  167. };
  168. /**
  169. * enum ape_opp - APE OPP states definition
  170. * @APE_OPP_INIT:
  171. * @APE_NO_CHANGE: The APE operating point is unchanged
  172. * @APE_100_OPP: The new APE operating point is ape100opp
  173. * @APE_50_OPP: 50%
  174. */
  175. enum ape_opp {
  176. APE_OPP_INIT = 0x00,
  177. APE_NO_CHANGE = 0x01,
  178. APE_100_OPP = 0x02,
  179. APE_50_OPP = 0x03
  180. };
  181. /**
  182. * enum hw_acc_state - State definition for hardware accelerator
  183. * @HW_NO_CHANGE: The hardware accelerator state must remain unchanged
  184. * @HW_OFF: The hardware accelerator must be switched off
  185. * @HW_OFF_RAMRET: The hardware accelerator must be switched off with its
  186. * internal RAM in retention
  187. * @HW_ON: The hwa hardware accelerator hwa must be switched on
  188. *
  189. * NOTE! Deprecated, to be removed when all users switched over to use the
  190. * regulator API.
  191. */
  192. enum hw_acc_state {
  193. HW_NO_CHANGE = 0x00,
  194. HW_OFF = 0x01,
  195. HW_OFF_RAMRET = 0x02,
  196. HW_ON = 0x04
  197. };
  198. /**
  199. * enum mbox_2_arm_stat - Status messages definition for mbox_arm
  200. * @BOOT_TO_EXECUTEOK: The apBoot to apExecute state transition has been
  201. * completed
  202. * @DEEPSLEEPOK: The apExecute to apDeepSleep state transition has been
  203. * completed
  204. * @SLEEPOK: The apExecute to apSleep state transition has been completed
  205. * @IDLEOK: The apExecute to apIdle state transition has been completed
  206. * @SOFTRESETOK: The A9 watchdog/ SoftReset state has been completed
  207. * @SOFTRESETGO : The A9 watchdog/SoftReset state is on going
  208. * @BOOT_TO_EXECUTE: The apBoot to apExecute state transition is on going
  209. * @EXECUTE_TO_DEEPSLEEP: The apExecute to apDeepSleep state transition is on
  210. * going
  211. * @DEEPSLEEP_TO_EXECUTE: The apDeepSleep to apExecute state transition is on
  212. * going
  213. * @DEEPSLEEP_TO_EXECUTEOK: The apDeepSleep to apExecute state transition has
  214. * been completed
  215. * @EXECUTE_TO_SLEEP: The apExecute to apSleep state transition is on going
  216. * @SLEEP_TO_EXECUTE: The apSleep to apExecute state transition is on going
  217. * @SLEEP_TO_EXECUTEOK: The apSleep to apExecute state transition has been
  218. * completed
  219. * @EXECUTE_TO_IDLE: The apExecute to apIdle state transition is on going
  220. * @IDLE_TO_EXECUTE: The apIdle to apExecute state transition is on going
  221. * @IDLE_TO_EXECUTEOK: The apIdle to apExecute state transition has been
  222. * completed
  223. * @INIT_STATUS: Status init
  224. */
  225. enum ap_pwrsttr_status {
  226. BOOT_TO_EXECUTEOK = 0xFF,
  227. DEEPSLEEPOK = 0xFE,
  228. SLEEPOK = 0xFD,
  229. IDLEOK = 0xFC,
  230. SOFTRESETOK = 0xFB,
  231. SOFTRESETGO = 0xFA,
  232. BOOT_TO_EXECUTE = 0xF9,
  233. EXECUTE_TO_DEEPSLEEP = 0xF8,
  234. DEEPSLEEP_TO_EXECUTE = 0xF7,
  235. DEEPSLEEP_TO_EXECUTEOK = 0xF6,
  236. EXECUTE_TO_SLEEP = 0xF5,
  237. SLEEP_TO_EXECUTE = 0xF4,
  238. SLEEP_TO_EXECUTEOK = 0xF3,
  239. EXECUTE_TO_IDLE = 0xF2,
  240. IDLE_TO_EXECUTE = 0xF1,
  241. IDLE_TO_EXECUTEOK = 0xF0,
  242. RDYTODS_RETURNTOEXE = 0xEF,
  243. NORDYTODS_RETURNTOEXE = 0xEE,
  244. EXETOSLEEP_RETURNTOEXE = 0xED,
  245. EXETOIDLE_RETURNTOEXE = 0xEC,
  246. INIT_STATUS = 0xEB,
  247. /*error messages */
  248. INITERROR = 0x00,
  249. PLLARMLOCKP_ER = 0x01,
  250. PLLDDRLOCKP_ER = 0x02,
  251. PLLSOCLOCKP_ER = 0x03,
  252. PLLSOCK1LOCKP_ER = 0x04,
  253. ARMWFI_ER = 0x05,
  254. SYSCLKOK_ER = 0x06,
  255. I2C_NACK_DATA_ER = 0x07,
  256. BOOT_ER = 0x08,
  257. I2C_STATUS_ALWAYS_1 = 0x0A,
  258. I2C_NACK_REG_ADDR_ER = 0x0B,
  259. I2C_NACK_DATA0123_ER = 0x1B,
  260. I2C_NACK_ADDR_ER = 0x1F,
  261. CURAPPWRSTISNOT_BOOT = 0x20,
  262. CURAPPWRSTISNOT_EXECUTE = 0x21,
  263. CURAPPWRSTISNOT_SLEEPMODE = 0x22,
  264. CURAPPWRSTISNOT_CORRECTFORIT10 = 0x23,
  265. FIFO4500WUISNOT_WUPEVENT = 0x24,
  266. PLL32KLOCKP_ER = 0x29,
  267. DDRDEEPSLEEPOK_ER = 0x2A,
  268. ROMCODEREADY_ER = 0x50,
  269. WUPBEFOREDS = 0x51,
  270. DDRCONFIG_ER = 0x52,
  271. WUPBEFORESLEEP = 0x53,
  272. WUPBEFOREIDLE = 0x54
  273. }; /* earlier called as mbox_2_arm_stat */
  274. /**
  275. * enum dvfs_stat - DVFS status messages definition
  276. * @DVFS_GO: A state transition DVFS is on going
  277. * @DVFS_ARM100OPPOK: The state transition DVFS has been completed for 100OPP
  278. * @DVFS_ARM50OPPOK: The state transition DVFS has been completed for 50OPP
  279. * @DVFS_ARMEXTCLKOK: The state transition DVFS has been completed for EXTCLK
  280. * @DVFS_NOCHGTCLKOK: The state transition DVFS has been completed for
  281. * NOCHGCLK
  282. * @DVFS_INITSTATUS: Value init
  283. */
  284. enum dvfs_stat {
  285. DVFS_GO = 0xFF,
  286. DVFS_ARM100OPPOK = 0xFE,
  287. DVFS_ARM50OPPOK = 0xFD,
  288. DVFS_ARMEXTCLKOK = 0xFC,
  289. DVFS_NOCHGTCLKOK = 0xFB,
  290. DVFS_INITSTATUS = 0x00
  291. };
  292. /**
  293. * enum sva_mmdsp_stat - SVA MMDSP status messages
  294. * @SVA_MMDSP_GO: SVAMMDSP interrupt has happened
  295. * @SVA_MMDSP_INIT: Status init
  296. */
  297. enum sva_mmdsp_stat {
  298. SVA_MMDSP_GO = 0xFF,
  299. SVA_MMDSP_INIT = 0x00
  300. };
  301. /**
  302. * enum sia_mmdsp_stat - SIA MMDSP status messages
  303. * @SIA_MMDSP_GO: SIAMMDSP interrupt has happened
  304. * @SIA_MMDSP_INIT: Status init
  305. */
  306. enum sia_mmdsp_stat {
  307. SIA_MMDSP_GO = 0xFF,
  308. SIA_MMDSP_INIT = 0x00
  309. };
  310. /**
  311. * enum mbox_to_arm_err - Error messages definition
  312. * @INIT_ERR: Init value
  313. * @PLLARMLOCKP_ERR: PLLARM has not been correctly locked in given time
  314. * @PLLDDRLOCKP_ERR: PLLDDR has not been correctly locked in the given time
  315. * @PLLSOC0LOCKP_ERR: PLLSOC0 has not been correctly locked in the given time
  316. * @PLLSOC1LOCKP_ERR: PLLSOC1 has not been correctly locked in the given time
  317. * @ARMWFI_ERR: The ARM WFI has not been correctly executed in the given time
  318. * @SYSCLKOK_ERR: The SYSCLK is not available in the given time
  319. * @BOOT_ERR: Romcode has not validated the XP70 self reset in the given time
  320. * @ROMCODESAVECONTEXT: The Romcode didn.t correctly save it secure context
  321. * @VARMHIGHSPEEDVALTO_ERR: The ARM high speed supply value transfered
  322. * through I2C has not been correctly executed in the given time
  323. * @VARMHIGHSPEEDACCESS_ERR: The command value of VarmHighSpeedVal transfered
  324. * through I2C has not been correctly executed in the given time
  325. * @VARMLOWSPEEDVALTO_ERR:The ARM low speed supply value transfered through
  326. * I2C has not been correctly executed in the given time
  327. * @VARMLOWSPEEDACCESS_ERR: The command value of VarmLowSpeedVal transfered
  328. * through I2C has not been correctly executed in the given time
  329. * @VARMRETENTIONVALTO_ERR: The ARM retention supply value transfered through
  330. * I2C has not been correctly executed in the given time
  331. * @VARMRETENTIONACCESS_ERR: The command value of VarmRetentionVal transfered
  332. * through I2C has not been correctly executed in the given time
  333. * @VAPEHIGHSPEEDVALTO_ERR: The APE highspeed supply value transfered through
  334. * I2C has not been correctly executed in the given time
  335. * @VSAFEHPVALTO_ERR: The SAFE high power supply value transfered through I2C
  336. * has not been correctly executed in the given time
  337. * @VMODSEL1VALTO_ERR: The MODEM sel1 supply value transfered through I2C has
  338. * not been correctly executed in the given time
  339. * @VMODSEL2VALTO_ERR: The MODEM sel2 supply value transfered through I2C has
  340. * not been correctly executed in the given time
  341. * @VARMOFFACCESS_ERR: The command value of Varm ON/OFF transfered through
  342. * I2C has not been correctly executed in the given time
  343. * @VAPEOFFACCESS_ERR: The command value of Vape ON/OFF transfered through
  344. * I2C has not been correctly executed in the given time
  345. * @VARMRETACCES_ERR: The command value of Varm retention ON/OFF transfered
  346. * through I2C has not been correctly executed in the given time
  347. * @CURAPPWRSTISNOTBOOT:Generated when Arm want to do power state transition
  348. * ApBoot to ApExecute but the power current state is not Apboot
  349. * @CURAPPWRSTISNOTEXECUTE: Generated when Arm want to do power state
  350. * transition from ApExecute to others power state but the
  351. * power current state is not ApExecute
  352. * @CURAPPWRSTISNOTSLEEPMODE: Generated when wake up events are transmitted
  353. * but the power current state is not ApDeepSleep/ApSleep/ApIdle
  354. * @CURAPPWRSTISNOTCORRECTDBG: Generated when wake up events are transmitted
  355. * but the power current state is not correct
  356. * @ARMREGU1VALTO_ERR:The ArmRegu1 value transferred through I2C has not
  357. * been correctly executed in the given time
  358. * @ARMREGU2VALTO_ERR: The ArmRegu2 value transferred through I2C has not
  359. * been correctly executed in the given time
  360. * @VAPEREGUVALTO_ERR: The VApeRegu value transfered through I2C has not
  361. * been correctly executed in the given time
  362. * @VSMPS3REGUVALTO_ERR: The VSmps3Regu value transfered through I2C has not
  363. * been correctly executed in the given time
  364. * @VMODREGUVALTO_ERR: The VModemRegu value transfered through I2C has not
  365. * been correctly executed in the given time
  366. */
  367. enum mbox_to_arm_err {
  368. INIT_ERR = 0x00,
  369. PLLARMLOCKP_ERR = 0x01,
  370. PLLDDRLOCKP_ERR = 0x02,
  371. PLLSOC0LOCKP_ERR = 0x03,
  372. PLLSOC1LOCKP_ERR = 0x04,
  373. ARMWFI_ERR = 0x05,
  374. SYSCLKOK_ERR = 0x06,
  375. BOOT_ERR = 0x07,
  376. ROMCODESAVECONTEXT = 0x08,
  377. VARMHIGHSPEEDVALTO_ERR = 0x10,
  378. VARMHIGHSPEEDACCESS_ERR = 0x11,
  379. VARMLOWSPEEDVALTO_ERR = 0x12,
  380. VARMLOWSPEEDACCESS_ERR = 0x13,
  381. VARMRETENTIONVALTO_ERR = 0x14,
  382. VARMRETENTIONACCESS_ERR = 0x15,
  383. VAPEHIGHSPEEDVALTO_ERR = 0x16,
  384. VSAFEHPVALTO_ERR = 0x17,
  385. VMODSEL1VALTO_ERR = 0x18,
  386. VMODSEL2VALTO_ERR = 0x19,
  387. VARMOFFACCESS_ERR = 0x1A,
  388. VAPEOFFACCESS_ERR = 0x1B,
  389. VARMRETACCES_ERR = 0x1C,
  390. CURAPPWRSTISNOTBOOT = 0x20,
  391. CURAPPWRSTISNOTEXECUTE = 0x21,
  392. CURAPPWRSTISNOTSLEEPMODE = 0x22,
  393. CURAPPWRSTISNOTCORRECTDBG = 0x23,
  394. ARMREGU1VALTO_ERR = 0x24,
  395. ARMREGU2VALTO_ERR = 0x25,
  396. VAPEREGUVALTO_ERR = 0x26,
  397. VSMPS3REGUVALTO_ERR = 0x27,
  398. VMODREGUVALTO_ERR = 0x28
  399. };
  400. enum hw_acc {
  401. SVAMMDSP = 0,
  402. SVAPIPE = 1,
  403. SIAMMDSP = 2,
  404. SIAPIPE = 3,
  405. SGA = 4,
  406. B2R2MCDE = 5,
  407. ESRAM12 = 6,
  408. ESRAM34 = 7,
  409. };
  410. enum cs_pwrmgt {
  411. PWRDNCS0 = 0,
  412. WKUPCS0 = 1,
  413. PWRDNCS1 = 2,
  414. WKUPCS1 = 3
  415. };
  416. /* Defs related to autonomous power management */
  417. /**
  418. * enum sia_sva_pwr_policy - Power policy
  419. * @NO_CHGT: No change
  420. * @DSPOFF_HWPOFF:
  421. * @DSPOFFRAMRET_HWPOFF:
  422. * @DSPCLKOFF_HWPOFF:
  423. * @DSPCLKOFF_HWPCLKOFF:
  424. *
  425. */
  426. enum sia_sva_pwr_policy {
  427. NO_CHGT = 0x0,
  428. DSPOFF_HWPOFF = 0x1,
  429. DSPOFFRAMRET_HWPOFF = 0x2,
  430. DSPCLKOFF_HWPOFF = 0x3,
  431. DSPCLKOFF_HWPCLKOFF = 0x4,
  432. };
  433. /**
  434. * enum auto_enable - Auto Power enable
  435. * @AUTO_OFF:
  436. * @AUTO_ON:
  437. *
  438. */
  439. enum auto_enable {
  440. AUTO_OFF = 0x0,
  441. AUTO_ON = 0x1,
  442. };
  443. /* End of file previously known as prcmu-fw-defs_v1.h */
  444. /* PRCMU Wakeup defines */
  445. enum prcmu_wakeup_index {
  446. PRCMU_WAKEUP_INDEX_RTC,
  447. PRCMU_WAKEUP_INDEX_RTT0,
  448. PRCMU_WAKEUP_INDEX_RTT1,
  449. PRCMU_WAKEUP_INDEX_HSI0,
  450. PRCMU_WAKEUP_INDEX_HSI1,
  451. PRCMU_WAKEUP_INDEX_USB,
  452. PRCMU_WAKEUP_INDEX_ABB,
  453. PRCMU_WAKEUP_INDEX_ABB_FIFO,
  454. PRCMU_WAKEUP_INDEX_ARM,
  455. NUM_PRCMU_WAKEUP_INDICES
  456. };
  457. #define PRCMU_WAKEUP(_name) (BIT(PRCMU_WAKEUP_INDEX_##_name))
  458. /* PRCMU QoS APE OPP class */
  459. #define PRCMU_QOS_APE_OPP 1
  460. #define PRCMU_QOS_DDR_OPP 2
  461. #define PRCMU_QOS_DEFAULT_VALUE -1
  462. /**
  463. * enum hw_acc_dev - enum for hw accelerators
  464. * @HW_ACC_SVAMMDSP: for SVAMMDSP
  465. * @HW_ACC_SVAPIPE: for SVAPIPE
  466. * @HW_ACC_SIAMMDSP: for SIAMMDSP
  467. * @HW_ACC_SIAPIPE: for SIAPIPE
  468. * @HW_ACC_SGA: for SGA
  469. * @HW_ACC_B2R2: for B2R2
  470. * @HW_ACC_MCDE: for MCDE
  471. * @HW_ACC_ESRAM1: for ESRAM1
  472. * @HW_ACC_ESRAM2: for ESRAM2
  473. * @HW_ACC_ESRAM3: for ESRAM3
  474. * @HW_ACC_ESRAM4: for ESRAM4
  475. * @NUM_HW_ACC: number of hardware accelerators
  476. *
  477. * Different hw accelerators which can be turned ON/
  478. * OFF or put into retention (MMDSPs and ESRAMs).
  479. * Used with EPOD API.
  480. *
  481. * NOTE! Deprecated, to be removed when all users switched over to use the
  482. * regulator API.
  483. */
  484. enum hw_acc_dev {
  485. HW_ACC_SVAMMDSP,
  486. HW_ACC_SVAPIPE,
  487. HW_ACC_SIAMMDSP,
  488. HW_ACC_SIAPIPE,
  489. HW_ACC_SGA,
  490. HW_ACC_B2R2,
  491. HW_ACC_MCDE,
  492. HW_ACC_ESRAM1,
  493. HW_ACC_ESRAM2,
  494. HW_ACC_ESRAM3,
  495. HW_ACC_ESRAM4,
  496. NUM_HW_ACC
  497. };
  498. /*
  499. * Ids for all EPODs (power domains)
  500. * - EPOD_ID_SVAMMDSP: power domain for SVA MMDSP
  501. * - EPOD_ID_SVAPIPE: power domain for SVA pipe
  502. * - EPOD_ID_SIAMMDSP: power domain for SIA MMDSP
  503. * - EPOD_ID_SIAPIPE: power domain for SIA pipe
  504. * - EPOD_ID_SGA: power domain for SGA
  505. * - EPOD_ID_B2R2_MCDE: power domain for B2R2 and MCDE
  506. * - EPOD_ID_ESRAM12: power domain for ESRAM 1 and 2
  507. * - EPOD_ID_ESRAM34: power domain for ESRAM 3 and 4
  508. * - NUM_EPOD_ID: number of power domains
  509. */
  510. #define EPOD_ID_SVAMMDSP 0
  511. #define EPOD_ID_SVAPIPE 1
  512. #define EPOD_ID_SIAMMDSP 2
  513. #define EPOD_ID_SIAPIPE 3
  514. #define EPOD_ID_SGA 4
  515. #define EPOD_ID_B2R2_MCDE 5
  516. #define EPOD_ID_ESRAM12 6
  517. #define EPOD_ID_ESRAM34 7
  518. #define NUM_EPOD_ID 8
  519. /*
  520. * state definition for EPOD (power domain)
  521. * - EPOD_STATE_NO_CHANGE: The EPOD should remain unchanged
  522. * - EPOD_STATE_OFF: The EPOD is switched off
  523. * - EPOD_STATE_RAMRET: The EPOD is switched off with its internal RAM in
  524. * retention
  525. * - EPOD_STATE_ON_CLK_OFF: The EPOD is switched on, clock is still off
  526. * - EPOD_STATE_ON: Same as above, but with clock enabled
  527. */
  528. #define EPOD_STATE_NO_CHANGE 0x00
  529. #define EPOD_STATE_OFF 0x01
  530. #define EPOD_STATE_RAMRET 0x02
  531. #define EPOD_STATE_ON_CLK_OFF 0x03
  532. #define EPOD_STATE_ON 0x04
  533. /*
  534. * CLKOUT sources
  535. */
  536. #define PRCMU_CLKSRC_CLK38M 0x00
  537. #define PRCMU_CLKSRC_ACLK 0x01
  538. #define PRCMU_CLKSRC_SYSCLK 0x02
  539. #define PRCMU_CLKSRC_LCDCLK 0x03
  540. #define PRCMU_CLKSRC_SDMMCCLK 0x04
  541. #define PRCMU_CLKSRC_TVCLK 0x05
  542. #define PRCMU_CLKSRC_TIMCLK 0x06
  543. #define PRCMU_CLKSRC_CLK009 0x07
  544. /* These are only valid for CLKOUT1: */
  545. #define PRCMU_CLKSRC_SIAMMDSPCLK 0x40
  546. #define PRCMU_CLKSRC_I2CCLK 0x41
  547. #define PRCMU_CLKSRC_MSP02CLK 0x42
  548. #define PRCMU_CLKSRC_ARMPLL_OBSCLK 0x43
  549. #define PRCMU_CLKSRC_HSIRXCLK 0x44
  550. #define PRCMU_CLKSRC_HSITXCLK 0x45
  551. #define PRCMU_CLKSRC_ARMCLKFIX 0x46
  552. #define PRCMU_CLKSRC_HDMICLK 0x47
  553. /*
  554. * Definitions for autonomous power management configuration.
  555. */
  556. #define PRCMU_AUTO_PM_OFF 0
  557. #define PRCMU_AUTO_PM_ON 1
  558. #define PRCMU_AUTO_PM_POWER_ON_HSEM BIT(0)
  559. #define PRCMU_AUTO_PM_POWER_ON_ABB_FIFO_IT BIT(1)
  560. enum prcmu_auto_pm_policy {
  561. PRCMU_AUTO_PM_POLICY_NO_CHANGE,
  562. PRCMU_AUTO_PM_POLICY_DSP_OFF_HWP_OFF,
  563. PRCMU_AUTO_PM_POLICY_DSP_OFF_RAMRET_HWP_OFF,
  564. PRCMU_AUTO_PM_POLICY_DSP_CLK_OFF_HWP_OFF,
  565. PRCMU_AUTO_PM_POLICY_DSP_CLK_OFF_HWP_CLK_OFF,
  566. };
  567. /**
  568. * struct prcmu_auto_pm_config - Autonomous power management configuration.
  569. * @sia_auto_pm_enable: SIA autonomous pm enable. (PRCMU_AUTO_PM_{OFF,ON})
  570. * @sia_power_on: SIA power ON enable. (PRCMU_AUTO_PM_POWER_ON_* bitmask)
  571. * @sia_policy: SIA power policy. (enum prcmu_auto_pm_policy)
  572. * @sva_auto_pm_enable: SVA autonomous pm enable. (PRCMU_AUTO_PM_{OFF,ON})
  573. * @sva_power_on: SVA power ON enable. (PRCMU_AUTO_PM_POWER_ON_* bitmask)
  574. * @sva_policy: SVA power policy. (enum prcmu_auto_pm_policy)
  575. */
  576. struct prcmu_auto_pm_config {
  577. u8 sia_auto_pm_enable;
  578. u8 sia_power_on;
  579. u8 sia_policy;
  580. u8 sva_auto_pm_enable;
  581. u8 sva_power_on;
  582. u8 sva_policy;
  583. };
  584. /**
  585. * enum ddr_opp - DDR OPP states definition
  586. * @DDR_100_OPP: The new DDR operating point is ddr100opp
  587. * @DDR_50_OPP: The new DDR operating point is ddr50opp
  588. * @DDR_25_OPP: The new DDR operating point is ddr25opp
  589. */
  590. enum ddr_opp {
  591. DDR_100_OPP = 0x00,
  592. DDR_50_OPP = 0x01,
  593. DDR_25_OPP = 0x02,
  594. };
  595. /*
  596. * Clock identifiers.
  597. */
  598. enum prcmu_clock {
  599. PRCMU_SGACLK,
  600. PRCMU_UARTCLK,
  601. PRCMU_MSP02CLK,
  602. PRCMU_MSP1CLK,
  603. PRCMU_I2CCLK,
  604. PRCMU_SDMMCCLK,
  605. PRCMU_SLIMCLK,
  606. PRCMU_PER1CLK,
  607. PRCMU_PER2CLK,
  608. PRCMU_PER3CLK,
  609. PRCMU_PER5CLK,
  610. PRCMU_PER6CLK,
  611. PRCMU_PER7CLK,
  612. PRCMU_LCDCLK,
  613. PRCMU_BMLCLK,
  614. PRCMU_HSITXCLK,
  615. PRCMU_HSIRXCLK,
  616. PRCMU_HDMICLK,
  617. PRCMU_APEATCLK,
  618. PRCMU_APETRACECLK,
  619. PRCMU_MCDECLK,
  620. PRCMU_IPI2CCLK,
  621. PRCMU_DSIALTCLK,
  622. PRCMU_DMACLK,
  623. PRCMU_B2R2CLK,
  624. PRCMU_TVCLK,
  625. PRCMU_SSPCLK,
  626. PRCMU_RNGCLK,
  627. PRCMU_UICCCLK,
  628. PRCMU_NUM_REG_CLOCKS,
  629. PRCMU_SYSCLK = PRCMU_NUM_REG_CLOCKS,
  630. PRCMU_TIMCLK,
  631. };
  632. /*
  633. * Definitions for controlling ESRAM0 in deep sleep.
  634. */
  635. #define ESRAM0_DEEP_SLEEP_STATE_OFF 1
  636. #define ESRAM0_DEEP_SLEEP_STATE_RET 2
  637. #ifdef CONFIG_MFD_DB8500_PRCMU
  638. void __init prcmu_early_init(void);
  639. int prcmu_set_display_clocks(void);
  640. int prcmu_disable_dsipll(void);
  641. int prcmu_enable_dsipll(void);
  642. #else
  643. static inline void __init prcmu_early_init(void) {}
  644. #endif
  645. #ifdef CONFIG_MFD_DB8500_PRCMU
  646. int prcmu_set_rc_a2p(enum romcode_write);
  647. enum romcode_read prcmu_get_rc_p2a(void);
  648. enum ap_pwrst prcmu_get_xp70_current_state(void);
  649. int prcmu_set_power_state(u8 state, bool keep_ulp_clk, bool keep_ap_pll);
  650. void prcmu_enable_wakeups(u32 wakeups);
  651. static inline void prcmu_disable_wakeups(void)
  652. {
  653. prcmu_enable_wakeups(0);
  654. }
  655. void prcmu_config_abb_event_readout(u32 abb_events);
  656. void prcmu_get_abb_event_buffer(void __iomem **buf);
  657. int prcmu_set_arm_opp(u8 opp);
  658. int prcmu_get_arm_opp(void);
  659. bool prcmu_has_arm_maxopp(void);
  660. bool prcmu_is_u8400(void);
  661. int prcmu_set_ape_opp(u8 opp);
  662. int prcmu_get_ape_opp(void);
  663. int prcmu_request_ape_opp_100_voltage(bool enable);
  664. int prcmu_release_usb_wakeup_state(void);
  665. int prcmu_set_ddr_opp(u8 opp);
  666. int prcmu_get_ddr_opp(void);
  667. unsigned long prcmu_qos_get_cpufreq_opp_delay(void);
  668. void prcmu_qos_set_cpufreq_opp_delay(unsigned long);
  669. /* NOTE! Use regulator framework instead */
  670. int prcmu_set_hwacc(u16 hw_acc_dev, u8 state);
  671. int prcmu_set_epod(u16 epod_id, u8 epod_state);
  672. void prcmu_configure_auto_pm(struct prcmu_auto_pm_config *sleep,
  673. struct prcmu_auto_pm_config *idle);
  674. bool prcmu_is_auto_pm_enabled(void);
  675. int prcmu_config_clkout(u8 clkout, u8 source, u8 div);
  676. int prcmu_request_clock(u8 clock, bool enable);
  677. int prcmu_set_clock_divider(u8 clock, u8 divider);
  678. int prcmu_config_esram0_deep_sleep(u8 state);
  679. int prcmu_config_hotdog(u8 threshold);
  680. int prcmu_config_hotmon(u8 low, u8 high);
  681. int prcmu_start_temp_sense(u16 cycles32k);
  682. int prcmu_stop_temp_sense(void);
  683. int prcmu_abb_read(u8 slave, u8 reg, u8 *value, u8 size);
  684. int prcmu_abb_write(u8 slave, u8 reg, u8 *value, u8 size);
  685. void prcmu_ac_wake_req(void);
  686. void prcmu_ac_sleep_req(void);
  687. void prcmu_system_reset(u16 reset_code);
  688. void prcmu_modem_reset(void);
  689. bool prcmu_is_ac_wake_requested(void);
  690. void prcmu_enable_spi2(void);
  691. void prcmu_disable_spi2(void);
  692. #else /* !CONFIG_MFD_DB8500_PRCMU */
  693. static inline int prcmu_set_rc_a2p(enum romcode_write code)
  694. {
  695. return 0;
  696. }
  697. static inline enum romcode_read prcmu_get_rc_p2a(void)
  698. {
  699. return INIT;
  700. }
  701. static inline enum ap_pwrst prcmu_get_xp70_current_state(void)
  702. {
  703. return AP_EXECUTE;
  704. }
  705. static inline int prcmu_set_power_state(u8 state, bool keep_ulp_clk,
  706. bool keep_ap_pll)
  707. {
  708. return 0;
  709. }
  710. static inline void prcmu_enable_wakeups(u32 wakeups) {}
  711. static inline void prcmu_disable_wakeups(void) {}
  712. static inline void prcmu_config_abb_event_readout(u32 abb_events) {}
  713. static inline int prcmu_set_arm_opp(u8 opp)
  714. {
  715. return 0;
  716. }
  717. static inline int prcmu_get_arm_opp(void)
  718. {
  719. return ARM_100_OPP;
  720. }
  721. static bool prcmu_has_arm_maxopp(void)
  722. {
  723. return false;
  724. }
  725. static bool prcmu_is_u8400(void)
  726. {
  727. return false;
  728. }
  729. static inline int prcmu_set_ape_opp(u8 opp)
  730. {
  731. return 0;
  732. }
  733. static inline int prcmu_get_ape_opp(void)
  734. {
  735. return APE_100_OPP;
  736. }
  737. static inline int prcmu_request_ape_opp_100_voltage(bool enable)
  738. {
  739. return 0;
  740. }
  741. static inline int prcmu_release_usb_wakeup_state(void)
  742. {
  743. return 0;
  744. }
  745. static inline int prcmu_set_ddr_opp(u8 opp)
  746. {
  747. return 0;
  748. }
  749. static inline int prcmu_get_ddr_opp(void)
  750. {
  751. return DDR_100_OPP;
  752. }
  753. static inline unsigned long prcmu_qos_get_cpufreq_opp_delay(void)
  754. {
  755. return 0;
  756. }
  757. static inline void prcmu_qos_set_cpufreq_opp_delay(unsigned long n) {}
  758. static inline int prcmu_set_hwacc(u16 hw_acc_dev, u8 state)
  759. {
  760. return 0;
  761. }
  762. static inline void prcmu_configure_auto_pm(struct prcmu_auto_pm_config *sleep,
  763. struct prcmu_auto_pm_config *idle)
  764. {
  765. }
  766. static inline bool prcmu_is_auto_pm_enabled(void)
  767. {
  768. return false;
  769. }
  770. static inline int prcmu_config_clkout(u8 clkout, u8 source, u8 div)
  771. {
  772. return 0;
  773. }
  774. static inline int prcmu_request_clock(u8 clock, bool enable)
  775. {
  776. return 0;
  777. }
  778. static inline int prcmu_set_clock_divider(u8 clock, u8 divider)
  779. {
  780. return 0;
  781. }
  782. int prcmu_config_esram0_deep_sleep(u8 state)
  783. {
  784. return 0;
  785. }
  786. static inline int prcmu_config_hotdog(u8 threshold)
  787. {
  788. return 0;
  789. }
  790. static inline int prcmu_config_hotmon(u8 low, u8 high)
  791. {
  792. return 0;
  793. }
  794. static inline int prcmu_start_temp_sense(u16 cycles32k)
  795. {
  796. return 0;
  797. }
  798. static inline int prcmu_stop_temp_sense(void)
  799. {
  800. return 0;
  801. }
  802. static inline int prcmu_abb_read(u8 slave, u8 reg, u8 *value, u8 size)
  803. {
  804. return -ENOSYS;
  805. }
  806. static inline int prcmu_abb_write(u8 slave, u8 reg, u8 *value, u8 size)
  807. {
  808. return -ENOSYS;
  809. }
  810. static inline void prcmu_ac_wake_req(void) {}
  811. static inline void prcmu_ac_sleep_req(void) {}
  812. static inline void prcmu_system_reset(u16 reset_code) {}
  813. static inline void prcmu_modem_reset(void) {}
  814. static inline bool prcmu_is_ac_wake_requested(void)
  815. {
  816. return false;
  817. }
  818. #ifndef CONFIG_UX500_SOC_DB5500
  819. static inline int prcmu_set_display_clocks(void)
  820. {
  821. return 0;
  822. }
  823. static inline int prcmu_disable_dsipll(void)
  824. {
  825. return 0;
  826. }
  827. static inline int prcmu_enable_dsipll(void)
  828. {
  829. return 0;
  830. }
  831. #endif
  832. static inline int prcmu_enable_spi2(void)
  833. {
  834. return 0;
  835. }
  836. static inline int prcmu_disable_spi2(void)
  837. {
  838. return 0;
  839. }
  840. #endif /* !CONFIG_MFD_DB8500_PRCMU */
  841. #ifdef CONFIG_UX500_PRCMU_QOS_POWER
  842. int prcmu_qos_requirement(int pm_qos_class);
  843. int prcmu_qos_add_requirement(int pm_qos_class, char *name, s32 value);
  844. int prcmu_qos_update_requirement(int pm_qos_class, char *name, s32 new_value);
  845. void prcmu_qos_remove_requirement(int pm_qos_class, char *name);
  846. int prcmu_qos_add_notifier(int prcmu_qos_class,
  847. struct notifier_block *notifier);
  848. int prcmu_qos_remove_notifier(int prcmu_qos_class,
  849. struct notifier_block *notifier);
  850. #else
  851. static inline int prcmu_qos_requirement(int prcmu_qos_class)
  852. {
  853. return 0;
  854. }
  855. static inline int prcmu_qos_add_requirement(int prcmu_qos_class,
  856. char *name, s32 value)
  857. {
  858. return 0;
  859. }
  860. static inline int prcmu_qos_update_requirement(int prcmu_qos_class,
  861. char *name, s32 new_value)
  862. {
  863. return 0;
  864. }
  865. static inline void prcmu_qos_remove_requirement(int prcmu_qos_class, char *name)
  866. {
  867. }
  868. static inline int prcmu_qos_add_notifier(int prcmu_qos_class,
  869. struct notifier_block *notifier)
  870. {
  871. return 0;
  872. }
  873. static inline int prcmu_qos_remove_notifier(int prcmu_qos_class,
  874. struct notifier_block *notifier)
  875. {
  876. return 0;
  877. }
  878. #endif
  879. #endif /* __MFD_DB8500_PRCMU_H */