pm33xx.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * TI pm33xx platform data
  4. *
  5. * Copyright (C) 2016-2018 Texas Instruments, Inc.
  6. * Dave Gerlach <[email protected]>
  7. */
  8. #ifndef _LINUX_PLATFORM_DATA_PM33XX_H
  9. #define _LINUX_PLATFORM_DATA_PM33XX_H
  10. #include <linux/kbuild.h>
  11. #include <linux/types.h>
  12. /*
  13. * WFI Flags for sleep code control
  14. *
  15. * These flags allow PM code to exclude certain operations from happening
  16. * in the low level ASM code found in sleep33xx.S and sleep43xx.S
  17. *
  18. * WFI_FLAG_FLUSH_CACHE: Flush the ARM caches and disable caching. Only
  19. * needed when MPU will lose context.
  20. * WFI_FLAG_SELF_REFRESH: Let EMIF place DDR memory into self-refresh and
  21. * disable EMIF.
  22. * WFI_FLAG_SAVE_EMIF: Save context of all EMIF registers and restore in
  23. * resume path. Only needed if PER domain loses context
  24. * and must also have WFI_FLAG_SELF_REFRESH set.
  25. * WFI_FLAG_WAKE_M3: Disable MPU clock or clockdomain to cause wkup_m3 to
  26. * execute when WFI instruction executes.
  27. * WFI_FLAG_RTC_ONLY: Configure the RTC to enter RTC+DDR mode.
  28. */
  29. #define WFI_FLAG_FLUSH_CACHE BIT(0)
  30. #define WFI_FLAG_SELF_REFRESH BIT(1)
  31. #define WFI_FLAG_SAVE_EMIF BIT(2)
  32. #define WFI_FLAG_WAKE_M3 BIT(3)
  33. #define WFI_FLAG_RTC_ONLY BIT(4)
  34. #ifndef __ASSEMBLER__
  35. struct am33xx_pm_sram_addr {
  36. void (*do_wfi)(void);
  37. unsigned long *do_wfi_sz;
  38. unsigned long *resume_offset;
  39. unsigned long *emif_sram_table;
  40. unsigned long *ro_sram_data;
  41. unsigned long resume_address;
  42. };
  43. struct am33xx_pm_platform_data {
  44. int (*init)(int (*idle)(u32 wfi_flags));
  45. int (*deinit)(void);
  46. int (*soc_suspend)(unsigned int state, int (*fn)(unsigned long),
  47. unsigned long args);
  48. int (*cpu_suspend)(int (*fn)(unsigned long), unsigned long args);
  49. void (*begin_suspend)(void);
  50. void (*finish_suspend)(void);
  51. struct am33xx_pm_sram_addr *(*get_sram_addrs)(void);
  52. void (*save_context)(void);
  53. void (*restore_context)(void);
  54. int (*check_off_mode_enable)(void);
  55. };
  56. struct am33xx_pm_sram_data {
  57. u32 wfi_flags;
  58. u32 l2_aux_ctrl_val;
  59. u32 l2_prefetch_ctrl_val;
  60. } __packed __aligned(8);
  61. struct am33xx_pm_ro_sram_data {
  62. u32 amx3_pm_sram_data_virt;
  63. u32 amx3_pm_sram_data_phys;
  64. void __iomem *rtc_base_virt;
  65. } __packed __aligned(8);
  66. #endif /* __ASSEMBLER__ */
  67. #endif /* _LINUX_PLATFORM_DATA_PM33XX_H */