xref: /OK3568_Linux_fs/u-boot/arch/arm/cpu/armv7/suspend.c (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /*
2*4882a593Smuzhiyun  * (C) Copyright 2017 Rockchip Electronics Co., Ltd
3*4882a593Smuzhiyun  *
4*4882a593Smuzhiyun  * SPDX-License-Identifier:     GPL-2.0+
5*4882a593Smuzhiyun  */
6*4882a593Smuzhiyun 
7*4882a593Smuzhiyun #include <asm/suspend.h>
8*4882a593Smuzhiyun #include <common.h>
9*4882a593Smuzhiyun 
10*4882a593Smuzhiyun DECLARE_GLOBAL_DATA_PTR;
11*4882a593Smuzhiyun 
cpu_suspend_save(struct pm_ctx * ctx,unsigned long sp)12*4882a593Smuzhiyun void cpu_suspend_save(struct pm_ctx *ctx, unsigned long sp)
13*4882a593Smuzhiyun {
14*4882a593Smuzhiyun 	gd->pm_ctx_phys = (phys_addr_t)ctx;
15*4882a593Smuzhiyun 
16*4882a593Smuzhiyun 	/* The content will be passed to cpu_do_resume as register sp */
17*4882a593Smuzhiyun 	ctx->sp = sp;
18*4882a593Smuzhiyun 	ctx->cpu_resume_addr = (phys_addr_t)cpu_do_resume;
19*4882a593Smuzhiyun 
20*4882a593Smuzhiyun 	cpu_do_suspend(ctx->suspend_regs);
21*4882a593Smuzhiyun 
22*4882a593Smuzhiyun 	flush_dcache_all();
23*4882a593Smuzhiyun }
24