Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/evbarm/tegra Try to reboot with the PMIC if availab...



details:   https://anonhg.NetBSD.org/src/rev/9c1b366d53e3
branches:  trunk
changeset: 341761:9c1b366d53e3
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Sat Nov 21 12:22:25 2015 +0000

description:
Try to reboot with the PMIC if available, falling back to PMC.

When the PMIC watchdog is armed and we reboot via PMC, the watchdog stays
armed on the next boot (and we end up being reset mid-boot the second time).
By rebooting with PMIC, we can ensure that the watchdog is not armed after
reset.

diffstat:

 sys/arch/evbarm/tegra/tegra_machdep.c |  23 ++++++++++++++++++++---
 1 files changed, 20 insertions(+), 3 deletions(-)

diffs (58 lines):

diff -r f75ebb481440 -r 9c1b366d53e3 sys/arch/evbarm/tegra/tegra_machdep.c
--- a/sys/arch/evbarm/tegra/tegra_machdep.c     Sat Nov 21 12:19:47 2015 +0000
+++ b/sys/arch/evbarm/tegra/tegra_machdep.c     Sat Nov 21 12:22:25 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tegra_machdep.c,v 1.32 2015/11/20 16:44:23 jakllsch Exp $ */
+/* $NetBSD: tegra_machdep.c,v 1.33 2015/11/21 12:22:25 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2015 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tegra_machdep.c,v 1.32 2015/11/20 16:44:23 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tegra_machdep.c,v 1.33 2015/11/21 12:22:25 jmcneill Exp $");
 
 #include "opt_tegra.h"
 #include "opt_machdep.h"
@@ -109,6 +109,7 @@
 #define KERNEL_BASE_PHYS ((paddr_t)KERNEL_BASE_phys)
 
 static void tegra_device_register(device_t, void *);
+static void tegra_reset(void);
 static void tegra_powerdown(void);
 
 bs_protos(bs_notimpl);
@@ -244,7 +245,7 @@
            uboot_args[0], uboot_args[1], uboot_args[2], uboot_args[3]);
 #endif
 
-       cpu_reset_address = tegra_pmc_reset;
+       cpu_reset_address = tegra_reset;
        cpu_powerdown_address = tegra_powerdown;
 
        /* Talk to the user */
@@ -524,6 +525,22 @@
 }
 
 static void
+tegra_reset(void)
+{
+#if NAS3722PMIC > 0
+       device_t pmic = device_find_by_driver_unit("as3722pmic", 0);
+       if (pmic != NULL) {
+               delay(1000000);
+               if (as3722_reboot(pmic) != 0) {
+                       printf("WARNING: AS3722 reset failed\n");
+                       return;
+               }
+       }
+#endif
+       tegra_pmc_reset();
+}
+
+static void
 tegra_powerdown(void)
 {
 #if NAS3722PMIC > 0



Home | Main Index | Thread Index | Old Index