diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2015-08-26 09:04:45 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2015-08-27 21:37:03 +0200 |
commit | 83b0a5ae055bc084938dac96b3ea1c796d99d86c (patch) | |
tree | ba69e2015cbfeb1626f7ea3f6bf850556541095a /arch/arm/lib | |
parent | 167e93947e9b755b54900ae9870dbcc089f8d6c9 (diff) | |
download | barebox-83b0a5ae055bc084938dac96b3ea1c796d99d86c.tar.gz barebox-83b0a5ae055bc084938dac96b3ea1c796d99d86c.tar.xz |
restart: replace reset_cpu with registered restart handlers
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>
Diffstat (limited to 'arch/arm/lib')
-rw-r--r-- | arch/arm/lib/bootm.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/arch/arm/lib/bootm.c b/arch/arm/lib/bootm.c index 8327c3f560..7bb9b43656 100644 --- a/arch/arm/lib/bootm.c +++ b/arch/arm/lib/bootm.c @@ -16,6 +16,7 @@ #include <libbb.h> #include <magicvar.h> #include <binfmt.h> +#include <restart.h> #include <asm/byteorder.h> #include <asm/setup.h> @@ -111,7 +112,7 @@ static int __do_bootm_linux(struct image_data *data, unsigned long free_mem, int start_linux((void *)kernel, swap, initrd_start, initrd_size, data->oftree); - reset_cpu(0); + restart_machine(); return -ERESTARTSYS; } @@ -378,7 +379,7 @@ static int do_bootm_barebox(struct image_data *data) start_linux(barebox, 0, 0, 0, data->oftree); - reset_cpu(0); + restart_machine(); } static struct image_handler barebox_handler = { @@ -518,7 +519,7 @@ static int do_bootm_aimage(struct image_data *data) second(); - reset_cpu(0); + restart_machine(); } close(fd); |