pm.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Definitions for Broadcom STB power management / Always ON (AON) block
  4. *
  5. * Copyright © 2016-2017 Broadcom
  6. */
  7. #ifndef __BRCMSTB_PM_H__
  8. #define __BRCMSTB_PM_H__
  9. #define AON_CTRL_RESET_CTRL 0x00
  10. #define AON_CTRL_PM_CTRL 0x04
  11. #define AON_CTRL_PM_STATUS 0x08
  12. #define AON_CTRL_PM_CPU_WAIT_COUNT 0x10
  13. #define AON_CTRL_PM_INITIATE 0x88
  14. #define AON_CTRL_HOST_MISC_CMDS 0x8c
  15. #define AON_CTRL_SYSTEM_DATA_RAM_OFS 0x200
  16. /* MIPS PM constants */
  17. /* MEMC0 offsets */
  18. #define DDR40_PHY_CONTROL_REGS_0_PLL_STATUS 0x10
  19. #define DDR40_PHY_CONTROL_REGS_0_STANDBY_CTRL 0xa4
  20. /* TIMER offsets */
  21. #define TIMER_TIMER1_CTRL 0x0c
  22. #define TIMER_TIMER1_STAT 0x1c
  23. /* TIMER defines */
  24. #define RESET_TIMER 0x0
  25. #define START_TIMER 0xbfffffff
  26. #define TIMER_MASK 0x3fffffff
  27. /* PM_CTRL bitfield (Method #0) */
  28. #define PM_FAST_PWRDOWN (1 << 6)
  29. #define PM_WARM_BOOT (1 << 5)
  30. #define PM_DEEP_STANDBY (1 << 4)
  31. #define PM_CPU_PWR (1 << 3)
  32. #define PM_USE_CPU_RDY (1 << 2)
  33. #define PM_PLL_PWRDOWN (1 << 1)
  34. #define PM_PWR_DOWN (1 << 0)
  35. /* PM_CTRL bitfield (Method #1) */
  36. #define PM_DPHY_STANDBY_CLEAR (1 << 20)
  37. #define PM_MIN_S3_WIDTH_TIMER_BYPASS (1 << 7)
  38. #define PM_S2_COMMAND (PM_PLL_PWRDOWN | PM_USE_CPU_RDY | PM_PWR_DOWN)
  39. /* Method 0 bitmasks */
  40. #define PM_COLD_CONFIG (PM_PLL_PWRDOWN | PM_DEEP_STANDBY)
  41. #define PM_WARM_CONFIG (PM_COLD_CONFIG | PM_USE_CPU_RDY | PM_WARM_BOOT)
  42. /* Method 1 bitmask */
  43. #define M1_PM_WARM_CONFIG (PM_DPHY_STANDBY_CLEAR | \
  44. PM_MIN_S3_WIDTH_TIMER_BYPASS | \
  45. PM_WARM_BOOT | PM_DEEP_STANDBY | \
  46. PM_PLL_PWRDOWN | PM_PWR_DOWN)
  47. #define M1_PM_COLD_CONFIG (PM_DPHY_STANDBY_CLEAR | \
  48. PM_MIN_S3_WIDTH_TIMER_BYPASS | \
  49. PM_DEEP_STANDBY | \
  50. PM_PLL_PWRDOWN | PM_PWR_DOWN)
  51. #ifndef __ASSEMBLY__
  52. #ifndef CONFIG_MIPS
  53. extern const unsigned long brcmstb_pm_do_s2_sz;
  54. extern asmlinkage int brcmstb_pm_do_s2(void __iomem *aon_ctrl_base,
  55. void __iomem *ddr_phy_pll_status);
  56. #else
  57. /* s2 asm */
  58. extern asmlinkage int brcm_pm_do_s2(u32 *s2_params);
  59. /* s3 asm */
  60. extern asmlinkage int brcm_pm_do_s3(void __iomem *aon_ctrl_base,
  61. int dcache_linesz);
  62. extern int s3_reentry;
  63. #endif /* CONFIG_MIPS */
  64. #endif
  65. #endif /* __BRCMSTB_PM_H__ */