zephyr/arch/arc/soc/quark_se_c1000_ss/soc_power.S

94 lines
2.3 KiB
ArmAsm

/*
* Copyright (c) 2016 Intel Corporation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#define _ASMLANGUAGE
#include <toolchain.h>
#include <arch/arc/v2/aux_regs.h>
#include <swap_macros.h>
#ifdef CONFIG_SYS_POWER_DEEP_SLEEP
GDATA(_pm_arc_context)
GTEXT(_sys_soc_resume_from_deep_sleep)
GTEXT(_power_restore_cpu_context)
GTEXT(_power_soc_sleep)
GTEXT(_power_soc_deep_sleep)
#define GPS0_REGISTER 0xb0800100
#define RESTORE_SS_BIT 2
SECTION_FUNC(TEXT, _sys_soc_resume_from_deep_sleep)
/* Check is this wakeup after sleep event. */
ld r0,[GPS0_REGISTER]
bbit1 r0,RESTORE_SS_BIT,restore
j_s [blink] /* Jump to context of BLINK register. */
restore:
bclr_s r0,r0,RESTORE_SS_BIT
st r0,[GPS0_REGISTER]
/* Enable I-Cache */
sr 1, [_ARC_V2_IC_CTRL]
j @_sys_soc_restore_cpu_context
SECTION_FUNC(TEXT, save_cpu_context)
mov_s r1, _kernel
ld_s r2, [r1, _kernel_offset_to_current]
_save_callee_saved_regs
j_s [blink] /* Jump to context of BLINK register. */
SECTION_FUNC(TEXT, _power_soc_sleep)
/*
* Save the return address.
* The restore function will pop this and jump
* back to the caller.
*/
push_s blink
/* Do not link to preserve blink */
jl @save_cpu_context
j @power_soc_sleep
/* Does not return */
SECTION_FUNC(TEXT, _power_soc_deep_sleep)
/*
* Save the return address.
* The restore function will pop this and jump
* back to the caller.
*/
push_s blink
/* Do not link to preserve blink */
jl @save_cpu_context
j @power_soc_deep_sleep
/* Does not return */
SECTION_FUNC(TEXT, _sys_soc_restore_cpu_context)
mov_s r1, _kernel
ld_s r2, [r1, _kernel_offset_to_current]
_load_callee_saved_regs
/* Restore return address */
pop_s blink
j_s [blink] /* Jump to context of BLINK register. */
#endif