diff mbox series

[RFC,09/13] ARC: delay: elide ZOL

Message ID 20220222141506.4003433-10-geomatsi@gmail.com
State New
Headers show
Series ARC: handle the lack of ZOL support | expand

Commit Message

Sergey Matyukevich Feb. 22, 2022, 2:15 p.m. UTC
From: Vineet Gupta <vgupta@kernel.org>

Add __delay implementation based on DBNZ if ZOL is not supported.

Signed-off-by: Vineet Gupta <vgupta@kernel.org>
---
 arch/arc/include/asm/delay.h | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
diff mbox series

Patch

diff --git a/arch/arc/include/asm/delay.h b/arch/arc/include/asm/delay.h
index 54db798f0aa0..e061d1c64f24 100644
--- a/arch/arc/include/asm/delay.h
+++ b/arch/arc/include/asm/delay.h
@@ -16,9 +16,12 @@ 
 
 #include <asm-generic/types.h>
 #include <asm/param.h>		/* HZ */
+#include <asm/assembler.h>
 
 extern unsigned long loops_per_jiffy;
 
+#ifndef CONFIG_ARC_LACKS_ZOL
+
 static inline void __delay(unsigned long loops)
 {
 	__asm__ __volatile__(
@@ -31,6 +34,19 @@  static inline void __delay(unsigned long loops)
         : "lp_count");
 }
 
+#else
+
+static inline void __delay(unsigned long loops)
+{
+	__asm__ __volatile__(
+	"	add   %0, %0, 1         \n"
+	"1:	nop			\n"
+	"	DBNZR %0, 1b		\n"
+	: "+r"(loops));
+}
+
+#endif
+
 extern void __bad_udelay(void);
 
 /*