csb337.cfg 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. # SPDX-License-Identifier: GPL-2.0-or-later
  2. # Cogent CSB337
  3. # http://cogcomp.com/csb_csb337.htm
  4. source [find target/at91rm9200.cfg]
  5. # boots from NOR on CS0: 8 MBytes CFI flash, 16-bit bus
  6. set _FLASHNAME $_CHIPNAME.flash
  7. flash bank $_FLASHNAME cfi 0x10000000 0x00800000 2 2 $_TARGETNAME
  8. # ETM9 trace port connector present on this board, 16 data pins.
  9. if { [info exists ETM_DRIVER] } {
  10. etm config $_TARGETNAME 16 normal half $ETM_DRIVER
  11. # OpenOCD may someday support a real trace port driver...
  12. # system config file would need to configure it.
  13. } else {
  14. etm config $_TARGETNAME 16 normal half dummy
  15. etm_dummy config $_TARGETNAME
  16. }
  17. proc csb337_clk_init { } {
  18. # CPU is in Slow Clock Mode (32KiHz) ... needs slow JTAG clock
  19. adapter speed 8
  20. # CKGR_MOR: start main oscillator (3.6864 MHz)
  21. mww 0xfffffc20 0xff01
  22. sleep 10
  23. # CKGR_PLLAR: start PLL A for CPU and peripherals (184.32 MHz)
  24. mww 0xfffffc28 0x20313e01
  25. # CKGR_PLLBR: start PLL B for USB timing (96 MHz, with div2)
  26. mww 0xfffffc2c 0x12703e18
  27. # let PLLs lock
  28. sleep 10
  29. # PMC_MCKR: switch to CPU clock = PLLA, master clock = CPU/4
  30. mww 0xfffffc30 0x0302
  31. sleep 20
  32. # CPU is in Normal Mode ... allows faster JTAG clock speed
  33. adapter speed 40000
  34. }
  35. proc csb337_nor_init { } {
  36. # SMC_CSR0: adjust timings (10 wait states)
  37. mww 0xffffff70 0x1100318a
  38. flash probe 0
  39. }
  40. proc csb337_sdram_init { } {
  41. # enable PIOC clock
  42. mww 0xfffffc10 0x0010
  43. # PC31..PC16 are D31..D16, with internal pullups like D15..D0
  44. mww 0xfffff870 0xffff0000
  45. mww 0xfffff874 0x0
  46. mww 0xfffff804 0xffff0000
  47. # SDRC_CR: set timings
  48. mww 0xffffff98 0x2188b0d5
  49. # SDRC_MR: issue all banks precharge to SDRAM
  50. mww 0xffffff90 2
  51. mww 0x20000000 0
  52. # SDRC_MR: 8 autorefresh cycles
  53. mww 0xffffff90 4
  54. mww 0x20000000 0
  55. mww 0x20000000 0
  56. mww 0x20000000 0
  57. mww 0x20000000 0
  58. mww 0x20000000 0
  59. mww 0x20000000 0
  60. mww 0x20000000 0
  61. mww 0x20000000 0
  62. # SDRC_MR: set SDRAM mode registers (CAS, burst len, etc)
  63. mww 0xffffff90 3
  64. mww 0x20000080 0
  65. # SDRC_TR: set refresh rate
  66. mww 0xffffff94 0x200
  67. mww 0x20000000 0
  68. # SDRC_MR: normal mode, 32 bit bus
  69. mww 0xffffff90 0
  70. mww 0x20000000 0
  71. }
  72. # The rm9200 chip has just been reset. Bring it up far enough
  73. # that we can write flash or run code from SDRAM.
  74. proc csb337_reset_init { } {
  75. csb337_clk_init
  76. # EBI_CSA: CS0 = NOR, CS1 = SDRAM
  77. mww 0xffffff60 0x02
  78. csb337_nor_init
  79. csb337_sdram_init
  80. # Update CP15 control register ... we don't seem to be able to
  81. # read/modify/write its value through a TCL variable, so just
  82. # write it. Fields are zero unless listed here ... and note
  83. # that OpenOCD numbers this register "2", not "1" (!).
  84. #
  85. # - Core to use Async Clocking mode (so it uses 184 MHz most
  86. # of the time instead of limiting to the master clock rate):
  87. # iA(31) = 1, nF(30) = 1
  88. # - Icache on (it's disabled now, slowing i-fetches)
  89. # I(12) = 1
  90. # - Reserved/ones
  91. # 6:3 = 1
  92. arm920t cp15 2 0xc0001078
  93. }
  94. $_TARGETNAME configure -event reset-init {csb337_reset_init}
  95. arm7_9 fast_memory_access enable