Source-Changes-HG archive

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

[src/trunk]: src/sys/arch implement amlogic_reset



details:   https://anonhg.NetBSD.org/src/rev/075e405e1c80
branches:  trunk
changeset: 806530:075e405e1c80
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Fri Feb 27 21:13:52 2015 +0000

description:
implement amlogic_reset

diffstat:

 sys/arch/arm/amlogic/amlogic_crureg.h     |  10 +++++++++-
 sys/arch/evbarm/amlogic/amlogic_machdep.c |  19 ++++++++++---------
 2 files changed, 19 insertions(+), 10 deletions(-)

diffs (72 lines):

diff -r 149bac6e770f -r 075e405e1c80 sys/arch/arm/amlogic/amlogic_crureg.h
--- a/sys/arch/arm/amlogic/amlogic_crureg.h     Fri Feb 27 20:41:01 2015 +0000
+++ b/sys/arch/arm/amlogic/amlogic_crureg.h     Fri Feb 27 21:13:52 2015 +0000
@@ -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 <jmcneill%invisible.ca@localhost>
@@ -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 */
diff -r 149bac6e770f -r 075e405e1c80 sys/arch/evbarm/amlogic/amlogic_machdep.c
--- a/sys/arch/evbarm/amlogic/amlogic_machdep.c Fri Feb 27 20:41:01 2015 +0000
+++ b/sys/arch/evbarm/amlogic/amlogic_machdep.c Fri Feb 27 21:13:52 2015 +0000
@@ -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 @@
 #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 @@
 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



Home | Main Index | Thread Index | Old Index