Konstantin Porotchkin | f69ec58 | 2018-06-07 18:31:14 +0300 | [diff] [blame] | 1 | # |
Marcin Wojtas | a86fe0c | 2020-06-02 15:12:06 +0200 | [diff] [blame] | 2 | # Copyright (C) 2016 - 2020 Marvell International Ltd. |
Konstantin Porotchkin | f69ec58 | 2018-06-07 18:31:14 +0300 | [diff] [blame] | 3 | # |
| 4 | # SPDX-License-Identifier: BSD-3-Clause |
| 5 | # https://spdx.org/licenses |
| 6 | |
Konstantin Porotchkin | f69ec58 | 2018-06-07 18:31:14 +0300 | [diff] [blame] | 7 | PLAT_FAMILY := a8k |
Grzegorz Jaszczyk | 3039bce | 2019-11-05 13:14:59 +0100 | [diff] [blame] | 8 | PLAT_INCLUDE_BASE := include/plat/marvell/armada/$(PLAT_FAMILY) |
Grzegorz Jaszczyk | 2d3d86a | 2018-12-09 23:11:20 +0100 | [diff] [blame] | 9 | PLAT_COMMON_BASE := plat/marvell/armada/a8k/common |
Konstantin Porotchkin | f69ec58 | 2018-06-07 18:31:14 +0300 | [diff] [blame] | 10 | MARVELL_DRV_BASE := drivers/marvell |
Grzegorz Jaszczyk | 3039bce | 2019-11-05 13:14:59 +0100 | [diff] [blame] | 11 | MARVELL_COMMON_BASE := plat/marvell/armada/common |
Konstantin Porotchkin | f69ec58 | 2018-06-07 18:31:14 +0300 | [diff] [blame] | 12 | |
Konstantin Porotchkin | 2309961 | 2020-10-12 18:13:07 +0300 | [diff] [blame] | 13 | MARVELL_SVC_TEST := 0 |
Konstantin Porotchkin | f51f251 | 2018-11-06 12:25:38 +0200 | [diff] [blame] | 14 | $(eval $(call add_define,MARVELL_SVC_TEST)) |
| 15 | |
Konstantin Porotchkin | f69ec58 | 2018-06-07 18:31:14 +0300 | [diff] [blame] | 16 | ERRATA_A72_859971 := 1 |
| 17 | |
| 18 | # Enable MSS support for a8k family |
| 19 | MSS_SUPPORT := 1 |
Konstantin Porotchkin | 2309961 | 2020-10-12 18:13:07 +0300 | [diff] [blame] | 20 | $(eval $(call add_define,MSS_SUPPORT)) |
Konstantin Porotchkin | f69ec58 | 2018-06-07 18:31:14 +0300 | [diff] [blame] | 21 | |
| 22 | # Disable EL3 cache for power management |
Marcin Wojtas | a86fe0c | 2020-06-02 15:12:06 +0200 | [diff] [blame] | 23 | BL31_CACHE_DISABLE := 0 |
Konstantin Porotchkin | f69ec58 | 2018-06-07 18:31:14 +0300 | [diff] [blame] | 24 | $(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 Jaszczyk | 2ed16f5 | 2018-06-29 18:00:33 +0200 | [diff] [blame] | 29 | AP_NUM := 1 |
| 30 | $(eval $(call add_define,AP_NUM)) |
| 31 | |
Konstantin Porotchkin | 6ff50d5 | 2018-10-07 17:54:20 +0300 | [diff] [blame] | 32 | DOIMAGEPATH ?= tools/marvell/doimage |
Konstantin Porotchkin | f69ec58 | 2018-06-07 18:31:14 +0300 | [diff] [blame] | 33 | DOIMAGETOOL ?= ${DOIMAGEPATH}/doimage |
| 34 | |
Pali Rohár | 85e0a89 | 2020-10-19 17:10:11 +0200 | [diff] [blame] | 35 | include plat/marvell/marvell.mk |
Pali Rohár | 6dca2c6 | 2020-10-21 11:50:40 +0200 | [diff] [blame] | 36 | include tools/marvell/doimage/doimage.mk |
| 37 | |
| 38 | ifeq (${MARVELL_SECURE_BOOT},1) |
| 39 | DOIMAGE_SEC_FLAGS := -c $(DOIMAGE_SEC) |
| 40 | DOIMAGE_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 |
| 60 | else #MARVELL_SECURE_BOOT |
| 61 | DOIMAGE_LIBS_CHECK = |
| 62 | DOIMAGE_SEC_FLAGS = |
| 63 | endif #MARVELL_SECURE_BOOT |
Pali Rohár | 85e0a89 | 2020-10-19 17:10:11 +0200 | [diff] [blame] | 64 | |
Konstantin Porotchkin | f69ec58 | 2018-06-07 18:31:14 +0300 | [diff] [blame] | 65 | ROM_BIN_EXT ?= $(BUILD_PLAT)/ble.bin |
| 66 | DOIMAGE_FLAGS += -b $(ROM_BIN_EXT) $(NAND_DOIMAGE_FLAGS) $(DOIMAGE_SEC_FLAGS) |
| 67 | |
Luka Kovacic | 49358fb | 2020-01-13 20:37:35 +0100 | [diff] [blame] | 68 | # Check whether to build system_power.c for the platform |
Luka Kovacic | 7a75c06 | 2020-07-03 17:02:54 +0200 | [diff] [blame] | 69 | ifneq ("$(wildcard $(BOARD_DIR)/board/system_power.c)","") |
Luka Kovacic | 49358fb | 2020-01-13 20:37:35 +0100 | [diff] [blame] | 70 | SYSTEM_POWER_SUPPORT = 1 |
| 71 | else |
| 72 | SYSTEM_POWER_SUPPORT = 0 |
| 73 | endif |
| 74 | |
Konstantin Porotchkin | f69ec58 | 2018-06-07 18:31:14 +0300 | [diff] [blame] | 75 | # This define specifies DDR type for BLE |
| 76 | $(eval $(call add_define,CONFIG_DDR4)) |
| 77 | |
Robert Marko | 9c523ec | 2021-10-11 16:25:49 +0200 | [diff] [blame] | 78 | # This define specifies DDR topology for BLE |
| 79 | DDR_TOPOLOGY ?= 0 |
| 80 | $(eval $(call add_define,DDR_TOPOLOGY)) |
| 81 | |
Konstantin Porotchkin | f69ec58 | 2018-06-07 18:31:14 +0300 | [diff] [blame] | 82 | MARVELL_GIC_SOURCES := drivers/arm/gic/common/gic_common.c \ |
| 83 | drivers/arm/gic/v2/gicv2_main.c \ |
| 84 | drivers/arm/gic/v2/gicv2_helpers.c \ |
| 85 | plat/common/plat_gicv2.c |
| 86 | |
Marcin Wojtas | d23e87b | 2021-08-24 04:19:07 +0200 | [diff] [blame] | 87 | PLAT_INCLUDES += -I$(BOARD_DIR) \ |
Grzegorz Jaszczyk | d3d6a1c | 2019-03-28 16:09:38 +0100 | [diff] [blame] | 88 | -I$(BOARD_DIR)/board \ |
Pali Rohár | 7eede30 | 2021-07-10 17:05:53 +0200 | [diff] [blame] | 89 | -I$(CURDIR)/drivers/marvell \ |
Konstantin Porotchkin | f69ec58 | 2018-06-07 18:31:14 +0300 | [diff] [blame] | 90 | -I$(PLAT_COMMON_BASE)/include \ |
Antonio Nino Diaz | 50a4d1a | 2019-02-01 12:22:22 +0000 | [diff] [blame] | 91 | -I$(PLAT_INCLUDE_BASE)/common |
Konstantin Porotchkin | f69ec58 | 2018-06-07 18:31:14 +0300 | [diff] [blame] | 92 | |
| 93 | PLAT_BL_COMMON_SOURCES := $(PLAT_COMMON_BASE)/aarch64/a8k_common.c \ |
Konstantin Porotchkin | f69ec58 | 2018-06-07 18:31:14 +0300 | [diff] [blame] | 94 | drivers/ti/uart/aarch64/16550_console.S |
| 95 | |
Marcin Wojtas | d23e87b | 2021-08-24 04:19:07 +0200 | [diff] [blame] | 96 | ifndef BLE_PORTING_SOURCES |
Grzegorz Jaszczyk | 2d3d86a | 2018-12-09 23:11:20 +0100 | [diff] [blame] | 97 | BLE_PORTING_SOURCES := $(BOARD_DIR)/board/dram_port.c \ |
| 98 | $(BOARD_DIR)/board/marvell_plat_config.c |
Marcin Wojtas | d23e87b | 2021-08-24 04:19:07 +0200 | [diff] [blame] | 99 | endif |
Konstantin Porotchkin | f69ec58 | 2018-06-07 18:31:14 +0300 | [diff] [blame] | 100 | |
| 101 | MARVELL_MOCHI_DRV += $(MARVELL_DRV_BASE)/mochi/cp110_setup.c |
| 102 | |
Christine Gharzuzi | 9a772df | 2018-06-25 13:39:37 +0300 | [diff] [blame] | 103 | BLE_SOURCES := drivers/mentor/i2c/mi2cv.c \ |
| 104 | $(PLAT_COMMON_BASE)/plat_ble_setup.c \ |
| 105 | $(MARVELL_MOCHI_DRV) \ |
| 106 | $(PLAT_COMMON_BASE)/plat_pm.c \ |
| 107 | $(MARVELL_DRV_BASE)/ap807_clocks_init.c \ |
| 108 | $(MARVELL_DRV_BASE)/thermal.c \ |
| 109 | $(PLAT_COMMON_BASE)/plat_thermal.c \ |
| 110 | $(BLE_PORTING_SOURCES) \ |
| 111 | $(MARVELL_DRV_BASE)/ccu.c \ |
Konstantin Porotchkin | f69ec58 | 2018-06-07 18:31:14 +0300 | [diff] [blame] | 112 | $(MARVELL_DRV_BASE)/io_win.c |
| 113 | |
| 114 | BL1_SOURCES += $(PLAT_COMMON_BASE)/aarch64/plat_helpers.S \ |
| 115 | lib/cpus/aarch64/cortex_a72.S |
| 116 | |
| 117 | MARVELL_DRV := $(MARVELL_DRV_BASE)/io_win.c \ |
| 118 | $(MARVELL_DRV_BASE)/iob.c \ |
| 119 | $(MARVELL_DRV_BASE)/mci.c \ |
| 120 | $(MARVELL_DRV_BASE)/amb_adec.c \ |
| 121 | $(MARVELL_DRV_BASE)/ccu.c \ |
| 122 | $(MARVELL_DRV_BASE)/cache_llc.c \ |
Grzegorz Jaszczyk | a3173d6 | 2019-12-18 15:58:27 +0100 | [diff] [blame] | 123 | $(MARVELL_DRV_BASE)/comphy/phy-comphy-cp110.c \ |
| 124 | $(MARVELL_DRV_BASE)/mc_trustzone/mc_trustzone.c \ |
Alex Leibovich | 6a99b19 | 2019-12-25 09:22:48 +0200 | [diff] [blame] | 125 | $(MARVELL_DRV_BASE)/secure_dfx_access/armada_thermal.c \ |
Grzegorz Jaszczyk | 7d50972 | 2020-01-03 09:35:21 +0100 | [diff] [blame] | 126 | $(MARVELL_DRV_BASE)/secure_dfx_access/misc_dfx.c \ |
Alex Leibovich | 6a99b19 | 2019-12-25 09:22:48 +0200 | [diff] [blame] | 127 | $(MARVELL_DRV_BASE)/ddr_phy_access.c \ |
Konstantin Porotchkin | 7b9e4d4 | 2020-07-26 17:49:54 +0300 | [diff] [blame] | 128 | drivers/rambus/trng_ip_76.c |
Konstantin Porotchkin | f69ec58 | 2018-06-07 18:31:14 +0300 | [diff] [blame] | 129 | |
Konstantin Porotchkin | 2309961 | 2020-10-12 18:13:07 +0300 | [diff] [blame] | 130 | ifeq (${MSS_SUPPORT}, 1) |
| 131 | MARVELL_DRV += $(MARVELL_DRV_BASE)/mg_conf_cm3/mg_conf_cm3.c |
| 132 | endif |
| 133 | |
Marcin Wojtas | d23e87b | 2021-08-24 04:19:07 +0200 | [diff] [blame] | 134 | ifndef BL31_PORTING_SOURCES |
Grzegorz Jaszczyk | 2d3d86a | 2018-12-09 23:11:20 +0100 | [diff] [blame] | 135 | BL31_PORTING_SOURCES := $(BOARD_DIR)/board/marvell_plat_config.c |
Marcin Wojtas | d23e87b | 2021-08-24 04:19:07 +0200 | [diff] [blame] | 136 | endif |
Konstantin Porotchkin | f69ec58 | 2018-06-07 18:31:14 +0300 | [diff] [blame] | 137 | |
Luka Kovacic | 49358fb | 2020-01-13 20:37:35 +0100 | [diff] [blame] | 138 | ifeq ($(SYSTEM_POWER_SUPPORT),1) |
Luka Kovacic | 7a75c06 | 2020-07-03 17:02:54 +0200 | [diff] [blame] | 139 | BL31_PORTING_SOURCES += $(BOARD_DIR)/board/system_power.c |
Luka Kovacic | 49358fb | 2020-01-13 20:37:35 +0100 | [diff] [blame] | 140 | endif |
| 141 | |
Konstantin Porotchkin | f69ec58 | 2018-06-07 18:31:14 +0300 | [diff] [blame] | 142 | BL31_SOURCES += lib/cpus/aarch64/cortex_a72.S \ |
| 143 | $(PLAT_COMMON_BASE)/aarch64/plat_helpers.S \ |
| 144 | $(PLAT_COMMON_BASE)/aarch64/plat_arch_config.c \ |
| 145 | $(PLAT_COMMON_BASE)/plat_pm.c \ |
| 146 | $(PLAT_COMMON_BASE)/plat_bl31_setup.c \ |
| 147 | $(MARVELL_COMMON_BASE)/marvell_gicv2.c \ |
| 148 | $(MARVELL_COMMON_BASE)/mrvl_sip_svc.c \ |
| 149 | $(MARVELL_COMMON_BASE)/marvell_ddr_info.c \ |
| 150 | $(BL31_PORTING_SOURCES) \ |
| 151 | $(MARVELL_DRV) \ |
| 152 | $(MARVELL_MOCHI_DRV) \ |
| 153 | $(MARVELL_GIC_SOURCES) |
| 154 | |
| 155 | # Add trace functionality for PM |
| 156 | BL31_SOURCES += $(PLAT_COMMON_BASE)/plat_pm_trace.c |
| 157 | |
Konstantin Porotchkin | 2309961 | 2020-10-12 18:13:07 +0300 | [diff] [blame] | 158 | |
| 159 | ifeq (${MSS_SUPPORT}, 1) |
Konstantin Porotchkin | f69ec58 | 2018-06-07 18:31:14 +0300 | [diff] [blame] | 160 | # Force builds with BL2 image on a80x0 platforms |
| 161 | ifndef SCP_BL2 |
| 162 | $(error "Error: SCP_BL2 image is mandatory for a8k family") |
| 163 | endif |
| 164 | |
| 165 | # MSS (SCP) build |
| 166 | include $(PLAT_COMMON_BASE)/mss/mss_a8k.mk |
Konstantin Porotchkin | 2309961 | 2020-10-12 18:13:07 +0300 | [diff] [blame] | 167 | endif |
Konstantin Porotchkin | f69ec58 | 2018-06-07 18:31:14 +0300 | [diff] [blame] | 168 | |
| 169 | # BLE (ROM context execution code, AKA binary extension) |
Konstantin Porotchkin | 01851db | 2018-10-03 14:21:42 +0300 | [diff] [blame] | 170 | BLE_PATH ?= $(PLAT_COMMON_BASE)/ble |
Konstantin Porotchkin | f69ec58 | 2018-06-07 18:31:14 +0300 | [diff] [blame] | 171 | |
| 172 | include ${BLE_PATH}/ble.mk |
Zelalem Aweke | b44dec1 | 2021-07-11 17:25:48 -0500 | [diff] [blame] | 173 | $(eval $(call MAKE_BL,ble)) |
Konstantin Porotchkin | f69ec58 | 2018-06-07 18:31:14 +0300 | [diff] [blame] | 174 | |
Pali Rohár | 06a38e2 | 2020-11-23 19:45:28 +0100 | [diff] [blame] | 175 | clean realclean distclean: mrvl_clean |
| 176 | |
| 177 | .PHONY: mrvl_clean |
Pali Rohár | 6dca2c6 | 2020-10-21 11:50:40 +0200 | [diff] [blame] | 178 | mrvl_clean: |
| 179 | @echo " Doimage CLEAN" |
| 180 | ${Q}${MAKE} PLAT=${PLAT} --no-print-directory -C ${DOIMAGEPATH} clean |
| 181 | |
Pali Rohár | 06a38e2 | 2020-11-23 19:45:28 +0100 | [diff] [blame] | 182 | ${DOIMAGETOOL}: FORCE |
Pali Rohár | 6dca2c6 | 2020-10-21 11:50:40 +0200 | [diff] [blame] | 183 | @$(DOIMAGE_LIBS_CHECK) |
| 184 | ${Q}${MAKE} --no-print-directory -C ${DOIMAGEPATH} |
| 185 | |
Pali Rohár | 4bce4d5 | 2021-01-26 10:44:07 +0100 | [diff] [blame] | 186 | ${BUILD_PLAT}/${FLASH_IMAGE}: ${ROM_BIN_EXT} ${BUILD_PLAT}/${BOOT_IMAGE} ${DOIMAGETOOL} |
Pali Rohár | 7cf48c8 | 2021-01-26 10:44:07 +0100 | [diff] [blame] | 187 | @${ECHO_BLANK_LINE} |
| 188 | @echo "Building flash image" |
| 189 | ${Q}${DOIMAGETOOL} ${DOIMAGE_FLAGS} ${BUILD_PLAT}/${BOOT_IMAGE} ${BUILD_PLAT}/${FLASH_IMAGE} |
| 190 | @${ECHO_BLANK_LINE} |
| 191 | @echo "Built $@ successfully" |
| 192 | @${ECHO_BLANK_LINE} |