1# Copyright (C) 2018 Marvell International Ltd.
2#
3# SPDX-License-Identifier:     BSD-3-Clause
4# https://spdx.org/licenses
5
6MARVELL_PLAT_BASE		:= plat/marvell/armada
7MARVELL_PLAT_INCLUDE_BASE	:= include/plat/marvell/armada
8
9SEPARATE_CODE_AND_RODATA	:= 1
10
11# flag to switch from PLL to ARO
12ARO_ENABLE			:= 0
13$(eval $(call add_define,ARO_ENABLE))
14
15# Convert LLC to secure SRAM
16LLC_SRAM			:= 0
17$(eval $(call add_define,LLC_SRAM))
18
19# Enable/Disable LLC
20LLC_ENABLE			:= 1
21$(eval $(call add_define,LLC_ENABLE))
22
23include lib/xlat_tables_v2/xlat_tables.mk
24
25PLAT_INCLUDES		+=	-I$(MARVELL_PLAT_INCLUDE_BASE)/common	\
26				-I$(MARVELL_PLAT_INCLUDE_BASE)/common/aarch64
27
28
29PLAT_BL_COMMON_SOURCES  += ${XLAT_TABLES_LIB_SRCS} \
30				$(MARVELL_PLAT_BASE)/common/aarch64/marvell_common.c	\
31				$(MARVELL_PLAT_BASE)/common/aarch64/marvell_helpers.S	\
32				$(MARVELL_COMMON_BASE)/marvell_console.c
33
34BL1_SOURCES		+=	drivers/delay_timer/delay_timer.c			\
35				drivers/io/io_fip.c					\
36				drivers/io/io_memmap.c					\
37				drivers/io/io_storage.c					\
38				$(MARVELL_PLAT_BASE)/common/marvell_bl1_setup.c		\
39				$(MARVELL_PLAT_BASE)/common/marvell_io_storage.c	\
40				$(MARVELL_PLAT_BASE)/common/plat_delay_timer.c
41
42ifdef EL3_PAYLOAD_BASE
43# Need the arm_program_trusted_mailbox() function to release secondary CPUs from
44# their holding pen
45endif
46
47BL2_SOURCES		+=	drivers/io/io_fip.c					\
48				drivers/io/io_memmap.c					\
49				drivers/io/io_storage.c					\
50				common/desc_image_load.c				\
51				$(MARVELL_PLAT_BASE)/common/marvell_bl2_setup.c		\
52				$(MARVELL_PLAT_BASE)/common/marvell_io_storage.c	\
53				$(MARVELL_PLAT_BASE)/common/aarch64/marvell_bl2_mem_params_desc.c	\
54				$(MARVELL_PLAT_BASE)/common/marvell_image_load.c
55
56ifeq (${SPD},opteed)
57PLAT_INCLUDES		+=	-Iinclude/lib
58BL2_SOURCES		+=	lib/optee/optee_utils.c
59endif
60
61BL31_SOURCES		+=	$(MARVELL_PLAT_BASE)/common/marvell_bl31_setup.c	\
62				$(MARVELL_PLAT_BASE)/common/marvell_pm.c		\
63				$(MARVELL_PLAT_BASE)/common/marvell_topology.c		\
64				plat/common/plat_psci_common.c				\
65				$(MARVELL_PLAT_BASE)/common/plat_delay_timer.c		\
66				drivers/delay_timer/delay_timer.c
67
68# PSCI functionality
69$(eval $(call add_define,CONFIG_ARM64))
70
71# Add the build options to pack Trusted OS Extra1 and Trusted OS Extra2 images
72# in the FIP if the platform requires.
73ifneq ($(BL32_EXTRA1),)
74$(eval $(call TOOL_ADD_IMG,bl32_extra1,--tos-fw-extra1))
75endif
76ifneq ($(BL32_EXTRA2),)
77$(eval $(call TOOL_ADD_IMG,bl32_extra2,--tos-fw-extra2))
78endif
79
80# MSS (SCP) build
81ifeq (${MSS_SUPPORT}, 1)
82include $(MARVELL_PLAT_BASE)/common/mss/mss_common.mk
83endif
84
85$(BUILD_PLAT)/$(BOOT_IMAGE): $(BUILD_PLAT)/bl1.bin $(BUILD_PLAT)/$(FIP_NAME)
86	$(if $(shell find $(BUILD_PLAT)/bl1.bin -type f -size +128k),$(error "Image '$(BUILD_PLAT)/bl1.bin' is bigger than 128kB"))
87	@cp $(BUILD_PLAT)/bl1.bin $(BUILD_PLAT)/$(BOOT_IMAGE) || { rm -f $(BUILD_PLAT)/$(BOOT_IMAGE); false; }
88	@truncate -s %128K $(BUILD_PLAT)/$(BOOT_IMAGE) || { rm -f $(BUILD_PLAT)/$(BOOT_IMAGE); false; }
89	@cat $(BUILD_PLAT)/$(FIP_NAME) >> $(BUILD_PLAT)/$(BOOT_IMAGE) || { rm -f $(BUILD_PLAT)/$(BOOT_IMAGE); false; }
90	@truncate -s %4 $(BUILD_PLAT)/$(BOOT_IMAGE) || { rm -f $(BUILD_PLAT)/$(BOOT_IMAGE); false; }
91	@$(ECHO_BLANK_LINE)
92	@echo "Built $@ successfully"
93	@$(ECHO_BLANK_LINE)
94
95.PHONY: mrvl_bootimage
96mrvl_bootimage: $(BUILD_PLAT)/$(BOOT_IMAGE)
97
98.PHONY: mrvl_flash
99mrvl_flash: $(BUILD_PLAT)/$(FLASH_IMAGE)
100