1/* SPDX-License-Identifier: BSD-2-Clause */
2/*
3 * Copyright 2017 NXP
4 */
5
6#include <arm.h>
7#include <arm32_macros.S>
8#include <asm.S>
9#include <kernel/cache_helpers.h>
10
11FUNC psci_disable_smp, :
12	read_actlr r0
13	bic	r0, r0, #ACTLR_SMP
14	write_actlr r0
15	isb
16	bx	lr
17END_FUNC psci_disable_smp
18
19FUNC psci_enable_smp, :
20	read_actlr r0
21	orr	r0, r0, #ACTLR_SMP
22	write_actlr r0
23	isb
24	bx	lr
25END_FUNC psci_enable_smp
26
27FUNC psci_armv7_cpu_off, :
28	push	{r12, lr}
29UNWIND(	.save	{r12, lr})
30
31	mov     r0, #DCACHE_OP_CLEAN_INV
32	bl	dcache_op_all
33
34	/* Disable Cache */
35	read_sctlr r0
36	bic	r0, r0, #SCTLR_C
37	write_sctlr r0
38	isb
39	dsb
40
41	mov	r0, #DCACHE_OP_CLEAN_INV
42	bl	dcache_op_all
43
44	clrex
45
46	bl	psci_disable_smp
47
48	pop	{r12, pc}
49END_FUNC psci_armv7_cpu_off
50