diff options
author | Colin Cross <ccross@android.com> | 2010-04-25 00:29:45 -0700 |
---|---|---|
committer | Colin Cross <ccross@android.com> | 2010-10-06 16:26:55 -0700 |
commit | 76f3a19c08955e1eef766c3b52f4166fe357457a (patch) | |
tree | 07dcf0bb76daffc16106df8ec39a938cc4f45f7b /arch/arm/mach-tegra/include/mach/delay.h | |
parent | 8734cdc2da00b304aded18263f1499f127119aad (diff) |
[ARM] tegra: Add arch-specific udelay using TMRUS
Change-Id: If075117642a725ee2ee24a622068274e588a5bc1
Signed-off-by: Colin Cross <ccross@android.com>
Diffstat (limited to 'arch/arm/mach-tegra/include/mach/delay.h')
-rw-r--r-- | arch/arm/mach-tegra/include/mach/delay.h | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/arch/arm/mach-tegra/include/mach/delay.h b/arch/arm/mach-tegra/include/mach/delay.h new file mode 100644 index 000000000000..2defb7b9b658 --- /dev/null +++ b/arch/arm/mach-tegra/include/mach/delay.h @@ -0,0 +1,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) */ |