diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2017-03-13 12:05:23 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2017-03-30 08:23:21 +0200 |
commit | dc247478c67d663b6e3f5ce639e06b23b54e6aff (patch) | |
tree | 7414c9d540c5d4600d161cf0bb72ccbd0e3da564 /arch/arm | |
parent | 441e9f5a72b245b671118f3e771eb129834a7a34 (diff) | |
download | barebox-dc247478c67d663b6e3f5ce639e06b23b54e6aff.tar.gz barebox-dc247478c67d663b6e3f5ce639e06b23b54e6aff.tar.xz |
poweroff: Allow to register poweroff handlers
Allow to register handlers for poweroff. This allows to have multiple
poweroff implementations in a single binary. The implementation is close
to the restart handlers.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/arm')
-rw-r--r-- | arch/arm/Kconfig | 2 | ||||
-rw-r--r-- | arch/arm/boards/mioa701/gpio0_poweroff.c | 3 | ||||
-rw-r--r-- | arch/arm/mach-highbank/reset.c | 20 | ||||
-rw-r--r-- | arch/arm/mach-pxa/pxa2xx.c | 15 | ||||
-rw-r--r-- | arch/arm/mach-pxa/pxa3xx.c | 13 |
5 files changed, 37 insertions, 16 deletions
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 4d952698fc..47b48308a6 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -93,7 +93,6 @@ config ARCH_EP93XX config ARCH_HIGHBANK bool "Calxeda Highbank" select HAS_DEBUG_LL - select HAS_POWEROFF select ARCH_HAS_L2X0 select CPU_V7 select ARM_AMBA @@ -154,7 +153,6 @@ config ARCH_OMAP config ARCH_PXA bool "Intel/Marvell PXA based" select GENERIC_GPIO - select HAS_POWEROFF config ARCH_ROCKCHIP bool "Rockchip RX3xxx" diff --git a/arch/arm/boards/mioa701/gpio0_poweroff.c b/arch/arm/boards/mioa701/gpio0_poweroff.c index 2054548aa6..01a5d0cc6e 100644 --- a/arch/arm/boards/mioa701/gpio0_poweroff.c +++ b/arch/arm/boards/mioa701/gpio0_poweroff.c @@ -19,6 +19,7 @@ #include <clock.h> #include <common.h> #include <init.h> +#include <poweroff.h> #include <gpio.h> #include <poller.h> @@ -45,7 +46,7 @@ static void try_poweroff(void) gpio_set_value(GPIO115_LED_nKeyboard, 0); mdelay(2000); - poweroff(); + poweroff_machine(); } static void gpio0_poller_fn(struct poller_struct *poller) diff --git a/arch/arm/mach-highbank/reset.c b/arch/arm/mach-highbank/reset.c index 929ded5951..b60f34452e 100644 --- a/arch/arm/mach-highbank/reset.c +++ b/arch/arm/mach-highbank/reset.c @@ -6,6 +6,7 @@ #include <common.h> #include <io.h> +#include <poweroff.h> #include <restart.h> #include <init.h> @@ -20,15 +21,7 @@ static void __noreturn highbank_restart_soc(struct restart_handler *rst) hang(); } -static int restart_register_feature(void) -{ - restart_handler_register_fn(highbank_restart_soc); - - return 0; -} -coredevice_initcall(restart_register_feature); - -void __noreturn poweroff() +void __noreturn highbank_poweroff(struct poweroff_handler *handler) { shutdown_barebox(); @@ -37,3 +30,12 @@ void __noreturn poweroff() while(1); } + +static int highbank_init(void) +{ + restart_handler_register_fn(highbank_restart_soc); + poweroff_handler_register_fn(highbank_poweroff); + + return 0; +} +coredevice_initcall(highbank_init); diff --git a/arch/arm/mach-pxa/pxa2xx.c b/arch/arm/mach-pxa/pxa2xx.c index b712b388c8..e28378e6db 100644 --- a/arch/arm/mach-pxa/pxa2xx.c +++ b/arch/arm/mach-pxa/pxa2xx.c @@ -14,6 +14,7 @@ #include <common.h> #include <init.h> +#include <poweroff.h> #include <reset_source.h> #include <mach/hardware.h> #include <mach/pxa-regs.h> @@ -46,9 +47,7 @@ void pxa_clear_reset_source(void) RCSR = RCSR_GPR | RCSR_SMR | RCSR_WDR | RCSR_HWR; } -device_initcall(pxa_detect_reset_source); - -void __noreturn poweroff(void) +static void __noreturn pxa2xx_poweroff(struct poweroff_handler *handler) { shutdown_barebox(); @@ -57,3 +56,13 @@ void __noreturn poweroff(void) pxa_suspend(PWRMODE_DEEPSLEEP); unreachable(); } + +static int pxa2xx_init(void) +{ + poweroff_handler_register_fn(pxa2xx_poweroff); + + pxa_detect_reset_source(); + + return 0; +} +device_initcall(pxa2xx_init); diff --git a/arch/arm/mach-pxa/pxa3xx.c b/arch/arm/mach-pxa/pxa3xx.c index 86ca63b160..ccfd952b5e 100644 --- a/arch/arm/mach-pxa/pxa3xx.c +++ b/arch/arm/mach-pxa/pxa3xx.c @@ -14,6 +14,7 @@ #include <common.h> #include <init.h> +#include <poweroff.h> #include <reset_source.h> #include <mach/hardware.h> #include <mach/pxa-regs.h> @@ -48,7 +49,7 @@ void pxa_clear_reset_source(void) device_initcall(pxa_detect_reset_source); -void __noreturn poweroff(void) +static void __noreturn pxa3xx_poweroff(struct poweroff_handler *handler) { shutdown_barebox(); @@ -57,3 +58,13 @@ void __noreturn poweroff(void) pxa3xx_suspend(PXA3xx_PM_S3D4C4); unreachable(); } + +static int pxa3xx_init(void) +{ + poweroff_handler_register_fn(pxa3xx_poweroff); + + pxa_detect_reset_source(); + + return 0; +} +device_initcall(pxa3xx_init); |