tcl/target/ls1088: Break out common configuration 75/6975/3
authorSean Anderson <sean.anderson@seco.com>
Fri, 13 May 2022 15:03:41 +0000 (11:03 -0400)
committerAntonio Borneo <borneo.antonio@gmail.com>
Fri, 27 May 2022 22:47:45 +0000 (22:47 +0000)
Several Layerscape processors (LS1088A, LS2088A, LS2160A, and LS1028A)
share a common architecture. Break out the common setup from the LS1088
config in preparation for adding the LS1028A. There's no official name
for this series of processors, but NXP refers to them as "chassis
generation 3" in U-Boot, so we'll go with that too.

Signed-off-by: Sean Anderson <sean.anderson@seco.com>
Change-Id: Ic6f89f95c678101f54579bcaa5d79c5b67ddf50a
Reviewed-on: https://review.openocd.org/c/openocd/+/6975
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
tcl/target/ls1088a.cfg
tcl/target/lsch3_common.cfg [new file with mode: 0644]

index f9ae9a134ad6774d95c9e86ed21624ef64c8062b..193d6ddc7712f51f609cba9d4fc76516f7d2a163 100644 (file)
@@ -13,62 +13,9 @@ if { [info exists DAP_TAPID] } {
        set _DAP_TAPID 0x5ba00477
 }
 
-jtag newtap $_CHIPNAME dap -irlen 4 -expected-id $_DAP_TAPID
-dap create $_CHIPNAME.dap -chain-position $_CHIPNAME.dap
+set _CPUS 8
 
-target create $_CHIPNAME.axi mem_ap -dap $_CHIPNAME.dap -ap-num 1
-
-set _CPU_BASE 0x81000000
-set _CPU_STRIDE 0x100000
-set _CPU_DBGOFF 0x10000
-set _CPU_CTIOFF 0x20000
-
-set _TARGETS {}
-for {set i 0} {$i < 8} {incr i} {
-       set _BASE [expr {$_CPU_BASE + $_CPU_STRIDE * $i}]
-       cti create $_CHIPNAME.cti$i -dap $_CHIPNAME.dap -ap-num 0 \
-               -baseaddr [expr {$_BASE + $_CPU_CTIOFF}]
-       target create $_CHIPNAME.cpu$i aarch64 -dap $_CHIPNAME.dap \
-               -cti $_CHIPNAME.cti$i -dbgbase [expr {$_BASE + $_CPU_DBGOFF}] \
-               {*}[expr {$i ? "-coreid $i" : "-rtos hwthread" }]
-       lappend _TARGETS $_CHIPNAME.cpu$i
-}
-
-target smp {*}$_TARGETS
-
-# Service processor
-target create $_CHIPNAME.sp cortex_a -dap $_CHIPNAME.dap -ap-num 0 -dbgbase 0x80138000
-
-# Normally you will not need to call this, but if you are using the hard-coded
-# Reset Configuration Word (RCW) you will need to call this manually. The CPU's
-# reset vector is 0, and the boot ROM at that location contains ARMv7-A 32-bit
-# instructions. This will cause the CPU to almost immediately execute an
-# illegal instruction.
-#
-# This code is idempotent; releasing a released CPU has no effect, although it
-# will halt/resume the service processor.
-add_help_text release_cpu "Release a cpu which is held off"
-proc release_cpu {cpu} {
-       set RST_BRRL 0x1e60060
-
-       set old [target current]
-       targets $::_CHIPNAME.sp
-       set not_halted [string compare halted [$::_CHIPNAME.sp curstate]]
-       if {$not_halted} {
-               halt
-       }
-
-       # Release the cpu; it will start executing something bogus
-       mem2array regs 32 $RST_BRRL 1
-       mww $RST_BRRL [expr {$regs(0) | 1 << $cpu}]
-
-       if {$not_halted} {
-               resume
-       }
-       targets $old
-}
-
-targets $_CHIPNAME.cpu0
+source [find target/lsch3_common.cfg]
 
 # Seems to work OK in testing
 adapter speed 10000
diff --git a/tcl/target/lsch3_common.cfg b/tcl/target/lsch3_common.cfg
new file mode 100644 (file)
index 0000000..f48d59b
--- /dev/null
@@ -0,0 +1,63 @@
+# SPDX-License-Identifier: GPL-2.0-or-later
+# This contains common configuration for NXP Layerscape chassis generation 3
+
+if { ![info exists _CPUS] } {
+       error "_CPUS must be set to the number of cores"
+}
+
+jtag newtap $_CHIPNAME dap -irlen 4 -expected-id $_DAP_TAPID
+dap create $_CHIPNAME.dap -chain-position $_CHIPNAME.dap
+
+target create $_CHIPNAME.axi mem_ap -dap $_CHIPNAME.dap -ap-num 1
+
+set _CPU_BASE 0x81000000
+set _CPU_STRIDE 0x100000
+set _CPU_DBGOFF 0x10000
+set _CPU_CTIOFF 0x20000
+
+set _TARGETS {}
+for {set i 0} {$i < $_CPUS} {incr i} {
+       set _BASE [expr {$_CPU_BASE + $_CPU_STRIDE * $i}]
+       cti create $_CHIPNAME.cti$i -dap $_CHIPNAME.dap -ap-num 0 \
+               -baseaddr [expr {$_BASE + $_CPU_CTIOFF}]
+       target create $_CHIPNAME.cpu$i aarch64 -dap $_CHIPNAME.dap \
+               -cti $_CHIPNAME.cti$i -dbgbase [expr {$_BASE + $_CPU_DBGOFF}] \
+               {*}[expr {$i ? "-coreid $i" : "-rtos hwthread" }]
+       lappend _TARGETS $_CHIPNAME.cpu$i
+}
+
+target smp {*}$_TARGETS
+
+# Service processor
+target create $_CHIPNAME.sp cortex_a -dap $_CHIPNAME.dap -ap-num 0 -dbgbase 0x80138000
+
+# Normally you will not need to call this, but if you are using the hard-coded
+# Reset Configuration Word (RCW) you will need to call this manually. The CPU's
+# reset vector is 0, and the boot ROM at that location contains ARMv7-A 32-bit
+# instructions. This will cause the CPU to almost immediately execute an
+# illegal instruction.
+#
+# This code is idempotent; releasing a released CPU has no effect, although it
+# will halt/resume the service processor.
+add_help_text release_cpu "Release a cpu which is held off"
+proc release_cpu {cpu} {
+       set RST_BRRL 0x1e60060
+
+       set old [target current]
+       targets $::_CHIPNAME.sp
+       set not_halted [string compare halted [$::_CHIPNAME.sp curstate]]
+       if {$not_halted} {
+               halt
+       }
+
+       # Release the cpu; it will start executing something bogus
+       mem2array regs 32 $RST_BRRL 1
+       mww $RST_BRRL [expr {$regs(0) | 1 << $cpu}]
+
+       if {$not_halted} {
+               resume
+       }
+       targets $old
+}
+
+targets $_CHIPNAME.cpu0

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)