1# 2# Copyright (c) 2018, Renesas Electronics Corporation. All rights reserved. 3# 4# SPDX-License-Identifier: BSD-3-Clause 5# 6 7PROGRAMMABLE_RESET_ADDRESS := 1 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 14ENABLE_SVE_FOR_NS := 0 15 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 141# 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 148# 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 304include drivers/staging/renesas/rcar/ddr/ddr.mk 305include drivers/staging/renesas/rcar/qos/qos.mk 306include drivers/staging/renesas/rcar/pfc/pfc.mk 307include lib/libfdt/libfdt.mk 308 309PLAT_INCLUDES := -Iinclude/common/tbbr \ 310 -Idrivers/staging/renesas/rcar/ddr \ 311 -Idrivers/staging/renesas/rcar/qos \ 312 -Idrivers/renesas/rcar/iic_dvfs \ 313 -Idrivers/renesas/rcar/board \ 314 -Idrivers/renesas/rcar/cpld/ \ 315 -Idrivers/renesas/rcar/avs \ 316 -Idrivers/renesas/rcar/delay \ 317 -Idrivers/renesas/rcar/rom \ 318 -Idrivers/renesas/rcar/scif \ 319 -Idrivers/renesas/rcar/emmc \ 320 -Idrivers/renesas/rcar/pwrc \ 321 -Idrivers/renesas/rcar/io \ 322 -Iplat/renesas/rcar/include/registers \ 323 -Iplat/renesas/rcar/include \ 324 -Iplat/renesas/rcar 325 326PLAT_BL_COMMON_SOURCES := drivers/renesas/rcar/iic_dvfs/iic_dvfs.c 327 328 329RCAR_GIC_SOURCES := drivers/arm/gic/common/gic_common.c \ 330 drivers/arm/gic/v2/gicv2_main.c \ 331 drivers/arm/gic/v2/gicv2_helpers.c \ 332 plat/common/plat_gicv2.c 333 334BL2_SOURCES += ${RCAR_GIC_SOURCES} \ 335 lib/cpus/aarch64/cortex_a53.S \ 336 lib/cpus/aarch64/cortex_a57.S \ 337 ${LIBFDT_SRCS} \ 338 common/desc_image_load.c \ 339 plat/renesas/rcar/aarch64/platform_common.c \ 340 plat/renesas/rcar/aarch64/plat_helpers.S \ 341 plat/renesas/rcar/bl2_interrupt_error.c \ 342 plat/renesas/rcar/bl2_secure_setting.c \ 343 plat/renesas/rcar/bl2_plat_setup.c \ 344 plat/renesas/rcar/plat_storage.c \ 345 plat/renesas/rcar/bl2_plat_mem_params_desc.c \ 346 plat/renesas/rcar/plat_image_load.c \ 347 plat/renesas/rcar/bl2_cpg_init.c \ 348 drivers/renesas/rcar/console/rcar_printf.c \ 349 drivers/renesas/rcar/scif/scif.S \ 350 drivers/renesas/rcar/common.c \ 351 drivers/renesas/rcar/io/io_emmcdrv.c \ 352 drivers/renesas/rcar/io/io_memdrv.c \ 353 drivers/renesas/rcar/io/io_rcar.c \ 354 drivers/renesas/rcar/auth/auth_mod.c \ 355 drivers/renesas/rcar/rpc/rpc_driver.c \ 356 drivers/renesas/rcar/dma/dma_driver.c \ 357 drivers/renesas/rcar/avs/avs_driver.c \ 358 drivers/renesas/rcar/delay/micro_delay.c \ 359 drivers/renesas/rcar/emmc/emmc_interrupt.c \ 360 drivers/renesas/rcar/emmc/emmc_utility.c \ 361 drivers/renesas/rcar/emmc/emmc_mount.c \ 362 drivers/renesas/rcar/emmc/emmc_init.c \ 363 drivers/renesas/rcar/emmc/emmc_read.c \ 364 drivers/renesas/rcar/emmc/emmc_cmd.c \ 365 drivers/renesas/rcar/watchdog/swdt.c \ 366 drivers/renesas/rcar/rom/rom_api.c \ 367 drivers/renesas/rcar/board/board.c \ 368 drivers/io/io_storage.c 369 370BL31_SOURCES += ${RCAR_GIC_SOURCES} \ 371 lib/cpus/aarch64/cortex_a53.S \ 372 lib/cpus/aarch64/cortex_a57.S \ 373 plat/common/plat_psci_common.c \ 374 plat/renesas/rcar/plat_topology.c \ 375 plat/renesas/rcar/aarch64/plat_helpers.S \ 376 plat/renesas/rcar/aarch64/platform_common.c \ 377 plat/renesas/rcar/bl31_plat_setup.c \ 378 plat/renesas/rcar/plat_pm.c \ 379 drivers/renesas/rcar/console/rcar_console.S \ 380 drivers/renesas/rcar/console/rcar_printf.c \ 381 drivers/renesas/rcar/delay/micro_delay.c \ 382 drivers/renesas/rcar/pwrc/call_sram.S \ 383 drivers/renesas/rcar/pwrc/pwrc.c \ 384 drivers/renesas/rcar/common.c \ 385 drivers/arm/cci/cci.c 386 387ifeq (${RCAR_GEN3_ULCB},1) 388BL31_SOURCES += drivers/renesas/rcar/cpld/ulcb_cpld.c 389endif 390 391include lib/xlat_tables_v2/xlat_tables.mk 392include drivers/auth/mbedtls/mbedtls_crypto.mk 393PLAT_BL_COMMON_SOURCES += ${XLAT_TABLES_LIB_SRCS} 394 395# build the layout images for the bootrom and the necessary srecords 396rcar: rcar_layout_tool rcar_srecord 397distclean realclean clean: clean_layout_tool clean_srecord 398 399# layout images 400LAYOUT_TOOLPATH ?= tools/renesas/rcar_layout_create 401 402clean_layout_tool: 403 @echo "clean layout tool" 404 ${Q}${MAKE} -C ${LAYOUT_TOOLPATH} clean 405 406.PHONY: rcar_layout_tool 407rcar_layout_tool: 408 @echo "generating layout srecs" 409 ${Q}${MAKE} CPPFLAGS="-D=AARCH64" --no-print-directory -C ${LAYOUT_TOOLPATH} 410 411# srecords 412SREC_PATH = ${BUILD_PLAT} 413BL2_ELF_SRC = ${SREC_PATH}/bl2/bl2.elf 414BL31_ELF_SRC = ${SREC_PATH}/bl31/bl31.elf 415 416clean_srecord: 417 @echo "clean bl2 and bl31 srecs" 418 rm -f ${SREC_PATH}/bl2.srec ${SREC_PATH}/bl31.srec 419 420.PHONY: rcar_srecord 421rcar_srecord: $(BL2_ELF_SRC) $(BL31_ELF_SRC) 422 @echo "generating srec: ${SREC_PATH}/bl2.srec" 423 $(Q)$(OC) -O srec --srec-forceS3 ${BL2_ELF_SRC} ${SREC_PATH}/bl2.srec 424 @echo "generating srec: ${SREC_PATH}/bl31.srec" 425 $(Q)$(OC) -O srec --srec-forceS3 ${BL31_ELF_SRC} ${SREC_PATH}/bl31.srec 426 427