diff mbox series

[049/120] MIPS: PS2: Power off support

Message ID f8961e0b92874c58c07951430d7b8d4899feb5b2.1567326213.git.noring@nocrew.org (mailing list archive)
State RFC
Headers show
Series Linux for the PlayStation 2 | expand

Commit Message

Fredrik Noring Sept. 1, 2019, 3:55 p.m. UTC
Signed-off-by: Fredrik Noring <noring@nocrew.org>
---
 arch/mips/ps2/Makefile |  1 +
 arch/mips/ps2/reboot.c | 29 +++++++++++++++++++++++++++++
 2 files changed, 30 insertions(+)
 create mode 100644 arch/mips/ps2/reboot.c
diff mbox series

Patch

diff --git a/arch/mips/ps2/Makefile b/arch/mips/ps2/Makefile
index b53bddcc8c01..6f671112fbcb 100644
--- a/arch/mips/ps2/Makefile
+++ b/arch/mips/ps2/Makefile
@@ -3,6 +3,7 @@  obj-y		+= identify.o
 obj-y		+= intc-irq.o
 obj-y		+= irq.o
 obj-y		+= memory.o
+obj-y		+= reboot.o
 obj-y		+= rom.o
 obj-m		+= rom-sysfs.o
 obj-y		+= scmd.o
diff --git a/arch/mips/ps2/reboot.c b/arch/mips/ps2/reboot.c
new file mode 100644
index 000000000000..b2a3ada5268b
--- /dev/null
+++ b/arch/mips/ps2/reboot.c
@@ -0,0 +1,29 @@ 
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * PlayStation 2 power off
+ *
+ * Copyright (C) 2019 Fredrik Noring
+ */
+
+#include <linux/init.h>
+#include <linux/pm.h>
+
+#include <asm/processor.h>
+#include <asm/reboot.h>
+
+#include <asm/mach-ps2/scmd.h>
+
+static void __noreturn power_off(void)
+{
+	scmd_power_off();
+
+	cpu_relax_forever();
+}
+
+static int __init ps2_init_reboot(void)
+{
+	pm_power_off = power_off;
+
+	return 0;
+}
+subsys_initcall(ps2_init_reboot);