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