Skip to content

Commit b68d23d

Browse files
gamelasterborneoa
authored andcommitted
tcl/target/bl702: implement full software reset
In previous implementation, it was known that it does not perform full reset, and that some peripherals, such as GLB core, which handles among other stuff GPIOs, was not reset. It was presumed, that full reset by software is not possible, although, by accident, even when comment says that CTRL_PWRON_RESET is set to 1, it is not (value written into 0x40000018 supposed to be 0x7, not 0x6). CTRL_PWRON_RESET indeed triggers full "power-on like" reset, so this method is implemented in this commit. There are some workarounds to make reset seamless, without any error messages, which are described in comments of TCL script. Only down-side of this reset is, that chip is halted after reset bit later in BootROM than previous implementation, but it's still good. Change-Id: Ife2cdcc6a2d96a2e24039bfec149705baf046318 Signed-off-by: Marek Kraus <[email protected]> Reviewed-on: https://review.openocd.org/c/openocd/+/8529 Reviewed-by: Antonio Borneo <[email protected]> Tested-by: jenkins
1 parent bcebc84 commit b68d23d

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

tcl/target/bl702.cfg

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ $_TARGETNAME configure -work-area-phys 0x22020000 -work-area-size 0x10000 -work-
3434
# Internal RC ticks on 32 MHz, so this speed should be safe to use.
3535
adapter speed 4000
3636

37+
# Debug Module's ndmreset resets only Trust Zone Controller, so we need to do SW reset instead.
38+
# CTRL_PWRON_RESET triggers full "power-on like" reset.
39+
# This means that pinmux configuration to access JTAG is reset as well, and configured back early
40+
# in BootROM.
3741
$_TARGETNAME configure -event reset-assert-pre {
3842
halt
3943

@@ -55,6 +59,15 @@ $_TARGETNAME configure -event reset-assert-pre {
5559
# Do reset
5660
# In GLB_SWRST_CFG2, clear CTRL_SYS_RESET, CTRL_CPU_RESET and CTRL_PWRON_RESET
5761
mmw 0x40000018 0x0 0x00000007
62+
63+
# Since this full software reset resets GPIO pinmux as well, we will lose access
64+
# to JTAG right away after writing to register. This chip doesn't support abstract
65+
# memory access, so when this is done by progbuf or sysbus, OpenOCD will fail to read
66+
# if write was successful or not, and will print error about that. Since receiving of
67+
# this error is expected, we will turn off log printing for a moment,
68+
set lvl [lindex [debug_level] 1]
69+
debug_level -1
5870
# In GLB_SWRST_CFG2, set CTRL_SYS_RESET, CTRL_CPU_RESET and CTRL_PWRON_RESET to 1
59-
mmw 0x40000018 0x6 0x0
71+
catch {mmw 0x40000018 0x7 0x0}
72+
debug_level $lvl
6073
}

0 commit comments

Comments
 (0)