renesas_rcar_gen3.cfg 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  1. # SPDX-License-Identifier: GPL-2.0-or-later
  2. # Renesas R-Car Generation 3 SOCs
  3. # - There are a combination of Cortex-A57s, Cortex-A53s, and Cortex-R7 for each Gen3 SOC
  4. # - Each SOC can boot through any of the, up to 3, core types that it has
  5. # e.g. H3 can boot through Cortex-A57, Cortex-A53, or Cortex-R7
  6. # Supported Gen3 SOCs and their cores:
  7. # H3: Cortex-A57 x 4, Cortex-A53 x 4, Cortex-R7 x 2 (Lock-Step)
  8. # M3W: Cortex-A57 x 2, Cortex-A53 x 4, Cortex-R7 x 2 (Lock-Step)
  9. # M3N: Cortex-A57 x 2, Cortex-R7 x 2 (Lock-Step)
  10. # V3U: Cortex-A76 x 8, Cortex-R52 x2 (Lock-Step)
  11. # V3H: Cortex-A53 x 4, Cortex-R7 x 2 (Lock-Step)
  12. # V3M: Cortex-A53 x 2, Cortex-R7 x 2 (Lock-Step)
  13. # E3: Cortex-A53 x 1, Cortex-R7 x 2 (Lock-Step)
  14. # D3: Cortex-A53 x 1
  15. # Usage:
  16. # There are 2 configuration options:
  17. # SOC: Selects the supported SOC. (Default 'H3')
  18. # BOOT_CORE: Selects the booting core. 'CA57', 'CA53', or 'CR7'
  19. # Defaults to 'CA57' if the SOC has one, else defaults to 'CA53'
  20. if { [info exists SOC] } {
  21. set _soc $SOC
  22. } else {
  23. set _soc H3
  24. }
  25. set _num_ca53 0
  26. set _num_ca57 0
  27. set _num_ca76 0
  28. set _num_cr52 0
  29. set _num_cr7 0
  30. # Set configuration for each SOC and the default 'BOOT_CORE'
  31. switch $_soc {
  32. H3 {
  33. set _CHIPNAME r8a77950
  34. set _num_ca57 4
  35. set _num_ca53 4
  36. set _num_cr7 1
  37. set _boot_core CA57
  38. }
  39. M3W {
  40. set _CHIPNAME r8a77960
  41. set _num_ca57 2
  42. set _num_ca53 4
  43. set _num_cr7 1
  44. set _boot_core CA57
  45. }
  46. M3N {
  47. set _CHIPNAME r8a77965
  48. set _num_ca57 2
  49. set _num_ca53 4
  50. set _num_cr7 1
  51. set _boot_core CA57
  52. }
  53. V3M {
  54. set _CHIPNAME r8a77970
  55. set _num_ca57 0
  56. set _num_ca53 2
  57. set _num_cr7 1
  58. set _boot_core CA53
  59. }
  60. V3H {
  61. set _CHIPNAME r8a77980
  62. set _num_ca57 0
  63. set _num_ca53 4
  64. set _num_cr7 1
  65. set _boot_core CA53
  66. }
  67. E3 {
  68. set _CHIPNAME r8a77990
  69. set _num_ca57 0
  70. set _num_ca53 1
  71. set _num_cr7 1
  72. set _boot_core CA53
  73. }
  74. D3 {
  75. set _CHIPNAME r8a77995
  76. set _num_ca57 0
  77. set _num_ca53 1
  78. set _num_cr7 0
  79. set _boot_core CA53
  80. }
  81. V3U {
  82. set _CHIPNAME r8a779a0
  83. set _num_ca76 8
  84. set _num_cr52 1
  85. set _boot_core CA76
  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 0x5ba00477
  103. }
  104. echo "\t$_soc - $_num_ca76 CA76(s), $_num_ca57 CA57(s), $_num_ca53 CA53(s), $_num_cr52 CR52(s), $_num_cr7 CR7(s)"
  105. echo "\tBoot Core - $_boot_core\n"
  106. set _DAPNAME $_CHIPNAME.dap
  107. # TAP and DAP
  108. jtag newtap $_CHIPNAME cpu -irlen 4 -ircapture 0x01 -irmask 0x0f -expected-id $_DAP_TAPID
  109. dap create $_DAPNAME -chain-position $_CHIPNAME.cpu
  110. set CA76_DBGBASE {0x81410000 0x81510000 0x81610000 0x81710000 0x81c10000 0x81d10000 0x81e10000 0x81f10000}
  111. set CA76_CTIBASE {0x81420000 0x81520000 0x81620000 0x81720000 0x81c20000 0x81d20000 0x81e20000 0x81f20000}
  112. set CA57_DBGBASE {0x80410000 0x80510000 0x80610000 0x80710000}
  113. set CA57_CTIBASE {0x80420000 0x80520000 0x80620000 0x80720000}
  114. set CA53_DBGBASE {0x80C10000 0x80D10000 0x80E10000 0x80F10000}
  115. set CA53_CTIBASE {0x80C20000 0x80D20000 0x80E20000 0x80F20000}
  116. set CR52_DBGBASE 0x80c10000
  117. set CR52_CTIBASE 0x80c20000
  118. set CR7_DBGBASE 0x80910000
  119. set CR7_CTIBASE 0x80918000
  120. set _targets ""
  121. set smp_targets ""
  122. proc setup_a5x {core_name dbgbase ctibase num boot} {
  123. global _CHIPNAME
  124. global _DAPNAME
  125. global smp_targets
  126. global _targets
  127. for { set _core 0 } { $_core < $num } { incr _core } {
  128. set _TARGETNAME $_CHIPNAME.$core_name.$_core
  129. set _CTINAME $_TARGETNAME.cti
  130. cti create $_CTINAME -dap $_DAPNAME -ap-num 1 \
  131. -baseaddr [lindex $ctibase $_core]
  132. set _command "target create $_TARGETNAME aarch64 -dap $_DAPNAME \
  133. -ap-num 1 -dbgbase [lindex $dbgbase $_core] -cti $_CTINAME"
  134. if { $_core == 0 && $boot == 1 } {
  135. set _targets "$_TARGETNAME"
  136. } else {
  137. set _command "$_command -defer-examine"
  138. }
  139. set smp_targets "$smp_targets $_TARGETNAME"
  140. eval $_command
  141. }
  142. }
  143. proc setup_crx {core_name dbgbase ctibase num boot} {
  144. global _CHIPNAME
  145. global _DAPNAME
  146. for { set _core 0 } { $_core < $num } { incr _core } {
  147. set _TARGETNAME $_CHIPNAME.$core_name
  148. set _CTINAME $_TARGETNAME.cti
  149. cti create $_CTINAME -dap $_DAPNAME -ap-num 1 -baseaddr $ctibase
  150. if { $core_name == "r52" } {
  151. set _command "target create $_TARGETNAME armv8r -dap $_DAPNAME \
  152. -ap-num 1 -dbgbase $dbgbase -cti $_CTINAME"
  153. } else {
  154. set _command "target create $_TARGETNAME cortex_r4 -dap $_DAPNAME \
  155. -ap-num 1 -dbgbase $dbgbase"
  156. }
  157. if { $boot == 1 } {
  158. set _targets "$_TARGETNAME"
  159. } else {
  160. set _command "$_command -defer-examine"
  161. }
  162. eval $_command
  163. }
  164. }
  165. # Organize target list based on the boot core
  166. if { [string equal $_boot_core CA76] } {
  167. setup_a5x a76 $CA76_DBGBASE $CA76_CTIBASE $_num_ca76 1
  168. setup_crx r52 $CR52_DBGBASE $CR52_CTIBASE $_num_cr52 0
  169. } elseif { [string equal $_boot_core CA57] } {
  170. setup_a5x a57 $CA57_DBGBASE $CA57_CTIBASE $_num_ca57 1
  171. setup_a5x a53 $CA53_DBGBASE $CA53_CTIBASE $_num_ca53 0
  172. setup_crx r7 $CR7_DBGBASE $CR7_CTIBASE $_num_cr7 0
  173. } elseif { [string equal $_boot_core CA53] } {
  174. setup_a5x a53 $CA53_DBGBASE $CA53_CTIBASE $_num_ca53 1
  175. setup_a5x a57 $CA57_DBGBASE $CA57_CTIBASE $_num_ca57 0
  176. setup_crx r7 $CR7_DBGBASE $CR7_CTIBASE $_num_cr7 0
  177. } elseif { [string equal $_boot_core CR52] } {
  178. setup_crx r52 $CR52_DBGBASE $CR52_CTIBASE $_num_cr52 1
  179. setup_a5x a76 $CA76_DBGBASE $CA76_CTIBASE $_num_ca76 0
  180. } else {
  181. setup_crx r7 $CR7_DBGBASE $CR7_CTIBASE $_num_cr7 1
  182. setup_a5x a57 $CA57_DBGBASE $CA57_CTIBASE $_num_ca57 0
  183. setup_a5x a53 $CA53_DBGBASE $CA53_CTIBASE $_num_ca53 0
  184. }
  185. source [find target/renesas_rcar_reset_common.cfg]
  186. eval "target smp $smp_targets"
  187. targets $_targets