l2c-l2x0-resume.S 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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/hardware/cache-l2x0.h>
  10. .text
  11. ENTRY(l2c310_early_resume)
  12. adr r0, 1f
  13. ldr r2, [r0]
  14. add r0, r2, r0
  15. ldmia r0, {r1, r2, r3, r4, r5, r6, r7, r8}
  16. @ r1 = phys address of L2C-310 controller
  17. @ r2 = aux_ctrl
  18. @ r3 = tag_latency
  19. @ r4 = data_latency
  20. @ r5 = filter_start
  21. @ r6 = filter_end
  22. @ r7 = prefetch_ctrl
  23. @ r8 = pwr_ctrl
  24. @ Check that the address has been initialised
  25. teq r1, #0
  26. moveq pc, lr
  27. @ The prefetch and power control registers are revision dependent
  28. @ and can be written whether or not the L2 cache is enabled
  29. ldr r0, [r1, #L2X0_CACHE_ID]
  30. and r0, r0, #L2X0_CACHE_ID_RTL_MASK
  31. cmp r0, #L310_CACHE_ID_RTL_R2P0
  32. strcs r7, [r1, #L310_PREFETCH_CTRL]
  33. cmp r0, #L310_CACHE_ID_RTL_R3P0
  34. strcs r8, [r1, #L310_POWER_CTRL]
  35. @ Don't setup the L2 cache if it is already enabled
  36. ldr r0, [r1, #L2X0_CTRL]
  37. tst r0, #L2X0_CTRL_EN
  38. movne pc, lr
  39. str r3, [r1, #L310_TAG_LATENCY_CTRL]
  40. str r4, [r1, #L310_DATA_LATENCY_CTRL]
  41. str r6, [r1, #L310_ADDR_FILTER_END]
  42. str r5, [r1, #L310_ADDR_FILTER_START]
  43. str r2, [r1, #L2X0_AUX_CTRL]
  44. mov r9, #L2X0_CTRL_EN
  45. str r9, [r1, #L2X0_CTRL]
  46. mov pc, lr
  47. ENDPROC(l2c310_early_resume)
  48. .align
  49. 1: .long l2x0_saved_regs - .