start.S 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656
  1. /*
  2. * Copyright (C) 2003 Josef Baumgartner <josef.baumgartner@telex.de>
  3. * Based on code from Bernhard Kuhn <bkuhn@metrowerks.com>
  4. *
  5. * See file CREDITS for list of people who contributed to this
  6. * project.
  7. *
  8. * This program is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU General Public License as
  10. * published by the Free Software Foundation; either version 2 of
  11. * the License, or (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, write to the Free Software
  20. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  21. * MA 02111-1307 USA
  22. */
  23. #include <config.h>
  24. #include <timestamp.h>
  25. #include "version.h"
  26. #ifndef CONFIG_IDENT_STRING
  27. #define CONFIG_IDENT_STRING ""
  28. #endif
  29. /* last three long word reserved for cache status */
  30. #define CACR_STATUS (CONFIG_SYS_INIT_RAM_ADDR+CONFIG_SYS_INIT_RAM_END-12)
  31. #define ICACHE_STATUS (CONFIG_SYS_INIT_RAM_ADDR+CONFIG_SYS_INIT_RAM_END- 8)
  32. #define DCACHE_STATUS (CONFIG_SYS_INIT_RAM_ADDR+CONFIG_SYS_INIT_RAM_END- 4)
  33. #define _START _start
  34. #define _FAULT _fault
  35. #define SAVE_ALL \
  36. move.w #0x2700,%sr; /* disable intrs */ \
  37. subl #60,%sp; /* space for 15 regs */ \
  38. moveml %d0-%d7/%a0-%a6,%sp@;
  39. #define RESTORE_ALL \
  40. moveml %sp@,%d0-%d7/%a0-%a6; \
  41. addl #60,%sp; /* space for 15 regs */ \
  42. rte;
  43. #if defined(CONFIG_CF_SBF)
  44. #define ASM_DRAMINIT (asm_dram_init - TEXT_BASE + CONFIG_SYS_INIT_RAM_ADDR)
  45. #define ASM_SBF_IMG_HDR (asm_sbf_img_hdr - TEXT_BASE + CONFIG_SYS_INIT_RAM_ADDR)
  46. #endif
  47. .text
  48. /*
  49. * Vector table. This is used for initial platform startup.
  50. * These vectors are to catch any un-intended traps.
  51. */
  52. _vectors:
  53. #if defined(CONFIG_CF_SBF)
  54. INITSP: .long 0 /* Initial SP */
  55. INITPC: .long ASM_DRAMINIT /* Initial PC */
  56. #else
  57. INITSP: .long 0 /* Initial SP */
  58. INITPC: .long _START /* Initial PC */
  59. #endif
  60. vector02: .long _FAULT /* Access Error */
  61. vector03: .long _FAULT /* Address Error */
  62. vector04: .long _FAULT /* Illegal Instruction */
  63. vector05: .long _FAULT /* Reserved */
  64. vector06: .long _FAULT /* Reserved */
  65. vector07: .long _FAULT /* Reserved */
  66. vector08: .long _FAULT /* Privilege Violation */
  67. vector09: .long _FAULT /* Trace */
  68. vector0A: .long _FAULT /* Unimplemented A-Line */
  69. vector0B: .long _FAULT /* Unimplemented F-Line */
  70. vector0C: .long _FAULT /* Debug Interrupt */
  71. vector0D: .long _FAULT /* Reserved */
  72. vector0E: .long _FAULT /* Format Error */
  73. vector0F: .long _FAULT /* Unitialized Int. */
  74. /* Reserved */
  75. vector10_17:
  76. .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
  77. vector18: .long _FAULT /* Spurious Interrupt */
  78. vector19: .long _FAULT /* Autovector Level 1 */
  79. vector1A: .long _FAULT /* Autovector Level 2 */
  80. vector1B: .long _FAULT /* Autovector Level 3 */
  81. vector1C: .long _FAULT /* Autovector Level 4 */
  82. vector1D: .long _FAULT /* Autovector Level 5 */
  83. vector1E: .long _FAULT /* Autovector Level 6 */
  84. vector1F: .long _FAULT /* Autovector Level 7 */
  85. #if !defined(CONFIG_CF_SBF)
  86. /* TRAP #0 - #15 */
  87. vector20_2F:
  88. .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
  89. .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
  90. /* Reserved */
  91. vector30_3F:
  92. .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
  93. .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
  94. vector64_127:
  95. .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
  96. .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
  97. .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
  98. .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
  99. .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
  100. .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
  101. .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
  102. .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
  103. vector128_191:
  104. .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
  105. .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
  106. .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
  107. .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
  108. .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
  109. .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
  110. .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
  111. .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
  112. vector192_255:
  113. .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
  114. .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
  115. .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
  116. .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
  117. .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
  118. .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
  119. .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
  120. .long _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT, _FAULT
  121. #endif
  122. #if defined(CONFIG_CF_SBF)
  123. /* Image header: chksum 4 bytes, len 4 bytes, img dest 4 bytes */
  124. asm_sbf_img_hdr:
  125. .long 0x00000000 /* checksum, not yet implemented */
  126. .long 0x00030000 /* image length */
  127. .long TEXT_BASE /* image to be relocated at */
  128. asm_dram_init:
  129. move.w #0x2700,%sr /* Mask off Interrupt */
  130. move.l #CONFIG_SYS_INIT_RAM_ADDR, %d0
  131. movec %d0, %VBR
  132. move.l #(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_RAM_CTRL), %d0
  133. movec %d0, %RAMBAR1
  134. /* initialize general use internal ram */
  135. move.l #0, %d0
  136. move.l #(CACR_STATUS), %a1 /* CACR */
  137. move.l #(ICACHE_STATUS), %a2 /* icache */
  138. move.l #(DCACHE_STATUS), %a3 /* dcache */
  139. move.l %d0, (%a1)
  140. move.l %d0, (%a2)
  141. move.l %d0, (%a3)
  142. /* invalidate and disable cache */
  143. move.l #0x01004100, %d0 /* Invalidate cache cmd */
  144. movec %d0, %CACR /* Invalidate cache */
  145. move.l #0, %d0
  146. movec %d0, %ACR0
  147. movec %d0, %ACR1
  148. movec %d0, %ACR2
  149. movec %d0, %ACR3
  150. move.l #(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET), %sp
  151. clr.l %sp@-
  152. /* Must disable global address */
  153. move.l #0xFC008000, %a1
  154. move.l #(CONFIG_SYS_CS0_BASE), (%a1)
  155. move.l #0xFC008008, %a1
  156. move.l #(CONFIG_SYS_CS0_CTRL), (%a1)
  157. move.l #0xFC008004, %a1
  158. move.l #(CONFIG_SYS_CS0_MASK), (%a1)
  159. /* Dram Initialization a1, a2, and d0 */
  160. /* mscr sdram */
  161. move.l #0xFC0A4074, %a1
  162. move.b #(CONFIG_SYS_SDRAM_DRV_STRENGTH), (%a1)
  163. nop
  164. /* SDRAM Chip 0 and 1 */
  165. move.l #0xFC0B8110, %a1
  166. move.l #0xFC0B8114, %a2
  167. /* calculate the size */
  168. move.l #0x13, %d1
  169. move.l #(CONFIG_SYS_SDRAM_SIZE), %d2
  170. #ifdef CONFIG_SYS_SDRAM_BASE1
  171. lsr.l #1, %d2
  172. #endif
  173. dramsz_loop:
  174. lsr.l #1, %d2
  175. add.l #1, %d1
  176. cmp.l #1, %d2
  177. bne dramsz_loop
  178. /* SDRAM Chip 0 and 1 */
  179. move.l #(CONFIG_SYS_SDRAM_BASE), (%a1)
  180. or.l %d1, (%a1)
  181. #ifdef CONFIG_SYS_SDRAM_BASE1
  182. move.l #(CONFIG_SYS_SDRAM_BASE1), (%a2)
  183. or.l %d1, (%a2)
  184. #endif
  185. nop
  186. /* dram cfg1 and cfg2 */
  187. move.l #0xFC0B8008, %a1
  188. move.l #(CONFIG_SYS_SDRAM_CFG1), (%a1)
  189. nop
  190. move.l #0xFC0B800C, %a2
  191. move.l #(CONFIG_SYS_SDRAM_CFG2), (%a2)
  192. nop
  193. move.l #0xFC0B8000, %a1 /* Mode */
  194. move.l #0xFC0B8004, %a2 /* Ctrl */
  195. /* Issue PALL */
  196. move.l #(CONFIG_SYS_SDRAM_CTRL + 2), (%a2)
  197. nop
  198. #ifdef CONFIG_M54455EVB
  199. /* Issue LEMR */
  200. move.l #(CONFIG_SYS_SDRAM_EMOD + 0x408), (%a1)
  201. nop
  202. move.l #(CONFIG_SYS_SDRAM_MODE + 0x300), (%a1)
  203. nop
  204. #endif
  205. move.l #1000, %d1
  206. jsr asm_delay
  207. /* Issue PALL */
  208. move.l #(CONFIG_SYS_SDRAM_CTRL + 2), (%a2)
  209. nop
  210. /* Perform two refresh cycles */
  211. move.l #(CONFIG_SYS_SDRAM_CTRL + 4), %d0
  212. nop
  213. move.l %d0, (%a2)
  214. move.l %d0, (%a2)
  215. nop
  216. #ifdef CONFIG_M54455EVB
  217. move.l #(CONFIG_SYS_SDRAM_MODE + 0x200), (%a1)
  218. nop
  219. #elif defined(CONFIG_M54451EVB)
  220. /* Issue LEMR */
  221. move.l #(CONFIG_SYS_SDRAM_MODE), (%a1)
  222. nop
  223. move.l #(CONFIG_SYS_SDRAM_EMOD), (%a1)
  224. #endif
  225. move.l #500, %d1
  226. jsr asm_delay
  227. move.l #(CONFIG_SYS_SDRAM_CTRL), %d1
  228. and.l #0x7FFFFFFF, %d1
  229. #ifdef CONFIG_M54455EVB
  230. or.l #0x10000C00, %d1
  231. #elif defined(CONFIG_M54451EVB)
  232. or.l #0x10000C00, %d1
  233. #endif
  234. move.l %d1, (%a2)
  235. nop
  236. move.l #2000, %d1
  237. jsr asm_delay
  238. /*
  239. * DSPI Initialization
  240. * a0 - general, sram - 0x80008000 - 32, see M54455EVB.h
  241. * a1 - dspi status
  242. * a2 - dtfr
  243. * a3 - drfr
  244. * a4 - Dst addr
  245. */
  246. /* Enable pins for DSPI mode - chip-selects are enabled later */
  247. asm_dspi_init:
  248. move.l #0xFC0A4063, %a0
  249. move.b #0x7F, (%a0)
  250. /* Configure DSPI module */
  251. move.l #0xFC05C000, %a0
  252. move.l #0x80FF0C00, (%a0) /* Master, clear TX/RX FIFO */
  253. move.l #0xFC05C00C, %a0
  254. move.l #0x3E000011, (%a0)
  255. move.l #0xFC05C034, %a2 /* dtfr */
  256. move.l #0xFC05C03B, %a3 /* drfr */
  257. move.l #(ASM_SBF_IMG_HDR + 4), %a1
  258. move.l (%a1)+, %d5
  259. move.l (%a1), %a4
  260. move.l #(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_SBFHDR_DATA_OFFSET), %a0
  261. move.l #(CONFIG_SYS_SBFHDR_SIZE), %d4
  262. move.l #0xFC05C02C, %a1 /* dspi status */
  263. /* Issue commands and address */
  264. move.l #0x8002000B, %d2 /* Fast Read Cmd */
  265. jsr asm_dspi_wr_status
  266. jsr asm_dspi_rd_status
  267. move.l #0x80020000, %d2 /* Address byte 2 */
  268. jsr asm_dspi_wr_status
  269. jsr asm_dspi_rd_status
  270. move.l #0x80020000, %d2 /* Address byte 1 */
  271. jsr asm_dspi_wr_status
  272. jsr asm_dspi_rd_status
  273. move.l #0x80020000, %d2 /* Address byte 0 */
  274. jsr asm_dspi_wr_status
  275. jsr asm_dspi_rd_status
  276. move.l #0x80020000, %d2 /* Dummy Wr and Rd */
  277. jsr asm_dspi_wr_status
  278. jsr asm_dspi_rd_status
  279. /* Transfer serial boot header to sram */
  280. asm_dspi_rd_loop1:
  281. move.l #0x80020000, %d2
  282. jsr asm_dspi_wr_status
  283. jsr asm_dspi_rd_status
  284. move.b %d1, (%a0) /* read, copy to dst */
  285. add.l #1, %a0 /* inc dst by 1 */
  286. sub.l #1, %d4 /* dec cnt by 1 */
  287. bne asm_dspi_rd_loop1
  288. /* Transfer u-boot from serial flash to memory */
  289. asm_dspi_rd_loop2:
  290. move.l #0x80020000, %d2
  291. jsr asm_dspi_wr_status
  292. jsr asm_dspi_rd_status
  293. move.b %d1, (%a4) /* read, copy to dst */
  294. add.l #1, %a4 /* inc dst by 1 */
  295. sub.l #1, %d5 /* dec cnt by 1 */
  296. bne asm_dspi_rd_loop2
  297. move.l #0x00020000, %d2 /* Terminate */
  298. jsr asm_dspi_wr_status
  299. jsr asm_dspi_rd_status
  300. /* jump to memory and execute */
  301. move.l #(TEXT_BASE + 0x400), %a0
  302. jmp (%a0)
  303. asm_dspi_wr_status:
  304. move.l (%a1), %d0 /* status */
  305. and.l #0x0000F000, %d0
  306. cmp.l #0x00003000, %d0
  307. bgt asm_dspi_wr_status
  308. move.l %d2, (%a2)
  309. rts
  310. asm_dspi_rd_status:
  311. move.l (%a1), %d0 /* status */
  312. and.l #0x000000F0, %d0
  313. lsr.l #4, %d0
  314. cmp.l #0, %d0
  315. beq asm_dspi_rd_status
  316. move.b (%a3), %d1
  317. rts
  318. asm_delay:
  319. nop
  320. subq.l #1, %d1
  321. bne asm_delay
  322. rts
  323. #endif /* CONFIG_CF_SBF */
  324. .text
  325. . = 0x400
  326. .globl _start
  327. _start:
  328. #if !defined(CONFIG_CF_SBF)
  329. nop
  330. nop
  331. move.w #0x2700,%sr /* Mask off Interrupt */
  332. /* Set vector base register at the beginning of the Flash */
  333. move.l #CONFIG_SYS_FLASH_BASE, %d0
  334. movec %d0, %VBR
  335. move.l #(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_RAM_CTRL), %d0
  336. movec %d0, %RAMBAR1
  337. /* initialize general use internal ram */
  338. move.l #0, %d0
  339. move.l #(CACR_STATUS), %a1 /* CACR */
  340. move.l #(ICACHE_STATUS), %a2 /* icache */
  341. move.l #(DCACHE_STATUS), %a3 /* dcache */
  342. move.l %d0, (%a1)
  343. move.l %d0, (%a2)
  344. move.l %d0, (%a3)
  345. /* invalidate and disable cache */
  346. move.l #0x01004100, %d0 /* Invalidate cache cmd */
  347. movec %d0, %CACR /* Invalidate cache */
  348. move.l #0, %d0
  349. movec %d0, %ACR0
  350. movec %d0, %ACR1
  351. movec %d0, %ACR2
  352. movec %d0, %ACR3
  353. /* set stackpointer to end of internal ram to get some stackspace for
  354. the first c-code */
  355. move.l #(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET), %sp
  356. clr.l %sp@-
  357. #endif
  358. move.l #__got_start, %a5 /* put relocation table address to a5 */
  359. bsr cpu_init_f /* run low-level CPU init code (from flash) */
  360. bsr board_init_f /* run low-level board init code (from flash) */
  361. /* board_init_f() does not return */
  362. /*------------------------------------------------------------------------------*/
  363. /*
  364. * void relocate_code (addr_sp, gd, addr_moni)
  365. *
  366. * This "function" does not return, instead it continues in RAM
  367. * after relocating the monitor code.
  368. *
  369. * r3 = dest
  370. * r4 = src
  371. * r5 = length in bytes
  372. * r6 = cachelinesize
  373. */
  374. .globl relocate_code
  375. relocate_code:
  376. link.w %a6,#0
  377. move.l 8(%a6), %sp /* set new stack pointer */
  378. move.l 12(%a6), %d0 /* Save copy of Global Data pointer */
  379. move.l 16(%a6), %a0 /* Save copy of Destination Address */
  380. move.l #CONFIG_SYS_MONITOR_BASE, %a1
  381. move.l #__init_end, %a2
  382. move.l %a0, %a3
  383. /* copy the code to RAM */
  384. 1:
  385. move.l (%a1)+, (%a3)+
  386. cmp.l %a1,%a2
  387. bgt.s 1b
  388. /*
  389. * We are done. Do not return, instead branch to second part of board
  390. * initialization, now running from RAM.
  391. */
  392. move.l %a0, %a1
  393. add.l #(in_ram - CONFIG_SYS_MONITOR_BASE), %a1
  394. jmp (%a1)
  395. in_ram:
  396. clear_bss:
  397. /*
  398. * Now clear BSS segment
  399. */
  400. move.l %a0, %a1
  401. add.l #(_sbss - CONFIG_SYS_MONITOR_BASE),%a1
  402. move.l %a0, %d1
  403. add.l #(_ebss - CONFIG_SYS_MONITOR_BASE),%d1
  404. 6:
  405. clr.l (%a1)+
  406. cmp.l %a1,%d1
  407. bgt.s 6b
  408. /*
  409. * fix got table in RAM
  410. */
  411. move.l %a0, %a1
  412. add.l #(__got_start - CONFIG_SYS_MONITOR_BASE),%a1
  413. move.l %a1,%a5 /* * fix got pointer register a5 */
  414. move.l %a0, %a2
  415. add.l #(__got_end - CONFIG_SYS_MONITOR_BASE),%a2
  416. 7:
  417. move.l (%a1),%d1
  418. sub.l #_start,%d1
  419. add.l %a0,%d1
  420. move.l %d1,(%a1)+
  421. cmp.l %a2, %a1
  422. bne 7b
  423. /* calculate relative jump to board_init_r in ram */
  424. move.l %a0, %a1
  425. add.l #(board_init_r - CONFIG_SYS_MONITOR_BASE), %a1
  426. /* set parameters for board_init_r */
  427. move.l %a0,-(%sp) /* dest_addr */
  428. move.l %d0,-(%sp) /* gd */
  429. jsr (%a1)
  430. /*------------------------------------------------------------------------------*/
  431. /* exception code */
  432. .globl _fault
  433. _fault:
  434. bra _fault
  435. .globl _exc_handler
  436. _exc_handler:
  437. SAVE_ALL
  438. movel %sp,%sp@-
  439. bsr exc_handler
  440. addql #4,%sp
  441. RESTORE_ALL
  442. .globl _int_handler
  443. _int_handler:
  444. SAVE_ALL
  445. movel %sp,%sp@-
  446. bsr int_handler
  447. addql #4,%sp
  448. RESTORE_ALL
  449. /*------------------------------------------------------------------------------*/
  450. /* cache functions */
  451. .globl icache_enable
  452. icache_enable:
  453. move.l #(CACR_STATUS), %a1 /* read CACR Status */
  454. move.l (%a1), %d1
  455. move.l #0x00040100, %d0 /* Invalidate icache */
  456. movec %d0, %CACR
  457. move.l #(CONFIG_SYS_SDRAM_BASE + 0xC000), %d0 /* Setup icache */
  458. movec %d0, %ACR2
  459. move.l #0x04088020, %d0 /* Enable bcache and icache */
  460. movec %d0, %CACR
  461. move.l #(ICACHE_STATUS), %a1
  462. moveq #1, %d0
  463. move.l %d0, (%a1)
  464. rts
  465. .globl icache_disable
  466. icache_disable:
  467. move.l #(CACR_STATUS), %a1 /* read CACR Status */
  468. move.l (%a1), %d0
  469. move.l #0xFFF77BFF, %d0
  470. or.l #0x00040100, %d0 /* Setup cache mask */
  471. movec %d0, %CACR /* Invalidate icache */
  472. clr.l %d0
  473. movec %d0, %ACR2
  474. movec %d0, %ACR3
  475. move.l #(ICACHE_STATUS), %a1
  476. moveq #0, %d0
  477. move.l %d0, (%a1)
  478. rts
  479. .globl icache_status
  480. icache_status:
  481. move.l #(ICACHE_STATUS), %a1
  482. move.l (%a1), %d0
  483. rts
  484. .globl icache_invalid
  485. icache_invalid:
  486. move.l #(CACR_STATUS), %a1 /* read CACR Status */
  487. move.l (%a1), %d0
  488. move.l #0x00040100, %d0 /* Invalidate icache */
  489. movec %d0, %CACR /* Enable and invalidate cache */
  490. rts
  491. .globl dcache_enable
  492. dcache_enable:
  493. move.l #(CACR_STATUS), %a1 /* read CACR Status */
  494. move.l (%a1), %d1
  495. move.l #0x01040100, %d0
  496. movec %d0, %CACR /* Invalidate dcache */
  497. move.l #0x80088020, %d0 /* Enable bcache and icache */
  498. movec %d0, %CACR
  499. move.l #(DCACHE_STATUS), %a1
  500. moveq #1, %d0
  501. move.l %d0, (%a1)
  502. rts
  503. .globl dcache_disable
  504. dcache_disable:
  505. move.l #(CACR_STATUS), %a1 /* read CACR Status */
  506. move.l (%a1), %d0
  507. and.l #0x7FFFFFFF, %d0
  508. or.l #0x01000000, %d0 /* Setup cache mask */
  509. movec %d0, %CACR /* Disable dcache */
  510. clr.l %d0
  511. movec %d0, %ACR0
  512. movec %d0, %ACR1
  513. move.l #(DCACHE_STATUS), %a1
  514. moveq #0, %d0
  515. move.l %d0, (%a1)
  516. rts
  517. .globl dcache_invalid
  518. dcache_invalid:
  519. move.l #(CACR_STATUS), %a1 /* read CACR Status */
  520. move.l (%a1), %d0
  521. move.l #0x81088020, %d0 /* Setup cache mask */
  522. movec %d0, %CACR /* Enable and invalidate cache */
  523. rts
  524. .globl dcache_status
  525. dcache_status:
  526. move.l #(DCACHE_STATUS), %a1
  527. move.l (%a1), %d0
  528. rts
  529. /*------------------------------------------------------------------------------*/
  530. .globl version_string
  531. version_string:
  532. .ascii U_BOOT_VERSION
  533. .ascii " (", U_BOOT_DATE, " - ", U_BOOT_TIME, ")"
  534. .ascii CONFIG_IDENT_STRING, "\0"
  535. .align 4