platform.S 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383
  1. /*
  2. * Board specific setup info
  3. *
  4. * (C) Copyright 2003
  5. * Texas Instruments, <www.ti.com>
  6. * Kshitij Gupta <Kshitij@ti.com>
  7. *
  8. * See file CREDITS for list of people who contributed to this
  9. * project.
  10. *
  11. * This program is free software; you can redistribute it and/or
  12. * modify it under the terms of the GNU General Public License as
  13. * published by the Free Software Foundation; either version 2 of
  14. * the License, or (at your option) any later version.
  15. *
  16. * This program is distributed in the hope that it will be useful,
  17. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  19. * GNU General Public License for more details.
  20. *
  21. * You should have received a copy of the GNU General Public License
  22. * along with this program; if not, write to the Free Software
  23. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  24. * MA 02111-1307 USA
  25. */
  26. #include <config.h>
  27. #include <version.h>
  28. #if defined(CONFIG_OMAP1610)
  29. #include <./configs/omap1510.h>
  30. #endif
  31. _TEXT_BASE:
  32. .word TEXT_BASE /* sdram load addr from config.mk */
  33. .globl platformsetup
  34. platformsetup:
  35. /*------------------------------------------------------*
  36. * Set up ARM CLM registers (IDLECT1) *
  37. *------------------------------------------------------*/
  38. ldr r0, REG_ARM_IDLECT1
  39. ldr r1, VAL_ARM_IDLECT1
  40. str r1, [r0]
  41. /*------------------------------------------------------*
  42. * Set up ARM CLM registers (IDLECT2) *
  43. *------------------------------------------------------*/
  44. ldr r0, REG_ARM_IDLECT2
  45. ldr r1, VAL_ARM_IDLECT2
  46. str r1, [r0]
  47. /*------------------------------------------------------*
  48. * Set up ARM CLM registers (IDLECT3) *
  49. *------------------------------------------------------*/
  50. ldr r0, REG_ARM_IDLECT3
  51. ldr r1, VAL_ARM_IDLECT3
  52. str r1, [r0]
  53. mov r1, #0x01 /* PER_EN bit */
  54. ldr r0, REG_ARM_RSTCT2
  55. strh r1, [r0] /* CLKM; Peripheral reset. */
  56. /* Set CLKM to Sync-Scalable */
  57. /* I supposedly need to enable the dsp clock before switching */
  58. mov r1, #0x0000
  59. ldr r0, REG_ARM_SYSST
  60. strh r1, [r0]
  61. mov r0, #0x400
  62. 1:
  63. subs r0, r0, #0x1 /* wait for any bubbles to finish */
  64. bne 1b
  65. ldr r1, VAL_ARM_CKCTL
  66. ldr r0, REG_ARM_CKCTL
  67. strh r1, [r0]
  68. /* a few nops to let settle */
  69. nop
  70. nop
  71. nop
  72. nop
  73. nop
  74. nop
  75. nop
  76. nop
  77. nop
  78. nop
  79. /* setup DPLL 1 */
  80. /* Ramp up the clock to 96Mhz */
  81. ldr r1, VAL_DPLL1_CTL
  82. ldr r0, REG_DPLL1_CTL
  83. strh r1, [r0]
  84. ands r1, r1, #0x10 /* Check if PLL is enabled. */
  85. beq lock_end /* Do not look for lock if BYPASS selected */
  86. 2:
  87. ldrh r1, [r0]
  88. ands r1, r1, #0x01 /* Check the LOCK bit.*/
  89. beq 2b /* loop until bit goes hi. */
  90. lock_end:
  91. /*------------------------------------------------------*
  92. * Turn off the watchdog during init... *
  93. *------------------------------------------------------*/
  94. ldr r0, REG_WATCHDOG
  95. ldr r1, WATCHDOG_VAL1
  96. str r1, [r0]
  97. ldr r1, WATCHDOG_VAL2
  98. str r1, [r0]
  99. ldr r0, REG_WSPRDOG
  100. ldr r1, WSPRDOG_VAL1
  101. str r1, [r0]
  102. ldr r0, REG_WWPSDOG
  103. watch1Wait:
  104. ldr r1, [r0]
  105. tst r1, #0x10
  106. bne watch1Wait
  107. ldr r0, REG_WSPRDOG
  108. ldr r1, WSPRDOG_VAL2
  109. str r1, [r0]
  110. ldr r0, REG_WWPSDOG
  111. watch2Wait:
  112. ldr r1, [r0]
  113. tst r1, #0x10
  114. bne watch2Wait
  115. /* Set memory timings corresponding to the new clock speed */
  116. /* Check execution location to determine current execution location
  117. * and branch to appropriate initialization code.
  118. */
  119. /* Load physical SDRAM base. */
  120. mov r0, #0x10000000
  121. /* Get current execution location. */
  122. mov r1, pc
  123. /* Compare. */
  124. cmp r1, r0
  125. /* Skip over EMIF-fast initialization if running from SDRAM. */
  126. bge skip_sdram
  127. /*
  128. * Delay for SDRAM initialization.
  129. */
  130. mov r3, #0x1800 /* value should be checked */
  131. 3:
  132. subs r3, r3, #0x1 /* Decrement count */
  133. bne 3b
  134. /*
  135. * Set SDRAM control values. Disable refresh before MRS command.
  136. */
  137. /* mobile ddr operation */
  138. ldr r0, REG_SDRAM_OPERATION
  139. mov r2, #07
  140. str r2, [r0]
  141. /* config register */
  142. ldr r0, REG_SDRAM_CONFIG
  143. ldr r1, SDRAM_CONFIG_VAL
  144. str r1, [r0]
  145. /* manual command register */
  146. ldr r0, REG_SDRAM_MANUAL_CMD
  147. /* issue set cke high */
  148. mov r1, #CMD_SDRAM_CKE_SET_HIGH
  149. str r1, [r0]
  150. /* issue nop */
  151. mov r1, #CMD_SDRAM_NOP
  152. str r1, [r0]
  153. mov r2, #0x0100
  154. waitMDDR1:
  155. subs r2, r2, #1
  156. bne waitMDDR1 /* delay loop */
  157. /* issue precharge */
  158. mov r1, #CMD_SDRAM_PRECHARGE
  159. str r1, [r0]
  160. /* issue autorefresh x 2 */
  161. mov r1, #CMD_SDRAM_AUTOREFRESH
  162. str r1, [r0]
  163. str r1, [r0]
  164. /* mrs register ddr mobile */
  165. ldr r0, REG_SDRAM_MRS
  166. mov r1, #0x33
  167. str r1, [r0]
  168. /* emrs1 low-power register */
  169. ldr r0, REG_SDRAM_EMRS1
  170. /* self refresh on all banks */
  171. mov r1, #0
  172. str r1, [r0]
  173. ldr r0, REG_DLL_URD_CONTROL
  174. ldr r1, DLL_URD_CONTROL_VAL
  175. str r1, [r0]
  176. ldr r0, REG_DLL_LRD_CONTROL
  177. ldr r1, DLL_LRD_CONTROL_VAL
  178. str r1, [r0]
  179. ldr r0, REG_DLL_WRT_CONTROL
  180. ldr r1, DLL_WRT_CONTROL_VAL
  181. str r1, [r0]
  182. /* delay loop */
  183. mov r2, #0x0100
  184. waitMDDR2:
  185. subs r2, r2, #1
  186. bne waitMDDR2
  187. /*
  188. * Delay for SDRAM initialization.
  189. */
  190. mov r3, #0x1800
  191. 4:
  192. subs r3, r3, #1 /* Decrement count. */
  193. bne 4b
  194. b common_tc
  195. skip_sdram:
  196. ldr r0, REG_SDRAM_CONFIG
  197. ldr r1, SDRAM_CONFIG_VAL
  198. str r1, [r0]
  199. common_tc:
  200. /* slow interface */
  201. ldr r1, VAL_TC_EMIFS_CS0_CONFIG
  202. ldr r0, REG_TC_EMIFS_CS0_CONFIG
  203. str r1, [r0] /* Chip Select 0 */
  204. ldr r1, VAL_TC_EMIFS_CS1_CONFIG
  205. ldr r0, REG_TC_EMIFS_CS1_CONFIG
  206. str r1, [r0] /* Chip Select 1 */
  207. ldr r1, VAL_TC_EMIFS_CS3_CONFIG
  208. ldr r0, REG_TC_EMIFS_CS3_CONFIG
  209. str r1, [r0] /* Chip Select 3 */
  210. /* back to arch calling code */
  211. mov pc, lr
  212. /* the literal pools origin */
  213. .ltorg
  214. REG_TC_EMIFS_CONFIG: /* 32 bits */
  215. .word 0xfffecc0c
  216. REG_TC_EMIFS_CS0_CONFIG: /* 32 bits */
  217. .word 0xfffecc10
  218. REG_TC_EMIFS_CS1_CONFIG: /* 32 bits */
  219. .word 0xfffecc14
  220. REG_TC_EMIFS_CS2_CONFIG: /* 32 bits */
  221. .word 0xfffecc18
  222. REG_TC_EMIFS_CS3_CONFIG: /* 32 bits */
  223. .word 0xfffecc1c
  224. /* MPU clock/reset/power mode control registers */
  225. REG_ARM_CKCTL: /* 16 bits */
  226. .word 0xfffece00
  227. REG_ARM_IDLECT3: /* 16 bits */
  228. .word 0xfffece24
  229. REG_ARM_IDLECT2: /* 16 bits */
  230. .word 0xfffece08
  231. REG_ARM_IDLECT1: /* 16 bits */
  232. .word 0xfffece04
  233. REG_ARM_RSTCT2: /* 16 bits */
  234. .word 0xfffece14
  235. REG_ARM_SYSST: /* 16 bits */
  236. .word 0xfffece18
  237. /* DPLL control registers */
  238. REG_DPLL1_CTL: /* 16 bits */
  239. .word 0xfffecf00
  240. /* Watch Dog register */
  241. /* secure watchdog stop */
  242. REG_WSPRDOG:
  243. .word 0xfffeb048
  244. /* watchdog write pending */
  245. REG_WWPSDOG:
  246. .word 0xfffeb034
  247. WSPRDOG_VAL1:
  248. .word 0x0000aaaa
  249. WSPRDOG_VAL2:
  250. .word 0x00005555
  251. /* SDRAM config is: auto refresh enabled, 16 bit 4 bank,
  252. counter @8192 rows, 10 ns, 8 burst */
  253. REG_SDRAM_CONFIG:
  254. .word 0xfffecc20
  255. /* Operation register */
  256. REG_SDRAM_OPERATION:
  257. .word 0xfffecc80
  258. /* Manual command register */
  259. REG_SDRAM_MANUAL_CMD:
  260. .word 0xfffecc84
  261. /* SDRAM MRS (New) config is: CAS latency is 2, burst length 8 */
  262. REG_SDRAM_MRS:
  263. .word 0xfffecc70
  264. /* SDRAM MRS (New) config is: CAS latency is 2, burst length 8 */
  265. REG_SDRAM_EMRS1:
  266. .word 0xfffecc78
  267. /* WRT DLL register */
  268. REG_DLL_WRT_CONTROL:
  269. .word 0xfffecc68
  270. DLL_WRT_CONTROL_VAL:
  271. .word 0x03f00002
  272. /* URD DLL register */
  273. REG_DLL_URD_CONTROL:
  274. .word 0xfffeccc0
  275. DLL_URD_CONTROL_VAL:
  276. .word 0x00800002
  277. /* LRD DLL register */
  278. REG_DLL_LRD_CONTROL:
  279. .word 0xfffecccc
  280. REG_WATCHDOG:
  281. .word 0xfffec808
  282. /* 96 MHz Samsung Mobile DDR */
  283. SDRAM_CONFIG_VAL:
  284. .word 0x001200f4
  285. DLL_LRD_CONTROL_VAL:
  286. .word 0x00800002
  287. VAL_ARM_CKCTL:
  288. .word 0x3000
  289. VAL_DPLL1_CTL:
  290. .word 0x2830
  291. VAL_TC_EMIFS_CS0_CONFIG:
  292. .word 0x002130b0
  293. VAL_TC_EMIFS_CS1_CONFIG:
  294. .word 0x00001131
  295. VAL_TC_EMIFS_CS2_CONFIG:
  296. .word 0x000055f0
  297. VAL_TC_EMIFS_CS3_CONFIG:
  298. .word 0x88011131
  299. VAL_TC_EMIFF_SDRAM_CONFIG:
  300. .word 0x010290fc
  301. VAL_TC_EMIFF_MRS:
  302. .word 0x00000027
  303. VAL_ARM_IDLECT1:
  304. .word 0x00000400
  305. VAL_ARM_IDLECT2:
  306. .word 0x00000886
  307. VAL_ARM_IDLECT3:
  308. .word 0x00000015
  309. WATCHDOG_VAL1:
  310. .word 0x000000f5
  311. WATCHDOG_VAL2:
  312. .word 0x000000a0
  313. /* command values */
  314. .equ CMD_SDRAM_NOP, 0x00000000
  315. .equ CMD_SDRAM_PRECHARGE, 0x00000001
  316. .equ CMD_SDRAM_AUTOREFRESH, 0x00000002
  317. .equ CMD_SDRAM_CKE_SET_HIGH, 0x00000007