platform.S 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386
  1. /*
  2. * Board specific setup info
  3. *
  4. * (C) Copyright 2003
  5. * Texas Instruments, <www.ti.com>
  6. *
  7. * -- Some bits of code used from rrload's head_OMAP1510.s --
  8. * Copyright (C) 2002 RidgeRun, Inc.
  9. *
  10. * See file CREDITS for list of people who contributed to this
  11. * project.
  12. *
  13. * This program is free software; you can redistribute it and/or
  14. * modify it under the terms of the GNU General Public License as
  15. * published by the Free Software Foundation; either version 2 of
  16. * the License, or (at your option) any later version.
  17. *
  18. * This program is distributed in the hope that it will be useful,
  19. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  20. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  21. * GNU General Public License for more details.
  22. *
  23. * You should have received a copy of the GNU General Public License
  24. * along with this program; if not, write to the Free Software
  25. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  26. * MA 02111-1307 USA
  27. */
  28. #include <config.h>
  29. #include <version.h>
  30. #if defined(CONFIG_OMAP1510)
  31. #include <./configs/omap1510.h>
  32. #endif
  33. #define OMAP1510_CLKS ((1<<EN_XORPCK)|(1<<EN_PERCK)|(1<<EN_TIMCK)|(1<<EN_GPIOCK))
  34. _TEXT_BASE:
  35. .word TEXT_BASE /* sdram load addr from config.mk */
  36. .globl platformsetup
  37. platformsetup:
  38. /*
  39. * Configure 1510 pins functions to match our board.
  40. */
  41. ldr r0, REG_PULL_DWN_CTRL_0
  42. ldr r1, VAL_PULL_DWN_CTRL_0
  43. str r1, [r0]
  44. ldr r0, REG_PULL_DWN_CTRL_1
  45. ldr r1, VAL_PULL_DWN_CTRL_1
  46. str r1, [r0]
  47. ldr r0, REG_PULL_DWN_CTRL_2
  48. ldr r1, VAL_PULL_DWN_CTRL_2
  49. str r1, [r0]
  50. ldr r0, REG_PULL_DWN_CTRL_3
  51. ldr r1, VAL_PULL_DWN_CTRL_3
  52. str r1, [r0]
  53. ldr r0, REG_FUNC_MUX_CTRL_4
  54. ldr r1, VAL_FUNC_MUX_CTRL_4
  55. str r1, [r0]
  56. ldr r0, REG_FUNC_MUX_CTRL_5
  57. ldr r1, VAL_FUNC_MUX_CTRL_5
  58. str r1, [r0]
  59. ldr r0, REG_FUNC_MUX_CTRL_6
  60. ldr r1, VAL_FUNC_MUX_CTRL_6
  61. str r1, [r0]
  62. ldr r0, REG_FUNC_MUX_CTRL_7
  63. ldr r1, VAL_FUNC_MUX_CTRL_7
  64. str r1, [r0]
  65. ldr r0, REG_FUNC_MUX_CTRL_8
  66. ldr r1, VAL_FUNC_MUX_CTRL_8
  67. str r1, [r0]
  68. ldr r0, REG_FUNC_MUX_CTRL_9
  69. ldr r1, VAL_FUNC_MUX_CTRL_9
  70. str r1, [r0]
  71. ldr r0, REG_FUNC_MUX_CTRL_A
  72. ldr r1, VAL_FUNC_MUX_CTRL_A
  73. str r1, [r0]
  74. ldr r0, REG_FUNC_MUX_CTRL_B
  75. ldr r1, VAL_FUNC_MUX_CTRL_B
  76. str r1, [r0]
  77. ldr r0, REG_FUNC_MUX_CTRL_C
  78. ldr r1, VAL_FUNC_MUX_CTRL_C
  79. str r1, [r0]
  80. ldr r0, REG_VOLTAGE_CTRL_0
  81. ldr r1, VAL_VOLTAGE_CTRL_0
  82. str r1, [r0]
  83. ldr r0, REG_TEST_DBG_CTRL_0
  84. ldr r1, VAL_TEST_DBG_CTRL_0
  85. str r1, [r0]
  86. ldr r0, REG_MOD_CONF_CTRL_0
  87. ldr r1, VAL_MOD_CONF_CTRL_0
  88. str r1, [r0]
  89. /* Move to 1510 mode */
  90. ldr r0, REG_COMP_MODE_CTRL_0
  91. ldr r1, VAL_COMP_MODE_CTRL_0
  92. str r1, [r0]
  93. /* Set up Traffic Ctlr*/
  94. ldr r0, REG_TC_IMIF_PRIO
  95. mov r1, #0x0
  96. str r1, [r0]
  97. ldr r0, REG_TC_EMIFS_PRIO
  98. str r1, [r0]
  99. ldr r0, REG_TC_EMIFF_PRIO
  100. str r1, [r0]
  101. ldr r0, REG_TC_EMIFS_CONFIG
  102. ldr r1, [r0]
  103. bic r1, r1, #0x08 /* clear the global power-down enable PDE bit */
  104. bic r1, r1, #0x01 /* write protect flash by clearing the WP bit */
  105. str r1, [r0] /* EMIFS GlB Configuration. (value 0x12 most likely) */
  106. /* Setup some clock domains */
  107. ldr r1, =OMAP1510_CLKS
  108. ldr r0, REG_ARM_IDLECT2
  109. strh r1, [r0] /* CLKM, Clock domain control. */
  110. mov r1, #0x01 /* PER_EN bit */
  111. ldr r0, REG_ARM_RSTCT2
  112. strh r1, [r0] /* CLKM; Peripheral reset. */
  113. /* Set CLKM to Sync-Scalable */
  114. /* I supposidly need to enable the dsp clock before switching */
  115. mov r1, #0x1000
  116. ldr r0, REG_ARM_SYSST
  117. strh r1, [r0]
  118. mov r0, #0x400
  119. 1:
  120. subs r0, r0, #0x1 /* wait for any bubbles to finish */
  121. bne 1b
  122. ldr r1, VAL_ARM_CKCTL /* use 12Mhz ref, PER must be <= 50Mhz so /2 */
  123. ldr r0, REG_ARM_CKCTL
  124. strh r1, [r0]
  125. /* setup DPLL 1 */
  126. ldr r1, VAL_DPLL1_CTL
  127. ldr r0, REG_DPLL1_CTL
  128. strh r1, [r0]
  129. ands r1, r1, #0x10 /* Check if PLL is enabled. */
  130. beq lock_end /* Do not look for lock if BYPASS selected */
  131. 2:
  132. ldrh r1, [r0]
  133. ands r1, r1, #0x01 /* Check the LOCK bit. */
  134. beq 2b /* ...loop until bit goes hi. */
  135. lock_end:
  136. /* Set memory timings corresponding to the new clock speed */
  137. /* Check execution location to determine current execution location
  138. * and branch to appropriate initialization code.
  139. */
  140. mov r0, #0x10000000 /* Load physical SDRAM base. */
  141. mov r1, pc /* Get current execution location. */
  142. cmp r1, r0 /* Compare. */
  143. bge skip_sdram /* Skip over EMIF-fast initialization if running from SDRAM. */
  144. /*
  145. * Delay for SDRAM initialization.
  146. */
  147. mov r3, #0x1800 /* value should be checked */
  148. 3:
  149. subs r3, r3, #0x1 /* Decrement count */
  150. bne 3b
  151. /*
  152. * Set SDRAM control values. Disable refresh before MRS command.
  153. */
  154. ldr r0, VAL_TC_EMIFF_SDRAM_CONFIG /* get good value */
  155. bic r3, r0, #0xC /* (BIT3|BIT2) ulConfig with auto-refresh disabled. */
  156. orr r3, r3, #0x8000000 /* (BIT27) Disable CLK when Power down or Self-Refresh */
  157. orr r3, r3, #0x4000000 /* BIT26 Power Down Enable */
  158. ldr r2, REG_TC_EMIFF_SDRAM_CONFIG /* Point to configuration register. */
  159. str r3, [r2] /* Store the passed value with AR disabled. */
  160. ldr r1, VAL_TC_EMIFF_MRS /* get MRS value */
  161. ldr r2, REG_TC_EMIFF_MRS /* Point to MRS register. */
  162. str r1, [r2] /* Store the passed value.*/
  163. ldr r2, REG_TC_EMIFF_SDRAM_CONFIG /* Point to configuration register. */
  164. str r0, [r2] /* Store the passed value. */
  165. /*
  166. * Delay for SDRAM initialization.
  167. */
  168. mov r3, #0x1800
  169. 4:
  170. subs r3, r3, #1 /* Decrement count. */
  171. bne 4b
  172. skip_sdram:
  173. /* slow interface */
  174. ldr r1, VAL_TC_EMIFS_CS0_CONFIG
  175. ldr r0, REG_TC_EMIFS_CS0_CONFIG
  176. str r1, [r0] /* Chip Select 0 */
  177. ldr r1, VAL_TC_EMIFS_CS1_CONFIG
  178. ldr r0, REG_TC_EMIFS_CS1_CONFIG
  179. str r1, [r0] /* Chip Select 1 */
  180. ldr r1, VAL_TC_EMIFS_CS2_CONFIG
  181. ldr r0, REG_TC_EMIFS_CS2_CONFIG
  182. str r1, [r0] /* Chip Select 2 */
  183. ldr r1, VAL_TC_EMIFS_CS3_CONFIG
  184. ldr r0, REG_TC_EMIFS_CS3_CONFIG
  185. str r1, [r0] /* Chip Select 3 */
  186. /* Next, Enable the RS232 Line Drivers in the FPGA. */
  187. /* Also, power on the audio CODEC's amplifier here, */
  188. /* which will make a noise on the audio output. */
  189. /* This is done here instead of in the kernel so there */
  190. /* isn't a loud popping noise at the start of each */
  191. /* song. */
  192. /* Also, disable the CODEC's clocks. */
  193. /* omap1510-HelenP1 [specific] */
  194. ldr r0, REG_FPGA_POWER
  195. mov r1, #0
  196. ldr r2, REG_FPGA_DIP_SWITCH
  197. ldrb r3, [r2]
  198. cmp r3, #0x8
  199. movne r1, #0x62 /* Enable the RS232 Line Drivers in the EPLD */
  200. strb r1, [r0]
  201. ldr r0, REG_FPGA_AUDIO
  202. mov r1, #0x0 /* Disable sound driver (CODEC clocks) */
  203. strb r1, [r0]
  204. /* back to arch calling code */
  205. mov pc, lr
  206. /* the literal pools origin */
  207. .ltorg
  208. /* OMAP configuration registers */
  209. REG_FUNC_MUX_CTRL_0: /* 32 bits */
  210. .word 0xfffe1000
  211. REG_FUNC_MUX_CTRL_1: /* 32 bits */
  212. .word 0xfffe1004
  213. REG_FUNC_MUX_CTRL_2: /* 32 bits */
  214. .word 0xfffe1008
  215. REG_COMP_MODE_CTRL_0: /* 32 bits */
  216. .word 0xfffe100c
  217. REG_FUNC_MUX_CTRL_3: /* 32 bits */
  218. .word 0xfffe1010
  219. REG_FUNC_MUX_CTRL_4: /* 32 bits */
  220. .word 0xfffe1014
  221. REG_FUNC_MUX_CTRL_5: /* 32 bits */
  222. .word 0xfffe1018
  223. REG_FUNC_MUX_CTRL_6: /* 32 bits */
  224. .word 0xfffe101c
  225. REG_FUNC_MUX_CTRL_7: /* 32 bits */
  226. .word 0xfffe1020
  227. REG_FUNC_MUX_CTRL_8: /* 32 bits */
  228. .word 0xfffe1024
  229. REG_FUNC_MUX_CTRL_9: /* 32 bits */
  230. .word 0xfffe1028
  231. REG_FUNC_MUX_CTRL_A: /* 32 bits */
  232. .word 0xfffe102C
  233. REG_FUNC_MUX_CTRL_B: /* 32 bits */
  234. .word 0xfffe1030
  235. REG_FUNC_MUX_CTRL_C: /* 32 bits */
  236. .word 0xfffe1034
  237. REG_FUNC_MUX_CTRL_D: /* 32 bits */
  238. .word 0xfffe1038
  239. REG_PULL_DWN_CTRL_0: /* 32 bits */
  240. .word 0xfffe1040
  241. REG_PULL_DWN_CTRL_1: /* 32 bits */
  242. .word 0xfffe1044
  243. REG_PULL_DWN_CTRL_2: /* 32 bits */
  244. .word 0xfffe1048
  245. REG_PULL_DWN_CTRL_3: /* 32 bits */
  246. .word 0xfffe104c
  247. REG_VOLTAGE_CTRL_0: /* 32 bits */
  248. .word 0xfffe1060
  249. REG_TEST_DBG_CTRL_0: /* 32 bits */
  250. .word 0xfffe1070
  251. REG_MOD_CONF_CTRL_0: /* 32 bits */
  252. .word 0xfffe1080
  253. REG_TC_IMIF_PRIO: /* 32 bits */
  254. .word 0xfffecc00
  255. REG_TC_EMIFS_PRIO: /* 32 bits */
  256. .word 0xfffecc04
  257. REG_TC_EMIFF_PRIO: /* 32 bits */
  258. .word 0xfffecc08
  259. REG_TC_EMIFS_CONFIG: /* 32 bits */
  260. .word 0xfffecc0c
  261. REG_TC_EMIFS_CS0_CONFIG: /* 32 bits */
  262. .word 0xfffecc10
  263. REG_TC_EMIFS_CS1_CONFIG: /* 32 bits */
  264. .word 0xfffecc14
  265. REG_TC_EMIFS_CS2_CONFIG: /* 32 bits */
  266. .word 0xfffecc18
  267. REG_TC_EMIFS_CS3_CONFIG: /* 32 bits */
  268. .word 0xfffecc1c
  269. REG_TC_EMIFF_SDRAM_CONFIG: /* 32 bits */
  270. .word 0xfffecc20
  271. REG_TC_EMIFF_MRS: /* 32 bits */
  272. .word 0xfffecc24
  273. /* MPU clock/reset/power mode control registers */
  274. REG_ARM_CKCTL: /* 16 bits */
  275. .word 0xfffece00
  276. REG_ARM_IDLECT2: /* 16 bits */
  277. .word 0xfffece08
  278. REG_ARM_RSTCT2: /* 16 bits */
  279. .word 0xfffece14
  280. REG_ARM_SYSST: /* 16 bits */
  281. .word 0xfffece18
  282. /* DPLL control registers */
  283. REG_DPLL1_CTL: /* 16 bits */
  284. .word 0xfffecf00
  285. /* identification code register */
  286. REG_IDCODE: /* 32 bits */
  287. .word 0xfffed404
  288. /* Innovator specific */
  289. REG_FPGA_LED_DIGIT: /* 8 bits (not used on Innovator) */
  290. .word 0x08000003
  291. REG_FPGA_POWER: /* 8 bits */
  292. .word 0x08000005
  293. REG_FPGA_AUDIO: /* 8 bits (not used on Innovator) */
  294. .word 0x0800000c
  295. REG_FPGA_DIP_SWITCH: /* 8 bits (not used on Innovator) */
  296. .word 0x0800000e
  297. VAL_COMP_MODE_CTRL_0:
  298. .word 0x0000eaef
  299. VAL_FUNC_MUX_CTRL_4:
  300. .word 0x00000000
  301. VAL_FUNC_MUX_CTRL_5:
  302. .word 0x00000000
  303. VAL_FUNC_MUX_CTRL_6:
  304. .word 0x00000001
  305. VAL_FUNC_MUX_CTRL_7:
  306. .word 0x00000000
  307. VAL_FUNC_MUX_CTRL_8:
  308. .word 0x10001200
  309. VAL_FUNC_MUX_CTRL_9:
  310. .word 0x01201012
  311. VAL_FUNC_MUX_CTRL_A:
  312. .word 0x00000248
  313. VAL_FUNC_MUX_CTRL_B:
  314. .word 0x00000248
  315. VAL_FUNC_MUX_CTRL_C:
  316. .word 0x09000000
  317. VAL_FUNC_MUX_CTRL_D:
  318. .word 0x00000000
  319. VAL_PULL_DWN_CTRL_0:
  320. .word 0x11a10000
  321. VAL_PULL_DWN_CTRL_1:
  322. .word 0x2e047fff
  323. VAL_PULL_DWN_CTRL_2:
  324. .word 0xffd7d3e6
  325. VAL_PULL_DWN_CTRL_3:
  326. .word 0x00003f03
  327. VAL_VOLTAGE_CTRL_0:
  328. .word 0x00000007
  329. VAL_TEST_DBG_CTRL_0:
  330. /* See Errata 4.13, This works around a SRAM bug, for chips below ES2.5 .
  331. * This slows down internal SRAM accesses.
  332. */
  333. .word 0x00000007
  334. VAL_MOD_CONF_CTRL_0:
  335. .word 0x0b000008
  336. VAL_ARM_CKCTL:
  337. .word 0x010f
  338. VAL_DPLL1_CTL:
  339. .word 0x2710
  340. VAL_TC_EMIFS_CS1_CONFIG_PRELIM:
  341. .word 0x00001149
  342. VAL_TC_EMIFS_CS2_CONFIG_PRELIM:
  343. .word 0x00004158
  344. VAL_TC_EMIFS_CS0_CONFIG:
  345. .word 0x002130b0
  346. VAL_TC_EMIFS_CS1_CONFIG:
  347. .word 0x0000f559
  348. VAL_TC_EMIFS_CS2_CONFIG:
  349. .word 0x000055f0
  350. VAL_TC_EMIFS_CS3_CONFIG:
  351. .word 0x00003331
  352. VAL_TC_EMIFF_SDRAM_CONFIG:
  353. .word 0x010290fc
  354. VAL_TC_EMIFF_MRS:
  355. .word 0x00000027