xref: /rk3399_ARM-atf/plat/marvell/armada/a8k/common/a8k_common.mk (revision 04e06973e1fef87849c498c7f045aa2be8aada1c)
1#
2# Copyright (C) 2016 - 2020 Marvell International Ltd.
3#
4# SPDX-License-Identifier:     BSD-3-Clause
5# https://spdx.org/licenses
6
7include tools/marvell/doimage/doimage.mk
8
9PLAT_FAMILY		:= a8k
10PLAT_INCLUDE_BASE	:= include/plat/marvell/armada/$(PLAT_FAMILY)
11PLAT_COMMON_BASE	:= plat/marvell/armada/a8k/common
12MARVELL_DRV_BASE	:= drivers/marvell
13MARVELL_COMMON_BASE	:= plat/marvell/armada/common
14
15MARVELL_SVC_TEST		:= 0
16$(eval $(call add_define,MARVELL_SVC_TEST))
17
18ERRATA_A72_859971	:= 1
19
20# Enable MSS support for a8k family
21MSS_SUPPORT		:= 1
22
23# Disable EL3 cache for power management
24BL31_CACHE_DISABLE	:= 0
25$(eval $(call add_define,BL31_CACHE_DISABLE))
26
27$(eval $(call add_define,PCI_EP_SUPPORT))
28$(eval $(call assert_boolean,PCI_EP_SUPPORT))
29
30AP_NUM			:= 1
31$(eval $(call add_define,AP_NUM))
32
33DOIMAGEPATH		?=	tools/marvell/doimage
34DOIMAGETOOL		?=	${DOIMAGEPATH}/doimage
35
36ROM_BIN_EXT ?= $(BUILD_PLAT)/ble.bin
37DOIMAGE_FLAGS	+= -b $(ROM_BIN_EXT) $(NAND_DOIMAGE_FLAGS) $(DOIMAGE_SEC_FLAGS)
38
39# Check whether to build system_power.c for the platform
40ifneq ("$(wildcard $(PLAT_FAMILY_BASE)/$(PLAT)/board/system_power.c)","")
41SYSTEM_POWER_SUPPORT = 1
42else
43SYSTEM_POWER_SUPPORT = 0
44endif
45
46# This define specifies DDR type for BLE
47$(eval $(call add_define,CONFIG_DDR4))
48
49MARVELL_GIC_SOURCES	:=	drivers/arm/gic/common/gic_common.c	\
50				drivers/arm/gic/v2/gicv2_main.c		\
51				drivers/arm/gic/v2/gicv2_helpers.c	\
52				plat/common/plat_gicv2.c
53
54PLAT_INCLUDES		:=	-I$(BOARD_DIR)				\
55				-I$(PLAT_COMMON_BASE)/include		\
56				-I$(PLAT_INCLUDE_BASE)/common
57
58PLAT_BL_COMMON_SOURCES	:=	$(PLAT_COMMON_BASE)/aarch64/a8k_common.c \
59				drivers/ti/uart/aarch64/16550_console.S
60
61BLE_PORTING_SOURCES	:=	$(BOARD_DIR)/board/dram_port.c \
62				$(BOARD_DIR)/board/marvell_plat_config.c
63
64MARVELL_MOCHI_DRV	+=	$(MARVELL_DRV_BASE)/mochi/cp110_setup.c
65
66BLE_SOURCES		:=	drivers/mentor/i2c/mi2cv.c		\
67				$(PLAT_COMMON_BASE)/plat_ble_setup.c	\
68				$(MARVELL_MOCHI_DRV)			\
69				$(PLAT_COMMON_BASE)/plat_pm.c		\
70				$(MARVELL_DRV_BASE)/ap807_clocks_init.c	\
71				$(MARVELL_DRV_BASE)/thermal.c		\
72				$(PLAT_COMMON_BASE)/plat_thermal.c	\
73				$(BLE_PORTING_SOURCES)			\
74				$(MARVELL_DRV_BASE)/ccu.c		\
75				$(MARVELL_DRV_BASE)/io_win.c
76
77BL1_SOURCES		+=	$(PLAT_COMMON_BASE)/aarch64/plat_helpers.S \
78				lib/cpus/aarch64/cortex_a72.S
79
80MARVELL_DRV		:= 	$(MARVELL_DRV_BASE)/io_win.c	\
81				$(MARVELL_DRV_BASE)/iob.c	\
82				$(MARVELL_DRV_BASE)/mci.c	\
83				$(MARVELL_DRV_BASE)/amb_adec.c	\
84				$(MARVELL_DRV_BASE)/ccu.c	\
85				$(MARVELL_DRV_BASE)/cache_llc.c	\
86				$(MARVELL_DRV_BASE)/comphy/phy-comphy-cp110.c \
87				$(MARVELL_DRV_BASE)/mc_trustzone/mc_trustzone.c
88
89BL31_PORTING_SOURCES	:=	$(BOARD_DIR)/board/marvell_plat_config.c
90
91ifeq ($(SYSTEM_POWER_SUPPORT),1)
92BL31_PORTING_SOURCES	+=	$(PLAT_FAMILY_BASE)/$(PLAT)/board/system_power.c
93endif
94
95BL31_SOURCES		+=	lib/cpus/aarch64/cortex_a72.S		       \
96				$(PLAT_COMMON_BASE)/aarch64/plat_helpers.S     \
97				$(PLAT_COMMON_BASE)/aarch64/plat_arch_config.c \
98				$(PLAT_COMMON_BASE)/plat_pm.c		       \
99				$(PLAT_COMMON_BASE)/plat_bl31_setup.c	       \
100				$(MARVELL_COMMON_BASE)/marvell_gicv2.c	       \
101				$(MARVELL_COMMON_BASE)/mrvl_sip_svc.c	       \
102				$(MARVELL_COMMON_BASE)/marvell_ddr_info.c      \
103				$(BL31_PORTING_SOURCES)			       \
104				$(MARVELL_DRV)				       \
105				$(MARVELL_MOCHI_DRV)			       \
106				$(MARVELL_GIC_SOURCES)
107
108# Add trace functionality for PM
109BL31_SOURCES		+=	$(PLAT_COMMON_BASE)/plat_pm_trace.c
110
111# Force builds with BL2 image on a80x0 platforms
112ifndef SCP_BL2
113 $(error "Error: SCP_BL2 image is mandatory for a8k family")
114endif
115
116# MSS (SCP) build
117include $(PLAT_COMMON_BASE)/mss/mss_a8k.mk
118
119# BLE (ROM context execution code, AKA binary extension)
120BLE_PATH	?=  $(PLAT_COMMON_BASE)/ble
121
122include ${BLE_PATH}/ble.mk
123$(eval $(call MAKE_BL,e))
124
125mrvl_flash: ${BUILD_PLAT}/${FIP_NAME} ${DOIMAGETOOL} ${BUILD_PLAT}/ble.bin
126	$(shell truncate -s %128K ${BUILD_PLAT}/bl1.bin)
127	$(shell cat ${BUILD_PLAT}/bl1.bin ${BUILD_PLAT}/${FIP_NAME} > ${BUILD_PLAT}/${BOOT_IMAGE})
128	${DOIMAGETOOL} ${DOIMAGE_FLAGS} ${BUILD_PLAT}/${BOOT_IMAGE} ${BUILD_PLAT}/${FLASH_IMAGE}
129
130