You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

148 lines
3.7 KiB

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