cache_llc.S 869 B

12345678910111213141516171819202122232425262728293031323334353637
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * Copyright (C) 2016 Marvell International Ltd.
  4. */
  5. #include <asm/arch-armada8k/cache_llc.h>
  6. #include <linux/linkage.h>
  7. /*
  8. * int __asm_flush_l3_dcache
  9. *
  10. * flush Armada-8K last level cache.
  11. *
  12. */
  13. ENTRY(__asm_flush_l3_dcache)
  14. /* flush cache */
  15. mov x0, #LLC_BASE_ADDR
  16. add x0, x0, #LLC_FLUSH_BY_WAY
  17. movk x0, #MVEBU_A8K_REGS_BASE_MSB, lsl #16
  18. mov w1, #LLC_WAY_MASK
  19. str w1, [x0]
  20. /* sync cache */
  21. mov x0, #LLC_BASE_ADDR
  22. add x0, x0, #LLC_CACHE_SYNC
  23. movk x0, #MVEBU_A8K_REGS_BASE_MSB, lsl #16
  24. str wzr, [x0]
  25. /* check that cache sync completed */
  26. mov x0, #LLC_BASE_ADDR
  27. add x0, x0, #LLC_CACHE_SYNC_COMPLETE
  28. movk x0, #MVEBU_A8K_REGS_BASE_MSB, lsl #16
  29. 1: ldr w1, [x0]
  30. and w1, w1, #LLC_CACHE_SYNC_MASK
  31. cbnz w1, 1b
  32. /* return success */
  33. mov x0, #0
  34. ret
  35. ENDPROC(__asm_flush_l3_dcache)