pm.h 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  1. /*
  2. * linux/include/asm/arch-omap/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. * Powermanagement 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_POWER_EN 0x0001
  59. #define DSP_IDLE_DELAY 10
  60. #define DSP_IDLE 0x0040
  61. #define DSP_RST 0x0004
  62. #define DSP_ENABLE 0x0002
  63. #define SUFFICIENT_DSP_RESET_TIME 1000
  64. #define DEFAULT_MPUI_CONFIG 0x05cf
  65. #define ENABLE_XORCLK 0x2
  66. #define DSP_CLOCK_ENABLE 0x2000
  67. #define DSP_IDLE_MODE 0x2
  68. #define TC_IDLE_REQUEST (0x0000000c)
  69. #define IRQ_LEVEL2 (1<<0)
  70. #define IRQ_KEYBOARD (1<<1)
  71. #define IRQ_UART2 (1<<15)
  72. #define PDE_BIT 0x08
  73. #define PWD_EN_BIT 0x04
  74. #define EN_PERCK_BIT 0x04
  75. #define OMAP1510_DEEP_SLEEP_REQUEST 0x0ec7
  76. #define OMAP1510_BIG_SLEEP_REQUEST 0x0cc5
  77. #define OMAP1510_IDLE_LOOP_REQUEST 0x0c00
  78. #define OMAP1510_IDLE_CLOCK_DOMAINS 0x2
  79. #define OMAP1510_ULPD_LOW_POWER_REQ 0x0001
  80. #define OMAP1610_DEEP_SLEEP_REQUEST 0x17c7
  81. #define OMAP1610_BIG_SLEEP_REQUEST TBD
  82. #define OMAP1610_IDLE_LOOP_REQUEST 0x0400
  83. #define OMAP1610_IDLE_CLOCK_DOMAINS 0x09c7
  84. #define OMAP1610_ULPD_LOW_POWER_REQ 0x3
  85. #ifndef OMAP1510_SRAM_IDLE_SUSPEND
  86. #define OMAP1510_SRAM_IDLE_SUSPEND 0
  87. #endif
  88. #ifndef OMAP1610_SRAM_IDLE_SUSPEND
  89. #define OMAP1610_SRAM_IDLE_SUSPEND 0
  90. #endif
  91. #ifndef OMAP5912_SRAM_IDLE_SUSPEND
  92. #define OMAP5912_SRAM_IDLE_SUSPEND 0
  93. #endif
  94. #ifndef OMAP1510_SRAM_API_SUSPEND
  95. #define OMAP1510_SRAM_API_SUSPEND 0
  96. #endif
  97. #ifndef OMAP1610_SRAM_API_SUSPEND
  98. #define OMAP1610_SRAM_API_SUSPEND 0
  99. #endif
  100. #ifndef OMAP5912_SRAM_API_SUSPEND
  101. #define OMAP5912_SRAM_API_SUSPEND 0
  102. #endif
  103. #if !defined(CONFIG_ARCH_OMAP1510) && \
  104. !defined(CONFIG_ARCH_OMAP16XX)
  105. #error "Power management for this processor not implemented yet"
  106. #endif
  107. #ifndef __ASSEMBLER__
  108. extern void omap_pm_idle(void);
  109. extern void omap_pm_suspend(void);
  110. extern int omap1510_cpu_suspend(unsigned short, unsigned short);
  111. extern int omap1610_cpu_suspend(unsigned short, unsigned short);
  112. extern int omap1510_idle_loop_suspend(void);
  113. extern int omap1610_idle_loop_suspend(void);
  114. extern unsigned int omap1510_cpu_suspend_sz;
  115. extern unsigned int omap1510_idle_loop_suspend_sz;
  116. extern unsigned int omap1610_cpu_suspend_sz;
  117. extern unsigned int omap1610_idle_loop_suspend_sz;
  118. #define ARM_SAVE(x) arm_sleep_save[ARM_SLEEP_SAVE_##x] = omap_readl(x)
  119. #define ARM_RESTORE(x) omap_writel((arm_sleep_save[ARM_SLEEP_SAVE_##x]), (x))
  120. #define ARM_SHOW(x) arm_sleep_save[ARM_SLEEP_SAVE_##x]
  121. #define ULPD_SAVE(x) ulpd_sleep_save[ULPD_SLEEP_SAVE_##x] = omap_readw(x)
  122. #define ULPD_RESTORE(x) omap_writew((ulpd_sleep_save[ULPD_SLEEP_SAVE_##x]), (x))
  123. #define ULPD_SHOW(x) ulpd_sleep_save[ULPD_SLEEP_SAVE_##x]
  124. #define MPUI1510_SAVE(x) mpui1510_sleep_save[MPUI1510_SLEEP_SAVE_##x] = omap_readl(x)
  125. #define MPUI1510_RESTORE(x) omap_writel((mpui1510_sleep_save[MPUI1510_SLEEP_SAVE_##x]), (x))
  126. #define MPUI1510_SHOW(x) mpui1510_sleep_save[MPUI1510_SLEEP_SAVE_##x]
  127. #define MPUI1610_SAVE(x) mpui1610_sleep_save[MPUI1610_SLEEP_SAVE_##x] = omap_readl(x)
  128. #define MPUI1610_RESTORE(x) omap_writel((mpui1610_sleep_save[MPUI1610_SLEEP_SAVE_##x]), (x))
  129. #define MPUI1610_SHOW(x) mpui1610_sleep_save[MPUI1610_SLEEP_SAVE_##x]
  130. /*
  131. * List of global OMAP registers to preserve.
  132. * More ones like CP and general purpose register values are preserved
  133. * with the stack pointer in sleep.S.
  134. */
  135. enum arm_save_state {
  136. ARM_SLEEP_SAVE_START = 0,
  137. /*
  138. * MPU control registers 32 bits
  139. */
  140. ARM_SLEEP_SAVE_ARM_CKCTL,
  141. ARM_SLEEP_SAVE_ARM_IDLECT1,
  142. ARM_SLEEP_SAVE_ARM_IDLECT2,
  143. ARM_SLEEP_SAVE_ARM_EWUPCT,
  144. ARM_SLEEP_SAVE_ARM_RSTCT1,
  145. ARM_SLEEP_SAVE_ARM_RSTCT2,
  146. ARM_SLEEP_SAVE_ARM_SYSST,
  147. ARM_SLEEP_SAVE_SIZE
  148. };
  149. enum ulpd_save_state {
  150. ULPD_SLEEP_SAVE_START = 0,
  151. /*
  152. * ULPD registers 16 bits
  153. */
  154. ULPD_SLEEP_SAVE_ULPD_IT_STATUS,
  155. ULPD_SLEEP_SAVE_ULPD_CLOCK_CTRL,
  156. ULPD_SLEEP_SAVE_ULPD_SOFT_REQ,
  157. ULPD_SLEEP_SAVE_ULPD_STATUS_REQ,
  158. ULPD_SLEEP_SAVE_ULPD_DPLL_CTRL,
  159. ULPD_SLEEP_SAVE_ULPD_POWER_CTRL,
  160. ULPD_SLEEP_SAVE_SIZE
  161. };
  162. enum mpui1510_save_state {
  163. MPUI1510_SLEEP_SAVE_START = 0,
  164. /*
  165. * MPUI registers 32 bits
  166. */
  167. MPUI1510_SLEEP_SAVE_MPUI_CTRL,
  168. MPUI1510_SLEEP_SAVE_MPUI_DSP_BOOT_CONFIG,
  169. MPUI1510_SLEEP_SAVE_MPUI_DSP_API_CONFIG,
  170. MPUI1510_SLEEP_SAVE_MPUI_DSP_STATUS,
  171. MPUI1510_SLEEP_SAVE_EMIFF_SDRAM_CONFIG,
  172. MPUI1510_SLEEP_SAVE_EMIFS_CONFIG,
  173. MPUI1510_SLEEP_SAVE_OMAP_IH1_MIR,
  174. MPUI1510_SLEEP_SAVE_OMAP_IH2_MIR,
  175. #if defined(CONFIG_ARCH_OMAP1510)
  176. MPUI1510_SLEEP_SAVE_SIZE
  177. #else
  178. MPUI1510_SLEEP_SAVE_SIZE = 0
  179. #endif
  180. };
  181. enum mpui1610_save_state {
  182. MPUI1610_SLEEP_SAVE_START = 0,
  183. /*
  184. * MPUI registers 32 bits
  185. */
  186. MPUI1610_SLEEP_SAVE_MPUI_CTRL,
  187. MPUI1610_SLEEP_SAVE_MPUI_DSP_BOOT_CONFIG,
  188. MPUI1610_SLEEP_SAVE_MPUI_DSP_API_CONFIG,
  189. MPUI1610_SLEEP_SAVE_MPUI_DSP_STATUS,
  190. MPUI1610_SLEEP_SAVE_EMIFF_SDRAM_CONFIG,
  191. MPUI1610_SLEEP_SAVE_EMIFS_CONFIG,
  192. MPUI1610_SLEEP_SAVE_OMAP_IH1_MIR,
  193. MPUI1610_SLEEP_SAVE_OMAP_IH2_0_MIR,
  194. MPUI1610_SLEEP_SAVE_OMAP_IH2_1_MIR,
  195. MPUI1610_SLEEP_SAVE_OMAP_IH2_2_MIR,
  196. MPUI1610_SLEEP_SAVE_OMAP_IH2_3_MIR,
  197. #if defined(CONFIG_ARCH_OMAP16XX)
  198. MPUI1610_SLEEP_SAVE_SIZE
  199. #else
  200. MPUI1610_SLEEP_SAVE_SIZE = 0
  201. #endif
  202. };
  203. #endif /* ASSEMBLER */
  204. #endif /* __ASM_ARCH_OMAP_PM_H */