1#
2# Copyright (c) 2020-2022, MediaTek Inc. All rights reserved.
3#
4# SPDX-License-Identifier: BSD-3-Clause
5#
6
7MTK_PLAT      := plat/mediatek
8MTK_PLAT_SOC  := ${MTK_PLAT}/${PLAT}
9
10PLAT_INCLUDES := -I${MTK_PLAT}/common/                            \
11                 -I${MTK_PLAT}/common/lpm/                        \
12                 -I${MTK_PLAT}/drivers/cirq/                      \
13                 -I${MTK_PLAT}/drivers/gic600/                    \
14                 -I${MTK_PLAT}/drivers/gpio/                      \
15                 -I${MTK_PLAT}/drivers/pmic/                      \
16                 -I${MTK_PLAT}/drivers/pmic_wrap/                 \
17                 -I${MTK_PLAT}/drivers/rtc/                       \
18                 -I${MTK_PLAT}/drivers/timer/                     \
19                 -I${MTK_PLAT}/drivers/uart/                      \
20                 -I${MTK_PLAT}/include/                           \
21                 -I${MTK_PLAT_SOC}/include/                       \
22                 -I${MTK_PLAT_SOC}/drivers/                       \
23                 -I${MTK_PLAT_SOC}/drivers/apusys/                \
24                 -I${MTK_PLAT_SOC}/drivers/dcm                    \
25                 -I${MTK_PLAT_SOC}/drivers/devapc                 \
26                 -I${MTK_PLAT_SOC}/drivers/dfd                    \
27                 -I${MTK_PLAT_SOC}/drivers/emi_mpu/               \
28                 -I${MTK_PLAT_SOC}/drivers/gpio/                  \
29                 -I${MTK_PLAT_SOC}/drivers/mcdi/                  \
30                 -I${MTK_PLAT_SOC}/drivers/pmic/                  \
31                 -I${MTK_PLAT_SOC}/drivers/ptp3/                  \
32                 -I${MTK_PLAT_SOC}/drivers/spmc/
33
34GICV3_SUPPORT_GIC600        :=      1
35include drivers/arm/gic/v3/gicv3.mk
36include lib/xlat_tables_v2/xlat_tables.mk
37
38PLAT_BL_COMMON_SOURCES := ${GICV3_SOURCES}                              \
39                          ${XLAT_TABLES_LIB_SRCS}                       \
40                          plat/common/aarch64/crash_console_helpers.S   \
41                          plat/common/plat_psci_common.c
42
43BL31_SOURCES    += common/desc_image_load.c                              \
44                   drivers/delay_timer/delay_timer.c                     \
45                   drivers/delay_timer/generic_delay_timer.c             \
46                   drivers/ti/uart/aarch64/16550_console.S               \
47                   drivers/gpio/gpio.c                                   \
48                   lib/bl_aux_params/bl_aux_params.c                     \
49                   lib/cpus/aarch64/cortex_a55.S                         \
50                   lib/cpus/aarch64/cortex_a76.S                         \
51                   plat/common/plat_gicv3.c                              \
52                   ${MTK_PLAT}/common/mtk_plat_common.c                  \
53                   ${MTK_PLAT}/common/mtk_sip_svc.c                      \
54                   ${MTK_PLAT}/common/params_setup.c                     \
55                   ${MTK_PLAT}/common/lpm/mt_lp_rm.c                     \
56                   ${MTK_PLAT}/drivers/cirq/mt_cirq.c                    \
57                   ${MTK_PLAT}/drivers/gic600/mt_gic_v3.c                \
58                   ${MTK_PLAT}/drivers/gpio/mtgpio_common.c              \
59                   ${MTK_PLAT}/drivers/pmic/pmic.c                       \
60                   ${MTK_PLAT}/drivers/pmic_wrap/pmic_wrap_init_v2.c     \
61                   ${MTK_PLAT}/drivers/rtc/rtc_common.c                  \
62                   ${MTK_PLAT}/drivers/rtc/rtc_mt6359p.c                 \
63                   ${MTK_PLAT}/drivers/timer/mt_timer.c                  \
64                   ${MTK_PLAT}/drivers/uart/uart.c                       \
65                   ${MTK_PLAT_SOC}/aarch64/platform_common.c             \
66                   ${MTK_PLAT_SOC}/aarch64/plat_helpers.S                \
67                   ${MTK_PLAT_SOC}/bl31_plat_setup.c                     \
68                   ${MTK_PLAT_SOC}/plat_pm.c                             \
69                   ${MTK_PLAT_SOC}/plat_topology.c                       \
70                   ${MTK_PLAT_SOC}/plat_sip_calls.c                      \
71                   ${MTK_PLAT_SOC}/drivers/apusys/mtk_apusys.c           \
72                   ${MTK_PLAT_SOC}/drivers/apusys/mtk_apusys_apc.c       \
73                   ${MTK_PLAT_SOC}/drivers/dcm/mtk_dcm.c                 \
74                   ${MTK_PLAT_SOC}/drivers/dcm/mtk_dcm_utils.c           \
75                   ${MTK_PLAT_SOC}/drivers/devapc/devapc.c               \
76                   ${MTK_PLAT_SOC}/drivers/dfd/plat_dfd.c                \
77                   ${MTK_PLAT_SOC}/drivers/emi_mpu/emi_mpu.c             \
78                   ${MTK_PLAT_SOC}/drivers/gpio/mtgpio.c                 \
79                   ${MTK_PLAT_SOC}/drivers/mcdi/mt_cpu_pm.c              \
80                   ${MTK_PLAT_SOC}/drivers/mcdi/mt_cpu_pm_cpc.c          \
81                   ${MTK_PLAT_SOC}/drivers/mcdi/mt_lp_irqremain.c        \
82                   ${MTK_PLAT_SOC}/drivers/mcdi/mt_mcdi.c                \
83                   ${MTK_PLAT_SOC}/drivers/ptp3/mtk_ptp3_main.c          \
84                   ${MTK_PLAT_SOC}/drivers/spmc/mtspmc.c
85
86# Build SPM drivers
87include ${MTK_PLAT_SOC}/drivers/spm/build.mk
88
89# Configs for A76 and A55
90HW_ASSISTED_COHERENCY := 1
91USE_COHERENT_MEM := 0
92CTX_INCLUDE_AARCH32_REGS := 0
93
94# indicate the reset vector address can be programmed
95PROGRAMMABLE_RESET_ADDRESS := 1
96
97COLD_BOOT_SINGLE_CPU := 1
98
99MACH_MT8192 := 1
100$(eval $(call add_define,MACH_MT8192))
101
102include lib/coreboot/coreboot.mk
103
104