summaryrefslogtreecommitdiff
path: root/arch/arm/mach-tegra/delay.S
blob: a5f539df204216c588de70c3f38b0cccca2436cf (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
44
45
46
47
48
49
50
51
52
53
54
55
/*
 * arch/arm/mach-tegra/delay.S
 *
 * Copyright (C) 2010 Google, Inc.
 * Copyright (c) 2013, NVIDIA CORPORATION.  All rights reserved.
 *
 * Author:
 *  Colin Cross <ccross@google.com>
 *
 * This software is licensed under the terms of the GNU General Public
 * License version 2, as published by the Free Software Foundation, and
 * may be copied, distributed, and modified under those terms.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 */

#include <linux/linkage.h>
#include <asm/assembler.h>

#include "iomap.h"
#include "sleep.h"

    .text

ENTRY(__tegra_udelay)
ENTRY(__tegra_const_udelay)
    mov32 r3, (IO_PPSB_VIRT + TEGRA_TMRUS_BASE - IO_PPSB_PHYS)
    ldr r1, [r3]

/* r0 - usecs to wait
 * r1 - initial value of the counter
 */
loop:
    ldr r2, [r3]
    sub r2, r2, r1
    cmp r2, r0
    bls loop
    mov pc, lr
ENDPROC(__tegra_const_udelay)
ENDPROC(__tegra_udelay)


/* Natural-Align this 2-instruction loop.
*/
.align 3
@ Delay routine
ENTRY(__tegra_delay)
    subs  r0, r0, #1
    bhi __tegra_delay
    mov pc, lr
ENDPROC(__tegra_delay)