l2c-l2x0-resume.S 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * L2C-310 early resume code. This can be used by platforms to restore
  4. * the settings of their L2 cache controller before restoring the
  5. * processor state.
  6. *
  7. * This code can only be used to if you are running in the secure world.
  8. */
  9. #include <linux/linkage.h>
  10. #include <asm/assembler.h>
  11. #include <asm/hardware/cache-l2x0.h>
  12. .text
  13. ENTRY(l2c310_early_resume)
  14. adr r0, 1f
  15. ldr r2, [r0]
  16. add r0, r2, r0
  17. ldmia r0, {r1, r2, r3, r4, r5, r6, r7, r8}
  18. @ r1 = phys address of L2C-310 controller
  19. @ r2 = aux_ctrl
  20. @ r3 = tag_latency
  21. @ r4 = data_latency
  22. @ r5 = filter_start
  23. @ r6 = filter_end
  24. @ r7 = prefetch_ctrl
  25. @ r8 = pwr_ctrl
  26. @ Check that the address has been initialised
  27. teq r1, #0
  28. reteq lr
  29. @ The prefetch and power control registers are revision dependent
  30. @ and can be written whether or not the L2 cache is enabled
  31. ldr r0, [r1, #L2X0_CACHE_ID]
  32. and r0, r0, #L2X0_CACHE_ID_RTL_MASK
  33. cmp r0, #L310_CACHE_ID_RTL_R2P0
  34. strcs r7, [r1, #L310_PREFETCH_CTRL]
  35. cmp r0, #L310_CACHE_ID_RTL_R3P0
  36. strcs r8, [r1, #L310_POWER_CTRL]
  37. @ Don't setup the L2 cache if it is already enabled
  38. ldr r0, [r1, #L2X0_CTRL]
  39. tst r0, #L2X0_CTRL_EN
  40. retne lr
  41. str r3, [r1, #L310_TAG_LATENCY_CTRL]
  42. str r4, [r1, #L310_DATA_LATENCY_CTRL]
  43. str r6, [r1, #L310_ADDR_FILTER_END]
  44. str r5, [r1, #L310_ADDR_FILTER_START]
  45. str r2, [r1, #L2X0_AUX_CTRL]
  46. mov r9, #L2X0_CTRL_EN
  47. str r9, [r1, #L2X0_CTRL]
  48. ret lr
  49. ENDPROC(l2c310_early_resume)
  50. .align
  51. 1: .long l2x0_saved_regs - .