1 /* SPDX-License-Identifier: GPL-2.0 */
3 #include <asm/ppc_asm.h>
4 #include <asm/processor.h>
9 _GLOBAL(mpc52xx_deep_sleep)
10 mpc52xx_deep_sleep: /* args r3-r6: SRAM, SDRAM regs, CDM regs, INTR regs */
12 /* enable interrupts */
14 ori r7, r7, 0x8000 /* EE */
18 li r10, 0 /* flag that irq handler sets */
20 /* enable tmr7 (or any other) interrupt */
21 lwz r8, 0x14(r6) /* intr->main_mask */
27 /* emulate tmr7 interrupt */
29 stw r8, 0x40(r6) /* intr->main_emulate */
32 /* wait for it to happen */
51 mtlr r9 /* restore LR */
62 /* return to C code */
66 _GLOBAL(mpc52xx_ds_sram)
68 /* put SDRAM into self-refresh */
69 lwz r8, 0x4(r4) /* sdram->ctrl */
71 oris r8, r8, 0x8000 /* mode_en */
75 ori r8, r8, 0x0002 /* soft_pre */
80 xoris r8, r8, 0x8000 /* !mode_en */
85 xoris r8, r8, 0x4000 /* ref_en !cke */
89 /* disable SDRAM clock */
90 lwz r8, 0x14(r5) /* cdm->clkenable */
97 /* put mpc5200 to sleep */
99 oris r10, r10, 0x0004 /* POW = 1 */
111 /* get ram out of self-refresh */
113 oris r8, r8, 0x5000 /* cke ref_en */
118 _GLOBAL(mpc52xx_ds_sram_size)
119 mpc52xx_ds_sram_size:
120 .long $-mpc52xx_ds_sram
123 /* ### interrupt handler for wakeup from deep-sleep ### */
124 _GLOBAL(mpc52xx_ds_cached)
129 /* disable emulated interrupt */
130 mfspr r7, 311 /* MBAR */
131 addi r7, r7, 0x540 /* intr->main_emul */
137 /* acknowledge wakeup, so CCS releases power pown */
138 mfspr r7, 311 /* MBAR */
139 addi r7, r7, 0x524 /* intr->enc_status */
146 /* flag - we handled the interrupt */
153 _GLOBAL(mpc52xx_ds_cached_size)
154 mpc52xx_ds_cached_size:
155 .long $-mpc52xx_ds_cached