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