diff options
Diffstat (limited to 'arch/arm/lib32/arm_architected_timer.c')
-rw-r--r-- | arch/arm/lib32/arm_architected_timer.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/arch/arm/lib32/arm_architected_timer.c b/arch/arm/lib32/arm_architected_timer.c new file mode 100644 index 0000000000..54eca13f8b --- /dev/null +++ b/arch/arm/lib32/arm_architected_timer.c @@ -0,0 +1,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) + ; +} |