Lines Matching +full:timebase +full:- +full:frequency
1 // SPDX-License-Identifier: GPL-2.0+
3 * Copyright (C) 2014, STMicroelectronics - All Rights Reserved
9 #include <asm/arch-stv0991/hardware.h>
10 #include <asm/arch-stv0991/stv0991_cgu.h>
11 #include <asm/arch-stv0991/stv0991_gpt.h>
16 #define READ_TIMER() (readl(&gpt1_regs_ptr->cnt) & GPT_FREE_RUNNING)
21 #define timestamp gd->arch.tbl
22 #define lastdec gd->arch.lastinc
29 writel(TIMER1_CLK_CFG, &stv0991_cgu_regs->tim_freq); in timer_init()
30 writel(readl(&stv0991_cgu_regs->cgu_enable_2) | in timer_init()
31 TIMER1_CLK_EN, &stv0991_cgu_regs->cgu_enable_2); in timer_init()
34 writel(readl(&gpt1_regs_ptr->cr1) & ~GPT_CR1_CEN, &gpt1_regs_ptr->cr1); in timer_init()
35 writel(GPT_PRESCALER_128, &gpt1_regs_ptr->psc); in timer_init()
36 /* Configure timer for auto-reload */ in timer_init()
37 writel(readl(&gpt1_regs_ptr->cr1) | GPT_MODE_AUTO_RELOAD, in timer_init()
38 &gpt1_regs_ptr->cr1); in timer_init()
41 writel(GPT_FREE_RUNNING, &gpt1_regs_ptr->arr); in timer_init()
44 writel(readl(&gpt1_regs_ptr->cr1) | GPT_CR1_CEN, in timer_init()
45 &gpt1_regs_ptr->cr1); in timer_init()
59 return (get_timer_masked() / GPT_RESOLUTION) - base; in get_timer()
74 while ((ulong) (get_timer_masked() - start) < tmo) in __udelay()
84 timestamp += now - lastdec; in get_timer_masked()
87 timestamp += now + GPT_FREE_RUNNING - lastdec; in get_timer_masked()
95 * This function is derived from PowerPC code (read timebase as long long).
104 * This function is derived from PowerPC code (timebase clock frequency).