Commit 366bb35a authored by Huacai Chen's avatar Huacai Chen
Browse files

LoongArch: Add suspend (ACPI S3) support



Add suspend (Suspend To RAM, aka ACPI S3) support for LoongArch.

Signed-off-by: default avatarHuacai Chen <chenhuacai@loongson.cn>
parent 27cab431
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -56,6 +56,7 @@ config LOONGARCH
	select ARCH_WANTS_NO_INSTR
	select BUILDTIME_TABLE_SORT
	select COMMON_CLK
	select CPU_PM
	select EFI
	select GENERIC_CLOCKEVENTS
	select GENERIC_CMOS_UPDATE
@@ -517,6 +518,10 @@ config ARCH_MMAP_RND_BITS_MAX

menu "Power management options"

config ARCH_SUSPEND_POSSIBLE
	def_bool y

source "kernel/power/Kconfig"
source "drivers/acpi/Kconfig"

endmenu
+3 −0
Original line number Diff line number Diff line
@@ -104,6 +104,9 @@ endif
libs-y += arch/loongarch/lib/
libs-$(CONFIG_EFI_STUB) += $(objtree)/drivers/firmware/efi/libstub/lib.a

# suspend and hibernation support
drivers-$(CONFIG_PM)	+= arch/loongarch/power/

ifeq ($(KBUILD_EXTMOD),)
prepare: vdso_prepare
vdso_prepare: prepare0
+10 −0
Original line number Diff line number Diff line
@@ -35,4 +35,14 @@ extern struct list_head acpi_wakeup_device_list;

#define ACPI_TABLE_UPGRADE_MAX_PHYS ARCH_LOW_ADDRESS_LIMIT

extern int loongarch_acpi_suspend(void);
extern int (*acpi_suspend_lowlevel)(void);
extern void loongarch_suspend_enter(void);

static inline unsigned long acpi_get_wakeup_address(void)
{
	extern void loongarch_wakeup_start(void);
	return (unsigned long)loongarch_wakeup_start;
}

#endif /* _ASM_LOONGARCH_ACPI_H */
+1 −0
Original line number Diff line number Diff line
@@ -32,6 +32,7 @@ struct loongson_system_configuration {
	int cores_per_node;
	int cores_per_package;
	unsigned long cores_io_master;
	unsigned long suspend_addr;
	const char *cpuname;
};

+3 −0
Original line number Diff line number Diff line
@@ -136,4 +136,7 @@ typedef enum {
#define ls7a_writel(val, addr)	*(volatile unsigned int   *)TO_UNCACHE(addr) = (val)
#define ls7a_writeq(val, addr)	*(volatile unsigned long  *)TO_UNCACHE(addr) = (val)

void enable_gpe_wakeup(void);
void enable_pci_wakeup(void);

#endif /* __ASM_LOONGSON_H */
Loading