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