From c5e1b061ced441c85bd286769d963a1fca05c4da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pali=20Roh=C3=A1r?= Date: Thu, 15 Oct 2020 13:50:28 +0200 Subject: [PATCH 1/3] plat: marvell: armada: a3k: When WTP is empty do not define variables and targets which depends on it MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Some of targets (e.g. mrvl_flash) depends on WTP build option. Other targets (e.g. fip) can be build also without WTP build option as they do not depend on it. This change put all A3720 variables and targets which depends on WTP into conditional if-endif section, so they are not defined when user has not supplied WTP build option. Target mrvl_flash is defined also when WTP was not specified and in this case it just print error message to help user. Variables which do not depend on WTP are moved to the top of a3700_common.mk file. Signed-off-by: Pali Rohár Change-Id: Idb3892233586a0afca3e0e6564279641d2e4b960 --- .../marvell/armada/a3k/common/a3700_common.mk | 100 ++++++++++-------- 1 file changed, 55 insertions(+), 45 deletions(-) diff --git a/plat/marvell/armada/a3k/common/a3700_common.mk b/plat/marvell/armada/a3k/common/a3700_common.mk index ace74a8b1..a135d5fd2 100644 --- a/plat/marvell/armada/a3k/common/a3700_common.mk +++ b/plat/marvell/armada/a3k/common/a3700_common.mk @@ -18,6 +18,54 @@ HANDLE_EA_EL3_FIRST := 1 include plat/marvell/marvell.mk #*********** A3700 ************* + +# GICV3 +$(eval $(call add_define,CONFIG_GICV3)) + +# CCI-400 +$(eval $(call add_define,USE_CCI)) + +# Include GICv3 driver files +include drivers/arm/gic/v3/gicv3.mk + +MARVELL_GIC_SOURCES := ${GICV3_SOURCES} \ + plat/common/plat_gicv3.c + +PLAT_INCLUDES := -I$(PLAT_FAMILY_BASE)/$(PLAT) \ + -I$(PLAT_COMMON_BASE)/include \ + -I$(PLAT_INCLUDE_BASE)/common \ + -I$(MARVELL_DRV_BASE) \ + -I$/drivers/arm/gic/common/ + +PLAT_BL_COMMON_SOURCES := $(PLAT_COMMON_BASE)/aarch64/a3700_common.c \ + $(MARVELL_COMMON_BASE)/marvell_cci.c \ + $(MARVELL_DRV_BASE)/uart/a3700_console.S + +BL1_SOURCES += $(PLAT_COMMON_BASE)/aarch64/plat_helpers.S \ + lib/cpus/aarch64/cortex_a53.S + +BL31_PORTING_SOURCES := $(PLAT_FAMILY_BASE)/$(PLAT)/board/pm_src.c + +MARVELL_DRV := $(MARVELL_DRV_BASE)/comphy/phy-comphy-3700.c + +BL31_SOURCES += lib/cpus/aarch64/cortex_a53.S \ + $(PLAT_COMMON_BASE)/aarch64/plat_helpers.S \ + $(PLAT_COMMON_BASE)/plat_pm.c \ + $(PLAT_COMMON_BASE)/dram_win.c \ + $(PLAT_COMMON_BASE)/io_addr_dec.c \ + $(PLAT_COMMON_BASE)/marvell_plat_config.c \ + $(PLAT_COMMON_BASE)/a3700_ea.c \ + $(PLAT_FAMILY_BASE)/$(PLAT)/plat_bl31_setup.c \ + $(MARVELL_COMMON_BASE)/marvell_ddr_info.c \ + $(MARVELL_COMMON_BASE)/marvell_gicv3.c \ + $(MARVELL_GIC_SOURCES) \ + drivers/arm/cci/cci.c \ + $(BL31_PORTING_SOURCES) \ + $(PLAT_COMMON_BASE)/a3700_sip_svc.c \ + $(MARVELL_DRV) + +ifneq (${WTP},) + DOIMAGEPATH := $(WTP) DOIMAGETOOL := $(DOIMAGEPATH)/wtptp/linux/tbb_linux @@ -72,51 +120,6 @@ TIMBLDUARTARGS := $(MARVELL_SECURE_BOOT) UART $(IMAGESPATH) $(DOIMAGEPATH) $(CL $(DDR_TOPOLOGY) 0 0 $(DOIMAGE_CFG) $(TIMNCFG) $(TIMNSIG) 0 DOIMAGE_FLAGS := -r $(DOIMAGE_CFG) -v -D -# GICV3 -$(eval $(call add_define,CONFIG_GICV3)) - -# CCI-400 -$(eval $(call add_define,USE_CCI)) - -# Include GICv3 driver files -include drivers/arm/gic/v3/gicv3.mk - -MARVELL_GIC_SOURCES := ${GICV3_SOURCES} \ - plat/common/plat_gicv3.c - -PLAT_INCLUDES := -I$(PLAT_FAMILY_BASE)/$(PLAT) \ - -I$(PLAT_COMMON_BASE)/include \ - -I$(PLAT_INCLUDE_BASE)/common \ - -I$(MARVELL_DRV_BASE) \ - -I$/drivers/arm/gic/common/ - -PLAT_BL_COMMON_SOURCES := $(PLAT_COMMON_BASE)/aarch64/a3700_common.c \ - $(MARVELL_COMMON_BASE)/marvell_cci.c \ - $(MARVELL_DRV_BASE)/uart/a3700_console.S - -BL1_SOURCES += $(PLAT_COMMON_BASE)/aarch64/plat_helpers.S \ - lib/cpus/aarch64/cortex_a53.S - -BL31_PORTING_SOURCES := $(PLAT_FAMILY_BASE)/$(PLAT)/board/pm_src.c - -MARVELL_DRV := $(MARVELL_DRV_BASE)/comphy/phy-comphy-3700.c - -BL31_SOURCES += lib/cpus/aarch64/cortex_a53.S \ - $(PLAT_COMMON_BASE)/aarch64/plat_helpers.S \ - $(PLAT_COMMON_BASE)/plat_pm.c \ - $(PLAT_COMMON_BASE)/dram_win.c \ - $(PLAT_COMMON_BASE)/io_addr_dec.c \ - $(PLAT_COMMON_BASE)/marvell_plat_config.c \ - $(PLAT_COMMON_BASE)/a3700_ea.c \ - $(PLAT_FAMILY_BASE)/$(PLAT)/plat_bl31_setup.c \ - $(MARVELL_COMMON_BASE)/marvell_ddr_info.c \ - $(MARVELL_COMMON_BASE)/marvell_gicv3.c \ - $(MARVELL_GIC_SOURCES) \ - drivers/arm/cci/cci.c \ - $(BL31_PORTING_SOURCES) \ - $(PLAT_COMMON_BASE)/a3700_sip_svc.c \ - $(MARVELL_DRV) - mrvl_flash: ${BUILD_PLAT}/${FIP_NAME} ${DOIMAGETOOL} $(shell truncate -s %128K ${BUILD_PLAT}/bl1.bin) $(shell cat ${BUILD_PLAT}/bl1.bin ${BUILD_PLAT}/${FIP_NAME} > ${BUILD_PLAT}/${BOOT_IMAGE}) @@ -168,3 +171,10 @@ endif @mv -t $(BUILD_PLAT) $(TIM_IMAGE) $(DOIMAGE_CFG) $(TIMN_IMAGE) $(TIMNCFG) $(WTMI_IMG) $(WTMI_SYSINIT_IMG) $(WTMI_MULTI_IMG) @if [ "$(MARVELL_SECURE_BOOT)" = "1" ]; then mv -t $(BUILD_PLAT) $(WTMI_ENC_IMG) OtpHash.txt; fi @find . -name "*.txt" | grep -E "CSK[[:alnum:]]_KeyHash.txt|Tim_msg.txt|TIMHash.txt" | xargs rm -f + +else # ${WTP} + +mrvl_flash: + $(error "Platform '${PLAT}' for target '$@' requires WTP. Please set WTP to point to the right directory") + +endif # ${WTP} From 0412b7323db50da35beaaa56158993be8f056910 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pali=20Roh=C3=A1r?= Date: Mon, 19 Oct 2020 17:10:11 +0200 Subject: [PATCH 2/3] plat: marvell: armada: Fix including plat/marvell/marvell.mk file MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Include file plat/marvell/marvell.mk for platform A3700 was included two times. Once from file plat/marvell/armada/a3k/common/a3700_common.mk and second time from common file plat/marvell/armada/common/marvell_common.mk. It caused following warning every time was make called: plat/marvell/marvell.mk:51: warning: overriding recipe for target 'mrvl_clean' plat/marvell/marvell.mk:51: warning: ignoring old recipe for target 'mrvl_clean' Change in this commit removes inclusion of plat/marvell/marvell.mk file in common file plat/marvell/armada/common/marvell_common.mk. As a80x0 platform needs this include file, add it also into a80x0 platform specific include file lat/marvell/armada/a8k/common/a8k_common.mk. Also moves inclusion of plat/marvell/marvell.mk file in a3700 platform file plat/marvell/armada/a3k/common/a3700_common.mk at correct place. Global plat/marvell/marvell.mk expects that variables DOIMAGEPATH and DOIMAGETOOL are already defined, but it defines MARVELL_SECURE_BOOT variable which is needed by plat/marvell/armada/a3k/common/a3700_common.mk. Signed-off-by: Pali Rohár Change-Id: I5cbbd7eb8a3376924419f9850516b2a4924be5aa --- plat/marvell/armada/a3k/common/a3700_common.mk | 4 ++-- plat/marvell/armada/a8k/common/a8k_common.mk | 2 ++ plat/marvell/armada/common/marvell_common.mk | 1 - 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/plat/marvell/armada/a3k/common/a3700_common.mk b/plat/marvell/armada/a3k/common/a3700_common.mk index a135d5fd2..8f65e92b3 100644 --- a/plat/marvell/armada/a3k/common/a3700_common.mk +++ b/plat/marvell/armada/a3k/common/a3700_common.mk @@ -15,8 +15,6 @@ MARVELL_DRV_BASE := drivers/marvell MARVELL_COMMON_BASE := $(MARVELL_PLAT_BASE)/common HANDLE_EA_EL3_FIRST := 1 -include plat/marvell/marvell.mk - #*********** A3700 ************* # GICV3 @@ -69,6 +67,8 @@ ifneq (${WTP},) DOIMAGEPATH := $(WTP) DOIMAGETOOL := $(DOIMAGEPATH)/wtptp/linux/tbb_linux +include plat/marvell/marvell.mk + ifeq ($(MARVELL_SECURE_BOOT),1) DOIMAGE_CFG := $(DOIMAGEPATH)/atf-tim.txt IMAGESPATH := $(DOIMAGEPATH)/tim/trusted diff --git a/plat/marvell/armada/a8k/common/a8k_common.mk b/plat/marvell/armada/a8k/common/a8k_common.mk index 02f1553b0..a807891e5 100644 --- a/plat/marvell/armada/a8k/common/a8k_common.mk +++ b/plat/marvell/armada/a8k/common/a8k_common.mk @@ -33,6 +33,8 @@ $(eval $(call add_define,AP_NUM)) DOIMAGEPATH ?= tools/marvell/doimage DOIMAGETOOL ?= ${DOIMAGEPATH}/doimage +include plat/marvell/marvell.mk + ROM_BIN_EXT ?= $(BUILD_PLAT)/ble.bin DOIMAGE_FLAGS += -b $(ROM_BIN_EXT) $(NAND_DOIMAGE_FLAGS) $(DOIMAGE_SEC_FLAGS) diff --git a/plat/marvell/armada/common/marvell_common.mk b/plat/marvell/armada/common/marvell_common.mk index 2e96e2f84..1cc6dba60 100644 --- a/plat/marvell/armada/common/marvell_common.mk +++ b/plat/marvell/armada/common/marvell_common.mk @@ -7,7 +7,6 @@ MARVELL_PLAT_BASE := plat/marvell/armada MARVELL_PLAT_INCLUDE_BASE := include/plat/marvell/armada include plat/marvell/version.mk -include plat/marvell/marvell.mk VERSION_STRING +=(Marvell-${SUBVERSION}) From b5e3d54017b3f48033960d392aa98ba053adfd97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pali=20Roh=C3=A1r?= Date: Wed, 21 Oct 2020 11:50:40 +0200 Subject: [PATCH 3/3] plat: marvell: armada: Building ${DOIMAGETOOL} is only for a8k MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Currently a3k target is misusing ${DOIMAGETOOL} target for building flash and UART images. It is not used for building image tool. So move ${DOIMAGETOOL} target from common marvell include file into a8k include file and add correct invocation of ${MAKE} into a3k for building flash and UART images. Part of this change is also checks that MV_DDR_PATH for a3k was specified by user as this option is required for building a3k flash and UART images. Signed-off-by: Pali Rohár Change-Id: I5ae9d08b8505460933f17836c9b6435fd6e51bb6 --- .../marvell/armada/a3k/common/a3700_common.mk | 2 + plat/marvell/armada/a8k/common/a8k_common.mk | 38 ++++++++++++++++++- plat/marvell/marvell.mk | 37 ------------------ 3 files changed, 38 insertions(+), 39 deletions(-) diff --git a/plat/marvell/armada/a3k/common/a3700_common.mk b/plat/marvell/armada/a3k/common/a3700_common.mk index 8f65e92b3..2050d59b6 100644 --- a/plat/marvell/armada/a3k/common/a3700_common.mk +++ b/plat/marvell/armada/a3k/common/a3700_common.mk @@ -124,6 +124,8 @@ mrvl_flash: ${BUILD_PLAT}/${FIP_NAME} ${DOIMAGETOOL} $(shell truncate -s %128K ${BUILD_PLAT}/bl1.bin) $(shell cat ${BUILD_PLAT}/bl1.bin ${BUILD_PLAT}/${FIP_NAME} > ${BUILD_PLAT}/${BOOT_IMAGE}) $(shell truncate -s %4 ${BUILD_PLAT}/${BOOT_IMAGE}) + $(if $(value MV_DDR_PATH),,$(error "Platform '${PLAT}' for target '$@' requires MV_DDR_PATH. Please set MV_DDR_PATH to point to the right directory")) + ${Q}${MAKE} --no-print-directory -C ${DOIMAGEPATH} WTMI_IMG=$(WTMI_IMG) MV_DDR_PATH=$(MV_DDR_PATH) $(shell truncate -s %4 $(WTMI_IMG)) @echo @echo "Building uart images" diff --git a/plat/marvell/armada/a8k/common/a8k_common.mk b/plat/marvell/armada/a8k/common/a8k_common.mk index a807891e5..c8273265e 100644 --- a/plat/marvell/armada/a8k/common/a8k_common.mk +++ b/plat/marvell/armada/a8k/common/a8k_common.mk @@ -4,8 +4,6 @@ # SPDX-License-Identifier: BSD-3-Clause # https://spdx.org/licenses -include tools/marvell/doimage/doimage.mk - PLAT_FAMILY := a8k PLAT_INCLUDE_BASE := include/plat/marvell/armada/$(PLAT_FAMILY) PLAT_COMMON_BASE := plat/marvell/armada/a8k/common @@ -34,6 +32,34 @@ DOIMAGEPATH ?= tools/marvell/doimage DOIMAGETOOL ?= ${DOIMAGEPATH}/doimage include plat/marvell/marvell.mk +include tools/marvell/doimage/doimage.mk + +ifeq (${MARVELL_SECURE_BOOT},1) +DOIMAGE_SEC_FLAGS := -c $(DOIMAGE_SEC) +DOIMAGE_LIBS_CHECK = \ + if ! [ -d "/usr/include/mbedtls" ]; then \ + echo "****************************************" >&2; \ + echo "Missing mbedTLS installation! " >&2; \ + echo "Please download it from \"tls.mbed.org\"" >&2; \ + echo "Alternatively on Debian/Ubuntu system install" >&2; \ + echo "\"libmbedtls-dev\" package" >&2; \ + echo "Make sure to use version 2.1.0 or later" >&2; \ + echo "****************************************" >&2; \ + exit 1; \ + else if ! [ -f "/usr/include/libconfig.h" ]; then \ + echo "********************************************************" >&2; \ + echo "Missing Libconfig installation!" >&2; \ + echo "Please download it from \"www.hyperrealm.com/libconfig/\"" >&2; \ + echo "Alternatively on Debian/Ubuntu system install packages" >&2; \ + echo "\"libconfig8\" and \"libconfig8-dev\"" >&2; \ + echo "********************************************************" >&2; \ + exit 1; \ + fi \ + fi +else #MARVELL_SECURE_BOOT +DOIMAGE_LIBS_CHECK = +DOIMAGE_SEC_FLAGS = +endif #MARVELL_SECURE_BOOT ROM_BIN_EXT ?= $(BUILD_PLAT)/ble.bin DOIMAGE_FLAGS += -b $(ROM_BIN_EXT) $(NAND_DOIMAGE_FLAGS) $(DOIMAGE_SEC_FLAGS) @@ -126,6 +152,14 @@ BLE_PATH ?= $(PLAT_COMMON_BASE)/ble include ${BLE_PATH}/ble.mk $(eval $(call MAKE_BL,e)) +mrvl_clean: + @echo " Doimage CLEAN" + ${Q}${MAKE} PLAT=${PLAT} --no-print-directory -C ${DOIMAGEPATH} clean + +${DOIMAGETOOL}: mrvl_clean + @$(DOIMAGE_LIBS_CHECK) + ${Q}${MAKE} --no-print-directory -C ${DOIMAGEPATH} + mrvl_flash: ${BUILD_PLAT}/${FIP_NAME} ${DOIMAGETOOL} ${BUILD_PLAT}/ble.bin $(shell truncate -s %128K ${BUILD_PLAT}/bl1.bin) $(shell cat ${BUILD_PLAT}/bl1.bin ${BUILD_PLAT}/${FIP_NAME} > ${BUILD_PLAT}/${BOOT_IMAGE}) diff --git a/plat/marvell/marvell.mk b/plat/marvell/marvell.mk index 82457536d..b6a2b9995 100644 --- a/plat/marvell/marvell.mk +++ b/plat/marvell/marvell.mk @@ -19,40 +19,3 @@ $(eval $(call add_define,PALLADIUM)) # Set board to work with DDR 32bit DDR32 := 0 $(eval $(call add_define,DDR32)) - -ifeq (${MARVELL_SECURE_BOOT},1) -DOIMAGE_SEC_FLAGS := -c $(DOIMAGE_SEC) -DOIMAGE_LIBS_CHECK = \ - if ! [ -d "/usr/include/mbedtls" ]; then \ - echo "****************************************" >&2; \ - echo "Missing mbedTLS installation! " >&2; \ - echo "Please download it from \"tls.mbed.org\"" >&2; \ - echo "Alternatively on Debian/Ubuntu system install" >&2; \ - echo "\"libmbedtls-dev\" package" >&2; \ - echo "Make sure to use version 2.1.0 or later" >&2; \ - echo "****************************************" >&2; \ - exit 1; \ - else if ! [ -f "/usr/include/libconfig.h" ]; then \ - echo "********************************************************" >&2; \ - echo "Missing Libconfig installation!" >&2; \ - echo "Please download it from \"www.hyperrealm.com/libconfig/\"" >&2; \ - echo "Alternatively on Debian/Ubuntu system install packages" >&2; \ - echo "\"libconfig8\" and \"libconfig8-dev\"" >&2; \ - echo "********************************************************" >&2; \ - exit 1; \ - fi \ - fi -else #MARVELL_SECURE_BOOT -DOIMAGE_LIBS_CHECK = -DOIMAGE_SEC_FLAGS = -endif #MARVELL_SECURE_BOOT - -mrvl_clean: - @echo " Doimage CLEAN" - ${Q}${MAKE} PLAT=${PLAT} --no-print-directory -C ${DOIMAGEPATH} clean - -${DOIMAGETOOL}: mrvl_clean - @$(DOIMAGE_LIBS_CHECK) - ${Q}${MAKE} --no-print-directory -C ${DOIMAGEPATH} VERSION=$(SUBVERSION) WTMI_IMG=$(WTMI_IMG) - -