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
25 /* Save all of the processor general registers and go to sleep.
26 * A wakeup condition will get us back here to restore the registers.
28 LEAF(au1xxx_save_and_sleep)
59 /* flush caches to make sure context is in memory */
60 la t1, __flush_cache_all
65 /* Now set up the scratch registers so the boot rom will
66 * return to this point upon wakeup.
70 lui t3, 0xb190 /* sys_xxx */
72 la k0, 3f /* resume path */
75 /* Put SDRAM into self refresh: Preload instructions into cache,
76 * issue a precharge, auto/self refresh, then sleep commands to it.
86 1: lui a0, 0xb400 /* mem_xxx */
87 #if defined(CONFIG_SOC_AU1000) || defined(CONFIG_SOC_AU1100) || \
88 defined(CONFIG_SOC_AU1500)
89 sw zero, 0x001c(a0) /* Precharge */
91 sw zero, 0x0020(a0) /* Auto Refresh */
93 sw zero, 0x0030(a0) /* Sleep */
97 #if defined(CONFIG_SOC_AU1550) || defined(CONFIG_SOC_AU1200)
98 sw zero, 0x08c0(a0) /* Precharge */
100 sw zero, 0x08d0(a0) /* Self Refresh */
103 /* wait for sdram to enter self-refresh mode */
105 2: lw t1, 0x0850(a0) /* mem_sdstat */
110 /* disable SDRAM clocks */
113 lw t1, 0x0840(a0) /* mem_sdconfiga */
114 and t1, t0, t1 /* clear CE[1:0] */
115 sw t1, 0x0840(a0) /* mem_sdconfiga */
119 /* put power supply and processor to sleep */
120 sw zero, 0x0078(t3) /* sys_slppwr */
122 sw zero, 0x007c(t3) /* sys_sleep */
133 /* This is where we return upon wakeup.
134 * Reload all of the registers and return.
141 mtc0 k0, CP0_PAGEMASK
145 /* We need to catch the early Alchemy SOCs with
146 * the write-only Config[OD] bit and set it back to one...
148 jal au1x00_fixup_config_od
172 END(au1xxx_save_and_sleep)