summaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
authorAndre Przywara <andre.przywara@arm.com>2017-01-02 11:48:32 +0000
committerJagan Teki <jagan@openedev.com>2017-01-04 16:37:41 +0100
commit8ed02bc2d969bcab140f33f235b512194ab17d47 (patch)
tree8baa968ea59438ecdfaf28d01af02c73e9630c92 /arch
parent11e1479b9e672661fcc2ea69f7e9cbaa6f07ecf5 (diff)
armv8: add simple sdelay implementation
The sunxi DRAM setup code needs an sdelay() implementation, which wasn't defined for armv8 so far. Shamelessly copy the armv7 version and adjust it to work in AArch64. Signed-off-by: Andre Przywara <andre.przywara@arm.com> Reviewed-by: Jagan Teki <jagan@openedev.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/cpu/armv8/cpu.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/arch/arm/cpu/armv8/cpu.c b/arch/arm/cpu/armv8/cpu.c
index 5dcb5e290b..28a27f724e 100644
--- a/arch/arm/cpu/armv8/cpu.c
+++ b/arch/arm/cpu/armv8/cpu.c
@@ -17,6 +17,20 @@
#include <asm/secure.h>
#include <linux/compiler.h>
+/*
+ * sdelay() - simple spin loop.
+ *
+ * Will delay execution by roughly (@loops * 2) cycles.
+ * This is necessary to be used before timers are accessible.
+ *
+ * A value of "0" will results in 2^64 loops.
+ */
+void sdelay(unsigned long loops)
+{
+ __asm__ volatile ("1:\n" "subs %0, %0, #1\n"
+ "b.ne 1b" : "=r" (loops) : "0"(loops) : "cc");
+}
+
int cleanup_before_linux(void)
{
/*