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