blob: 773b912d172be799af2192713d77ff2999e9d85c [file] [log] [blame]
Konstantin Porotchkinf69ec582018-06-07 18:31:14 +03001#
Marcin Wojtasa86fe0c2020-06-02 15:12:06 +02002# Copyright (C) 2016 - 2020 Marvell International Ltd.
Konstantin Porotchkinf69ec582018-06-07 18:31:14 +03003#
4# SPDX-License-Identifier: BSD-3-Clause
5# https://spdx.org/licenses
6
Konstantin Porotchkinf69ec582018-06-07 18:31:14 +03007PLAT_FAMILY := a8k
Grzegorz Jaszczyk3039bce2019-11-05 13:14:59 +01008PLAT_INCLUDE_BASE := include/plat/marvell/armada/$(PLAT_FAMILY)
Grzegorz Jaszczyk2d3d86a2018-12-09 23:11:20 +01009PLAT_COMMON_BASE := plat/marvell/armada/a8k/common
Konstantin Porotchkinf69ec582018-06-07 18:31:14 +030010MARVELL_DRV_BASE := drivers/marvell
Grzegorz Jaszczyk3039bce2019-11-05 13:14:59 +010011MARVELL_COMMON_BASE := plat/marvell/armada/common
Konstantin Porotchkinf69ec582018-06-07 18:31:14 +030012
Konstantin Porotchkin23099612020-10-12 18:13:07 +030013MARVELL_SVC_TEST := 0
Konstantin Porotchkinf51f2512018-11-06 12:25:38 +020014$(eval $(call add_define,MARVELL_SVC_TEST))
15
Konstantin Porotchkinf69ec582018-06-07 18:31:14 +030016ERRATA_A72_859971 := 1
17
18# Enable MSS support for a8k family
19MSS_SUPPORT := 1
Konstantin Porotchkin23099612020-10-12 18:13:07 +030020$(eval $(call add_define,MSS_SUPPORT))
Konstantin Porotchkinf69ec582018-06-07 18:31:14 +030021
22# Disable EL3 cache for power management
Marcin Wojtasa86fe0c2020-06-02 15:12:06 +020023BL31_CACHE_DISABLE := 0
Konstantin Porotchkinf69ec582018-06-07 18:31:14 +030024$(eval $(call add_define,BL31_CACHE_DISABLE))
25
26$(eval $(call add_define,PCI_EP_SUPPORT))
27$(eval $(call assert_boolean,PCI_EP_SUPPORT))
28
Grzegorz Jaszczyk2ed16f52018-06-29 18:00:33 +020029AP_NUM := 1
30$(eval $(call add_define,AP_NUM))
31
Konstantin Porotchkin6ff50d52018-10-07 17:54:20 +030032DOIMAGEPATH ?= tools/marvell/doimage
Konstantin Porotchkinf69ec582018-06-07 18:31:14 +030033DOIMAGETOOL ?= ${DOIMAGEPATH}/doimage
34
Pali Rohár85e0a892020-10-19 17:10:11 +020035include plat/marvell/marvell.mk
Pali Rohár6dca2c62020-10-21 11:50:40 +020036include tools/marvell/doimage/doimage.mk
37
38ifeq (${MARVELL_SECURE_BOOT},1)
39DOIMAGE_SEC_FLAGS := -c $(DOIMAGE_SEC)
40DOIMAGE_LIBS_CHECK = \
41 if ! [ -d "/usr/include/mbedtls" ]; then \
42 echo "****************************************" >&2; \
43 echo "Missing mbedTLS installation! " >&2; \
44 echo "Please download it from \"tls.mbed.org\"" >&2; \
45 echo "Alternatively on Debian/Ubuntu system install" >&2; \
46 echo "\"libmbedtls-dev\" package" >&2; \
47 echo "Make sure to use version 2.1.0 or later" >&2; \
48 echo "****************************************" >&2; \
49 exit 1; \
50 else if ! [ -f "/usr/include/libconfig.h" ]; then \
51 echo "********************************************************" >&2; \
52 echo "Missing Libconfig installation!" >&2; \
53 echo "Please download it from \"www.hyperrealm.com/libconfig/\"" >&2; \
54 echo "Alternatively on Debian/Ubuntu system install packages" >&2; \
55 echo "\"libconfig8\" and \"libconfig8-dev\"" >&2; \
56 echo "********************************************************" >&2; \
57 exit 1; \
58 fi \
59 fi
60else #MARVELL_SECURE_BOOT
61DOIMAGE_LIBS_CHECK =
62DOIMAGE_SEC_FLAGS =
63endif #MARVELL_SECURE_BOOT
Pali Rohár85e0a892020-10-19 17:10:11 +020064
Konstantin Porotchkinf69ec582018-06-07 18:31:14 +030065ROM_BIN_EXT ?= $(BUILD_PLAT)/ble.bin
66DOIMAGE_FLAGS += -b $(ROM_BIN_EXT) $(NAND_DOIMAGE_FLAGS) $(DOIMAGE_SEC_FLAGS)
67
Luka Kovacic49358fb2020-01-13 20:37:35 +010068# Check whether to build system_power.c for the platform
Luka Kovacic7a75c062020-07-03 17:02:54 +020069ifneq ("$(wildcard $(BOARD_DIR)/board/system_power.c)","")
Luka Kovacic49358fb2020-01-13 20:37:35 +010070SYSTEM_POWER_SUPPORT = 1
71else
72SYSTEM_POWER_SUPPORT = 0
73endif
74
Konstantin Porotchkinf69ec582018-06-07 18:31:14 +030075# This define specifies DDR type for BLE
76$(eval $(call add_define,CONFIG_DDR4))
77
78MARVELL_GIC_SOURCES := drivers/arm/gic/common/gic_common.c \
79 drivers/arm/gic/v2/gicv2_main.c \
80 drivers/arm/gic/v2/gicv2_helpers.c \
81 plat/common/plat_gicv2.c
82
Grzegorz Jaszczyk2d3d86a2018-12-09 23:11:20 +010083PLAT_INCLUDES := -I$(BOARD_DIR) \
Grzegorz Jaszczykd3d6a1c2019-03-28 16:09:38 +010084 -I$(BOARD_DIR)/board \
Pali Rohár7eede302021-07-10 17:05:53 +020085 -I$(CURDIR)/drivers/marvell \
Konstantin Porotchkinf69ec582018-06-07 18:31:14 +030086 -I$(PLAT_COMMON_BASE)/include \
Antonio Nino Diaz50a4d1a2019-02-01 12:22:22 +000087 -I$(PLAT_INCLUDE_BASE)/common
Konstantin Porotchkinf69ec582018-06-07 18:31:14 +030088
89PLAT_BL_COMMON_SOURCES := $(PLAT_COMMON_BASE)/aarch64/a8k_common.c \
Konstantin Porotchkinf69ec582018-06-07 18:31:14 +030090 drivers/ti/uart/aarch64/16550_console.S
91
Grzegorz Jaszczyk2d3d86a2018-12-09 23:11:20 +010092BLE_PORTING_SOURCES := $(BOARD_DIR)/board/dram_port.c \
93 $(BOARD_DIR)/board/marvell_plat_config.c
Konstantin Porotchkinf69ec582018-06-07 18:31:14 +030094
95MARVELL_MOCHI_DRV += $(MARVELL_DRV_BASE)/mochi/cp110_setup.c
96
Christine Gharzuzi9a772df2018-06-25 13:39:37 +030097BLE_SOURCES := drivers/mentor/i2c/mi2cv.c \
98 $(PLAT_COMMON_BASE)/plat_ble_setup.c \
99 $(MARVELL_MOCHI_DRV) \
100 $(PLAT_COMMON_BASE)/plat_pm.c \
101 $(MARVELL_DRV_BASE)/ap807_clocks_init.c \
102 $(MARVELL_DRV_BASE)/thermal.c \
103 $(PLAT_COMMON_BASE)/plat_thermal.c \
104 $(BLE_PORTING_SOURCES) \
105 $(MARVELL_DRV_BASE)/ccu.c \
Konstantin Porotchkinf69ec582018-06-07 18:31:14 +0300106 $(MARVELL_DRV_BASE)/io_win.c
107
108BL1_SOURCES += $(PLAT_COMMON_BASE)/aarch64/plat_helpers.S \
109 lib/cpus/aarch64/cortex_a72.S
110
111MARVELL_DRV := $(MARVELL_DRV_BASE)/io_win.c \
112 $(MARVELL_DRV_BASE)/iob.c \
113 $(MARVELL_DRV_BASE)/mci.c \
114 $(MARVELL_DRV_BASE)/amb_adec.c \
115 $(MARVELL_DRV_BASE)/ccu.c \
116 $(MARVELL_DRV_BASE)/cache_llc.c \
Grzegorz Jaszczyka3173d62019-12-18 15:58:27 +0100117 $(MARVELL_DRV_BASE)/comphy/phy-comphy-cp110.c \
118 $(MARVELL_DRV_BASE)/mc_trustzone/mc_trustzone.c \
Alex Leibovich6a99b192019-12-25 09:22:48 +0200119 $(MARVELL_DRV_BASE)/secure_dfx_access/armada_thermal.c \
Grzegorz Jaszczyk7d509722020-01-03 09:35:21 +0100120 $(MARVELL_DRV_BASE)/secure_dfx_access/misc_dfx.c \
Alex Leibovich6a99b192019-12-25 09:22:48 +0200121 $(MARVELL_DRV_BASE)/ddr_phy_access.c \
Konstantin Porotchkin7b9e4d42020-07-26 17:49:54 +0300122 drivers/rambus/trng_ip_76.c
Konstantin Porotchkinf69ec582018-06-07 18:31:14 +0300123
Konstantin Porotchkin23099612020-10-12 18:13:07 +0300124ifeq (${MSS_SUPPORT}, 1)
125MARVELL_DRV += $(MARVELL_DRV_BASE)/mg_conf_cm3/mg_conf_cm3.c
126endif
127
Grzegorz Jaszczyk2d3d86a2018-12-09 23:11:20 +0100128BL31_PORTING_SOURCES := $(BOARD_DIR)/board/marvell_plat_config.c
Konstantin Porotchkinf69ec582018-06-07 18:31:14 +0300129
Luka Kovacic49358fb2020-01-13 20:37:35 +0100130ifeq ($(SYSTEM_POWER_SUPPORT),1)
Luka Kovacic7a75c062020-07-03 17:02:54 +0200131BL31_PORTING_SOURCES += $(BOARD_DIR)/board/system_power.c
Luka Kovacic49358fb2020-01-13 20:37:35 +0100132endif
133
Konstantin Porotchkinf69ec582018-06-07 18:31:14 +0300134BL31_SOURCES += lib/cpus/aarch64/cortex_a72.S \
135 $(PLAT_COMMON_BASE)/aarch64/plat_helpers.S \
136 $(PLAT_COMMON_BASE)/aarch64/plat_arch_config.c \
137 $(PLAT_COMMON_BASE)/plat_pm.c \
138 $(PLAT_COMMON_BASE)/plat_bl31_setup.c \
139 $(MARVELL_COMMON_BASE)/marvell_gicv2.c \
140 $(MARVELL_COMMON_BASE)/mrvl_sip_svc.c \
141 $(MARVELL_COMMON_BASE)/marvell_ddr_info.c \
142 $(BL31_PORTING_SOURCES) \
143 $(MARVELL_DRV) \
144 $(MARVELL_MOCHI_DRV) \
145 $(MARVELL_GIC_SOURCES)
146
147# Add trace functionality for PM
148BL31_SOURCES += $(PLAT_COMMON_BASE)/plat_pm_trace.c
149
Konstantin Porotchkin23099612020-10-12 18:13:07 +0300150
151ifeq (${MSS_SUPPORT}, 1)
Konstantin Porotchkinf69ec582018-06-07 18:31:14 +0300152# Force builds with BL2 image on a80x0 platforms
153ifndef SCP_BL2
154 $(error "Error: SCP_BL2 image is mandatory for a8k family")
155endif
156
157# MSS (SCP) build
158include $(PLAT_COMMON_BASE)/mss/mss_a8k.mk
Konstantin Porotchkin23099612020-10-12 18:13:07 +0300159endif
Konstantin Porotchkinf69ec582018-06-07 18:31:14 +0300160
161# BLE (ROM context execution code, AKA binary extension)
Konstantin Porotchkin01851db2018-10-03 14:21:42 +0300162BLE_PATH ?= $(PLAT_COMMON_BASE)/ble
Konstantin Porotchkinf69ec582018-06-07 18:31:14 +0300163
164include ${BLE_PATH}/ble.mk
165$(eval $(call MAKE_BL,e))
166
Pali Rohár06a38e22020-11-23 19:45:28 +0100167clean realclean distclean: mrvl_clean
168
169.PHONY: mrvl_clean
Pali Rohár6dca2c62020-10-21 11:50:40 +0200170mrvl_clean:
171 @echo " Doimage CLEAN"
172 ${Q}${MAKE} PLAT=${PLAT} --no-print-directory -C ${DOIMAGEPATH} clean
173
Pali Rohár06a38e22020-11-23 19:45:28 +0100174${DOIMAGETOOL}: FORCE
Pali Rohár6dca2c62020-10-21 11:50:40 +0200175 @$(DOIMAGE_LIBS_CHECK)
176 ${Q}${MAKE} --no-print-directory -C ${DOIMAGEPATH}
177
Pali Rohár4bce4d52021-01-26 10:44:07 +0100178${BUILD_PLAT}/${FLASH_IMAGE}: ${ROM_BIN_EXT} ${BUILD_PLAT}/${BOOT_IMAGE} ${DOIMAGETOOL}
Pali Rohár7cf48c82021-01-26 10:44:07 +0100179 @${ECHO_BLANK_LINE}
180 @echo "Building flash image"
181 ${Q}${DOIMAGETOOL} ${DOIMAGE_FLAGS} ${BUILD_PLAT}/${BOOT_IMAGE} ${BUILD_PLAT}/${FLASH_IMAGE}
182 @${ECHO_BLANK_LINE}
183 @echo "Built $@ successfully"
184 @${ECHO_BLANK_LINE}