renesas_rz_g2.cfg 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  1. # SPDX-License-Identifier: GPL-2.0-or-later
  2. # Renesas RZ/G2 SOCs
  3. # - There are a combination of Cortex-A57s, Cortex-A53s, Cortex-A55, Cortex-R7
  4. # and Cortex-M33 for each SOC
  5. # - Each SOC can boot through the Cortex-A5x cores
  6. # Supported RZ/G2 SOCs and their cores:
  7. # RZ/G2H: Cortex-A57 x4, Cortex-A53 x4, Cortex-R7
  8. # RZ/G2M: Cortex-A57 x2, Cortex-A53 x4, Cortex-R7
  9. # RZ/G2N: Cortex-A57 x2, Cortex-R7
  10. # RZ/G2E: Cortex-A53 x2, Cortex-R7
  11. # RZ/G2L: Cortex-A55 x2, Cortex-M33
  12. # RZ/G2LC: Cortex-A55 x2, Cortex-M33
  13. # RZ/G2UL: Cortex-A55 x1, Cortex-M33
  14. # Usage:
  15. # There are 2 configuration options:
  16. # SOC: Selects the supported SOC. (Default 'G2L')
  17. # BOOT_CORE: Selects the booting core. 'CA57', 'CA53' or 'CA55'
  18. transport select jtag
  19. reset_config trst_and_srst srst_gates_jtag
  20. adapter speed 4000
  21. adapter srst delay 500
  22. if { [info exists SOC] } {
  23. set _soc $SOC
  24. } else {
  25. set _soc G2L
  26. }
  27. set _num_ca57 0
  28. set _num_ca55 0
  29. set _num_ca53 0
  30. set _num_cr7 0
  31. set _num_cm33 0
  32. # Set configuration for each SOC and the default 'BOOT_CORE'
  33. switch $_soc {
  34. G2H {
  35. set _CHIPNAME r8a774ex
  36. set _num_ca57 4
  37. set _num_ca53 4
  38. set _num_cr7 1
  39. set _boot_core CA57
  40. set _ap_num 1
  41. }
  42. G2M {
  43. set _CHIPNAME r8a774ax
  44. set _num_ca57 2
  45. set _num_ca53 4
  46. set _num_cr7 1
  47. set _boot_core CA57
  48. set _ap_num 1
  49. }
  50. G2N {
  51. set _CHIPNAME r8a774bx
  52. set _num_ca57 2
  53. set _num_ca53 0
  54. set _num_cr7 1
  55. set _boot_core CA57
  56. set _ap_num 1
  57. }
  58. G2E {
  59. set _CHIPNAME r8a774c0
  60. set _num_ca57 0
  61. set _num_ca53 2
  62. set _num_cr7 1
  63. set _boot_core CA53
  64. set _ap_num 1
  65. }
  66. G2L {
  67. set _CHIPNAME r9a07g044l
  68. set _num_ca55 2
  69. set _num_cm33 1
  70. set _boot_core CA55
  71. set _ap_num 0
  72. }
  73. G2LC {
  74. set _CHIPNAME r9a07g044c
  75. set _num_ca55 2
  76. set _num_cm33 1
  77. set _boot_core CA55
  78. set _ap_num 0
  79. }
  80. G2UL {
  81. set _CHIPNAME r9a07g043u
  82. set _num_ca55 1
  83. set _num_cm33 1
  84. set _boot_core CA55
  85. set _ap_num 0
  86. }
  87. default {
  88. error "'$_soc' is invalid!"
  89. }
  90. }
  91. # If configured, override the default 'CHIPNAME'
  92. if { [info exists CHIPNAME] } {
  93. set _CHIPNAME $CHIPNAME
  94. }
  95. # If configured, override the default 'BOOT_CORE'
  96. if { [info exists BOOT_CORE] } {
  97. set _boot_core $BOOT_CORE
  98. }
  99. if { [info exists DAP_TAPID] } {
  100. set _DAP_TAPID $DAP_TAPID
  101. } else {
  102. set _DAP_TAPID 0x6ba00477
  103. }
  104. echo "\t$_soc - $_num_ca57 CA57(s), $_num_ca55 CA55(s), $_num_ca53 CA53(s), $_num_cr7 CR7(s), \
  105. $_num_cm33 CM33(s)"
  106. echo "\tBoot Core - $_boot_core\n"
  107. set _DAPNAME $_CHIPNAME.dap
  108. # TAP and DAP
  109. jtag newtap $_CHIPNAME cpu -irlen 4 -ircapture 0x1 -irmask 0xf -expected-id $_DAP_TAPID \
  110. -ignore-version
  111. dap create $_DAPNAME -chain-position $_CHIPNAME.cpu
  112. echo "$_CHIPNAME.cpu"
  113. set CA57_DBGBASE {0x80410000 0x80510000 0x80610000 0x80710000}
  114. set CA57_CTIBASE {0x80420000 0x80520000 0x80620000 0x80720000}
  115. set CA55_DBGBASE {0x10E10000 0x10F10000}
  116. set CA55_CTIBASE {0x10E20000 0x10F20000}
  117. set CA53_DBGBASE {0x80C10000 0x80D10000 0x80E10000 0x80F10000}
  118. set CA53_CTIBASE {0x80C20000 0x80D20000 0x80E20000 0x80F20000}
  119. set CR7_DBGBASE 0x80910000
  120. set CR7_CTIBASE 0x80918000
  121. set CM33_DBGBASE 0xE000E000
  122. set CM33_CTIBASE 0xE0042000
  123. set smp_targets ""
  124. proc setup_a5x {core_name dbgbase ctibase num boot} {
  125. for { set _core 0 } { $_core < $num } { incr _core } {
  126. set _TARGETNAME $::_CHIPNAME.$core_name.$_core
  127. set _CTINAME $_TARGETNAME.cti
  128. cti create $_CTINAME -dap $::_DAPNAME -ap-num $::_ap_num \
  129. -baseaddr [lindex $ctibase $_core]
  130. target create $_TARGETNAME aarch64 -dap $::_DAPNAME \
  131. -ap-num $::_ap_num -dbgbase [lindex $dbgbase $_core] -cti $_CTINAME
  132. if { $_core > 0 || $boot == 0 } {
  133. $_TARGETNAME configure -defer-examine
  134. }
  135. set ::smp_targets "$::smp_targets $_TARGETNAME"
  136. }
  137. }
  138. proc setup_cr7 {dbgbase ctibase} {
  139. set _TARGETNAME $::_CHIPNAME.r7
  140. set _CTINAME $_TARGETNAME.cti
  141. cti create $_CTINAME -dap $::_DAPNAME -ap-num 1 -baseaddr $ctibase
  142. target create $_TARGETNAME cortex_r4 -dap $::_DAPNAME \
  143. -ap-num 1 -dbgbase $dbgbase -defer-examine
  144. }
  145. proc setup_cm33 {dbgbase ctibase} {
  146. set _TARGETNAME $::_CHIPNAME.m33
  147. set _CTINAME $_TARGETNAME.cti
  148. cti create $_CTINAME -dap $::_DAPNAME -ap-num 2 -baseaddr $ctibase
  149. target create $_TARGETNAME cortex_m -dap $::_DAPNAME \
  150. -ap-num 2 -dbgbase $dbgbase -defer-examine
  151. }
  152. # Organize target list based on the boot core
  153. if { $_boot_core == "CA57" } {
  154. setup_a5x a57 $CA57_DBGBASE $CA57_CTIBASE $_num_ca57 1
  155. setup_a5x a53 $CA53_DBGBASE $CA53_CTIBASE $_num_ca53 0
  156. setup_cr7 $CR7_DBGBASE $CR7_CTIBASE
  157. } elseif { $_boot_core == "CA53" } {
  158. setup_a5x a53 $CA53_DBGBASE $CA53_CTIBASE $_num_ca53 1
  159. setup_a5x a57 $CA57_DBGBASE $CA57_CTIBASE $_num_ca57 0
  160. setup_cr7 $CR7_DBGBASE $CR7_CTIBASE
  161. } elseif { $_boot_core == "CA55" } {
  162. setup_a5x a55 $CA55_DBGBASE $CA55_CTIBASE $_num_ca55 1
  163. setup_cm33 $CM33_DBGBASE $CM33_CTIBASE
  164. }
  165. echo "SMP targets:$smp_targets"
  166. eval "target smp $smp_targets"
  167. if { $_soc == "G2L" || $_soc == "G2LC" || $_soc == "G2UL" } {
  168. target create $_CHIPNAME.axi_ap mem_ap -dap $_DAPNAME -ap-num 1
  169. }
  170. proc init_reset {mode} {
  171. # Assert both resets: equivalent to a power-on reset
  172. adapter assert trst assert srst
  173. # Deassert TRST to begin TAP communication
  174. adapter deassert trst assert srst
  175. # TAP should now be responsive, validate the scan-chain
  176. jtag arp_init
  177. }