pm.h 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356
  1. /*
  2. * arch/arm/plat-omap/include/mach/pm.h
  3. *
  4. * Header file for OMAP Power Management Routines
  5. *
  6. * Author: MontaVista Software, Inc.
  7. * support@mvista.com
  8. *
  9. * Copyright 2002 MontaVista Software Inc.
  10. *
  11. * Cleanup 2004 for Linux 2.6 by Dirk Behme <dirk.behme@de.bosch.com>
  12. *
  13. * This program is free software; you can redistribute it and/or modify it
  14. * under the terms of the GNU General Public License as published by the
  15. * Free Software Foundation; either version 2 of the License, or (at your
  16. * option) any later version.
  17. *
  18. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
  19. * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  20. * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
  21. * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
  22. * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
  23. * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  24. * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
  25. * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  26. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  27. * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  28. *
  29. * You should have received a copy of the GNU General Public License along
  30. * with this program; if not, write to the Free Software Foundation, Inc.,
  31. * 675 Mass Ave, Cambridge, MA 02139, USA.
  32. */
  33. #ifndef __ASM_ARCH_OMAP_PM_H
  34. #define __ASM_ARCH_OMAP_PM_H
  35. /*
  36. * ----------------------------------------------------------------------------
  37. * Register and offset definitions to be used in PM assembler code
  38. * ----------------------------------------------------------------------------
  39. */
  40. #define CLKGEN_REG_ASM_BASE io_p2v(0xfffece00)
  41. #define ARM_IDLECT1_ASM_OFFSET 0x04
  42. #define ARM_IDLECT2_ASM_OFFSET 0x08
  43. #define TCMIF_ASM_BASE io_p2v(0xfffecc00)
  44. #define EMIFS_CONFIG_ASM_OFFSET 0x0c
  45. #define EMIFF_SDRAM_CONFIG_ASM_OFFSET 0x20
  46. /*
  47. * ----------------------------------------------------------------------------
  48. * Power management bitmasks
  49. * ----------------------------------------------------------------------------
  50. */
  51. #define IDLE_WAIT_CYCLES 0x00000fff
  52. #define PERIPHERAL_ENABLE 0x2
  53. #define SELF_REFRESH_MODE 0x0c000001
  54. #define IDLE_EMIFS_REQUEST 0xc
  55. #define MODEM_32K_EN 0x1
  56. #define PER_EN 0x1
  57. #define CPU_SUSPEND_SIZE 200
  58. #define ULPD_LOW_PWR_EN 0x0001
  59. #define ULPD_DEEP_SLEEP_TRANSITION_EN 0x0010
  60. #define ULPD_SETUP_ANALOG_CELL_3_VAL 0
  61. #define ULPD_POWER_CTRL_REG_VAL 0x0219
  62. #define DSP_IDLE_DELAY 10
  63. #define DSP_IDLE 0x0040
  64. #define DSP_RST 0x0004
  65. #define DSP_ENABLE 0x0002
  66. #define SUFFICIENT_DSP_RESET_TIME 1000
  67. #define DEFAULT_MPUI_CONFIG 0x05cf
  68. #define ENABLE_XORCLK 0x2
  69. #define DSP_CLOCK_ENABLE 0x2000
  70. #define DSP_IDLE_MODE 0x2
  71. #define TC_IDLE_REQUEST (0x0000000c)
  72. #define IRQ_LEVEL2 (1<<0)
  73. #define IRQ_KEYBOARD (1<<1)
  74. #define IRQ_UART2 (1<<15)
  75. #define PDE_BIT 0x08
  76. #define PWD_EN_BIT 0x04
  77. #define EN_PERCK_BIT 0x04
  78. #define OMAP1510_DEEP_SLEEP_REQUEST 0x0ec7
  79. #define OMAP1510_BIG_SLEEP_REQUEST 0x0cc5
  80. #define OMAP1510_IDLE_LOOP_REQUEST 0x0c00
  81. #define OMAP1510_IDLE_CLOCK_DOMAINS 0x2
  82. /* Both big sleep and deep sleep use same values. Difference is in ULPD. */
  83. #define OMAP1610_IDLECT1_SLEEP_VAL 0x13c7
  84. #define OMAP1610_IDLECT2_SLEEP_VAL 0x09c7
  85. #define OMAP1610_IDLECT3_VAL 0x3f
  86. #define OMAP1610_IDLECT3_SLEEP_ORMASK 0x2c
  87. #define OMAP1610_IDLECT3 0xfffece24
  88. #define OMAP1610_IDLE_LOOP_REQUEST 0x0400
  89. #define OMAP730_IDLECT1_SLEEP_VAL 0x16c7
  90. #define OMAP730_IDLECT2_SLEEP_VAL 0x09c7
  91. #define OMAP730_IDLECT3_VAL 0x3f
  92. #define OMAP730_IDLECT3 0xfffece24
  93. #define OMAP730_IDLE_LOOP_REQUEST 0x0C00
  94. #if !defined(CONFIG_ARCH_OMAP730) && \
  95. !defined(CONFIG_ARCH_OMAP15XX) && \
  96. !defined(CONFIG_ARCH_OMAP16XX) && \
  97. !defined(CONFIG_ARCH_OMAP24XX)
  98. #error "Power management for this processor not implemented yet"
  99. #endif
  100. #ifndef __ASSEMBLER__
  101. #include <linux/clk.h>
  102. extern void prevent_idle_sleep(void);
  103. extern void allow_idle_sleep(void);
  104. /**
  105. * clk_deny_idle - Prevents the clock from being idled during MPU idle
  106. * @clk: clock signal handle
  107. */
  108. void clk_deny_idle(struct clk *clk);
  109. /**
  110. * clk_allow_idle - Counters previous clk_deny_idle
  111. * @clk: clock signal handle
  112. */
  113. void clk_deny_idle(struct clk *clk);
  114. extern void omap_pm_idle(void);
  115. extern void omap_pm_suspend(void);
  116. extern void omap730_cpu_suspend(unsigned short, unsigned short);
  117. extern void omap1510_cpu_suspend(unsigned short, unsigned short);
  118. extern void omap1610_cpu_suspend(unsigned short, unsigned short);
  119. extern void omap24xx_cpu_suspend(u32 dll_ctrl, u32 cpu_revision);
  120. extern void omap730_idle_loop_suspend(void);
  121. extern void omap1510_idle_loop_suspend(void);
  122. extern void omap1610_idle_loop_suspend(void);
  123. extern void omap24xx_idle_loop_suspend(void);
  124. extern unsigned int omap730_cpu_suspend_sz;
  125. extern unsigned int omap1510_cpu_suspend_sz;
  126. extern unsigned int omap1610_cpu_suspend_sz;
  127. extern unsigned int omap24xx_cpu_suspend_sz;
  128. extern unsigned int omap730_idle_loop_suspend_sz;
  129. extern unsigned int omap1510_idle_loop_suspend_sz;
  130. extern unsigned int omap1610_idle_loop_suspend_sz;
  131. extern unsigned int omap24xx_idle_loop_suspend_sz;
  132. #ifdef CONFIG_OMAP_SERIAL_WAKE
  133. extern void omap_serial_wake_trigger(int enable);
  134. #else
  135. #define omap_serial_wakeup_init() {}
  136. #define omap_serial_wake_trigger(x) {}
  137. #endif /* CONFIG_OMAP_SERIAL_WAKE */
  138. #define ARM_SAVE(x) arm_sleep_save[ARM_SLEEP_SAVE_##x] = omap_readl(x)
  139. #define ARM_RESTORE(x) omap_writel((arm_sleep_save[ARM_SLEEP_SAVE_##x]), (x))
  140. #define ARM_SHOW(x) arm_sleep_save[ARM_SLEEP_SAVE_##x]
  141. #define DSP_SAVE(x) dsp_sleep_save[DSP_SLEEP_SAVE_##x] = __raw_readw(x)
  142. #define DSP_RESTORE(x) __raw_writew((dsp_sleep_save[DSP_SLEEP_SAVE_##x]), (x))
  143. #define DSP_SHOW(x) dsp_sleep_save[DSP_SLEEP_SAVE_##x]
  144. #define ULPD_SAVE(x) ulpd_sleep_save[ULPD_SLEEP_SAVE_##x] = omap_readw(x)
  145. #define ULPD_RESTORE(x) omap_writew((ulpd_sleep_save[ULPD_SLEEP_SAVE_##x]), (x))
  146. #define ULPD_SHOW(x) ulpd_sleep_save[ULPD_SLEEP_SAVE_##x]
  147. #define MPUI730_SAVE(x) mpui730_sleep_save[MPUI730_SLEEP_SAVE_##x] = omap_readl(x)
  148. #define MPUI730_RESTORE(x) omap_writel((mpui730_sleep_save[MPUI730_SLEEP_SAVE_##x]), (x))
  149. #define MPUI730_SHOW(x) mpui730_sleep_save[MPUI730_SLEEP_SAVE_##x]
  150. #define MPUI1510_SAVE(x) mpui1510_sleep_save[MPUI1510_SLEEP_SAVE_##x] = omap_readl(x)
  151. #define MPUI1510_RESTORE(x) omap_writel((mpui1510_sleep_save[MPUI1510_SLEEP_SAVE_##x]), (x))
  152. #define MPUI1510_SHOW(x) mpui1510_sleep_save[MPUI1510_SLEEP_SAVE_##x]
  153. #define MPUI1610_SAVE(x) mpui1610_sleep_save[MPUI1610_SLEEP_SAVE_##x] = omap_readl(x)
  154. #define MPUI1610_RESTORE(x) omap_writel((mpui1610_sleep_save[MPUI1610_SLEEP_SAVE_##x]), (x))
  155. #define MPUI1610_SHOW(x) mpui1610_sleep_save[MPUI1610_SLEEP_SAVE_##x]
  156. #define OMAP24XX_SAVE(x) omap24xx_sleep_save[OMAP24XX_SLEEP_SAVE_##x] = x
  157. #define OMAP24XX_RESTORE(x) x = omap24xx_sleep_save[OMAP24XX_SLEEP_SAVE_##x]
  158. #define OMAP24XX_SHOW(x) omap24xx_sleep_save[OMAP24XX_SLEEP_SAVE_##x]
  159. /*
  160. * List of global OMAP registers to preserve.
  161. * More ones like CP and general purpose register values are preserved
  162. * with the stack pointer in sleep.S.
  163. */
  164. enum arm_save_state {
  165. ARM_SLEEP_SAVE_START = 0,
  166. /*
  167. * MPU control registers 32 bits
  168. */
  169. ARM_SLEEP_SAVE_ARM_CKCTL,
  170. ARM_SLEEP_SAVE_ARM_IDLECT1,
  171. ARM_SLEEP_SAVE_ARM_IDLECT2,
  172. ARM_SLEEP_SAVE_ARM_IDLECT3,
  173. ARM_SLEEP_SAVE_ARM_EWUPCT,
  174. ARM_SLEEP_SAVE_ARM_RSTCT1,
  175. ARM_SLEEP_SAVE_ARM_RSTCT2,
  176. ARM_SLEEP_SAVE_ARM_SYSST,
  177. ARM_SLEEP_SAVE_SIZE
  178. };
  179. enum dsp_save_state {
  180. DSP_SLEEP_SAVE_START = 0,
  181. /*
  182. * DSP registers 16 bits
  183. */
  184. DSP_SLEEP_SAVE_DSP_IDLECT2,
  185. DSP_SLEEP_SAVE_SIZE
  186. };
  187. enum ulpd_save_state {
  188. ULPD_SLEEP_SAVE_START = 0,
  189. /*
  190. * ULPD registers 16 bits
  191. */
  192. ULPD_SLEEP_SAVE_ULPD_IT_STATUS,
  193. ULPD_SLEEP_SAVE_ULPD_CLOCK_CTRL,
  194. ULPD_SLEEP_SAVE_ULPD_SOFT_REQ,
  195. ULPD_SLEEP_SAVE_ULPD_STATUS_REQ,
  196. ULPD_SLEEP_SAVE_ULPD_DPLL_CTRL,
  197. ULPD_SLEEP_SAVE_ULPD_POWER_CTRL,
  198. ULPD_SLEEP_SAVE_SIZE
  199. };
  200. enum mpui1510_save_state {
  201. MPUI1510_SLEEP_SAVE_START = 0,
  202. /*
  203. * MPUI registers 32 bits
  204. */
  205. MPUI1510_SLEEP_SAVE_MPUI_CTRL,
  206. MPUI1510_SLEEP_SAVE_MPUI_DSP_BOOT_CONFIG,
  207. MPUI1510_SLEEP_SAVE_MPUI_DSP_API_CONFIG,
  208. MPUI1510_SLEEP_SAVE_MPUI_DSP_STATUS,
  209. MPUI1510_SLEEP_SAVE_EMIFF_SDRAM_CONFIG,
  210. MPUI1510_SLEEP_SAVE_EMIFS_CONFIG,
  211. MPUI1510_SLEEP_SAVE_OMAP_IH1_MIR,
  212. MPUI1510_SLEEP_SAVE_OMAP_IH2_MIR,
  213. #if defined(CONFIG_ARCH_OMAP15XX)
  214. MPUI1510_SLEEP_SAVE_SIZE
  215. #else
  216. MPUI1510_SLEEP_SAVE_SIZE = 0
  217. #endif
  218. };
  219. enum mpui730_save_state {
  220. MPUI730_SLEEP_SAVE_START = 0,
  221. /*
  222. * MPUI registers 32 bits
  223. */
  224. MPUI730_SLEEP_SAVE_MPUI_CTRL,
  225. MPUI730_SLEEP_SAVE_MPUI_DSP_BOOT_CONFIG,
  226. MPUI730_SLEEP_SAVE_MPUI_DSP_API_CONFIG,
  227. MPUI730_SLEEP_SAVE_MPUI_DSP_STATUS,
  228. MPUI730_SLEEP_SAVE_EMIFF_SDRAM_CONFIG,
  229. MPUI730_SLEEP_SAVE_EMIFS_CONFIG,
  230. MPUI730_SLEEP_SAVE_OMAP_IH1_MIR,
  231. MPUI730_SLEEP_SAVE_OMAP_IH2_0_MIR,
  232. MPUI730_SLEEP_SAVE_OMAP_IH2_1_MIR,
  233. #if defined(CONFIG_ARCH_OMAP730)
  234. MPUI730_SLEEP_SAVE_SIZE
  235. #else
  236. MPUI730_SLEEP_SAVE_SIZE = 0
  237. #endif
  238. };
  239. enum mpui1610_save_state {
  240. MPUI1610_SLEEP_SAVE_START = 0,
  241. /*
  242. * MPUI registers 32 bits
  243. */
  244. MPUI1610_SLEEP_SAVE_MPUI_CTRL,
  245. MPUI1610_SLEEP_SAVE_MPUI_DSP_BOOT_CONFIG,
  246. MPUI1610_SLEEP_SAVE_MPUI_DSP_API_CONFIG,
  247. MPUI1610_SLEEP_SAVE_MPUI_DSP_STATUS,
  248. MPUI1610_SLEEP_SAVE_EMIFF_SDRAM_CONFIG,
  249. MPUI1610_SLEEP_SAVE_EMIFS_CONFIG,
  250. MPUI1610_SLEEP_SAVE_OMAP_IH1_MIR,
  251. MPUI1610_SLEEP_SAVE_OMAP_IH2_0_MIR,
  252. MPUI1610_SLEEP_SAVE_OMAP_IH2_1_MIR,
  253. MPUI1610_SLEEP_SAVE_OMAP_IH2_2_MIR,
  254. MPUI1610_SLEEP_SAVE_OMAP_IH2_3_MIR,
  255. #if defined(CONFIG_ARCH_OMAP16XX)
  256. MPUI1610_SLEEP_SAVE_SIZE
  257. #else
  258. MPUI1610_SLEEP_SAVE_SIZE = 0
  259. #endif
  260. };
  261. enum omap24xx_save_state {
  262. OMAP24XX_SLEEP_SAVE_START = 0,
  263. OMAP24XX_SLEEP_SAVE_INTC_MIR0,
  264. OMAP24XX_SLEEP_SAVE_INTC_MIR1,
  265. OMAP24XX_SLEEP_SAVE_INTC_MIR2,
  266. OMAP24XX_SLEEP_SAVE_CM_CLKSTCTRL_MPU,
  267. OMAP24XX_SLEEP_SAVE_CM_CLKSTCTRL_CORE,
  268. OMAP24XX_SLEEP_SAVE_CM_CLKSTCTRL_GFX,
  269. OMAP24XX_SLEEP_SAVE_CM_CLKSTCTRL_DSP,
  270. OMAP24XX_SLEEP_SAVE_CM_CLKSTCTRL_MDM,
  271. OMAP24XX_SLEEP_SAVE_PM_PWSTCTRL_MPU,
  272. OMAP24XX_SLEEP_SAVE_PM_PWSTCTRL_CORE,
  273. OMAP24XX_SLEEP_SAVE_PM_PWSTCTRL_GFX,
  274. OMAP24XX_SLEEP_SAVE_PM_PWSTCTRL_DSP,
  275. OMAP24XX_SLEEP_SAVE_PM_PWSTCTRL_MDM,
  276. OMAP24XX_SLEEP_SAVE_CM_IDLEST1_CORE,
  277. OMAP24XX_SLEEP_SAVE_CM_IDLEST2_CORE,
  278. OMAP24XX_SLEEP_SAVE_CM_IDLEST3_CORE,
  279. OMAP24XX_SLEEP_SAVE_CM_IDLEST4_CORE,
  280. OMAP24XX_SLEEP_SAVE_CM_IDLEST_GFX,
  281. OMAP24XX_SLEEP_SAVE_CM_IDLEST_WKUP,
  282. OMAP24XX_SLEEP_SAVE_CM_IDLEST_CKGEN,
  283. OMAP24XX_SLEEP_SAVE_CM_IDLEST_DSP,
  284. OMAP24XX_SLEEP_SAVE_CM_IDLEST_MDM,
  285. OMAP24XX_SLEEP_SAVE_CM_AUTOIDLE1_CORE,
  286. OMAP24XX_SLEEP_SAVE_CM_AUTOIDLE2_CORE,
  287. OMAP24XX_SLEEP_SAVE_CM_AUTOIDLE3_CORE,
  288. OMAP24XX_SLEEP_SAVE_CM_AUTOIDLE4_CORE,
  289. OMAP24XX_SLEEP_SAVE_CM_AUTOIDLE_WKUP,
  290. OMAP24XX_SLEEP_SAVE_CM_AUTOIDLE_PLL,
  291. OMAP24XX_SLEEP_SAVE_CM_AUTOIDLE_DSP,
  292. OMAP24XX_SLEEP_SAVE_CM_AUTOIDLE_MDM,
  293. OMAP24XX_SLEEP_SAVE_CM_FCLKEN1_CORE,
  294. OMAP24XX_SLEEP_SAVE_CM_FCLKEN2_CORE,
  295. OMAP24XX_SLEEP_SAVE_CM_ICLKEN1_CORE,
  296. OMAP24XX_SLEEP_SAVE_CM_ICLKEN2_CORE,
  297. OMAP24XX_SLEEP_SAVE_CM_ICLKEN3_CORE,
  298. OMAP24XX_SLEEP_SAVE_CM_ICLKEN4_CORE,
  299. OMAP24XX_SLEEP_SAVE_GPIO1_IRQENABLE1,
  300. OMAP24XX_SLEEP_SAVE_GPIO2_IRQENABLE1,
  301. OMAP24XX_SLEEP_SAVE_GPIO3_IRQENABLE1,
  302. OMAP24XX_SLEEP_SAVE_GPIO4_IRQENABLE1,
  303. OMAP24XX_SLEEP_SAVE_GPIO3_OE,
  304. OMAP24XX_SLEEP_SAVE_GPIO4_OE,
  305. OMAP24XX_SLEEP_SAVE_GPIO3_RISINGDETECT,
  306. OMAP24XX_SLEEP_SAVE_GPIO3_FALLINGDETECT,
  307. OMAP24XX_SLEEP_SAVE_CONTROL_PADCONF_SPI1_NCS2,
  308. OMAP24XX_SLEEP_SAVE_CONTROL_PADCONF_MCBSP1_DX,
  309. OMAP24XX_SLEEP_SAVE_CONTROL_PADCONF_SSI1_FLAG_TX,
  310. OMAP24XX_SLEEP_SAVE_CONTROL_PADCONF_SYS_NIRQW0,
  311. OMAP24XX_SLEEP_SAVE_SIZE
  312. };
  313. #endif /* ASSEMBLER */
  314. #endif /* __ASM_ARCH_OMAP_PM_H */