davinci: add watchdog reset method
authorDavid Brownell <dbrownell@users.sourceforge.net>
Tue, 20 Oct 2009 05:50:51 +0000 (22:50 -0700)
committerDavid Brownell <dbrownell@users.sourceforge.net>
Tue, 20 Oct 2009 05:50:51 +0000 (22:50 -0700)
Lightly tested on dm365.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
tcl/target/davinci.cfg

index 658e7fe5bc2f5cea1d31c5e8bce63cf547a662f1..e1eb48f598285991233780e37a4150110bc871c3 100644 (file)
@@ -33,7 +33,7 @@ proc mmw {reg setbits clearbits} {
 #
 
 # PLL version 0x02: tested on dm355
-# REVISIT:  On dm6446 and dm357 the PLLRST polarity is different.
+# REVISIT:  On dm6446/dm357 the PLLRST polarity is different.
 proc pll_v02_setup {pll_addr mult config} {
        set pll_ctrl_addr [expr $pll_addr + 0x100]
        set pll_ctrl [mrw $pll_ctrl_addr]
@@ -174,3 +174,64 @@ proc psc_go {} {
        # wait for PTSTAT.go to clear (again ignoring DSP power domain)
        while { [expr [mrw $ptstat_addr] & 0x01] != 0 } { sleep 1 }
 }
+
+#
+# A reset using only SRST is a "Warm Reset", resetting everything in the
+# chip except ARM emulation (and everything _outside_ the chip that hooks
+# up to SRST).  But many boards don't expose SRST via their JTAG connectors
+# (it's not present on TI-14 headers).
+#
+# From the chip-only perspective, a "Max Reset" is a "Warm" reset ... except
+# without any board-wide side effects, since it's triggered using JTAG using
+# either (a) ARM watchdog timer, or (b) ICEpick.
+#
+proc davinci_wdog_reset {} {
+       set timer2_phys 0x01c21c00
+
+       # NOTE -- on entry
+       #   - JTAG communication with the ARM *must* be working OK; this
+       #     may imply using adaptive clocking or disabling WFI-in-idle
+       #   - current target must be the DaVinci ARM
+       #   - that ARM core must be halted
+       #   - timer2 clock is still enabled (PSC 29 on most chips)
+
+       #
+       # Part I -- run regardless of being halted via JTAG
+       #
+       # NOTE:  for now, we assume there's no DSP that could control the
+       # watchdog; or, equivalently, SUSPSRC.TMR2SRC says the watchdog
+       # suspend signal is controlled via ARM emulation suspend.
+       #
+
+       # EMUMGT_CLKSPEED: write FREE bit to run despite emulation halt
+       arm926ejs mww_phys [expr $timer2_phys + 0x28] 0x00004000
+
+       #
+       # Part II -- in case watchdog hasn't been set up
+       #
+
+       # TCR: disable, force internal clock source
+       arm926ejs mww_phys [expr $timer2_phys + 0x20] 0
+
+       # TGCR: reset, force to 64-bit wdog mode, un-reset ("initial" state)
+       arm926ejs mww_phys [expr $timer2_phys + 0x24] 0
+       arm926ejs mww_phys [expr $timer2_phys + 0x24] 0x110b
+
+       # clear counter (TIM12, TIM34) and period (PRD12, PRD34) registers
+       # so watchdog triggers ASAP
+       arm926ejs mww_phys [expr $timer2_phys + 0x10] 0
+       arm926ejs mww_phys [expr $timer2_phys + 0x14] 0
+       arm926ejs mww_phys [expr $timer2_phys + 0x18] 0
+       arm926ejs mww_phys [expr $timer2_phys + 0x1c] 0
+
+       # WDTCR: put into pre-active state, then active
+       arm926ejs mww_phys [expr $timer2_phys + 0x28] 0xa5c64000
+       arm926ejs mww_phys [expr $timer2_phys + 0x28] 0xda7e4000
+
+       #
+       # Part III -- it's ready to rumble
+       #
+
+       # WDTCR: write invalid WDKEY to trigger reset
+       arm926ejs mww_phys [expr $timer2_phys + 0x28] 0x00004000
+}

Linking to existing account procedure

If you already have an account and want to add another login method you MUST first sign in with your existing account and then change URL to read https://review.openocd.org/login/?link to get to this page again but this time it'll work for linking. Thank you.

SSH host keys fingerprints

1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=..              |
|+o..   .         |
|*.o   . .        |
|+B . . .         |
|Bo. = o S        |
|Oo.+ + =         |
|oB=.* = . o      |
| =+=.+   + E     |
|. .=o   . o      |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)