0001-cache-patch-from-OpenWRT.patch 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. From 57615e112aba6ae4c831d50e769c2c102f013686 Mon Sep 17 00:00:00 2001
  2. From: Linus Walleij <[email protected]>
  3. Date: Tue, 7 Jun 2016 22:53:24 +0200
  4. Subject: [PATCH 01/31] cache patch from OpenWRT
  5. ---
  6. arch/arm/mm/cache-fa.S | 17 ++++++++++++++++-
  7. 1 file changed, 16 insertions(+), 1 deletion(-)
  8. --- a/arch/arm/mm/cache-fa.S
  9. +++ b/arch/arm/mm/cache-fa.S
  10. @@ -24,7 +24,8 @@
  11. /*
  12. * The size of one data cache line.
  13. */
  14. -#define CACHE_DLINESIZE 16
  15. +#define CACHE_DLINESIZE 16
  16. +#define CACHE_DLINESHIFT 4
  17. /*
  18. * The total size of the data cache.
  19. @@ -169,7 +170,17 @@ ENTRY(fa_flush_kern_dcache_area)
  20. * - start - virtual start address
  21. * - end - virtual end address
  22. */
  23. +__flush_whole_dcache:
  24. + mcr p15, 0, r0, c7, c14, 0 @ clean/invalidate D cache
  25. + mov r0, #0
  26. + mcr p15, 0, r0, c7, c10, 4 @ drain write buffer
  27. + mov pc, lr
  28. +
  29. fa_dma_inv_range:
  30. + sub r3, r1, r0 @ calculate total size
  31. + cmp r3, #CACHE_DLIMIT @ total size >= limit?
  32. + bhs __flush_whole_dcache @ flush whole D cache
  33. +
  34. tst r0, #CACHE_DLINESIZE - 1
  35. bic r0, r0, #CACHE_DLINESIZE - 1
  36. mcrne p15, 0, r0, c7, c14, 1 @ clean & invalidate D entry
  37. @@ -193,6 +204,10 @@ fa_dma_inv_range:
  38. * - end - virtual end address
  39. */
  40. fa_dma_clean_range:
  41. + sub r3, r1, r0 @ calculate total size
  42. + cmp r3, #CACHE_DLIMIT @ total size >= limit?
  43. + bhs __flush_whole_dcache @ flush whole D cache
  44. +
  45. bic r0, r0, #CACHE_DLINESIZE - 1
  46. 1: mcr p15, 0, r0, c7, c10, 1 @ clean D entry
  47. add r0, r0, #CACHE_DLINESIZE