s32cc-clk-regs.h 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. // SPDX-License-Identifier: BSD-3-Clause
  2. /*
  3. * Copyright 2020-2021, 2023-2024 NXP
  4. */
  5. #ifndef S32CC_CLK_REGS_H
  6. #define S32CC_CLK_REGS_H
  7. #include <lib/utils_def.h>
  8. #define FXOSC_BASE_ADDR (0x40050000UL)
  9. #define ARMPLL_BASE_ADDR (0x40038000UL)
  10. #define PERIPHPLL_BASE_ADDR (0x4003C000UL)
  11. #define ARM_DFS_BASE_ADDR (0x40054000UL)
  12. #define CGM0_BASE_ADDR (0x40030000UL)
  13. #define CGM1_BASE_ADDR (0x40034000UL)
  14. #define DDRPLL_BASE_ADDR (0x40044000UL)
  15. #define MC_ME_BASE_ADDR (0x40088000UL)
  16. #define MC_RGM_BASE_ADDR (0x40078000UL)
  17. #define RDC_BASE_ADDR (0x40080000UL)
  18. #define MC_CGM5_BASE_ADDR (0x40068000UL)
  19. /* FXOSC */
  20. #define FXOSC_CTRL(FXOSC) ((FXOSC) + 0x0UL)
  21. #define FXOSC_CTRL_OSC_BYP BIT_32(31U)
  22. #define FXOSC_CTRL_COMP_EN BIT_32(24U)
  23. #define FXOSC_CTRL_EOCV_OFFSET 16U
  24. #define FXOSC_CTRL_EOCV_MASK GENMASK_32(23U, FXOSC_CTRL_EOCV_OFFSET)
  25. #define FXOSC_CTRL_EOCV(VAL) (FXOSC_CTRL_EOCV_MASK & \
  26. ((uint32_t)(VAL) << FXOSC_CTRL_EOCV_OFFSET))
  27. #define FXOSC_CTRL_GM_SEL_OFFSET 4U
  28. #define FXOSC_CTRL_GM_SEL_MASK GENMASK_32(7U, FXOSC_CTRL_GM_SEL_OFFSET)
  29. #define FXOSC_CTRL_GM_SEL(VAL) (FXOSC_CTRL_GM_SEL_MASK & \
  30. ((uint32_t)(VAL) << FXOSC_CTRL_GM_SEL_OFFSET))
  31. #define FXOSC_CTRL_OSCON BIT_32(0U)
  32. #define FXOSC_STAT(FXOSC) ((FXOSC) + 0x4UL)
  33. #define FXOSC_STAT_OSC_STAT BIT_32(31U)
  34. /* PLL */
  35. #define PLLDIG_PLLCR(PLL) ((PLL) + 0x0UL)
  36. #define PLLDIG_PLLCR_PLLPD BIT_32(31U)
  37. #define PLLDIG_PLLSR(PLL) ((PLL) + 0x4UL)
  38. #define PLLDIG_PLLSR_LOCK BIT_32(2U)
  39. #define PLLDIG_PLLDV(PLL) ((PLL) + 0x8UL)
  40. #define PLLDIG_PLLDV_RDIV_OFFSET 12U
  41. #define PLLDIG_PLLDV_RDIV_MASK GENMASK_32(14U, PLLDIG_PLLDV_RDIV_OFFSET)
  42. #define PLLDIG_PLLDV_RDIV_SET(VAL) (PLLDIG_PLLDV_RDIV_MASK & \
  43. ((VAL) << PLLDIG_PLLDV_RDIV_OFFSET))
  44. #define PLLDIG_PLLDV_MFI_MASK GENMASK_32(7U, 0U)
  45. #define PLLDIG_PLLDV_MFI(DIV) (PLLDIG_PLLDV_MFI_MASK & (DIV))
  46. #define PLLDIG_PLLFD(PLL) ((PLL) + 0x10UL)
  47. #define PLLDIG_PLLFD_SMDEN BIT_32(30U)
  48. #define PLLDIG_PLLFD_MFN_MASK GENMASK_32(14U, 0U)
  49. #define PLLDIG_PLLFD_MFN_SET(VAL) (PLLDIG_PLLFD_MFN_MASK & (VAL))
  50. #define PLLDIG_PLLCLKMUX(PLL) ((PLL) + 0x20UL)
  51. #define PLLDIG_PLLODIV(PLL, N) ((PLL) + 0x80UL + ((N) * 0x4UL))
  52. #define PLLDIG_PLLODIV_DE BIT_32(31U)
  53. #define PLLDIG_PLLODIV_DIV_OFFSET 16U
  54. #define PLLDIG_PLLODIV_DIV_MASK GENMASK_32(23U, PLLDIG_PLLODIV_DIV_OFFSET)
  55. #define PLLDIG_PLLODIV_DIV(VAL) (((VAL) & PLLDIG_PLLODIV_DIV_MASK) >> \
  56. PLLDIG_PLLODIV_DIV_OFFSET)
  57. #define PLLDIG_PLLODIV_DIV_SET(VAL) (PLLDIG_PLLODIV_DIV_MASK & ((VAL) << \
  58. PLLDIG_PLLODIV_DIV_OFFSET))
  59. /* MMC_CGM */
  60. #define CGM_MUXn_CSC(CGM_ADDR, MUX) ((CGM_ADDR) + 0x300UL + ((MUX) * 0x40UL))
  61. #define MC_CGM_MUXn_CSC_SELCTL_OFFSET 24U
  62. #define MC_CGM_MUXn_CSC_SELCTL_MASK GENMASK_32(29U, MC_CGM_MUXn_CSC_SELCTL_OFFSET)
  63. #define MC_CGM_MUXn_CSC_SELCTL(val) (MC_CGM_MUXn_CSC_SELCTL_MASK & ((val) \
  64. << MC_CGM_MUXn_CSC_SELCTL_OFFSET))
  65. #define MC_CGM_MUXn_CSC_CLK_SW BIT_32(2U)
  66. #define MC_CGM_MUXn_CSC_SAFE_SW BIT_32(3U)
  67. #define CGM_MUXn_CSS(CGM_ADDR, MUX) ((CGM_ADDR) + 0x304UL + ((MUX) * 0x40UL))
  68. #define MC_CGM_MUXn_CSS_SELSTAT_OFFSET 24U
  69. #define MC_CGM_MUXn_CSS_SELSTAT_MASK GENMASK_32(29U, MC_CGM_MUXn_CSS_SELSTAT_OFFSET)
  70. #define MC_CGM_MUXn_CSS_SELSTAT(css) ((MC_CGM_MUXn_CSS_SELSTAT_MASK & (css))\
  71. >> MC_CGM_MUXn_CSS_SELSTAT_OFFSET)
  72. #define MC_CGM_MUXn_CSS_SWTRG(css) ((MC_CGM_MUXn_CSS_SWTRG_MASK & (css)) \
  73. >> MC_CGM_MUXn_CSS_SWTRG_OFFSET)
  74. #define MC_CGM_MUXn_CSS_SWTRG_OFFSET 17U
  75. #define MC_CGM_MUXn_CSS_SWTRG_MASK GENMASK_32(19U, MC_CGM_MUXn_CSS_SWTRG_OFFSET)
  76. #define MC_CGM_MUXn_CSS_SWTRG_SUCCESS 0x1U
  77. #define MC_CGM_MUXn_CSS_SWTRG_SAFE_CLK 0x4U
  78. #define MC_CGM_MUXn_CSS_SWTRG_SAFE_CLK_INACTIVE 0x5U
  79. #define MC_CGM_MUXn_CSS_SWIP BIT_32(16U)
  80. #define MC_CGM_MUXn_CSS_SAFE_SW BIT_32(3U)
  81. /* DFS */
  82. #define DFS_PORTSR(DFS_ADDR) ((DFS_ADDR) + 0xCUL)
  83. #define DFS_PORTOLSR(DFS_ADDR) ((DFS_ADDR) + 0x10UL)
  84. #define DFS_PORTOLSR_LOL(N) (BIT_32(N) & GENMASK_32(5U, 0U))
  85. #define DFS_PORTRESET(DFS_ADDR) ((DFS_ADDR) + 0x14UL)
  86. #define DFS_PORTRESET_MASK GENMASK_32(5U, 0U)
  87. #define DFS_PORTRESET_SET(VAL) (((VAL) & DFS_PORTRESET_MASK))
  88. #define DFS_CTL(DFS_ADDR) ((DFS_ADDR) + 0x18UL)
  89. #define DFS_CTL_RESET BIT_32(1U)
  90. #define DFS_DVPORTn(DFS_ADDR, PORT) ((DFS_ADDR) + 0x1CUL + ((PORT) * 0x4UL))
  91. #define DFS_DVPORTn_MFI_MASK GENMASK_32(15U, 8U)
  92. #define DFS_DVPORTn_MFI_SHIFT 8U
  93. #define DFS_DVPORTn_MFN_MASK GENMASK_32(7U, 0U)
  94. #define DFS_DVPORTn_MFN_SHIFT 0U
  95. #define DFS_DVPORTn_MFI(MFI) (((MFI) & DFS_DVPORTn_MFI_MASK) >> DFS_DVPORTn_MFI_SHIFT)
  96. #define DFS_DVPORTn_MFN(MFN) (((MFN) & DFS_DVPORTn_MFN_MASK) >> DFS_DVPORTn_MFN_SHIFT)
  97. #define DFS_DVPORTn_MFI_SET(VAL) (((VAL) << DFS_DVPORTn_MFI_SHIFT) & DFS_DVPORTn_MFI_MASK)
  98. #define DFS_DVPORTn_MFN_SET(VAL) (((VAL) << DFS_DVPORTn_MFN_SHIFT) & DFS_DVPORTn_MFN_MASK)
  99. #endif /* S32CC_CLK_REGS_H */