dm365evm.cfg 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. # SPDX-License-Identifier: GPL-2.0-or-later
  2. # DM365 EVM board -- Beta
  3. # http://focus.ti.com/docs/toolsw/folders/print/tmdxevm365.html
  4. # http://support.spectrumdigital.com/boards/evmdm365
  5. source [find target/ti_dm365.cfg]
  6. # NOTE: in Rev C boards, the CPLD ignores SRST from the ARM-20 JTAG
  7. # connector, so it doesn't affect generation of the reset signal.
  8. # Accordingly, resets require something else. ICEpick could do it;
  9. # but its docs aren't generally available.
  10. #
  11. # At this writing, newer boards aren't available ... so assume no SRST.
  12. # Also ICEpick docs aren't available ... so we must use watchdog reset,
  13. # and hope the CPU isn't wedged or in a WFI loop (either of which can
  14. # block access to CPU and thus watchdog registers).
  15. reset_config trst_only
  16. $_TARGETNAME configure -event reset-assert "davinci_wdog_reset"
  17. # SW5.1 routes CS0: NAND vs OneNAND.
  18. # SW4.6:4 controls AEMIF width (8 for NAND, 16 for OneNand)
  19. # for boot-from-flash, those must agree with SW4.3:1 settings.
  20. if { [info exists CS0MODE] } {
  21. # NAND or OneNAND
  22. set CS0 $CS0MODE
  23. } else {
  24. set CS0 ""
  25. echo "WARNING: CS0 configuration not known"
  26. proc cs0_setup {a_emif} {}
  27. proc flashprobe {} {}
  28. }
  29. set a_emif [dict get $dm365 a_emif]
  30. # As shipped: boot from NAND.
  31. if { $CS0 == "NAND" } {
  32. echo "CS0 NAND"
  33. # NAND socket has two chipselects. Default MT29F16G08FAA chip
  34. # has 1GByte on each one.
  35. # NOTE: "hwecc4" here presumes that you're not updating anything
  36. # that needs infix layout (e.g. UBL, old U-Boot, etc)
  37. nand device low davinci $_TARGETNAME 0x02000000 hwecc4 $a_emif
  38. nand device high davinci $_TARGETNAME 0x02004000 hwecc4 $a_emif
  39. proc cs0_setup {a_emif} {
  40. global dm365
  41. # 8 bit EMIF
  42. davinci_pinmux $dm365 2 0x00000016
  43. # slow/pessimistic timings
  44. set nand_timings 0x40400204
  45. # fast (25% faster page reads)
  46. #set nand_timings 0x0400008c
  47. # CS0 == socketed NAND (default MT29F16G08FAA, 2 GBytes)
  48. mww [expr {$a_emif + 0x10}] $nand_timings
  49. # NANDFCR -- CS0 has NAND
  50. mww [expr {$a_emif + 0x60}] 0x01
  51. }
  52. proc flashprobe {} {
  53. nand probe 0
  54. nand probe 1
  55. }
  56. } elseif { $CS0 == "OneNAND" } {
  57. echo "CS0 OneNAND"
  58. # No support for this OneNAND in OpenOCD (yet) or Linux ...
  59. # REVISIT OneNAND timings not verified to work!
  60. echo "WARNING -- OneNAND not yet tested!"
  61. proc cs0_setup {a_emif} {
  62. global dm365
  63. # 16 bit EMIF
  64. davinci_pinmux $dm365 2 0x00000055
  65. # CS0 == OneNAND (KFG1G16U2B-DIB6, 128 KBytes)
  66. mww [expr {$a_emif + 0x10}] 0x00000001
  67. # ONENANDCTRL -- CS0 has OneNAND, enable sync reads
  68. mww [expr {$a_emif + 0x5c}] 0x0441
  69. }
  70. proc flashprobe {} { }
  71. }
  72. # NOTE: disable or replace this call to dm365evm_init if you're
  73. # debugging new UBL/NANDboot code from SRAM.
  74. $_TARGETNAME configure -event reset-init { dm365evm_init }
  75. #
  76. # This post-reset init is called when the MMU isn't active, all IRQs
  77. # are disabled, etc. It should do most of what a UBL does, except for
  78. # loading code (like U-Boot) into DRAM and running it.
  79. #
  80. proc dm365evm_init {} {
  81. global dm365
  82. echo "Initialize DM365 EVM board"
  83. # CLKIN = 24 MHz ... can't talk quickly to ARM yet
  84. adapter speed 1500
  85. # FIXME -- PLL init
  86. ########################
  87. # PINMUX setup
  88. davinci_pinmux $dm365 0 0x00fd0000
  89. davinci_pinmux $dm365 1 0x00145555
  90. # mux2 controls AEMIF ... 8 bit for NAND, 16 for OneNand
  91. davinci_pinmux $dm365 3 0x375affff
  92. davinci_pinmux $dm365 4 0x55556555
  93. ########################
  94. # PSC setup (minimal)
  95. # DDR EMIF/13, AEMIF/14, UART0/19
  96. psc_enable 13
  97. psc_enable 14
  98. psc_enable 19
  99. psc_go
  100. # FIXME setup DDR2 (needs PLL)
  101. ########################
  102. # ASYNC EMIF
  103. set a_emif [dict get $dm365 a_emif]
  104. # AWCCR
  105. mww [expr {$a_emif + 0x04}] 0xff
  106. # CS0 == NAND or OneNAND
  107. cs0_setup $a_emif
  108. # CS1 == CPLD
  109. mww [expr {$a_emif + 0x14}] 0x00a00505
  110. # FIXME setup UART0
  111. flashprobe
  112. }