Commit d20abd36f0e83cb0a4fd93f51334104423d6468e

Authored by Dave Gerlach
Committed by Lokesh Vutla
1 parent 1fc1621abf

ARM: AM43xx: Protect against jump to bad return address from rtc-only

For am43xx_rtconly_evm_defconfig, the bootloader indicates support for
RTC-Only modes by writing a magic number into RTC scratch register
which kernel PM code will then clear and then write back again if
RTC-Only mode entry is desired. If no PM code is loaded in the kernel,
this magic number will not get cleared and then be detected again
by the bootloader on a warm reboot, indicating an RTC+DDR resume event
and causing the bootloader to attempt to jump to the resume address in
RTC scratch register 0, which is invalid.

Add a check to prevent jumping to address 0 if the scratch register is
not properly programmed, otherwise warm reboot will not work on am437x
if no PM is loaded in the kernel.

Signed-off-by: Dave Gerlach <d-gerlach@ti.com>

Showing 1 changed file with 2 additions and 1 deletions Side-by-side Diff

arch/arm/cpu/armv7/am33xx/board.c
... ... @@ -367,7 +367,8 @@
367 367 sdram_init();
368 368  
369 369 resume_func = (void *)readl(&rtc->scratch0);
370   - resume_func();
  370 + if (resume_func)
  371 + resume_func();
371 372 }
372 373 #endif
373 374