This replaces the reset_cpu() function which every SoC or board must provide with registered handlers. This makes it possible to have multiple reset functions for boards which have multiple ways to reset the machine. Also boards which have no way at all to reset the machine no longer have to provide a dummy reset_cpu() function. The problem this solves is that some machines have external PMICs or similar to reset the system which have to be preferred over the internal SoC reset, because the PMIC can reset not only the SoC but also the external devices. To pick the right way to reset a machine each handler has a priority. The default priority is 100 and all currently existing restart handlers are registered with this priority. of_get_restart_priority() allows to retrieve the priority from the device tree which makes it possible for boards to give certain restart handlers a higher priority in order to use this one instead of the default one. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
41 lines
1,000 B
ArmAsm
41 lines
1,000 B
ArmAsm
/*
|
|
* reset AT91SAM9G45 as per errata
|
|
*
|
|
* Copyright (C) 2011 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcosoft.com>
|
|
*
|
|
* unless the SDRAM is cleanly shutdown before we hit the
|
|
* reset register it can be left driving the data bus and
|
|
* killing the chance of a subsequent boot from NAND
|
|
*
|
|
* GPLv2 Only
|
|
*/
|
|
|
|
#include <linux/linkage.h>
|
|
#include <mach/hardware.h>
|
|
#include <mach/at91sam9_ddrsdr.h>
|
|
#include <mach/at91_rstc.h>
|
|
|
|
.arm
|
|
|
|
.globl restart_sam9g45
|
|
|
|
restart_sam9g45: ldr r0, .at91_va_base_sdramc @ preload constants
|
|
ldr r1, .at91_va_base_rstc_cr
|
|
|
|
mov r2, #1
|
|
mov r3, #AT91_DDRSDRC_LPCB_POWER_DOWN
|
|
ldr r4, =AT91_RSTC_KEY | AT91_RSTC_PERRST | AT91_RSTC_PROCRST
|
|
|
|
.balign 32 @ align to cache line
|
|
|
|
str r2, [r0, #AT91_DDRSDRC_RTR] @ disable DDR0 access
|
|
str r3, [r0, #AT91_DDRSDRC_LPR] @ power down DDR0
|
|
str r4, [r1] @ reset processor
|
|
|
|
b .
|
|
|
|
.at91_va_base_sdramc:
|
|
.word AT91_BASE_SYS + AT91_DDRSDRC0
|
|
.at91_va_base_rstc_cr:
|
|
.word AT91_BASE_SYS + AT91_RSTC_CR
|