1#
2# Copyright (c) 2021, MediaTek Inc. All rights reserved.
3#
4# SPDX-License-Identifier: BSD-3-Clause
5#
6
7# Enable or disable spm feature
8MT_SPM_FEATURE_SUPPORT = yes
9
10# Enable or disable cirq restore
11MT_SPM_CIRQ_FEATURE_SUPPORT = yes
12
13# sspm notifier support
14MT_SPM_SSPM_NOTIFIER_SUPPORT = yes
15
16CUR_SPM_FOLDER = ${MTK_PLAT_SOC}/drivers/spm
17
18# spm common files
19PLAT_SPM_SOURCE_FILES_COMMON +=			\
20	${CUR_SPM_FOLDER}/mt_spm.c		\
21	${CUR_SPM_FOLDER}/mt_spm_conservation.c	\
22	${CUR_SPM_FOLDER}/mt_spm_internal.c	\
23	${CUR_SPM_FOLDER}/mt_spm_pmic_wrap.c
24
25# spm platform dependcy files
26PLAT_SPM_SOURCE_FILES +=					\
27	${CUR_SPM_FOLDER}/constraints/mt_spm_rc_bus26m.c	\
28	${CUR_SPM_FOLDER}/constraints/mt_spm_rc_cpu_buck_ldo.c	\
29	${CUR_SPM_FOLDER}/constraints/mt_spm_rc_dram.c		\
30	${CUR_SPM_FOLDER}/constraints/mt_spm_rc_syspll.c	\
31	${CUR_SPM_FOLDER}/mt_spm_cond.c				\
32	${CUR_SPM_FOLDER}/mt_spm_suspend.c			\
33	${CUR_SPM_FOLDER}/mt_spm_idle.c
34
35ifeq (${MT_SPM_FEATURE_SUPPORT}, no)
36PLAT_SPM_DEBUG_CFLAGS += -DATF_PLAT_SPM_UNSUPPORT
37BL31_MT_LPM_PLAT_SPM_SOURCE_FILES += ${PLAT_SPM_SOURCE_FILES_COMMON}
38else
39BL31_MT_LPM_PLAT_SPM_SOURCE_FILES +=	\
40	${PLAT_SPM_SOURCE_FILES_COMMON} \
41	${PLAT_SPM_SOURCE_FILES}
42endif
43
44ifeq (${MT_SPM_CIRQ_FEATURE_SUPPORT}, no)
45PLAT_SPM_DEBUG_CFLAGS += -DATF_PLAT_CIRQ_UNSUPPORT
46endif
47
48ifeq (${MT_SPM_SSPM_NOTIFIER_SUPPORT}, no)
49PLAT_SPM_DEBUG_CFLAGS += -DATF_PLAT_SPM_SSPM_NOTIFIER_UNSUPPORT
50else
51BL31_MT_LPM_PLAT_SPM_SOURCE_FILES +=	\
52	${CUR_SPM_FOLDER}/notifier/mt_spm_sspm_notifier.c
53endif
54
55$(info --------------------------------------)
56$(info SPM build flags: ${PLAT_SPM_DEBUG_CFLAGS})
57$(info SPM build files: ${BL31_MT_LPM_PLAT_SPM_SOURCE_FILES})
58$(info --------------------------------------)
59
60# Common makefile for platform.mk
61PLAT_INCLUDES +=				\
62	${PLAT_SPM_DEBUG_CFLAGS}		\
63	-I${CUR_SPM_FOLDER}/			\
64	-I${CUR_SPM_FOLDER}/constraints/	\
65	-I${CUR_SPM_FOLDER}/notifier/
66
67PLAT_BL_COMMON_SOURCES += ${BL31_MT_LPM_PLAT_SPM_SOURCE_FILES}
68