blob: 18959171f446b2efa9ed11803262df56b3128e9c [file] [log] [blame]
Linus Walleij650c2a22011-05-15 22:53:56 +02001/*
2 * Copyright (C) STMicroelectronics 2009
3 * Copyright (C) ST-Ericsson SA 2010
4 *
Linus Walleij650c2a22011-05-15 22:53:56 +02005 * License Terms: GNU General Public License v2
Mattias Nilsson3df57bc2011-05-16 00:15:05 +02006 * Author: Kumar Sanghvi <kumar.sanghvi@stericsson.com>
Linus Walleij650c2a22011-05-15 22:53:56 +02007 *
Mattias Nilsson3df57bc2011-05-16 00:15:05 +02008 * PRCMU f/w APIs
Linus Walleij650c2a22011-05-15 22:53:56 +02009 */
Mattias Nilsson3df57bc2011-05-16 00:15:05 +020010#ifndef __MFD_DB8500_PRCMU_H
11#define __MFD_DB8500_PRCMU_H
Linus Walleij650c2a22011-05-15 22:53:56 +020012
Mattias Nilsson3df57bc2011-05-16 00:15:05 +020013#include <linux/interrupt.h>
Linus Walleij650c2a22011-05-15 22:53:56 +020014
Mattias Nilsson3df57bc2011-05-16 00:15:05 +020015/* This portion previously known as <mach/prcmu-fw-defs_v1.h> */
16
17/**
18 * enum state - ON/OFF state definition
19 * @OFF: State is ON
20 * @ON: State is OFF
21 *
22 */
23enum state {
24 OFF = 0x0,
25 ON = 0x1,
Linus Walleij650c2a22011-05-15 22:53:56 +020026};
27
Mattias Nilsson3df57bc2011-05-16 00:15:05 +020028/**
29 * enum ret_state - general purpose On/Off/Retention states
30 *
31 */
32enum ret_state {
33 OFFST = 0,
34 ONST = 1,
35 RETST = 2
36};
37
38/**
39 * enum clk_arm - ARM Cortex A9 clock schemes
40 * @A9_OFF:
41 * @A9_BOOT:
42 * @A9_OPPT1:
43 * @A9_OPPT2:
44 * @A9_EXTCLK:
45 */
46enum clk_arm {
47 A9_OFF,
48 A9_BOOT,
49 A9_OPPT1,
50 A9_OPPT2,
51 A9_EXTCLK
52};
53
54/**
55 * enum clk_gen - GEN#0/GEN#1 clock schemes
56 * @GEN_OFF:
57 * @GEN_BOOT:
58 * @GEN_OPPT1:
59 */
60enum clk_gen {
61 GEN_OFF,
62 GEN_BOOT,
63 GEN_OPPT1,
64};
65
66/* some information between arm and xp70 */
67
68/**
69 * enum romcode_write - Romcode message written by A9 AND read by XP70
70 * @RDY_2_DS: Value set when ApDeepSleep state can be executed by XP70
71 * @RDY_2_XP70_RST: Value set when 0x0F has been successfully polled by the
72 * romcode. The xp70 will go into self-reset
73 */
74enum romcode_write {
75 RDY_2_DS = 0x09,
76 RDY_2_XP70_RST = 0x10
77};
78
79/**
80 * enum romcode_read - Romcode message written by XP70 and read by A9
81 * @INIT: Init value when romcode field is not used
82 * @FS_2_DS: Value set when power state is going from ApExecute to
83 * ApDeepSleep
84 * @END_DS: Value set when ApDeepSleep power state is reached coming from
85 * ApExecute state
86 * @DS_TO_FS: Value set when power state is going from ApDeepSleep to
87 * ApExecute
88 * @END_FS: Value set when ApExecute power state is reached coming from
89 * ApDeepSleep state
90 * @SWR: Value set when power state is going to ApReset
91 * @END_SWR: Value set when the xp70 finished executing ApReset actions and
92 * waits for romcode acknowledgment to go to self-reset
93 */
94enum romcode_read {
95 INIT = 0x00,
96 FS_2_DS = 0x0A,
97 END_DS = 0x0B,
98 DS_TO_FS = 0x0C,
99 END_FS = 0x0D,
100 SWR = 0x0E,
101 END_SWR = 0x0F
102};
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 */
114enum 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/**
125 * enum ap_pwrst_trans - Transition states defined in PRCMU firmware
126 * @NO_TRANSITION: No power state transition
127 * @APEXECUTE_TO_APSLEEP: Power state transition from ApExecute to ApSleep
128 * @APIDLE_TO_APSLEEP: Power state transition from ApIdle to ApSleep
129 * @APBOOT_TO_APEXECUTE: Power state transition from ApBoot to ApExecute
130 * @APEXECUTE_TO_APDEEPSLEEP: Power state transition from ApExecute to
131 * ApDeepSleep
132 * @APEXECUTE_TO_APIDLE: Power state transition from ApExecute to ApIdle
133 */
134enum ap_pwrst_trans {
Mattias Nilsson73180f82011-08-12 10:28:10 +0200135 PRCMU_AP_NO_CHANGE = 0x00,
Mattias Nilsson3df57bc2011-05-16 00:15:05 +0200136 APEXECUTE_TO_APSLEEP = 0x01,
137 APIDLE_TO_APSLEEP = 0x02, /* To be removed */
138 PRCMU_AP_SLEEP = 0x01,
139 APBOOT_TO_APEXECUTE = 0x03,
140 APEXECUTE_TO_APDEEPSLEEP = 0x04, /* To be removed */
141 PRCMU_AP_DEEP_SLEEP = 0x04,
142 APEXECUTE_TO_APIDLE = 0x05, /* To be removed */
143 PRCMU_AP_IDLE = 0x05,
144 PRCMU_AP_DEEP_IDLE = 0x07,
145};
146
147/**
Mattias Nilsson3df57bc2011-05-16 00:15:05 +0200148 * enum hw_acc_state - State definition for hardware accelerator
149 * @HW_NO_CHANGE: The hardware accelerator state must remain unchanged
150 * @HW_OFF: The hardware accelerator must be switched off
151 * @HW_OFF_RAMRET: The hardware accelerator must be switched off with its
152 * internal RAM in retention
153 * @HW_ON: The hwa hardware accelerator hwa must be switched on
154 *
155 * NOTE! Deprecated, to be removed when all users switched over to use the
156 * regulator API.
157 */
158enum hw_acc_state {
159 HW_NO_CHANGE = 0x00,
160 HW_OFF = 0x01,
161 HW_OFF_RAMRET = 0x02,
162 HW_ON = 0x04
163};
164
165/**
166 * enum mbox_2_arm_stat - Status messages definition for mbox_arm
167 * @BOOT_TO_EXECUTEOK: The apBoot to apExecute state transition has been
168 * completed
169 * @DEEPSLEEPOK: The apExecute to apDeepSleep state transition has been
170 * completed
171 * @SLEEPOK: The apExecute to apSleep state transition has been completed
172 * @IDLEOK: The apExecute to apIdle state transition has been completed
173 * @SOFTRESETOK: The A9 watchdog/ SoftReset state has been completed
174 * @SOFTRESETGO : The A9 watchdog/SoftReset state is on going
175 * @BOOT_TO_EXECUTE: The apBoot to apExecute state transition is on going
176 * @EXECUTE_TO_DEEPSLEEP: The apExecute to apDeepSleep state transition is on
177 * going
178 * @DEEPSLEEP_TO_EXECUTE: The apDeepSleep to apExecute state transition is on
179 * going
180 * @DEEPSLEEP_TO_EXECUTEOK: The apDeepSleep to apExecute state transition has
181 * been completed
182 * @EXECUTE_TO_SLEEP: The apExecute to apSleep state transition is on going
183 * @SLEEP_TO_EXECUTE: The apSleep to apExecute state transition is on going
184 * @SLEEP_TO_EXECUTEOK: The apSleep to apExecute state transition has been
185 * completed
186 * @EXECUTE_TO_IDLE: The apExecute to apIdle state transition is on going
187 * @IDLE_TO_EXECUTE: The apIdle to apExecute state transition is on going
188 * @IDLE_TO_EXECUTEOK: The apIdle to apExecute state transition has been
189 * completed
190 * @INIT_STATUS: Status init
191 */
192enum ap_pwrsttr_status {
193 BOOT_TO_EXECUTEOK = 0xFF,
194 DEEPSLEEPOK = 0xFE,
195 SLEEPOK = 0xFD,
196 IDLEOK = 0xFC,
197 SOFTRESETOK = 0xFB,
198 SOFTRESETGO = 0xFA,
199 BOOT_TO_EXECUTE = 0xF9,
200 EXECUTE_TO_DEEPSLEEP = 0xF8,
201 DEEPSLEEP_TO_EXECUTE = 0xF7,
202 DEEPSLEEP_TO_EXECUTEOK = 0xF6,
203 EXECUTE_TO_SLEEP = 0xF5,
204 SLEEP_TO_EXECUTE = 0xF4,
205 SLEEP_TO_EXECUTEOK = 0xF3,
206 EXECUTE_TO_IDLE = 0xF2,
207 IDLE_TO_EXECUTE = 0xF1,
208 IDLE_TO_EXECUTEOK = 0xF0,
209 RDYTODS_RETURNTOEXE = 0xEF,
210 NORDYTODS_RETURNTOEXE = 0xEE,
211 EXETOSLEEP_RETURNTOEXE = 0xED,
212 EXETOIDLE_RETURNTOEXE = 0xEC,
213 INIT_STATUS = 0xEB,
214
215 /*error messages */
216 INITERROR = 0x00,
217 PLLARMLOCKP_ER = 0x01,
218 PLLDDRLOCKP_ER = 0x02,
219 PLLSOCLOCKP_ER = 0x03,
220 PLLSOCK1LOCKP_ER = 0x04,
221 ARMWFI_ER = 0x05,
222 SYSCLKOK_ER = 0x06,
223 I2C_NACK_DATA_ER = 0x07,
224 BOOT_ER = 0x08,
225 I2C_STATUS_ALWAYS_1 = 0x0A,
226 I2C_NACK_REG_ADDR_ER = 0x0B,
227 I2C_NACK_DATA0123_ER = 0x1B,
228 I2C_NACK_ADDR_ER = 0x1F,
229 CURAPPWRSTISNOT_BOOT = 0x20,
230 CURAPPWRSTISNOT_EXECUTE = 0x21,
231 CURAPPWRSTISNOT_SLEEPMODE = 0x22,
232 CURAPPWRSTISNOT_CORRECTFORIT10 = 0x23,
233 FIFO4500WUISNOT_WUPEVENT = 0x24,
234 PLL32KLOCKP_ER = 0x29,
235 DDRDEEPSLEEPOK_ER = 0x2A,
236 ROMCODEREADY_ER = 0x50,
237 WUPBEFOREDS = 0x51,
238 DDRCONFIG_ER = 0x52,
239 WUPBEFORESLEEP = 0x53,
240 WUPBEFOREIDLE = 0x54
241}; /* earlier called as mbox_2_arm_stat */
242
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 */
253enum 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/**
263 * enum sva_mmdsp_stat - SVA MMDSP status messages
264 * @SVA_MMDSP_GO: SVAMMDSP interrupt has happened
265 * @SVA_MMDSP_INIT: Status init
266 */
267enum sva_mmdsp_stat {
268 SVA_MMDSP_GO = 0xFF,
269 SVA_MMDSP_INIT = 0x00
270};
271
272/**
273 * enum sia_mmdsp_stat - SIA MMDSP status messages
274 * @SIA_MMDSP_GO: SIAMMDSP interrupt has happened
275 * @SIA_MMDSP_INIT: Status init
276 */
277enum sia_mmdsp_stat {
278 SIA_MMDSP_GO = 0xFF,
279 SIA_MMDSP_INIT = 0x00
280};
281
282/**
283 * enum mbox_to_arm_err - Error messages definition
284 * @INIT_ERR: Init value
285 * @PLLARMLOCKP_ERR: PLLARM has not been correctly locked in given time
286 * @PLLDDRLOCKP_ERR: PLLDDR has not been correctly locked in the given time
287 * @PLLSOC0LOCKP_ERR: PLLSOC0 has not been correctly locked in the given time
288 * @PLLSOC1LOCKP_ERR: PLLSOC1 has not been correctly locked in the given time
289 * @ARMWFI_ERR: The ARM WFI has not been correctly executed in the given time
290 * @SYSCLKOK_ERR: The SYSCLK is not available in the given time
291 * @BOOT_ERR: Romcode has not validated the XP70 self reset in the given time
292 * @ROMCODESAVECONTEXT: The Romcode didn.t correctly save it secure context
293 * @VARMHIGHSPEEDVALTO_ERR: The ARM high speed supply value transfered
294 * through I2C has not been correctly executed in the given time
295 * @VARMHIGHSPEEDACCESS_ERR: The command value of VarmHighSpeedVal transfered
296 * through I2C has not been correctly executed in the given time
297 * @VARMLOWSPEEDVALTO_ERR:The ARM low speed supply value transfered through
298 * I2C has not been correctly executed in the given time
299 * @VARMLOWSPEEDACCESS_ERR: The command value of VarmLowSpeedVal transfered
300 * through I2C has not been correctly executed in the given time
301 * @VARMRETENTIONVALTO_ERR: The ARM retention supply value transfered through
302 * I2C has not been correctly executed in the given time
303 * @VARMRETENTIONACCESS_ERR: The command value of VarmRetentionVal transfered
304 * through I2C has not been correctly executed in the given time
305 * @VAPEHIGHSPEEDVALTO_ERR: The APE highspeed supply value transfered through
306 * I2C has not been correctly executed in the given time
307 * @VSAFEHPVALTO_ERR: The SAFE high power supply value transfered through I2C
308 * has not been correctly executed in the given time
309 * @VMODSEL1VALTO_ERR: The MODEM sel1 supply value transfered through I2C has
310 * not been correctly executed in the given time
311 * @VMODSEL2VALTO_ERR: The MODEM sel2 supply value transfered through I2C has
312 * not been correctly executed in the given time
313 * @VARMOFFACCESS_ERR: The command value of Varm ON/OFF transfered through
314 * I2C has not been correctly executed in the given time
315 * @VAPEOFFACCESS_ERR: The command value of Vape ON/OFF transfered through
316 * I2C has not been correctly executed in the given time
317 * @VARMRETACCES_ERR: The command value of Varm retention ON/OFF transfered
318 * through I2C has not been correctly executed in the given time
319 * @CURAPPWRSTISNOTBOOT:Generated when Arm want to do power state transition
320 * ApBoot to ApExecute but the power current state is not Apboot
321 * @CURAPPWRSTISNOTEXECUTE: Generated when Arm want to do power state
322 * transition from ApExecute to others power state but the
323 * power current state is not ApExecute
324 * @CURAPPWRSTISNOTSLEEPMODE: Generated when wake up events are transmitted
325 * but the power current state is not ApDeepSleep/ApSleep/ApIdle
326 * @CURAPPWRSTISNOTCORRECTDBG: Generated when wake up events are transmitted
327 * but the power current state is not correct
328 * @ARMREGU1VALTO_ERR:The ArmRegu1 value transferred through I2C has not
329 * been correctly executed in the given time
330 * @ARMREGU2VALTO_ERR: The ArmRegu2 value transferred through I2C has not
331 * been correctly executed in the given time
332 * @VAPEREGUVALTO_ERR: The VApeRegu value transfered through I2C has not
333 * been correctly executed in the given time
334 * @VSMPS3REGUVALTO_ERR: The VSmps3Regu value transfered through I2C has not
335 * been correctly executed in the given time
336 * @VMODREGUVALTO_ERR: The VModemRegu value transfered through I2C has not
337 * been correctly executed in the given time
338 */
339enum mbox_to_arm_err {
340 INIT_ERR = 0x00,
341 PLLARMLOCKP_ERR = 0x01,
342 PLLDDRLOCKP_ERR = 0x02,
343 PLLSOC0LOCKP_ERR = 0x03,
344 PLLSOC1LOCKP_ERR = 0x04,
345 ARMWFI_ERR = 0x05,
346 SYSCLKOK_ERR = 0x06,
347 BOOT_ERR = 0x07,
348 ROMCODESAVECONTEXT = 0x08,
349 VARMHIGHSPEEDVALTO_ERR = 0x10,
350 VARMHIGHSPEEDACCESS_ERR = 0x11,
351 VARMLOWSPEEDVALTO_ERR = 0x12,
352 VARMLOWSPEEDACCESS_ERR = 0x13,
353 VARMRETENTIONVALTO_ERR = 0x14,
354 VARMRETENTIONACCESS_ERR = 0x15,
355 VAPEHIGHSPEEDVALTO_ERR = 0x16,
356 VSAFEHPVALTO_ERR = 0x17,
357 VMODSEL1VALTO_ERR = 0x18,
358 VMODSEL2VALTO_ERR = 0x19,
359 VARMOFFACCESS_ERR = 0x1A,
360 VAPEOFFACCESS_ERR = 0x1B,
361 VARMRETACCES_ERR = 0x1C,
362 CURAPPWRSTISNOTBOOT = 0x20,
363 CURAPPWRSTISNOTEXECUTE = 0x21,
364 CURAPPWRSTISNOTSLEEPMODE = 0x22,
365 CURAPPWRSTISNOTCORRECTDBG = 0x23,
366 ARMREGU1VALTO_ERR = 0x24,
367 ARMREGU2VALTO_ERR = 0x25,
368 VAPEREGUVALTO_ERR = 0x26,
369 VSMPS3REGUVALTO_ERR = 0x27,
370 VMODREGUVALTO_ERR = 0x28
371};
372
373enum hw_acc {
374 SVAMMDSP = 0,
375 SVAPIPE = 1,
376 SIAMMDSP = 2,
377 SIAPIPE = 3,
378 SGA = 4,
379 B2R2MCDE = 5,
380 ESRAM12 = 6,
381 ESRAM34 = 7,
382};
383
384enum cs_pwrmgt {
385 PWRDNCS0 = 0,
386 WKUPCS0 = 1,
387 PWRDNCS1 = 2,
388 WKUPCS1 = 3
389};
390
391/* Defs related to autonomous power management */
392
393/**
394 * enum sia_sva_pwr_policy - Power policy
395 * @NO_CHGT: No change
396 * @DSPOFF_HWPOFF:
397 * @DSPOFFRAMRET_HWPOFF:
398 * @DSPCLKOFF_HWPOFF:
399 * @DSPCLKOFF_HWPCLKOFF:
400 *
401 */
402enum sia_sva_pwr_policy {
403 NO_CHGT = 0x0,
404 DSPOFF_HWPOFF = 0x1,
405 DSPOFFRAMRET_HWPOFF = 0x2,
406 DSPCLKOFF_HWPOFF = 0x3,
407 DSPCLKOFF_HWPCLKOFF = 0x4,
408};
409
410/**
411 * enum auto_enable - Auto Power enable
412 * @AUTO_OFF:
413 * @AUTO_ON:
414 *
415 */
416enum auto_enable {
417 AUTO_OFF = 0x0,
418 AUTO_ON = 0x1,
419};
420
421/* End of file previously known as prcmu-fw-defs_v1.h */
422
Mattias Nilsson3df57bc2011-05-16 00:15:05 +0200423/**
424 * enum hw_acc_dev - enum for hw accelerators
425 * @HW_ACC_SVAMMDSP: for SVAMMDSP
426 * @HW_ACC_SVAPIPE: for SVAPIPE
427 * @HW_ACC_SIAMMDSP: for SIAMMDSP
428 * @HW_ACC_SIAPIPE: for SIAPIPE
429 * @HW_ACC_SGA: for SGA
430 * @HW_ACC_B2R2: for B2R2
431 * @HW_ACC_MCDE: for MCDE
432 * @HW_ACC_ESRAM1: for ESRAM1
433 * @HW_ACC_ESRAM2: for ESRAM2
434 * @HW_ACC_ESRAM3: for ESRAM3
435 * @HW_ACC_ESRAM4: for ESRAM4
436 * @NUM_HW_ACC: number of hardware accelerators
437 *
438 * Different hw accelerators which can be turned ON/
439 * OFF or put into retention (MMDSPs and ESRAMs).
440 * Used with EPOD API.
441 *
442 * NOTE! Deprecated, to be removed when all users switched over to use the
443 * regulator API.
444 */
445enum hw_acc_dev {
446 HW_ACC_SVAMMDSP,
447 HW_ACC_SVAPIPE,
448 HW_ACC_SIAMMDSP,
449 HW_ACC_SIAPIPE,
450 HW_ACC_SGA,
451 HW_ACC_B2R2,
452 HW_ACC_MCDE,
453 HW_ACC_ESRAM1,
454 HW_ACC_ESRAM2,
455 HW_ACC_ESRAM3,
456 HW_ACC_ESRAM4,
457 NUM_HW_ACC
458};
Linus Walleij650c2a22011-05-15 22:53:56 +0200459
460/*
Mattias Nilsson3df57bc2011-05-16 00:15:05 +0200461 * Definitions for autonomous power management configuration.
462 */
463
464#define PRCMU_AUTO_PM_OFF 0
465#define PRCMU_AUTO_PM_ON 1
466
467#define PRCMU_AUTO_PM_POWER_ON_HSEM BIT(0)
468#define PRCMU_AUTO_PM_POWER_ON_ABB_FIFO_IT BIT(1)
469
470enum prcmu_auto_pm_policy {
471 PRCMU_AUTO_PM_POLICY_NO_CHANGE,
472 PRCMU_AUTO_PM_POLICY_DSP_OFF_HWP_OFF,
473 PRCMU_AUTO_PM_POLICY_DSP_OFF_RAMRET_HWP_OFF,
474 PRCMU_AUTO_PM_POLICY_DSP_CLK_OFF_HWP_OFF,
475 PRCMU_AUTO_PM_POLICY_DSP_CLK_OFF_HWP_CLK_OFF,
476};
477
478/**
479 * struct prcmu_auto_pm_config - Autonomous power management configuration.
480 * @sia_auto_pm_enable: SIA autonomous pm enable. (PRCMU_AUTO_PM_{OFF,ON})
481 * @sia_power_on: SIA power ON enable. (PRCMU_AUTO_PM_POWER_ON_* bitmask)
482 * @sia_policy: SIA power policy. (enum prcmu_auto_pm_policy)
483 * @sva_auto_pm_enable: SVA autonomous pm enable. (PRCMU_AUTO_PM_{OFF,ON})
484 * @sva_power_on: SVA power ON enable. (PRCMU_AUTO_PM_POWER_ON_* bitmask)
485 * @sva_policy: SVA power policy. (enum prcmu_auto_pm_policy)
486 */
487struct prcmu_auto_pm_config {
488 u8 sia_auto_pm_enable;
489 u8 sia_power_on;
490 u8 sia_policy;
491 u8 sva_auto_pm_enable;
492 u8 sva_power_on;
493 u8 sva_policy;
494};
495
Mattias Nilssonb58d12f2012-01-13 16:20:10 +0100496#define PRCMU_FW_PROJECT_U8500 2
497#define PRCMU_FW_PROJECT_U9500 4
498#define PRCMU_FW_PROJECT_U8500_C2 7
499#define PRCMU_FW_PROJECT_U9500_C2 11
500
501struct prcmu_fw_version {
502 u8 project;
503 u8 api_version;
504 u8 func_version;
505 u8 errata;
506};
507
Mattias Nilsson3df57bc2011-05-16 00:15:05 +0200508#ifdef CONFIG_MFD_DB8500_PRCMU
509
Mattias Nilsson73180f82011-08-12 10:28:10 +0200510void db8500_prcmu_early_init(void);
Mattias Nilsson3df57bc2011-05-16 00:15:05 +0200511int prcmu_set_rc_a2p(enum romcode_write);
512enum romcode_read prcmu_get_rc_p2a(void);
513enum ap_pwrst prcmu_get_xp70_current_state(void);
Mattias Nilsson3df57bc2011-05-16 00:15:05 +0200514bool prcmu_has_arm_maxopp(void);
Mattias Nilsson3df57bc2011-05-16 00:15:05 +0200515int prcmu_set_ape_opp(u8 opp);
516int prcmu_get_ape_opp(void);
Mattias Nilssonb58d12f2012-01-13 16:20:10 +0100517struct prcmu_fw_version *prcmu_get_fw_version(void);
Mattias Nilsson3df57bc2011-05-16 00:15:05 +0200518int prcmu_request_ape_opp_100_voltage(bool enable);
519int prcmu_release_usb_wakeup_state(void);
520int prcmu_set_ddr_opp(u8 opp);
521int prcmu_get_ddr_opp(void);
Mattias Nilsson3df57bc2011-05-16 00:15:05 +0200522/* NOTE! Use regulator framework instead */
523int prcmu_set_hwacc(u16 hw_acc_dev, u8 state);
Mattias Nilsson3df57bc2011-05-16 00:15:05 +0200524void prcmu_configure_auto_pm(struct prcmu_auto_pm_config *sleep,
525 struct prcmu_auto_pm_config *idle);
526bool prcmu_is_auto_pm_enabled(void);
527
528int prcmu_config_clkout(u8 clkout, u8 source, u8 div);
Mattias Nilsson3df57bc2011-05-16 00:15:05 +0200529int prcmu_set_clock_divider(u8 clock, u8 divider);
Mattias Nilsson3df57bc2011-05-16 00:15:05 +0200530int prcmu_config_hotdog(u8 threshold);
531int prcmu_config_hotmon(u8 low, u8 high);
532int prcmu_start_temp_sense(u16 cycles32k);
533int prcmu_stop_temp_sense(void);
Linus Walleij650c2a22011-05-15 22:53:56 +0200534int prcmu_abb_read(u8 slave, u8 reg, u8 *value, u8 size);
535int prcmu_abb_write(u8 slave, u8 reg, u8 *value, u8 size);
Linus Walleij650c2a22011-05-15 22:53:56 +0200536
Mattias Nilsson3df57bc2011-05-16 00:15:05 +0200537void prcmu_ac_wake_req(void);
538void prcmu_ac_sleep_req(void);
Mattias Nilsson3df57bc2011-05-16 00:15:05 +0200539void prcmu_modem_reset(void);
Mattias Nilsson3df57bc2011-05-16 00:15:05 +0200540void prcmu_enable_spi2(void);
541void prcmu_disable_spi2(void);
542
Mattias Nilsson73180f82011-08-12 10:28:10 +0200543int prcmu_config_a9wdog(u8 num, bool sleep_auto_off);
544int prcmu_enable_a9wdog(u8 id);
545int prcmu_disable_a9wdog(u8 id);
546int prcmu_kick_a9wdog(u8 id);
547int prcmu_load_a9wdog(u8 id, u32 val);
548
549void db8500_prcmu_system_reset(u16 reset_code);
550int db8500_prcmu_set_power_state(u8 state, bool keep_ulp_clk, bool keep_ap_pll);
551void db8500_prcmu_enable_wakeups(u32 wakeups);
552int db8500_prcmu_set_epod(u16 epod_id, u8 epod_state);
553int db8500_prcmu_request_clock(u8 clock, bool enable);
554int db8500_prcmu_set_display_clocks(void);
555int db8500_prcmu_disable_dsipll(void);
556int db8500_prcmu_enable_dsipll(void);
557void db8500_prcmu_config_abb_event_readout(u32 abb_events);
558void db8500_prcmu_get_abb_event_buffer(void __iomem **buf);
559int db8500_prcmu_config_esram0_deep_sleep(u8 state);
560u16 db8500_prcmu_get_reset_code(void);
561bool db8500_prcmu_is_ac_wake_requested(void);
562int db8500_prcmu_set_arm_opp(u8 opp);
563int db8500_prcmu_get_arm_opp(void);
564
Mattias Nilsson3df57bc2011-05-16 00:15:05 +0200565#else /* !CONFIG_MFD_DB8500_PRCMU */
566
Mattias Nilsson73180f82011-08-12 10:28:10 +0200567static inline void db8500_prcmu_early_init(void) {}
568
Mattias Nilsson3df57bc2011-05-16 00:15:05 +0200569static inline int prcmu_set_rc_a2p(enum romcode_write code)
570{
571 return 0;
572}
573
574static inline enum romcode_read prcmu_get_rc_p2a(void)
575{
576 return INIT;
577}
578
579static inline enum ap_pwrst prcmu_get_xp70_current_state(void)
580{
581 return AP_EXECUTE;
582}
583
Mattias Nilsson73180f82011-08-12 10:28:10 +0200584static inline bool prcmu_has_arm_maxopp(void)
Mattias Nilsson3df57bc2011-05-16 00:15:05 +0200585{
586 return false;
587}
588
Mattias Nilssonb58d12f2012-01-13 16:20:10 +0100589static inline struct prcmu_fw_version *prcmu_get_fw_version(void)
590{
591 return NULL;
592}
593
Mattias Nilsson3df57bc2011-05-16 00:15:05 +0200594static inline int prcmu_set_ape_opp(u8 opp)
595{
596 return 0;
597}
598
599static inline int prcmu_get_ape_opp(void)
600{
601 return APE_100_OPP;
602}
603
604static inline int prcmu_request_ape_opp_100_voltage(bool enable)
605{
606 return 0;
607}
608
609static inline int prcmu_release_usb_wakeup_state(void)
610{
611 return 0;
612}
613
614static inline int prcmu_set_ddr_opp(u8 opp)
615{
616 return 0;
617}
618
619static inline int prcmu_get_ddr_opp(void)
620{
621 return DDR_100_OPP;
622}
623
Mattias Nilsson3df57bc2011-05-16 00:15:05 +0200624static inline int prcmu_set_hwacc(u16 hw_acc_dev, u8 state)
625{
626 return 0;
627}
628
629static inline void prcmu_configure_auto_pm(struct prcmu_auto_pm_config *sleep,
630 struct prcmu_auto_pm_config *idle)
631{
632}
633
634static inline bool prcmu_is_auto_pm_enabled(void)
635{
636 return false;
637}
638
639static inline int prcmu_config_clkout(u8 clkout, u8 source, u8 div)
640{
641 return 0;
642}
643
Mattias Nilsson3df57bc2011-05-16 00:15:05 +0200644static inline int prcmu_set_clock_divider(u8 clock, u8 divider)
645{
646 return 0;
647}
648
Mattias Nilsson3df57bc2011-05-16 00:15:05 +0200649static inline int prcmu_config_hotdog(u8 threshold)
650{
651 return 0;
652}
653
654static inline int prcmu_config_hotmon(u8 low, u8 high)
655{
656 return 0;
657}
658
659static inline int prcmu_start_temp_sense(u16 cycles32k)
660{
661 return 0;
662}
663
664static inline int prcmu_stop_temp_sense(void)
665{
666 return 0;
667}
668
669static inline int prcmu_abb_read(u8 slave, u8 reg, u8 *value, u8 size)
670{
671 return -ENOSYS;
672}
673
674static inline int prcmu_abb_write(u8 slave, u8 reg, u8 *value, u8 size)
675{
676 return -ENOSYS;
677}
678
679static inline void prcmu_ac_wake_req(void) {}
680
681static inline void prcmu_ac_sleep_req(void) {}
682
Mattias Nilsson3df57bc2011-05-16 00:15:05 +0200683static inline void prcmu_modem_reset(void) {}
684
Mattias Nilsson3df57bc2011-05-16 00:15:05 +0200685static inline int prcmu_enable_spi2(void)
686{
687 return 0;
688}
689
690static inline int prcmu_disable_spi2(void)
691{
692 return 0;
693}
694
Mattias Nilsson73180f82011-08-12 10:28:10 +0200695static inline void db8500_prcmu_system_reset(u16 reset_code) {}
696
697static inline int db8500_prcmu_set_power_state(u8 state, bool keep_ulp_clk,
698 bool keep_ap_pll)
699{
700 return 0;
701}
702
703static inline void db8500_prcmu_enable_wakeups(u32 wakeups) {}
704
705static inline int db8500_prcmu_set_epod(u16 epod_id, u8 epod_state)
706{
707 return 0;
708}
709
710static inline int db8500_prcmu_request_clock(u8 clock, bool enable)
711{
712 return 0;
713}
714
715static inline int db8500_prcmu_set_display_clocks(void)
716{
717 return 0;
718}
719
720static inline int db8500_prcmu_disable_dsipll(void)
721{
722 return 0;
723}
724
725static inline int db8500_prcmu_enable_dsipll(void)
726{
727 return 0;
728}
729
730static inline int db8500_prcmu_config_esram0_deep_sleep(u8 state)
731{
732 return 0;
733}
734
735static inline void db8500_prcmu_config_abb_event_readout(u32 abb_events) {}
736
737static inline void db8500_prcmu_get_abb_event_buffer(void __iomem **buf) {}
738
739static inline u16 db8500_prcmu_get_reset_code(void)
740{
741 return 0;
742}
743
744static inline int prcmu_config_a9wdog(u8 num, bool sleep_auto_off)
745{
746 return 0;
747}
748
749static inline int prcmu_enable_a9wdog(u8 id)
750{
751 return 0;
752}
753
754static inline int prcmu_disable_a9wdog(u8 id)
755{
756 return 0;
757}
758
759static inline int prcmu_kick_a9wdog(u8 id)
760{
761 return 0;
762}
763
764static inline int prcmu_load_a9wdog(u8 id, u32 val)
765{
766 return 0;
767}
768
769static inline bool db8500_prcmu_is_ac_wake_requested(void)
770{
771 return 0;
772}
773
774static inline int db8500_prcmu_set_arm_opp(u8 opp)
775{
776 return 0;
777}
778
779static inline int db8500_prcmu_get_arm_opp(void)
780{
781 return 0;
782}
783
Mattias Nilsson3df57bc2011-05-16 00:15:05 +0200784#endif /* !CONFIG_MFD_DB8500_PRCMU */
785
Mattias Nilsson3df57bc2011-05-16 00:15:05 +0200786#endif /* __MFD_DB8500_PRCMU_H */