dbx500-prcmu.h 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773
  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. * state definition for EPOD (power domain)
  54. * - EPOD_STATE_NO_CHANGE: The EPOD should remain unchanged
  55. * - EPOD_STATE_OFF: The EPOD is switched off
  56. * - EPOD_STATE_RAMRET: The EPOD is switched off with its internal RAM in
  57. * retention
  58. * - EPOD_STATE_ON_CLK_OFF: The EPOD is switched on, clock is still off
  59. * - EPOD_STATE_ON: Same as above, but with clock enabled
  60. */
  61. #define EPOD_STATE_NO_CHANGE 0x00
  62. #define EPOD_STATE_OFF 0x01
  63. #define EPOD_STATE_RAMRET 0x02
  64. #define EPOD_STATE_ON_CLK_OFF 0x03
  65. #define EPOD_STATE_ON 0x04
  66. /*
  67. * CLKOUT sources
  68. */
  69. #define PRCMU_CLKSRC_CLK38M 0x00
  70. #define PRCMU_CLKSRC_ACLK 0x01
  71. #define PRCMU_CLKSRC_SYSCLK 0x02
  72. #define PRCMU_CLKSRC_LCDCLK 0x03
  73. #define PRCMU_CLKSRC_SDMMCCLK 0x04
  74. #define PRCMU_CLKSRC_TVCLK 0x05
  75. #define PRCMU_CLKSRC_TIMCLK 0x06
  76. #define PRCMU_CLKSRC_CLK009 0x07
  77. /* These are only valid for CLKOUT1: */
  78. #define PRCMU_CLKSRC_SIAMMDSPCLK 0x40
  79. #define PRCMU_CLKSRC_I2CCLK 0x41
  80. #define PRCMU_CLKSRC_MSP02CLK 0x42
  81. #define PRCMU_CLKSRC_ARMPLL_OBSCLK 0x43
  82. #define PRCMU_CLKSRC_HSIRXCLK 0x44
  83. #define PRCMU_CLKSRC_HSITXCLK 0x45
  84. #define PRCMU_CLKSRC_ARMCLKFIX 0x46
  85. #define PRCMU_CLKSRC_HDMICLK 0x47
  86. /*
  87. * Clock identifiers.
  88. */
  89. enum prcmu_clock {
  90. PRCMU_SGACLK,
  91. PRCMU_UARTCLK,
  92. PRCMU_MSP02CLK,
  93. PRCMU_MSP1CLK,
  94. PRCMU_I2CCLK,
  95. PRCMU_SDMMCCLK,
  96. PRCMU_SPARE1CLK,
  97. PRCMU_SLIMCLK,
  98. PRCMU_PER1CLK,
  99. PRCMU_PER2CLK,
  100. PRCMU_PER3CLK,
  101. PRCMU_PER5CLK,
  102. PRCMU_PER6CLK,
  103. PRCMU_PER7CLK,
  104. PRCMU_LCDCLK,
  105. PRCMU_BMLCLK,
  106. PRCMU_HSITXCLK,
  107. PRCMU_HSIRXCLK,
  108. PRCMU_HDMICLK,
  109. PRCMU_APEATCLK,
  110. PRCMU_APETRACECLK,
  111. PRCMU_MCDECLK,
  112. PRCMU_IPI2CCLK,
  113. PRCMU_DSIALTCLK,
  114. PRCMU_DMACLK,
  115. PRCMU_B2R2CLK,
  116. PRCMU_TVCLK,
  117. PRCMU_SSPCLK,
  118. PRCMU_RNGCLK,
  119. PRCMU_UICCCLK,
  120. PRCMU_PWMCLK,
  121. PRCMU_IRDACLK,
  122. PRCMU_IRRCCLK,
  123. PRCMU_SIACLK,
  124. PRCMU_SVACLK,
  125. PRCMU_ACLK,
  126. PRCMU_NUM_REG_CLOCKS,
  127. PRCMU_SYSCLK = PRCMU_NUM_REG_CLOCKS,
  128. PRCMU_CDCLK,
  129. PRCMU_TIMCLK,
  130. PRCMU_PLLSOC0,
  131. PRCMU_PLLSOC1,
  132. PRCMU_ARMSS,
  133. PRCMU_PLLDDR,
  134. PRCMU_PLLDSI,
  135. PRCMU_DSI0CLK,
  136. PRCMU_DSI1CLK,
  137. PRCMU_DSI0ESCCLK,
  138. PRCMU_DSI1ESCCLK,
  139. PRCMU_DSI2ESCCLK,
  140. };
  141. /**
  142. * enum ape_opp - APE OPP states definition
  143. * @APE_OPP_INIT:
  144. * @APE_NO_CHANGE: The APE operating point is unchanged
  145. * @APE_100_OPP: The new APE operating point is ape100opp
  146. * @APE_50_OPP: 50%
  147. * @APE_50_PARTLY_25_OPP: 50%, except some clocks at 25%.
  148. */
  149. enum ape_opp {
  150. APE_OPP_INIT = 0x00,
  151. APE_NO_CHANGE = 0x01,
  152. APE_100_OPP = 0x02,
  153. APE_50_OPP = 0x03,
  154. APE_50_PARTLY_25_OPP = 0xFF,
  155. };
  156. /**
  157. * enum arm_opp - ARM OPP states definition
  158. * @ARM_OPP_INIT:
  159. * @ARM_NO_CHANGE: The ARM operating point is unchanged
  160. * @ARM_100_OPP: The new ARM operating point is arm100opp
  161. * @ARM_50_OPP: The new ARM operating point is arm50opp
  162. * @ARM_MAX_OPP: Operating point is "max" (more than 100)
  163. * @ARM_MAX_FREQ100OPP: Set max opp if available, else 100
  164. * @ARM_EXTCLK: The new ARM operating point is armExtClk
  165. */
  166. enum arm_opp {
  167. ARM_OPP_INIT = 0x00,
  168. ARM_NO_CHANGE = 0x01,
  169. ARM_100_OPP = 0x02,
  170. ARM_50_OPP = 0x03,
  171. ARM_MAX_OPP = 0x04,
  172. ARM_MAX_FREQ100OPP = 0x05,
  173. ARM_EXTCLK = 0x07
  174. };
  175. /**
  176. * enum ddr_opp - DDR OPP states definition
  177. * @DDR_100_OPP: The new DDR operating point is ddr100opp
  178. * @DDR_50_OPP: The new DDR operating point is ddr50opp
  179. * @DDR_25_OPP: The new DDR operating point is ddr25opp
  180. */
  181. enum ddr_opp {
  182. DDR_100_OPP = 0x00,
  183. DDR_50_OPP = 0x01,
  184. DDR_25_OPP = 0x02,
  185. };
  186. /*
  187. * Definitions for controlling ESRAM0 in deep sleep.
  188. */
  189. #define ESRAM0_DEEP_SLEEP_STATE_OFF 1
  190. #define ESRAM0_DEEP_SLEEP_STATE_RET 2
  191. /**
  192. * enum ddr_pwrst - DDR power states definition
  193. * @DDR_PWR_STATE_UNCHANGED: SDRAM and DDR controller state is unchanged
  194. * @DDR_PWR_STATE_ON:
  195. * @DDR_PWR_STATE_OFFLOWLAT:
  196. * @DDR_PWR_STATE_OFFHIGHLAT:
  197. */
  198. enum ddr_pwrst {
  199. DDR_PWR_STATE_UNCHANGED = 0x00,
  200. DDR_PWR_STATE_ON = 0x01,
  201. DDR_PWR_STATE_OFFLOWLAT = 0x02,
  202. DDR_PWR_STATE_OFFHIGHLAT = 0x03
  203. };
  204. #include <linux/mfd/db8500-prcmu.h>
  205. #if defined(CONFIG_UX500_SOC_DB8500)
  206. #include <mach/id.h>
  207. static inline void __init prcmu_early_init(void)
  208. {
  209. return db8500_prcmu_early_init();
  210. }
  211. static inline int prcmu_set_power_state(u8 state, bool keep_ulp_clk,
  212. bool keep_ap_pll)
  213. {
  214. return db8500_prcmu_set_power_state(state, keep_ulp_clk,
  215. keep_ap_pll);
  216. }
  217. static inline u8 prcmu_get_power_state_result(void)
  218. {
  219. return db8500_prcmu_get_power_state_result();
  220. }
  221. static inline int prcmu_gic_decouple(void)
  222. {
  223. return db8500_prcmu_gic_decouple();
  224. }
  225. static inline int prcmu_gic_recouple(void)
  226. {
  227. return db8500_prcmu_gic_recouple();
  228. }
  229. static inline bool prcmu_gic_pending_irq(void)
  230. {
  231. return db8500_prcmu_gic_pending_irq();
  232. }
  233. static inline bool prcmu_is_cpu_in_wfi(int cpu)
  234. {
  235. return db8500_prcmu_is_cpu_in_wfi(cpu);
  236. }
  237. static inline int prcmu_copy_gic_settings(void)
  238. {
  239. return db8500_prcmu_copy_gic_settings();
  240. }
  241. static inline bool prcmu_pending_irq(void)
  242. {
  243. return db8500_prcmu_pending_irq();
  244. }
  245. static inline int prcmu_set_epod(u16 epod_id, u8 epod_state)
  246. {
  247. return db8500_prcmu_set_epod(epod_id, epod_state);
  248. }
  249. static inline void prcmu_enable_wakeups(u32 wakeups)
  250. {
  251. db8500_prcmu_enable_wakeups(wakeups);
  252. }
  253. static inline void prcmu_disable_wakeups(void)
  254. {
  255. prcmu_enable_wakeups(0);
  256. }
  257. static inline void prcmu_config_abb_event_readout(u32 abb_events)
  258. {
  259. db8500_prcmu_config_abb_event_readout(abb_events);
  260. }
  261. static inline void prcmu_get_abb_event_buffer(void __iomem **buf)
  262. {
  263. db8500_prcmu_get_abb_event_buffer(buf);
  264. }
  265. int prcmu_abb_read(u8 slave, u8 reg, u8 *value, u8 size);
  266. int prcmu_abb_write(u8 slave, u8 reg, u8 *value, u8 size);
  267. int prcmu_abb_write_masked(u8 slave, u8 reg, u8 *value, u8 *mask, u8 size);
  268. int prcmu_config_clkout(u8 clkout, u8 source, u8 div);
  269. static inline int prcmu_request_clock(u8 clock, bool enable)
  270. {
  271. return db8500_prcmu_request_clock(clock, enable);
  272. }
  273. unsigned long prcmu_clock_rate(u8 clock);
  274. long prcmu_round_clock_rate(u8 clock, unsigned long rate);
  275. int prcmu_set_clock_rate(u8 clock, unsigned long rate);
  276. static inline int prcmu_set_ddr_opp(u8 opp)
  277. {
  278. return db8500_prcmu_set_ddr_opp(opp);
  279. }
  280. static inline int prcmu_get_ddr_opp(void)
  281. {
  282. return db8500_prcmu_get_ddr_opp();
  283. }
  284. static inline int prcmu_set_arm_opp(u8 opp)
  285. {
  286. return db8500_prcmu_set_arm_opp(opp);
  287. }
  288. static inline int prcmu_get_arm_opp(void)
  289. {
  290. return db8500_prcmu_get_arm_opp();
  291. }
  292. static inline int prcmu_set_ape_opp(u8 opp)
  293. {
  294. return db8500_prcmu_set_ape_opp(opp);
  295. }
  296. static inline int prcmu_get_ape_opp(void)
  297. {
  298. return db8500_prcmu_get_ape_opp();
  299. }
  300. static inline int prcmu_request_ape_opp_100_voltage(bool enable)
  301. {
  302. return db8500_prcmu_request_ape_opp_100_voltage(enable);
  303. }
  304. static inline void prcmu_system_reset(u16 reset_code)
  305. {
  306. return db8500_prcmu_system_reset(reset_code);
  307. }
  308. static inline u16 prcmu_get_reset_code(void)
  309. {
  310. return db8500_prcmu_get_reset_code();
  311. }
  312. int prcmu_ac_wake_req(void);
  313. void prcmu_ac_sleep_req(void);
  314. static inline void prcmu_modem_reset(void)
  315. {
  316. return db8500_prcmu_modem_reset();
  317. }
  318. static inline bool prcmu_is_ac_wake_requested(void)
  319. {
  320. return db8500_prcmu_is_ac_wake_requested();
  321. }
  322. static inline int prcmu_set_display_clocks(void)
  323. {
  324. return db8500_prcmu_set_display_clocks();
  325. }
  326. static inline int prcmu_disable_dsipll(void)
  327. {
  328. return db8500_prcmu_disable_dsipll();
  329. }
  330. static inline int prcmu_enable_dsipll(void)
  331. {
  332. return db8500_prcmu_enable_dsipll();
  333. }
  334. static inline int prcmu_config_esram0_deep_sleep(u8 state)
  335. {
  336. return db8500_prcmu_config_esram0_deep_sleep(state);
  337. }
  338. static inline int prcmu_config_hotdog(u8 threshold)
  339. {
  340. return db8500_prcmu_config_hotdog(threshold);
  341. }
  342. static inline int prcmu_config_hotmon(u8 low, u8 high)
  343. {
  344. return db8500_prcmu_config_hotmon(low, high);
  345. }
  346. static inline int prcmu_start_temp_sense(u16 cycles32k)
  347. {
  348. return db8500_prcmu_start_temp_sense(cycles32k);
  349. }
  350. static inline int prcmu_stop_temp_sense(void)
  351. {
  352. return db8500_prcmu_stop_temp_sense();
  353. }
  354. static inline u32 prcmu_read(unsigned int reg)
  355. {
  356. return db8500_prcmu_read(reg);
  357. }
  358. static inline void prcmu_write(unsigned int reg, u32 value)
  359. {
  360. db8500_prcmu_write(reg, value);
  361. }
  362. static inline void prcmu_write_masked(unsigned int reg, u32 mask, u32 value)
  363. {
  364. db8500_prcmu_write_masked(reg, mask, value);
  365. }
  366. static inline int prcmu_enable_a9wdog(u8 id)
  367. {
  368. return db8500_prcmu_enable_a9wdog(id);
  369. }
  370. static inline int prcmu_disable_a9wdog(u8 id)
  371. {
  372. return db8500_prcmu_disable_a9wdog(id);
  373. }
  374. static inline int prcmu_kick_a9wdog(u8 id)
  375. {
  376. return db8500_prcmu_kick_a9wdog(id);
  377. }
  378. static inline int prcmu_load_a9wdog(u8 id, u32 timeout)
  379. {
  380. return db8500_prcmu_load_a9wdog(id, timeout);
  381. }
  382. static inline int prcmu_config_a9wdog(u8 num, bool sleep_auto_off)
  383. {
  384. return db8500_prcmu_config_a9wdog(num, sleep_auto_off);
  385. }
  386. #else
  387. static inline void __init prcmu_early_init(void) {}
  388. static inline int prcmu_set_power_state(u8 state, bool keep_ulp_clk,
  389. bool keep_ap_pll)
  390. {
  391. return 0;
  392. }
  393. static inline int prcmu_set_epod(u16 epod_id, u8 epod_state)
  394. {
  395. return 0;
  396. }
  397. static inline void prcmu_enable_wakeups(u32 wakeups) {}
  398. static inline void prcmu_disable_wakeups(void) {}
  399. static inline int prcmu_abb_read(u8 slave, u8 reg, u8 *value, u8 size)
  400. {
  401. return -ENOSYS;
  402. }
  403. static inline int prcmu_abb_write(u8 slave, u8 reg, u8 *value, u8 size)
  404. {
  405. return -ENOSYS;
  406. }
  407. static inline int prcmu_abb_write_masked(u8 slave, u8 reg, u8 *value, u8 *mask,
  408. u8 size)
  409. {
  410. return -ENOSYS;
  411. }
  412. static inline int prcmu_config_clkout(u8 clkout, u8 source, u8 div)
  413. {
  414. return 0;
  415. }
  416. static inline int prcmu_request_clock(u8 clock, bool enable)
  417. {
  418. return 0;
  419. }
  420. static inline long prcmu_round_clock_rate(u8 clock, unsigned long rate)
  421. {
  422. return 0;
  423. }
  424. static inline int prcmu_set_clock_rate(u8 clock, unsigned long rate)
  425. {
  426. return 0;
  427. }
  428. static inline unsigned long prcmu_clock_rate(u8 clock)
  429. {
  430. return 0;
  431. }
  432. static inline int prcmu_set_ape_opp(u8 opp)
  433. {
  434. return 0;
  435. }
  436. static inline int prcmu_get_ape_opp(void)
  437. {
  438. return APE_100_OPP;
  439. }
  440. static inline int prcmu_request_ape_opp_100_voltage(bool enable)
  441. {
  442. return 0;
  443. }
  444. static inline int prcmu_set_arm_opp(u8 opp)
  445. {
  446. return 0;
  447. }
  448. static inline int prcmu_get_arm_opp(void)
  449. {
  450. return ARM_100_OPP;
  451. }
  452. static inline int prcmu_set_ddr_opp(u8 opp)
  453. {
  454. return 0;
  455. }
  456. static inline int prcmu_get_ddr_opp(void)
  457. {
  458. return DDR_100_OPP;
  459. }
  460. static inline void prcmu_system_reset(u16 reset_code) {}
  461. static inline u16 prcmu_get_reset_code(void)
  462. {
  463. return 0;
  464. }
  465. static inline int prcmu_ac_wake_req(void)
  466. {
  467. return 0;
  468. }
  469. static inline void prcmu_ac_sleep_req(void) {}
  470. static inline void prcmu_modem_reset(void) {}
  471. static inline bool prcmu_is_ac_wake_requested(void)
  472. {
  473. return false;
  474. }
  475. static inline int prcmu_set_display_clocks(void)
  476. {
  477. return 0;
  478. }
  479. static inline int prcmu_disable_dsipll(void)
  480. {
  481. return 0;
  482. }
  483. static inline int prcmu_enable_dsipll(void)
  484. {
  485. return 0;
  486. }
  487. static inline int prcmu_config_esram0_deep_sleep(u8 state)
  488. {
  489. return 0;
  490. }
  491. static inline void prcmu_config_abb_event_readout(u32 abb_events) {}
  492. static inline void prcmu_get_abb_event_buffer(void __iomem **buf)
  493. {
  494. *buf = NULL;
  495. }
  496. static inline int prcmu_config_hotdog(u8 threshold)
  497. {
  498. return 0;
  499. }
  500. static inline int prcmu_config_hotmon(u8 low, u8 high)
  501. {
  502. return 0;
  503. }
  504. static inline int prcmu_start_temp_sense(u16 cycles32k)
  505. {
  506. return 0;
  507. }
  508. static inline int prcmu_stop_temp_sense(void)
  509. {
  510. return 0;
  511. }
  512. static inline u32 prcmu_read(unsigned int reg)
  513. {
  514. return 0;
  515. }
  516. static inline void prcmu_write(unsigned int reg, u32 value) {}
  517. static inline void prcmu_write_masked(unsigned int reg, u32 mask, u32 value) {}
  518. #endif
  519. static inline void prcmu_set(unsigned int reg, u32 bits)
  520. {
  521. prcmu_write_masked(reg, bits, bits);
  522. }
  523. static inline void prcmu_clear(unsigned int reg, u32 bits)
  524. {
  525. prcmu_write_masked(reg, bits, 0);
  526. }
  527. #if defined(CONFIG_UX500_SOC_DB8500)
  528. /**
  529. * prcmu_enable_spi2 - Enables pin muxing for SPI2 on OtherAlternateC1.
  530. */
  531. static inline void prcmu_enable_spi2(void)
  532. {
  533. if (cpu_is_u8500())
  534. prcmu_set(DB8500_PRCM_GPIOCR, DB8500_PRCM_GPIOCR_SPI2_SELECT);
  535. }
  536. /**
  537. * prcmu_disable_spi2 - Disables pin muxing for SPI2 on OtherAlternateC1.
  538. */
  539. static inline void prcmu_disable_spi2(void)
  540. {
  541. if (cpu_is_u8500())
  542. prcmu_clear(DB8500_PRCM_GPIOCR, DB8500_PRCM_GPIOCR_SPI2_SELECT);
  543. }
  544. /**
  545. * prcmu_enable_stm_mod_uart - Enables pin muxing for STMMOD
  546. * and UARTMOD on OtherAlternateC3.
  547. */
  548. static inline void prcmu_enable_stm_mod_uart(void)
  549. {
  550. if (cpu_is_u8500()) {
  551. prcmu_set(DB8500_PRCM_GPIOCR,
  552. (DB8500_PRCM_GPIOCR_DBG_STM_MOD_CMD1 |
  553. DB8500_PRCM_GPIOCR_DBG_UARTMOD_CMD0));
  554. }
  555. }
  556. /**
  557. * prcmu_disable_stm_mod_uart - Disables pin muxing for STMMOD
  558. * and UARTMOD on OtherAlternateC3.
  559. */
  560. static inline void prcmu_disable_stm_mod_uart(void)
  561. {
  562. if (cpu_is_u8500()) {
  563. prcmu_clear(DB8500_PRCM_GPIOCR,
  564. (DB8500_PRCM_GPIOCR_DBG_STM_MOD_CMD1 |
  565. DB8500_PRCM_GPIOCR_DBG_UARTMOD_CMD0));
  566. }
  567. }
  568. /**
  569. * prcmu_enable_stm_ape - Enables pin muxing for STM APE on OtherAlternateC1.
  570. */
  571. static inline void prcmu_enable_stm_ape(void)
  572. {
  573. if (cpu_is_u8500()) {
  574. prcmu_set(DB8500_PRCM_GPIOCR,
  575. DB8500_PRCM_GPIOCR_DBG_STM_APE_CMD);
  576. }
  577. }
  578. /**
  579. * prcmu_disable_stm_ape - Disables pin muxing for STM APE on OtherAlternateC1.
  580. */
  581. static inline void prcmu_disable_stm_ape(void)
  582. {
  583. if (cpu_is_u8500()) {
  584. prcmu_clear(DB8500_PRCM_GPIOCR,
  585. DB8500_PRCM_GPIOCR_DBG_STM_APE_CMD);
  586. }
  587. }
  588. #else
  589. static inline void prcmu_enable_spi2(void) {}
  590. static inline void prcmu_disable_spi2(void) {}
  591. static inline void prcmu_enable_stm_mod_uart(void) {}
  592. static inline void prcmu_disable_stm_mod_uart(void) {}
  593. static inline void prcmu_enable_stm_ape(void) {}
  594. static inline void prcmu_disable_stm_ape(void) {}
  595. #endif
  596. /* PRCMU QoS APE OPP class */
  597. #define PRCMU_QOS_APE_OPP 1
  598. #define PRCMU_QOS_DDR_OPP 2
  599. #define PRCMU_QOS_ARM_OPP 3
  600. #define PRCMU_QOS_DEFAULT_VALUE -1
  601. #ifdef CONFIG_DBX500_PRCMU_QOS_POWER
  602. unsigned long prcmu_qos_get_cpufreq_opp_delay(void);
  603. void prcmu_qos_set_cpufreq_opp_delay(unsigned long);
  604. void prcmu_qos_force_opp(int, s32);
  605. int prcmu_qos_requirement(int pm_qos_class);
  606. int prcmu_qos_add_requirement(int pm_qos_class, char *name, s32 value);
  607. int prcmu_qos_update_requirement(int pm_qos_class, char *name, s32 new_value);
  608. void prcmu_qos_remove_requirement(int pm_qos_class, char *name);
  609. int prcmu_qos_add_notifier(int prcmu_qos_class,
  610. struct notifier_block *notifier);
  611. int prcmu_qos_remove_notifier(int prcmu_qos_class,
  612. struct notifier_block *notifier);
  613. #else
  614. static inline unsigned long prcmu_qos_get_cpufreq_opp_delay(void)
  615. {
  616. return 0;
  617. }
  618. static inline void prcmu_qos_set_cpufreq_opp_delay(unsigned long n) {}
  619. static inline void prcmu_qos_force_opp(int prcmu_qos_class, s32 i) {}
  620. static inline int prcmu_qos_requirement(int prcmu_qos_class)
  621. {
  622. return 0;
  623. }
  624. static inline int prcmu_qos_add_requirement(int prcmu_qos_class,
  625. char *name, s32 value)
  626. {
  627. return 0;
  628. }
  629. static inline int prcmu_qos_update_requirement(int prcmu_qos_class,
  630. char *name, s32 new_value)
  631. {
  632. return 0;
  633. }
  634. static inline void prcmu_qos_remove_requirement(int prcmu_qos_class, char *name)
  635. {
  636. }
  637. static inline int prcmu_qos_add_notifier(int prcmu_qos_class,
  638. struct notifier_block *notifier)
  639. {
  640. return 0;
  641. }
  642. static inline int prcmu_qos_remove_notifier(int prcmu_qos_class,
  643. struct notifier_block *notifier)
  644. {
  645. return 0;
  646. }
  647. #endif
  648. #endif /* __MACH_PRCMU_H */