[Sound-open-firmware] [PATCH] arch: xtensa: Add support for apollolake

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


Apollolake has reset vector in ROM and some other changes that need
configured after reset.

Signed-off-by: Liam Girdwood <liam.r.girdwood at linux.intel.com>
---
 src/arch/xtensa/reset-vector.S | 57 ++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 55 insertions(+), 2 deletions(-)

diff --git a/src/arch/xtensa/reset-vector.S b/src/arch/xtensa/reset-vector.S
index 1ddd6ca..be2eb7a 100644
--- a/src/arch/xtensa/reset-vector.S
+++ b/src/arch/xtensa/reset-vector.S
@@ -78,7 +78,26 @@ _ResetVector:
 	wsr	a0, MEMCTL
 #endif
 #endif
+
+/* Apollolake+ have reset vector in ROM */
+#if defined(CONFIG_BAYTRAIL) || defined(CONFIG_CHERRYTRAIL) \
+	|| defined (CONFIG_HASWELL) || defined(CONFIG_BROADWELL)
 	j	_ResetHandler
+#else
+
+	// This is our VM bxt ROM. It simply jumps to the reset handler.
+	j .sram_jump		// jump over the literals
+
+	.align	4
+	.literal_position	// tells the assembler/linker to place literals here
+
+_reset_sram:
+	.word _ResetHandler
+	.align 4
+.sram_jump:
+	l32r	a0, _reset_sram	// load SRAM reset hanler address
+	jx	a0		// jump to the hanlder
+#endif
 	.size	_ResetVector, . - _ResetVector
 
 # if XCHAL_HAVE_HALT
@@ -96,7 +115,7 @@ _ResetVector:
 #  endif
 # endif
 
-#ifdef CONFIG_BROXTON
+#if defined(CONFIG_APOLLOLAKE) || defined(CONFIG_CANNONLAKE)
 	.section .ResetHandler.text, "ax"
 	j	_ResetHandler
 #endif
@@ -105,6 +124,7 @@ _ResetVector:
 
 	.align	4
 	.global	_ResetHandler
+
 _ResetHandler:
 #endif
 
@@ -155,7 +175,19 @@ _ResetHandler:
 
 #endif
 
+#if defined(CONFIG_APOLLOLAKE)
+	call0 _call_init
+#endif
+
+#if defined(CONFIG_APOLLOLAKE)
+	movi	a0, 0		// a0 is always 0 in this code, used to initialize lots of things
+	movi	a0, 0
+	movi	a1, 0
+	movi	a2, 0
+#else
 	movi	a0, 0		// a0 is always 0 in this code, used to initialize lots of things
+#endif
+
 
 #if XCHAL_HAVE_INTERRUPTS	// technically this should be under !FULL_RESET, assuming hard reset
 	wsr	a0, INTENABLE	// make sure that interrupts are shut off (*before* we lower PS.INTLEVEL and PS.EXCM!)
@@ -249,6 +281,12 @@ _ResetHandler:
 	extui 	a3, a3, 0, 8	// extract core ID (FIXME: need proper constants for PRID bits to extract)
 	beqz	a2, .Ldonesync	// skip if no sync variable
 	bnez	a3, .Ldonesync	// only do this on core 0
+#if defined(CONFIG_APOLLOLAKE)
+	movi	a2, 100		// delay here for 100 iterations if we are not core 0
+2:	addi.n	a2, a2, -1
+	bnez	a2, 2b
+	j	.Ldonesync
+#endif
 	s32i	a0, a2, 0	// clear sync variable
 .Ldonesync:
 #endif
@@ -312,7 +350,11 @@ _ResetHandler:
 
 #if XCHAL_HAVE_PREFETCH
 	/* Enable cache prefetch if present.  */
+#if defined(CONFIG_APOLLOLAKE)
+	movi.n	a2, 34
+#else
 	movi.n	a2, 68
+#endif
 	wsr	a2, PREFCTL
 #endif
 	/*
@@ -479,6 +521,7 @@ unpackdone:
 	 */
 #if HAVE_XSR
 
+#if !XCHAL_HAVE_BOOTLOADER
 /*  For asm macros; works for positive a,b smaller than 1000:  */
 # define GREATERTHAN(a,b)	(((b)-(a)) & ~0xFFF)
 
@@ -517,7 +560,7 @@ unpackdone:
 	init_vector	4
 	init_vector	5
 	init_vector	6
-
+#endif
 #endif /*HAVE_XSR*/
 
 
@@ -553,6 +596,16 @@ unpackdone:
 	.size	_ResetVector, . - _ResetVector
 #endif
 
+#if defined(CONFIG_APOLLOLAKE)
+	.align	4
+	.global	_call_init
+	.type _call_init, at function
+
+_call_init:
+	ret.n
+	.size	_call_init, . - _call_init
+#endif
+
 	.text
 	.global xthals_hw_configid0, xthals_hw_configid1
 	.global xthals_release_major, xthals_release_minor
-- 
2.14.1



More information about the Sound-open-firmware mailing list