Module Name:    src
Committed By:   hkenken
Date:           Wed Oct 23 02:34:43 UTC 2019

Modified Files:
        src/sys/arch/arm/imx/fdt: imx6_platform.c

Log Message:
Implement platform reset for i.MX6.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/arm/imx/fdt/imx6_platform.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/arm/imx/fdt/imx6_platform.c
diff -u src/sys/arch/arm/imx/fdt/imx6_platform.c:1.7 src/sys/arch/arm/imx/fdt/imx6_platform.c:1.8
--- src/sys/arch/arm/imx/fdt/imx6_platform.c:1.7	Fri Oct 18 12:53:08 2019
+++ src/sys/arch/arm/imx/fdt/imx6_platform.c	Wed Oct 23 02:34:43 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: imx6_platform.c,v 1.7 2019/10/18 12:53:08 hkenken Exp $	*/
+/*	$NetBSD: imx6_platform.c,v 1.8 2019/10/23 02:34:43 hkenken Exp $	*/
 /*-
  * Copyright (c) 2019 Genetec Corporation.  All rights reserved.
  * Written by Hashimoto Kenichi for Genetec Corporation.
@@ -25,7 +25,7 @@
  * SUCH DAMAGE.
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: imx6_platform.c,v 1.7 2019/10/18 12:53:08 hkenken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: imx6_platform.c,v 1.8 2019/10/23 02:34:43 hkenken Exp $");
 
 #include "arml2cc.h"
 #include "opt_console.h"
@@ -57,6 +57,7 @@ __KERNEL_RCSID(0, "$NetBSD: imx6_platfor
 #include <arm/imx/imx6_reg.h>
 #include <arm/imx/imx6_srcreg.h>
 #include <arm/imx/imxuartreg.h>
+#include <arm/imx/imxwdogreg.h>
 
 #include <arm/imx/fdt/imx6_platform.h>
 
@@ -197,6 +198,27 @@ imx_platform_mpstart(void)
 static void
 imx6_platform_reset(void)
 {
+	bus_space_tag_t bst = &armv7_generic_bs_tag;
+	bus_space_handle_t bsh;
+
+	if (bus_space_map(bst, IMX6_AIPS1_BASE + AIPS1_WDOG1_BASE, AIPS1_WDOG_SIZE, 0, &bsh))
+		panic("couldn't map wdog1 registers");
+
+	delay(1000);	/* wait for flushing FIFO of serial console */
+
+	cpsid(I32_bit|F32_bit);
+
+	/* software reset signal on wdog */
+	bus_space_write_2(bst, bsh, IMX_WDOG_WCR, WCR_WDE);
+
+	/*
+	 * write twice due to errata.
+	 * Reference: ERR004346: IMX6DQCE Chip Errata for the i.MX 6Dual/6Quad
+	 */
+	bus_space_write_2(bst, bsh, IMX_WDOG_WCR, WCR_WDE);
+
+	for (;;)
+		__asm("wfi");
 }
 
 const struct arm_platform imx6_platform = {

Reply via email to