Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/arm/fdt Use PSCI for reset and poweroff when availa...



details:   https://anonhg.NetBSD.org/src/rev/5e1b36c3def0
branches:  trunk
changeset: 356237:5e1b36c3def0
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Mon Sep 11 09:21:56 2017 +0000

description:
Use PSCI for reset and poweroff when available.

diffstat:

 sys/arch/arm/fdt/psci_fdt.c |  26 ++++++++++++++++++++++++--
 1 files changed, 24 insertions(+), 2 deletions(-)

diffs (54 lines):

diff -r 7369c6d444cc -r 5e1b36c3def0 sys/arch/arm/fdt/psci_fdt.c
--- a/sys/arch/arm/fdt/psci_fdt.c       Mon Sep 11 07:33:45 2017 +0000
+++ b/sys/arch/arm/fdt/psci_fdt.c       Mon Sep 11 09:21:56 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: psci_fdt.c,v 1.2 2017/08/05 11:58:19 jmcneill Exp $ */
+/* $NetBSD: psci_fdt.c,v 1.3 2017/09/11 09:21:56 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill <jmcneill%invisible.ca@localhost>
@@ -29,7 +29,7 @@
 #include "opt_multiprocessor.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: psci_fdt.c,v 1.2 2017/08/05 11:58:19 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: psci_fdt.c,v 1.3 2017/09/11 09:21:56 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -59,6 +59,25 @@
 
 CFATTACH_DECL_NEW(psci_fdt, 0, psci_fdt_match, psci_fdt_attach, NULL, NULL);
 
+static void
+psci_fdt_reset(device_t dev)
+{
+       delay(500000);
+       psci_system_reset();
+}
+
+static void
+psci_fdt_poweroff(device_t dev)
+{
+       delay(500000);
+       psci_system_off();
+}
+
+static const struct fdtbus_power_controller_func psci_power_funcs = {
+       .reset = psci_fdt_reset,
+       .poweroff = psci_fdt_poweroff,
+};
+
 static int
 psci_fdt_match(device_t parent, cfdata_t cf, void *aux)
 {
@@ -81,6 +100,9 @@
 
        aprint_naive("\n");
        aprint_normal(": PSCI %u.%u\n", ver_maj, ver_min);
+
+       fdtbus_register_power_controller(self, phandle,
+           &psci_power_funcs);
 }
 
 static int



Home | Main Index | Thread Index | Old Index