1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * Copyright (C) 2016 Broadcom Corporation
7 #include <asm/regdef.h>
8 #include <asm/mipsregs.h>
9 #include <asm/stackframe.h>
18 * a0: u32 params array
34 * Dereference the params array
35 * s0: AON_CTRL base register
36 * s1: DDR_PHY base register
37 * s2: TIMERS base register
38 * s3: I-Cache line size
39 * s4: Restart vector address
40 * s5: Restart vector size
51 /* Lock this asm section into the I-cache */
65 /* Lock the interrupt vector into the I-cache */
77 /* Power down request */
79 sw zero, AON_CTRL_PM_CTRL(s0)
80 lw zero, AON_CTRL_PM_CTRL(s0)
81 sw t0, AON_CTRL_PM_CTRL(s0)
82 lw t0, AON_CTRL_PM_CTRL(s0)
84 /* Enable CP0 interrupt 2 and wait for interrupt */
86 /* Save cp0 sr for restoring later */
89 li t1, ~(ST0_IM | ST0_IE)
99 /* Wait for interrupt */
104 1: lw t0, DDR40_PHY_CONTROL_REGS_0_PLL_STATUS(s1)
109 /* 1ms delay needed for stable recovery */
110 /* Use TIMER1 to count 1 ms */
112 sw t0, TIMER_TIMER1_CTRL(s2)
113 lw t0, TIMER_TIMER1_CTRL(s2)
116 sw t0, TIMER_TIMER1_CTRL(s2)
117 lw t0, TIMER_TIMER1_CTRL(s2)
121 lw t1, TIMER_TIMER1_STAT(s2)
126 /* Wait for the timer value to exceed t1 */
127 1: lw t0, TIMER_TIMER1_STAT(s2)
134 sw t1, AON_CTRL_HOST_MISC_CMDS(s0)
135 lw t1, AON_CTRL_HOST_MISC_CMDS(s0)
137 sw zero, AON_CTRL_PM_CTRL(s0)
138 lw zero, AON_CTRL_PM_CTRL(s0)
154 /* Unlock interrupt vector */
170 /* Set return value to success */
173 /* Return to caller */