2 * linux/arch/unicore32/lib/delay.S
4 * Code specific to PKUnity SoC and UniCore ISA
6 * Copyright (C) 2001-2010 GUAN Xue-tao
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
12 #include <linux/linkage.h>
13 #include <asm/assembler.h>
14 #include <asm/param.h>
17 .LC0: .word loops_per_jiffy
18 .LC1: .word (2199023*HZ)>>11
22 * lpj <= 0x01ffffff (max. 3355 bogomips)
29 ENTRY(__const_udelay) @ 0 <= r0 <= 0x7fffff06
31 ldw r2, [r2] @ max = 0x01ffffff
32 mov r0, r0 >> #14 @ max = 0x0001ffff
33 mov r2, r2 >> #10 @ max = 0x00007fff
34 mul r0, r2, r0 @ max = 2^32-1
39 * loops = r0 * HZ * loops_per_jiffy / 1000000
41 * Oh, if only we had a cycle counter...
50 ENDPROC(__const_udelay)