1 /* SPDX-License-Identifier: GPL-2.0 */
3 * Sleep helper for Loongson-3 sleep mode.
5 * Author: Huacai Chen <chenhuacai@loongson.cn>
6 * Copyright (C) 2020-2022 Loongson Technology Corporation Limited
10 #include <asm/asmmacro.h>
11 #include <asm/addrspace.h>
12 #include <asm/loongarch.h>
13 #include <asm/stackframe.h>
15 /* preparatory stuff */
17 addi.d sp, sp, -PT_SIZE
34 la.pcrel t0, acpi_saved_sp
59 /* Sleep/wakeup code for Loongson-3 */
60 SYM_FUNC_START(loongarch_suspend_enter)
64 /* Pass RA and SP to BIOS */
66 la.pcrel a0, loongarch_wakeup_start
67 la.pcrel t0, loongarch_suspend_addr
69 jirl ra, t0, 0 /* Call BIOS's STR sleep routine */
72 * This is where we return upon wakeup.
73 * Reload all of the registers and return.
75 SYM_INNER_LABEL(loongarch_wakeup_start, SYM_L_GLOBAL)
80 li.w t0, 0xb0 # PLV=0, IE=0, PG=1
81 csrwr t0, LOONGARCH_CSR_CRMD
83 la.pcrel t0, acpi_saved_sp
86 addi.d sp, sp, PT_SIZE
88 SYM_FUNC_END(loongarch_suspend_enter)