blob: ca0790fba2f5d60abbe975fa3547c363c525f443 [file] [log] [blame]
Mattias Nilssonfea799e2011-08-12 10:28:02 +02001/*
2 * Copyright (C) ST Ericsson SA 2011
3 *
4 * License Terms: GNU General Public License v2
5 *
6 * STE Ux500 PRCMU API
7 */
8#ifndef __MACH_PRCMU_H
9#define __MACH_PRCMU_H
10
11#include <linux/interrupt.h>
12#include <linux/notifier.h>
Mattias Nilsson05089012012-01-13 16:20:20 +010013#include <linux/err.h>
Mattias Nilssonfea799e2011-08-12 10:28:02 +020014
Linus Walleij05ec2602013-02-07 10:17:31 +010015/* Offset for the firmware version within the TCPM */
16#define DB8500_PRCMU_FW_VERSION_OFFSET 0xA4
17#define DBX540_PRCMU_FW_VERSION_OFFSET 0xA8
18
Mattias Nilssonfea799e2011-08-12 10:28:02 +020019/* PRCMU Wakeup defines */
20enum prcmu_wakeup_index {
21 PRCMU_WAKEUP_INDEX_RTC,
22 PRCMU_WAKEUP_INDEX_RTT0,
23 PRCMU_WAKEUP_INDEX_RTT1,
24 PRCMU_WAKEUP_INDEX_HSI0,
25 PRCMU_WAKEUP_INDEX_HSI1,
26 PRCMU_WAKEUP_INDEX_USB,
27 PRCMU_WAKEUP_INDEX_ABB,
28 PRCMU_WAKEUP_INDEX_ABB_FIFO,
29 PRCMU_WAKEUP_INDEX_ARM,
30 PRCMU_WAKEUP_INDEX_CD_IRQ,
31 NUM_PRCMU_WAKEUP_INDICES
32};
33#define PRCMU_WAKEUP(_name) (BIT(PRCMU_WAKEUP_INDEX_##_name))
34
35/* EPOD (power domain) IDs */
36
37/*
38 * DB8500 EPODs
39 * - EPOD_ID_SVAMMDSP: power domain for SVA MMDSP
40 * - EPOD_ID_SVAPIPE: power domain for SVA pipe
41 * - EPOD_ID_SIAMMDSP: power domain for SIA MMDSP
42 * - EPOD_ID_SIAPIPE: power domain for SIA pipe
43 * - EPOD_ID_SGA: power domain for SGA
44 * - EPOD_ID_B2R2_MCDE: power domain for B2R2 and MCDE
45 * - EPOD_ID_ESRAM12: power domain for ESRAM 1 and 2
46 * - EPOD_ID_ESRAM34: power domain for ESRAM 3 and 4
47 * - NUM_EPOD_ID: number of power domains
48 *
49 * TODO: These should be prefixed.
50 */
51#define EPOD_ID_SVAMMDSP 0
52#define EPOD_ID_SVAPIPE 1
53#define EPOD_ID_SIAMMDSP 2
54#define EPOD_ID_SIAPIPE 3
55#define EPOD_ID_SGA 4
56#define EPOD_ID_B2R2_MCDE 5
57#define EPOD_ID_ESRAM12 6
58#define EPOD_ID_ESRAM34 7
59#define NUM_EPOD_ID 8
60
61/*
Mattias Nilssonfea799e2011-08-12 10:28:02 +020062 * state definition for EPOD (power domain)
63 * - EPOD_STATE_NO_CHANGE: The EPOD should remain unchanged
64 * - EPOD_STATE_OFF: The EPOD is switched off
65 * - EPOD_STATE_RAMRET: The EPOD is switched off with its internal RAM in
66 * retention
67 * - EPOD_STATE_ON_CLK_OFF: The EPOD is switched on, clock is still off
68 * - EPOD_STATE_ON: Same as above, but with clock enabled
69 */
70#define EPOD_STATE_NO_CHANGE 0x00
71#define EPOD_STATE_OFF 0x01
72#define EPOD_STATE_RAMRET 0x02
73#define EPOD_STATE_ON_CLK_OFF 0x03
74#define EPOD_STATE_ON 0x04
75
76/*
77 * CLKOUT sources
78 */
79#define PRCMU_CLKSRC_CLK38M 0x00
80#define PRCMU_CLKSRC_ACLK 0x01
81#define PRCMU_CLKSRC_SYSCLK 0x02
82#define PRCMU_CLKSRC_LCDCLK 0x03
83#define PRCMU_CLKSRC_SDMMCCLK 0x04
84#define PRCMU_CLKSRC_TVCLK 0x05
85#define PRCMU_CLKSRC_TIMCLK 0x06
86#define PRCMU_CLKSRC_CLK009 0x07
87/* These are only valid for CLKOUT1: */
88#define PRCMU_CLKSRC_SIAMMDSPCLK 0x40
89#define PRCMU_CLKSRC_I2CCLK 0x41
90#define PRCMU_CLKSRC_MSP02CLK 0x42
91#define PRCMU_CLKSRC_ARMPLL_OBSCLK 0x43
92#define PRCMU_CLKSRC_HSIRXCLK 0x44
93#define PRCMU_CLKSRC_HSITXCLK 0x45
94#define PRCMU_CLKSRC_ARMCLKFIX 0x46
95#define PRCMU_CLKSRC_HDMICLK 0x47
96
97/*
98 * Clock identifiers.
99 */
100enum prcmu_clock {
101 PRCMU_SGACLK,
102 PRCMU_UARTCLK,
103 PRCMU_MSP02CLK,
104 PRCMU_MSP1CLK,
105 PRCMU_I2CCLK,
106 PRCMU_SDMMCCLK,
Mattias Nilsson6b6fae22012-01-13 16:20:28 +0100107 PRCMU_SPARE1CLK,
Mattias Nilssonfea799e2011-08-12 10:28:02 +0200108 PRCMU_SLIMCLK,
109 PRCMU_PER1CLK,
110 PRCMU_PER2CLK,
111 PRCMU_PER3CLK,
112 PRCMU_PER5CLK,
113 PRCMU_PER6CLK,
114 PRCMU_PER7CLK,
115 PRCMU_LCDCLK,
116 PRCMU_BMLCLK,
117 PRCMU_HSITXCLK,
118 PRCMU_HSIRXCLK,
119 PRCMU_HDMICLK,
120 PRCMU_APEATCLK,
121 PRCMU_APETRACECLK,
122 PRCMU_MCDECLK,
123 PRCMU_IPI2CCLK,
124 PRCMU_DSIALTCLK,
125 PRCMU_DMACLK,
126 PRCMU_B2R2CLK,
127 PRCMU_TVCLK,
128 PRCMU_SSPCLK,
129 PRCMU_RNGCLK,
130 PRCMU_UICCCLK,
131 PRCMU_PWMCLK,
132 PRCMU_IRDACLK,
133 PRCMU_IRRCCLK,
134 PRCMU_SIACLK,
135 PRCMU_SVACLK,
Mattias Nilsson6b6fae22012-01-13 16:20:28 +0100136 PRCMU_ACLK,
Philippe Begnic852bbba2013-05-27 14:41:30 +0200137 PRCMU_HVACLK, /* Ux540 only */
138 PRCMU_G1CLK, /* Ux540 only */
139 PRCMU_SDMMCHCLK,
140 PRCMU_CAMCLK,
Philippe Begnic54e30032013-05-27 14:41:31 +0200141 PRCMU_BML8580CLK,
Mattias Nilssonfea799e2011-08-12 10:28:02 +0200142 PRCMU_NUM_REG_CLOCKS,
143 PRCMU_SYSCLK = PRCMU_NUM_REG_CLOCKS,
Mattias Nilsson6b6fae22012-01-13 16:20:28 +0100144 PRCMU_CDCLK,
Mattias Nilssonfea799e2011-08-12 10:28:02 +0200145 PRCMU_TIMCLK,
146 PRCMU_PLLSOC0,
147 PRCMU_PLLSOC1,
Michel Jaouen20aee5b2012-08-31 14:21:30 +0200148 PRCMU_ARMSS,
Mattias Nilssonfea799e2011-08-12 10:28:02 +0200149 PRCMU_PLLDDR,
Mattias Nilsson6b6fae22012-01-13 16:20:28 +0100150 PRCMU_PLLDSI,
151 PRCMU_DSI0CLK,
152 PRCMU_DSI1CLK,
153 PRCMU_DSI0ESCCLK,
154 PRCMU_DSI1ESCCLK,
155 PRCMU_DSI2ESCCLK,
Philippe Begnic852bbba2013-05-27 14:41:30 +0200156 /* LCD DSI PLL - Ux540 only */
157 PRCMU_PLLDSI_LCD,
158 PRCMU_DSI0CLK_LCD,
159 PRCMU_DSI1CLK_LCD,
160 PRCMU_DSI0ESCCLK_LCD,
161 PRCMU_DSI1ESCCLK_LCD,
162 PRCMU_DSI2ESCCLK_LCD,
Mattias Nilssonfea799e2011-08-12 10:28:02 +0200163};
164
165/**
Fabio Baltieri98c60a02013-01-18 12:40:11 +0100166 * enum prcmu_wdog_id - PRCMU watchdog IDs
167 * @PRCMU_WDOG_ALL: use all timers
168 * @PRCMU_WDOG_CPU1: use first CPU timer only
169 * @PRCMU_WDOG_CPU2: use second CPU timer conly
170 */
171enum prcmu_wdog_id {
172 PRCMU_WDOG_ALL = 0x00,
173 PRCMU_WDOG_CPU1 = 0x01,
174 PRCMU_WDOG_CPU2 = 0x02,
175};
176
177/**
Mattias Nilssonfea799e2011-08-12 10:28:02 +0200178 * enum ape_opp - APE OPP states definition
179 * @APE_OPP_INIT:
180 * @APE_NO_CHANGE: The APE operating point is unchanged
181 * @APE_100_OPP: The new APE operating point is ape100opp
182 * @APE_50_OPP: 50%
Mattias Nilsson4d64d2e2012-01-13 16:20:43 +0100183 * @APE_50_PARTLY_25_OPP: 50%, except some clocks at 25%.
Mattias Nilssonfea799e2011-08-12 10:28:02 +0200184 */
185enum ape_opp {
186 APE_OPP_INIT = 0x00,
187 APE_NO_CHANGE = 0x01,
188 APE_100_OPP = 0x02,
Mattias Nilsson4d64d2e2012-01-13 16:20:43 +0100189 APE_50_OPP = 0x03,
190 APE_50_PARTLY_25_OPP = 0xFF,
Mattias Nilssonfea799e2011-08-12 10:28:02 +0200191};
192
193/**
194 * enum arm_opp - ARM OPP states definition
195 * @ARM_OPP_INIT:
196 * @ARM_NO_CHANGE: The ARM operating point is unchanged
197 * @ARM_100_OPP: The new ARM operating point is arm100opp
198 * @ARM_50_OPP: The new ARM operating point is arm50opp
199 * @ARM_MAX_OPP: Operating point is "max" (more than 100)
200 * @ARM_MAX_FREQ100OPP: Set max opp if available, else 100
201 * @ARM_EXTCLK: The new ARM operating point is armExtClk
202 */
203enum arm_opp {
204 ARM_OPP_INIT = 0x00,
205 ARM_NO_CHANGE = 0x01,
206 ARM_100_OPP = 0x02,
207 ARM_50_OPP = 0x03,
208 ARM_MAX_OPP = 0x04,
209 ARM_MAX_FREQ100OPP = 0x05,
210 ARM_EXTCLK = 0x07
211};
212
213/**
214 * enum ddr_opp - DDR OPP states definition
215 * @DDR_100_OPP: The new DDR operating point is ddr100opp
216 * @DDR_50_OPP: The new DDR operating point is ddr50opp
217 * @DDR_25_OPP: The new DDR operating point is ddr25opp
218 */
219enum ddr_opp {
220 DDR_100_OPP = 0x00,
221 DDR_50_OPP = 0x01,
222 DDR_25_OPP = 0x02,
223};
224
225/*
226 * Definitions for controlling ESRAM0 in deep sleep.
227 */
228#define ESRAM0_DEEP_SLEEP_STATE_OFF 1
229#define ESRAM0_DEEP_SLEEP_STATE_RET 2
230
231/**
232 * enum ddr_pwrst - DDR power states definition
233 * @DDR_PWR_STATE_UNCHANGED: SDRAM and DDR controller state is unchanged
234 * @DDR_PWR_STATE_ON:
235 * @DDR_PWR_STATE_OFFLOWLAT:
236 * @DDR_PWR_STATE_OFFHIGHLAT:
237 */
238enum ddr_pwrst {
239 DDR_PWR_STATE_UNCHANGED = 0x00,
240 DDR_PWR_STATE_ON = 0x01,
241 DDR_PWR_STATE_OFFLOWLAT = 0x02,
242 DDR_PWR_STATE_OFFHIGHLAT = 0x03
243};
244
Linus Walleij05ec2602013-02-07 10:17:31 +0100245#define DB8500_PRCMU_LEGACY_OFFSET 0xDD4
246
247struct prcmu_pdata
248{
249 bool enable_set_ddr_opp;
250 bool enable_ape_opp_100_voltage;
251 struct ab8500_platform_data *ab_platdata;
Arnd Bergmann55b175d2013-03-21 22:51:07 +0100252 int ab_irq;
253 int irq_base;
Linus Walleij05ec2602013-02-07 10:17:31 +0100254 u32 version_offset;
255 u32 legacy_offset;
256 u32 adt_offset;
257};
258
259#define PRCMU_FW_PROJECT_U8500 2
260#define PRCMU_FW_PROJECT_U8400 3
261#define PRCMU_FW_PROJECT_U9500 4 /* Customer specific */
262#define PRCMU_FW_PROJECT_U8500_MBB 5
263#define PRCMU_FW_PROJECT_U8500_C1 6
264#define PRCMU_FW_PROJECT_U8500_C2 7
265#define PRCMU_FW_PROJECT_U8500_C3 8
266#define PRCMU_FW_PROJECT_U8500_C4 9
267#define PRCMU_FW_PROJECT_U9500_MBL 10
268#define PRCMU_FW_PROJECT_U8500_MBL 11 /* Customer specific */
269#define PRCMU_FW_PROJECT_U8500_MBL2 12 /* Customer specific */
270#define PRCMU_FW_PROJECT_U8520 13
271#define PRCMU_FW_PROJECT_U8420 14
272#define PRCMU_FW_PROJECT_A9420 20
273/* [32..63] 9540 and derivatives */
274#define PRCMU_FW_PROJECT_U9540 32
275/* [64..95] 8540 and derivatives */
276#define PRCMU_FW_PROJECT_L8540 64
277/* [96..126] 8580 and derivatives */
278#define PRCMU_FW_PROJECT_L8580 96
279
280#define PRCMU_FW_PROJECT_NAME_LEN 20
281struct prcmu_fw_version {
282 u32 project; /* Notice, project shifted with 8 on ux540 */
283 u8 api_version;
284 u8 func_version;
285 u8 errata;
286 char project_name[PRCMU_FW_PROJECT_NAME_LEN];
287};
288
Mattias Nilssonfea799e2011-08-12 10:28:02 +0200289#include <linux/mfd/db8500-prcmu.h>
Mattias Nilssonfea799e2011-08-12 10:28:02 +0200290
Linus Walleijdece3702012-04-13 14:01:39 +0200291#if defined(CONFIG_UX500_SOC_DB8500)
Mattias Nilssonfea799e2011-08-12 10:28:02 +0200292
Linus Walleij9a47a8d2013-03-21 12:27:25 +0100293static inline void prcmu_early_init(u32 phy_base, u32 size)
Mattias Nilssonfea799e2011-08-12 10:28:02 +0200294{
Linus Walleij9a47a8d2013-03-21 12:27:25 +0100295 return db8500_prcmu_early_init(phy_base, size);
Mattias Nilssonfea799e2011-08-12 10:28:02 +0200296}
297
298static inline int prcmu_set_power_state(u8 state, bool keep_ulp_clk,
299 bool keep_ap_pll)
300{
Linus Walleijdece3702012-04-13 14:01:39 +0200301 return db8500_prcmu_set_power_state(state, keep_ulp_clk,
302 keep_ap_pll);
Mattias Nilssonfea799e2011-08-12 10:28:02 +0200303}
304
Mattias Nilsson4d64d2e2012-01-13 16:20:43 +0100305static inline u8 prcmu_get_power_state_result(void)
306{
Linus Walleijdece3702012-04-13 14:01:39 +0200307 return db8500_prcmu_get_power_state_result();
Mattias Nilsson4d64d2e2012-01-13 16:20:43 +0100308}
309
Mattias Nilssonfea799e2011-08-12 10:28:02 +0200310static inline int prcmu_set_epod(u16 epod_id, u8 epod_state)
311{
Linus Walleijdece3702012-04-13 14:01:39 +0200312 return db8500_prcmu_set_epod(epod_id, epod_state);
Mattias Nilssonfea799e2011-08-12 10:28:02 +0200313}
314
315static inline void prcmu_enable_wakeups(u32 wakeups)
316{
Linus Walleijdece3702012-04-13 14:01:39 +0200317 db8500_prcmu_enable_wakeups(wakeups);
Mattias Nilssonfea799e2011-08-12 10:28:02 +0200318}
319
320static inline void prcmu_disable_wakeups(void)
321{
322 prcmu_enable_wakeups(0);
323}
324
325static inline void prcmu_config_abb_event_readout(u32 abb_events)
326{
Linus Walleijdece3702012-04-13 14:01:39 +0200327 db8500_prcmu_config_abb_event_readout(abb_events);
Mattias Nilssonfea799e2011-08-12 10:28:02 +0200328}
329
330static inline void prcmu_get_abb_event_buffer(void __iomem **buf)
331{
Linus Walleijdece3702012-04-13 14:01:39 +0200332 db8500_prcmu_get_abb_event_buffer(buf);
Mattias Nilssonfea799e2011-08-12 10:28:02 +0200333}
334
335int prcmu_abb_read(u8 slave, u8 reg, u8 *value, u8 size);
336int prcmu_abb_write(u8 slave, u8 reg, u8 *value, u8 size);
Mattias Nilsson3c3e4892012-03-08 14:02:05 +0100337int prcmu_abb_write_masked(u8 slave, u8 reg, u8 *value, u8 *mask, u8 size);
Mattias Nilssonfea799e2011-08-12 10:28:02 +0200338
339int prcmu_config_clkout(u8 clkout, u8 source, u8 div);
340
341static inline int prcmu_request_clock(u8 clock, bool enable)
342{
Linus Walleijdece3702012-04-13 14:01:39 +0200343 return db8500_prcmu_request_clock(clock, enable);
Mattias Nilssonfea799e2011-08-12 10:28:02 +0200344}
345
Mattias Nilsson05089012012-01-13 16:20:20 +0100346unsigned long prcmu_clock_rate(u8 clock);
347long prcmu_round_clock_rate(u8 clock, unsigned long rate);
348int prcmu_set_clock_rate(u8 clock, unsigned long rate);
349
350static inline int prcmu_set_ddr_opp(u8 opp)
351{
Linus Walleijdece3702012-04-13 14:01:39 +0200352 return db8500_prcmu_set_ddr_opp(opp);
Mattias Nilsson05089012012-01-13 16:20:20 +0100353}
354static inline int prcmu_get_ddr_opp(void)
355{
Linus Walleijdece3702012-04-13 14:01:39 +0200356 return db8500_prcmu_get_ddr_opp();
Mattias Nilsson05089012012-01-13 16:20:20 +0100357}
Mattias Nilssonfea799e2011-08-12 10:28:02 +0200358
359static inline int prcmu_set_arm_opp(u8 opp)
360{
Linus Walleijdece3702012-04-13 14:01:39 +0200361 return db8500_prcmu_set_arm_opp(opp);
Mattias Nilssonfea799e2011-08-12 10:28:02 +0200362}
363
364static inline int prcmu_get_arm_opp(void)
365{
Linus Walleijdece3702012-04-13 14:01:39 +0200366 return db8500_prcmu_get_arm_opp();
Mattias Nilssonfea799e2011-08-12 10:28:02 +0200367}
368
Mattias Nilsson05089012012-01-13 16:20:20 +0100369static inline int prcmu_set_ape_opp(u8 opp)
370{
Linus Walleijdece3702012-04-13 14:01:39 +0200371 return db8500_prcmu_set_ape_opp(opp);
Mattias Nilsson05089012012-01-13 16:20:20 +0100372}
373
374static inline int prcmu_get_ape_opp(void)
375{
Linus Walleijdece3702012-04-13 14:01:39 +0200376 return db8500_prcmu_get_ape_opp();
Mattias Nilsson05089012012-01-13 16:20:20 +0100377}
378
Ulf Hansson686f8712012-09-24 16:43:17 +0200379static inline int prcmu_request_ape_opp_100_voltage(bool enable)
380{
381 return db8500_prcmu_request_ape_opp_100_voltage(enable);
382}
383
Mattias Nilssonfea799e2011-08-12 10:28:02 +0200384static inline void prcmu_system_reset(u16 reset_code)
385{
Linus Walleijdece3702012-04-13 14:01:39 +0200386 return db8500_prcmu_system_reset(reset_code);
Mattias Nilssonfea799e2011-08-12 10:28:02 +0200387}
388
389static inline u16 prcmu_get_reset_code(void)
390{
Linus Walleijdece3702012-04-13 14:01:39 +0200391 return db8500_prcmu_get_reset_code();
Mattias Nilssonfea799e2011-08-12 10:28:02 +0200392}
393
Arun Murthy5261e102012-05-21 14:28:21 +0530394int prcmu_ac_wake_req(void);
Mattias Nilssonfea799e2011-08-12 10:28:02 +0200395void prcmu_ac_sleep_req(void);
Mattias Nilsson05089012012-01-13 16:20:20 +0100396static inline void prcmu_modem_reset(void)
397{
Linus Walleijdece3702012-04-13 14:01:39 +0200398 return db8500_prcmu_modem_reset();
Mattias Nilsson05089012012-01-13 16:20:20 +0100399}
400
Mattias Nilssonfea799e2011-08-12 10:28:02 +0200401static inline bool prcmu_is_ac_wake_requested(void)
402{
Linus Walleijdece3702012-04-13 14:01:39 +0200403 return db8500_prcmu_is_ac_wake_requested();
Mattias Nilssonfea799e2011-08-12 10:28:02 +0200404}
405
406static inline int prcmu_set_display_clocks(void)
407{
Linus Walleijdece3702012-04-13 14:01:39 +0200408 return db8500_prcmu_set_display_clocks();
Mattias Nilssonfea799e2011-08-12 10:28:02 +0200409}
410
411static inline int prcmu_disable_dsipll(void)
412{
Linus Walleijdece3702012-04-13 14:01:39 +0200413 return db8500_prcmu_disable_dsipll();
Mattias Nilssonfea799e2011-08-12 10:28:02 +0200414}
415
416static inline int prcmu_enable_dsipll(void)
417{
Linus Walleijdece3702012-04-13 14:01:39 +0200418 return db8500_prcmu_enable_dsipll();
Mattias Nilssonfea799e2011-08-12 10:28:02 +0200419}
420
421static inline int prcmu_config_esram0_deep_sleep(u8 state)
422{
Linus Walleijdece3702012-04-13 14:01:39 +0200423 return db8500_prcmu_config_esram0_deep_sleep(state);
Mattias Nilssonfea799e2011-08-12 10:28:02 +0200424}
Mattias Nilsson05089012012-01-13 16:20:20 +0100425
426static inline int prcmu_config_hotdog(u8 threshold)
427{
Linus Walleijdece3702012-04-13 14:01:39 +0200428 return db8500_prcmu_config_hotdog(threshold);
Mattias Nilsson05089012012-01-13 16:20:20 +0100429}
430
431static inline int prcmu_config_hotmon(u8 low, u8 high)
432{
Linus Walleijdece3702012-04-13 14:01:39 +0200433 return db8500_prcmu_config_hotmon(low, high);
Mattias Nilsson05089012012-01-13 16:20:20 +0100434}
435
436static inline int prcmu_start_temp_sense(u16 cycles32k)
437{
Linus Walleijdece3702012-04-13 14:01:39 +0200438 return db8500_prcmu_start_temp_sense(cycles32k);
Mattias Nilsson05089012012-01-13 16:20:20 +0100439}
440
441static inline int prcmu_stop_temp_sense(void)
442{
Linus Walleijdece3702012-04-13 14:01:39 +0200443 return db8500_prcmu_stop_temp_sense();
Mattias Nilsson05089012012-01-13 16:20:20 +0100444}
445
Mattias Nilssonb4a6dbd2012-01-13 16:21:00 +0100446static inline u32 prcmu_read(unsigned int reg)
447{
Linus Walleijdece3702012-04-13 14:01:39 +0200448 return db8500_prcmu_read(reg);
Mattias Nilssonb4a6dbd2012-01-13 16:21:00 +0100449}
450
451static inline void prcmu_write(unsigned int reg, u32 value)
452{
Linus Walleijdece3702012-04-13 14:01:39 +0200453 db8500_prcmu_write(reg, value);
Mattias Nilssonb4a6dbd2012-01-13 16:21:00 +0100454}
455
456static inline void prcmu_write_masked(unsigned int reg, u32 mask, u32 value)
457{
Linus Walleijdece3702012-04-13 14:01:39 +0200458 db8500_prcmu_write_masked(reg, mask, value);
Mattias Nilssonb4a6dbd2012-01-13 16:21:00 +0100459}
460
Mattias Nilsson05089012012-01-13 16:20:20 +0100461static inline int prcmu_enable_a9wdog(u8 id)
462{
Linus Walleijdece3702012-04-13 14:01:39 +0200463 return db8500_prcmu_enable_a9wdog(id);
Mattias Nilsson05089012012-01-13 16:20:20 +0100464}
465
466static inline int prcmu_disable_a9wdog(u8 id)
467{
Linus Walleijdece3702012-04-13 14:01:39 +0200468 return db8500_prcmu_disable_a9wdog(id);
Mattias Nilsson05089012012-01-13 16:20:20 +0100469}
470
471static inline int prcmu_kick_a9wdog(u8 id)
472{
Linus Walleijdece3702012-04-13 14:01:39 +0200473 return db8500_prcmu_kick_a9wdog(id);
Mattias Nilsson05089012012-01-13 16:20:20 +0100474}
475
476static inline int prcmu_load_a9wdog(u8 id, u32 timeout)
477{
Linus Walleijdece3702012-04-13 14:01:39 +0200478 return db8500_prcmu_load_a9wdog(id, timeout);
Mattias Nilsson05089012012-01-13 16:20:20 +0100479}
480
481static inline int prcmu_config_a9wdog(u8 num, bool sleep_auto_off)
482{
Linus Walleijdece3702012-04-13 14:01:39 +0200483 return db8500_prcmu_config_a9wdog(num, sleep_auto_off);
Mattias Nilsson05089012012-01-13 16:20:20 +0100484}
Mattias Nilssonfea799e2011-08-12 10:28:02 +0200485#else
486
Linus Walleij9a47a8d2013-03-21 12:27:25 +0100487static inline void prcmu_early_init(u32 phy_base, u32 size) {}
Mattias Nilssonfea799e2011-08-12 10:28:02 +0200488
489static inline int prcmu_set_power_state(u8 state, bool keep_ulp_clk,
490 bool keep_ap_pll)
491{
492 return 0;
493}
494
495static inline int prcmu_set_epod(u16 epod_id, u8 epod_state)
496{
497 return 0;
498}
499
500static inline void prcmu_enable_wakeups(u32 wakeups) {}
501
502static inline void prcmu_disable_wakeups(void) {}
503
504static inline int prcmu_abb_read(u8 slave, u8 reg, u8 *value, u8 size)
505{
506 return -ENOSYS;
507}
508
509static inline int prcmu_abb_write(u8 slave, u8 reg, u8 *value, u8 size)
510{
511 return -ENOSYS;
512}
513
Mattias Nilsson3c3e4892012-03-08 14:02:05 +0100514static inline int prcmu_abb_write_masked(u8 slave, u8 reg, u8 *value, u8 *mask,
515 u8 size)
516{
517 return -ENOSYS;
518}
519
Mattias Nilssonfea799e2011-08-12 10:28:02 +0200520static inline int prcmu_config_clkout(u8 clkout, u8 source, u8 div)
521{
522 return 0;
523}
524
525static inline int prcmu_request_clock(u8 clock, bool enable)
526{
527 return 0;
528}
529
Mattias Nilsson6b6fae22012-01-13 16:20:28 +0100530static inline long prcmu_round_clock_rate(u8 clock, unsigned long rate)
531{
532 return 0;
533}
534
535static inline int prcmu_set_clock_rate(u8 clock, unsigned long rate)
536{
537 return 0;
538}
539
540static inline unsigned long prcmu_clock_rate(u8 clock)
541{
542 return 0;
543}
544
Mattias Nilssonfea799e2011-08-12 10:28:02 +0200545static inline int prcmu_set_ape_opp(u8 opp)
546{
547 return 0;
548}
549
550static inline int prcmu_get_ape_opp(void)
551{
552 return APE_100_OPP;
553}
554
Ulf Hansson686f8712012-09-24 16:43:17 +0200555static inline int prcmu_request_ape_opp_100_voltage(bool enable)
556{
557 return 0;
558}
559
Mattias Nilssonfea799e2011-08-12 10:28:02 +0200560static inline int prcmu_set_arm_opp(u8 opp)
561{
562 return 0;
563}
564
565static inline int prcmu_get_arm_opp(void)
566{
567 return ARM_100_OPP;
568}
569
570static inline int prcmu_set_ddr_opp(u8 opp)
571{
572 return 0;
573}
574
575static inline int prcmu_get_ddr_opp(void)
576{
577 return DDR_100_OPP;
578}
579
580static inline void prcmu_system_reset(u16 reset_code) {}
581
582static inline u16 prcmu_get_reset_code(void)
583{
584 return 0;
585}
586
Arun Murthy5261e102012-05-21 14:28:21 +0530587static inline int prcmu_ac_wake_req(void)
588{
589 return 0;
590}
Mattias Nilssonfea799e2011-08-12 10:28:02 +0200591
592static inline void prcmu_ac_sleep_req(void) {}
593
594static inline void prcmu_modem_reset(void) {}
595
596static inline bool prcmu_is_ac_wake_requested(void)
597{
598 return false;
599}
600
601static inline int prcmu_set_display_clocks(void)
602{
603 return 0;
604}
605
606static inline int prcmu_disable_dsipll(void)
607{
608 return 0;
609}
610
611static inline int prcmu_enable_dsipll(void)
612{
613 return 0;
614}
615
616static inline int prcmu_config_esram0_deep_sleep(u8 state)
617{
618 return 0;
619}
620
621static inline void prcmu_config_abb_event_readout(u32 abb_events) {}
622
623static inline void prcmu_get_abb_event_buffer(void __iomem **buf)
624{
625 *buf = NULL;
626}
627
Mattias Nilsson05089012012-01-13 16:20:20 +0100628static inline int prcmu_config_hotdog(u8 threshold)
629{
630 return 0;
631}
632
633static inline int prcmu_config_hotmon(u8 low, u8 high)
634{
635 return 0;
636}
637
638static inline int prcmu_start_temp_sense(u16 cycles32k)
639{
640 return 0;
641}
642
643static inline int prcmu_stop_temp_sense(void)
644{
645 return 0;
646}
647
Mattias Nilssonb4a6dbd2012-01-13 16:21:00 +0100648static inline u32 prcmu_read(unsigned int reg)
649{
650 return 0;
651}
652
653static inline void prcmu_write(unsigned int reg, u32 value) {}
654
655static inline void prcmu_write_masked(unsigned int reg, u32 mask, u32 value) {}
656
657#endif
658
659static inline void prcmu_set(unsigned int reg, u32 bits)
660{
661 prcmu_write_masked(reg, bits, bits);
662}
663
664static inline void prcmu_clear(unsigned int reg, u32 bits)
665{
666 prcmu_write_masked(reg, bits, 0);
667}
668
Mattias Nilssonfea799e2011-08-12 10:28:02 +0200669/* PRCMU QoS APE OPP class */
670#define PRCMU_QOS_APE_OPP 1
671#define PRCMU_QOS_DDR_OPP 2
Mattias Nilsson4d64d2e2012-01-13 16:20:43 +0100672#define PRCMU_QOS_ARM_OPP 3
Mattias Nilssonfea799e2011-08-12 10:28:02 +0200673#define PRCMU_QOS_DEFAULT_VALUE -1
674
Mattias Nilsson4d64d2e2012-01-13 16:20:43 +0100675#ifdef CONFIG_DBX500_PRCMU_QOS_POWER
Mattias Nilssonfea799e2011-08-12 10:28:02 +0200676
677unsigned long prcmu_qos_get_cpufreq_opp_delay(void);
678void prcmu_qos_set_cpufreq_opp_delay(unsigned long);
679void prcmu_qos_force_opp(int, s32);
680int prcmu_qos_requirement(int pm_qos_class);
681int prcmu_qos_add_requirement(int pm_qos_class, char *name, s32 value);
682int prcmu_qos_update_requirement(int pm_qos_class, char *name, s32 new_value);
683void prcmu_qos_remove_requirement(int pm_qos_class, char *name);
684int prcmu_qos_add_notifier(int prcmu_qos_class,
685 struct notifier_block *notifier);
686int prcmu_qos_remove_notifier(int prcmu_qos_class,
687 struct notifier_block *notifier);
688
689#else
690
691static inline unsigned long prcmu_qos_get_cpufreq_opp_delay(void)
692{
693 return 0;
694}
695
696static inline void prcmu_qos_set_cpufreq_opp_delay(unsigned long n) {}
697
698static inline void prcmu_qos_force_opp(int prcmu_qos_class, s32 i) {}
699
700static inline int prcmu_qos_requirement(int prcmu_qos_class)
701{
702 return 0;
703}
704
705static inline int prcmu_qos_add_requirement(int prcmu_qos_class,
706 char *name, s32 value)
707{
708 return 0;
709}
710
711static inline int prcmu_qos_update_requirement(int prcmu_qos_class,
712 char *name, s32 new_value)
713{
714 return 0;
715}
716
717static inline void prcmu_qos_remove_requirement(int prcmu_qos_class, char *name)
718{
719}
720
721static inline int prcmu_qos_add_notifier(int prcmu_qos_class,
722 struct notifier_block *notifier)
723{
724 return 0;
725}
726static inline int prcmu_qos_remove_notifier(int prcmu_qos_class,
727 struct notifier_block *notifier)
728{
729 return 0;
730}
731
732#endif
733
734#endif /* __MACH_PRCMU_H */