summaryrefslogtreecommitdiffstats
path: root/arch/arm/lib32/arm_architected_timer.c
blob: 54eca13f8b9d1c940d54f0e34c1dd261c5eec8c7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// SPDX-License-Identifier: GPL-2.0-only

#include <asm/system.h>
#include <clock.h>
#include <common.h>

/* Unlike the ARMv8, the timer is not generic to ARM32 */
void arm_architected_timer_udelay(unsigned long us)
{
	unsigned long long ticks, cntfrq = get_cntfrq();
	unsigned long long start = get_cntpct();

	ticks = DIV_ROUND_DOWN_ULL((us * cntfrq), 1000000);

	while ((long)(start + ticks - get_cntpct()) > 0)
		;
}