2 * Copyright 2002 Embedded Edge, LLC
3 * Author: dan@embeddededge.com
5 * Sleep helper for Au1xxx sleep mode.
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version.
14 #include <asm/mipsregs.h>
15 #include <asm/regdef.h>
16 #include <asm/stackframe.h>
18 .extern __flush_cache_all
26 /* preparatory stuff */
58 /* flush caches to make sure context is in memory */
59 la t1, __flush_cache_all
64 /* Now set up the scratch registers so the boot rom will
65 * return to this point upon wakeup.
69 lui t3, 0xb190 /* sys_xxx */
71 la k0, alchemy_sleep_wakeup /* resume path */
76 /* put power supply and processor to sleep */
77 sw zero, 0x0078(t3) /* sys_slppwr */
79 sw zero, 0x007c(t3) /* sys_sleep */
91 /* sleep code for Au1000/Au1100/Au1500 memory controller type */
92 LEAF(alchemy_sleep_au1000)
96 /* cache following instructions, as memory gets put to sleep */
105 1: lui a0, 0xb400 /* mem_xxx */
106 sw zero, 0x001c(a0) /* Precharge */
108 sw zero, 0x0020(a0) /* Auto Refresh */
110 sw zero, 0x0030(a0) /* Sleep */
115 END(alchemy_sleep_au1000)
117 /* sleep code for Au1550/Au1200 memory controller type */
118 LEAF(alchemy_sleep_au1550)
122 /* cache following instructions, as memory gets put to sleep */
131 1: lui a0, 0xb400 /* mem_xxx */
132 sw zero, 0x08c0(a0) /* Precharge */
134 sw zero, 0x08d0(a0) /* Self Refresh */
137 /* wait for sdram to enter self-refresh mode */
139 2: lw t1, 0x0850(a0) /* mem_sdstat */
144 /* disable SDRAM clocks */
147 lw t1, 0x0840(a0) /* mem_sdconfiga */
148 and t1, t0, t1 /* clear CE[1:0] */
149 sw t1, 0x0840(a0) /* mem_sdconfiga */
154 END(alchemy_sleep_au1550)
157 /* This is where we return upon wakeup.
158 * Reload all of the registers and return.
160 LEAF(alchemy_sleep_wakeup)
166 mtc0 k0, CP0_PAGEMASK
170 /* We need to catch the early Alchemy SOCs with
171 * the write-only Config[OD] bit and set it back to one...
173 jal au1x00_fixup_config_od
197 END(alchemy_sleep_wakeup)