1 # SPDX-License-Identifier: GPL-2.0-or-later
3 # Renesas R-Car Generation 2 SOCs
4 # - There are a combination of Cortex-A15s and Cortex-A7s for each Gen2 SOC
5 # - Each SOC can boot through any of the, up to 2, core types that it has
6 # e.g. H2 can boot through Cortex-A15 or Cortex-A7
8 # Supported Gen2 SOCs and their cores:
9 # H2: Cortex-A15 x 4, Cortex-A7 x 4
16 # There are 2 configuration options:
17 # SOC: Selects the supported SOC. (Default 'H2')
18 # BOOT_CORE: Selects the booting core. 'CA15', or 'CA7'
19 # Defaults to 'CA15' if the SOC has one, else defaults to 'CA7'
21 if { [info exists SOC] } {
27 # Set configuration for each SOC and the default 'BOOT_CORE'
60 error "'$_soc' is invalid!"
64 # If configured, override the default 'CHIPNAME'
65 if { [info exists CHIPNAME] } {
66 set _CHIPNAME $CHIPNAME
69 # If configured, override the default 'BOOT_CORE'
70 if { [info exists BOOT_CORE] } {
71 set _boot_core $BOOT_CORE
74 if { [info exists DAP_TAPID] } {
75 set _DAP_TAPID $DAP_TAPID
77 set _DAP_TAPID 0x4ba00477
80 echo "\t$_soc - $_num_ca15 CA15(s), $_num_ca7 CA7(s)"
81 echo "\tBoot Core - $_boot_core\n"
83 set _DAPNAME $_CHIPNAME.dap
86 jtag newtap $_CHIPNAME cpu -irlen 4 -ircapture 0x01 -irmask 0x0f -expected-id $_DAP_TAPID
87 dap create $_DAPNAME -chain-position $_CHIPNAME.cpu
89 set CA15_DBGBASE {0x800B0000 0x800B2000 0x800B4000 0x800B6000}
90 set CA7_DBGBASE {0x800F0000 0x800F2000 0x800F4000 0x800F6000}
95 proc setup_ca {core_name dbgbase num boot} {
100 for { set _core 0 } { $_core < $num } { incr _core } {
101 set _TARGETNAME $_CHIPNAME.$core_name.$_core
102 set _CTINAME $_TARGETNAME.cti
103 set _command "target create $_TARGETNAME cortex_a -dap $_DAPNAME \
104 -coreid $_core -dbgbase [lindex $dbgbase $_core]"
105 if { $_core == 0 && $boot == 1 } {
106 set _targets "$_TARGETNAME"
108 set _command "$_command -defer-examine"
110 set smp_targets "$smp_targets $_TARGETNAME"
115 # Organize target list based on the boot core
116 if { [string equal $_boot_core CA15] } {
117 setup_ca a15 $CA15_DBGBASE $_num_ca15 1
118 setup_ca a7 $CA7_DBGBASE $_num_ca7 0
119 } elseif { [string equal $_boot_core CA7] } {
120 setup_ca a7 $CA7_DBGBASE $_num_ca7 1
121 setup_ca a15 $CA15_DBGBASE $_num_ca15 0
123 setup_ca a15 $CA15_DBGBASE $_num_ca15 0
124 setup_ca a7 $CA7_DBGBASE $_num_ca7 0
127 source [find target/renesas_rcar_reset_common.cfg]
129 eval "target smp $smp_targets"