cache.c 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /***************************************************************************/
  2. /*
  3. * cache.c -- general ColdFire Cache maintenance code
  4. *
  5. * Copyright (C) 2010, Greg Ungerer (gerg@snapgear.com)
  6. */
  7. /***************************************************************************/
  8. #include <linux/kernel.h>
  9. #include <asm/coldfire.h>
  10. #include <asm/mcfsim.h>
  11. /***************************************************************************/
  12. #ifdef CACHE_PUSH
  13. /***************************************************************************/
  14. /*
  15. * Use cpushl to push all dirty cache lines back to memory.
  16. * Older versions of GAS don't seem to know how to generate the
  17. * ColdFire cpushl instruction... Oh well, bit stuff it for now.
  18. */
  19. void mcf_cache_push(void)
  20. {
  21. __asm__ __volatile__ (
  22. "clrl %%d0\n\t"
  23. "1:\n\t"
  24. "movel %%d0,%%a0\n\t"
  25. "2:\n\t"
  26. ".word 0xf468\n\t"
  27. "addl %0,%%a0\n\t"
  28. "cmpl %1,%%a0\n\t"
  29. "blt 2b\n\t"
  30. "addql #1,%%d0\n\t"
  31. "cmpil %2,%%d0\n\t"
  32. "bne 1b\n\t"
  33. : /* No output */
  34. : "i" (CACHE_LINE_SIZE),
  35. "i" (DCACHE_SIZE / CACHE_WAYS),
  36. "i" (CACHE_WAYS)
  37. : "d0", "a0" );
  38. }
  39. /***************************************************************************/
  40. #endif /* CACHE_PUSH */
  41. /***************************************************************************/