[qsd8k] Add code to support Scorpion warm boot in lk bootloader
Before going into power collapse, the kernel does not change the reset
vector, so execution resumes at bootloader. Add check in bootloader
to detect warm boot v/s cold boot and if warm boot is detected then
jump to kernel after doing cpu early initializations.
diff --git a/arch/arm/crt0.S b/arch/arm/crt0.S
index 9196d10..c33d6dd 100644
--- a/arch/arm/crt0.S
+++ b/arch/arm/crt0.S
@@ -50,6 +50,17 @@
bl __cpu_early_init
#endif
+#if WITH_CPU_WARM_BOOT
+ ldr r0, warm_boot_tag
+ cmp r0, #1
+
+ /* if set, warm boot */
+ ldreq pc, =BASE_ADDR
+
+ mov r0, #1
+ str r0, warm_boot_tag
+#endif
+
/* see if we need to relocate */
mov r0, pc
sub r0, r0, #(.Laddr - _start)
@@ -72,6 +83,10 @@
bx r0
.ltorg
+#if WITH_CPU_WARM_BOOT
+warm_boot_tag:
+ .word 0
+#endif
.Lstack_setup:
/* set up the stack for irq, fiq, abort, undefined, system/user, and lastly supervisor mode */
diff --git a/platform/qsd8k/rules.mk b/platform/qsd8k/rules.mk
index 1a8f2ef..237c469 100644
--- a/platform/qsd8k/rules.mk
+++ b/platform/qsd8k/rules.mk
@@ -5,7 +5,7 @@
#arm1136j-s
CPU := generic
-DEFINES += WITH_CPU_EARLY_INIT=1 MEMBASE=0
+DEFINES += WITH_CPU_EARLY_INIT=1 WITH_CPU_WARM_BOOT=1 MEMBASE=0
INCLUDES += -I$(LOCAL_DIR)/include