1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * Copyright © 2014-2017 Broadcom
6 #include <linux/linkage.h>
7 #include <asm/assembler.h>
14 #define AON_CTRL_REG r10
15 #define DDR_PHY_STATUS_REG r11
18 * r0: AON_CTRL base address
19 * r1: DDRY PHY PLL status register address
21 ENTRY(brcmstb_pm_do_s2)
22 stmfd sp!, {r4-r11, lr}
24 mov DDR_PHY_STATUS_REG, r1
26 /* Flush memory transactions */
29 /* Cache DDR_PHY_STATUS_REG translation */
30 ldr r0, [DDR_PHY_STATUS_REG]
32 /* power down request */
33 ldr r0, =PM_S2_COMMAND
35 str r1, [AON_CTRL_REG, #AON_CTRL_PM_CTRL]
36 ldr r1, [AON_CTRL_REG, #AON_CTRL_PM_CTRL]
37 str r0, [AON_CTRL_REG, #AON_CTRL_PM_CTRL]
38 ldr r0, [AON_CTRL_REG, #AON_CTRL_PM_CTRL]
40 /* Wait for interrupt */
44 /* Bring MEMC back up */
45 1: ldr r0, [DDR_PHY_STATUS_REG]
49 /* Power-up handshake */
51 str r0, [AON_CTRL_REG, #AON_CTRL_HOST_MISC_CMDS]
52 ldr r0, [AON_CTRL_REG, #AON_CTRL_HOST_MISC_CMDS]
55 str r0, [AON_CTRL_REG, #AON_CTRL_PM_CTRL]
56 ldr r0, [AON_CTRL_REG, #AON_CTRL_PM_CTRL]
58 /* Return to caller */
60 ldmfd sp!, {r4-r11, pc}
62 ENDPROC(brcmstb_pm_do_s2)
64 /* Place literal pool here */
67 ENTRY(brcmstb_pm_do_s2_sz)
68 .word . - brcmstb_pm_do_s2