2 * (C) Copyright 2010-2015
3 * NVIDIA Corporation <www.nvidia.com>
5 * SPDX-License-Identifier: GPL-2.0+
8 /* Tegra114 Clock control functions */
12 #include <asm/arch/clock.h>
13 #include <asm/arch/sysctr.h>
14 #include <asm/arch/tegra.h>
15 #include <asm/arch-tegra/clk_rst.h>
16 #include <asm/arch-tegra/timer.h>
21 * Clock types that we can use as a source. The Tegra114 has muxes for the
22 * peripheral clocks, and in most cases there are four options for the clock
23 * source. This gives us a clock 'type' and exploits what commonality exists
26 * Letters are obvious, except for T which means CLK_M, and S which means the
27 * clock derived from 32KHz. Beware that CLK_M (also called OSC in the
28 * datasheet) and PLL_M are different things. The former is the basic
29 * clock supplied to the SOC from an external oscillator. The latter is the
32 * See definitions in clock_id in the header file.
35 CLOCK_TYPE_AXPT, /* PLL_A, PLL_X, PLL_P, CLK_M */
36 CLOCK_TYPE_MCPA, /* and so on */
48 CLOCK_TYPE_NONE = -1, /* invalid clock type */
52 CLOCK_MAX_MUX = 8 /* number of source options for each clock */
56 * Clock source mux for each clock type. This just converts our enum into
57 * a list of mux sources for use by the code.
60 * The extra column in each clock source array is used to store the mask
61 * bits in its register for the source.
63 #define CLK(x) CLOCK_ID_ ## x
64 static enum clock_id clock_source[CLOCK_TYPE_COUNT][CLOCK_MAX_MUX+1] = {
65 { CLK(AUDIO), CLK(XCPU), CLK(PERIPH), CLK(OSC),
66 CLK(NONE), CLK(NONE), CLK(NONE), CLK(NONE),
68 { CLK(MEMORY), CLK(CGENERAL), CLK(PERIPH), CLK(AUDIO),
69 CLK(NONE), CLK(NONE), CLK(NONE), CLK(NONE),
71 { CLK(MEMORY), CLK(CGENERAL), CLK(PERIPH), CLK(OSC),
72 CLK(NONE), CLK(NONE), CLK(NONE), CLK(NONE),
74 { CLK(PERIPH), CLK(CGENERAL), CLK(MEMORY), CLK(NONE),
75 CLK(NONE), CLK(NONE), CLK(NONE), CLK(NONE),
77 { CLK(PERIPH), CLK(CGENERAL), CLK(MEMORY), CLK(OSC),
78 CLK(NONE), CLK(NONE), CLK(NONE), CLK(NONE),
80 { CLK(PERIPH), CLK(CGENERAL), CLK(MEMORY), CLK(OSC),
81 CLK(NONE), CLK(NONE), CLK(NONE), CLK(NONE),
83 { CLK(PERIPH), CLK(DISPLAY), CLK(CGENERAL), CLK(OSC),
84 CLK(NONE), CLK(NONE), CLK(NONE), CLK(NONE),
86 { CLK(AUDIO), CLK(CGENERAL), CLK(PERIPH), CLK(OSC),
87 CLK(NONE), CLK(NONE), CLK(NONE), CLK(NONE),
89 { CLK(AUDIO), CLK(SFROM32KHZ), CLK(PERIPH), CLK(OSC),
90 CLK(EPCI), CLK(NONE), CLK(NONE), CLK(NONE),
92 { CLK(PERIPH), CLK(MEMORY), CLK(DISPLAY), CLK(AUDIO),
93 CLK(CGENERAL), CLK(DISPLAY2), CLK(OSC), CLK(NONE),
95 { CLK(PERIPH), CLK(CGENERAL), CLK(SFROM32KHZ), CLK(OSC),
96 CLK(NONE), CLK(NONE), CLK(NONE), CLK(NONE),
101 * Clock type for each peripheral clock source. We put the name in each
102 * record just so it is easy to match things up
104 #define TYPE(name, type) type
105 static enum clock_type_id clock_periph_type[PERIPHC_COUNT] = {
107 TYPE(PERIPHC_I2S1, CLOCK_TYPE_AXPT),
108 TYPE(PERIPHC_I2S2, CLOCK_TYPE_AXPT),
109 TYPE(PERIPHC_SPDIF_OUT, CLOCK_TYPE_AXPT),
110 TYPE(PERIPHC_SPDIF_IN, CLOCK_TYPE_PCM),
111 TYPE(PERIPHC_PWM, CLOCK_TYPE_PCST), /* only PWM uses b29:28 */
112 TYPE(PERIPHC_NONE, CLOCK_TYPE_NONE),
113 TYPE(PERIPHC_SBC2, CLOCK_TYPE_PCMT),
114 TYPE(PERIPHC_SBC3, CLOCK_TYPE_PCMT),
117 TYPE(PERIPHC_NONE, CLOCK_TYPE_NONE),
118 TYPE(PERIPHC_I2C1, CLOCK_TYPE_PCMT16),
119 TYPE(PERIPHC_I2C5, CLOCK_TYPE_PCMT16),
120 TYPE(PERIPHC_NONE, CLOCK_TYPE_NONE),
121 TYPE(PERIPHC_NONE, CLOCK_TYPE_NONE),
122 TYPE(PERIPHC_SBC1, CLOCK_TYPE_PCMT),
123 TYPE(PERIPHC_DISP1, CLOCK_TYPE_PMDACD2T),
124 TYPE(PERIPHC_DISP2, CLOCK_TYPE_PMDACD2T),
127 TYPE(PERIPHC_CVE, CLOCK_TYPE_PDCT),
128 TYPE(PERIPHC_NONE, CLOCK_TYPE_NONE),
129 TYPE(PERIPHC_VI, CLOCK_TYPE_MCPA),
130 TYPE(PERIPHC_NONE, CLOCK_TYPE_NONE),
131 TYPE(PERIPHC_SDMMC1, CLOCK_TYPE_PCMT),
132 TYPE(PERIPHC_SDMMC2, CLOCK_TYPE_PCMT),
133 TYPE(PERIPHC_G3D, CLOCK_TYPE_MCPA),
134 TYPE(PERIPHC_G2D, CLOCK_TYPE_MCPA),
137 TYPE(PERIPHC_NDFLASH, CLOCK_TYPE_PCMT),
138 TYPE(PERIPHC_SDMMC4, CLOCK_TYPE_PCMT),
139 TYPE(PERIPHC_VFIR, CLOCK_TYPE_PCMT),
140 TYPE(PERIPHC_EPP, CLOCK_TYPE_MCPA),
141 TYPE(PERIPHC_MPE, CLOCK_TYPE_MCPA),
142 TYPE(PERIPHC_MIPI, CLOCK_TYPE_PCMT), /* MIPI base-band HSI */
143 TYPE(PERIPHC_UART1, CLOCK_TYPE_PCMT),
144 TYPE(PERIPHC_UART2, CLOCK_TYPE_PCMT),
147 TYPE(PERIPHC_HOST1X, CLOCK_TYPE_MCPA),
148 TYPE(PERIPHC_NONE, CLOCK_TYPE_NONE),
149 TYPE(PERIPHC_TVO, CLOCK_TYPE_PDCT),
150 TYPE(PERIPHC_HDMI, CLOCK_TYPE_PMDACD2T),
151 TYPE(PERIPHC_NONE, CLOCK_TYPE_NONE),
152 TYPE(PERIPHC_TVDAC, CLOCK_TYPE_PDCT),
153 TYPE(PERIPHC_I2C2, CLOCK_TYPE_PCMT16),
154 TYPE(PERIPHC_EMC, CLOCK_TYPE_MCPT),
157 TYPE(PERIPHC_UART3, CLOCK_TYPE_PCMT),
158 TYPE(PERIPHC_NONE, CLOCK_TYPE_NONE),
159 TYPE(PERIPHC_VI, CLOCK_TYPE_MCPA),
160 TYPE(PERIPHC_NONE, CLOCK_TYPE_NONE),
161 TYPE(PERIPHC_NONE, CLOCK_TYPE_NONE),
162 TYPE(PERIPHC_SBC4, CLOCK_TYPE_PCMT),
163 TYPE(PERIPHC_I2C3, CLOCK_TYPE_PCMT16),
164 TYPE(PERIPHC_SDMMC3, CLOCK_TYPE_PCMT),
167 TYPE(PERIPHC_UART4, CLOCK_TYPE_PCMT),
168 TYPE(PERIPHC_UART5, CLOCK_TYPE_PCMT),
169 TYPE(PERIPHC_VDE, CLOCK_TYPE_PCMT),
170 TYPE(PERIPHC_OWR, CLOCK_TYPE_PCMT),
171 TYPE(PERIPHC_NOR, CLOCK_TYPE_PCMT),
172 TYPE(PERIPHC_CSITE, CLOCK_TYPE_PCMT),
173 TYPE(PERIPHC_I2S0, CLOCK_TYPE_AXPT),
174 TYPE(PERIPHC_NONE, CLOCK_TYPE_NONE),
176 /* 0x38h */ /* Jumps to reg offset 0x3B0h */
177 TYPE(PERIPHC_G3D2, CLOCK_TYPE_MCPA),
178 TYPE(PERIPHC_MSELECT, CLOCK_TYPE_PCMT),
179 TYPE(PERIPHC_TSENSOR, CLOCK_TYPE_PCST), /* s/b PCTS */
180 TYPE(PERIPHC_I2S3, CLOCK_TYPE_AXPT),
181 TYPE(PERIPHC_I2S4, CLOCK_TYPE_AXPT),
182 TYPE(PERIPHC_I2C4, CLOCK_TYPE_PCMT16),
183 TYPE(PERIPHC_SBC5, CLOCK_TYPE_PCMT),
184 TYPE(PERIPHC_SBC6, CLOCK_TYPE_PCMT),
187 TYPE(PERIPHC_AUDIO, CLOCK_TYPE_ACPT),
188 TYPE(PERIPHC_NONE, CLOCK_TYPE_NONE),
189 TYPE(PERIPHC_DAM0, CLOCK_TYPE_ACPT),
190 TYPE(PERIPHC_DAM1, CLOCK_TYPE_ACPT),
191 TYPE(PERIPHC_DAM2, CLOCK_TYPE_ACPT),
192 TYPE(PERIPHC_HDA2CODEC2X, CLOCK_TYPE_PCMT),
193 TYPE(PERIPHC_ACTMON, CLOCK_TYPE_PCST), /* MASK 31:30 */
194 TYPE(PERIPHC_EXTPERIPH1, CLOCK_TYPE_ASPTE),
197 TYPE(PERIPHC_EXTPERIPH2, CLOCK_TYPE_ASPTE),
198 TYPE(PERIPHC_EXTPERIPH3, CLOCK_TYPE_ASPTE),
199 TYPE(PERIPHC_NANDSPEED, CLOCK_TYPE_PCMT),
200 TYPE(PERIPHC_I2CSLOW, CLOCK_TYPE_PCST), /* MASK 31:30 */
201 TYPE(PERIPHC_SYS, CLOCK_TYPE_NONE),
202 TYPE(PERIPHC_SPEEDO, CLOCK_TYPE_PCMT),
203 TYPE(PERIPHC_NONE, CLOCK_TYPE_NONE),
204 TYPE(PERIPHC_NONE, CLOCK_TYPE_NONE),
207 TYPE(PERIPHC_NONE, CLOCK_TYPE_NONE),
208 TYPE(PERIPHC_NONE, CLOCK_TYPE_NONE),
209 TYPE(PERIPHC_NONE, CLOCK_TYPE_NONE),
210 TYPE(PERIPHC_NONE, CLOCK_TYPE_NONE),
211 TYPE(PERIPHC_SATAOOB, CLOCK_TYPE_PCMT), /* offset 0x420h */
212 TYPE(PERIPHC_SATA, CLOCK_TYPE_PCMT),
213 TYPE(PERIPHC_HDA, CLOCK_TYPE_PCMT),
217 * This array translates a periph_id to a periphc_internal_id
219 * Not present/matched up:
220 * uint vi_sensor; _VI_SENSOR_0, 0x1A8
221 * SPDIF - which is both 0x08 and 0x0c
224 #define NONE(name) (-1)
225 #define OFFSET(name, value) PERIPHC_ ## name
226 static s8 periph_id_to_internal_id[PERIPH_ID_COUNT] = {
235 PERIPHC_UART2, /* and vfir 0x68 */
240 NONE(SPDIF), /* 0x08 and 0x0c, unclear which to use */
267 /* Middle word: 63:32 */
279 NONE(SBC1), /* SBC1, 0x34, is this SPI1? */
289 PERIPHC_TVO, /* also CVE 0x40 */
307 /* Upper word 95:64 */
389 NONE(RESERVED1_SATACOLD),
390 NONE(RESERVED2_PCIERX0),
391 NONE(RESERVED3_PCIERX1),
392 NONE(RESERVED4_PCIERX2),
393 NONE(RESERVED5_PCIERX3),
394 NONE(RESERVED6_PCIERX4),
395 NONE(RESERVED7_PCIERX5),
413 NONE(RESERVED21_ENTROPY),
429 * PLL divider shift/mask tables for all PLL IDs.
431 struct clk_pll_info tegra_pll_info_table[CLOCK_ID_PLL_COUNT] = {
433 * T114: some deviations from T2x/T30.
434 * NOTE: If kcp_mask/kvco_mask == 0, they're not used in that PLL (PLLX, etc.)
435 * If lock_ena or lock_det are >31, they're not used in that PLL.
438 { .m_shift = 0, .m_mask = 0xFF, .n_shift = 8, .n_mask = 0xFF, .p_shift = 20, .p_mask = 0x0F,
439 .lock_ena = 24, .lock_det = 27, .kcp_shift = 28, .kcp_mask = 3, .kvco_shift = 27, .kvco_mask = 1 }, /* PLLC */
440 { .m_shift = 0, .m_mask = 0xFF, .n_shift = 8, .n_mask = 0xFF, .p_shift = 0, .p_mask = 0,
441 .lock_ena = 0, .lock_det = 27, .kcp_shift = 1, .kcp_mask = 3, .kvco_shift = 0, .kvco_mask = 1 }, /* PLLM */
442 { .m_shift = 0, .m_mask = 0x1F, .n_shift = 8, .n_mask = 0x3FF, .p_shift = 20, .p_mask = 0x07,
443 .lock_ena = 18, .lock_det = 27, .kcp_shift = 8, .kcp_mask = 0xF, .kvco_shift = 4, .kvco_mask = 0xF }, /* PLLP */
444 { .m_shift = 0, .m_mask = 0x1F, .n_shift = 8, .n_mask = 0x3FF, .p_shift = 20, .p_mask = 0x07,
445 .lock_ena = 18, .lock_det = 27, .kcp_shift = 8, .kcp_mask = 0xF, .kvco_shift = 4, .kvco_mask = 0xF }, /* PLLA */
446 { .m_shift = 0, .m_mask = 0x1F, .n_shift = 8, .n_mask = 0x3FF, .p_shift = 20, .p_mask = 0x01,
447 .lock_ena = 22, .lock_det = 27, .kcp_shift = 8, .kcp_mask = 0xF, .kvco_shift = 4, .kvco_mask = 0xF }, /* PLLU */
448 { .m_shift = 0, .m_mask = 0x1F, .n_shift = 8, .n_mask = 0x3FF, .p_shift = 20, .p_mask = 0x07,
449 .lock_ena = 22, .lock_det = 27, .kcp_shift = 8, .kcp_mask = 0xF, .kvco_shift = 4, .kvco_mask = 0xF }, /* PLLD */
450 { .m_shift = 0, .m_mask = 0xFF, .n_shift = 8, .n_mask = 0xFF, .p_shift = 20, .p_mask = 0x0F,
451 .lock_ena = 18, .lock_det = 27, .kcp_shift = 0, .kcp_mask = 0, .kvco_shift = 0, .kvco_mask = 0 }, /* PLLX */
452 { .m_shift = 0, .m_mask = 0xFF, .n_shift = 8, .n_mask = 0xFF, .p_shift = 0, .p_mask = 0,
453 .lock_ena = 9, .lock_det = 11, .kcp_shift = 6, .kcp_mask = 3, .kvco_shift = 0, .kvco_mask = 1 }, /* PLLE */
454 { .m_shift = 0, .m_mask = 0x0F, .n_shift = 8, .n_mask = 0x3FF, .p_shift = 20, .p_mask = 0x07,
455 .lock_ena = 18, .lock_det = 27, .kcp_shift = 8, .kcp_mask = 0xF, .kvco_shift = 4, .kvco_mask = 0xF }, /* PLLS (RESERVED) */
459 * Get the oscillator frequency, from the corresponding hardware configuration
460 * field. Note that T30/T114 support 3 new higher freqs, but we map back
461 * to the old T20 freqs. Support for the higher oscillators is TBD.
463 enum clock_osc_freq clock_get_osc_freq(void)
465 struct clk_rst_ctlr *clkrst =
466 (struct clk_rst_ctlr *)NV_PA_CLK_RST_BASE;
469 reg = readl(&clkrst->crc_osc_ctrl);
470 reg = (reg & OSC_FREQ_MASK) >> OSC_FREQ_SHIFT;
472 if (reg & 1) /* one of the newer freqs */
473 printf("Warning: OSC_FREQ is unsupported! (%d)\n", reg);
475 return reg >> 2; /* Map to most common (T20) freqs */
478 /* Returns a pointer to the clock source register for a peripheral */
479 u32 *get_periph_source_reg(enum periph_id periph_id)
481 struct clk_rst_ctlr *clkrst =
482 (struct clk_rst_ctlr *)NV_PA_CLK_RST_BASE;
483 enum periphc_internal_id internal_id;
485 /* Coresight is a special case */
486 if (periph_id == PERIPH_ID_CSI)
487 return &clkrst->crc_clk_src[PERIPH_ID_CSI+1];
489 assert(periph_id >= PERIPH_ID_FIRST && periph_id < PERIPH_ID_COUNT);
490 internal_id = periph_id_to_internal_id[periph_id];
491 assert(internal_id != -1);
492 if (internal_id >= PERIPHC_VW_FIRST) {
493 internal_id -= PERIPHC_VW_FIRST;
494 return &clkrst->crc_clk_src_vw[internal_id];
496 return &clkrst->crc_clk_src[internal_id];
500 * Given a peripheral ID and the required source clock, this returns which
501 * value should be programmed into the source mux for that peripheral.
503 * There is special code here to handle the one source type with 5 sources.
505 * @param periph_id peripheral to start
506 * @param source PLL id of required parent clock
507 * @param mux_bits Set to number of bits in mux register: 2 or 4
508 * @param divider_bits Set to number of divider bits (8 or 16)
509 * @return mux value (0-4, or -1 if not found)
511 int get_periph_clock_source(enum periph_id periph_id,
512 enum clock_id parent, int *mux_bits, int *divider_bits)
514 enum clock_type_id type;
515 enum periphc_internal_id internal_id;
518 assert(clock_periph_id_isvalid(periph_id));
520 internal_id = periph_id_to_internal_id[periph_id];
521 assert(periphc_internal_id_isvalid(internal_id));
523 type = clock_periph_type[internal_id];
524 assert(clock_type_id_isvalid(type));
526 *mux_bits = clock_source[type][CLOCK_MAX_MUX];
528 if (type == CLOCK_TYPE_PCMT16)
533 for (mux = 0; mux < CLOCK_MAX_MUX; mux++)
534 if (clock_source[type][mux] == parent)
537 /* if we get here, either us or the caller has made a mistake */
538 printf("Caller requested bad clock: periph=%d, parent=%d\n", periph_id,
543 void clock_set_enable(enum periph_id periph_id, int enable)
545 struct clk_rst_ctlr *clkrst =
546 (struct clk_rst_ctlr *)NV_PA_CLK_RST_BASE;
550 /* Enable/disable the clock to this peripheral */
551 assert(clock_periph_id_isvalid(periph_id));
552 if ((int)periph_id < (int)PERIPH_ID_VW_FIRST)
553 clk = &clkrst->crc_clk_out_enb[PERIPH_REG(periph_id)];
555 clk = &clkrst->crc_clk_out_enb_vw[PERIPH_REG(periph_id)];
558 reg |= PERIPH_MASK(periph_id);
560 reg &= ~PERIPH_MASK(periph_id);
564 void reset_set_enable(enum periph_id periph_id, int enable)
566 struct clk_rst_ctlr *clkrst =
567 (struct clk_rst_ctlr *)NV_PA_CLK_RST_BASE;
571 /* Enable/disable reset to the peripheral */
572 assert(clock_periph_id_isvalid(periph_id));
573 if (periph_id < PERIPH_ID_VW_FIRST)
574 reset = &clkrst->crc_rst_dev[PERIPH_REG(periph_id)];
576 reset = &clkrst->crc_rst_dev_vw[PERIPH_REG(periph_id)];
579 reg |= PERIPH_MASK(periph_id);
581 reg &= ~PERIPH_MASK(periph_id);
585 #if CONFIG_IS_ENABLED(OF_CONTROL)
587 * Convert a device tree clock ID to our peripheral ID. They are mostly
588 * the same but we are very cautious so we check that a valid clock ID is
591 * @param clk_id Clock ID according to tegra114 device tree binding
592 * @return peripheral ID, or PERIPH_ID_NONE if the clock ID is invalid
594 enum periph_id clk_id_to_periph_id(int clk_id)
596 if (clk_id > PERIPH_ID_COUNT)
597 return PERIPH_ID_NONE;
600 case PERIPH_ID_RESERVED3:
601 case PERIPH_ID_RESERVED16:
602 case PERIPH_ID_RESERVED24:
603 case PERIPH_ID_RESERVED35:
604 case PERIPH_ID_RESERVED43:
605 case PERIPH_ID_RESERVED45:
606 case PERIPH_ID_RESERVED56:
607 case PERIPH_ID_RESERVED76:
608 case PERIPH_ID_RESERVED77:
609 case PERIPH_ID_RESERVED78:
610 case PERIPH_ID_RESERVED83:
611 case PERIPH_ID_RESERVED89:
612 case PERIPH_ID_RESERVED91:
613 case PERIPH_ID_RESERVED93:
614 case PERIPH_ID_RESERVED94:
615 case PERIPH_ID_RESERVED95:
616 return PERIPH_ID_NONE;
621 #endif /* CONFIG_IS_ENABLED(OF_CONTROL) */
623 void clock_early_init(void)
625 struct clk_rst_ctlr *clkrst =
626 (struct clk_rst_ctlr *)NV_PA_CLK_RST_BASE;
627 struct clk_pll_info *pllinfo;
630 tegra30_set_up_pllp();
633 * PLLC output frequency set to 600Mhz
634 * PLLD output frequency set to 925Mhz
636 switch (clock_get_osc_freq()) {
637 case CLOCK_OSC_FREQ_12_0: /* OSC is 12Mhz */
638 clock_set_rate(CLOCK_ID_CGENERAL, 600, 12, 0, 8);
639 clock_set_rate(CLOCK_ID_DISPLAY, 925, 12, 0, 12);
642 case CLOCK_OSC_FREQ_26_0: /* OSC is 26Mhz */
643 clock_set_rate(CLOCK_ID_CGENERAL, 600, 26, 0, 8);
644 clock_set_rate(CLOCK_ID_DISPLAY, 925, 26, 0, 12);
647 case CLOCK_OSC_FREQ_13_0: /* OSC is 13Mhz */
648 clock_set_rate(CLOCK_ID_CGENERAL, 600, 13, 0, 8);
649 clock_set_rate(CLOCK_ID_DISPLAY, 925, 13, 0, 12);
651 case CLOCK_OSC_FREQ_19_2:
654 * These are not supported. It is too early to print a
655 * message and the UART likely won't work anyway due to the
656 * oscillator being wrong.
661 /* PLLC_MISC2: Set dynramp_stepA/B. MISC2 maps to pll_out[1] */
662 writel(0x00561600, &clkrst->crc_pll[CLOCK_ID_CGENERAL].pll_out[1]);
664 /* PLLC_MISC: Set LOCK_ENABLE */
665 pllinfo = &tegra_pll_info_table[CLOCK_ID_CGENERAL];
666 setbits_le32(&clkrst->crc_pll[CLOCK_ID_CGENERAL].pll_misc, (1 << pllinfo->lock_ena));
669 /* PLLD_MISC: Set CLKENABLE, CPCON 12, LFCON 1, and enable lock */
670 pllinfo = &tegra_pll_info_table[CLOCK_ID_DISPLAY];
671 data = (12 << pllinfo->kcp_shift) | (1 << pllinfo->kvco_shift);
672 data |= (1 << PLLD_CLKENABLE) | (1 << pllinfo->lock_ena);
673 writel(data, &clkrst->crc_pll[CLOCK_ID_DISPLAY].pll_misc);
677 void arch_timer_init(void)
679 struct sysctr_ctlr *sysctr = (struct sysctr_ctlr *)NV_PA_TSC_BASE;
682 freq = clock_get_rate(CLOCK_ID_OSC);
683 debug("%s: osc freq is %dHz [0x%08X]\n", __func__, freq, freq);
686 asm("mcr p15, 0, %0, c14, c0, 0\n" : : "r" (freq));
688 /* Only T114 has the System Counter regs */
689 debug("%s: setting CNTFID0 to 0x%08X\n", __func__, freq);
690 writel(freq, &sysctr->cntfid0);
692 val = readl(&sysctr->cntcr);
693 val |= TSC_CNTCR_ENABLE | TSC_CNTCR_HDBG;
694 writel(val, &sysctr->cntcr);
695 debug("%s: TSC CNTCR = 0x%08X\n", __func__, val);