Yann Gautier | 4b0c72a | 2018-07-16 10:54:09 +0200 | [diff] [blame] | 1 | /* |
Yann Gautier | 1a3fc9f | 2019-01-17 14:35:22 +0100 | [diff] [blame] | 2 | * Copyright (c) 2015-2019, STMicroelectronics - All Rights Reserved |
Yann Gautier | 4b0c72a | 2018-07-16 10:54:09 +0200 | [diff] [blame] | 3 | * |
| 4 | * SPDX-License-Identifier: BSD-3-Clause |
| 5 | */ |
| 6 | |
Antonio Nino Diaz | 5eb8837 | 2018-11-08 10:20:19 +0000 | [diff] [blame] | 7 | #ifndef STM32MP1_RCC_H |
| 8 | #define STM32MP1_RCC_H |
Yann Gautier | 4b0c72a | 2018-07-16 10:54:09 +0200 | [diff] [blame] | 9 | |
Antonio Nino Diaz | e0f9063 | 2018-12-14 00:18:21 +0000 | [diff] [blame] | 10 | #include <lib/utils_def.h> |
Yann Gautier | 4b0c72a | 2018-07-16 10:54:09 +0200 | [diff] [blame] | 11 | |
| 12 | #define RCC_TZCR U(0x00) |
| 13 | #define RCC_OCENSETR U(0x0C) |
| 14 | #define RCC_OCENCLRR U(0x10) |
| 15 | #define RCC_HSICFGR U(0x18) |
| 16 | #define RCC_CSICFGR U(0x1C) |
| 17 | #define RCC_MPCKSELR U(0x20) |
| 18 | #define RCC_ASSCKSELR U(0x24) |
| 19 | #define RCC_RCK12SELR U(0x28) |
| 20 | #define RCC_MPCKDIVR U(0x2C) |
| 21 | #define RCC_AXIDIVR U(0x30) |
| 22 | #define RCC_APB4DIVR U(0x3C) |
| 23 | #define RCC_APB5DIVR U(0x40) |
| 24 | #define RCC_RTCDIVR U(0x44) |
| 25 | #define RCC_MSSCKSELR U(0x48) |
| 26 | #define RCC_PLL1CR U(0x80) |
| 27 | #define RCC_PLL1CFGR1 U(0x84) |
| 28 | #define RCC_PLL1CFGR2 U(0x88) |
| 29 | #define RCC_PLL1FRACR U(0x8C) |
| 30 | #define RCC_PLL1CSGR U(0x90) |
| 31 | #define RCC_PLL2CR U(0x94) |
| 32 | #define RCC_PLL2CFGR1 U(0x98) |
| 33 | #define RCC_PLL2CFGR2 U(0x9C) |
| 34 | #define RCC_PLL2FRACR U(0xA0) |
| 35 | #define RCC_PLL2CSGR U(0xA4) |
| 36 | #define RCC_I2C46CKSELR U(0xC0) |
| 37 | #define RCC_SPI6CKSELR U(0xC4) |
| 38 | #define RCC_UART1CKSELR U(0xC8) |
| 39 | #define RCC_RNG1CKSELR U(0xCC) |
| 40 | #define RCC_CPERCKSELR U(0xD0) |
| 41 | #define RCC_STGENCKSELR U(0xD4) |
| 42 | #define RCC_DDRITFCR U(0xD8) |
| 43 | #define RCC_MP_BOOTCR U(0x100) |
| 44 | #define RCC_MP_SREQSETR U(0x104) |
| 45 | #define RCC_MP_SREQCLRR U(0x108) |
| 46 | #define RCC_MP_GCR U(0x10C) |
| 47 | #define RCC_MP_APRSTCR U(0x110) |
| 48 | #define RCC_MP_APRSTSR U(0x114) |
| 49 | #define RCC_BDCR U(0x140) |
| 50 | #define RCC_RDLSICR U(0x144) |
| 51 | #define RCC_APB4RSTSETR U(0x180) |
| 52 | #define RCC_APB4RSTCLRR U(0x184) |
| 53 | #define RCC_APB5RSTSETR U(0x188) |
| 54 | #define RCC_APB5RSTCLRR U(0x18C) |
| 55 | #define RCC_AHB5RSTSETR U(0x190) |
| 56 | #define RCC_AHB5RSTCLRR U(0x194) |
| 57 | #define RCC_AHB6RSTSETR U(0x198) |
| 58 | #define RCC_AHB6RSTCLRR U(0x19C) |
| 59 | #define RCC_TZAHB6RSTSETR U(0x1A0) |
| 60 | #define RCC_TZAHB6RSTCLRR U(0x1A4) |
| 61 | #define RCC_MP_APB4ENSETR U(0x200) |
| 62 | #define RCC_MP_APB4ENCLRR U(0x204) |
| 63 | #define RCC_MP_APB5ENSETR U(0x208) |
| 64 | #define RCC_MP_APB5ENCLRR U(0x20C) |
| 65 | #define RCC_MP_AHB5ENSETR U(0x210) |
| 66 | #define RCC_MP_AHB5ENCLRR U(0x214) |
| 67 | #define RCC_MP_AHB6ENSETR U(0x218) |
| 68 | #define RCC_MP_AHB6ENCLRR U(0x21C) |
| 69 | #define RCC_MP_TZAHB6ENSETR U(0x220) |
| 70 | #define RCC_MP_TZAHB6ENCLRR U(0x224) |
Yann Gautier | 1a3fc9f | 2019-01-17 14:35:22 +0100 | [diff] [blame] | 71 | #define RCC_MC_APB4ENSETR U(0x280) |
| 72 | #define RCC_MC_APB4ENCLRR U(0x284) |
| 73 | #define RCC_MC_APB5ENSETR U(0x288) |
| 74 | #define RCC_MC_APB5ENCLRR U(0x28C) |
| 75 | #define RCC_MC_AHB5ENSETR U(0x290) |
| 76 | #define RCC_MC_AHB5ENCLRR U(0x294) |
| 77 | #define RCC_MC_AHB6ENSETR U(0x298) |
| 78 | #define RCC_MC_AHB6ENCLRR U(0x29C) |
Yann Gautier | 4b0c72a | 2018-07-16 10:54:09 +0200 | [diff] [blame] | 79 | #define RCC_MP_APB4LPENSETR U(0x300) |
| 80 | #define RCC_MP_APB4LPENCLRR U(0x304) |
| 81 | #define RCC_MP_APB5LPENSETR U(0x308) |
| 82 | #define RCC_MP_APB5LPENCLRR U(0x30C) |
| 83 | #define RCC_MP_AHB5LPENSETR U(0x310) |
| 84 | #define RCC_MP_AHB5LPENCLRR U(0x314) |
| 85 | #define RCC_MP_AHB6LPENSETR U(0x318) |
| 86 | #define RCC_MP_AHB6LPENCLRR U(0x31C) |
| 87 | #define RCC_MP_TZAHB6LPENSETR U(0x320) |
| 88 | #define RCC_MP_TZAHB6LPENCLRR U(0x324) |
Yann Gautier | 1a3fc9f | 2019-01-17 14:35:22 +0100 | [diff] [blame] | 89 | #define RCC_MC_APB4LPENSETR U(0x380) |
| 90 | #define RCC_MC_APB4LPENCLRR U(0x384) |
| 91 | #define RCC_MC_APB5LPENSETR U(0x388) |
| 92 | #define RCC_MC_APB5LPENCLRR U(0x38C) |
| 93 | #define RCC_MC_AHB5LPENSETR U(0x390) |
| 94 | #define RCC_MC_AHB5LPENCLRR U(0x394) |
| 95 | #define RCC_MC_AHB6LPENSETR U(0x398) |
| 96 | #define RCC_MC_AHB6LPENCLRR U(0x39C) |
Yann Gautier | 4b0c72a | 2018-07-16 10:54:09 +0200 | [diff] [blame] | 97 | #define RCC_BR_RSTSCLRR U(0x400) |
| 98 | #define RCC_MP_GRSTCSETR U(0x404) |
| 99 | #define RCC_MP_RSTSCLRR U(0x408) |
| 100 | #define RCC_MP_IWDGFZSETR U(0x40C) |
| 101 | #define RCC_MP_IWDGFZCLRR U(0x410) |
| 102 | #define RCC_MP_CIER U(0x414) |
| 103 | #define RCC_MP_CIFR U(0x418) |
| 104 | #define RCC_PWRLPDLYCR U(0x41C) |
| 105 | #define RCC_MP_RSTSSETR U(0x420) |
| 106 | #define RCC_MCO1CFGR U(0x800) |
| 107 | #define RCC_MCO2CFGR U(0x804) |
| 108 | #define RCC_OCRDYR U(0x808) |
| 109 | #define RCC_DBGCFGR U(0x80C) |
| 110 | #define RCC_RCK3SELR U(0x820) |
| 111 | #define RCC_RCK4SELR U(0x824) |
| 112 | #define RCC_TIMG1PRER U(0x828) |
| 113 | #define RCC_TIMG2PRER U(0x82C) |
Yann Gautier | ed34232 | 2019-02-15 17:33:27 +0100 | [diff] [blame] | 114 | #define RCC_MCUDIVR U(0x830) |
Yann Gautier | 4b0c72a | 2018-07-16 10:54:09 +0200 | [diff] [blame] | 115 | #define RCC_APB1DIVR U(0x834) |
| 116 | #define RCC_APB2DIVR U(0x838) |
| 117 | #define RCC_APB3DIVR U(0x83C) |
| 118 | #define RCC_PLL3CR U(0x880) |
| 119 | #define RCC_PLL3CFGR1 U(0x884) |
| 120 | #define RCC_PLL3CFGR2 U(0x888) |
| 121 | #define RCC_PLL3FRACR U(0x88C) |
| 122 | #define RCC_PLL3CSGR U(0x890) |
| 123 | #define RCC_PLL4CR U(0x894) |
| 124 | #define RCC_PLL4CFGR1 U(0x898) |
| 125 | #define RCC_PLL4CFGR2 U(0x89C) |
| 126 | #define RCC_PLL4FRACR U(0x8A0) |
| 127 | #define RCC_PLL4CSGR U(0x8A4) |
| 128 | #define RCC_I2C12CKSELR U(0x8C0) |
| 129 | #define RCC_I2C35CKSELR U(0x8C4) |
| 130 | #define RCC_SAI1CKSELR U(0x8C8) |
| 131 | #define RCC_SAI2CKSELR U(0x8CC) |
| 132 | #define RCC_SAI3CKSELR U(0x8D0) |
| 133 | #define RCC_SAI4CKSELR U(0x8D4) |
| 134 | #define RCC_SPI2S1CKSELR U(0x8D8) |
| 135 | #define RCC_SPI2S23CKSELR U(0x8DC) |
| 136 | #define RCC_SPI45CKSELR U(0x8E0) |
| 137 | #define RCC_UART6CKSELR U(0x8E4) |
| 138 | #define RCC_UART24CKSELR U(0x8E8) |
| 139 | #define RCC_UART35CKSELR U(0x8EC) |
| 140 | #define RCC_UART78CKSELR U(0x8F0) |
| 141 | #define RCC_SDMMC12CKSELR U(0x8F4) |
| 142 | #define RCC_SDMMC3CKSELR U(0x8F8) |
| 143 | #define RCC_ETHCKSELR U(0x8FC) |
| 144 | #define RCC_QSPICKSELR U(0x900) |
| 145 | #define RCC_FMCCKSELR U(0x904) |
| 146 | #define RCC_FDCANCKSELR U(0x90C) |
| 147 | #define RCC_SPDIFCKSELR U(0x914) |
| 148 | #define RCC_CECCKSELR U(0x918) |
| 149 | #define RCC_USBCKSELR U(0x91C) |
| 150 | #define RCC_RNG2CKSELR U(0x920) |
| 151 | #define RCC_DSICKSELR U(0x924) |
| 152 | #define RCC_ADCCKSELR U(0x928) |
| 153 | #define RCC_LPTIM45CKSELR U(0x92C) |
| 154 | #define RCC_LPTIM23CKSELR U(0x930) |
| 155 | #define RCC_LPTIM1CKSELR U(0x934) |
| 156 | #define RCC_APB1RSTSETR U(0x980) |
| 157 | #define RCC_APB1RSTCLRR U(0x984) |
| 158 | #define RCC_APB2RSTSETR U(0x988) |
| 159 | #define RCC_APB2RSTCLRR U(0x98C) |
| 160 | #define RCC_APB3RSTSETR U(0x990) |
| 161 | #define RCC_APB3RSTCLRR U(0x994) |
| 162 | #define RCC_AHB2RSTSETR U(0x998) |
| 163 | #define RCC_AHB2RSTCLRR U(0x99C) |
| 164 | #define RCC_AHB3RSTSETR U(0x9A0) |
| 165 | #define RCC_AHB3RSTCLRR U(0x9A4) |
| 166 | #define RCC_AHB4RSTSETR U(0x9A8) |
| 167 | #define RCC_AHB4RSTCLRR U(0x9AC) |
| 168 | #define RCC_MP_APB1ENSETR U(0xA00) |
| 169 | #define RCC_MP_APB1ENCLRR U(0xA04) |
| 170 | #define RCC_MP_APB2ENSETR U(0xA08) |
| 171 | #define RCC_MP_APB2ENCLRR U(0xA0C) |
| 172 | #define RCC_MP_APB3ENSETR U(0xA10) |
| 173 | #define RCC_MP_APB3ENCLRR U(0xA14) |
| 174 | #define RCC_MP_AHB2ENSETR U(0xA18) |
| 175 | #define RCC_MP_AHB2ENCLRR U(0xA1C) |
| 176 | #define RCC_MP_AHB3ENSETR U(0xA20) |
| 177 | #define RCC_MP_AHB3ENCLRR U(0xA24) |
| 178 | #define RCC_MP_AHB4ENSETR U(0xA28) |
| 179 | #define RCC_MP_AHB4ENCLRR U(0xA2C) |
| 180 | #define RCC_MP_MLAHBENSETR U(0xA38) |
| 181 | #define RCC_MP_MLAHBENCLRR U(0xA3C) |
Yann Gautier | 1a3fc9f | 2019-01-17 14:35:22 +0100 | [diff] [blame] | 182 | #define RCC_MC_APB1ENSETR U(0xA80) |
| 183 | #define RCC_MC_APB1ENCLRR U(0xA84) |
| 184 | #define RCC_MC_APB2ENSETR U(0xA88) |
| 185 | #define RCC_MC_APB2ENCLRR U(0xA8C) |
| 186 | #define RCC_MC_APB3ENSETR U(0xA90) |
| 187 | #define RCC_MC_APB3ENCLRR U(0xA94) |
| 188 | #define RCC_MC_AHB2ENSETR U(0xA98) |
| 189 | #define RCC_MC_AHB2ENCLRR U(0xA9C) |
| 190 | #define RCC_MC_AHB3ENSETR U(0xAA0) |
| 191 | #define RCC_MC_AHB3ENCLRR U(0xAA4) |
| 192 | #define RCC_MC_AHB4ENSETR U(0xAA8) |
| 193 | #define RCC_MC_AHB4ENCLRR U(0xAAC) |
| 194 | #define RCC_MC_AXIMENSETR U(0xAB0) |
| 195 | #define RCC_MC_AXIMENCLRR U(0xAB4) |
| 196 | #define RCC_MC_MLAHBENSETR U(0xAB8) |
| 197 | #define RCC_MC_MLAHBENCLRR U(0xABC) |
Yann Gautier | 4b0c72a | 2018-07-16 10:54:09 +0200 | [diff] [blame] | 198 | #define RCC_MP_APB1LPENSETR U(0xB00) |
| 199 | #define RCC_MP_APB1LPENCLRR U(0xB04) |
| 200 | #define RCC_MP_APB2LPENSETR U(0xB08) |
| 201 | #define RCC_MP_APB2LPENCLRR U(0xB0C) |
| 202 | #define RCC_MP_APB3LPENSETR U(0xB10) |
| 203 | #define RCC_MP_APB3LPENCLRR U(0xB14) |
| 204 | #define RCC_MP_AHB2LPENSETR U(0xB18) |
| 205 | #define RCC_MP_AHB2LPENCLRR U(0xB1C) |
| 206 | #define RCC_MP_AHB3LPENSETR U(0xB20) |
| 207 | #define RCC_MP_AHB3LPENCLRR U(0xB24) |
| 208 | #define RCC_MP_AHB4LPENSETR U(0xB28) |
| 209 | #define RCC_MP_AHB4LPENCLRR U(0xB2C) |
| 210 | #define RCC_MP_AXIMLPENSETR U(0xB30) |
| 211 | #define RCC_MP_AXIMLPENCLRR U(0xB34) |
| 212 | #define RCC_MP_MLAHBLPENSETR U(0xB38) |
| 213 | #define RCC_MP_MLAHBLPENCLRR U(0xB3C) |
Yann Gautier | 1a3fc9f | 2019-01-17 14:35:22 +0100 | [diff] [blame] | 214 | #define RCC_MC_APB1LPENSETR U(0xB80) |
| 215 | #define RCC_MC_APB1LPENCLRR U(0xB84) |
| 216 | #define RCC_MC_APB2LPENSETR U(0xB88) |
| 217 | #define RCC_MC_APB2LPENCLRR U(0xB8C) |
| 218 | #define RCC_MC_APB3LPENSETR U(0xB90) |
| 219 | #define RCC_MC_APB3LPENCLRR U(0xB94) |
| 220 | #define RCC_MC_AHB2LPENSETR U(0xB98) |
| 221 | #define RCC_MC_AHB2LPENCLRR U(0xB9C) |
| 222 | #define RCC_MC_AHB3LPENSETR U(0xBA0) |
| 223 | #define RCC_MC_AHB3LPENCLRR U(0xBA4) |
| 224 | #define RCC_MC_AHB4LPENSETR U(0xBA8) |
| 225 | #define RCC_MC_AHB4LPENCLRR U(0xBAC) |
| 226 | #define RCC_MC_AXIMLPENSETR U(0xBB0) |
| 227 | #define RCC_MC_AXIMLPENCLRR U(0xBB4) |
| 228 | #define RCC_MC_MLAHBLPENSETR U(0xBB8) |
| 229 | #define RCC_MC_MLAHBLPENCLRR U(0xBBC) |
| 230 | #define RCC_MC_RSTSCLRR U(0xC00) |
| 231 | #define RCC_MC_CIER U(0xC14) |
| 232 | #define RCC_MC_CIFR U(0xC18) |
Yann Gautier | 4b0c72a | 2018-07-16 10:54:09 +0200 | [diff] [blame] | 233 | #define RCC_VERR U(0xFF4) |
| 234 | #define RCC_IDR U(0xFF8) |
| 235 | #define RCC_SIDR U(0xFFC) |
| 236 | |
Yann Gautier | 1a3fc9f | 2019-01-17 14:35:22 +0100 | [diff] [blame] | 237 | #define RCC_OFFSET_MASK GENMASK(11, 0) |
| 238 | |
Yann Gautier | 4b0c72a | 2018-07-16 10:54:09 +0200 | [diff] [blame] | 239 | /* Values for RCC_TZCR register */ |
| 240 | #define RCC_TZCR_TZEN BIT(0) |
Yann Gautier | ed34232 | 2019-02-15 17:33:27 +0100 | [diff] [blame] | 241 | #define RCC_TZCR_MCKPROT BIT(1) |
Yann Gautier | 4b0c72a | 2018-07-16 10:54:09 +0200 | [diff] [blame] | 242 | |
| 243 | /* Used for most of RCC_<x>SELR registers */ |
| 244 | #define RCC_SELR_SRC_MASK GENMASK(2, 0) |
| 245 | #define RCC_SELR_REFCLK_SRC_MASK GENMASK(1, 0) |
| 246 | #define RCC_SELR_SRCRDY BIT(31) |
| 247 | |
| 248 | /* Values of RCC_MPCKSELR register */ |
| 249 | #define RCC_MPCKSELR_HSI 0x00000000 |
| 250 | #define RCC_MPCKSELR_HSE 0x00000001 |
| 251 | #define RCC_MPCKSELR_PLL 0x00000002 |
| 252 | #define RCC_MPCKSELR_PLL_MPUDIV 0x00000003 |
| 253 | |
| 254 | /* Values of RCC_ASSCKSELR register */ |
| 255 | #define RCC_ASSCKSELR_HSI 0x00000000 |
| 256 | #define RCC_ASSCKSELR_HSE 0x00000001 |
| 257 | #define RCC_ASSCKSELR_PLL 0x00000002 |
| 258 | |
| 259 | /* Values of RCC_MSSCKSELR register */ |
| 260 | #define RCC_MSSCKSELR_HSI 0x00000000 |
| 261 | #define RCC_MSSCKSELR_HSE 0x00000001 |
| 262 | #define RCC_MSSCKSELR_CSI 0x00000002 |
| 263 | #define RCC_MSSCKSELR_PLL 0x00000003 |
| 264 | |
| 265 | /* Values of RCC_CPERCKSELR register */ |
| 266 | #define RCC_CPERCKSELR_HSI 0x00000000 |
| 267 | #define RCC_CPERCKSELR_CSI 0x00000001 |
| 268 | #define RCC_CPERCKSELR_HSE 0x00000002 |
| 269 | |
| 270 | /* Used for most of DIVR register: max div for RTC */ |
| 271 | #define RCC_DIVR_DIV_MASK GENMASK(5, 0) |
| 272 | #define RCC_DIVR_DIVRDY BIT(31) |
| 273 | |
| 274 | /* Masks for specific DIVR registers */ |
| 275 | #define RCC_APBXDIV_MASK GENMASK(2, 0) |
| 276 | #define RCC_MPUDIV_MASK GENMASK(2, 0) |
| 277 | #define RCC_AXIDIV_MASK GENMASK(2, 0) |
Yann Gautier | ed34232 | 2019-02-15 17:33:27 +0100 | [diff] [blame] | 278 | #define RCC_MCUDIV_MASK GENMASK(3, 0) |
Yann Gautier | 4b0c72a | 2018-07-16 10:54:09 +0200 | [diff] [blame] | 279 | |
Yann Gautier | 1a3fc9f | 2019-01-17 14:35:22 +0100 | [diff] [blame] | 280 | /* Used for TIMER Prescaler */ |
| 281 | #define RCC_TIMGXPRER_TIMGXPRE BIT(0) |
| 282 | |
Yann Gautier | 4b0c72a | 2018-07-16 10:54:09 +0200 | [diff] [blame] | 283 | /* Offset between RCC_MP_xxxENSETR and RCC_MP_xxxENCLRR registers */ |
| 284 | #define RCC_MP_ENCLRR_OFFSET U(4) |
| 285 | |
Yann Gautier | 33b1be4 | 2019-02-14 09:17:55 +0100 | [diff] [blame] | 286 | /* Offset between RCC_xxxRSTSETR and RCC_xxxRSTCLRR registers */ |
| 287 | #define RCC_RSTCLRR_OFFSET U(4) |
| 288 | |
Yann Gautier | 4b0c72a | 2018-07-16 10:54:09 +0200 | [diff] [blame] | 289 | /* Fields of RCC_BDCR register */ |
| 290 | #define RCC_BDCR_LSEON BIT(0) |
| 291 | #define RCC_BDCR_LSEBYP BIT(1) |
| 292 | #define RCC_BDCR_LSERDY BIT(2) |
Yann Gautier | 1a3fc9f | 2019-01-17 14:35:22 +0100 | [diff] [blame] | 293 | #define RCC_BDCR_DIGBYP BIT(3) |
Yann Gautier | 4b0c72a | 2018-07-16 10:54:09 +0200 | [diff] [blame] | 294 | #define RCC_BDCR_LSEDRV_MASK GENMASK(5, 4) |
| 295 | #define RCC_BDCR_LSEDRV_SHIFT 4 |
| 296 | #define RCC_BDCR_LSECSSON BIT(8) |
| 297 | #define RCC_BDCR_RTCCKEN BIT(20) |
| 298 | #define RCC_BDCR_RTCSRC_MASK GENMASK(17, 16) |
| 299 | #define RCC_BDCR_RTCSRC_SHIFT 16 |
| 300 | #define RCC_BDCR_VSWRST BIT(31) |
| 301 | |
| 302 | /* Fields of RCC_RDLSICR register */ |
| 303 | #define RCC_RDLSICR_LSION BIT(0) |
| 304 | #define RCC_RDLSICR_LSIRDY BIT(1) |
| 305 | |
| 306 | /* Used for all RCC_PLL<n>CR registers */ |
| 307 | #define RCC_PLLNCR_PLLON BIT(0) |
| 308 | #define RCC_PLLNCR_PLLRDY BIT(1) |
Yann Gautier | 1a3fc9f | 2019-01-17 14:35:22 +0100 | [diff] [blame] | 309 | #define RCC_PLLNCR_SSCG_CTRL BIT(2) |
Yann Gautier | 4b0c72a | 2018-07-16 10:54:09 +0200 | [diff] [blame] | 310 | #define RCC_PLLNCR_DIVPEN BIT(4) |
| 311 | #define RCC_PLLNCR_DIVQEN BIT(5) |
| 312 | #define RCC_PLLNCR_DIVREN BIT(6) |
| 313 | #define RCC_PLLNCR_DIVEN_SHIFT 4 |
| 314 | |
| 315 | /* Used for all RCC_PLL<n>CFGR1 registers */ |
| 316 | #define RCC_PLLNCFGR1_DIVM_SHIFT 16 |
| 317 | #define RCC_PLLNCFGR1_DIVM_MASK GENMASK(21, 16) |
| 318 | #define RCC_PLLNCFGR1_DIVN_SHIFT 0 |
| 319 | #define RCC_PLLNCFGR1_DIVN_MASK GENMASK(8, 0) |
| 320 | /* Only for PLL3 and PLL4 */ |
| 321 | #define RCC_PLLNCFGR1_IFRGE_SHIFT 24 |
| 322 | #define RCC_PLLNCFGR1_IFRGE_MASK GENMASK(25, 24) |
| 323 | |
| 324 | /* Used for all RCC_PLL<n>CFGR2 registers */ |
| 325 | #define RCC_PLLNCFGR2_DIVX_MASK GENMASK(6, 0) |
| 326 | #define RCC_PLLNCFGR2_DIVP_SHIFT 0 |
| 327 | #define RCC_PLLNCFGR2_DIVP_MASK GENMASK(6, 0) |
| 328 | #define RCC_PLLNCFGR2_DIVQ_SHIFT 8 |
| 329 | #define RCC_PLLNCFGR2_DIVQ_MASK GENMASK(14, 8) |
| 330 | #define RCC_PLLNCFGR2_DIVR_SHIFT 16 |
| 331 | #define RCC_PLLNCFGR2_DIVR_MASK GENMASK(22, 16) |
| 332 | |
| 333 | /* Used for all RCC_PLL<n>FRACR registers */ |
| 334 | #define RCC_PLLNFRACR_FRACV_SHIFT 3 |
| 335 | #define RCC_PLLNFRACR_FRACV_MASK GENMASK(15, 3) |
| 336 | #define RCC_PLLNFRACR_FRACLE BIT(16) |
| 337 | |
| 338 | /* Used for all RCC_PLL<n>CSGR registers */ |
| 339 | #define RCC_PLLNCSGR_INC_STEP_SHIFT 16 |
| 340 | #define RCC_PLLNCSGR_INC_STEP_MASK GENMASK(30, 16) |
| 341 | #define RCC_PLLNCSGR_MOD_PER_SHIFT 0 |
| 342 | #define RCC_PLLNCSGR_MOD_PER_MASK GENMASK(12, 0) |
| 343 | #define RCC_PLLNCSGR_SSCG_MODE_SHIFT 15 |
| 344 | #define RCC_PLLNCSGR_SSCG_MODE_MASK BIT(15) |
| 345 | |
| 346 | /* Used for RCC_OCENSETR and RCC_OCENCLRR registers */ |
| 347 | #define RCC_OCENR_HSION BIT(0) |
Yann Gautier | 1a3fc9f | 2019-01-17 14:35:22 +0100 | [diff] [blame] | 348 | #define RCC_OCENR_HSIKERON BIT(1) |
Yann Gautier | 4b0c72a | 2018-07-16 10:54:09 +0200 | [diff] [blame] | 349 | #define RCC_OCENR_CSION BIT(4) |
Yann Gautier | 1a3fc9f | 2019-01-17 14:35:22 +0100 | [diff] [blame] | 350 | #define RCC_OCENR_CSIKERON BIT(5) |
| 351 | #define RCC_OCENR_DIGBYP BIT(7) |
Yann Gautier | 4b0c72a | 2018-07-16 10:54:09 +0200 | [diff] [blame] | 352 | #define RCC_OCENR_HSEON BIT(8) |
Yann Gautier | 1a3fc9f | 2019-01-17 14:35:22 +0100 | [diff] [blame] | 353 | #define RCC_OCENR_HSEKERON BIT(9) |
Yann Gautier | 4b0c72a | 2018-07-16 10:54:09 +0200 | [diff] [blame] | 354 | #define RCC_OCENR_HSEBYP BIT(10) |
| 355 | #define RCC_OCENR_HSECSSON BIT(11) |
| 356 | |
| 357 | /* Fields of RCC_OCRDYR register */ |
| 358 | #define RCC_OCRDYR_HSIRDY BIT(0) |
| 359 | #define RCC_OCRDYR_HSIDIVRDY BIT(2) |
| 360 | #define RCC_OCRDYR_CSIRDY BIT(4) |
| 361 | #define RCC_OCRDYR_HSERDY BIT(8) |
| 362 | |
| 363 | /* Fields of RCC_DDRITFCR register */ |
| 364 | #define RCC_DDRITFCR_DDRC1EN BIT(0) |
| 365 | #define RCC_DDRITFCR_DDRC1LPEN BIT(1) |
| 366 | #define RCC_DDRITFCR_DDRC2EN BIT(2) |
| 367 | #define RCC_DDRITFCR_DDRC2LPEN BIT(3) |
| 368 | #define RCC_DDRITFCR_DDRPHYCEN BIT(4) |
| 369 | #define RCC_DDRITFCR_DDRPHYCLPEN BIT(5) |
| 370 | #define RCC_DDRITFCR_DDRCAPBEN BIT(6) |
| 371 | #define RCC_DDRITFCR_DDRCAPBLPEN BIT(7) |
| 372 | #define RCC_DDRITFCR_AXIDCGEN BIT(8) |
| 373 | #define RCC_DDRITFCR_DDRPHYCAPBEN BIT(9) |
| 374 | #define RCC_DDRITFCR_DDRPHYCAPBLPEN BIT(10) |
| 375 | #define RCC_DDRITFCR_DDRCAPBRST BIT(14) |
| 376 | #define RCC_DDRITFCR_DDRCAXIRST BIT(15) |
| 377 | #define RCC_DDRITFCR_DDRCORERST BIT(16) |
| 378 | #define RCC_DDRITFCR_DPHYAPBRST BIT(17) |
| 379 | #define RCC_DDRITFCR_DPHYRST BIT(18) |
| 380 | #define RCC_DDRITFCR_DPHYCTLRST BIT(19) |
| 381 | #define RCC_DDRITFCR_DDRCKMOD_MASK GENMASK(22, 20) |
| 382 | #define RCC_DDRITFCR_DDRCKMOD_SHIFT 20 |
| 383 | #define RCC_DDRITFCR_DDRCKMOD_SSR 0 |
| 384 | #define RCC_DDRITFCR_DDRCKMOD_ASR1 BIT(20) |
| 385 | #define RCC_DDRITFCR_DDRCKMOD_HSR1 BIT(21) |
| 386 | #define RCC_DDRITFCR_GSKPCTRL BIT(24) |
| 387 | |
| 388 | /* Fields of RCC_HSICFGR register */ |
| 389 | #define RCC_HSICFGR_HSIDIV_MASK GENMASK(1, 0) |
Yann Gautier | 1a3fc9f | 2019-01-17 14:35:22 +0100 | [diff] [blame] | 390 | #define RCC_HSICFGR_HSITRIM_SHIFT 8 |
| 391 | #define RCC_HSICFGR_HSITRIM_MASK GENMASK(14, 8) |
| 392 | #define RCC_HSICFGR_HSICAL_SHIFT 16 |
| 393 | #define RCC_HSICFGR_HSICAL_MASK GENMASK(27, 16) |
| 394 | |
| 395 | /* Fields of RCC_CSICFGR register */ |
| 396 | #define RCC_CSICFGR_CSITRIM_SHIFT 8 |
| 397 | #define RCC_CSICFGR_CSITRIM_MASK GENMASK(12, 8) |
| 398 | #define RCC_CSICFGR_CSICAL_SHIFT 16 |
| 399 | #define RCC_CSICFGR_CSICAL_MASK GENMASK(23, 16) |
Yann Gautier | 4b0c72a | 2018-07-16 10:54:09 +0200 | [diff] [blame] | 400 | |
| 401 | /* Used for RCC_MCO related operations */ |
| 402 | #define RCC_MCOCFG_MCOON BIT(12) |
| 403 | #define RCC_MCOCFG_MCODIV_MASK GENMASK(7, 4) |
| 404 | #define RCC_MCOCFG_MCODIV_SHIFT 4 |
| 405 | #define RCC_MCOCFG_MCOSRC_MASK GENMASK(2, 0) |
| 406 | |
| 407 | /* Fields of RCC_DBGCFGR register */ |
| 408 | #define RCC_DBGCFGR_DBGCKEN BIT(8) |
| 409 | |
| 410 | /* RCC register fields for reset reasons */ |
Yann Gautier | 1a3fc9f | 2019-01-17 14:35:22 +0100 | [diff] [blame] | 411 | #define RCC_MP_RSTSCLRR_PORRSTF BIT(0) |
| 412 | #define RCC_MP_RSTSCLRR_BORRSTF BIT(1) |
| 413 | #define RCC_MP_RSTSCLRR_PADRSTF BIT(2) |
| 414 | #define RCC_MP_RSTSCLRR_HCSSRSTF BIT(3) |
| 415 | #define RCC_MP_RSTSCLRR_VCORERSTF BIT(4) |
| 416 | #define RCC_MP_RSTSCLRR_MPSYSRSTF BIT(6) |
| 417 | #define RCC_MP_RSTSCLRR_MCSYSRSTF BIT(7) |
| 418 | #define RCC_MP_RSTSCLRR_IWDG1RSTF BIT(8) |
| 419 | #define RCC_MP_RSTSCLRR_IWDG2RSTF BIT(9) |
| 420 | #define RCC_MP_RSTSCLRR_STDBYRSTF BIT(11) |
| 421 | #define RCC_MP_RSTSCLRR_CSTDBYRSTF BIT(12) |
| 422 | #define RCC_MP_RSTSCLRR_MPUP0RSTF BIT(13) |
| 423 | #define RCC_MP_RSTSCLRR_MPUP1RSTF BIT(14) |
Yann Gautier | 4b0c72a | 2018-07-16 10:54:09 +0200 | [diff] [blame] | 424 | |
| 425 | /* Global Reset Register */ |
| 426 | #define RCC_MP_GRSTCSETR_MPSYSRST BIT(0) |
Yann Gautier | ed34232 | 2019-02-15 17:33:27 +0100 | [diff] [blame] | 427 | #define RCC_MP_GRSTCSETR_MCURST BIT(1) |
Yann Gautier | 1a3fc9f | 2019-01-17 14:35:22 +0100 | [diff] [blame] | 428 | #define RCC_MP_GRSTCSETR_MPUP0RST BIT(4) |
| 429 | #define RCC_MP_GRSTCSETR_MPUP1RST BIT(5) |
Yann Gautier | 4b0c72a | 2018-07-16 10:54:09 +0200 | [diff] [blame] | 430 | |
| 431 | /* Clock Source Interrupt Flag Register */ |
| 432 | #define RCC_MP_CIFR_MASK U(0x110F1F) |
Yann Gautier | 1a3fc9f | 2019-01-17 14:35:22 +0100 | [diff] [blame] | 433 | #define RCC_MP_CIFR_LSIRDYF BIT(0) |
| 434 | #define RCC_MP_CIFR_LSERDYF BIT(1) |
| 435 | #define RCC_MP_CIFR_HSIRDYF BIT(2) |
| 436 | #define RCC_MP_CIFR_HSERDYF BIT(3) |
| 437 | #define RCC_MP_CIFR_CSIRDYF BIT(4) |
| 438 | #define RCC_MP_CIFR_PLL1DYF BIT(8) |
| 439 | #define RCC_MP_CIFR_PLL2DYF BIT(9) |
| 440 | #define RCC_MP_CIFR_PLL3DYF BIT(10) |
| 441 | #define RCC_MP_CIFR_PLL4DYF BIT(11) |
Yann Gautier | 4b0c72a | 2018-07-16 10:54:09 +0200 | [diff] [blame] | 442 | #define RCC_MP_CIFR_WKUPF BIT(20) |
| 443 | |
| 444 | /* Stop Request Set Register */ |
| 445 | #define RCC_MP_SREQSETR_STPREQ_P0 BIT(0) |
| 446 | #define RCC_MP_SREQSETR_STPREQ_P1 BIT(1) |
| 447 | |
| 448 | /* Stop Request Clear Register */ |
| 449 | #define RCC_MP_SREQCLRR_STPREQ_P0 BIT(0) |
| 450 | #define RCC_MP_SREQCLRR_STPREQ_P1 BIT(1) |
| 451 | |
| 452 | /* Values of RCC_UART24CKSELR register */ |
| 453 | #define RCC_UART24CKSELR_HSI 0x00000002 |
| 454 | |
| 455 | /* Values of RCC_MP_APB1ENSETR register */ |
| 456 | #define RCC_MP_APB1ENSETR_UART4EN BIT(16) |
| 457 | |
Yann Gautier | 1a3fc9f | 2019-01-17 14:35:22 +0100 | [diff] [blame] | 458 | /* Values of RCC_MP_APB5ENSETR register */ |
| 459 | #define RCC_MP_APB5ENSETR_SPI6EN BIT(0) |
| 460 | #define RCC_MP_APB5ENSETR_I2C4EN BIT(2) |
| 461 | #define RCC_MP_APB5ENSETR_I2C6EN BIT(3) |
| 462 | #define RCC_MP_APB5ENSETR_USART1EN BIT(4) |
| 463 | #define RCC_MP_APB5ENSETR_RTCAPBEN BIT(8) |
| 464 | #define RCC_MP_APB5ENSETR_IWDG1APBEN BIT(15) |
| 465 | |
Yann Gautier | 4b0c72a | 2018-07-16 10:54:09 +0200 | [diff] [blame] | 466 | /* Values of RCC_MP_AHB4ENSETR register */ |
| 467 | #define RCC_MP_AHB4ENSETR_GPIOGEN BIT(6) |
Yann Gautier | 1a3fc9f | 2019-01-17 14:35:22 +0100 | [diff] [blame] | 468 | #define RCC_MP_AHB4ENSETR_GPIOHEN BIT(7) |
| 469 | |
| 470 | /* Values of RCC_MP_AHB5ENSETR register */ |
| 471 | #define RCC_MP_AHB5ENSETR_GPIOZEN BIT(0) |
| 472 | #define RCC_MP_AHB5ENSETR_CRYP1EN BIT(4) |
| 473 | #define RCC_MP_AHB5ENSETR_HASH1EN BIT(5) |
| 474 | #define RCC_MP_AHB5ENSETR_RNG1EN BIT(6) |
| 475 | |
| 476 | /* Values of RCC_MP_IWDGFZSETR register */ |
| 477 | #define RCC_MP_IWDGFZSETR_IWDG1 BIT(0) |
| 478 | #define RCC_MP_IWDGFZSETR_IWDG2 BIT(1) |
| 479 | |
| 480 | /* Values of RCC_PWRLPDLYCR register */ |
| 481 | #define RCC_PWRLPDLYCR_PWRLP_DLY_MASK GENMASK(21, 0) |
Yann Gautier | 4b0c72a | 2018-07-16 10:54:09 +0200 | [diff] [blame] | 482 | |
Antonio Nino Diaz | 5eb8837 | 2018-11-08 10:20:19 +0000 | [diff] [blame] | 483 | #endif /* STM32MP1_RCC_H */ |