cache.c 1.3 KB

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