suspend.h 2.5 KB

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