treewide: remove redundant IS_ERR() before error code check
[linux/fpc-iii.git] / arch / unicore32 / lib / delay.S
blob6a359dd034e5ea753d00a11a59568ef8d6bc6a29
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  * linux/arch/unicore32/lib/delay.S
4  *
5  * Code specific to PKUnity SoC and UniCore ISA
6  *
7  * Copyright (C) 2001-2010 GUAN Xue-tao
8  */
9 #include <linux/linkage.h>
10 #include <asm/assembler.h>
11 #include <asm/param.h>
12                 .text
14 .LC0:           .word   loops_per_jiffy
15 .LC1:           .word   (2199023*HZ)>>11
18  * r0  <= 2000
19  * lpj <= 0x01ffffff (max. 3355 bogomips)
20  * HZ  <= 1000
21  */
23 ENTRY(__udelay)
24                 ldw     r2, .LC1
25                 mul     r0, r2, r0
26 ENTRY(__const_udelay)                           @ 0 <= r0 <= 0x7fffff06
27                 ldw     r2, .LC0
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
32                 mov.a   r0, r0 >> #6
33                 cmoveq  pc, lr
36  * loops = r0 * HZ * loops_per_jiffy / 1000000
37  *
38  * Oh, if only we had a cycle counter...
39  */
41 @ Delay routine
42 ENTRY(__delay)
43                 sub.a   r0, r0, #2
44                 bua     __delay
45                 mov     pc, lr
46 ENDPROC(__udelay)
47 ENDPROC(__const_udelay)
48 ENDPROC(__delay)