xref: /rk3399_ARM-atf/plat/renesas/rcar/platform.mk (revision c3cf06f1a3a9b9ee8ac7a0ae505f95c45f7dca84)
1#
2# Copyright (c) 2018, Renesas Electronics Corporation. All rights reserved.
3#
4# SPDX-License-Identifier: BSD-3-Clause
5#
6
7PROGRAMMABLE_RESET_ADDRESS	:= 0
8COLD_BOOT_SINGLE_CPU		:= 1
9ARM_CCI_PRODUCT_ID		:= 500
10TRUSTED_BOARD_BOOT		:= 1
11RESET_TO_BL31			:= 1
12GENERATE_COT			:= 1
13BL2_AT_EL3			:= 1
14
15$(eval $(call add_define,PLAT_EXTRA_LD_SCRIPT))
16
17ifeq (${SPD},none)
18  SPD_NONE:=1
19  $(eval $(call add_define,SPD_NONE))
20endif
21
22# LSI setting common define
23RCAR_H3:=0
24RCAR_M3:=1
25RCAR_M3N:=2
26RCAR_E3:=3
27RCAR_H3N:=4
28RCAR_AUTO:=99
29$(eval $(call add_define,RCAR_H3))
30$(eval $(call add_define,RCAR_M3))
31$(eval $(call add_define,RCAR_M3N))
32$(eval $(call add_define,RCAR_E3))
33$(eval $(call add_define,RCAR_H3N))
34$(eval $(call add_define,RCAR_AUTO))
35RCAR_CUT_10:=0
36RCAR_CUT_11:=1
37RCAR_CUT_20:=10
38RCAR_CUT_30:=20
39$(eval $(call add_define,RCAR_CUT_10))
40$(eval $(call add_define,RCAR_CUT_11))
41$(eval $(call add_define,RCAR_CUT_20))
42$(eval $(call add_define,RCAR_CUT_30))
43
44ifndef LSI
45  $(error "Error: Unknown LSI. Please use LSI=<LSI name> to specify the LSI")
46else
47  ifeq (${LSI},AUTO)
48    RCAR_LSI:=${RCAR_AUTO}
49  else ifeq (${LSI},H3)
50    RCAR_LSI:=${RCAR_H3}
51    ifndef LSI_CUT
52      # enable compatible function.
53      RCAR_LSI_CUT_COMPAT := 1
54      $(eval $(call add_define,RCAR_LSI_CUT_COMPAT))
55    else
56      # disable compatible function.
57      ifeq (${LSI_CUT},10)
58        RCAR_LSI_CUT:=0
59      else ifeq (${LSI_CUT},11)
60        RCAR_LSI_CUT:=1
61      else ifeq (${LSI_CUT},20)
62        RCAR_LSI_CUT:=10
63      else ifeq (${LSI_CUT},30)
64        RCAR_LSI_CUT:=20
65      else
66        $(error "Error: ${LSI_CUT} is not supported.")
67      endif
68      $(eval $(call add_define,RCAR_LSI_CUT))
69    endif
70  else ifeq (${LSI},H3N)
71    RCAR_LSI:=${RCAR_H3N}
72    ifndef LSI_CUT
73      # enable compatible function.
74      RCAR_LSI_CUT_COMPAT := 1
75      $(eval $(call add_define,RCAR_LSI_CUT_COMPAT))
76    else
77      # disable compatible function.
78      ifeq (${LSI_CUT},30)
79        RCAR_LSI_CUT:=20
80      else
81        $(error "Error: ${LSI_CUT} is not supported.")
82      endif
83      $(eval $(call add_define,RCAR_LSI_CUT))
84    endif
85  else ifeq (${LSI},M3)
86    RCAR_LSI:=${RCAR_M3}
87    ifndef LSI_CUT
88      # enable compatible function.
89      RCAR_LSI_CUT_COMPAT := 1
90      $(eval $(call add_define,RCAR_LSI_CUT_COMPAT))
91    else
92      # disable compatible function.
93      ifeq (${LSI_CUT},10)
94        RCAR_LSI_CUT:=0
95      else ifeq (${LSI_CUT},11)
96        RCAR_LSI_CUT:=1
97      else
98        $(error "Error: ${LSI_CUT} is not supported.")
99      endif
100      $(eval $(call add_define,RCAR_LSI_CUT))
101    endif
102  else ifeq (${LSI},M3N)
103    RCAR_LSI:=${RCAR_M3N}
104    ifndef LSI_CUT
105      # enable compatible function.
106      RCAR_LSI_CUT_COMPAT := 1
107      $(eval $(call add_define,RCAR_LSI_CUT_COMPAT))
108    else
109      # disable compatible function.
110      ifeq (${LSI_CUT},10)
111        RCAR_LSI_CUT:=0
112      else ifeq (${LSI_CUT},11)
113        RCAR_LSI_CUT:=1
114      else
115        $(error "Error: ${LSI_CUT} is not supported.")
116      endif
117      $(eval $(call add_define,RCAR_LSI_CUT))
118    endif
119  else ifeq (${LSI},E3)
120    RCAR_LSI:=${RCAR_E3}
121    ifndef LSI_CUT
122      # enable compatible function.
123      RCAR_LSI_CUT_COMPAT := 1
124      $(eval $(call add_define,RCAR_LSI_CUT_COMPAT))
125    else
126      # disable compatible function.
127      ifeq (${LSI_CUT},10)
128        RCAR_LSI_CUT:=0
129      else
130        $(error "Error: ${LSI_CUT} is not supported.")
131      endif
132      $(eval $(call add_define,RCAR_LSI_CUT))
133    endif
134  else
135    $(error "Error: ${LSI} is not supported.")
136  endif
137  $(eval $(call add_define,RCAR_LSI))
138endif
139
140# Process RCAR_SECURE_BOOT flag
141ifndef RCAR_SECURE_BOOT
142RCAR_SECURE_BOOT := 1
143endif
144$(eval $(call add_define,RCAR_SECURE_BOOT))
145
146# Process RCAR_QOS_TYPE flag
147ifndef RCAR_QOS_TYPE
148RCAR_QOS_TYPE := 0
149endif
150$(eval $(call add_define,RCAR_QOS_TYPE))
151
152# Process RCAR_DRAM_SPLIT flag
153ifndef RCAR_DRAM_SPLIT
154RCAR_DRAM_SPLIT := 0
155endif
156$(eval $(call add_define,RCAR_DRAM_SPLIT))
157
158# Process RCAR_BL33_EXECUTION_EL flag
159ifndef RCAR_BL33_EXECUTION_EL
160RCAR_BL33_EXECUTION_EL := 0
161endif
162$(eval $(call add_define,RCAR_BL33_EXECUTION_EL))
163
164# Process RCAR_AVS_SETTING_ENABLE flag
165ifeq (${RCAR_AVS_SETTING_ENABLE},0)
166AVS_SETTING_ENABLE := 0
167else
168AVS_SETTING_ENABLE := 1
169endif
170$(eval $(call add_define,AVS_SETTING_ENABLE))
171
172# Process RCAR_LOSSY_ENABLE flag
173ifndef RCAR_LOSSY_ENABLE
174RCAR_LOSSY_ENABLE := 0
175endif
176$(eval $(call add_define,RCAR_LOSSY_ENABLE))
177
178# Process LIFEC_DBSC_PROTECT_ENABLE flag
179ifndef LIFEC_DBSC_PROTECT_ENABLE
180LIFEC_DBSC_PROTECT_ENABLE := 1
181endif
182$(eval $(call add_define,LIFEC_DBSC_PROTECT_ENABLE))
183
184# Process PMIC_ROHM_BD9571 flag
185ifndef PMIC_ROHM_BD9571
186PMIC_ROHM_BD9571 := 1
187endif
188$(eval $(call add_define,PMIC_ROHM_BD9571))
189
190# Process PMIC_LEVEL_MODE flag
191ifndef PMIC_LEVEL_MODE
192PMIC_LEVEL_MODE := 1
193endif
194$(eval $(call add_define,PMIC_LEVEL_MODE))
195
196# Process RCAR_GEN3_ULCB flag
197ifndef RCAR_GEN3_ULCB
198RCAR_GEN3_ULCB := 0
199endif
200ifeq (${RCAR_GEN3_ULCB},1)
201 BOARD_DEFAULT := 0x10
202 $(eval $(call add_define,BOARD_DEFAULT))
203endif
204$(eval $(call add_define,RCAR_GEN3_ULCB))
205
206# Process RCAR_REF_INT flag
207ifndef RCAR_REF_INT
208RCAR_REF_INT :=0
209endif
210$(eval $(call add_define,RCAR_REF_INT))
211
212# Process RCAR_REWT_TRAINING flag
213ifndef RCAR_REWT_TRAINING
214RCAR_REWT_TRAINING := 0
215endif
216$(eval $(call add_define,RCAR_REWT_TRAINING))
217
218# Process RCAR_SYSTEM_SUSPEND flag
219ifndef RCAR_SYSTEM_SUSPEND
220RCAR_SYSTEM_SUSPEND := 1
221endif
222$(eval $(call add_define,RCAR_SYSTEM_SUSPEND))
223
224# SYSTEM_SUSPEND requires power control of PMIC etc.
225# When executing SYSTEM_SUSPEND other than Salvator-X, Salvator-XS and Ebisu,
226# processing equivalent to that implemented in PMIC_ROHM_BD9571 is necessary.
227ifeq (${RCAR_SYSTEM_SUSPEND},1)
228  ifeq (${PMIC_ROHM_BD9571},0)
229    $(error "Error: When you want RCAR_SYSTEM_SUSPEND to be enable, please also set PMIC_ROHM_BD9571 to enable.")
230  endif
231endif
232
233# Process RCAR_DRAM_LPDDR4_MEMCONF flag
234ifndef RCAR_DRAM_LPDDR4_MEMCONF
235RCAR_DRAM_LPDDR4_MEMCONF :=1
236endif
237$(eval $(call add_define,RCAR_DRAM_LPDDR4_MEMCONF))
238
239# Process RCAR_DRAM_DDR3L_MEMCONF flag
240ifndef RCAR_DRAM_DDR3L_MEMCONF
241RCAR_DRAM_DDR3L_MEMCONF :=1
242endif
243$(eval $(call add_define,RCAR_DRAM_DDR3L_MEMCONF))
244
245# Process RCAR_DRAM_DDR3L_MEMDUAL flag
246ifndef RCAR_DRAM_DDR3L_MEMDUAL
247RCAR_DRAM_DDR3L_MEMDUAL :=1
248endif
249$(eval $(call add_define,RCAR_DRAM_DDR3L_MEMDUAL))
250
251# Process RCAR_BL33_ARG0 flag
252ifdef RCAR_BL33_ARG0
253$(eval $(call add_define,RCAR_BL33_ARG0))
254endif
255
256#Process RCAR_BL2_DCACHE flag
257ifndef RCAR_BL2_DCACHE
258RCAR_BL2_DCACHE := 0
259endif
260$(eval $(call add_define,RCAR_BL2_DCACHE))
261
262# Process RCAR_DRAM_CHANNEL flag
263ifndef RCAR_DRAM_CHANNEL
264RCAR_DRAM_CHANNEL :=15
265endif
266$(eval $(call add_define,RCAR_DRAM_CHANNEL))
267
268#Process RCAR_SYSTEM_RESET_KEEPON_DDR flag
269ifndef RCAR_SYSTEM_RESET_KEEPON_DDR
270RCAR_SYSTEM_RESET_KEEPON_DDR := 0
271endif
272$(eval $(call add_define,RCAR_SYSTEM_RESET_KEEPON_DDR))
273
274# RCAR_SYSTEM_RESET_KEEPON_DDR requires power control of PMIC etc.
275# When executing SYSTEM_SUSPEND other than Salvator-X, Salvator-XS and Ebisu,
276# processing equivalent to that implemented in PMIC_ROHM_BD9571 is necessary.
277# Also, it is necessary to enable RCAR_SYSTEM_SUSPEND.
278ifeq (${RCAR_SYSTEM_RESET_KEEPON_DDR},1)
279  ifeq (${PMIC_ROHM_BD9571},0)
280    $(error "Error: When you want RCAR_SYSTEM_RESET_KEEPON_DDR to be enable, please also set PMIC_ROHM_BD9571 to enable.")
281  endif
282  ifeq (${RCAR_SYSTEM_SUSPEND},0)
283    $(error "Error: When you want RCAR_SYSTEM_RESET_KEEPON_DDR to be enable, please also set RCAR_SYSTEM_SUSPEND to enable.")
284  endif
285endif
286
287# Enable workarounds for selected Cortex-A53 erratas.
288ERRATA_A53_835769  := 1
289ERRATA_A53_843419  := 1
290ERRATA_A53_855873  := 1
291
292# Enable workarounds for selected Cortex-A57 erratas.
293ERRATA_A57_859972  := 1
294ERRATA_A57_813419  := 1
295
296include drivers/staging/renesas/rcar/ddr/ddr.mk
297include drivers/staging/renesas/rcar/qos/qos.mk
298include drivers/staging/renesas/rcar/pfc/pfc.mk
299
300PLAT_INCLUDES	:=	-Iinclude/common/tbbr			\
301			-Idrivers/staging/renesas/rcar/ddr	\
302			-Idrivers/staging/renesas/rcar/qos	\
303			-Idrivers/renesas/rcar/iic_dvfs		\
304			-Idrivers/renesas/rcar/board		\
305			-Idrivers/renesas/rcar/avs		\
306			-Idrivers/renesas/rcar/delay		\
307			-Idrivers/renesas/rcar/rom		\
308			-Idrivers/renesas/rcar/scif		\
309			-Idrivers/renesas/rcar/emmc		\
310			-Idrivers/renesas/rcar/pwrc		\
311			-Idrivers/renesas/rcar/io		\
312			-Iplat/renesas/rcar/include/registers	\
313			-Iplat/renesas/rcar/include		\
314			-Iplat/renesas/rcar
315
316PLAT_BL_COMMON_SOURCES	:=	drivers/renesas/rcar/iic_dvfs/iic_dvfs.c
317
318
319RCAR_GIC_SOURCES	:=	drivers/arm/gic/common/gic_common.c	\
320				drivers/arm/gic/v2/gicv2_main.c		\
321				drivers/arm/gic/v2/gicv2_helpers.c	\
322				plat/common/plat_gicv2.c
323
324BL2_SOURCES	+=	${RCAR_GIC_SOURCES}				\
325			lib/cpus/aarch64/cortex_a53.S			\
326			lib/cpus/aarch64/cortex_a57.S			\
327			common/desc_image_load.c			\
328			plat/renesas/rcar/aarch64/platform_common.c	\
329			plat/renesas/rcar/aarch64/plat_helpers.S	\
330			plat/renesas/rcar/bl2_interrupt_error.c		\
331			plat/renesas/rcar/bl2_secure_setting.c		\
332			plat/renesas/rcar/bl2_plat_setup.c		\
333			plat/renesas/rcar/plat_storage.c		\
334			plat/renesas/rcar/bl2_plat_mem_params_desc.c	\
335			plat/renesas/rcar/plat_image_load.c		\
336			plat/renesas/rcar/bl2_cpg_init.c		\
337			drivers/renesas/rcar/console/rcar_printf.c	\
338			drivers/renesas/rcar/scif/scif.S		\
339			drivers/renesas/rcar/common.c			\
340			drivers/renesas/rcar/io/io_emmcdrv.c		\
341			drivers/renesas/rcar/io/io_memdrv.c		\
342			drivers/renesas/rcar/io/io_rcar.c		\
343			drivers/renesas/rcar/auth/auth_mod.c		\
344			drivers/renesas/rcar/rpc/rpc_driver.c		\
345			drivers/renesas/rcar/dma/dma_driver.c		\
346			drivers/renesas/rcar/avs/avs_driver.c		\
347			drivers/renesas/rcar/delay/micro_delay.S	\
348			drivers/renesas/rcar/emmc/emmc_interrupt.c	\
349			drivers/renesas/rcar/emmc/emmc_utility.c	\
350			drivers/renesas/rcar/emmc/emmc_mount.c		\
351			drivers/renesas/rcar/emmc/emmc_init.c		\
352			drivers/renesas/rcar/emmc/emmc_read.c		\
353			drivers/renesas/rcar/emmc/emmc_cmd.c		\
354			drivers/renesas/rcar/watchdog/swdt.c		\
355			drivers/renesas/rcar/rom/rom_api.c		\
356			drivers/renesas/rcar/board/board.c		\
357			drivers/io/io_storage.c
358
359BL31_SOURCES	+=	${RCAR_GIC_SOURCES}				\
360			lib/cpus/aarch64/cortex_a53.S			\
361			lib/cpus/aarch64/cortex_a57.S			\
362			plat/common/plat_psci_common.c			\
363			plat/renesas/rcar/plat_topology.c		\
364			plat/renesas/rcar/aarch64/plat_helpers.S	\
365			plat/renesas/rcar/aarch64/platform_common.c	\
366			plat/renesas/rcar/bl31_plat_setup.c		\
367			plat/renesas/rcar/plat_pm.c			\
368			drivers/renesas/rcar/console/rcar_console.S	\
369			drivers/renesas/rcar/console/rcar_printf.c	\
370			drivers/renesas/rcar/pwrc/call_sram.S		\
371			drivers/renesas/rcar/pwrc/pwrc.c		\
372			drivers/renesas/rcar/common.c			\
373			drivers/arm/cci/cci.c
374
375ifeq (${RCAR_GEN3_ULCB},1)
376BL31_SOURCES		+=	drivers/renesas/rcar/cpld/ulcb_cpld.c
377endif
378
379include lib/xlat_tables_v2/xlat_tables.mk
380include drivers/auth/mbedtls/mbedtls_crypto.mk
381PLAT_BL_COMMON_SOURCES	+=	${XLAT_TABLES_LIB_SRCS}
382
383# build the layout images for the bootrom and the necessary srecords
384rcar: rcar_layout_tool rcar_srecord
385distclean realclean clean: clean_layout_tool clean_srecord
386
387# layout images
388LAYOUT_TOOLPATH ?= tools/renesas/rcar_layout_create
389
390clean_layout_tool:
391	@echo "clean layout tool"
392	${Q}${MAKE} -C ${LAYOUT_TOOLPATH} clean
393
394.PHONY: rcar_layout_tool
395rcar_layout_tool:
396	@echo "generating layout srecs"
397	${Q}${MAKE} CPPFLAGS="-D=AARCH64" --no-print-directory -C ${LAYOUT_TOOLPATH}
398
399# srecords
400SREC_PATH	= ${BUILD_PLAT}
401BL2_ELF_SRC	= ${SREC_PATH}/bl2/bl2.elf
402BL31_ELF_SRC	= ${SREC_PATH}/bl31/bl31.elf
403
404clean_srecord:
405	@echo "clean bl2 and bl31 srecs"
406	rm -f ${SREC_PATH}/bl2.srec ${SREC_PATH}/bl31.srec
407
408.PHONY: rcar_srecord
409rcar_srecord:
410	@echo "generating srec: ${SREC_PATH}/bl2.srec"
411	$(Q)$(OC) -O srec --srec-forceS3 ${BL2_ELF_SRC}  ${SREC_PATH}/bl2.srec
412	@echo "generating srec: ${SREC_PATH}/bl31.srec"
413	$(Q)$(OC) -O srec --srec-forceS3 ${BL31_ELF_SRC} ${SREC_PATH}/bl31.srec
414
415