dbx500-prcmu.h 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884
  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. #include <linux/interrupt.h>
  11. #include <linux/notifier.h>
  12. #include <linux/err.h>
  13. /* PRCMU Wakeup defines */
  14. enum prcmu_wakeup_index {
  15. PRCMU_WAKEUP_INDEX_RTC,
  16. PRCMU_WAKEUP_INDEX_RTT0,
  17. PRCMU_WAKEUP_INDEX_RTT1,
  18. PRCMU_WAKEUP_INDEX_HSI0,
  19. PRCMU_WAKEUP_INDEX_HSI1,
  20. PRCMU_WAKEUP_INDEX_USB,
  21. PRCMU_WAKEUP_INDEX_ABB,
  22. PRCMU_WAKEUP_INDEX_ABB_FIFO,
  23. PRCMU_WAKEUP_INDEX_ARM,
  24. PRCMU_WAKEUP_INDEX_CD_IRQ,
  25. NUM_PRCMU_WAKEUP_INDICES
  26. };
  27. #define PRCMU_WAKEUP(_name) (BIT(PRCMU_WAKEUP_INDEX_##_name))
  28. /* EPOD (power domain) IDs */
  29. /*
  30. * DB8500 EPODs
  31. * - EPOD_ID_SVAMMDSP: power domain for SVA MMDSP
  32. * - EPOD_ID_SVAPIPE: power domain for SVA pipe
  33. * - EPOD_ID_SIAMMDSP: power domain for SIA MMDSP
  34. * - EPOD_ID_SIAPIPE: power domain for SIA pipe
  35. * - EPOD_ID_SGA: power domain for SGA
  36. * - EPOD_ID_B2R2_MCDE: power domain for B2R2 and MCDE
  37. * - EPOD_ID_ESRAM12: power domain for ESRAM 1 and 2
  38. * - EPOD_ID_ESRAM34: power domain for ESRAM 3 and 4
  39. * - NUM_EPOD_ID: number of power domains
  40. *
  41. * TODO: These should be prefixed.
  42. */
  43. #define EPOD_ID_SVAMMDSP 0
  44. #define EPOD_ID_SVAPIPE 1
  45. #define EPOD_ID_SIAMMDSP 2
  46. #define EPOD_ID_SIAPIPE 3
  47. #define EPOD_ID_SGA 4
  48. #define EPOD_ID_B2R2_MCDE 5
  49. #define EPOD_ID_ESRAM12 6
  50. #define EPOD_ID_ESRAM34 7
  51. #define NUM_EPOD_ID 8
  52. /*
  53. * DB5500 EPODs
  54. */
  55. #define DB5500_EPOD_ID_BASE 0x0100
  56. #define DB5500_EPOD_ID_SGA (DB5500_EPOD_ID_BASE + 0)
  57. #define DB5500_EPOD_ID_HVA (DB5500_EPOD_ID_BASE + 1)
  58. #define DB5500_EPOD_ID_SIA (DB5500_EPOD_ID_BASE + 2)
  59. #define DB5500_EPOD_ID_DISP (DB5500_EPOD_ID_BASE + 3)
  60. #define DB5500_EPOD_ID_ESRAM12 (DB5500_EPOD_ID_BASE + 6)
  61. #define DB5500_NUM_EPOD_ID 7
  62. /*
  63. * state definition for EPOD (power domain)
  64. * - EPOD_STATE_NO_CHANGE: The EPOD should remain unchanged
  65. * - EPOD_STATE_OFF: The EPOD is switched off
  66. * - EPOD_STATE_RAMRET: The EPOD is switched off with its internal RAM in
  67. * retention
  68. * - EPOD_STATE_ON_CLK_OFF: The EPOD is switched on, clock is still off
  69. * - EPOD_STATE_ON: Same as above, but with clock enabled
  70. */
  71. #define EPOD_STATE_NO_CHANGE 0x00
  72. #define EPOD_STATE_OFF 0x01
  73. #define EPOD_STATE_RAMRET 0x02
  74. #define EPOD_STATE_ON_CLK_OFF 0x03
  75. #define EPOD_STATE_ON 0x04
  76. /* DB5500 CLKOUT IDs */
  77. enum {
  78. DB5500_CLKOUT0 = 0,
  79. DB5500_CLKOUT1,
  80. };
  81. /* DB5500 CLKOUTx sources */
  82. enum {
  83. DB5500_CLKOUT_REF_CLK_SEL0,
  84. DB5500_CLKOUT_RTC_CLK0_SEL0,
  85. DB5500_CLKOUT_ULP_CLK_SEL0,
  86. DB5500_CLKOUT_STATIC0,
  87. DB5500_CLKOUT_REFCLK,
  88. DB5500_CLKOUT_ULPCLK,
  89. DB5500_CLKOUT_ARMCLK,
  90. DB5500_CLKOUT_SYSACC0CLK,
  91. DB5500_CLKOUT_SOC0PLLCLK,
  92. DB5500_CLKOUT_SOC1PLLCLK,
  93. DB5500_CLKOUT_DDRPLLCLK,
  94. DB5500_CLKOUT_TVCLK,
  95. DB5500_CLKOUT_IRDACLK,
  96. };
  97. /*
  98. * CLKOUT sources
  99. */
  100. #define PRCMU_CLKSRC_CLK38M 0x00
  101. #define PRCMU_CLKSRC_ACLK 0x01
  102. #define PRCMU_CLKSRC_SYSCLK 0x02
  103. #define PRCMU_CLKSRC_LCDCLK 0x03
  104. #define PRCMU_CLKSRC_SDMMCCLK 0x04
  105. #define PRCMU_CLKSRC_TVCLK 0x05
  106. #define PRCMU_CLKSRC_TIMCLK 0x06
  107. #define PRCMU_CLKSRC_CLK009 0x07
  108. /* These are only valid for CLKOUT1: */
  109. #define PRCMU_CLKSRC_SIAMMDSPCLK 0x40
  110. #define PRCMU_CLKSRC_I2CCLK 0x41
  111. #define PRCMU_CLKSRC_MSP02CLK 0x42
  112. #define PRCMU_CLKSRC_ARMPLL_OBSCLK 0x43
  113. #define PRCMU_CLKSRC_HSIRXCLK 0x44
  114. #define PRCMU_CLKSRC_HSITXCLK 0x45
  115. #define PRCMU_CLKSRC_ARMCLKFIX 0x46
  116. #define PRCMU_CLKSRC_HDMICLK 0x47
  117. /*
  118. * Clock identifiers.
  119. */
  120. enum prcmu_clock {
  121. PRCMU_SGACLK,
  122. PRCMU_UARTCLK,
  123. PRCMU_MSP02CLK,
  124. PRCMU_MSP1CLK,
  125. PRCMU_I2CCLK,
  126. PRCMU_SDMMCCLK,
  127. PRCMU_SPARE1CLK,
  128. PRCMU_SLIMCLK,
  129. PRCMU_PER1CLK,
  130. PRCMU_PER2CLK,
  131. PRCMU_PER3CLK,
  132. PRCMU_PER5CLK,
  133. PRCMU_PER6CLK,
  134. PRCMU_PER7CLK,
  135. PRCMU_LCDCLK,
  136. PRCMU_BMLCLK,
  137. PRCMU_HSITXCLK,
  138. PRCMU_HSIRXCLK,
  139. PRCMU_HDMICLK,
  140. PRCMU_APEATCLK,
  141. PRCMU_APETRACECLK,
  142. PRCMU_MCDECLK,
  143. PRCMU_IPI2CCLK,
  144. PRCMU_DSIALTCLK,
  145. PRCMU_DMACLK,
  146. PRCMU_B2R2CLK,
  147. PRCMU_TVCLK,
  148. PRCMU_SSPCLK,
  149. PRCMU_RNGCLK,
  150. PRCMU_UICCCLK,
  151. PRCMU_PWMCLK,
  152. PRCMU_IRDACLK,
  153. PRCMU_IRRCCLK,
  154. PRCMU_SIACLK,
  155. PRCMU_SVACLK,
  156. PRCMU_ACLK,
  157. PRCMU_NUM_REG_CLOCKS,
  158. PRCMU_SYSCLK = PRCMU_NUM_REG_CLOCKS,
  159. PRCMU_CDCLK,
  160. PRCMU_TIMCLK,
  161. PRCMU_PLLSOC0,
  162. PRCMU_PLLSOC1,
  163. PRCMU_PLLDDR,
  164. PRCMU_PLLDSI,
  165. PRCMU_DSI0CLK,
  166. PRCMU_DSI1CLK,
  167. PRCMU_DSI0ESCCLK,
  168. PRCMU_DSI1ESCCLK,
  169. PRCMU_DSI2ESCCLK,
  170. };
  171. /**
  172. * enum ape_opp - APE OPP states definition
  173. * @APE_OPP_INIT:
  174. * @APE_NO_CHANGE: The APE operating point is unchanged
  175. * @APE_100_OPP: The new APE operating point is ape100opp
  176. * @APE_50_OPP: 50%
  177. * @APE_50_PARTLY_25_OPP: 50%, except some clocks at 25%.
  178. */
  179. enum ape_opp {
  180. APE_OPP_INIT = 0x00,
  181. APE_NO_CHANGE = 0x01,
  182. APE_100_OPP = 0x02,
  183. APE_50_OPP = 0x03,
  184. APE_50_PARTLY_25_OPP = 0xFF,
  185. };
  186. /**
  187. * enum arm_opp - ARM OPP states definition
  188. * @ARM_OPP_INIT:
  189. * @ARM_NO_CHANGE: The ARM operating point is unchanged
  190. * @ARM_100_OPP: The new ARM operating point is arm100opp
  191. * @ARM_50_OPP: The new ARM operating point is arm50opp
  192. * @ARM_MAX_OPP: Operating point is "max" (more than 100)
  193. * @ARM_MAX_FREQ100OPP: Set max opp if available, else 100
  194. * @ARM_EXTCLK: The new ARM operating point is armExtClk
  195. */
  196. enum arm_opp {
  197. ARM_OPP_INIT = 0x00,
  198. ARM_NO_CHANGE = 0x01,
  199. ARM_100_OPP = 0x02,
  200. ARM_50_OPP = 0x03,
  201. ARM_MAX_OPP = 0x04,
  202. ARM_MAX_FREQ100OPP = 0x05,
  203. ARM_EXTCLK = 0x07
  204. };
  205. /**
  206. * enum ddr_opp - DDR OPP states definition
  207. * @DDR_100_OPP: The new DDR operating point is ddr100opp
  208. * @DDR_50_OPP: The new DDR operating point is ddr50opp
  209. * @DDR_25_OPP: The new DDR operating point is ddr25opp
  210. */
  211. enum ddr_opp {
  212. DDR_100_OPP = 0x00,
  213. DDR_50_OPP = 0x01,
  214. DDR_25_OPP = 0x02,
  215. };
  216. /*
  217. * Definitions for controlling ESRAM0 in deep sleep.
  218. */
  219. #define ESRAM0_DEEP_SLEEP_STATE_OFF 1
  220. #define ESRAM0_DEEP_SLEEP_STATE_RET 2
  221. /**
  222. * enum ddr_pwrst - DDR power states definition
  223. * @DDR_PWR_STATE_UNCHANGED: SDRAM and DDR controller state is unchanged
  224. * @DDR_PWR_STATE_ON:
  225. * @DDR_PWR_STATE_OFFLOWLAT:
  226. * @DDR_PWR_STATE_OFFHIGHLAT:
  227. */
  228. enum ddr_pwrst {
  229. DDR_PWR_STATE_UNCHANGED = 0x00,
  230. DDR_PWR_STATE_ON = 0x01,
  231. DDR_PWR_STATE_OFFLOWLAT = 0x02,
  232. DDR_PWR_STATE_OFFHIGHLAT = 0x03
  233. };
  234. #include <linux/mfd/db8500-prcmu.h>
  235. #include <linux/mfd/db5500-prcmu.h>
  236. #if defined(CONFIG_UX500_SOC_DB8500) || defined(CONFIG_UX500_SOC_DB5500)
  237. #include <mach/id.h>
  238. static inline void __init prcmu_early_init(void)
  239. {
  240. if (cpu_is_u5500())
  241. return db5500_prcmu_early_init();
  242. else
  243. return db8500_prcmu_early_init();
  244. }
  245. static inline int prcmu_set_power_state(u8 state, bool keep_ulp_clk,
  246. bool keep_ap_pll)
  247. {
  248. if (cpu_is_u5500())
  249. return db5500_prcmu_set_power_state(state, keep_ulp_clk,
  250. keep_ap_pll);
  251. else
  252. return db8500_prcmu_set_power_state(state, keep_ulp_clk,
  253. keep_ap_pll);
  254. }
  255. static inline u8 prcmu_get_power_state_result(void)
  256. {
  257. if (cpu_is_u5500())
  258. return -EINVAL;
  259. else
  260. return db8500_prcmu_get_power_state_result();
  261. }
  262. static inline int prcmu_gic_decouple(void)
  263. {
  264. if (cpu_is_u5500())
  265. return -EINVAL;
  266. else
  267. return db8500_prcmu_gic_decouple();
  268. }
  269. static inline int prcmu_gic_recouple(void)
  270. {
  271. if (cpu_is_u5500())
  272. return -EINVAL;
  273. else
  274. return db8500_prcmu_gic_recouple();
  275. }
  276. static inline bool prcmu_gic_pending_irq(void)
  277. {
  278. if (cpu_is_u5500())
  279. return -EINVAL;
  280. else
  281. return db8500_prcmu_gic_pending_irq();
  282. }
  283. static inline int prcmu_set_epod(u16 epod_id, u8 epod_state)
  284. {
  285. if (cpu_is_u5500())
  286. return -EINVAL;
  287. else
  288. return db8500_prcmu_set_epod(epod_id, epod_state);
  289. }
  290. static inline void prcmu_enable_wakeups(u32 wakeups)
  291. {
  292. if (cpu_is_u5500())
  293. db5500_prcmu_enable_wakeups(wakeups);
  294. else
  295. db8500_prcmu_enable_wakeups(wakeups);
  296. }
  297. static inline void prcmu_disable_wakeups(void)
  298. {
  299. prcmu_enable_wakeups(0);
  300. }
  301. static inline void prcmu_config_abb_event_readout(u32 abb_events)
  302. {
  303. if (cpu_is_u5500())
  304. db5500_prcmu_config_abb_event_readout(abb_events);
  305. else
  306. db8500_prcmu_config_abb_event_readout(abb_events);
  307. }
  308. static inline void prcmu_get_abb_event_buffer(void __iomem **buf)
  309. {
  310. if (cpu_is_u5500())
  311. db5500_prcmu_get_abb_event_buffer(buf);
  312. else
  313. db8500_prcmu_get_abb_event_buffer(buf);
  314. }
  315. int prcmu_abb_read(u8 slave, u8 reg, u8 *value, u8 size);
  316. int prcmu_abb_write(u8 slave, u8 reg, u8 *value, u8 size);
  317. int prcmu_config_clkout(u8 clkout, u8 source, u8 div);
  318. static inline int prcmu_request_clock(u8 clock, bool enable)
  319. {
  320. if (cpu_is_u5500())
  321. return db5500_prcmu_request_clock(clock, enable);
  322. else
  323. return db8500_prcmu_request_clock(clock, enable);
  324. }
  325. unsigned long prcmu_clock_rate(u8 clock);
  326. long prcmu_round_clock_rate(u8 clock, unsigned long rate);
  327. int prcmu_set_clock_rate(u8 clock, unsigned long rate);
  328. static inline int prcmu_set_ddr_opp(u8 opp)
  329. {
  330. if (cpu_is_u5500())
  331. return -EINVAL;
  332. else
  333. return db8500_prcmu_set_ddr_opp(opp);
  334. }
  335. static inline int prcmu_get_ddr_opp(void)
  336. {
  337. if (cpu_is_u5500())
  338. return -EINVAL;
  339. else
  340. return db8500_prcmu_get_ddr_opp();
  341. }
  342. static inline int prcmu_set_arm_opp(u8 opp)
  343. {
  344. if (cpu_is_u5500())
  345. return -EINVAL;
  346. else
  347. return db8500_prcmu_set_arm_opp(opp);
  348. }
  349. static inline int prcmu_get_arm_opp(void)
  350. {
  351. if (cpu_is_u5500())
  352. return -EINVAL;
  353. else
  354. return db8500_prcmu_get_arm_opp();
  355. }
  356. static inline int prcmu_set_ape_opp(u8 opp)
  357. {
  358. if (cpu_is_u5500())
  359. return -EINVAL;
  360. else
  361. return db8500_prcmu_set_ape_opp(opp);
  362. }
  363. static inline int prcmu_get_ape_opp(void)
  364. {
  365. if (cpu_is_u5500())
  366. return -EINVAL;
  367. else
  368. return db8500_prcmu_get_ape_opp();
  369. }
  370. static inline void prcmu_system_reset(u16 reset_code)
  371. {
  372. if (cpu_is_u5500())
  373. return db5500_prcmu_system_reset(reset_code);
  374. else
  375. return db8500_prcmu_system_reset(reset_code);
  376. }
  377. static inline u16 prcmu_get_reset_code(void)
  378. {
  379. if (cpu_is_u5500())
  380. return db5500_prcmu_get_reset_code();
  381. else
  382. return db8500_prcmu_get_reset_code();
  383. }
  384. void prcmu_ac_wake_req(void);
  385. void prcmu_ac_sleep_req(void);
  386. static inline void prcmu_modem_reset(void)
  387. {
  388. if (cpu_is_u5500())
  389. return;
  390. else
  391. return db8500_prcmu_modem_reset();
  392. }
  393. static inline bool prcmu_is_ac_wake_requested(void)
  394. {
  395. if (cpu_is_u5500())
  396. return db5500_prcmu_is_ac_wake_requested();
  397. else
  398. return db8500_prcmu_is_ac_wake_requested();
  399. }
  400. static inline int prcmu_set_display_clocks(void)
  401. {
  402. if (cpu_is_u5500())
  403. return db5500_prcmu_set_display_clocks();
  404. else
  405. return db8500_prcmu_set_display_clocks();
  406. }
  407. static inline int prcmu_disable_dsipll(void)
  408. {
  409. if (cpu_is_u5500())
  410. return db5500_prcmu_disable_dsipll();
  411. else
  412. return db8500_prcmu_disable_dsipll();
  413. }
  414. static inline int prcmu_enable_dsipll(void)
  415. {
  416. if (cpu_is_u5500())
  417. return db5500_prcmu_enable_dsipll();
  418. else
  419. return db8500_prcmu_enable_dsipll();
  420. }
  421. static inline int prcmu_config_esram0_deep_sleep(u8 state)
  422. {
  423. if (cpu_is_u5500())
  424. return -EINVAL;
  425. else
  426. return db8500_prcmu_config_esram0_deep_sleep(state);
  427. }
  428. static inline int prcmu_config_hotdog(u8 threshold)
  429. {
  430. if (cpu_is_u5500())
  431. return -EINVAL;
  432. else
  433. return db8500_prcmu_config_hotdog(threshold);
  434. }
  435. static inline int prcmu_config_hotmon(u8 low, u8 high)
  436. {
  437. if (cpu_is_u5500())
  438. return -EINVAL;
  439. else
  440. return db8500_prcmu_config_hotmon(low, high);
  441. }
  442. static inline int prcmu_start_temp_sense(u16 cycles32k)
  443. {
  444. if (cpu_is_u5500())
  445. return -EINVAL;
  446. else
  447. return db8500_prcmu_start_temp_sense(cycles32k);
  448. }
  449. static inline int prcmu_stop_temp_sense(void)
  450. {
  451. if (cpu_is_u5500())
  452. return -EINVAL;
  453. else
  454. return db8500_prcmu_stop_temp_sense();
  455. }
  456. static inline u32 prcmu_read(unsigned int reg)
  457. {
  458. if (cpu_is_u5500())
  459. return -EINVAL;
  460. else
  461. return db8500_prcmu_read(reg);
  462. }
  463. static inline void prcmu_write(unsigned int reg, u32 value)
  464. {
  465. if (cpu_is_u5500())
  466. return;
  467. else
  468. db8500_prcmu_write(reg, value);
  469. }
  470. static inline void prcmu_write_masked(unsigned int reg, u32 mask, u32 value)
  471. {
  472. if (cpu_is_u5500())
  473. return;
  474. else
  475. db8500_prcmu_write_masked(reg, mask, value);
  476. }
  477. static inline int prcmu_enable_a9wdog(u8 id)
  478. {
  479. if (cpu_is_u5500())
  480. return -EINVAL;
  481. else
  482. return db8500_prcmu_enable_a9wdog(id);
  483. }
  484. static inline int prcmu_disable_a9wdog(u8 id)
  485. {
  486. if (cpu_is_u5500())
  487. return -EINVAL;
  488. else
  489. return db8500_prcmu_disable_a9wdog(id);
  490. }
  491. static inline int prcmu_kick_a9wdog(u8 id)
  492. {
  493. if (cpu_is_u5500())
  494. return -EINVAL;
  495. else
  496. return db8500_prcmu_kick_a9wdog(id);
  497. }
  498. static inline int prcmu_load_a9wdog(u8 id, u32 timeout)
  499. {
  500. if (cpu_is_u5500())
  501. return -EINVAL;
  502. else
  503. return db8500_prcmu_load_a9wdog(id, timeout);
  504. }
  505. static inline int prcmu_config_a9wdog(u8 num, bool sleep_auto_off)
  506. {
  507. if (cpu_is_u5500())
  508. return -EINVAL;
  509. else
  510. return db8500_prcmu_config_a9wdog(num, sleep_auto_off);
  511. }
  512. #else
  513. static inline void __init prcmu_early_init(void) {}
  514. static inline int prcmu_set_power_state(u8 state, bool keep_ulp_clk,
  515. bool keep_ap_pll)
  516. {
  517. return 0;
  518. }
  519. static inline int prcmu_set_epod(u16 epod_id, u8 epod_state)
  520. {
  521. return 0;
  522. }
  523. static inline void prcmu_enable_wakeups(u32 wakeups) {}
  524. static inline void prcmu_disable_wakeups(void) {}
  525. static inline int prcmu_abb_read(u8 slave, u8 reg, u8 *value, u8 size)
  526. {
  527. return -ENOSYS;
  528. }
  529. static inline int prcmu_abb_write(u8 slave, u8 reg, u8 *value, u8 size)
  530. {
  531. return -ENOSYS;
  532. }
  533. static inline int prcmu_config_clkout(u8 clkout, u8 source, u8 div)
  534. {
  535. return 0;
  536. }
  537. static inline int prcmu_request_clock(u8 clock, bool enable)
  538. {
  539. return 0;
  540. }
  541. static inline long prcmu_round_clock_rate(u8 clock, unsigned long rate)
  542. {
  543. return 0;
  544. }
  545. static inline int prcmu_set_clock_rate(u8 clock, unsigned long rate)
  546. {
  547. return 0;
  548. }
  549. static inline unsigned long prcmu_clock_rate(u8 clock)
  550. {
  551. return 0;
  552. }
  553. static inline int prcmu_set_ape_opp(u8 opp)
  554. {
  555. return 0;
  556. }
  557. static inline int prcmu_get_ape_opp(void)
  558. {
  559. return APE_100_OPP;
  560. }
  561. static inline int prcmu_set_arm_opp(u8 opp)
  562. {
  563. return 0;
  564. }
  565. static inline int prcmu_get_arm_opp(void)
  566. {
  567. return ARM_100_OPP;
  568. }
  569. static inline int prcmu_set_ddr_opp(u8 opp)
  570. {
  571. return 0;
  572. }
  573. static inline int prcmu_get_ddr_opp(void)
  574. {
  575. return DDR_100_OPP;
  576. }
  577. static inline void prcmu_system_reset(u16 reset_code) {}
  578. static inline u16 prcmu_get_reset_code(void)
  579. {
  580. return 0;
  581. }
  582. static inline void prcmu_ac_wake_req(void) {}
  583. static inline void prcmu_ac_sleep_req(void) {}
  584. static inline void prcmu_modem_reset(void) {}
  585. static inline bool prcmu_is_ac_wake_requested(void)
  586. {
  587. return false;
  588. }
  589. static inline int prcmu_set_display_clocks(void)
  590. {
  591. return 0;
  592. }
  593. static inline int prcmu_disable_dsipll(void)
  594. {
  595. return 0;
  596. }
  597. static inline int prcmu_enable_dsipll(void)
  598. {
  599. return 0;
  600. }
  601. static inline int prcmu_config_esram0_deep_sleep(u8 state)
  602. {
  603. return 0;
  604. }
  605. static inline void prcmu_config_abb_event_readout(u32 abb_events) {}
  606. static inline void prcmu_get_abb_event_buffer(void __iomem **buf)
  607. {
  608. *buf = NULL;
  609. }
  610. static inline int prcmu_config_hotdog(u8 threshold)
  611. {
  612. return 0;
  613. }
  614. static inline int prcmu_config_hotmon(u8 low, u8 high)
  615. {
  616. return 0;
  617. }
  618. static inline int prcmu_start_temp_sense(u16 cycles32k)
  619. {
  620. return 0;
  621. }
  622. static inline int prcmu_stop_temp_sense(void)
  623. {
  624. return 0;
  625. }
  626. static inline u32 prcmu_read(unsigned int reg)
  627. {
  628. return 0;
  629. }
  630. static inline void prcmu_write(unsigned int reg, u32 value) {}
  631. static inline void prcmu_write_masked(unsigned int reg, u32 mask, u32 value) {}
  632. #endif
  633. static inline void prcmu_set(unsigned int reg, u32 bits)
  634. {
  635. prcmu_write_masked(reg, bits, bits);
  636. }
  637. static inline void prcmu_clear(unsigned int reg, u32 bits)
  638. {
  639. prcmu_write_masked(reg, bits, 0);
  640. }
  641. #if defined(CONFIG_UX500_SOC_DB8500) || defined(CONFIG_UX500_SOC_DB5500)
  642. /**
  643. * prcmu_enable_spi2 - Enables pin muxing for SPI2 on OtherAlternateC1.
  644. */
  645. static inline void prcmu_enable_spi2(void)
  646. {
  647. if (cpu_is_u8500())
  648. prcmu_set(DB8500_PRCM_GPIOCR, DB8500_PRCM_GPIOCR_SPI2_SELECT);
  649. }
  650. /**
  651. * prcmu_disable_spi2 - Disables pin muxing for SPI2 on OtherAlternateC1.
  652. */
  653. static inline void prcmu_disable_spi2(void)
  654. {
  655. if (cpu_is_u8500())
  656. prcmu_clear(DB8500_PRCM_GPIOCR, DB8500_PRCM_GPIOCR_SPI2_SELECT);
  657. }
  658. /**
  659. * prcmu_enable_stm_mod_uart - Enables pin muxing for STMMOD
  660. * and UARTMOD on OtherAlternateC3.
  661. */
  662. static inline void prcmu_enable_stm_mod_uart(void)
  663. {
  664. if (cpu_is_u8500()) {
  665. prcmu_set(DB8500_PRCM_GPIOCR,
  666. (DB8500_PRCM_GPIOCR_DBG_STM_MOD_CMD1 |
  667. DB8500_PRCM_GPIOCR_DBG_UARTMOD_CMD0));
  668. }
  669. }
  670. /**
  671. * prcmu_disable_stm_mod_uart - Disables pin muxing for STMMOD
  672. * and UARTMOD on OtherAlternateC3.
  673. */
  674. static inline void prcmu_disable_stm_mod_uart(void)
  675. {
  676. if (cpu_is_u8500()) {
  677. prcmu_clear(DB8500_PRCM_GPIOCR,
  678. (DB8500_PRCM_GPIOCR_DBG_STM_MOD_CMD1 |
  679. DB8500_PRCM_GPIOCR_DBG_UARTMOD_CMD0));
  680. }
  681. }
  682. /**
  683. * prcmu_enable_stm_ape - Enables pin muxing for STM APE on OtherAlternateC1.
  684. */
  685. static inline void prcmu_enable_stm_ape(void)
  686. {
  687. if (cpu_is_u8500()) {
  688. prcmu_set(DB8500_PRCM_GPIOCR,
  689. DB8500_PRCM_GPIOCR_DBG_STM_APE_CMD);
  690. }
  691. }
  692. /**
  693. * prcmu_disable_stm_ape - Disables pin muxing for STM APE on OtherAlternateC1.
  694. */
  695. static inline void prcmu_disable_stm_ape(void)
  696. {
  697. if (cpu_is_u8500()) {
  698. prcmu_clear(DB8500_PRCM_GPIOCR,
  699. DB8500_PRCM_GPIOCR_DBG_STM_APE_CMD);
  700. }
  701. }
  702. #else
  703. static inline void prcmu_enable_spi2(void) {}
  704. static inline void prcmu_disable_spi2(void) {}
  705. static inline void prcmu_enable_stm_mod_uart(void) {}
  706. static inline void prcmu_disable_stm_mod_uart(void) {}
  707. static inline void prcmu_enable_stm_ape(void) {}
  708. static inline void prcmu_disable_stm_ape(void) {}
  709. #endif
  710. /* PRCMU QoS APE OPP class */
  711. #define PRCMU_QOS_APE_OPP 1
  712. #define PRCMU_QOS_DDR_OPP 2
  713. #define PRCMU_QOS_ARM_OPP 3
  714. #define PRCMU_QOS_DEFAULT_VALUE -1
  715. #ifdef CONFIG_DBX500_PRCMU_QOS_POWER
  716. unsigned long prcmu_qos_get_cpufreq_opp_delay(void);
  717. void prcmu_qos_set_cpufreq_opp_delay(unsigned long);
  718. void prcmu_qos_force_opp(int, s32);
  719. int prcmu_qos_requirement(int pm_qos_class);
  720. int prcmu_qos_add_requirement(int pm_qos_class, char *name, s32 value);
  721. int prcmu_qos_update_requirement(int pm_qos_class, char *name, s32 new_value);
  722. void prcmu_qos_remove_requirement(int pm_qos_class, char *name);
  723. int prcmu_qos_add_notifier(int prcmu_qos_class,
  724. struct notifier_block *notifier);
  725. int prcmu_qos_remove_notifier(int prcmu_qos_class,
  726. struct notifier_block *notifier);
  727. #else
  728. static inline unsigned long prcmu_qos_get_cpufreq_opp_delay(void)
  729. {
  730. return 0;
  731. }
  732. static inline void prcmu_qos_set_cpufreq_opp_delay(unsigned long n) {}
  733. static inline void prcmu_qos_force_opp(int prcmu_qos_class, s32 i) {}
  734. static inline int prcmu_qos_requirement(int prcmu_qos_class)
  735. {
  736. return 0;
  737. }
  738. static inline int prcmu_qos_add_requirement(int prcmu_qos_class,
  739. char *name, s32 value)
  740. {
  741. return 0;
  742. }
  743. static inline int prcmu_qos_update_requirement(int prcmu_qos_class,
  744. char *name, s32 new_value)
  745. {
  746. return 0;
  747. }
  748. static inline void prcmu_qos_remove_requirement(int prcmu_qos_class, char *name)
  749. {
  750. }
  751. static inline int prcmu_qos_add_notifier(int prcmu_qos_class,
  752. struct notifier_block *notifier)
  753. {
  754. return 0;
  755. }
  756. static inline int prcmu_qos_remove_notifier(int prcmu_qos_class,
  757. struct notifier_block *notifier)
  758. {
  759. return 0;
  760. }
  761. #endif
  762. #endif /* __MACH_PRCMU_H */