l2c-l2x0-resume.S 1.4 KB

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