Module Name: src
Committed By: jmcneill
Date: Wed Nov 11 12:37:52 UTC 2015
Modified Files:
src/sys/arch/evbarm/tegra: tegra_machdep.c
Log Message:
support RB_POWERDOWN using the AMS AS3722 PMIC when available
To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 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.25 src/sys/arch/evbarm/tegra/tegra_machdep.c:1.26
--- src/sys/arch/evbarm/tegra/tegra_machdep.c:1.25 Mon Nov 9 23:05:58 2015
+++ src/sys/arch/evbarm/tegra/tegra_machdep.c Wed Nov 11 12:37:52 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: tegra_machdep.c,v 1.25 2015/11/09 23:05:58 jmcneill Exp $ */
+/* $NetBSD: tegra_machdep.c,v 1.26 2015/11/11 12:37:52 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.25 2015/11/09 23:05:58 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tegra_machdep.c,v 1.26 2015/11/11 12:37:52 jmcneill Exp $");
#include "opt_tegra.h"
#include "opt_machdep.h"
@@ -40,6 +40,7 @@ __KERNEL_RCSID(0, "$NetBSD: tegra_machde
#include "ukbd.h"
#include "genfb.h"
#include "ether.h"
+#include "as3722pmic.h"
#include <sys/param.h>
#include <sys/systm.h>
@@ -89,6 +90,10 @@ __KERNEL_RCSID(0, "$NetBSD: tegra_machde
#include <dev/usb/ukbdvar.h>
#include <net/if_ether.h>
+#if NAS3722PMIC > 0
+#include <dev/i2c/as3722.h>
+#endif
+
#ifndef TEGRA_MAX_BOOT_STRING
#define TEGRA_MAX_BOOT_STRING 1024
#endif
@@ -104,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_powerdown(void);
bs_protos(bs_notimpl);
@@ -253,6 +259,7 @@ initarm(void *arg)
#endif
cpu_reset_address = tegra_pmc_reset;
+ cpu_powerdown_address = tegra_powerdown;
/* Talk to the user */
DPRINTF("\nNetBSD/evbarm (tegra) booting ...\n");
@@ -527,3 +534,18 @@ tegra_device_register(device_t self, voi
}
#endif
}
+
+static void
+tegra_powerdown(void)
+{
+#if NAS3722PMIC > 0
+ device_t pmic = device_find_by_driver_unit("as3722pmic", 0);
+ if (pmic != NULL) {
+ if (as3722_poweroff(pmic) != 0) {
+ printf("WARNING: AS3722 poweroff failed\n");
+ return;
+ }
+ delay(1000000);
+ }
+#endif
+}