start.S 15 KB

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