atheros_ar9331.cfg 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. # The Atheros AR9331 is a highly integrated and cost effective
  2. # IEEE 802.11n 1x1 2.4 GHz System- on-a-Chip (SoC) for wireless
  3. # local area network (WLAN) AP and router platforms.
  4. #
  5. # Notes:
  6. # - MIPS Processor ID (PRId): 0x00019374
  7. # - 24Kc MIPS processor with 64 KB I-Cache and 32 KB D-Cache,
  8. # operating at up to 400 MHz
  9. # - External 16-bit DDR1, DDR2, or SDRAM memory interface
  10. # - TRST is not available.
  11. # - EJTAG PrRst signal is not supported
  12. # - RESET_L pin A72 on the SoC will reset internal JTAG logic.
  13. #
  14. # Pins related for debug and bootstrap:
  15. # Name Pin Description
  16. # JTAG
  17. # JTAG_TCK GPIO0, (A27) Software configurable, default JTAG
  18. # JTAG_TDI GPIO6, (B46) Software configurable, default JTAG
  19. # JTAG_TDO GPIO7, (A54) Software configurable, default JTAG
  20. # JTAG_TMS GPIO8, (A52) Software configurable, default JTAG
  21. # Reset
  22. # RESET_L -, (A72) Input only
  23. # SYS_RST_L ???????? Output reset request or GPIO
  24. # Bootstrap
  25. # MEM_TYPE[1] GPIO28, (A74) 0 - SDRAM, 1 - DDR1 RAM, 2 - DDR2 RAM
  26. # MEM_TYPE[0] GPIO12, (A56)
  27. # FW_DOWNLOAD GPIO16, (A75) Used if BOOT_FROM_SPI = 0. 0 - boot from USB
  28. # 1 - boot from MDIO.
  29. # JTAG_MODE(JS) GPIO11, (B48) 0 - JTAG (Default); 1 - EJTAG
  30. # BOOT_FROM_SPI GPIO1, (A77) 0 - ROM boot; 1 - SPI boot
  31. # SEL_25M_40M GPIO0, (A78) 0 - 25MHz; 1 - 40MHz
  32. # UART
  33. # UART0_SOUT GPIO10, (A79)
  34. # UART0_SIN GPIO9, (B68)
  35. # Per default we need to use "none" variant to be able properly "reset init"
  36. # or "reset halt" the CPU.
  37. reset_config none srst_pulls_trst
  38. # For SRST based variant we still need proper timings.
  39. # For ETH part the reset should be asserted at least for 10ms
  40. # Since there is no other information let's take 100ms to be sure.
  41. adapter srst pulse_width 100
  42. # according to the SoC documentation it should take at least 5ms from
  43. # reset end till bootstrap end. In the practice we need 8ms to get JTAG back
  44. # to live.
  45. adapter srst delay 8
  46. if { [info exists CHIPNAME] } {
  47. set _CHIPNAME $_CHIPNAME
  48. } else {
  49. set _CHIPNAME ar9331
  50. }
  51. jtag newtap $_CHIPNAME cpu -irlen 5 -expected-id 0x00000001
  52. set _TARGETNAME $_CHIPNAME.cpu
  53. target create $_TARGETNAME mips_m4k -endian big -chain-position $_TARGETNAME
  54. # provide watchdog helper.
  55. proc disable_watchdog { } {
  56. mww 0xb8060008 0x0
  57. }
  58. $_TARGETNAME configure -event halted { disable_watchdog }
  59. # Since PrRst is not supported and SRST will reset complete chip
  60. # with JTAG engine, we need to reset CPU from CPU itself.
  61. $_TARGETNAME configure -event reset-assert-pre {
  62. halt
  63. }
  64. $_TARGETNAME configure -event reset-assert {
  65. catch "mww 0xb806001C 0x01000000"
  66. }
  67. # To be able to trigger complete chip reset, in case JTAG is blocked
  68. # or CPU not responding, we still can use this helper.
  69. proc full_reset { } {
  70. reset_config srst_only
  71. reset
  72. halt
  73. reset_config none
  74. }
  75. proc disable_watchdog { } {
  76. ;# disable watchdog
  77. mww 0xb8060008 0x0
  78. }
  79. $_TARGETNAME configure -event reset-end { disable_watchdog }
  80. # Section with helpers which can be used by boards
  81. proc ar9331_25mhz_pll_init {} {
  82. mww 0xb8050008 0x00018004 ;# bypass PLL; AHB_POST_DIV - ratio 4
  83. mww 0xb8050004 0x00000352 ;# 34000(ns)/40ns(25MHz) = 0x352 (850)
  84. mww 0xb8050000 0x40818000 ;# Power down control for CPU PLL
  85. ;# OUTDIV | REFDIV | DIV_INT
  86. mww 0xb8050010 0x001003e8 ;# CPU PLL Dither FRAC Register
  87. ;# (disabled?)
  88. mww 0xb8050000 0x00818000 ;# Power on | OUTDIV | REFDIV | DIV_INT
  89. mww 0xb8050008 0x00008000 ;# remove bypass;
  90. ;# AHB_POST_DIV - ratio 2
  91. }
  92. proc ar9331_ddr1_init {} {
  93. mww 0xb8000000 0x7fbc8cd0 ;# DDR_CONFIG - lots of DRAM confs
  94. mww 0xb8000004 0x9dd0e6a8 ;# DDR_CONFIG2 - more DRAM confs
  95. mww 0xb8000010 0x8 ;# Forces a PRECHARGE ALL cycle
  96. mww 0xb8000008 0x133 ;# mode reg: 0x133 - default
  97. mww 0xb8000010 0x1 ;# Forces an MRS update cycl
  98. mww 0xb800000c 0x2 ;# Extended mode register value.
  99. ;# default 0x2 - Reset to weak driver, DLL on
  100. mww 0xb8000010 0x2 ;# Forces an EMRS update cycle
  101. mww 0xb8000010 0x8 ;# Forces a PRECHARGE ALL cycle
  102. mww 0xb8000008 0x33 ;# mode reg: remove some bit?
  103. mww 0xb8000010 0x1 ;# Forces an MRS update cycl
  104. mww 0xb8000014 0x4186 ;# enable refres: bit(14) - set refresh rate
  105. mww 0xb800001c 0x8 ;# This register is used along with DQ Lane 0,
  106. ;# DQ[7:0], DQS_0
  107. mww 0xb8000020 0x9 ;# This register is used along with DQ Lane 1,
  108. ;# DQ[15:8], DQS_1.
  109. mww 0xb8000018 0xff ;# DDR read and capture bit mask.
  110. ;# Each bit represents a cycle of valid data.
  111. }
  112. proc ar9331_ddr2_init {} {
  113. mww 0xb8000000 0x7fbc8cd0 ;# DDR_CONFIG - lots of DRAM confs
  114. mww 0xb8000004 0x9dd0e6a8 ;# DDR_CONFIG2 - more DRAM confs
  115. mww 0xb800008c 0x00000a59
  116. mww 0xb8000010 0x00000008 ;# PRECHARGE ALL cycle
  117. mww 0xb8000090 0x00000000
  118. mww 0xb8000010 0x00000010 ;# EMR2S update cycle
  119. mww 0xb8000094 0x00000000
  120. mww 0xb8000010 0x00000020 ;# EMR3S update cycle
  121. mww 0xb800000c 0x00000000
  122. mww 0xb8000010 0x00000002 ;# EMRS update cycle
  123. mww 0xb8000008 0x00000100
  124. mww 0xb8000010 0x00000001 ;# MRS update cycle
  125. mww 0xb8000010 0x00000008 ;# PRECHARGE ALL cycle
  126. mww 0xb8000010 0x00000004
  127. mww 0xb8000010 0x00000004 ;# AUTO REFRESH cycle
  128. mww 0xb8000008 0x00000a33
  129. mww 0xb8000010 0x00000001 ;# MRS update cycle
  130. mww 0xb800000c 0x00000382
  131. mww 0xb8000010 0x00000002 ;# EMRS update cycle
  132. mww 0xb800000c 0x00000402
  133. mww 0xb8000010 0x00000002 ;# EMRS update cycle
  134. mww 0xb8000014 0x00004186 ;# DDR_REFRESH
  135. mww 0xb800001c 0x00000008 ;# DDR_TAP_CTRL0
  136. mww 0xb8000020 0x00000009 ;# DDR_TAP_CTRL1
  137. ;# DDR read and capture bit mask.
  138. ;# Each bit represents a cycle of valid data.
  139. ;# 0xff: use 16-bit DDR
  140. mww 0xb8000018 0x000000ff
  141. }