s2-arm.S 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright © 2014-2017 Broadcom
  4. */
  5. #include <linux/linkage.h>
  6. #include <asm/assembler.h>
  7. #include "pm.h"
  8. .text
  9. .align 3
  10. #define AON_CTRL_REG r10
  11. #define DDR_PHY_STATUS_REG r11
  12. /*
  13. * r0: AON_CTRL base address
  14. * r1: DDRY PHY PLL status register address
  15. */
  16. ENTRY(brcmstb_pm_do_s2)
  17. stmfd sp!, {r4-r11, lr}
  18. mov AON_CTRL_REG, r0
  19. mov DDR_PHY_STATUS_REG, r1
  20. /* Flush memory transactions */
  21. dsb
  22. /* Cache DDR_PHY_STATUS_REG translation */
  23. ldr r0, [DDR_PHY_STATUS_REG]
  24. /* power down request */
  25. ldr r0, =PM_S2_COMMAND
  26. ldr r1, =0
  27. str r1, [AON_CTRL_REG, #AON_CTRL_PM_CTRL]
  28. ldr r1, [AON_CTRL_REG, #AON_CTRL_PM_CTRL]
  29. str r0, [AON_CTRL_REG, #AON_CTRL_PM_CTRL]
  30. ldr r0, [AON_CTRL_REG, #AON_CTRL_PM_CTRL]
  31. /* Wait for interrupt */
  32. wfi
  33. nop
  34. /* Bring MEMC back up */
  35. 1: ldr r0, [DDR_PHY_STATUS_REG]
  36. ands r0, #1
  37. beq 1b
  38. /* Power-up handshake */
  39. ldr r0, =1
  40. str r0, [AON_CTRL_REG, #AON_CTRL_HOST_MISC_CMDS]
  41. ldr r0, [AON_CTRL_REG, #AON_CTRL_HOST_MISC_CMDS]
  42. ldr r0, =0
  43. str r0, [AON_CTRL_REG, #AON_CTRL_PM_CTRL]
  44. ldr r0, [AON_CTRL_REG, #AON_CTRL_PM_CTRL]
  45. /* Return to caller */
  46. ldr r0, =0
  47. ldmfd sp!, {r4-r11, pc}
  48. ENDPROC(brcmstb_pm_do_s2)
  49. /* Place literal pool here */
  50. .ltorg
  51. ENTRY(brcmstb_pm_do_s2_sz)
  52. .word . - brcmstb_pm_do_s2