a8k_common.mk 6.02 KB
Newer Older
1
#
2
# Copyright (C) 2016 - 2020 Marvell International Ltd.
3
4
5
6
7
#
# SPDX-License-Identifier:     BSD-3-Clause
# https://spdx.org/licenses

PLAT_FAMILY		:= a8k
8
PLAT_INCLUDE_BASE	:= include/plat/marvell/armada/$(PLAT_FAMILY)
9
PLAT_COMMON_BASE	:= plat/marvell/armada/a8k/common
10
MARVELL_DRV_BASE	:= drivers/marvell
11
MARVELL_COMMON_BASE	:= plat/marvell/armada/common
12

13
MARVELL_SVC_TEST	:= 0
14
15
$(eval $(call add_define,MARVELL_SVC_TEST))

16
17
18
19
ERRATA_A72_859971	:= 1

# Enable MSS support for a8k family
MSS_SUPPORT		:= 1
20
$(eval $(call add_define,MSS_SUPPORT))
21
22

# Disable EL3 cache for power management
23
BL31_CACHE_DISABLE	:= 0
24
25
26
27
28
$(eval $(call add_define,BL31_CACHE_DISABLE))

$(eval $(call add_define,PCI_EP_SUPPORT))
$(eval $(call assert_boolean,PCI_EP_SUPPORT))

29
30
31
AP_NUM			:= 1
$(eval $(call add_define,AP_NUM))

32
DOIMAGEPATH		?=	tools/marvell/doimage
33
34
DOIMAGETOOL		?=	${DOIMAGEPATH}/doimage

35
include plat/marvell/marvell.mk
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
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
64

65
66
67
ROM_BIN_EXT ?= $(BUILD_PLAT)/ble.bin
DOIMAGE_FLAGS	+= -b $(ROM_BIN_EXT) $(NAND_DOIMAGE_FLAGS) $(DOIMAGE_SEC_FLAGS)

68
# Check whether to build system_power.c for the platform
69
ifneq ("$(wildcard $(BOARD_DIR)/board/system_power.c)","")
70
71
72
73
74
SYSTEM_POWER_SUPPORT = 1
else
SYSTEM_POWER_SUPPORT = 0
endif

75
76
77
78
79
80
81
82
# This define specifies DDR type for BLE
$(eval $(call add_define,CONFIG_DDR4))

MARVELL_GIC_SOURCES	:=	drivers/arm/gic/common/gic_common.c	\
				drivers/arm/gic/v2/gicv2_main.c		\
				drivers/arm/gic/v2/gicv2_helpers.c	\
				plat/common/plat_gicv2.c

83
PLAT_INCLUDES		:=	-I$(BOARD_DIR)				\
84
				-I$(BOARD_DIR)/board			\
85
				-I$(CURDIR)/drivers/marvell		\
86
				-I$(PLAT_COMMON_BASE)/include		\
87
				-I$(PLAT_INCLUDE_BASE)/common
88
89
90
91

PLAT_BL_COMMON_SOURCES	:=	$(PLAT_COMMON_BASE)/aarch64/a8k_common.c \
				drivers/ti/uart/aarch64/16550_console.S

92
93
BLE_PORTING_SOURCES	:=	$(BOARD_DIR)/board/dram_port.c \
				$(BOARD_DIR)/board/marvell_plat_config.c
94
95
96

MARVELL_MOCHI_DRV	+=	$(MARVELL_DRV_BASE)/mochi/cp110_setup.c

97
98
99
100
101
102
103
104
105
BLE_SOURCES		:=	drivers/mentor/i2c/mi2cv.c		\
				$(PLAT_COMMON_BASE)/plat_ble_setup.c	\
				$(MARVELL_MOCHI_DRV)			\
				$(PLAT_COMMON_BASE)/plat_pm.c		\
				$(MARVELL_DRV_BASE)/ap807_clocks_init.c	\
				$(MARVELL_DRV_BASE)/thermal.c		\
				$(PLAT_COMMON_BASE)/plat_thermal.c	\
				$(BLE_PORTING_SOURCES)			\
				$(MARVELL_DRV_BASE)/ccu.c		\
106
107
108
109
110
111
112
113
114
115
116
				$(MARVELL_DRV_BASE)/io_win.c

BL1_SOURCES		+=	$(PLAT_COMMON_BASE)/aarch64/plat_helpers.S \
				lib/cpus/aarch64/cortex_a72.S

