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