summaryrefslogtreecommitdiff
path: root/arch/arm/mach-tegra/include/mach/delay.h
blob: 2defb7b9b658de14f7c6089f9dcf7cf060903ce9 (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
/*
 * arch/arm/mach-tegra/include/mach/delay.h
 *
 * Copyright (C) 2010 Google, Inc.
 *
 * 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.
 *
 */
#ifndef __MACH_TEGRA_DELAY_H
#define __MACH_TEGRA_DELAY_H

/* needed by loops_per_jiffy calculations */
extern void __delay(int loops);

extern void __udelay(unsigned long usecs);
extern void __const_udelay(unsigned long usecs);

/* we don't have any restrictions on maximum udelay length, but we'll enforce
 * the same restriction as the ARM default so we don't introduce any
 * incompatibilties in drivers.
 */
extern void __bad_udelay(void);

#define MAX_UDELAY_MS 2

#define udelay(n)							\
	((__builtin_constant_p(n) && (n) > (MAX_UDELAY_MS * 1000)) ?	\
		__bad_udelay() :					\
		__udelay(n))

#endif /* defined(__MACH_TEGRA_DELAY_H) */