Mattias Nilsson | fea799e | 2011-08-12 10:28:02 +0200 | [diff] [blame] | 1 | /* |
| 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 Nilsson | 0508901 | 2012-01-13 16:20:20 +0100 | [diff] [blame] | 13 | #include <linux/err.h> |
Mattias Nilsson | fea799e | 2011-08-12 10:28:02 +0200 | [diff] [blame] | 14 | |
Lee Jones | 67f13da | 2013-06-06 11:50:47 +0100 | [diff] [blame] | 15 | #include <dt-bindings/mfd/dbx500-prcmu.h> /* For clock identifiers */ |
| 16 | |
Linus Walleij | 05ec260 | 2013-02-07 10:17:31 +0100 | [diff] [blame] | 17 | /* Offset for the firmware version within the TCPM */ |
| 18 | #define DB8500_PRCMU_FW_VERSION_OFFSET 0xA4 |
| 19 | #define DBX540_PRCMU_FW_VERSION_OFFSET 0xA8 |
| 20 | |
Mattias Nilsson | fea799e | 2011-08-12 10:28:02 +0200 | [diff] [blame] | 21 | /* PRCMU Wakeup defines */ |
| 22 | enum prcmu_wakeup_index { |
| 23 | PRCMU_WAKEUP_INDEX_RTC, |
| 24 | PRCMU_WAKEUP_INDEX_RTT0, |
| 25 | PRCMU_WAKEUP_INDEX_RTT1, |
| 26 | PRCMU_WAKEUP_INDEX_HSI0, |
| 27 | PRCMU_WAKEUP_INDEX_HSI1, |
| 28 | PRCMU_WAKEUP_INDEX_USB, |
| 29 | PRCMU_WAKEUP_INDEX_ABB, |
| 30 | PRCMU_WAKEUP_INDEX_ABB_FIFO, |
| 31 | PRCMU_WAKEUP_INDEX_ARM, |
| 32 | PRCMU_WAKEUP_INDEX_CD_IRQ, |
| 33 | NUM_PRCMU_WAKEUP_INDICES |
| 34 | }; |
| 35 | #define PRCMU_WAKEUP(_name) (BIT(PRCMU_WAKEUP_INDEX_##_name)) |
| 36 | |
| 37 | /* EPOD (power domain) IDs */ |
| 38 | |
| 39 | /* |
| 40 | * DB8500 EPODs |
| 41 | * - EPOD_ID_SVAMMDSP: power domain for SVA MMDSP |
| 42 | * - EPOD_ID_SVAPIPE: power domain for SVA pipe |
| 43 | * - EPOD_ID_SIAMMDSP: power domain for SIA MMDSP |
| 44 | * - EPOD_ID_SIAPIPE: power domain for SIA pipe |
| 45 | * - EPOD_ID_SGA: power domain for SGA |
| 46 | * - EPOD_ID_B2R2_MCDE: power domain for B2R2 and MCDE |
| 47 | * - EPOD_ID_ESRAM12: power domain for ESRAM 1 and 2 |
| 48 | * - EPOD_ID_ESRAM34: power domain for ESRAM 3 and 4 |
| 49 | * - NUM_EPOD_ID: number of power domains |
| 50 | * |
| 51 | * TODO: These should be prefixed. |
| 52 | */ |
| 53 | #define EPOD_ID_SVAMMDSP 0 |
| 54 | #define EPOD_ID_SVAPIPE 1 |
| 55 | #define EPOD_ID_SIAMMDSP 2 |
| 56 | #define EPOD_ID_SIAPIPE 3 |
| 57 | #define EPOD_ID_SGA 4 |
| 58 | #define EPOD_ID_B2R2_MCDE 5 |
| 59 | #define EPOD_ID_ESRAM12 6 |
| 60 | #define EPOD_ID_ESRAM34 7 |
| 61 | #define NUM_EPOD_ID 8 |
| 62 | |
| 63 | /* |
Mattias Nilsson | fea799e | 2011-08-12 10:28:02 +0200 | [diff] [blame] | 64 | * state definition for EPOD (power domain) |
| 65 | * - EPOD_STATE_NO_CHANGE: The EPOD should remain unchanged |
| 66 | * - EPOD_STATE_OFF: The EPOD is switched off |
| 67 | * - EPOD_STATE_RAMRET: The EPOD is switched off with its internal RAM in |
| 68 | * retention |
| 69 | * - EPOD_STATE_ON_CLK_OFF: The EPOD is switched on, clock is still off |
| 70 | * - EPOD_STATE_ON: Same as above, but with clock enabled |
| 71 | */ |
| 72 | #define EPOD_STATE_NO_CHANGE 0x00 |
| 73 | #define EPOD_STATE_OFF 0x01 |
| 74 | #define EPOD_STATE_RAMRET 0x02 |
| 75 | #define EPOD_STATE_ON_CLK_OFF 0x03 |
| 76 | #define EPOD_STATE_ON 0x04 |
| 77 | |
| 78 | /* |
| 79 | * CLKOUT sources |
| 80 | */ |
| 81 | #define PRCMU_CLKSRC_CLK38M 0x00 |
| 82 | #define PRCMU_CLKSRC_ACLK 0x01 |
| 83 | #define PRCMU_CLKSRC_SYSCLK 0x02 |
| 84 | #define PRCMU_CLKSRC_LCDCLK 0x03 |
| 85 | #define PRCMU_CLKSRC_SDMMCCLK 0x04 |
| 86 | #define PRCMU_CLKSRC_TVCLK 0x05 |
| 87 | #define PRCMU_CLKSRC_TIMCLK 0x06 |
| 88 | #define PRCMU_CLKSRC_CLK009 0x07 |
| 89 | /* These are only valid for CLKOUT1: */ |
| 90 | #define PRCMU_CLKSRC_SIAMMDSPCLK 0x40 |
| 91 | #define PRCMU_CLKSRC_I2CCLK 0x41 |
| 92 | #define PRCMU_CLKSRC_MSP02CLK 0x42 |
| 93 | #define PRCMU_CLKSRC_ARMPLL_OBSCLK 0x43 |
| 94 | #define PRCMU_CLKSRC_HSIRXCLK 0x44 |
| 95 | #define PRCMU_CLKSRC_HSITXCLK 0x45 |
| 96 | #define PRCMU_CLKSRC_ARMCLKFIX 0x46 |
| 97 | #define PRCMU_CLKSRC_HDMICLK 0x47 |
| 98 | |
Mattias Nilsson | fea799e | 2011-08-12 10:28:02 +0200 | [diff] [blame] | 99 | /** |
Fabio Baltieri | 98c60a0 | 2013-01-18 12:40:11 +0100 | [diff] [blame] | 100 | * enum prcmu_wdog_id - PRCMU watchdog IDs |
| 101 | * @PRCMU_WDOG_ALL: use all timers |
| 102 | * @PRCMU_WDOG_CPU1: use first CPU timer only |
| 103 | * @PRCMU_WDOG_CPU2: use second CPU timer conly |
| 104 | */ |
| 105 | enum prcmu_wdog_id { |
| 106 | PRCMU_WDOG_ALL = 0x00, |
| 107 | PRCMU_WDOG_CPU1 = 0x01, |
| 108 | PRCMU_WDOG_CPU2 = 0x02, |
| 109 | }; |
| 110 | |
| 111 | /** |
Mattias Nilsson | fea799e | 2011-08-12 10:28:02 +0200 | [diff] [blame] | 112 | * enum ape_opp - APE OPP states definition |
| 113 | * @APE_OPP_INIT: |
| 114 | * @APE_NO_CHANGE: The APE operating point is unchanged |
| 115 | * @APE_100_OPP: The new APE operating point is ape100opp |
| 116 | * @APE_50_OPP: 50% |
Mattias Nilsson | 4d64d2e | 2012-01-13 16:20:43 +0100 | [diff] [blame] | 117 | * @APE_50_PARTLY_25_OPP: 50%, except some clocks at 25%. |
Mattias Nilsson | fea799e | 2011-08-12 10:28:02 +0200 | [diff] [blame] | 118 | */ |
| 119 | enum ape_opp { |
| 120 | APE_OPP_INIT = 0x00, |
| 121 | APE_NO_CHANGE = 0x01, |
| 122 | APE_100_OPP = 0x02, |
Mattias Nilsson | 4d64d2e | 2012-01-13 16:20:43 +0100 | [diff] [blame] | 123 | APE_50_OPP = 0x03, |
| 124 | APE_50_PARTLY_25_OPP = 0xFF, |
Mattias Nilsson | fea799e | 2011-08-12 10:28:02 +0200 | [diff] [blame] | 125 | }; |
| 126 | |
| 127 | /** |
| 128 | * enum arm_opp - ARM OPP states definition |
| 129 | * @ARM_OPP_INIT: |
| 130 | * @ARM_NO_CHANGE: The ARM operating point is unchanged |
| 131 | * @ARM_100_OPP: The new ARM operating point is arm100opp |
| 132 | * @ARM_50_OPP: The new ARM operating point is arm50opp |
| 133 | * @ARM_MAX_OPP: Operating point is "max" (more than 100) |
| 134 | * @ARM_MAX_FREQ100OPP: Set max opp if available, else 100 |
| 135 | * @ARM_EXTCLK: The new ARM operating point is armExtClk |
| 136 | */ |
| 137 | enum arm_opp { |
| 138 | ARM_OPP_INIT = 0x00, |
| 139 | ARM_NO_CHANGE = 0x01, |
| 140 | ARM_100_OPP = 0x02, |
| 141 | ARM_50_OPP = 0x03, |
| 142 | ARM_MAX_OPP = 0x04, |
| 143 | ARM_MAX_FREQ100OPP = 0x05, |
| 144 | ARM_EXTCLK = 0x07 |
| 145 | }; |
| 146 | |
| 147 | /** |
| 148 | * enum ddr_opp - DDR OPP states definition |
| 149 | * @DDR_100_OPP: The new DDR operating point is ddr100opp |
| 150 | * @DDR_50_OPP: The new DDR operating point is ddr50opp |
| 151 | * @DDR_25_OPP: The new DDR operating point is ddr25opp |
| 152 | */ |
| 153 | enum ddr_opp { |
| 154 | DDR_100_OPP = 0x00, |
| 155 | DDR_50_OPP = 0x01, |
| 156 | DDR_25_OPP = 0x02, |
| 157 | }; |
| 158 | |
| 159 | /* |
| 160 | * Definitions for controlling ESRAM0 in deep sleep. |
| 161 | */ |
| 162 | #define ESRAM0_DEEP_SLEEP_STATE_OFF 1 |
| 163 | #define ESRAM0_DEEP_SLEEP_STATE_RET 2 |
| 164 | |
| 165 | /** |
| 166 | * enum ddr_pwrst - DDR power states definition |
| 167 | * @DDR_PWR_STATE_UNCHANGED: SDRAM and DDR controller state is unchanged |
| 168 | * @DDR_PWR_STATE_ON: |
| 169 | * @DDR_PWR_STATE_OFFLOWLAT: |
| 170 | * @DDR_PWR_STATE_OFFHIGHLAT: |
| 171 | */ |
| 172 | enum ddr_pwrst { |
| 173 | DDR_PWR_STATE_UNCHANGED = 0x00, |
| 174 | DDR_PWR_STATE_ON = 0x01, |
| 175 | DDR_PWR_STATE_OFFLOWLAT = 0x02, |
| 176 | DDR_PWR_STATE_OFFHIGHLAT = 0x03 |
| 177 | }; |
| 178 | |
Linus Walleij | 05ec260 | 2013-02-07 10:17:31 +0100 | [diff] [blame] | 179 | #define DB8500_PRCMU_LEGACY_OFFSET 0xDD4 |
| 180 | |
| 181 | struct prcmu_pdata |
| 182 | { |
| 183 | bool enable_set_ddr_opp; |
| 184 | bool enable_ape_opp_100_voltage; |
| 185 | struct ab8500_platform_data *ab_platdata; |
Arnd Bergmann | 55b175d | 2013-03-21 22:51:07 +0100 | [diff] [blame] | 186 | int ab_irq; |
| 187 | int irq_base; |
Linus Walleij | 05ec260 | 2013-02-07 10:17:31 +0100 | [diff] [blame] | 188 | u32 version_offset; |
| 189 | u32 legacy_offset; |
| 190 | u32 adt_offset; |
| 191 | }; |
| 192 | |
| 193 | #define PRCMU_FW_PROJECT_U8500 2 |
| 194 | #define PRCMU_FW_PROJECT_U8400 3 |
| 195 | #define PRCMU_FW_PROJECT_U9500 4 /* Customer specific */ |
| 196 | #define PRCMU_FW_PROJECT_U8500_MBB 5 |
| 197 | #define PRCMU_FW_PROJECT_U8500_C1 6 |
| 198 | #define PRCMU_FW_PROJECT_U8500_C2 7 |
| 199 | #define PRCMU_FW_PROJECT_U8500_C3 8 |
| 200 | #define PRCMU_FW_PROJECT_U8500_C4 9 |
| 201 | #define PRCMU_FW_PROJECT_U9500_MBL 10 |
| 202 | #define PRCMU_FW_PROJECT_U8500_MBL 11 /* Customer specific */ |
| 203 | #define PRCMU_FW_PROJECT_U8500_MBL2 12 /* Customer specific */ |
| 204 | #define PRCMU_FW_PROJECT_U8520 13 |
| 205 | #define PRCMU_FW_PROJECT_U8420 14 |
| 206 | #define PRCMU_FW_PROJECT_A9420 20 |
| 207 | /* [32..63] 9540 and derivatives */ |
| 208 | #define PRCMU_FW_PROJECT_U9540 32 |
| 209 | /* [64..95] 8540 and derivatives */ |
| 210 | #define PRCMU_FW_PROJECT_L8540 64 |
| 211 | /* [96..126] 8580 and derivatives */ |
| 212 | #define PRCMU_FW_PROJECT_L8580 96 |
| 213 | |
| 214 | #define PRCMU_FW_PROJECT_NAME_LEN 20 |
| 215 | struct prcmu_fw_version { |
| 216 | u32 project; /* Notice, project shifted with 8 on ux540 */ |
| 217 | u8 api_version; |
| 218 | u8 func_version; |
| 219 | u8 errata; |
| 220 | char project_name[PRCMU_FW_PROJECT_NAME_LEN]; |
| 221 | }; |
| 222 | |
Mattias Nilsson | fea799e | 2011-08-12 10:28:02 +0200 | [diff] [blame] | 223 | #include <linux/mfd/db8500-prcmu.h> |
Mattias Nilsson | fea799e | 2011-08-12 10:28:02 +0200 | [diff] [blame] | 224 | |
Linus Walleij | dece370 | 2012-04-13 14:01:39 +0200 | [diff] [blame] | 225 | #if defined(CONFIG_UX500_SOC_DB8500) |
Mattias Nilsson | fea799e | 2011-08-12 10:28:02 +0200 | [diff] [blame] | 226 | |
Linus Walleij | 9a47a8d | 2013-03-21 12:27:25 +0100 | [diff] [blame] | 227 | static inline void prcmu_early_init(u32 phy_base, u32 size) |
Mattias Nilsson | fea799e | 2011-08-12 10:28:02 +0200 | [diff] [blame] | 228 | { |
Linus Walleij | 9a47a8d | 2013-03-21 12:27:25 +0100 | [diff] [blame] | 229 | return db8500_prcmu_early_init(phy_base, size); |
Mattias Nilsson | fea799e | 2011-08-12 10:28:02 +0200 | [diff] [blame] | 230 | } |
| 231 | |
| 232 | static inline int prcmu_set_power_state(u8 state, bool keep_ulp_clk, |
| 233 | bool keep_ap_pll) |
| 234 | { |
Linus Walleij | dece370 | 2012-04-13 14:01:39 +0200 | [diff] [blame] | 235 | return db8500_prcmu_set_power_state(state, keep_ulp_clk, |
| 236 | keep_ap_pll); |
Mattias Nilsson | fea799e | 2011-08-12 10:28:02 +0200 | [diff] [blame] | 237 | } |
| 238 | |
Mattias Nilsson | 4d64d2e | 2012-01-13 16:20:43 +0100 | [diff] [blame] | 239 | static inline u8 prcmu_get_power_state_result(void) |
| 240 | { |
Linus Walleij | dece370 | 2012-04-13 14:01:39 +0200 | [diff] [blame] | 241 | return db8500_prcmu_get_power_state_result(); |
Mattias Nilsson | 4d64d2e | 2012-01-13 16:20:43 +0100 | [diff] [blame] | 242 | } |
| 243 | |
Mattias Nilsson | fea799e | 2011-08-12 10:28:02 +0200 | [diff] [blame] | 244 | static inline int prcmu_set_epod(u16 epod_id, u8 epod_state) |
| 245 | { |
Linus Walleij | dece370 | 2012-04-13 14:01:39 +0200 | [diff] [blame] | 246 | return db8500_prcmu_set_epod(epod_id, epod_state); |
Mattias Nilsson | fea799e | 2011-08-12 10:28:02 +0200 | [diff] [blame] | 247 | } |
| 248 | |
| 249 | static inline void prcmu_enable_wakeups(u32 wakeups) |
| 250 | { |
Linus Walleij | dece370 | 2012-04-13 14:01:39 +0200 | [diff] [blame] | 251 | db8500_prcmu_enable_wakeups(wakeups); |
Mattias Nilsson | fea799e | 2011-08-12 10:28:02 +0200 | [diff] [blame] | 252 | } |
| 253 | |
| 254 | static inline void prcmu_disable_wakeups(void) |
| 255 | { |
| 256 | prcmu_enable_wakeups(0); |
| 257 | } |
| 258 | |
| 259 | static inline void prcmu_config_abb_event_readout(u32 abb_events) |
| 260 | { |
Linus Walleij | dece370 | 2012-04-13 14:01:39 +0200 | [diff] [blame] | 261 | db8500_prcmu_config_abb_event_readout(abb_events); |
Mattias Nilsson | fea799e | 2011-08-12 10:28:02 +0200 | [diff] [blame] | 262 | } |
| 263 | |
| 264 | static inline void prcmu_get_abb_event_buffer(void __iomem **buf) |
| 265 | { |
Linus Walleij | dece370 | 2012-04-13 14:01:39 +0200 | [diff] [blame] | 266 | db8500_prcmu_get_abb_event_buffer(buf); |
Mattias Nilsson | fea799e | 2011-08-12 10:28:02 +0200 | [diff] [blame] | 267 | } |
| 268 | |
| 269 | int prcmu_abb_read(u8 slave, u8 reg, u8 *value, u8 size); |
| 270 | int prcmu_abb_write(u8 slave, u8 reg, u8 *value, u8 size); |
Mattias Nilsson | 3c3e489 | 2012-03-08 14:02:05 +0100 | [diff] [blame] | 271 | int prcmu_abb_write_masked(u8 slave, u8 reg, u8 *value, u8 *mask, u8 size); |
Mattias Nilsson | fea799e | 2011-08-12 10:28:02 +0200 | [diff] [blame] | 272 | |
| 273 | int prcmu_config_clkout(u8 clkout, u8 source, u8 div); |
| 274 | |
| 275 | static inline int prcmu_request_clock(u8 clock, bool enable) |
| 276 | { |
Linus Walleij | dece370 | 2012-04-13 14:01:39 +0200 | [diff] [blame] | 277 | return db8500_prcmu_request_clock(clock, enable); |
Mattias Nilsson | fea799e | 2011-08-12 10:28:02 +0200 | [diff] [blame] | 278 | } |
| 279 | |
Mattias Nilsson | 0508901 | 2012-01-13 16:20:20 +0100 | [diff] [blame] | 280 | unsigned long prcmu_clock_rate(u8 clock); |
| 281 | long prcmu_round_clock_rate(u8 clock, unsigned long rate); |
| 282 | int prcmu_set_clock_rate(u8 clock, unsigned long rate); |
| 283 | |
| 284 | static inline int prcmu_set_ddr_opp(u8 opp) |
| 285 | { |
Linus Walleij | dece370 | 2012-04-13 14:01:39 +0200 | [diff] [blame] | 286 | return db8500_prcmu_set_ddr_opp(opp); |
Mattias Nilsson | 0508901 | 2012-01-13 16:20:20 +0100 | [diff] [blame] | 287 | } |
| 288 | static inline int prcmu_get_ddr_opp(void) |
| 289 | { |
Linus Walleij | dece370 | 2012-04-13 14:01:39 +0200 | [diff] [blame] | 290 | return db8500_prcmu_get_ddr_opp(); |
Mattias Nilsson | 0508901 | 2012-01-13 16:20:20 +0100 | [diff] [blame] | 291 | } |
Mattias Nilsson | fea799e | 2011-08-12 10:28:02 +0200 | [diff] [blame] | 292 | |
| 293 | static inline int prcmu_set_arm_opp(u8 opp) |
| 294 | { |
Linus Walleij | dece370 | 2012-04-13 14:01:39 +0200 | [diff] [blame] | 295 | return db8500_prcmu_set_arm_opp(opp); |
Mattias Nilsson | fea799e | 2011-08-12 10:28:02 +0200 | [diff] [blame] | 296 | } |
| 297 | |
| 298 | static inline int prcmu_get_arm_opp(void) |
| 299 | { |
Linus Walleij | dece370 | 2012-04-13 14:01:39 +0200 | [diff] [blame] | 300 | return db8500_prcmu_get_arm_opp(); |
Mattias Nilsson | fea799e | 2011-08-12 10:28:02 +0200 | [diff] [blame] | 301 | } |
| 302 | |
Mattias Nilsson | 0508901 | 2012-01-13 16:20:20 +0100 | [diff] [blame] | 303 | static inline int prcmu_set_ape_opp(u8 opp) |
| 304 | { |
Linus Walleij | dece370 | 2012-04-13 14:01:39 +0200 | [diff] [blame] | 305 | return db8500_prcmu_set_ape_opp(opp); |
Mattias Nilsson | 0508901 | 2012-01-13 16:20:20 +0100 | [diff] [blame] | 306 | } |
| 307 | |
| 308 | static inline int prcmu_get_ape_opp(void) |
| 309 | { |
Linus Walleij | dece370 | 2012-04-13 14:01:39 +0200 | [diff] [blame] | 310 | return db8500_prcmu_get_ape_opp(); |
Mattias Nilsson | 0508901 | 2012-01-13 16:20:20 +0100 | [diff] [blame] | 311 | } |
| 312 | |
Ulf Hansson | 686f871 | 2012-09-24 16:43:17 +0200 | [diff] [blame] | 313 | static inline int prcmu_request_ape_opp_100_voltage(bool enable) |
| 314 | { |
| 315 | return db8500_prcmu_request_ape_opp_100_voltage(enable); |
| 316 | } |
| 317 | |
Mattias Nilsson | fea799e | 2011-08-12 10:28:02 +0200 | [diff] [blame] | 318 | static inline void prcmu_system_reset(u16 reset_code) |
| 319 | { |
Linus Walleij | dece370 | 2012-04-13 14:01:39 +0200 | [diff] [blame] | 320 | return db8500_prcmu_system_reset(reset_code); |
Mattias Nilsson | fea799e | 2011-08-12 10:28:02 +0200 | [diff] [blame] | 321 | } |
| 322 | |
| 323 | static inline u16 prcmu_get_reset_code(void) |
| 324 | { |
Linus Walleij | dece370 | 2012-04-13 14:01:39 +0200 | [diff] [blame] | 325 | return db8500_prcmu_get_reset_code(); |
Mattias Nilsson | fea799e | 2011-08-12 10:28:02 +0200 | [diff] [blame] | 326 | } |
| 327 | |
Arun Murthy | 5261e10 | 2012-05-21 14:28:21 +0530 | [diff] [blame] | 328 | int prcmu_ac_wake_req(void); |
Mattias Nilsson | fea799e | 2011-08-12 10:28:02 +0200 | [diff] [blame] | 329 | void prcmu_ac_sleep_req(void); |
Mattias Nilsson | 0508901 | 2012-01-13 16:20:20 +0100 | [diff] [blame] | 330 | static inline void prcmu_modem_reset(void) |
| 331 | { |
Linus Walleij | dece370 | 2012-04-13 14:01:39 +0200 | [diff] [blame] | 332 | return db8500_prcmu_modem_reset(); |
Mattias Nilsson | 0508901 | 2012-01-13 16:20:20 +0100 | [diff] [blame] | 333 | } |
| 334 | |
Mattias Nilsson | fea799e | 2011-08-12 10:28:02 +0200 | [diff] [blame] | 335 | static inline bool prcmu_is_ac_wake_requested(void) |
| 336 | { |
Linus Walleij | dece370 | 2012-04-13 14:01:39 +0200 | [diff] [blame] | 337 | return db8500_prcmu_is_ac_wake_requested(); |
Mattias Nilsson | fea799e | 2011-08-12 10:28:02 +0200 | [diff] [blame] | 338 | } |
| 339 | |
| 340 | static inline int prcmu_set_display_clocks(void) |
| 341 | { |
Linus Walleij | dece370 | 2012-04-13 14:01:39 +0200 | [diff] [blame] | 342 | return db8500_prcmu_set_display_clocks(); |
Mattias Nilsson | fea799e | 2011-08-12 10:28:02 +0200 | [diff] [blame] | 343 | } |
| 344 | |
| 345 | static inline int prcmu_disable_dsipll(void) |
| 346 | { |
Linus Walleij | dece370 | 2012-04-13 14:01:39 +0200 | [diff] [blame] | 347 | return db8500_prcmu_disable_dsipll(); |
Mattias Nilsson | fea799e | 2011-08-12 10:28:02 +0200 | [diff] [blame] | 348 | } |
| 349 | |
| 350 | static inline int prcmu_enable_dsipll(void) |
| 351 | { |
Linus Walleij | dece370 | 2012-04-13 14:01:39 +0200 | [diff] [blame] | 352 | return db8500_prcmu_enable_dsipll(); |
Mattias Nilsson | fea799e | 2011-08-12 10:28:02 +0200 | [diff] [blame] | 353 | } |
| 354 | |
| 355 | static inline int prcmu_config_esram0_deep_sleep(u8 state) |
| 356 | { |
Linus Walleij | dece370 | 2012-04-13 14:01:39 +0200 | [diff] [blame] | 357 | return db8500_prcmu_config_esram0_deep_sleep(state); |
Mattias Nilsson | fea799e | 2011-08-12 10:28:02 +0200 | [diff] [blame] | 358 | } |
Mattias Nilsson | 0508901 | 2012-01-13 16:20:20 +0100 | [diff] [blame] | 359 | |
| 360 | static inline int prcmu_config_hotdog(u8 threshold) |
| 361 | { |
Linus Walleij | dece370 | 2012-04-13 14:01:39 +0200 | [diff] [blame] | 362 | return db8500_prcmu_config_hotdog(threshold); |
Mattias Nilsson | 0508901 | 2012-01-13 16:20:20 +0100 | [diff] [blame] | 363 | } |
| 364 | |
| 365 | static inline int prcmu_config_hotmon(u8 low, u8 high) |
| 366 | { |
Linus Walleij | dece370 | 2012-04-13 14:01:39 +0200 | [diff] [blame] | 367 | return db8500_prcmu_config_hotmon(low, high); |
Mattias Nilsson | 0508901 | 2012-01-13 16:20:20 +0100 | [diff] [blame] | 368 | } |
| 369 | |
| 370 | static inline int prcmu_start_temp_sense(u16 cycles32k) |
| 371 | { |
Linus Walleij | dece370 | 2012-04-13 14:01:39 +0200 | [diff] [blame] | 372 | return db8500_prcmu_start_temp_sense(cycles32k); |
Mattias Nilsson | 0508901 | 2012-01-13 16:20:20 +0100 | [diff] [blame] | 373 | } |
| 374 | |
| 375 | static inline int prcmu_stop_temp_sense(void) |
| 376 | { |
Linus Walleij | dece370 | 2012-04-13 14:01:39 +0200 | [diff] [blame] | 377 | return db8500_prcmu_stop_temp_sense(); |
Mattias Nilsson | 0508901 | 2012-01-13 16:20:20 +0100 | [diff] [blame] | 378 | } |
| 379 | |
Mattias Nilsson | b4a6dbd | 2012-01-13 16:21:00 +0100 | [diff] [blame] | 380 | static inline u32 prcmu_read(unsigned int reg) |
| 381 | { |
Linus Walleij | dece370 | 2012-04-13 14:01:39 +0200 | [diff] [blame] | 382 | return db8500_prcmu_read(reg); |
Mattias Nilsson | b4a6dbd | 2012-01-13 16:21:00 +0100 | [diff] [blame] | 383 | } |
| 384 | |
| 385 | static inline void prcmu_write(unsigned int reg, u32 value) |
| 386 | { |
Linus Walleij | dece370 | 2012-04-13 14:01:39 +0200 | [diff] [blame] | 387 | db8500_prcmu_write(reg, value); |
Mattias Nilsson | b4a6dbd | 2012-01-13 16:21:00 +0100 | [diff] [blame] | 388 | } |
| 389 | |
| 390 | static inline void prcmu_write_masked(unsigned int reg, u32 mask, u32 value) |
| 391 | { |
Linus Walleij | dece370 | 2012-04-13 14:01:39 +0200 | [diff] [blame] | 392 | db8500_prcmu_write_masked(reg, mask, value); |
Mattias Nilsson | b4a6dbd | 2012-01-13 16:21:00 +0100 | [diff] [blame] | 393 | } |
| 394 | |
Mattias Nilsson | 0508901 | 2012-01-13 16:20:20 +0100 | [diff] [blame] | 395 | static inline int prcmu_enable_a9wdog(u8 id) |
| 396 | { |
Linus Walleij | dece370 | 2012-04-13 14:01:39 +0200 | [diff] [blame] | 397 | return db8500_prcmu_enable_a9wdog(id); |
Mattias Nilsson | 0508901 | 2012-01-13 16:20:20 +0100 | [diff] [blame] | 398 | } |
| 399 | |
| 400 | static inline int prcmu_disable_a9wdog(u8 id) |
| 401 | { |
Linus Walleij | dece370 | 2012-04-13 14:01:39 +0200 | [diff] [blame] | 402 | return db8500_prcmu_disable_a9wdog(id); |
Mattias Nilsson | 0508901 | 2012-01-13 16:20:20 +0100 | [diff] [blame] | 403 | } |
| 404 | |
| 405 | static inline int prcmu_kick_a9wdog(u8 id) |
| 406 | { |
Linus Walleij | dece370 | 2012-04-13 14:01:39 +0200 | [diff] [blame] | 407 | return db8500_prcmu_kick_a9wdog(id); |
Mattias Nilsson | 0508901 | 2012-01-13 16:20:20 +0100 | [diff] [blame] | 408 | } |
| 409 | |
| 410 | static inline int prcmu_load_a9wdog(u8 id, u32 timeout) |
| 411 | { |
Linus Walleij | dece370 | 2012-04-13 14:01:39 +0200 | [diff] [blame] | 412 | return db8500_prcmu_load_a9wdog(id, timeout); |
Mattias Nilsson | 0508901 | 2012-01-13 16:20:20 +0100 | [diff] [blame] | 413 | } |
| 414 | |
| 415 | static inline int prcmu_config_a9wdog(u8 num, bool sleep_auto_off) |
| 416 | { |
Linus Walleij | dece370 | 2012-04-13 14:01:39 +0200 | [diff] [blame] | 417 | return db8500_prcmu_config_a9wdog(num, sleep_auto_off); |
Mattias Nilsson | 0508901 | 2012-01-13 16:20:20 +0100 | [diff] [blame] | 418 | } |
Mattias Nilsson | fea799e | 2011-08-12 10:28:02 +0200 | [diff] [blame] | 419 | #else |
| 420 | |
Linus Walleij | 9a47a8d | 2013-03-21 12:27:25 +0100 | [diff] [blame] | 421 | static inline void prcmu_early_init(u32 phy_base, u32 size) {} |
Mattias Nilsson | fea799e | 2011-08-12 10:28:02 +0200 | [diff] [blame] | 422 | |
| 423 | static inline int prcmu_set_power_state(u8 state, bool keep_ulp_clk, |
| 424 | bool keep_ap_pll) |
| 425 | { |
| 426 | return 0; |
| 427 | } |
| 428 | |
| 429 | static inline int prcmu_set_epod(u16 epod_id, u8 epod_state) |
| 430 | { |
| 431 | return 0; |
| 432 | } |
| 433 | |
| 434 | static inline void prcmu_enable_wakeups(u32 wakeups) {} |
| 435 | |
| 436 | static inline void prcmu_disable_wakeups(void) {} |
| 437 | |
| 438 | static inline int prcmu_abb_read(u8 slave, u8 reg, u8 *value, u8 size) |
| 439 | { |
| 440 | return -ENOSYS; |
| 441 | } |
| 442 | |
| 443 | static inline int prcmu_abb_write(u8 slave, u8 reg, u8 *value, u8 size) |
| 444 | { |
| 445 | return -ENOSYS; |
| 446 | } |
| 447 | |
Mattias Nilsson | 3c3e489 | 2012-03-08 14:02:05 +0100 | [diff] [blame] | 448 | static inline int prcmu_abb_write_masked(u8 slave, u8 reg, u8 *value, u8 *mask, |
| 449 | u8 size) |
| 450 | { |
| 451 | return -ENOSYS; |
| 452 | } |
| 453 | |
Mattias Nilsson | fea799e | 2011-08-12 10:28:02 +0200 | [diff] [blame] | 454 | static inline int prcmu_config_clkout(u8 clkout, u8 source, u8 div) |
| 455 | { |
| 456 | return 0; |
| 457 | } |
| 458 | |
| 459 | static inline int prcmu_request_clock(u8 clock, bool enable) |
| 460 | { |
| 461 | return 0; |
| 462 | } |
| 463 | |
Mattias Nilsson | 6b6fae2 | 2012-01-13 16:20:28 +0100 | [diff] [blame] | 464 | static inline long prcmu_round_clock_rate(u8 clock, unsigned long rate) |
| 465 | { |
| 466 | return 0; |
| 467 | } |
| 468 | |
| 469 | static inline int prcmu_set_clock_rate(u8 clock, unsigned long rate) |
| 470 | { |
| 471 | return 0; |
| 472 | } |
| 473 | |
| 474 | static inline unsigned long prcmu_clock_rate(u8 clock) |
| 475 | { |
| 476 | return 0; |
| 477 | } |
| 478 | |
Mattias Nilsson | fea799e | 2011-08-12 10:28:02 +0200 | [diff] [blame] | 479 | static inline int prcmu_set_ape_opp(u8 opp) |
| 480 | { |
| 481 | return 0; |
| 482 | } |
| 483 | |
| 484 | static inline int prcmu_get_ape_opp(void) |
| 485 | { |
| 486 | return APE_100_OPP; |
| 487 | } |
| 488 | |
Ulf Hansson | 686f871 | 2012-09-24 16:43:17 +0200 | [diff] [blame] | 489 | static inline int prcmu_request_ape_opp_100_voltage(bool enable) |
| 490 | { |
| 491 | return 0; |
| 492 | } |
| 493 | |
Mattias Nilsson | fea799e | 2011-08-12 10:28:02 +0200 | [diff] [blame] | 494 | static inline int prcmu_set_arm_opp(u8 opp) |
| 495 | { |
| 496 | return 0; |
| 497 | } |
| 498 | |
| 499 | static inline int prcmu_get_arm_opp(void) |
| 500 | { |
| 501 | return ARM_100_OPP; |
| 502 | } |
| 503 | |
| 504 | static inline int prcmu_set_ddr_opp(u8 opp) |
| 505 | { |
| 506 | return 0; |
| 507 | } |
| 508 | |
| 509 | static inline int prcmu_get_ddr_opp(void) |
| 510 | { |
| 511 | return DDR_100_OPP; |
| 512 | } |
| 513 | |
| 514 | static inline void prcmu_system_reset(u16 reset_code) {} |
| 515 | |
| 516 | static inline u16 prcmu_get_reset_code(void) |
| 517 | { |
| 518 | return 0; |
| 519 | } |
| 520 | |
Arun Murthy | 5261e10 | 2012-05-21 14:28:21 +0530 | [diff] [blame] | 521 | static inline int prcmu_ac_wake_req(void) |
| 522 | { |
| 523 | return 0; |
| 524 | } |
Mattias Nilsson | fea799e | 2011-08-12 10:28:02 +0200 | [diff] [blame] | 525 | |
| 526 | static inline void prcmu_ac_sleep_req(void) {} |
| 527 | |
| 528 | static inline void prcmu_modem_reset(void) {} |
| 529 | |
| 530 | static inline bool prcmu_is_ac_wake_requested(void) |
| 531 | { |
| 532 | return false; |
| 533 | } |
| 534 | |
| 535 | static inline int prcmu_set_display_clocks(void) |
| 536 | { |
| 537 | return 0; |
| 538 | } |
| 539 | |
| 540 | static inline int prcmu_disable_dsipll(void) |
| 541 | { |
| 542 | return 0; |
| 543 | } |
| 544 | |
| 545 | static inline int prcmu_enable_dsipll(void) |
| 546 | { |
| 547 | return 0; |
| 548 | } |
| 549 | |
| 550 | static inline int prcmu_config_esram0_deep_sleep(u8 state) |
| 551 | { |
| 552 | return 0; |
| 553 | } |
| 554 | |
| 555 | static inline void prcmu_config_abb_event_readout(u32 abb_events) {} |
| 556 | |
| 557 | static inline void prcmu_get_abb_event_buffer(void __iomem **buf) |
| 558 | { |
| 559 | *buf = NULL; |
| 560 | } |
| 561 | |
Mattias Nilsson | 0508901 | 2012-01-13 16:20:20 +0100 | [diff] [blame] | 562 | static inline int prcmu_config_hotdog(u8 threshold) |
| 563 | { |
| 564 | return 0; |
| 565 | } |
| 566 | |
| 567 | static inline int prcmu_config_hotmon(u8 low, u8 high) |
| 568 | { |
| 569 | return 0; |
| 570 | } |
| 571 | |
| 572 | static inline int prcmu_start_temp_sense(u16 cycles32k) |
| 573 | { |
| 574 | return 0; |
| 575 | } |
| 576 | |
| 577 | static inline int prcmu_stop_temp_sense(void) |
| 578 | { |
| 579 | return 0; |
| 580 | } |
| 581 | |
Mattias Nilsson | b4a6dbd | 2012-01-13 16:21:00 +0100 | [diff] [blame] | 582 | static inline u32 prcmu_read(unsigned int reg) |
| 583 | { |
| 584 | return 0; |
| 585 | } |
| 586 | |
| 587 | static inline void prcmu_write(unsigned int reg, u32 value) {} |
| 588 | |
| 589 | static inline void prcmu_write_masked(unsigned int reg, u32 mask, u32 value) {} |
| 590 | |
| 591 | #endif |
| 592 | |
| 593 | static inline void prcmu_set(unsigned int reg, u32 bits) |
| 594 | { |
| 595 | prcmu_write_masked(reg, bits, bits); |
| 596 | } |
| 597 | |
| 598 | static inline void prcmu_clear(unsigned int reg, u32 bits) |
| 599 | { |
| 600 | prcmu_write_masked(reg, bits, 0); |
| 601 | } |
| 602 | |
Mattias Nilsson | fea799e | 2011-08-12 10:28:02 +0200 | [diff] [blame] | 603 | /* PRCMU QoS APE OPP class */ |
| 604 | #define PRCMU_QOS_APE_OPP 1 |
| 605 | #define PRCMU_QOS_DDR_OPP 2 |
Mattias Nilsson | 4d64d2e | 2012-01-13 16:20:43 +0100 | [diff] [blame] | 606 | #define PRCMU_QOS_ARM_OPP 3 |
Mattias Nilsson | fea799e | 2011-08-12 10:28:02 +0200 | [diff] [blame] | 607 | #define PRCMU_QOS_DEFAULT_VALUE -1 |
| 608 | |
Mattias Nilsson | 4d64d2e | 2012-01-13 16:20:43 +0100 | [diff] [blame] | 609 | #ifdef CONFIG_DBX500_PRCMU_QOS_POWER |
Mattias Nilsson | fea799e | 2011-08-12 10:28:02 +0200 | [diff] [blame] | 610 | |
| 611 | unsigned long prcmu_qos_get_cpufreq_opp_delay(void); |
| 612 | void prcmu_qos_set_cpufreq_opp_delay(unsigned long); |
| 613 | void prcmu_qos_force_opp(int, s32); |
| 614 | int prcmu_qos_requirement(int pm_qos_class); |
| 615 | int prcmu_qos_add_requirement(int pm_qos_class, char *name, s32 value); |
| 616 | int prcmu_qos_update_requirement(int pm_qos_class, char *name, s32 new_value); |
| 617 | void prcmu_qos_remove_requirement(int pm_qos_class, char *name); |
| 618 | int prcmu_qos_add_notifier(int prcmu_qos_class, |
| 619 | struct notifier_block *notifier); |
| 620 | int prcmu_qos_remove_notifier(int prcmu_qos_class, |
| 621 | struct notifier_block *notifier); |
| 622 | |
| 623 | #else |
| 624 | |
| 625 | static inline unsigned long prcmu_qos_get_cpufreq_opp_delay(void) |
| 626 | { |
| 627 | return 0; |
| 628 | } |
| 629 | |
| 630 | static inline void prcmu_qos_set_cpufreq_opp_delay(unsigned long n) {} |
| 631 | |
| 632 | static inline void prcmu_qos_force_opp(int prcmu_qos_class, s32 i) {} |
| 633 | |
| 634 | static inline int prcmu_qos_requirement(int prcmu_qos_class) |
| 635 | { |
| 636 | return 0; |
| 637 | } |
| 638 | |
| 639 | static inline int prcmu_qos_add_requirement(int prcmu_qos_class, |
| 640 | char *name, s32 value) |
| 641 | { |
| 642 | return 0; |
| 643 | } |
| 644 | |
| 645 | static inline int prcmu_qos_update_requirement(int prcmu_qos_class, |
| 646 | char *name, s32 new_value) |
| 647 | { |
| 648 | return 0; |
| 649 | } |
| 650 | |
| 651 | static inline void prcmu_qos_remove_requirement(int prcmu_qos_class, char *name) |
| 652 | { |
| 653 | } |
| 654 | |
| 655 | static inline int prcmu_qos_add_notifier(int prcmu_qos_class, |
| 656 | struct notifier_block *notifier) |
| 657 | { |
| 658 | return 0; |
| 659 | } |
| 660 | static inline int prcmu_qos_remove_notifier(int prcmu_qos_class, |
| 661 | struct notifier_block *notifier) |
| 662 | { |
| 663 | return 0; |
| 664 | } |
| 665 | |
| 666 | #endif |
| 667 | |
| 668 | #endif /* __MACH_PRCMU_H */ |