blob: d0ba355cc55f181ebb2f89954c22bddac129930b [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,
Mattias Nilssonfea799e2011-08-12 10:28:02 +0200141 PRCMU_NUM_REG_CLOCKS,
142 PRCMU_SYSCLK = PRCMU_NUM_REG_CLOCKS,
Mattias Nilsson6b6fae22012-01-13 16:20:28 +0100143 PRCMU_CDCLK,
Mattias Nilssonfea799e2011-08-12 10:28:02 +0200144 PRCMU_TIMCLK,
145 PRCMU_PLLSOC0,
146 PRCMU_PLLSOC1,
Michel Jaouen20aee5b2012-08-31 14:21:30 +0200147 PRCMU_ARMSS,
Mattias Nilssonfea799e2011-08-12 10:28:02 +0200148 PRCMU_PLLDDR,
Mattias Nilsson6b6fae22012-01-13 16:20:28 +0100149 PRCMU_PLLDSI,
150 PRCMU_DSI0CLK,
151 PRCMU_DSI1CLK,
152 PRCMU_DSI0ESCCLK,
153 PRCMU_DSI1ESCCLK,
154 PRCMU_DSI2ESCCLK,
Philippe Begnic852bbba2013-05-27 14:41:30 +0200155 /* LCD DSI PLL - Ux540 only */
156 PRCMU_PLLDSI_LCD,
157 PRCMU_DSI0CLK_LCD,
158 PRCMU_DSI1CLK_LCD,
159 PRCMU_DSI0ESCCLK_LCD,
160 PRCMU_DSI1ESCCLK_LCD,
161 PRCMU_DSI2ESCCLK_LCD,
Mattias Nilssonfea799e2011-08-12 10:28:02 +0200162};
163
164/**
Fabio Baltieri98c60a02013-01-18 12:40:11 +0100165 * enum prcmu_wdog_id - PRCMU watchdog IDs
166 * @PRCMU_WDOG_ALL: use all timers
167 * @PRCMU_WDOG_CPU1: use first CPU timer only
168 * @PRCMU_WDOG_CPU2: use second CPU timer conly
169 */
170enum prcmu_wdog_id {
171 PRCMU_WDOG_ALL = 0x00,
172 PRCMU_WDOG_CPU1 = 0x01,
173 PRCMU_WDOG_CPU2 = 0x02,
174};
175
176/**
Mattias Nilssonfea799e2011-08-12 10:28:02 +0200177 * enum ape_opp - APE OPP states definition
178 * @APE_OPP_INIT:
179 * @APE_NO_CHANGE: The APE operating point is unchanged
180 * @APE_100_OPP: The new APE operating point is ape100opp
181 * @APE_50_OPP: 50%
Mattias Nilsson4d64d2e2012-01-13 16:20:43 +0100182 * @APE_50_PARTLY_25_OPP: 50%, except some clocks at 25%.
Mattias Nilssonfea799e2011-08-12 10:28:02 +0200183 */
184enum ape_opp {
185 APE_OPP_INIT = 0x00,
186 APE_NO_CHANGE = 0x01,
187 APE_100_OPP = 0x02,
Mattias Nilsson4d64d2e2012-01-13 16:20:43 +0100188 APE_50_OPP = 0x03,
189 APE_50_PARTLY_25_OPP = 0xFF,
Mattias Nilssonfea799e2011-08-12 10:28:02 +0200190};
191
192/**
193 * enum arm_opp - ARM OPP states definition
194 * @ARM_OPP_INIT:
195 * @ARM_NO_CHANGE: The ARM operating point is unchanged
196 * @ARM_100_OPP: The new ARM operating point is arm100opp
197 * @ARM_50_OPP: The new ARM operating point is arm50opp
198 * @ARM_MAX_OPP: Operating point is "max" (more than 100)
199 * @ARM_MAX_FREQ100OPP: Set max opp if available, else 100
200 * @ARM_EXTCLK: The new ARM operating point is armExtClk
201 */
202enum arm_opp {
203 ARM_OPP_INIT = 0x00,
204 ARM_NO_CHANGE = 0x01,
205 ARM_100_OPP = 0x02,
206 ARM_50_OPP = 0x03,
207 ARM_MAX_OPP = 0x04,
208 ARM_MAX_FREQ100OPP = 0x05,
209 ARM_EXTCLK = 0x07
210};
211
212/**
213 * enum ddr_opp - DDR OPP states definition
214 * @DDR_100_OPP: The new DDR operating point is ddr100opp
215 * @DDR_50_OPP: The new DDR operating point is ddr50opp
216 * @DDR_25_OPP: The new DDR operating point is ddr25opp
217 */
218enum ddr_opp {
219 DDR_100_OPP = 0x00,
220 DDR_50_OPP = 0x01,
221 DDR_25_OPP = 0x02,
222};
223
224/*
225 * Definitions for controlling ESRAM0 in deep sleep.
226 */
227#define ESRAM0_DEEP_SLEEP_STATE_OFF 1
228#define ESRAM0_DEEP_SLEEP_STATE_RET 2
229
230/**
231 * enum ddr_pwrst - DDR power states definition
232 * @DDR_PWR_STATE_UNCHANGED: SDRAM and DDR controller state is unchanged
233 * @DDR_PWR_STATE_ON:
234 * @DDR_PWR_STATE_OFFLOWLAT:
235 * @DDR_PWR_STATE_OFFHIGHLAT:
236 */
237enum ddr_pwrst {
238 DDR_PWR_STATE_UNCHANGED = 0x00,
239 DDR_PWR_STATE_ON = 0x01,
240 DDR_PWR_STATE_OFFLOWLAT = 0x02,
241 DDR_PWR_STATE_OFFHIGHLAT = 0x03
242};
243
Linus Walleij05ec2602013-02-07 10:17:31 +0100244#define DB8500_PRCMU_LEGACY_OFFSET 0xDD4
245
246struct prcmu_pdata
247{
248 bool enable_set_ddr_opp;
249 bool enable_ape_opp_100_voltage;
250 struct ab8500_platform_data *ab_platdata;
Arnd Bergmann55b175d2013-03-21 22:51:07 +0100251 int ab_irq;
252 int irq_base;
Linus Walleij05ec2602013-02-07 10:17:31 +0100253 u32 version_offset;
254 u32 legacy_offset;
255 u32 adt_offset;
256};
257
258#define PRCMU_FW_PROJECT_U8500 2
259#define PRCMU_FW_PROJECT_U8400 3
260#define PRCMU_FW_PROJECT_U9500 4 /* Customer specific */
261#define PRCMU_FW_PROJECT_U8500_MBB 5
262#define PRCMU_FW_PROJECT_U8500_C1 6
263#define PRCMU_FW_PROJECT_U8500_C2 7
264#define PRCMU_FW_PROJECT_U8500_C3 8
265#define PRCMU_FW_PROJECT_U8500_C4 9
266#define PRCMU_FW_PROJECT_U9500_MBL 10
267#define PRCMU_FW_PROJECT_U8500_MBL 11 /* Customer specific */
268#define PRCMU_FW_PROJECT_U8500_MBL2 12 /* Customer specific */
269#define PRCMU_FW_PROJECT_U8520 13
270#define PRCMU_FW_PROJECT_U8420 14
271#define PRCMU_FW_PROJECT_A9420 20
272/* [32..63] 9540 and derivatives */
273#define PRCMU_FW_PROJECT_U9540 32
274/* [64..95] 8540 and derivatives */
275#define PRCMU_FW_PROJECT_L8540 64
276/* [96..126] 8580 and derivatives */
277#define PRCMU_FW_PROJECT_L8580 96
278
279#define PRCMU_FW_PROJECT_NAME_LEN 20
280struct prcmu_fw_version {
281 u32 project; /* Notice, project shifted with 8 on ux540 */
282 u8 api_version;
283 u8 func_version;
284 u8 errata;
285 char project_name[PRCMU_FW_PROJECT_NAME_LEN];
286};
287
Mattias Nilssonfea799e2011-08-12 10:28:02 +0200288#include <linux/mfd/db8500-prcmu.h>
Mattias Nilssonfea799e2011-08-12 10:28:02 +0200289
Linus Walleijdece3702012-04-13 14:01:39 +0200290#if defined(CONFIG_UX500_SOC_DB8500)
Mattias Nilssonfea799e2011-08-12 10:28:02 +0200291
Linus Walleij9a47a8d2013-03-21 12:27:25 +0100292static inline void prcmu_early_init(u32 phy_base, u32 size)
Mattias Nilssonfea799e2011-08-12 10:28:02 +0200293{
Linus Walleij9a47a8d2013-03-21 12:27:25 +0100294 return db8500_prcmu_early_init(phy_base, size);
Mattias Nilssonfea799e2011-08-12 10:28:02 +0200295}
296
297static inline int prcmu_set_power_state(u8 state, bool keep_ulp_clk,
298 bool keep_ap_pll)
299{
Linus Walleijdece3702012-04-13 14:01:39 +0200300 return db8500_prcmu_set_power_state(state, keep_ulp_clk,
301 keep_ap_pll);
Mattias Nilssonfea799e2011-08-12 10:28:02 +0200302}
303
Mattias Nilsson4d64d2e2012-01-13 16:20:43 +0100304static inline u8 prcmu_get_power_state_result(void)
305{
Linus Walleijdece3702012-04-13 14:01:39 +0200306 return db8500_prcmu_get_power_state_result();
Mattias Nilsson4d64d2e2012-01-13 16:20:43 +0100307}
308
Mattias Nilssonfea799e2011-08-12 10:28:02 +0200309static inline int prcmu_set_epod(u16 epod_id, u8 epod_state)
310{
Linus Walleijdece3702012-04-13 14:01:39 +0200311 return db8500_prcmu_set_epod(epod_id, epod_state);
Mattias Nilssonfea799e2011-08-12 10:28:02 +0200312}
313
314static inline void prcmu_enable_wakeups(u32 wakeups)
315{
Linus Walleijdece3702012-04-13 14:01:39 +0200316 db8500_prcmu_enable_wakeups(wakeups);
Mattias Nilssonfea799e2011-08-12 10:28:02 +0200317}
318
319static inline void prcmu_disable_wakeups(void)
320{
321 prcmu_enable_wakeups(0);
322}
323
324static inline void prcmu_config_abb_event_readout(u32 abb_events)
325{
Linus Walleijdece3702012-04-13 14:01:39 +0200326 db8500_prcmu_config_abb_event_readout(abb_events);
Mattias Nilssonfea799e2011-08-12 10:28:02 +0200327}
328
329static inline void prcmu_get_abb_event_buffer(void __iomem **buf)
330{
Linus Walleijdece3702012-04-13 14:01:39 +0200331 db8500_prcmu_get_abb_event_buffer(buf);
Mattias Nilssonfea799e2011-08-12 10:28:02 +0200332}
333
334int prcmu_abb_read(u8 slave, u8 reg, u8 *value, u8 size);
335int prcmu_abb_write(u8 slave, u8 reg, u8 *value, u8 size);
Mattias Nilsson3c3e4892012-03-08 14:02:05 +0100336int prcmu_abb_write_masked(u8 slave, u8 reg, u8 *value, u8 *mask, u8 size);
Mattias Nilssonfea799e2011-08-12 10:28:02 +0200337
338int prcmu_config_clkout(u8 clkout, u8 source, u8 div);
339
340static inline int prcmu_request_clock(u8 clock, bool enable)
341{
Linus Walleijdece3702012-04-13 14:01:39 +0200342 return db8500_prcmu_request_clock(clock, enable);
Mattias Nilssonfea799e2011-08-12 10:28:02 +0200343}
344
Mattias Nilsson05089012012-01-13 16:20:20 +0100345unsigned long prcmu_clock_rate(u8 clock);
346long prcmu_round_clock_rate(u8 clock, unsigned long rate);
347int prcmu_set_clock_rate(u8 clock, unsigned long rate);
348
349static inline int prcmu_set_ddr_opp(u8 opp)
350{
Linus Walleijdece3702012-04-13 14:01:39 +0200351 return db8500_prcmu_set_ddr_opp(opp);
Mattias Nilsson05089012012-01-13 16:20:20 +0100352}
353static inline int prcmu_get_ddr_opp(void)
354{
Linus Walleijdece3702012-04-13 14:01:39 +0200355 return db8500_prcmu_get_ddr_opp();
Mattias Nilsson05089012012-01-13 16:20:20 +0100356}
Mattias Nilssonfea799e2011-08-12 10:28:02 +0200357
358static inline int prcmu_set_arm_opp(u8 opp)
359{
Linus Walleijdece3702012-04-13 14:01:39 +0200360 return db8500_prcmu_set_arm_opp(opp);
Mattias Nilssonfea799e2011-08-12 10:28:02 +0200361}
362
363static inline int prcmu_get_arm_opp(void)
364{
Linus Walleijdece3702012-04-13 14:01:39 +0200365 return db8500_prcmu_get_arm_opp();
Mattias Nilssonfea799e2011-08-12 10:28:02 +0200366}
367
Mattias Nilsson05089012012-01-13 16:20:20 +0100368static inline int prcmu_set_ape_opp(u8 opp)
369{
Linus Walleijdece3702012-04-13 14:01:39 +0200370 return db8500_prcmu_set_ape_opp(opp);
Mattias Nilsson05089012012-01-13 16:20:20 +0100371}
372
373static inline int prcmu_get_ape_opp(void)
374{
Linus Walleijdece3702012-04-13 14:01:39 +0200375 return db8500_prcmu_get_ape_opp();
Mattias Nilsson05089012012-01-13 16:20:20 +0100376}
377
Ulf Hansson686f8712012-09-24 16:43:17 +0200378static inline int prcmu_request_ape_opp_100_voltage(bool enable)
379{
380 return db8500_prcmu_request_ape_opp_100_voltage(enable);
381}
382
Mattias Nilssonfea799e2011-08-12 10:28:02 +0200383static inline void prcmu_system_reset(u16 reset_code)
384{
Linus Walleijdece3702012-04-13 14:01:39 +0200385 return db8500_prcmu_system_reset(reset_code);
Mattias Nilssonfea799e2011-08-12 10:28:02 +0200386}
387
388static inline u16 prcmu_get_reset_code(void)
389{
Linus Walleijdece3702012-04-13 14:01:39 +0200390 return db8500_prcmu_get_reset_code();
Mattias Nilssonfea799e2011-08-12 10:28:02 +0200391}
392
Arun Murthy5261e102012-05-21 14:28:21 +0530393int prcmu_ac_wake_req(void);
Mattias Nilssonfea799e2011-08-12 10:28:02 +0200394void prcmu_ac_sleep_req(void);
Mattias Nilsson05089012012-01-13 16:20:20 +0100395static inline void prcmu_modem_reset(void)
396{
Linus Walleijdece3702012-04-13 14:01:39 +0200397 return db8500_prcmu_modem_reset();
Mattias Nilsson05089012012-01-13 16:20:20 +0100398}
399
Mattias Nilssonfea799e2011-08-12 10:28:02 +0200400static inline bool prcmu_is_ac_wake_requested(void)
401{
Linus Walleijdece3702012-04-13 14:01:39 +0200402 return db8500_prcmu_is_ac_wake_requested();
Mattias Nilssonfea799e2011-08-12 10:28:02 +0200403}
404
405static inline int prcmu_set_display_clocks(void)
406{
Linus Walleijdece3702012-04-13 14:01:39 +0200407 return db8500_prcmu_set_display_clocks();
Mattias Nilssonfea799e2011-08-12 10:28:02 +0200408}
409
410static inline int prcmu_disable_dsipll(void)
411{
Linus Walleijdece3702012-04-13 14:01:39 +0200412 return db8500_prcmu_disable_dsipll();
Mattias Nilssonfea799e2011-08-12 10:28:02 +0200413}
414
415static inline int prcmu_enable_dsipll(void)
416{
Linus Walleijdece3702012-04-13 14:01:39 +0200417 return db8500_prcmu_enable_dsipll();
Mattias Nilssonfea799e2011-08-12 10:28:02 +0200418}
419
420static inline int prcmu_config_esram0_deep_sleep(u8 state)
421{
Linus Walleijdece3702012-04-13 14:01:39 +0200422 return db8500_prcmu_config_esram0_deep_sleep(state);
Mattias Nilssonfea799e2011-08-12 10:28:02 +0200423}
Mattias Nilsson05089012012-01-13 16:20:20 +0100424
425static inline int prcmu_config_hotdog(u8 threshold)
426{
Linus Walleijdece3702012-04-13 14:01:39 +0200427 return db8500_prcmu_config_hotdog(threshold);
Mattias Nilsson05089012012-01-13 16:20:20 +0100428}
429
430static inline int prcmu_config_hotmon(u8 low, u8 high)
431{
Linus Walleijdece3702012-04-13 14:01:39 +0200432 return db8500_prcmu_config_hotmon(low, high);
Mattias Nilsson05089012012-01-13 16:20:20 +0100433}
434
435static inline int prcmu_start_temp_sense(u16 cycles32k)
436{
Linus Walleijdece3702012-04-13 14:01:39 +0200437 return db8500_prcmu_start_temp_sense(cycles32k);
Mattias Nilsson05089012012-01-13 16:20:20 +0100438}
439
440static inline int prcmu_stop_temp_sense(void)
441{
Linus Walleijdece3702012-04-13 14:01:39 +0200442 return db8500_prcmu_stop_temp_sense();
Mattias Nilsson05089012012-01-13 16:20:20 +0100443}
444
Mattias Nilssonb4a6dbd2012-01-13 16:21:00 +0100445static inline u32 prcmu_read(unsigned int reg)
446{
Linus Walleijdece3702012-04-13 14:01:39 +0200447 return db8500_prcmu_read(reg);
Mattias Nilssonb4a6dbd2012-01-13 16:21:00 +0100448}
449
450static inline void prcmu_write(unsigned int reg, u32 value)
451{
Linus Walleijdece3702012-04-13 14:01:39 +0200452 db8500_prcmu_write(reg, value);
Mattias Nilssonb4a6dbd2012-01-13 16:21:00 +0100453}
454
455static inline void prcmu_write_masked(unsigned int reg, u32 mask, u32 value)
456{
Linus Walleijdece3702012-04-13 14:01:39 +0200457 db8500_prcmu_write_masked(reg, mask, value);
Mattias Nilssonb4a6dbd2012-01-13 16:21:00 +0100458}
459
Mattias Nilsson05089012012-01-13 16:20:20 +0100460static inline int prcmu_enable_a9wdog(u8 id)
461{
Linus Walleijdece3702012-04-13 14:01:39 +0200462 return db8500_prcmu_enable_a9wdog(id);
Mattias Nilsson05089012012-01-13 16:20:20 +0100463}
464
465static inline int prcmu_disable_a9wdog(u8 id)
466{
Linus Walleijdece3702012-04-13 14:01:39 +0200467 return db8500_prcmu_disable_a9wdog(id);
Mattias Nilsson05089012012-01-13 16:20:20 +0100468}
469
470static inline int prcmu_kick_a9wdog(u8 id)
471{
Linus Walleijdece3702012-04-13 14:01:39 +0200472 return db8500_prcmu_kick_a9wdog(id);
Mattias Nilsson05089012012-01-13 16:20:20 +0100473}
474
475static inline int prcmu_load_a9wdog(u8 id, u32 timeout)
476{
Linus Walleijdece3702012-04-13 14:01:39 +0200477 return db8500_prcmu_load_a9wdog(id, timeout);
Mattias Nilsson05089012012-01-13 16:20:20 +0100478}
479
480static inline int prcmu_config_a9wdog(u8 num, bool sleep_auto_off)
481{
Linus Walleijdece3702012-04-13 14:01:39 +0200482 return db8500_prcmu_config_a9wdog(num, sleep_auto_off);
Mattias Nilsson05089012012-01-13 16:20:20 +0100483}
Mattias Nilssonfea799e2011-08-12 10:28:02 +0200484#else
485
Linus Walleij9a47a8d2013-03-21 12:27:25 +0100486static inline void prcmu_early_init(u32 phy_base, u32 size) {}
Mattias Nilssonfea799e2011-08-12 10:28:02 +0200487
488static inline int prcmu_set_power_state(u8 state, bool keep_ulp_clk,
489 bool keep_ap_pll)
490{
491 return 0;
492}
493
494static inline int prcmu_set_epod(u16 epod_id, u8 epod_state)
495{
496 return 0;
497}
498
499static inline void prcmu_enable_wakeups(u32 wakeups) {}
500
501static inline void prcmu_disable_wakeups(void) {}
502
503static inline int prcmu_abb_read(u8 slave, u8 reg, u8 *value, u8 size)
504{
505 return -ENOSYS;
506}
507
508static inline int prcmu_abb_write(u8 slave, u8 reg, u8 *value, u8 size)
509{
510 return -ENOSYS;
511}
512
Mattias Nilsson3c3e4892012-03-08 14:02:05 +0100513static inline int prcmu_abb_write_masked(u8 slave, u8 reg, u8 *value, u8 *mask,
514 u8 size)
515{
516 return -ENOSYS;
517}
518
Mattias Nilssonfea799e2011-08-12 10:28:02 +0200519static inline int prcmu_config_clkout(u8 clkout, u8 source, u8 div)
520{
521 return 0;
522}
523
524static inline int prcmu_request_clock(u8 clock, bool enable)
525{
526 return 0;
527}
528
Mattias Nilsson6b6fae22012-01-13 16:20:28 +0100529static inline long prcmu_round_clock_rate(u8 clock, unsigned long rate)
530{
531 return 0;
532}
533
534static inline int prcmu_set_clock_rate(u8 clock, unsigned long rate)
535{
536 return 0;
537}
538
539static inline unsigned long prcmu_clock_rate(u8 clock)
540{
541 return 0;
542}
543
Mattias Nilssonfea799e2011-08-12 10:28:02 +0200544static inline int prcmu_set_ape_opp(u8 opp)
545{
546 return 0;
547}
548
549static inline int prcmu_get_ape_opp(void)
550{
551 return APE_100_OPP;
552}
553
Ulf Hansson686f8712012-09-24 16:43:17 +0200554static inline int prcmu_request_ape_opp_100_voltage(bool enable)
555{
556 return 0;
557}
558
Mattias Nilssonfea799e2011-08-12 10:28:02 +0200559static inline int prcmu_set_arm_opp(u8 opp)
560{
561 return 0;
562}
563
564static inline int prcmu_get_arm_opp(void)
565{
566 return ARM_100_OPP;
567}
568
569static inline int prcmu_set_ddr_opp(u8 opp)
570{
571 return 0;
572}
573
574static inline int prcmu_get_ddr_opp(void)
575{
576 return DDR_100_OPP;
577}
578
579static inline void prcmu_system_reset(u16 reset_code) {}
580
581static inline u16 prcmu_get_reset_code(void)
582{
583 return 0;
584}
585
Arun Murthy5261e102012-05-21 14:28:21 +0530586static inline int prcmu_ac_wake_req(void)
587{
588 return 0;
589}
Mattias Nilssonfea799e2011-08-12 10:28:02 +0200590
591static inline void prcmu_ac_sleep_req(void) {}
592
593static inline void prcmu_modem_reset(void) {}
594
595static inline bool prcmu_is_ac_wake_requested(void)
596{
597 return false;
598}
599
600static inline int prcmu_set_display_clocks(void)
601{
602 return 0;
603}
604
605static inline int prcmu_disable_dsipll(void)
606{
607 return 0;
608}
609
610static inline int prcmu_enable_dsipll(void)
611{
612 return 0;
613}
614
615static inline int prcmu_config_esram0_deep_sleep(u8 state)
616{
617 return 0;
618}
619
620static inline void prcmu_config_abb_event_readout(u32 abb_events) {}
621
622static inline void prcmu_get_abb_event_buffer(void __iomem **buf)
623{
624 *buf = NULL;
625}
626
Mattias Nilsson05089012012-01-13 16:20:20 +0100627static inline int prcmu_config_hotdog(u8 threshold)
628{
629 return 0;
630}
631
632static inline int prcmu_config_hotmon(u8 low, u8 high)
633{
634 return 0;
635}
636
637static inline int prcmu_start_temp_sense(u16 cycles32k)
638{
639 return 0;
640}
641
642static inline int prcmu_stop_temp_sense(void)
643{
644 return 0;
645}
646
Mattias Nilssonb4a6dbd2012-01-13 16:21:00 +0100647static inline u32 prcmu_read(unsigned int reg)
648{
649 return 0;
650}
651
652static inline void prcmu_write(unsigned int reg, u32 value) {}
653
654static inline void prcmu_write_masked(unsigned int reg, u32 mask, u32 value) {}
655
656#endif
657
658static inline void prcmu_set(unsigned int reg, u32 bits)
659{
660 prcmu_write_masked(reg, bits, bits);
661}
662
663static inline void prcmu_clear(unsigned int reg, u32 bits)
664{
665 prcmu_write_masked(reg, bits, 0);
666}
667
Mattias Nilssonfea799e2011-08-12 10:28:02 +0200668/* PRCMU QoS APE OPP class */
669#define PRCMU_QOS_APE_OPP 1
670#define PRCMU_QOS_DDR_OPP 2
Mattias Nilsson4d64d2e2012-01-13 16:20:43 +0100671#define PRCMU_QOS_ARM_OPP 3
Mattias Nilssonfea799e2011-08-12 10:28:02 +0200672#define PRCMU_QOS_DEFAULT_VALUE -1
673
Mattias Nilsson4d64d2e2012-01-13 16:20:43 +0100674#ifdef CONFIG_DBX500_PRCMU_QOS_POWER
Mattias Nilssonfea799e2011-08-12 10:28:02 +0200675
676unsigned long prcmu_qos_get_cpufreq_opp_delay(void);
677void prcmu_qos_set_cpufreq_opp_delay(unsigned long);
678void prcmu_qos_force_opp(int, s32);
679int prcmu_qos_requirement(int pm_qos_class);
680int prcmu_qos_add_requirement(int pm_qos_class, char *name, s32 value);
681int prcmu_qos_update_requirement(int pm_qos_class, char *name, s32 new_value);
682void prcmu_qos_remove_requirement(int pm_qos_class, char *name);
683int prcmu_qos_add_notifier(int prcmu_qos_class,
684 struct notifier_block *notifier);
685int prcmu_qos_remove_notifier(int prcmu_qos_class,
686 struct notifier_block *notifier);
687
688#else
689
690static inline unsigned long prcmu_qos_get_cpufreq_opp_delay(void)
691{
692 return 0;
693}
694
695static inline void prcmu_qos_set_cpufreq_opp_delay(unsigned long n) {}
696
697static inline void prcmu_qos_force_opp(int prcmu_qos_class, s32 i) {}
698
699static inline int prcmu_qos_requirement(int prcmu_qos_class)
700{
701 return 0;
702}
703
704static inline int prcmu_qos_add_requirement(int prcmu_qos_class,
705 char *name, s32 value)
706{
707 return 0;
708}
709
710static inline int prcmu_qos_update_requirement(int prcmu_qos_class,
711 char *name, s32 new_value)
712{
713 return 0;
714}
715
716static inline void prcmu_qos_remove_requirement(int prcmu_qos_class, char *name)
717{
718}
719
720static inline int prcmu_qos_add_notifier(int prcmu_qos_class,
721 struct notifier_block *notifier)
722{
723 return 0;
724}
725static inline int prcmu_qos_remove_notifier(int prcmu_qos_class,
726 struct notifier_block *notifier)
727{
728 return 0;
729}
730
731#endif
732
733#endif /* __MACH_PRCMU_H */