blob: f7d6216a84061816797e2ebb021d53f3a1dc7d98 [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
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
Jorge Ramirez-Ortiz87c04052018-11-19 19:26:56 +0100140# lock RPC HYPERFLASH access by default
141# unlock to repogram the ATF firmware from u-boot
142ifndef RCAR_RPC_HYPERFLASH_LOCKED
143RCAR_RPC_HYPERFLASH_LOCKED := 1
144endif
145$(eval $(call add_define,RCAR_RPC_HYPERFLASH_LOCKED))
146
Jorge Ramirez-Ortizbf084dc2018-09-23 09:36:13 +0200147# Process RCAR_SECURE_BOOT flag
148ifndef RCAR_SECURE_BOOT
149RCAR_SECURE_BOOT := 1
150endif
151$(eval $(call add_define,RCAR_SECURE_BOOT))
152
153# Process RCAR_QOS_TYPE flag
154ifndef RCAR_QOS_TYPE
155RCAR_QOS_TYPE := 0
156endif
157$(eval $(call add_define,RCAR_QOS_TYPE))
158
159# Process RCAR_DRAM_SPLIT flag
160ifndef RCAR_DRAM_SPLIT
161RCAR_DRAM_SPLIT := 0
162endif
163$(eval $(call add_define,RCAR_DRAM_SPLIT))
164
165# Process RCAR_BL33_EXECUTION_EL flag
166ifndef RCAR_BL33_EXECUTION_EL
167RCAR_BL33_EXECUTION_EL := 0
168endif
169$(eval $(call add_define,RCAR_BL33_EXECUTION_EL))
170
171# Process RCAR_AVS_SETTING_ENABLE flag
172ifeq (${RCAR_AVS_SETTING_ENABLE},0)
173AVS_SETTING_ENABLE := 0
174else
175AVS_SETTING_ENABLE := 1
176endif
177$(eval $(call add_define,AVS_SETTING_ENABLE))
178
179# Process RCAR_LOSSY_ENABLE flag
180ifndef RCAR_LOSSY_ENABLE
181RCAR_LOSSY_ENABLE := 0
182endif
183$(eval $(call add_define,RCAR_LOSSY_ENABLE))
184
185# Process LIFEC_DBSC_PROTECT_ENABLE flag
186ifndef LIFEC_DBSC_PROTECT_ENABLE
187LIFEC_DBSC_PROTECT_ENABLE := 1
188endif
189$(eval $(call add_define,LIFEC_DBSC_PROTECT_ENABLE))
190
191# Process PMIC_ROHM_BD9571 flag
192ifndef PMIC_ROHM_BD9571
193PMIC_ROHM_BD9571 := 1
194endif
195$(eval $(call add_define,PMIC_ROHM_BD9571))
196
197# Process PMIC_LEVEL_MODE flag
198ifndef PMIC_LEVEL_MODE
199PMIC_LEVEL_MODE := 1
200endif
201$(eval $(call add_define,PMIC_LEVEL_MODE))
202
203# Process RCAR_GEN3_ULCB flag
204ifndef RCAR_GEN3_ULCB
205RCAR_GEN3_ULCB := 0
206endif
207ifeq (${RCAR_GEN3_ULCB},1)
208 BOARD_DEFAULT := 0x10
209 $(eval $(call add_define,BOARD_DEFAULT))
210endif
211$(eval $(call add_define,RCAR_GEN3_ULCB))
212
213# Process RCAR_REF_INT flag
214ifndef RCAR_REF_INT
215RCAR_REF_INT :=0
216endif
217$(eval $(call add_define,RCAR_REF_INT))
218
219# Process RCAR_REWT_TRAINING flag
220ifndef RCAR_REWT_TRAINING
221RCAR_REWT_TRAINING := 0
222endif
223$(eval $(call add_define,RCAR_REWT_TRAINING))
224
225# Process RCAR_SYSTEM_SUSPEND flag
226ifndef RCAR_SYSTEM_SUSPEND
227RCAR_SYSTEM_SUSPEND := 1
228endif
229$(eval $(call add_define,RCAR_SYSTEM_SUSPEND))
230
231# SYSTEM_SUSPEND requires power control of PMIC etc.
232# When executing SYSTEM_SUSPEND other than Salvator-X, Salvator-XS and Ebisu,
233# processing equivalent to that implemented in PMIC_ROHM_BD9571 is necessary.
234ifeq (${RCAR_SYSTEM_SUSPEND},1)
235 ifeq (${PMIC_ROHM_BD9571},0)
236 $(error "Error: When you want RCAR_SYSTEM_SUSPEND to be enable, please also set PMIC_ROHM_BD9571 to enable.")
237 endif
238endif
239
240# Process RCAR_DRAM_LPDDR4_MEMCONF flag
241ifndef RCAR_DRAM_LPDDR4_MEMCONF
242RCAR_DRAM_LPDDR4_MEMCONF :=1
243endif
244$(eval $(call add_define,RCAR_DRAM_LPDDR4_MEMCONF))
245
246# Process RCAR_DRAM_DDR3L_MEMCONF flag
247ifndef RCAR_DRAM_DDR3L_MEMCONF
248RCAR_DRAM_DDR3L_MEMCONF :=1
249endif
250$(eval $(call add_define,RCAR_DRAM_DDR3L_MEMCONF))
251
252# Process RCAR_DRAM_DDR3L_MEMDUAL flag
253ifndef RCAR_DRAM_DDR3L_MEMDUAL
254RCAR_DRAM_DDR3L_MEMDUAL :=1
255endif
256$(eval $(call add_define,RCAR_DRAM_DDR3L_MEMDUAL))
257
258# Process RCAR_BL33_ARG0 flag
259ifdef RCAR_BL33_ARG0
260$(eval $(call add_define,RCAR_BL33_ARG0))
261endif
262
263#Process RCAR_BL2_DCACHE flag
264ifndef RCAR_BL2_DCACHE
265RCAR_BL2_DCACHE := 0
266endif
267$(eval $(call add_define,RCAR_BL2_DCACHE))
268
269# Process RCAR_DRAM_CHANNEL flag
270ifndef RCAR_DRAM_CHANNEL
271RCAR_DRAM_CHANNEL :=15
272endif
273$(eval $(call add_define,RCAR_DRAM_CHANNEL))
274
275#Process RCAR_SYSTEM_RESET_KEEPON_DDR flag
276ifndef RCAR_SYSTEM_RESET_KEEPON_DDR
277RCAR_SYSTEM_RESET_KEEPON_DDR := 0
278endif
279$(eval $(call add_define,RCAR_SYSTEM_RESET_KEEPON_DDR))
280
281# RCAR_SYSTEM_RESET_KEEPON_DDR requires power control of PMIC etc.
282# When executing SYSTEM_SUSPEND other than Salvator-X, Salvator-XS and Ebisu,
283# processing equivalent to that implemented in PMIC_ROHM_BD9571 is necessary.
284# Also, it is necessary to enable RCAR_SYSTEM_SUSPEND.
285ifeq (${RCAR_SYSTEM_RESET_KEEPON_DDR},1)
286 ifeq (${PMIC_ROHM_BD9571},0)
287 $(error "Error: When you want RCAR_SYSTEM_RESET_KEEPON_DDR to be enable, please also set PMIC_ROHM_BD9571 to enable.")
288 endif
289 ifeq (${RCAR_SYSTEM_SUSPEND},0)
290 $(error "Error: When you want RCAR_SYSTEM_RESET_KEEPON_DDR to be enable, please also set RCAR_SYSTEM_SUSPEND to enable.")
291 endif
292endif
293
294# Enable workarounds for selected Cortex-A53 erratas.
295ERRATA_A53_835769 := 1
296ERRATA_A53_843419 := 1
297ERRATA_A53_855873 := 1
298
299# Enable workarounds for selected Cortex-A57 erratas.
300ERRATA_A57_859972 := 1
301ERRATA_A57_813419 := 1
302
Jorge Ramirez-Ortiz47503d22018-09-23 09:36:52 +0200303include drivers/staging/renesas/rcar/ddr/ddr.mk
304include drivers/staging/renesas/rcar/qos/qos.mk
305include drivers/staging/renesas/rcar/pfc/pfc.mk
Jorge Ramirez-Ortizbf084dc2018-09-23 09:36:13 +0200306
307PLAT_INCLUDES := -Iinclude/common/tbbr \
Jorge Ramirez-Ortiz47503d22018-09-23 09:36:52 +0200308 -Idrivers/staging/renesas/rcar/ddr \
309 -Idrivers/staging/renesas/rcar/qos \
Jorge Ramirez-Ortizbf084dc2018-09-23 09:36:13 +0200310 -Idrivers/renesas/rcar/iic_dvfs \
311 -Idrivers/renesas/rcar/board \
312 -Idrivers/renesas/rcar/avs \
313 -Idrivers/renesas/rcar/delay \
314 -Idrivers/renesas/rcar/rom \
315 -Idrivers/renesas/rcar/scif \
316 -Idrivers/renesas/rcar/emmc \
317 -Idrivers/renesas/rcar/pwrc \
318 -Idrivers/renesas/rcar/io \
Jorge Ramirez-Ortizbf084dc2018-09-23 09:36:13 +0200319 -Iplat/renesas/rcar/include/registers \
320 -Iplat/renesas/rcar/include \
321 -Iplat/renesas/rcar
322
323PLAT_BL_COMMON_SOURCES := drivers/renesas/rcar/iic_dvfs/iic_dvfs.c
324
325
326RCAR_GIC_SOURCES := drivers/arm/gic/common/gic_common.c \
327 drivers/arm/gic/v2/gicv2_main.c \
328 drivers/arm/gic/v2/gicv2_helpers.c \
329 plat/common/plat_gicv2.c
330
331BL2_SOURCES += ${RCAR_GIC_SOURCES} \
332 lib/cpus/aarch64/cortex_a53.S \
333 lib/cpus/aarch64/cortex_a57.S \
334 common/desc_image_load.c \
335 plat/renesas/rcar/aarch64/platform_common.c \
336 plat/renesas/rcar/aarch64/plat_helpers.S \
337 plat/renesas/rcar/bl2_interrupt_error.c \
338 plat/renesas/rcar/bl2_secure_setting.c \
339 plat/renesas/rcar/bl2_plat_setup.c \
340 plat/renesas/rcar/plat_storage.c \
341 plat/renesas/rcar/bl2_plat_mem_params_desc.c \
342 plat/renesas/rcar/plat_image_load.c \
343 plat/renesas/rcar/bl2_cpg_init.c \
344 drivers/renesas/rcar/console/rcar_printf.c \
345 drivers/renesas/rcar/scif/scif.S \
346 drivers/renesas/rcar/common.c \
347 drivers/renesas/rcar/io/io_emmcdrv.c \
348 drivers/renesas/rcar/io/io_memdrv.c \
349 drivers/renesas/rcar/io/io_rcar.c \
350 drivers/renesas/rcar/auth/auth_mod.c \
351 drivers/renesas/rcar/rpc/rpc_driver.c \
352 drivers/renesas/rcar/dma/dma_driver.c \
353 drivers/renesas/rcar/avs/avs_driver.c \
354 drivers/renesas/rcar/delay/micro_delay.S \
355 drivers/renesas/rcar/emmc/emmc_interrupt.c \
356 drivers/renesas/rcar/emmc/emmc_utility.c \
357 drivers/renesas/rcar/emmc/emmc_mount.c \
358 drivers/renesas/rcar/emmc/emmc_init.c \
359 drivers/renesas/rcar/emmc/emmc_read.c \
360 drivers/renesas/rcar/emmc/emmc_cmd.c \
361 drivers/renesas/rcar/watchdog/swdt.c \
362 drivers/renesas/rcar/rom/rom_api.c \
363 drivers/renesas/rcar/board/board.c \
364 drivers/io/io_storage.c
365
366BL31_SOURCES += ${RCAR_GIC_SOURCES} \
367 lib/cpus/aarch64/cortex_a53.S \
368 lib/cpus/aarch64/cortex_a57.S \
369 plat/common/plat_psci_common.c \
370 plat/renesas/rcar/plat_topology.c \
371 plat/renesas/rcar/aarch64/plat_helpers.S \
372 plat/renesas/rcar/aarch64/platform_common.c \
373 plat/renesas/rcar/bl31_plat_setup.c \
374 plat/renesas/rcar/plat_pm.c \
375 drivers/renesas/rcar/console/rcar_console.S \
376 drivers/renesas/rcar/console/rcar_printf.c \
377 drivers/renesas/rcar/pwrc/call_sram.S \
378 drivers/renesas/rcar/pwrc/pwrc.c \
379 drivers/renesas/rcar/common.c \
380 drivers/arm/cci/cci.c
381
382ifeq (${RCAR_GEN3_ULCB},1)
383BL31_SOURCES += drivers/renesas/rcar/cpld/ulcb_cpld.c
384endif
385
386include lib/xlat_tables_v2/xlat_tables.mk
387include drivers/auth/mbedtls/mbedtls_crypto.mk
388PLAT_BL_COMMON_SOURCES += ${XLAT_TABLES_LIB_SRCS}
389
390# build the layout images for the bootrom and the necessary srecords
391rcar: rcar_layout_tool rcar_srecord
392distclean realclean clean: clean_layout_tool clean_srecord
393
394# layout images
395LAYOUT_TOOLPATH ?= tools/renesas/rcar_layout_create
396
397clean_layout_tool:
398 @echo "clean layout tool"
399 ${Q}${MAKE} -C ${LAYOUT_TOOLPATH} clean
400
401.PHONY: rcar_layout_tool
402rcar_layout_tool:
403 @echo "generating layout srecs"
404 ${Q}${MAKE} CPPFLAGS="-D=AARCH64" --no-print-directory -C ${LAYOUT_TOOLPATH}
405
406# srecords
407SREC_PATH = ${BUILD_PLAT}
408BL2_ELF_SRC = ${SREC_PATH}/bl2/bl2.elf
409BL31_ELF_SRC = ${SREC_PATH}/bl31/bl31.elf
410
411clean_srecord:
412 @echo "clean bl2 and bl31 srecs"
413 rm -f ${SREC_PATH}/bl2.srec ${SREC_PATH}/bl31.srec
414
415.PHONY: rcar_srecord
416rcar_srecord:
417 @echo "generating srec: ${SREC_PATH}/bl2.srec"
418 $(Q)$(OC) -O srec --srec-forceS3 ${BL2_ELF_SRC} ${SREC_PATH}/bl2.srec
419 @echo "generating srec: ${SREC_PATH}/bl31.srec"
420 $(Q)$(OC) -O srec --srec-forceS3 ${BL31_ELF_SRC} ${SREC_PATH}/bl31.srec
421