agilex5_power_manager.h 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. /*
  2. * Copyright (c) 2022-2023, Intel Corporation. All rights reserved.
  3. * Copyright (c) 2024, Altera Corporation. All rights reserved.
  4. *
  5. * SPDX-License-Identifier: BSD-3-Clause
  6. */
  7. #ifndef POWERMANAGER_H
  8. #define POWERMANAGER_H
  9. #include "socfpga_handoff.h"
  10. #define AGX5_PWRMGR_BASE 0x10d14000
  11. /* DSU */
  12. #define AGX5_PWRMGR_DSU_FWENCTL 0x0
  13. #define AGX5_PWRMGR_DSU_PGENCTL 0x4
  14. #define AGX5_PWRMGR_DSU_PGSTAT 0x8
  15. #define AGX5_PWRMGR_DSU_PWRCTLR 0xc
  16. #define AGX5_PWRMGR_DSU_PWRSTAT0 0x10
  17. #define AGX5_PWRMGR_DSU_PWRSTAT1 0x14
  18. /* DSU Macros*/
  19. #define AGX5_PWRMGR_DSU_FWEN(x) ((x) & 0xf)
  20. #define AGX5_PWRMGR_DSU_PGEN(x) ((x) & 0xf)
  21. #define AGX5_PWRMGR_DSU_PGEN_OUT(x) ((x) & 0xf)
  22. #define AGX5_PWRMGR_DSU_SINGLE_PACCEPT(x) ((x) & 0x1)
  23. #define AGX5_PWRMGR_DSU_SINGLE_PDENY(x) (((x) & 0x1) << 1)
  24. #define AGX5_PWRMGR_DSU_SINGLE_FSM_STATE(x) (((x) & 0xff) << 8)
  25. #define AGX5_PWRMGR_DSU_SINGLE_PCH_DONE(x) (((x) & 0x1) << 31)
  26. #define AGX5_PWRMGR_DSU_MULTI_PACTIVE_IN(x) ((x) & 0xff)
  27. #define AGX5_PWRMGR_DSU_MULTI_PACCEPT(x) (((x) & 0xff) << 8)
  28. #define AGX5_PWRMGR_DSU_MULTI_PDENY(x) (((x) & 0xff) << 16)
  29. #define AGX5_PWRMGR_DSU_MULTI_PCH_DONE(x) (((x) & 0x1) << 31)
  30. /* CPU */
  31. #define AGX5_PWRMGR_CPU_PWRCTLR0 0x18
  32. #define AGX5_PWRMGR_CPU_PWRCTLR1 0x20
  33. #define AGX5_PWRMGR_CPU_PWRCTLR2 0x28
  34. #define AGX5_PWRMGR_CPU_PWRCTLR3 0x30
  35. #define AGX5_PWRMGR_CPU_PWRSTAT0 0x1c
  36. #define AGX5_PWRMGR_CPU_PWRSTAT1 0x24
  37. #define AGX5_PWRMGR_CPU_PWRSTAT2 0x2c
  38. #define AGX5_PWRMGR_CPU_PWRSTAT3 0x34
  39. /* APS */
  40. #define AGX5_PWRMGR_APS_FWENCTL 0x38
  41. #define AGX5_PWRMGR_APS_PGENCTL 0x3C
  42. #define AGX5_PWRMGR_APS_PGSTAT 0x40
  43. /* PSS */
  44. #define AGX5_PWRMGR_PSS_FWENCTL 0x44
  45. #define AGX5_PWRMGR_PSS_PGENCTL 0x48
  46. #define AGX5_PWRMGR_PSS_PGSTAT 0x4c
  47. /* PSS Macros*/
  48. #define AGX5_PWRMGR_PSS_FWEN(x) ((x) & 0xff)
  49. #define AGX5_PWRMGR_PSS_PGEN(x) ((x) & 0xff)
  50. #define AGX5_PWRMGR_PSS_PGEN_OUT(x) ((x) & 0xff)
  51. /* MPU */
  52. #define AGX5_PWRMGR_MPU_PCHCTLR 0x50
  53. #define AGX5_PWRMGR_MPU_PCHSTAT 0x54
  54. #define AGX5_PWRMGR_MPU_BOOTCONFIG 0x58
  55. #define AGX5_PWRMGR_CPU_POWER_STATE_MASK 0x1E
  56. /* MPU Macros*/
  57. #define AGX5_PWRMGR_MPU_TRIGGER_PCH_DSU(x) ((x) & 0x1)
  58. #define AGX5_PWRMGR_MPU_TRIGGER_PCH_CPU(x) (((x) & 0xf) << 1)
  59. #define AGX5_PWRMGR_MPU_STATUS_PCH_CPU(x) (((x) & 0xf) << 1)
  60. /* Shared Macros */
  61. #define AGX5_PWRMGR(_reg) (AGX5_PWRMGR_BASE + \
  62. (AGX5_PWRMGR_##_reg))
  63. /* POWER MANAGER ERROR CODE */
  64. #define AGX5_PWRMGR_HANDOFF_PERIPHERAL -1
  65. #define AGX5_PWRMGR_PSS_STAT_BUSY_E_BUSY 0x0
  66. #define AGX5_PWRMGR_PSS_STAT_BUSY(x) (((x) & 0x000000FF) >> 0)
  67. void config_pwrmgr_handoff(handoff *hoff_ptr);
  68. #endif