summaryrefslogtreecommitdiff
path: root/arch/arm/mach-tegra/delay.S
diff options
context:
space:
mode:
authorColin Cross <ccross@android.com>2010-04-25 00:29:45 -0700
committerDan Willemsen <dwillemsen@nvidia.com>2011-11-30 21:34:36 -0800
commit1ae52cd40073f35c17452abc128b29dbee8bf75c (patch)
treeca015de0cb9efcc9aae7a7c4fa74003cd723f2e4 /arch/arm/mach-tegra/delay.S
parentad117211ea3b94a22a8f0e8571403dabd93cfaa6 (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/delay.S')
-rw-r--r--arch/arm/mach-tegra/delay.S50
1 files changed, 50 insertions, 0 deletions
diff --git a/arch/arm/mach-tegra/delay.S b/arch/arm/mach-tegra/delay.S
new file mode 100644
index 000000000000..01123bfe6a0c
--- /dev/null
+++ b/arch/arm/mach-tegra/delay.S
@@ -0,0 +1,50 @@
+/*
+ * arch/arm/mach-tegra/delay.S
+ *
+ * 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.
+ *
+ */
+
+#include <linux/linkage.h>
+#include <asm/assembler.h>
+#include <mach/iomap.h>
+#include <mach/io.h>
+
+ .text
+
+ENTRY(__udelay)
+ENTRY(__const_udelay)
+ ldr 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(__const_udelay)
+ENDPROC(__udelay)
+
+
+@ Delay routine
+ENTRY(__delay)
+ subs r0, r0, #1
+ bhi __delay
+ mov pc, lr
+ENDPROC(__delay)