[Sound-open-firmware] [PATCH] arch: xtensa: Support wait_for_interrupt on LX6

Liam Girdwood liam.r.girdwood at linux.intel.com
Tue Jan 23 17:39:56 CET 2018


Add LX6 version of wait_for_interrupt() as this will be needed for
cannonlake.

Signed-off-by: Liam Girdwood <liam.r.girdwood at linux.intel.com>
---
 src/arch/xtensa/Makefile.am                     |  1 -
 src/arch/xtensa/include/arch/Makefile.am        |  3 +-
 src/arch/xtensa/{wait.S => include/arch/wait.h} | 51 ++++++++++++++++++-------
 src/include/reef/wait.h                         |  1 +
 4 files changed, 41 insertions(+), 15 deletions(-)
 rename src/arch/xtensa/{wait.S => include/arch/wait.h} (71%)

diff --git a/src/arch/xtensa/Makefile.am b/src/arch/xtensa/Makefile.am
index 00f6b68..fe27c24 100644
--- a/src/arch/xtensa/Makefile.am
+++ b/src/arch/xtensa/Makefile.am
@@ -31,7 +31,6 @@ reef_SOURCES = \
 	crt1-boards.S \
 	_vectors.S \
 	init.c \
-	wait.S \
 	timer.c \
 	task.c
 
diff --git a/src/arch/xtensa/include/arch/Makefile.am b/src/arch/xtensa/include/arch/Makefile.am
index d8ba0df..42b3b70 100644
--- a/src/arch/xtensa/include/arch/Makefile.am
+++ b/src/arch/xtensa/include/arch/Makefile.am
@@ -4,4 +4,5 @@ noinst_HEADERS = \
 	reef.h \
 	spinlock.h \
 	task.h \
-	timer.h
+	timer.h \
+	wait.h
diff --git a/src/arch/xtensa/wait.S b/src/arch/xtensa/include/arch/wait.h
similarity index 71%
rename from src/arch/xtensa/wait.S
rename to src/arch/xtensa/include/arch/wait.h
index df9893d..2f6e4f5 100644
--- a/src/arch/xtensa/wait.S
+++ b/src/arch/xtensa/include/arch/wait.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Intel Corporation
+ * Copyright (c) 2017, Intel Corporation
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -28,17 +28,42 @@
  * Author: Liam Girdwood <liam.r.girdwood at linux.intel.com>
  */
 
-#include <xtensa/coreasm.h>
-#include <xtensa/config/specreg.h>
-#include "xtos-internal.h"
+#include <xtensa/xtruntime.h>
 
-	.text
-	.align 4
-	.global	arch_wait_for_interrupt
-	.type	arch_wait_for_interrupt, at function
-arch_wait_for_interrupt:
-	abi_entry
-	waiti 0
-	abi_return
+#if defined(CONFIG_CANNONLAKE)
+
+static inline void arch_wait_for_interrupt(int level)
+{
+	int i;
+
+	/* this sequnce must be atomic on LX6 */
+	XTOS_SET_INTLEVEL(5);
+
+	/* LX6 needs a delay */
+	for (i = 0; i < 128; i++)
+		asm volatile("nop");
+
+	/* and to flush all loads/stores prior to wait */
+	asm volatile("isync");
+	asm volatile("extw");
+
+	/* now wait */
+	asm volatile("waiti 0");
+}
+
+#else
+
+static inline void arch_wait_for_interrupt(int level)
+{
+	 asm volatile("waiti 0");
+}
+
+#endif
+
+static inline void idelay(int n)
+{
+	while (n--) {
+		asm volatile("nop");
+	}
+}
 
-	.size	arch_wait_for_interrupt, . - arch_wait_for_interrupt
diff --git a/src/include/reef/wait.h b/src/include/reef/wait.h
index 3354eb4..a598d48 100644
--- a/src/include/reef/wait.h
+++ b/src/include/reef/wait.h
@@ -35,6 +35,7 @@
 
 #include <stdint.h>
 #include <errno.h>
+#include <arch/wait.h>
 #include <reef/debug.h>
 #include <reef/work.h>
 #include <reef/timer.h>
-- 
2.14.1



More information about the Sound-open-firmware mailing list