From 32e55a777f839316ffcabd0c1a5192e5ffca55e7 Mon Sep 17 00:00:00 2001 From: Stephen Boyd Date: Tue, 9 Jun 2015 19:24:23 +0100 Subject: ARM: 8389/1: Add cpu_resume_arm() for firmwares that resume in ARM state Some platforms always enter the kernel in the ARM state even if the kernel is compiled for THUMB2. Add a small wrapper on top of cpu_resume() that switches into THUMB2 state. This provides the functionality to fix a problem reported by Kevin Hilman on next-20150601 where the ifc6410 fails to boot a THUMB2 kernel because the platform's firmware always enters the kernel in ARM mode from deep idle states. (rmk: tweaked to work without BSYM->badr changes.) Reported-by: Kevin Hilman Cc: Ard Biesheuvel Cc: Lina Iyer Signed-off-by: Stephen Boyd Signed-off-by: Russell King --- arch/arm/kernel/sleep.S | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'arch/arm/kernel/sleep.S') diff --git a/arch/arm/kernel/sleep.S b/arch/arm/kernel/sleep.S index 7d37bfc50830..761c5debfab0 100644 --- a/arch/arm/kernel/sleep.S +++ b/arch/arm/kernel/sleep.S @@ -118,6 +118,12 @@ ENDPROC(cpu_resume_after_mmu) .text .align + .arm +ENTRY(cpu_resume_arm) + THUMB( adr r9, BSYM(1f) ) @ Kernel is entered in ARM. + THUMB( bx r9 ) @ If this is a Thumb-2 kernel, + THUMB( .thumb ) @ switch to Thumb now. + THUMB(1: ) ENTRY(cpu_resume) ARM_BE8(setend be) @ ensure we are in BE mode #ifdef CONFIG_ARM_VIRT_EXT @@ -149,6 +155,7 @@ THUMB( ldmia r0!, {r1, r2, r3} ) THUMB( mov sp, r2 ) THUMB( bx r3 ) ENDPROC(cpu_resume) +ENDPROC(cpu_resume_arm) .align 2 _sleep_save_sp: -- cgit v1.2.3 From 2678bb9fa137726a0b83dd61a9c1636543066755 Mon Sep 17 00:00:00 2001 From: Russell King Date: Fri, 12 Jun 2015 09:24:17 +0100 Subject: ARM: fix EFM32 build breakage caused by cpu_resume_arm Fix: arch/arm/kernel/sleep.S:121: Error: selected processor does not support ARM opcodes arch/arm/kernel/sleep.S:123: Error: attempt to use an ARM instruction on a Thumb-only processor -- `adr r9,1f+1' arch/arm/kernel/sleep.S:124: Error: attempt to use an ARM instruction on a Thumb-only processor -- `bx r9' Signed-off-by: Russell King --- arch/arm/kernel/sleep.S | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'arch/arm/kernel/sleep.S') diff --git a/arch/arm/kernel/sleep.S b/arch/arm/kernel/sleep.S index 761c5debfab0..6060dbc7844e 100644 --- a/arch/arm/kernel/sleep.S +++ b/arch/arm/kernel/sleep.S @@ -118,12 +118,16 @@ ENDPROC(cpu_resume_after_mmu) .text .align + +#ifdef CONFIG_MMU .arm ENTRY(cpu_resume_arm) THUMB( adr r9, BSYM(1f) ) @ Kernel is entered in ARM. THUMB( bx r9 ) @ If this is a Thumb-2 kernel, THUMB( .thumb ) @ switch to Thumb now. THUMB(1: ) +#endif + ENTRY(cpu_resume) ARM_BE8(setend be) @ ensure we are in BE mode #ifdef CONFIG_ARM_VIRT_EXT @@ -155,7 +159,10 @@ THUMB( ldmia r0!, {r1, r2, r3} ) THUMB( mov sp, r2 ) THUMB( bx r3 ) ENDPROC(cpu_resume) + +#ifdef CONFIG_MMU ENDPROC(cpu_resume_arm) +#endif .align 2 _sleep_save_sp: -- cgit v1.2.3