pm.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. /*
  2. * Definitions for Broadcom STB power management / Always ON (AON) block
  3. *
  4. * Copyright © 2016-2017 Broadcom
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License version 2 as
  8. * published by the Free Software Foundation.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. */
  15. #ifndef __BRCMSTB_PM_H__
  16. #define __BRCMSTB_PM_H__
  17. #define AON_CTRL_RESET_CTRL 0x00
  18. #define AON_CTRL_PM_CTRL 0x04
  19. #define AON_CTRL_PM_STATUS 0x08
  20. #define AON_CTRL_PM_CPU_WAIT_COUNT 0x10
  21. #define AON_CTRL_PM_INITIATE 0x88
  22. #define AON_CTRL_HOST_MISC_CMDS 0x8c
  23. #define AON_CTRL_SYSTEM_DATA_RAM_OFS 0x200
  24. /* MIPS PM constants */
  25. /* MEMC0 offsets */
  26. #define DDR40_PHY_CONTROL_REGS_0_PLL_STATUS 0x10
  27. #define DDR40_PHY_CONTROL_REGS_0_STANDBY_CTRL 0xa4
  28. /* TIMER offsets */
  29. #define TIMER_TIMER1_CTRL 0x0c
  30. #define TIMER_TIMER1_STAT 0x1c
  31. /* TIMER defines */
  32. #define RESET_TIMER 0x0
  33. #define START_TIMER 0xbfffffff
  34. #define TIMER_MASK 0x3fffffff
  35. /* PM_CTRL bitfield (Method #0) */
  36. #define PM_FAST_PWRDOWN (1 << 6)
  37. #define PM_WARM_BOOT (1 << 5)
  38. #define PM_DEEP_STANDBY (1 << 4)
  39. #define PM_CPU_PWR (1 << 3)
  40. #define PM_USE_CPU_RDY (1 << 2)
  41. #define PM_PLL_PWRDOWN (1 << 1)
  42. #define PM_PWR_DOWN (1 << 0)
  43. /* PM_CTRL bitfield (Method #1) */
  44. #define PM_DPHY_STANDBY_CLEAR (1 << 20)
  45. #define PM_MIN_S3_WIDTH_TIMER_BYPASS (1 << 7)
  46. #define PM_S2_COMMAND (PM_PLL_PWRDOWN | PM_USE_CPU_RDY | PM_PWR_DOWN)
  47. /* Method 0 bitmasks */
  48. #define PM_COLD_CONFIG (PM_PLL_PWRDOWN | PM_DEEP_STANDBY)
  49. #define PM_WARM_CONFIG (PM_COLD_CONFIG | PM_USE_CPU_RDY | PM_WARM_BOOT)
  50. /* Method 1 bitmask */
  51. #define M1_PM_WARM_CONFIG (PM_DPHY_STANDBY_CLEAR | \
  52. PM_MIN_S3_WIDTH_TIMER_BYPASS | \
  53. PM_WARM_BOOT | PM_DEEP_STANDBY | \
  54. PM_PLL_PWRDOWN | PM_PWR_DOWN)
  55. #define M1_PM_COLD_CONFIG (PM_DPHY_STANDBY_CLEAR | \
  56. PM_MIN_S3_WIDTH_TIMER_BYPASS | \
  57. PM_DEEP_STANDBY | \
  58. PM_PLL_PWRDOWN | PM_PWR_DOWN)
  59. #ifndef __ASSEMBLY__
  60. #ifndef CONFIG_MIPS
  61. extern const unsigned long brcmstb_pm_do_s2_sz;
  62. extern asmlinkage int brcmstb_pm_do_s2(void __iomem *aon_ctrl_base,
  63. void __iomem *ddr_phy_pll_status);
  64. #else
  65. /* s2 asm */
  66. extern asmlinkage int brcm_pm_do_s2(u32 *s2_params);
  67. /* s3 asm */
  68. extern asmlinkage int brcm_pm_do_s3(void __iomem *aon_ctrl_base,
  69. int dcache_linesz);
  70. extern int s3_reentry;
  71. #endif /* CONFIG_MIPS */
  72. #endif
  73. #endif /* __BRCMSTB_PM_H__ */