Module Name:    src
Committed By:   jmcneill
Date:           Sat Nov 21 12:22:26 UTC 2015

Modified Files:
        src/sys/arch/evbarm/tegra: tegra_machdep.c

Log Message:
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.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/arch/evbarm/tegra/tegra_machdep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/evbarm/tegra/tegra_machdep.c
diff -u src/sys/arch/evbarm/tegra/tegra_machdep.c:1.32 src/sys/arch/evbarm/tegra/tegra_machdep.c:1.33
--- src/sys/arch/evbarm/tegra/tegra_machdep.c:1.32	Fri Nov 20 16:44:23 2015
+++ src/sys/arch/evbarm/tegra/tegra_machdep.c	Sat Nov 21 12:22:25 2015
@@ -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 <[email protected]>
@@ -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 @@ extern char KERNEL_BASE_phys[];
 #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 @@ initarm(void *arg)
 	    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 @@ tegra_device_register(device_t self, voi
 }
 
 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

Reply via email to