1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * linux/arch/unicore32/lib/delay.S
5 * Code specific to PKUnity SoC and UniCore ISA
7 * Copyright (C) 2001-2010 GUAN Xue-tao
9 #include <linux/linkage.h>
10 #include <asm/assembler.h>
11 #include <asm/param.h>
14 .LC0: .word loops_per_jiffy
15 .LC1: .word (2199023*HZ)>>11
19 * lpj <= 0x01ffffff (max. 3355 bogomips)
26 ENTRY(__const_udelay) @ 0 <= r0 <= 0x7fffff06
28 ldw r2, [r2] @ max = 0x01ffffff
29 mov r0, r0 >> #14 @ max = 0x0001ffff
30 mov r2, r2 >> #10 @ max = 0x00007fff
31 mul r0, r2, r0 @ max = 2^32-1
36 * loops = r0 * HZ * loops_per_jiffy / 1000000
38 * Oh, if only we had a cycle counter...
47 ENDPROC(__const_udelay)