start.S 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633
  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.l #(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_RAM_CTRL), %d0
  130. movec %d0, %RAMBAR1 /* init Rambar */
  131. move.l #(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET), %sp
  132. clr.l %sp@-
  133. /* Must disable global address */
  134. move.l #0xFC008000, %a1
  135. move.l #(CONFIG_SYS_CS0_BASE), (%a1)
  136. move.l #0xFC008008, %a1
  137. move.l #(CONFIG_SYS_CS0_CTRL), (%a1)
  138. move.l #0xFC008004, %a1
  139. move.l #(CONFIG_SYS_CS0_MASK), (%a1)
  140. /*
  141. * Dram Initialization
  142. * a1, a2, and d0
  143. */
  144. /* mscr sdram */
  145. move.l #0xFC0A4074, %a1
  146. move.b #(CONFIG_SYS_SDRAM_DRV_STRENGTH), (%a1)
  147. nop
  148. /* SDRAM Chip 0 and 1 */
  149. move.l #0xFC0B8110, %a1
  150. move.l #0xFC0B8114, %a2
  151. /* calculate the size */
  152. move.l #0x13, %d1
  153. move.l #(CONFIG_SYS_SDRAM_SIZE), %d2
  154. #ifdef CONFIG_SYS_SDRAM_BASE1
  155. lsr.l #1, %d2
  156. #endif
  157. dramsz_loop:
  158. lsr.l #1, %d2
  159. add.l #1, %d1
  160. cmp.l #1, %d2
  161. bne dramsz_loop
  162. /* SDRAM Chip 0 and 1 */
  163. move.l #(CONFIG_SYS_SDRAM_BASE), (%a1)
  164. or.l %d1, (%a1)
  165. #ifdef CONFIG_SYS_SDRAM_BASE1
  166. move.l #(CONFIG_SYS_SDRAM_BASE1), (%a2)
  167. or.l %d1, (%a2)
  168. #endif
  169. nop
  170. /* dram cfg1 and cfg2 */
  171. move.l #0xFC0B8008, %a1
  172. move.l #(CONFIG_SYS_SDRAM_CFG1), (%a1)
  173. nop
  174. move.l #0xFC0B800C, %a2
  175. move.l #(CONFIG_SYS_SDRAM_CFG2), (%a2)
  176. nop
  177. move.l #0xFC0B8000, %a1 /* Mode */
  178. move.l #0xFC0B8004, %a2 /* Ctrl */
  179. #ifdef CONFIG_M54455EVB
  180. /* Issue PALL */
  181. move.l #(CONFIG_SYS_SDRAM_CTRL + 2), (%a2)
  182. nop
  183. /* Issue LEMR */
  184. move.l #(CONFIG_SYS_SDRAM_EMOD + 0x408), (%a1)
  185. nop
  186. move.l #(CONFIG_SYS_SDRAM_MODE + 0x300), (%a1)
  187. nop
  188. move.l #1000, %d0
  189. wait1000:
  190. nop
  191. subq.l #1, %d0
  192. bne wait1000
  193. #endif
  194. /* Issue PALL */
  195. move.l #(CONFIG_SYS_SDRAM_CTRL + 2), (%a2)
  196. nop
  197. /* Perform two refresh cycles */
  198. move.l #(CONFIG_SYS_SDRAM_CTRL + 4), %d0
  199. nop
  200. move.l %d0, (%a2)
  201. move.l %d0, (%a2)
  202. nop
  203. #ifdef CONFIG_M54455EVB
  204. move.l #(CONFIG_SYS_SDRAM_MODE + 0x200), (%a1)
  205. nop
  206. #elif defined(CONFIG_M54451EVB)
  207. /* Issue LEMR */
  208. move.l #(CONFIG_SYS_SDRAM_MODE), (%a2)
  209. nop
  210. move.l #(CONFIG_SYS_SDRAM_EMOD), (%a2)
  211. nop
  212. #endif
  213. move.l #500, %d0
  214. wait500:
  215. nop
  216. subq.l #1, %d0
  217. bne wait500
  218. move.l #(CONFIG_SYS_SDRAM_CTRL), %d0
  219. and.l #0x7FFFFFFF, %d0
  220. #ifdef CONFIG_M54455EVB
  221. or.l #0x10000c00, %d0
  222. #elif defined(CONFIG_M54451EVB)
  223. or.l #0x10000000, %d0
  224. #endif
  225. move.l %d0, (%a2)
  226. nop
  227. /*
  228. * DSPI Initialization
  229. * a0 - general, sram - 0x80008000 - 32, see M54455EVB.h
  230. * a1 - dspi status
  231. * a2 - dtfr
  232. * a3 - drfr
  233. * a4 - Dst addr
  234. */
  235. /* Enable pins for DSPI mode - chip-selects are enabled later */
  236. move.l #0xFC0A4063, %a0
  237. move.b #0x7F, (%a0)
  238. /* Configure DSPI module */
  239. move.l #0xFC05C000, %a0
  240. move.l #0x80FF0C00, (%a0) /* Master, clear TX/RX FIFO */
  241. move.l #0xFC05C00C, %a0
  242. move.l #0x3E000011, (%a0)
  243. move.l #0xFC05C034, %a2 /* dtfr */
  244. move.l #0xFC05C03B, %a3 /* drfr */
  245. move.l #(ASM_SBF_IMG_HDR + 4), %a1
  246. move.l (%a1)+, %d5
  247. move.l (%a1), %a4
  248. move.l #(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_SBFHDR_DATA_OFFSET), %a0
  249. move.l #(CONFIG_SYS_SBFHDR_SIZE), %d4
  250. move.l #0xFC05C02C, %a1 /* dspi status */
  251. /* Issue commands and address */
  252. move.l #0x8002000B, %d2 /* Fast Read Cmd */
  253. jsr asm_dspi_wr_status
  254. jsr asm_dspi_rd_status
  255. move.l #0x80020000, %d2 /* Address byte 2 */
  256. jsr asm_dspi_wr_status
  257. jsr asm_dspi_rd_status
  258. move.l #0x80020000, %d2 /* Address byte 1 */
  259. jsr asm_dspi_wr_status
  260. jsr asm_dspi_rd_status
  261. move.l #0x80020000, %d2 /* Address byte 0 */
  262. jsr asm_dspi_wr_status
  263. jsr asm_dspi_rd_status
  264. move.l #0x80020000, %d2 /* Dummy Wr and Rd */
  265. jsr asm_dspi_wr_status
  266. jsr asm_dspi_rd_status
  267. /* Transfer serial boot header to sram */
  268. asm_dspi_rd_loop1:
  269. move.l #0x80020000, %d2
  270. jsr asm_dspi_wr_status
  271. jsr asm_dspi_rd_status
  272. move.b %d1, (%a0) /* read, copy to dst */
  273. add.l #1, %a0 /* inc dst by 1 */
  274. sub.l #1, %d4 /* dec cnt by 1 */
  275. bne asm_dspi_rd_loop1
  276. /* Transfer u-boot from serial flash to memory */
  277. asm_dspi_rd_loop2:
  278. move.l #0x80020000, %d2
  279. jsr asm_dspi_wr_status
  280. jsr asm_dspi_rd_status
  281. move.b %d1, (%a4) /* read, copy to dst */
  282. add.l #1, %a4 /* inc dst by 1 */
  283. sub.l #1, %d5 /* dec cnt by 1 */
  284. bne asm_dspi_rd_loop2
  285. move.l #0x00020000, %d2 /* Terminate */
  286. jsr asm_dspi_wr_status
  287. jsr asm_dspi_rd_status
  288. /* jump to memory and execute */
  289. move.l #(TEXT_BASE + 0x400), %a0
  290. jmp (%a0)
  291. asm_dspi_wr_status:
  292. move.l (%a1), %d0 /* status */
  293. and.l #0x0000F000, %d0
  294. cmp.l #0x00003000, %d0
  295. bgt asm_dspi_wr_status
  296. move.l %d2, (%a2)
  297. rts
  298. asm_dspi_rd_status:
  299. move.l (%a1), %d0 /* status */
  300. and.l #0x000000F0, %d0
  301. lsr.l #4, %d0
  302. cmp.l #0, %d0
  303. beq asm_dspi_rd_status
  304. move.b (%a3), %d1
  305. rts
  306. #endif /* CONFIG_CF_SBF */
  307. .text
  308. . = 0x400
  309. .globl _start
  310. _start:
  311. nop
  312. nop
  313. move.w #0x2700,%sr /* Mask off Interrupt */
  314. /* Set vector base register at the beginning of the Flash */
  315. #if defined(CONFIG_CF_SBF)
  316. move.l #TEXT_BASE, %d0
  317. movec %d0, %VBR
  318. #else
  319. move.l #CONFIG_SYS_FLASH_BASE, %d0
  320. movec %d0, %VBR
  321. move.l #(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_RAM_CTRL), %d0
  322. movec %d0, %RAMBAR1
  323. #endif
  324. /* initialize general use internal ram */
  325. move.l #0, %d0
  326. move.l #(CACR_STATUS), %a1 /* CACR */
  327. move.l #(ICACHE_STATUS), %a2 /* icache */
  328. move.l #(DCACHE_STATUS), %a3 /* dcache */
  329. move.l %d0, (%a1)
  330. move.l %d0, (%a2)
  331. move.l %d0, (%a3)
  332. /* invalidate and disable cache */
  333. move.l #0x01004100, %d0 /* Invalidate cache cmd */
  334. movec %d0, %CACR /* Invalidate cache */
  335. move.l #0, %d0
  336. movec %d0, %ACR0
  337. movec %d0, %ACR1
  338. movec %d0, %ACR2
  339. movec %d0, %ACR3
  340. /* set stackpointer to end of internal ram to get some stackspace for
  341. the first c-code */
  342. move.l #(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET), %sp
  343. clr.l %sp@-
  344. move.l #__got_start, %a5 /* put relocation table address to a5 */
  345. bsr cpu_init_f /* run low-level CPU init code (from flash) */
  346. bsr board_init_f /* run low-level board init code (from flash) */
  347. /* board_init_f() does not return */
  348. /*------------------------------------------------------------------------------*/
  349. /*
  350. * void relocate_code (addr_sp, gd, addr_moni)
  351. *
  352. * This "function" does not return, instead it continues in RAM
  353. * after relocating the monitor code.
  354. *
  355. * r3 = dest
  356. * r4 = src
  357. * r5 = length in bytes
  358. * r6 = cachelinesize
  359. */
  360. .globl relocate_code
  361. relocate_code:
  362. link.w %a6,#0
  363. move.l 8(%a6), %sp /* set new stack pointer */
  364. move.l 12(%a6), %d0 /* Save copy of Global Data pointer */
  365. move.l 16(%a6), %a0 /* Save copy of Destination Address */
  366. move.l #CONFIG_SYS_MONITOR_BASE, %a1
  367. move.l #__init_end, %a2
  368. move.l %a0, %a3
  369. /* copy the code to RAM */
  370. 1:
  371. move.l (%a1)+, (%a3)+
  372. cmp.l %a1,%a2
  373. bgt.s 1b
  374. /*
  375. * We are done. Do not return, instead branch to second part of board
  376. * initialization, now running from RAM.
  377. */
  378. move.l %a0, %a1
  379. add.l #(in_ram - CONFIG_SYS_MONITOR_BASE), %a1
  380. jmp (%a1)
  381. in_ram:
  382. clear_bss:
  383. /*
  384. * Now clear BSS segment
  385. */
  386. move.l %a0, %a1
  387. add.l #(_sbss - CONFIG_SYS_MONITOR_BASE),%a1
  388. move.l %a0, %d1
  389. add.l #(_ebss - CONFIG_SYS_MONITOR_BASE),%d1
  390. 6:
  391. clr.l (%a1)+
  392. cmp.l %a1,%d1
  393. bgt.s 6b
  394. /*
  395. * fix got table in RAM
  396. */
  397. move.l %a0, %a1
  398. add.l #(__got_start - CONFIG_SYS_MONITOR_BASE),%a1
  399. move.l %a1,%a5 /* * fix got pointer register a5 */
  400. move.l %a0, %a2
  401. add.l #(__got_end - CONFIG_SYS_MONITOR_BASE),%a2
  402. 7:
  403. move.l (%a1),%d1
  404. sub.l #_start,%d1
  405. add.l %a0,%d1
  406. move.l %d1,(%a1)+
  407. cmp.l %a2, %a1
  408. bne 7b
  409. /* calculate relative jump to board_init_r in ram */
  410. move.l %a0, %a1
  411. add.l #(board_init_r - CONFIG_SYS_MONITOR_BASE), %a1
  412. /* set parameters for board_init_r */
  413. move.l %a0,-(%sp) /* dest_addr */
  414. move.l %d0,-(%sp) /* gd */
  415. jsr (%a1)
  416. /*------------------------------------------------------------------------------*/
  417. /* exception code */
  418. .globl _fault
  419. _fault:
  420. bra _fault
  421. .globl _exc_handler
  422. _exc_handler:
  423. SAVE_ALL
  424. movel %sp,%sp@-
  425. bsr exc_handler
  426. addql #4,%sp
  427. RESTORE_ALL
  428. .globl _int_handler
  429. _int_handler:
  430. SAVE_ALL
  431. movel %sp,%sp@-
  432. bsr int_handler
  433. addql #4,%sp
  434. RESTORE_ALL
  435. /*------------------------------------------------------------------------------*/
  436. /* cache functions */
  437. .globl icache_enable
  438. icache_enable:
  439. move.l #(CACR_STATUS), %a1 /* read CACR Status */
  440. move.l (%a1), %d1
  441. move.l #0x00040100, %d0 /* Invalidate icache */
  442. movec %d0, %CACR
  443. move.l #(CONFIG_SYS_SDRAM_BASE + 0x1c000), %d0 /* Setup icache */
  444. movec %d0, %ACR2
  445. move.l #0x04088020, %d0 /* Enable bcache and icache */
  446. movec %d0, %CACR
  447. move.l #(ICACHE_STATUS), %a1
  448. moveq #1, %d0
  449. move.l %d0, (%a1)
  450. rts
  451. .globl icache_disable
  452. icache_disable:
  453. move.l #(CACR_STATUS), %a1 /* read CACR Status */
  454. move.l (%a1), %d0
  455. move.l #0xFFF77BFF, %d0
  456. or.l #0x00040100, %d0 /* Setup cache mask */
  457. movec %d0, %CACR /* Invalidate icache */
  458. clr.l %d0
  459. movec %d0, %ACR2
  460. movec %d0, %ACR3
  461. move.l #(ICACHE_STATUS), %a1
  462. moveq #0, %d0
  463. move.l %d0, (%a1)
  464. rts
  465. .globl icache_status
  466. icache_status:
  467. move.l #(ICACHE_STATUS), %a1
  468. move.l (%a1), %d0
  469. rts
  470. .globl icache_invalid
  471. icache_invalid:
  472. move.l #(CACR_STATUS), %a1 /* read CACR Status */
  473. move.l (%a1), %d0
  474. move.l #0x00040100, %d0 /* Invalidate icache */
  475. movec %d0, %CACR /* Enable and invalidate cache */
  476. rts
  477. .globl dcache_enable
  478. dcache_enable:
  479. move.l #(CACR_STATUS), %a1 /* read CACR Status */
  480. move.l (%a1), %d1
  481. move.l #0x01040100, %d0
  482. movec %d0, %CACR /* Invalidate dcache */
  483. move.l #0x80088020, %d0 /* Enable bcache and icache */
  484. movec %d0, %CACR
  485. move.l #(DCACHE_STATUS), %a1
  486. moveq #1, %d0
  487. move.l %d0, (%a1)
  488. rts
  489. .globl dcache_disable
  490. dcache_disable:
  491. move.l #(CACR_STATUS), %a1 /* read CACR Status */
  492. move.l (%a1), %d0
  493. and.l #0x7FFFFFFF, %d0
  494. or.l #0x01000000, %d0 /* Setup cache mask */
  495. movec %d0, %CACR /* Disable dcache */
  496. clr.l %d0
  497. movec %d0, %ACR0
  498. movec %d0, %ACR1
  499. move.l #(DCACHE_STATUS), %a1
  500. moveq #0, %d0
  501. move.l %d0, (%a1)
  502. rts
  503. .globl dcache_invalid
  504. dcache_invalid:
  505. move.l #(CACR_STATUS), %a1 /* read CACR Status */
  506. move.l (%a1), %d0
  507. move.l #0x81088020, %d0 /* Setup cache mask */
  508. movec %d0, %CACR /* Enable and invalidate cache */
  509. rts
  510. .globl dcache_status
  511. dcache_status:
  512. move.l #(DCACHE_STATUS), %a1
  513. move.l (%a1), %d0
  514. rts
  515. /*------------------------------------------------------------------------------*/
  516. .globl version_string
  517. version_string:
  518. .ascii U_BOOT_VERSION
  519. .ascii " (", U_BOOT_DATE, " - ", U_BOOT_TIME, ")"
  520. .ascii CONFIG_IDENT_STRING, "\0"
  521. .align 4