2 * Copyright (C) 2016 Broadcom Corporation
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
15 #include <asm/regdef.h>
16 #include <asm/mipsregs.h>
17 #include <asm/stackframe.h>
26 * a0: u32 params array
42 * Dereference the params array
43 * s0: AON_CTRL base register
44 * s1: DDR_PHY base register
45 * s2: TIMERS base register
46 * s3: I-Cache line size
47 * s4: Restart vector address
48 * s5: Restart vector size
59 /* Lock this asm section into the I-cache */
73 /* Lock the interrupt vector into the I-cache */
85 /* Power down request */
87 sw zero, AON_CTRL_PM_CTRL(s0)
88 lw zero, AON_CTRL_PM_CTRL(s0)
89 sw t0, AON_CTRL_PM_CTRL(s0)
90 lw t0, AON_CTRL_PM_CTRL(s0)
92 /* Enable CP0 interrupt 2 and wait for interrupt */
94 /* Save cp0 sr for restoring later */
97 li t1, ~(ST0_IM | ST0_IE)
107 /* Wait for interrupt */
112 1: lw t0, DDR40_PHY_CONTROL_REGS_0_PLL_STATUS(s1)
117 /* 1ms delay needed for stable recovery */
118 /* Use TIMER1 to count 1 ms */
120 sw t0, TIMER_TIMER1_CTRL(s2)
121 lw t0, TIMER_TIMER1_CTRL(s2)
124 sw t0, TIMER_TIMER1_CTRL(s2)
125 lw t0, TIMER_TIMER1_CTRL(s2)
129 lw t1, TIMER_TIMER1_STAT(s2)
134 /* Wait for the timer value to exceed t1 */
135 1: lw t0, TIMER_TIMER1_STAT(s2)
142 sw t1, AON_CTRL_HOST_MISC_CMDS(s0)
143 lw t1, AON_CTRL_HOST_MISC_CMDS(s0)
145 sw zero, AON_CTRL_PM_CTRL(s0)
146 lw zero, AON_CTRL_PM_CTRL(s0)
162 /* Unlock interrupt vector */
178 /* Set return value to success */
181 /* Return to caller */