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 <khilman@linaro.org> Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org> Cc: Lina Iyer <lina.iyer@linaro.org> Signed-off-by: Stephen Boyd <sboyd@codeaurora.org> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
This commit is contained in:
		
					parent
					
						
							
								02b4e2756e
							
						
					
				
			
			
				commit
				
					
						32e55a777f
					
				
			
		
					 2 changed files with 8 additions and 0 deletions
				
			
		| 
						 | 
					@ -7,6 +7,7 @@ struct sleep_save_sp {
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
extern void cpu_resume(void);
 | 
					extern void cpu_resume(void);
 | 
				
			||||||
 | 
					extern void cpu_resume_arm(void);
 | 
				
			||||||
extern int cpu_suspend(unsigned long, int (*)(unsigned long));
 | 
					extern int cpu_suspend(unsigned long, int (*)(unsigned long));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -118,6 +118,12 @@ ENDPROC(cpu_resume_after_mmu)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	.text
 | 
						.text
 | 
				
			||||||
	.align
 | 
						.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)
 | 
					ENTRY(cpu_resume)
 | 
				
			||||||
ARM_BE8(setend be)			@ ensure we are in BE mode
 | 
					ARM_BE8(setend be)			@ ensure we are in BE mode
 | 
				
			||||||
#ifdef CONFIG_ARM_VIRT_EXT
 | 
					#ifdef CONFIG_ARM_VIRT_EXT
 | 
				
			||||||
| 
						 | 
					@ -149,6 +155,7 @@ THUMB(	ldmia	r0!, {r1, r2, r3}	)
 | 
				
			||||||
THUMB(	mov	sp, r2			)
 | 
					THUMB(	mov	sp, r2			)
 | 
				
			||||||
THUMB(	bx	r3			)
 | 
					THUMB(	bx	r3			)
 | 
				
			||||||
ENDPROC(cpu_resume)
 | 
					ENDPROC(cpu_resume)
 | 
				
			||||||
 | 
					ENDPROC(cpu_resume_arm)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	.align 2
 | 
						.align 2
 | 
				
			||||||
_sleep_save_sp:
 | 
					_sleep_save_sp:
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue