suspend.h 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. #ifndef _ASM_SH_SUSPEND_H
  2. #define _ASM_SH_SUSPEND_H
  3. #ifndef __ASSEMBLY__
  4. #include <linux/notifier.h>
  5. #include <asm/ptrace.h>
  6. struct swsusp_arch_regs {
  7. struct pt_regs user_regs;
  8. unsigned long bank1_regs[8];
  9. };
  10. void sh_mobile_call_standby(unsigned long mode);
  11. #ifdef CONFIG_CPU_IDLE
  12. int sh_mobile_setup_cpuidle(void);
  13. #else
  14. static inline int sh_mobile_setup_cpuidle(void) { return 0; }
  15. #endif
  16. /* notifier chains for pre/post sleep hooks */
  17. extern struct atomic_notifier_head sh_mobile_pre_sleep_notifier_list;
  18. extern struct atomic_notifier_head sh_mobile_post_sleep_notifier_list;
  19. /* priority levels for notifiers */
  20. #define SH_MOBILE_SLEEP_BOARD 0
  21. #define SH_MOBILE_SLEEP_CPU 1
  22. #define SH_MOBILE_PRE(x) (x)
  23. #define SH_MOBILE_POST(x) (-(x))
  24. /* board code registration function for self-refresh assembly snippets */
  25. void sh_mobile_register_self_refresh(unsigned long flags,
  26. void *pre_start, void *pre_end,
  27. void *post_start, void *post_end);
  28. /* register structure for address/data information */
  29. struct sh_sleep_regs {
  30. unsigned long stbcr;
  31. unsigned long bar;
  32. /* MMU */
  33. unsigned long pteh;
  34. unsigned long ptel;
  35. unsigned long ttb;
  36. unsigned long tea;
  37. unsigned long mmucr;
  38. unsigned long ptea;
  39. unsigned long pascr;
  40. unsigned long irmcr;
  41. /* Cache */
  42. unsigned long ccr;
  43. unsigned long ramcr;
  44. };
  45. /* data area for low-level sleep code */
  46. struct sh_sleep_data {
  47. /* current sleep mode (SUSP_SH_...) */
  48. unsigned long mode;
  49. /* addresses of board specific self-refresh snippets */
  50. unsigned long sf_pre;
  51. unsigned long sf_post;
  52. /* address of resume code */
  53. unsigned long resume;
  54. /* register state saved and restored by the assembly code */
  55. unsigned long vbr;
  56. unsigned long spc;
  57. unsigned long sr;
  58. unsigned long sp;
  59. /* structure for keeping register addresses */
  60. struct sh_sleep_regs addr;
  61. /* structure for saving/restoring register state */
  62. struct sh_sleep_regs data;
  63. };
  64. /* a bitmap of supported sleep modes (SUSP_SH..) */
  65. extern unsigned long sh_mobile_sleep_supported;
  66. #endif
  67. /* flags passed to assembly suspend code */
  68. #define SUSP_SH_SLEEP (1 << 0) /* Regular sleep mode */
  69. #define SUSP_SH_STANDBY (1 << 1) /* SH-Mobile Software standby mode */
  70. #define SUSP_SH_RSTANDBY (1 << 2) /* SH-Mobile R-standby mode */
  71. #define SUSP_SH_USTANDBY (1 << 3) /* SH-Mobile U-standby mode */
  72. #define SUSP_SH_SF (1 << 4) /* Enable self-refresh */
  73. #define SUSP_SH_MMU (1 << 5) /* Save/restore MMU and cache */
  74. #define SUSP_SH_REGS (1 << 6) /* Save/restore registers */
  75. #endif /* _ASM_SH_SUSPEND_H */