1 /* 2 * (C) Copyright 2013 3 * NVIDIA Corporation <www.nvidia.com> 4 * 5 * SPDX-License-Identifier: GPL-2.0+ 6 */ 7 8 /* Tegra124 clock PLL tables */ 9 10 #ifndef _TEGRA124_CLOCK_TABLES_H_ 11 #define _TEGRA124_CLOCK_TABLES_H_ 12 13 /* The PLLs supported by the hardware */ 14 enum clock_id { 15 CLOCK_ID_FIRST, 16 CLOCK_ID_CGENERAL = CLOCK_ID_FIRST, 17 CLOCK_ID_MEMORY, 18 CLOCK_ID_PERIPH, 19 CLOCK_ID_AUDIO, 20 CLOCK_ID_USB, 21 CLOCK_ID_DISPLAY, 22 23 /* now the simple ones */ 24 CLOCK_ID_FIRST_SIMPLE, 25 CLOCK_ID_XCPU = CLOCK_ID_FIRST_SIMPLE, 26 CLOCK_ID_EPCI, 27 CLOCK_ID_SFROM32KHZ, 28 CLOCK_ID_DP, /* Special for Tegra124 */ 29 30 /* These are the base clocks (inputs to the Tegra SoC) */ 31 CLOCK_ID_32KHZ, 32 CLOCK_ID_OSC, 33 CLOCK_ID_CLK_M, 34 35 CLOCK_ID_COUNT, /* number of PLLs */ 36 37 /* 38 * These are clock IDs that are used in table clock_source[][] 39 * but will not be assigned as a clock source for any peripheral. 40 */ 41 CLOCK_ID_DISPLAY2, 42 CLOCK_ID_CGENERAL2, 43 CLOCK_ID_CGENERAL3, 44 CLOCK_ID_MEMORY2, 45 CLOCK_ID_SRC2, 46 47 CLOCK_ID_NONE = -1, 48 }; 49 50 /* The clocks supported by the hardware */ 51 enum periph_id { 52 PERIPH_ID_FIRST, 53 54 /* Low word: 31:0 (DEVICES_L) */ 55 PERIPH_ID_CPU = PERIPH_ID_FIRST, 56 PERIPH_ID_COP, 57 PERIPH_ID_TRIGSYS, 58 PERIPH_ID_ISPB, 59 PERIPH_ID_RESERVED4, 60 PERIPH_ID_TMR, 61 PERIPH_ID_UART1, 62 PERIPH_ID_UART2, 63 64 /* 8 */ 65 PERIPH_ID_GPIO, 66 PERIPH_ID_SDMMC2, 67 PERIPH_ID_SPDIF, 68 PERIPH_ID_I2S1, 69 PERIPH_ID_I2C1, 70 PERIPH_ID_RESERVED13, 71 PERIPH_ID_SDMMC1, 72 PERIPH_ID_SDMMC4, 73 74 /* 16 */ 75 PERIPH_ID_TCW, 76 PERIPH_ID_PWM, 77 PERIPH_ID_I2S2, 78 PERIPH_ID_RESERVED19, 79 PERIPH_ID_VI, 80 PERIPH_ID_RESERVED21, 81 PERIPH_ID_USBD, 82 PERIPH_ID_ISP, 83 84 /* 24 */ 85 PERIPH_ID_RESERVED24, 86 PERIPH_ID_RESERVED25, 87 PERIPH_ID_DISP2, 88 PERIPH_ID_DISP1, 89 PERIPH_ID_HOST1X, 90 PERIPH_ID_VCP, 91 PERIPH_ID_I2S0, 92 PERIPH_ID_CACHE2, 93 94 /* Middle word: 63:32 (DEVICES_H) */ 95 PERIPH_ID_MEM, 96 PERIPH_ID_AHBDMA, 97 PERIPH_ID_APBDMA, 98 PERIPH_ID_RESERVED35, 99 PERIPH_ID_RESERVED36, 100 PERIPH_ID_STAT_MON, 101 PERIPH_ID_RESERVED38, 102 PERIPH_ID_FUSE, 103 104 /* 40 */ 105 PERIPH_ID_KFUSE, 106 PERIPH_ID_SBC1, 107 PERIPH_ID_SNOR, 108 PERIPH_ID_RESERVED43, 109 PERIPH_ID_SBC2, 110 PERIPH_ID_XIO, 111 PERIPH_ID_SBC3, 112 PERIPH_ID_I2C5, 113 114 /* 48 */ 115 PERIPH_ID_DSI, 116 PERIPH_ID_RESERVED49, 117 PERIPH_ID_HSI, 118 PERIPH_ID_HDMI, 119 PERIPH_ID_CSI, 120 PERIPH_ID_RESERVED53, 121 PERIPH_ID_I2C2, 122 PERIPH_ID_UART3, 123 124 /* 56 */ 125 PERIPH_ID_MIPI_CAL, 126 PERIPH_ID_EMC, 127 PERIPH_ID_USB2, 128 PERIPH_ID_USB3, 129 PERIPH_ID_RESERVED60, 130 PERIPH_ID_VDE, 131 PERIPH_ID_BSEA, 132 PERIPH_ID_BSEV, 133 134 /* Upper word 95:64 (DEVICES_U) */ 135 PERIPH_ID_RESERVED64, 136 PERIPH_ID_UART4, 137 PERIPH_ID_UART5, 138 PERIPH_ID_I2C3, 139 PERIPH_ID_SBC4, 140 PERIPH_ID_SDMMC3, 141 PERIPH_ID_PCIE, 142 PERIPH_ID_OWR, 143 144 /* 72 */ 145 PERIPH_ID_AFI, 146 PERIPH_ID_CORESIGHT, 147 PERIPH_ID_PCIEXCLK, 148 PERIPH_ID_AVPUCQ, 149 PERIPH_ID_LA, 150 PERIPH_ID_TRACECLKIN, 151 PERIPH_ID_SOC_THERM, 152 PERIPH_ID_DTV, 153 154 /* 80 */ 155 PERIPH_ID_RESERVED80, 156 PERIPH_ID_I2CSLOW, 157 PERIPH_ID_DSIB, 158 PERIPH_ID_TSEC, 159 PERIPH_ID_RESERVED84, 160 PERIPH_ID_RESERVED85, 161 PERIPH_ID_RESERVED86, 162 PERIPH_ID_EMUCIF, 163 164 /* 88 */ 165 PERIPH_ID_RESERVED88, 166 PERIPH_ID_XUSB_HOST, 167 PERIPH_ID_RESERVED90, 168 PERIPH_ID_MSENC, 169 PERIPH_ID_RESERVED92, 170 PERIPH_ID_RESERVED93, 171 PERIPH_ID_RESERVED94, 172 PERIPH_ID_XUSB_DEV, 173 174 PERIPH_ID_VW_FIRST, 175 /* V word: 31:0 */ 176 PERIPH_ID_CPUG = PERIPH_ID_VW_FIRST, 177 PERIPH_ID_CPULP, 178 PERIPH_ID_V_RESERVED2, 179 PERIPH_ID_MSELECT, 180 PERIPH_ID_V_RESERVED4, 181 PERIPH_ID_I2S3, 182 PERIPH_ID_I2S4, 183 PERIPH_ID_I2C4, 184 185 /* 104 */ 186 PERIPH_ID_SBC5, 187 PERIPH_ID_SBC6, 188 PERIPH_ID_AUDIO, 189 PERIPH_ID_APBIF, 190 PERIPH_ID_DAM0, 191 PERIPH_ID_DAM1, 192 PERIPH_ID_DAM2, 193 PERIPH_ID_HDA2CODEC2X, 194 195 /* 112 */ 196 PERIPH_ID_ATOMICS, 197 PERIPH_ID_V_RESERVED17, 198 PERIPH_ID_V_RESERVED18, 199 PERIPH_ID_V_RESERVED19, 200 PERIPH_ID_V_RESERVED20, 201 PERIPH_ID_V_RESERVED21, 202 PERIPH_ID_V_RESERVED22, 203 PERIPH_ID_ACTMON, 204 205 /* 120 */ 206 PERIPH_ID_EXTPERIPH1, 207 PERIPH_ID_EXTPERIPH2, 208 PERIPH_ID_EXTPERIPH3, 209 PERIPH_ID_OOB, 210 PERIPH_ID_SATA, 211 PERIPH_ID_HDA, 212 PERIPH_ID_V_RESERVED30, 213 PERIPH_ID_V_RESERVED31, 214 215 /* W word: 31:0 */ 216 PERIPH_ID_HDA2HDMICODEC, 217 PERIPH_ID_SATACOLD, 218 PERIPH_ID_W_RESERVED2, 219 PERIPH_ID_W_RESERVED3, 220 PERIPH_ID_W_RESERVED4, 221 PERIPH_ID_W_RESERVED5, 222 PERIPH_ID_W_RESERVED6, 223 PERIPH_ID_W_RESERVED7, 224 225 /* 136 */ 226 PERIPH_ID_CEC, 227 PERIPH_ID_W_RESERVED9, 228 PERIPH_ID_W_RESERVED10, 229 PERIPH_ID_W_RESERVED11, 230 PERIPH_ID_W_RESERVED12, 231 PERIPH_ID_W_RESERVED13, 232 PERIPH_ID_XUSB_PADCTL, 233 PERIPH_ID_W_RESERVED15, 234 235 /* 144 */ 236 PERIPH_ID_W_RESERVED16, 237 PERIPH_ID_W_RESERVED17, 238 PERIPH_ID_W_RESERVED18, 239 PERIPH_ID_W_RESERVED19, 240 PERIPH_ID_W_RESERVED20, 241 PERIPH_ID_ENTROPY, 242 PERIPH_ID_DDS, 243 PERIPH_ID_W_RESERVED23, 244 245 /* 152 */ 246 PERIPH_ID_DP2, 247 PERIPH_ID_AMX0, 248 PERIPH_ID_ADX0, 249 PERIPH_ID_DVFS, 250 PERIPH_ID_XUSB_SS, 251 PERIPH_ID_W_RESERVED29, 252 PERIPH_ID_W_RESERVED30, 253 PERIPH_ID_W_RESERVED31, 254 255 PERIPH_ID_X_FIRST, 256 /* X word: 31:0 */ 257 PERIPH_ID_SPARE = PERIPH_ID_X_FIRST, 258 PERIPH_ID_X_RESERVED1, 259 PERIPH_ID_X_RESERVED2, 260 PERIPH_ID_X_RESERVED3, 261 PERIPH_ID_CAM_MCLK, 262 PERIPH_ID_CAM_MCLK2, 263 PERIPH_ID_I2C6, 264 PERIPH_ID_X_RESERVED7, 265 266 /* 168 */ 267 PERIPH_ID_X_RESERVED8, 268 PERIPH_ID_X_RESERVED9, 269 PERIPH_ID_X_RESERVED10, 270 PERIPH_ID_VIM2_CLK, 271 PERIPH_ID_X_RESERVED12, 272 PERIPH_ID_X_RESERVED13, 273 PERIPH_ID_EMC_DLL, 274 PERIPH_ID_X_RESERVED15, 275 276 /* 176 */ 277 PERIPH_ID_HDMI_AUDIO, 278 PERIPH_ID_CLK72MHZ, 279 PERIPH_ID_VIC, 280 PERIPH_ID_X_RESERVED19, 281 PERIPH_ID_ADX1, 282 PERIPH_ID_DPAUX, 283 PERIPH_ID_SOR0, 284 PERIPH_ID_X_RESERVED23, 285 286 /* 184 */ 287 PERIPH_ID_GPU, 288 PERIPH_ID_AMX1, 289 PERIPH_ID_AFC5, 290 PERIPH_ID_AFC4, 291 PERIPH_ID_AFC3, 292 PERIPH_ID_AFC2, 293 PERIPH_ID_AFC1, 294 PERIPH_ID_AFC0, 295 296 PERIPH_ID_COUNT, 297 PERIPH_ID_NONE = -1, 298 }; 299 300 enum pll_out_id { 301 PLL_OUT1, 302 PLL_OUT2, 303 PLL_OUT3, 304 PLL_OUT4 305 }; 306 307 /* 308 * Clock peripheral IDs which sadly don't match up with PERIPH_ID. we want 309 * callers to use the PERIPH_ID for all access to peripheral clocks to avoid 310 * confusion bewteen PERIPH_ID_... and PERIPHC_... 311 * 312 * We don't call this CLOCK_PERIPH_ID or PERIPH_CLOCK_ID as it would just be 313 * confusing. 314 */ 315 enum periphc_internal_id { 316 /* 0x00 */ 317 PERIPHC_I2S1, 318 PERIPHC_I2S2, 319 PERIPHC_SPDIF_OUT, 320 PERIPHC_SPDIF_IN, 321 PERIPHC_PWM, 322 PERIPHC_05h, 323 PERIPHC_SBC2, 324 PERIPHC_SBC3, 325 326 /* 0x08 */ 327 PERIPHC_08h, 328 PERIPHC_I2C1, 329 PERIPHC_I2C5, 330 PERIPHC_0bh, 331 PERIPHC_0ch, 332 PERIPHC_SBC1, 333 PERIPHC_DISP1, 334 PERIPHC_DISP2, 335 336 /* 0x10 */ 337 PERIPHC_10h, 338 PERIPHC_11h, 339 PERIPHC_VI, 340 PERIPHC_13h, 341 PERIPHC_SDMMC1, 342 PERIPHC_SDMMC2, 343 PERIPHC_G3D, 344 PERIPHC_G2D, 345 346 /* 0x18 */ 347 PERIPHC_18h, 348 PERIPHC_SDMMC4, 349 PERIPHC_VFIR, 350 PERIPHC_1Bh, 351 PERIPHC_1Ch, 352 PERIPHC_HSI, 353 PERIPHC_UART1, 354 PERIPHC_UART2, 355 356 /* 0x20 */ 357 PERIPHC_HOST1X, 358 PERIPHC_21h, 359 PERIPHC_22h, 360 PERIPHC_HDMI, 361 PERIPHC_24h, 362 PERIPHC_25h, 363 PERIPHC_I2C2, 364 PERIPHC_EMC, 365 366 /* 0x28 */ 367 PERIPHC_UART3, 368 PERIPHC_29h, 369 PERIPHC_VI_SENSOR, 370 PERIPHC_2bh, 371 PERIPHC_2ch, 372 PERIPHC_SBC4, 373 PERIPHC_I2C3, 374 PERIPHC_SDMMC3, 375 376 /* 0x30 */ 377 PERIPHC_UART4, 378 PERIPHC_UART5, 379 PERIPHC_VDE, 380 PERIPHC_OWR, 381 PERIPHC_NOR, 382 PERIPHC_CSITE, 383 PERIPHC_I2S0, 384 PERIPHC_DTV, 385 386 /* 0x38 */ 387 PERIPHC_38h, 388 PERIPHC_39h, 389 PERIPHC_3ah, 390 PERIPHC_3bh, 391 PERIPHC_MSENC, 392 PERIPHC_TSEC, 393 PERIPHC_3eh, 394 PERIPHC_OSC, 395 396 PERIPHC_VW_FIRST, 397 /* 0x40 */ 398 PERIPHC_40h = PERIPHC_VW_FIRST, 399 PERIPHC_MSELECT, 400 PERIPHC_TSENSOR, 401 PERIPHC_I2S3, 402 PERIPHC_I2S4, 403 PERIPHC_I2C4, 404 PERIPHC_SBC5, 405 PERIPHC_SBC6, 406 407 /* 0x48 */ 408 PERIPHC_AUDIO, 409 PERIPHC_49h, 410 PERIPHC_DAM0, 411 PERIPHC_DAM1, 412 PERIPHC_DAM2, 413 PERIPHC_HDA2CODEC2X, 414 PERIPHC_ACTMON, 415 PERIPHC_EXTPERIPH1, 416 417 /* 0x50 */ 418 PERIPHC_EXTPERIPH2, 419 PERIPHC_EXTPERIPH3, 420 PERIPHC_52h, 421 PERIPHC_I2CSLOW, 422 PERIPHC_SYS, 423 PERIPHC_55h, 424 PERIPHC_56h, 425 PERIPHC_57h, 426 427 /* 0x58 */ 428 PERIPHC_58h, 429 PERIPHC_SOR, 430 PERIPHC_5ah, 431 PERIPHC_5bh, 432 PERIPHC_SATAOOB, 433 PERIPHC_SATA, 434 PERIPHC_HDA, /* 0x428 */ 435 PERIPHC_5fh, 436 437 PERIPHC_X_FIRST, 438 /* 0x60 */ 439 PERIPHC_XUSB_CORE_HOST = PERIPHC_X_FIRST, /* 0x600 */ 440 PERIPHC_XUSB_FALCON, 441 PERIPHC_XUSB_FS, 442 PERIPHC_XUSB_CORE_DEV, 443 PERIPHC_XUSB_SS, 444 PERIPHC_CILAB, 445 PERIPHC_CILCD, 446 PERIPHC_CILE, 447 448 /* 0x68 */ 449 PERIPHC_DSIA_LP, 450 PERIPHC_DSIB_LP, 451 PERIPHC_ENTROPY, 452 PERIPHC_DVFS_REF, 453 PERIPHC_DVFS_SOC, 454 PERIPHC_TRACECLKIN, 455 PERIPHC_ADX0, 456 PERIPHC_AMX0, 457 458 /* 0x70 */ 459 PERIPHC_EMC_LATENCY, 460 PERIPHC_SOC_THERM, 461 PERIPHC_72h, 462 PERIPHC_73h, 463 PERIPHC_74h, 464 PERIPHC_75h, 465 PERIPHC_VI_SENSOR2, 466 PERIPHC_I2C6, 467 468 /* 0x78 */ 469 PERIPHC_78h, 470 PERIPHC_EMC_DLL, 471 PERIPHC_HDMI_AUDIO, 472 PERIPHC_CLK72MHZ, 473 PERIPHC_ADX1, 474 PERIPHC_AMX1, 475 PERIPHC_VIC, 476 PERIPHC_7fh, 477 478 PERIPHC_COUNT, 479 480 PERIPHC_NONE = -1, 481 }; 482 483 /* Converts a clock number to a clock register: 0=L, 1=H, 2=U, 0=V, 1=W */ 484 #define PERIPH_REG(id) \ 485 (id < PERIPH_ID_VW_FIRST) ? \ 486 ((id) >> 5) : ((id - PERIPH_ID_VW_FIRST) >> 5) 487 488 /* Mask value for a clock (within PERIPH_REG(id)) */ 489 #define PERIPH_MASK(id) (1 << ((id) & 0x1f)) 490 491 /* return 1 if a PLL ID is in range */ 492 #define clock_id_is_pll(id) ((id) >= CLOCK_ID_FIRST && (id) < CLOCK_ID_COUNT) 493 494 /* return 1 if a peripheral ID is in range */ 495 #define clock_periph_id_isvalid(id) ((id) >= PERIPH_ID_FIRST && \ 496 (id) < PERIPH_ID_COUNT) 497 498 #endif /* _TEGRA124_CLOCK_TABLES_H_ */ 499