Lines Matching +full:1000 +full:base +full:- +full:t
1 // SPDX-License-Identifier: GPL-2.0+
4 * Po-Yu Chuang <ratbert@faraday-tech.com>
26 writel(0, &tmr->cr); in timer_init()
34 writel(TIMER_LOAD_VAL, &tmr->timer3_load); in timer_init()
35 writel(TIMER_LOAD_VAL, &tmr->timer3_counter); in timer_init()
36 writel(0, &tmr->timer3_match1); in timer_init()
37 writel(0, &tmr->timer3_match2); in timer_init()
39 /* we don't want timer to issue interrupts */ in timer_init()
43 &tmr->interrupt_mask); in timer_init()
45 cr = readl(&tmr->cr); in timer_init()
50 writel(cr, &tmr->cr); in timer_init()
71 lastdec = readl(&tmr->timer3_counter) / (TIMER_CLOCK / CONFIG_SYS_HZ); in reset_timer_masked()
73 lastdec = readl(&tmr->timer3_counter) / in reset_timer_masked()
96 ulong now = readl(&tmr->timer3_counter) / (TIMER_CLOCK / CONFIG_SYS_HZ); in get_timer_masked()
98 ulong now = readl(&tmr->timer3_counter) / in get_timer_masked()
109 timestamp += lastdec - now; in get_timer_masked()
114 * nts = ts + ld + (TLV - now) in get_timer_masked()
115 * ts=old stamp, ld=time that passed before passing through -1 in get_timer_masked()
116 * (TLV-now) amount of time after passing though -1 in get_timer_masked()
120 timestamp += lastdec + TIMER_LOAD_VAL - now; in get_timer_masked()
131 * return difference between timer ticks and base
133 ulong get_timer(ulong base) in get_timer() argument
135 debug("%s(%lx)\n", __func__, base); in get_timer()
136 return get_timer_masked() - base; in get_timer()
139 void set_timer(ulong t) in set_timer() argument
141 debug("%s(%lx)\n", __func__, t); in set_timer()
142 timestamp = t; in set_timer()
151 long tmo = usec * (TIMER_CLOCK / 1000) / 1000; in __udelay()
153 long tmo = usec * ((CONFIG_SYS_CLK_FREQ / 2) / 1000) / 1000; in __udelay()
155 unsigned long now, last = readl(&tmr->timer3_counter); in __udelay()
159 now = readl(&tmr->timer3_counter); in __udelay()
161 tmo -= TIMER_LOAD_VAL + last - now; in __udelay()
163 tmo -= last - now; in __udelay()