MARVELL_DRV		:= 	$(MARVELL_DRV_BASE)/io_win.c	\
				$(MARVELL_DRV_BASE)/iob.c	\
				$(MARVELL_DRV_BASE)/mci.c	\
				$(MARVELL_DRV_BASE)/amb_adec.c	\
				$(MARVELL_DRV_BASE)/ccu.c	\
				$(MARVELL_DRV_BASE)/cache_llc.c	\
117
118
				$(MARVELL_DRV_BASE)/comphy/phy-comphy-cp110.c	\
				$(MARVELL_DRV_BASE)/mc_trustzone/mc_trustzone.c	\
119
				$(MARVELL_DRV_BASE)/secure_dfx_access/armada_thermal.c	\
120
				$(MARVELL_DRV_BASE)/secure_dfx_access/misc_dfx.c	\
121
				$(MARVELL_DRV_BASE)/ddr_phy_access.c	\
122
				drivers/rambus/trng_ip_76.c
123

124
125
126
127
ifeq (${MSS_SUPPORT}, 1)
MARVELL_DRV		+=	$(MARVELL_DRV_BASE)/mg_conf_cm3/mg_conf_cm3.c
endif

128
BL31_PORTING_SOURCES	:=	$(BOARD_DIR)/board/marvell_plat_config.c
129

130
ifeq ($(SYSTEM_POWER_SUPPORT),1)
131
BL31_PORTING_SOURCES	+=	$(BOARD_DIR)/board/system_power.c
132
133
endif

134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
BL31_SOURCES		+=	lib/cpus/aarch64/cortex_a72.S		       \
				$(PLAT_COMMON_BASE)/aarch64/plat_helpers.S     \
				$(PLAT_COMMON_BASE)/aarch64/plat_arch_config.c \
				$(PLAT_COMMON_BASE)/plat_pm.c		       \
				$(PLAT_COMMON_BASE)/plat_bl31_setup.c	       \
				$(MARVELL_COMMON_BASE)/marvell_gicv2.c	       \
				$(MARVELL_COMMON_BASE)/mrvl_sip_svc.c	       \
				$(MARVELL_COMMON_BASE)/marvell_ddr_info.c      \
				$(BL31_PORTING_SOURCES)			       \
				$(MARVELL_DRV)				       \
				$(MARVELL_MOCHI_DRV)			       \
				$(MARVELL_GIC_SOURCES)

# Add trace functionality for PM
BL31_SOURCES		+=	$(PLAT_COMMON_BASE)/plat_pm_trace.c

150
151

ifeq (${MSS_SUPPORT}, 1)
152
153
154
155
156
157
158
# Force builds with BL2 image on a80x0 platforms
ifndef SCP_BL2
 $(error "Error: SCP_BL2 image is mandatory for a8k family")
endif

# MSS (SCP) build
include $(PLAT_COMMON_BASE)/mss/mss_a8k.mk
159
endif
160
161

# BLE (ROM context execution code, AKA binary extension)
162
BLE_PATH	?=  $(PLAT_COMMON_BASE)/ble
163
164
165
166

include ${BLE_PATH}/ble.mk
$(eval $(call MAKE_BL,e))

167
168
169
clean realclean distclean: mrvl_clean

.PHONY: mrvl_clean
170
171
172
173
mrvl_clean:
	@echo "  Doimage CLEAN"
	${Q}${MAKE} PLAT=${PLAT} --no-print-directory -C ${DOIMAGEPATH} clean

174
${DOIMAGETOOL}: FORCE
175
176
177
	@$(DOIMAGE_LIBS_CHECK)
	${Q}${MAKE} --no-print-directory -C ${DOIMAGEPATH}

178
${BUILD_PLAT}/${FLASH_IMAGE}: ${ROM_BIN_EXT} ${BUILD_PLAT}/${BOOT_IMAGE} ${DOIMAGETOOL}
179
180
181
182
183
184
	@${ECHO_BLANK_LINE}
	@echo "Building flash image"
	${Q}${DOIMAGETOOL} ${DOIMAGE_FLAGS} ${BUILD_PLAT}/${BOOT_IMAGE} ${BUILD_PLAT}/${FLASH_IMAGE}
	@${ECHO_BLANK_LINE}
	@echo "Built $@ successfully"
	@${ECHO_BLANK_LINE}