Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/arm/imx/fdt Implement platform reset for i.MX6.



details:   https://anonhg.NetBSD.org/src/rev/ce151f222a6c
branches:  trunk
changeset: 460429:ce151f222a6c
user:      hkenken <hkenken%NetBSD.org@localhost>
date:      Wed Oct 23 02:34:43 2019 +0000

description:
Implement platform reset for i.MX6.

diffstat:

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

diffs (54 lines):

diff -r 43e90982fba3 -r ce151f222a6c sys/arch/arm/imx/fdt/imx6_platform.c
--- a/sys/arch/arm/imx/fdt/imx6_platform.c      Wed Oct 23 01:30:54 2019 +0000
+++ b/sys/arch/arm/imx/fdt/imx6_platform.c      Wed Oct 23 02:34:43 2019 +0000
@@ -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 @@
 #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 @@
 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 = {



Home | Main Index | Thread Index | Old Index