Module Name:    src
Committed By:   jmcneill
Date:           Fri Feb 27 21:13:52 UTC 2015

Modified Files:
        src/sys/arch/arm/amlogic: amlogic_crureg.h
        src/sys/arch/evbarm/amlogic: amlogic_machdep.c

Log Message:
implement amlogic_reset


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/amlogic/amlogic_crureg.h
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/evbarm/amlogic/amlogic_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/arm/amlogic/amlogic_crureg.h
diff -u src/sys/arch/arm/amlogic/amlogic_crureg.h:1.1 src/sys/arch/arm/amlogic/amlogic_crureg.h:1.2
--- src/sys/arch/arm/amlogic/amlogic_crureg.h:1.1	Fri Feb 27 19:57:10 2015
+++ src/sys/arch/arm/amlogic/amlogic_crureg.h	Fri Feb 27 21:13:52 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: amlogic_crureg.h,v 1.1 2015/02/27 19:57:10 jmcneill Exp $ */
+/* $NetBSD: amlogic_crureg.h,v 1.2 2015/02/27 21:13:52 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2015 Jared D. McNeill <[email protected]>
@@ -47,4 +47,12 @@
 #define PREG_CTLREG0_ADDR_REG		CBUS_REG(0x2000)
 #define PREG_CTLREG0_ADDR_CLKRATE	__BITS(9,4)
 
+#define WATCHDOG_TC_REG			CBUS_REG(0x2640)
+#define WATCHDOG_TC_CPUS		__BITS(27,24)
+#define WATCHDOG_TC_ENABLE		__BIT(19)
+#define WATCHDOG_TC_TCNT		__BITS(15,0)
+
+#define WATCHDOG_RESET_REG		CBUS_REG(0x2641)
+#define WATCHDOG_RESET_COUNT		__BITS(15,0)
+
 #endif /* _ARM_AMLOGIC_CRUREG_H */

Index: src/sys/arch/evbarm/amlogic/amlogic_machdep.c
diff -u src/sys/arch/evbarm/amlogic/amlogic_machdep.c:1.5 src/sys/arch/evbarm/amlogic/amlogic_machdep.c:1.6
--- src/sys/arch/evbarm/amlogic/amlogic_machdep.c:1.5	Fri Feb 27 20:41:01 2015
+++ src/sys/arch/evbarm/amlogic/amlogic_machdep.c	Fri Feb 27 21:13:52 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: amlogic_machdep.c,v 1.5 2015/02/27 20:41:01 jmcneill Exp $ */
+/*	$NetBSD: amlogic_machdep.c,v 1.6 2015/02/27 21:13:52 jmcneill Exp $ */
 
 /*
  * Machine dependent functions for kernel setup for TI OSK5912 board.
@@ -125,7 +125,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: amlogic_machdep.c,v 1.5 2015/02/27 20:41:01 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: amlogic_machdep.c,v 1.6 2015/02/27 21:13:52 jmcneill Exp $");
 
 #include "opt_machdep.h"
 #include "opt_ddb.h"
@@ -181,6 +181,7 @@ __KERNEL_RCSID(0, "$NetBSD: amlogic_mach
 #include <arm/mainbus/mainbus.h>
 
 #include <arm/amlogic/amlogic_reg.h>
+#include <arm/amlogic/amlogic_crureg.h>
 #include <arm/amlogic/amlogic_var.h>
 #include <arm/amlogic/amlogic_comreg.h>
 #include <arm/amlogic/amlogic_comvar.h>
@@ -490,16 +491,16 @@ consinit(void)
 void
 amlogic_reset(void)
 {
-#if notyet
 	bus_space_tag_t bst = &amlogic_bs_tag;
-	bus_space_handle_t bsh;
+        bus_space_handle_t bsh = amlogic_core_bsh;
 
-	bus_space_subregion(bst, amlogic_core1_bsh,
-	    ROCKCHIP_CRU_OFFSET, ROCKCHIP_CRU_SIZE, &bsh);
+	bus_space_write_4(bst, bsh, WATCHDOG_TC_REG,
+	    WATCHDOG_TC_CPUS | WATCHDOG_TC_ENABLE | 1);
+	bus_space_write_4(bst, bsh, WATCHDOG_RESET_REG, 0);
 
-	bus_space_write_4(bst, bsh, CRU_GLB_SRST_FST_REG,
-	    CRU_GLB_SRST_FST_MAGIC);
-#endif
+	for (;;) {
+		__asm("wfi");
+	}
 }
 
 #ifdef KGDB

Reply via email to