Skip to content

Commit

Permalink
ARM: mach-imx: move early resume code out of the .data section
Browse files Browse the repository at this point in the history
Building the kernel with allyesconfig fails because the i.mx early
resume code located in the .data section is unable to fixup the bl
relocation as the branch target gets too far away.

The idea of having code in the .data section allows for easy access to
nearby data using relative addressing while the MMU is off. However it
is probably best to move the code back to the .text section where it
belongs and fixup the data access instead.  This solves the bl reloc
issue (at least until this becomes a general problem) and simplifies
the code as well.

Signed-off-by: Nicolas Pitre <nico@linaro.org>
Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
  • Loading branch information
Nicolas Pitre authored and Shawn Guo committed Mar 4, 2013
1 parent 6dbe51c commit b4e6153
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 24 deletions.
18 changes: 9 additions & 9 deletions arch/arm/mach-imx/headsmp.S
Original file line number Diff line number Diff line change
Expand Up @@ -26,26 +26,26 @@ ENDPROC(v7_secondary_startup)

#ifdef CONFIG_PM
/*
* The following code is located into the .data section. This is to
* allow phys_l2x0_saved_regs to be accessed with a relative load
* as we are running on physical address here.
* The following code must assume it is running from physical address
* where absolute virtual addresses to the data section have to be
* turned into relative ones.
*/
.data
.align

#ifdef CONFIG_CACHE_L2X0
.macro pl310_resume
ldr r2, phys_l2x0_saved_regs
adr r0, l2x0_saved_regs_offset
ldr r2, [r0]
add r2, r2, r0
ldr r0, [r2, #L2X0_R_PHY_BASE] @ get physical base of l2x0
ldr r1, [r2, #L2X0_R_AUX_CTRL] @ get aux_ctrl value
str r1, [r0, #L2X0_AUX_CTRL] @ restore aux_ctrl
mov r1, #0x1
str r1, [r0, #L2X0_CTRL] @ re-enable L2
.endm

.globl phys_l2x0_saved_regs
phys_l2x0_saved_regs:
.long 0
l2x0_saved_regs_offset:
.word l2x0_saved_regs - .

#else
.macro pl310_resume
.endm
Expand Down
15 changes: 0 additions & 15 deletions arch/arm/mach-imx/pm-imx6q.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@
#include "common.h"
#include "hardware.h"

extern unsigned long phys_l2x0_saved_regs;

static int imx6q_suspend_finish(unsigned long val)
{
cpu_do_idle();
Expand Down Expand Up @@ -57,18 +55,5 @@ static const struct platform_suspend_ops imx6q_pm_ops = {

void __init imx6q_pm_init(void)
{
/*
* The l2x0 core code provides an infrastucture to save and restore
* l2x0 registers across suspend/resume cycle. But because imx6q
* retains L2 content during suspend and needs to resume L2 before
* MMU is enabled, it can only utilize register saving support and
* have to take care of restoring on its own. So we save physical
* address of the data structure used by l2x0 core to save registers,
* and later restore the necessary ones in imx6q resume entry.
*/
#ifdef CONFIG_CACHE_L2X0
phys_l2x0_saved_regs = __pa(&l2x0_saved_regs);
#endif

suspend_set_ops(&imx6q_pm_ops);
}

0 comments on commit b4e6153

Please sign in to comment.