summaryrefslogtreecommitdiffstats
path: root/arch/mips
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2017-03-13 12:05:23 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2017-03-30 08:23:21 +0200
commitdc247478c67d663b6e3f5ce639e06b23b54e6aff (patch)
tree7414c9d540c5d4600d161cf0bb72ccbd0e3da564 /arch/mips
parent441e9f5a72b245b671118f3e771eb129834a7a34 (diff)
downloadbarebox-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/mips')
-rw-r--r--arch/mips/mach-xburst/Kconfig1
-rw-r--r--arch/mips/mach-xburst/reset-jz4750.c13
2 files changed, 11 insertions, 3 deletions
diff --git a/arch/mips/mach-xburst/Kconfig b/arch/mips/mach-xburst/Kconfig
index fd106fefe0..ee79ff6167 100644
--- a/arch/mips/mach-xburst/Kconfig
+++ b/arch/mips/mach-xburst/Kconfig
@@ -21,7 +21,6 @@ choice
config BOARD_RZX50
bool "Ritmix RZX-50"
- select HAS_POWEROFF
select CPU_JZ4755
config BOARD_CI20
diff --git a/arch/mips/mach-xburst/reset-jz4750.c b/arch/mips/mach-xburst/reset-jz4750.c
index 25830f130e..1fdcc7b8af 100644
--- a/arch/mips/mach-xburst/reset-jz4750.c
+++ b/arch/mips/mach-xburst/reset-jz4750.c
@@ -22,6 +22,8 @@
#include <common.h>
#include <io.h>
+#include <init.h>
+#include <poweroff.h>
#include <mach/jz4750d_regs.h>
static void __noreturn jz4750d_halt(void)
@@ -37,7 +39,7 @@ static void __noreturn jz4750d_halt(void)
unreachable();
}
-void __noreturn poweroff()
+static void __noreturn jz4750_poweroff(struct poweroff_handler *handler)
{
u32 ctrl;
@@ -50,4 +52,11 @@ void __noreturn poweroff()
writel(RTC_HCR_PD, (u32 *)RTC_HCR);
jz4750d_halt();
}
-EXPORT_SYMBOL(poweroff);
+
+static int jz4750_init(void)
+{
+ poweroff_handler_register_fn(jz4750_poweroff);
+
+ return 0;
+}
+coredevice_initcall(jz4750_init);