]> www.infradead.org Git - users/borneoa/openocd-next.git/commitdiff
target: add support for Allwinner H618 SoC
authorElectric Worry <me@electricworry.net>
Thu, 29 May 2025 09:51:59 +0000 (10:51 +0100)
committerAntonio Borneo <borneo.antonio@gmail.com>
Fri, 13 Jun 2025 16:24:47 +0000 (16:24 +0000)
The Allwinner H618 is an updated H616 but appears functionally
equivalent. It is used in small boards such as Orange Pi Zero 3.

Change-Id: I299a42be746189f3e8e31070aa26b83ab7d806a4
Signed-off-by: Electric Worry <me@electricworry.net>
Reviewed-on: https://review.openocd.org/c/openocd/+/8936
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
tcl/target/allwinner_h618.cfg [new file with mode: 0644]

diff --git a/tcl/target/allwinner_h618.cfg b/tcl/target/allwinner_h618.cfg
new file mode 100644 (file)
index 0000000..98d3ace
--- /dev/null
@@ -0,0 +1,57 @@
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+# This is the Allwinner H618 chip. It is an updated version of the Allwinner H616.
+
+# Information is available on linux-sunxi.org:
+# Datasheet: https://linux-sunxi.org/images/b/b9/H616_Datasheet_V1.0_cleaned.pdf
+# Manual: https://linux-sunxi.org/images/2/24/H616_User_Manual_V1.0_cleaned.pdf
+
+if { [info exists CHIPNAME] } {
+       set  _CHIPNAME $CHIPNAME
+} else {
+       set  _CHIPNAME h618
+}
+
+if { [info exists USE_SMP] } {
+       set _USE_SMP $USE_SMP
+} else {
+       set _USE_SMP 0
+}
+
+if { [info exists DAP_TAPID] } {
+       set _DAP_TAPID $DAP_TAPID
+} else {
+       set _DAP_TAPID 0x5ba00477
+}
+
+set _cores 4
+jtag newtap $_CHIPNAME cpu -expected-id $_DAP_TAPID -irlen 4
+adapter speed 4000
+
+dap create $_CHIPNAME.dap -chain-position $_CHIPNAME.cpu
+
+# MEM-AP for direct access
+target create $_CHIPNAME.ap mem_ap -dap $_CHIPNAME.dap -ap-num 1
+
+# these addresses are obtained from the ROM table via 'dap info 1' command
+set _DBGBASE {0x81410000 0x81510000 0x81610000 0x81710000}
+set _CTIBASE {0x81420000 0x81520000 0x81620000 0x81720000}
+
+set _smp_command "target smp"
+
+for { set _core 0 } { $_core < $_cores } { incr _core } {
+       set _CTINAME $_CHIPNAME.cti$_core
+       set _TARGETNAME $_CHIPNAME.cpu$_core
+
+       cti create $_CTINAME -dap $_CHIPNAME.dap -ap-num 1 -baseaddr [lindex $_CTIBASE $_core]
+       target create $_TARGETNAME aarch64 -dap $_CHIPNAME.dap -ap-num 1 -dbgbase [lindex $_DBGBASE $_core] -cti $_CTINAME
+
+       set _smp_command "$_smp_command $_TARGETNAME"
+}
+
+if {$_USE_SMP} {
+       eval $_smp_command
+}
+
+# default target is cpu0
+targets $_CHIPNAME.cpu0