lsch3_common.cfg 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. # SPDX-License-Identifier: GPL-2.0-or-later
  2. # This contains common configuration for NXP Layerscape chassis generation 3
  3. if { ![info exists _CPUS] } {
  4. error "_CPUS must be set to the number of cores"
  5. }
  6. jtag newtap $_CHIPNAME dap -irlen 4 -expected-id $_DAP_TAPID
  7. dap create $_CHIPNAME.dap -chain-position $_CHIPNAME.dap
  8. target create $_CHIPNAME.axi mem_ap -dap $_CHIPNAME.dap -ap-num 1
  9. set _CPU_BASE 0x81000000
  10. set _CPU_STRIDE 0x100000
  11. set _CPU_DBGOFF 0x10000
  12. set _CPU_CTIOFF 0x20000
  13. set _TARGETS {}
  14. for {set i 0} {$i < $_CPUS} {incr i} {
  15. set _BASE [expr {$_CPU_BASE + $_CPU_STRIDE * $i}]
  16. cti create $_CHIPNAME.cti$i -dap $_CHIPNAME.dap -ap-num 0 \
  17. -baseaddr [expr {$_BASE + $_CPU_CTIOFF}]
  18. target create $_CHIPNAME.cpu$i aarch64 -dap $_CHIPNAME.dap \
  19. -cti $_CHIPNAME.cti$i -dbgbase [expr {$_BASE + $_CPU_DBGOFF}] \
  20. {*}[expr {$i ? "-coreid $i" : "-rtos hwthread" }]
  21. lappend _TARGETS $_CHIPNAME.cpu$i
  22. }
  23. target smp {*}$_TARGETS
  24. # Service processor
  25. target create $_CHIPNAME.sp cortex_a -dap $_CHIPNAME.dap -ap-num 0 -dbgbase 0x80138000
  26. # Normally you will not need to call this, but if you are using the hard-coded
  27. # Reset Configuration Word (RCW) you will need to call this manually. The CPU's
  28. # reset vector is 0, and the boot ROM at that location contains ARMv7-A 32-bit
  29. # instructions. This will cause the CPU to almost immediately execute an
  30. # illegal instruction.
  31. #
  32. # This code is idempotent; releasing a released CPU has no effect, although it
  33. # will halt/resume the service processor.
  34. add_help_text release_cpu "Release a cpu which is held off"
  35. proc release_cpu {cpu} {
  36. set RST_BRRL 0x1e60060
  37. set old [target current]
  38. targets $::_CHIPNAME.sp
  39. set not_halted [string compare halted [$::_CHIPNAME.sp curstate]]
  40. if {$not_halted} {
  41. halt
  42. }
  43. # Release the cpu; it will start executing something bogus
  44. mem2array regs 32 $RST_BRRL 1
  45. mww $RST_BRRL [expr {$regs(0) | 1 << $cpu}]
  46. if {$not_halted} {
  47. resume
  48. }
  49. targets $old
  50. }
  51. targets $_CHIPNAME.cpu0