summaryrefslogtreecommitdiffstats
path: root/arch/arm/lib/delay.S
blob: 72dab5a9569011d536f677b7daa84b1c427b080f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/*
 * linux/arch/arm/lib/delay.S
 *
 * Copyright (C) 1995, 1996 Russell King
 */
#include <linux/linkage.h>
#include <asm/assembler.h>
		.text

LC0:		.word	SYMBOL_NAME(loops_per_sec)

ENTRY(udelay)
		mov	r2, #0x1000
		orr	r2, r2, #0x00c6
		mul	r1, r0, r2
		ldr	r2, LC0
		ldr	r2, [r2]
		mov	r1, r1, lsr #11
		mov	r2, r2, lsr #11
		mul	r0, r1, r2
		movs	r0, r0, lsr #10
		RETINSTR(moveq,pc,lr)

@ Delay routine
ENTRY(__delay)
		subs	r0, r0, #1
		RETINSTR(movcc,pc,lr)
		subs	r0, r0, #1
		RETINSTR(movcc,pc,lr)
		subs	r0, r0, #1
		RETINSTR(movcc,pc,lr)
		subs	r0, r0, #1
		RETINSTR(movcc,pc,lr)
		subs	r0, r0, #1
		RETINSTR(movcc,pc,lr)
		subs	r0, r0, #1
		RETINSTR(movcc,pc,lr)
		subs	r0, r0, #1
		RETINSTR(movcc,pc,lr)
		subs	r0, r0, #1
		bcs	SYMBOL_NAME(__delay)
		RETINSTR(mov,pc,lr)