| 1 |
# |
| 2 |
# Copyright (c) 2018-2021, Renesas Electronics Corporation. All rights reserved. |
| 3 |
# |
| 4 |
# SPDX-License-Identifier: BSD-3-Clause |
| 5 |
# |
| 6 |
|
| 7 |
include plat/renesas/common/common.mk |
| 8 |
|
| 9 |
ENABLE_STACK_PROTECTOR := strong |
| 10 |
|
| 11 |
ifndef LSI |
| 12 |
$(error "Error: Unknown LSI. Please use LSI=<LSI name> to specify the LSI") |
| 13 |
else |
| 14 |
ifeq (${LSI},AUTO) |
| 15 |
RCAR_LSI:=${RCAR_AUTO} |
| 16 |
else ifeq (${LSI},H3) |
| 17 |
RCAR_LSI:=${RCAR_H3} |
| 18 |
ifndef LSI_CUT |
| 19 |
# enable compatible function. |
| 20 |
RCAR_LSI_CUT_COMPAT := 1 |
| 21 |
$(eval $(call add_define,RCAR_LSI_CUT_COMPAT)) |
| 22 |
else |
| 23 |
# disable compatible function. |
| 24 |
ifeq (${LSI_CUT},10) |
| 25 |
RCAR_LSI_CUT:=0 |
| 26 |
else ifeq (${LSI_CUT},11) |
| 27 |
RCAR_LSI_CUT:=1 |
| 28 |
else ifeq (${LSI_CUT},20) |
| 29 |
RCAR_LSI_CUT:=10 |
| 30 |
else ifeq (${LSI_CUT},30) |
| 31 |
RCAR_LSI_CUT:=20 |
| 32 |
else |
| 33 |
$(error "Error: ${LSI_CUT} is not supported.") |
| 34 |
endif |
| 35 |
$(eval $(call add_define,RCAR_LSI_CUT)) |
| 36 |
endif |
| 37 |
else ifeq (${LSI},H3N) |
| 38 |
RCAR_LSI:=${RCAR_H3N} |
| 39 |
ifndef LSI_CUT |
| 40 |
# enable compatible function. |
| 41 |
RCAR_LSI_CUT_COMPAT := 1 |
| 42 |
$(eval $(call add_define,RCAR_LSI_CUT_COMPAT)) |
| 43 |
else |
| 44 |
# disable compatible function. |
| 45 |
ifeq (${LSI_CUT},30) |
| 46 |
RCAR_LSI_CUT:=20 |
| 47 |
else |
| 48 |
$(error "Error: ${LSI_CUT} is not supported.") |
| 49 |
endif |
| 50 |
$(eval $(call add_define,RCAR_LSI_CUT)) |
| 51 |
endif |
| 52 |
else ifeq (${LSI},M3) |
| 53 |
RCAR_LSI:=${RCAR_M3} |
| 54 |
ifndef LSI_CUT |
| 55 |
# enable compatible function. |
| 56 |
RCAR_LSI_CUT_COMPAT := 1 |
| 57 |
$(eval $(call add_define,RCAR_LSI_CUT_COMPAT)) |
| 58 |
else |
| 59 |
# disable compatible function. |
| 60 |
ifeq (${LSI_CUT},10) |
| 61 |
RCAR_LSI_CUT:=0 |
| 62 |
else ifeq (${LSI_CUT},11) |
| 63 |
RCAR_LSI_CUT:=1 |
| 64 |
else ifeq (${LSI_CUT},13) |
| 65 |
RCAR_LSI_CUT:=3 |
| 66 |
else ifeq (${LSI_CUT},30) |
| 67 |
RCAR_LSI_CUT:=20 |
| 68 |
else |
| 69 |
$(error "Error: ${LSI_CUT} is not supported.") |
| 70 |
endif |
| 71 |
$(eval $(call add_define,RCAR_LSI_CUT)) |
| 72 |
endif |
| 73 |
else ifeq (${LSI},M3N) |
| 74 |
RCAR_LSI:=${RCAR_M3N} |
| 75 |
ifndef LSI_CUT |
| 76 |
# enable compatible function. |
| 77 |
RCAR_LSI_CUT_COMPAT := 1 |
| 78 |
$(eval $(call add_define,RCAR_LSI_CUT_COMPAT)) |
| 79 |
else |
| 80 |
# disable compatible function. |
| 81 |
ifeq (${LSI_CUT},10) |
| 82 |
RCAR_LSI_CUT:=0 |
| 83 |
else ifeq (${LSI_CUT},11) |
| 84 |
RCAR_LSI_CUT:=1 |
| 85 |
else |
| 86 |
$(error "Error: ${LSI_CUT} is not supported.") |
| 87 |
endif |
| 88 |
$(eval $(call add_define,RCAR_LSI_CUT)) |
| 89 |
endif |
| 90 |
else ifeq (${LSI},E3) |
| 91 |
RCAR_LSI:=${RCAR_E3} |
| 92 |
ifndef LSI_CUT |
| 93 |
# enable compatible function. |
| 94 |
RCAR_LSI_CUT_COMPAT := 1 |
| 95 |
$(eval $(call add_define,RCAR_LSI_CUT_COMPAT)) |
| 96 |
else |
| 97 |
# disable compatible function. |
| 98 |
ifeq (${LSI_CUT},10) |
| 99 |
RCAR_LSI_CUT:=0 |
| 100 |
else ifeq (${LSI_CUT},11) |
| 101 |
RCAR_LSI_CUT:=1 |
| 102 |
else |
| 103 |
$(error "Error: ${LSI_CUT} is not supported.") |
| 104 |
endif |
| 105 |
$(eval $(call add_define,RCAR_LSI_CUT)) |
| 106 |
endif |
| 107 |
else ifeq (${LSI},D3) |
| 108 |
RCAR_LSI:=${RCAR_D3} |
| 109 |
ifndef LSI_CUT |
| 110 |
# enable compatible function. |
| 111 |
RCAR_LSI_CUT_COMPAT := 1 |
| 112 |
$(eval $(call add_define,RCAR_LSI_CUT_COMPAT)) |
| 113 |
else |
| 114 |
# disable compatible function. |
| 115 |
ifeq (${LSI_CUT},10) |
| 116 |
RCAR_LSI_CUT:=0 |
| 117 |
else |
| 118 |
$(error "Error: ${LSI_CUT} is not supported.") |
| 119 |
endif |
| 120 |
$(eval $(call add_define,RCAR_LSI_CUT)) |
| 121 |
endif |
| 122 |
else ifeq (${LSI},V3M) |
| 123 |
RCAR_LSI:=${RCAR_V3M} |
| 124 |
ifndef LSI_CUT |
| 125 |
# enable compatible function. |
| 126 |
RCAR_LSI_CUT_COMPAT := 1 |
| 127 |
$(eval $(call add_define,RCAR_LSI_CUT_COMPAT)) |
| 128 |
else |
| 129 |
# disable compatible function. |
| 130 |
ifeq (${LSI_CUT},10) |
| 131 |
RCAR_LSI_CUT:=0 |
| 132 |
endif |
| 133 |
ifeq (${LSI_CUT},20) |
| 134 |
RCAR_LSI_CUT:=10 |
| 135 |
endif |
| 136 |
$(eval $(call add_define,RCAR_LSI_CUT)) |
| 137 |
endif |
| 138 |
else |
| 139 |
$(error "Error: ${LSI} is not supported.") |
| 140 |
endif |
| 141 |
$(eval $(call add_define,RCAR_LSI)) |
| 142 |
endif |
| 143 |
|
| 144 |
# lock RPC HYPERFLASH access by default |
| 145 |
# unlock to repogram the ATF firmware from u-boot |
| 146 |
ifndef RCAR_RPC_HYPERFLASH_LOCKED |
| 147 |
RCAR_RPC_HYPERFLASH_LOCKED := 1 |
| 148 |
endif |
| 149 |
$(eval $(call add_define,RCAR_RPC_HYPERFLASH_LOCKED)) |
| 150 |
|
| •151 |
# Support A/B switching with RPC HYPERFLASH access by default |
| 152 |
# Use together with https://github.com/marex/abloader . |
| 153 |
ifndef RCAR_RPC_HYPERFLASH_ABLOADER |
| 154 |
RCAR_RPC_HYPERFLASH_ABLOADER := 0 |
| 155 |
endif |
| 156 |
$(eval $(call add_define,RCAR_RPC_HYPERFLASH_ABLOADER)) |
| 157 |
|
| 158 |
# Process RCAR_SECURE_BOOT flag |
| 159 |
ifndef RCAR_SECURE_BOOT |
| 160 |
RCAR_SECURE_BOOT := 1 |
| 161 |
endif |
| 162 |
$(eval $(call add_define,RCAR_SECURE_BOOT)) |
| 163 |
|
| 164 |
# Process RCAR_QOS_TYPE flag |
| 165 |
ifndef RCAR_QOS_TYPE |
| 166 |
RCAR_QOS_TYPE := 0 |
| 167 |
endif |
| 168 |
$(eval $(call add_define,RCAR_QOS_TYPE)) |
| 169 |
|
| 170 |
# Process RCAR_DRAM_SPLIT flag |
| 171 |
ifndef RCAR_DRAM_SPLIT |
| 172 |
RCAR_DRAM_SPLIT := 0 |
| 173 |
endif |
| 174 |
$(eval $(call add_define,RCAR_DRAM_SPLIT)) |
| 175 |
|
| 176 |
# Process RCAR_BL33_EXECUTION_EL flag |
| 177 |
ifndef RCAR_BL33_EXECUTION_EL |
| 178 |
RCAR_BL33_EXECUTION_EL := 0 |
| 179 |
endif |
| 180 |
$(eval $(call add_define,RCAR_BL33_EXECUTION_EL)) |
| 181 |
|
| 182 |
# Process RCAR_AVS_SETTING_ENABLE flag |
| 183 |
ifeq (${RCAR_AVS_SETTING_ENABLE},0) |
| 184 |
AVS_SETTING_ENABLE := 0 |
| 185 |
else |
| 186 |
AVS_SETTING_ENABLE := 1 |
| 187 |
endif |
| 188 |
$(eval $(call add_define,AVS_SETTING_ENABLE)) |
| 189 |
|
| 190 |
# Process RCAR_LOSSY_ENABLE flag |
| 191 |
ifndef RCAR_LOSSY_ENABLE |
| 192 |
RCAR_LOSSY_ENABLE := 0 |
| 193 |
endif |
| 194 |
$(eval $(call add_define,RCAR_LOSSY_ENABLE)) |
| 195 |
|
| 196 |
# Process LIFEC_DBSC_PROTECT_ENABLE flag |
| 197 |
ifndef LIFEC_DBSC_PROTECT_ENABLE |
| 198 |
LIFEC_DBSC_PROTECT_ENABLE := 1 |
| 199 |
endif |
| 200 |
$(eval $(call add_define,LIFEC_DBSC_PROTECT_ENABLE)) |
| 201 |
|
| 202 |
# Process PMIC_ROHM_BD9571 flag |
| 203 |
ifndef PMIC_ROHM_BD9571 |
| 204 |
PMIC_ROHM_BD9571 := 1 |
| 205 |
endif |
| 206 |
$(eval $(call add_define,PMIC_ROHM_BD9571)) |
| 207 |
|
| 208 |
# Process PMIC_LEVEL_MODE flag |
| 209 |
ifndef PMIC_LEVEL_MODE |
| 210 |
PMIC_LEVEL_MODE := 1 |
| 211 |
endif |
| 212 |
$(eval $(call add_define,PMIC_LEVEL_MODE)) |
| 213 |
|
| 214 |
# Process RCAR_GEN3_ULCB flag |
| 215 |
ifndef RCAR_GEN3_ULCB |
| 216 |
RCAR_GEN3_ULCB := 0 |
| 217 |
endif |
| 218 |
ifeq (${RCAR_GEN3_ULCB},1) |
| 219 |
BOARD_DEFAULT := 0x10 |
| 220 |
$(eval $(call add_define,BOARD_DEFAULT)) |
| 221 |
endif |
| 222 |
$(eval $(call add_define,RCAR_GEN3_ULCB)) |
| 223 |
|
| 224 |
# Process RCAR_REF_INT flag |
| 225 |
ifndef RCAR_REF_INT |
| 226 |
RCAR_REF_INT :=0 |
| 227 |
endif |
| 228 |
$(eval $(call add_define,RCAR_REF_INT)) |
| 229 |
|
| 230 |
# Process RCAR_REWT_TRAINING flag |
| 231 |
ifndef RCAR_REWT_TRAINING |
| 232 |
RCAR_REWT_TRAINING := 1 |
| 233 |
endif |
| 234 |
$(eval $(call add_define,RCAR_REWT_TRAINING)) |
| 235 |
|
| 236 |
# Process RCAR_SYSTEM_SUSPEND flag |
| 237 |
ifndef RCAR_SYSTEM_SUSPEND |
| 238 |
RCAR_SYSTEM_SUSPEND := 1 |
| 239 |
endif |
| 240 |
$(eval $(call add_define,RCAR_SYSTEM_SUSPEND)) |
| 241 |
|
| 242 |
# SYSTEM_SUSPEND requires power control of PMIC etc. |
| 243 |
# When executing SYSTEM_SUSPEND other than Salvator-X, Salvator-XS and Ebisu, |
| 244 |
# processing equivalent to that implemented in PMIC_ROHM_BD9571 is necessary. |
| 245 |
ifeq (${RCAR_SYSTEM_SUSPEND},1) |
| 246 |
ifeq (${PMIC_ROHM_BD9571},0) |
| 247 |
$(error "Error: When you want RCAR_SYSTEM_SUSPEND to be enable, please also set PMIC_ROHM_BD9571 to enable.") |
| 248 |
endif |
| 249 |
endif |
| 250 |
|
| 251 |
# Process RCAR_DRAM_LPDDR4_MEMCONF flag |
| 252 |
ifndef RCAR_DRAM_LPDDR4_MEMCONF |
| 253 |
RCAR_DRAM_LPDDR4_MEMCONF :=1 |
| 254 |
endif |
| 255 |
$(eval $(call add_define,RCAR_DRAM_LPDDR4_MEMCONF)) |
| 256 |
|
| 257 |
# Process RCAR_DRAM_MEMRANK flag |
| 258 |
ifndef RCAR_DRAM_MEMRANK |
| 259 |
RCAR_DRAM_MEMRANK :=0 |
| 260 |
endif |
| 261 |
$(eval $(call add_define,RCAR_DRAM_MEMRANK)) |
| 262 |
|
| 263 |
# Process RCAR_DRAM_DDR3L_MEMCONF flag |
| 264 |
ifndef RCAR_DRAM_DDR3L_MEMCONF |
| 265 |
RCAR_DRAM_DDR3L_MEMCONF :=1 |
| 266 |
endif |
| 267 |
$(eval $(call add_define,RCAR_DRAM_DDR3L_MEMCONF)) |
| 268 |
|
| 269 |
# Process RCAR_DRAM_DDR3L_MEMDUAL flag |
| 270 |
ifndef RCAR_DRAM_DDR3L_MEMDUAL |
| 271 |
RCAR_DRAM_DDR3L_MEMDUAL :=1 |
| 272 |
endif |
| 273 |
$(eval $(call add_define,RCAR_DRAM_DDR3L_MEMDUAL)) |
| 274 |
|
| 275 |
# Process RCAR_BL33_ARG0 flag |
| 276 |
ifdef RCAR_BL33_ARG0 |
| 277 |
$(eval $(call add_define,RCAR_BL33_ARG0)) |
| 278 |
endif |
| 279 |
|
| 280 |
#Process RCAR_BL2_DCACHE flag |
| 281 |
ifndef RCAR_BL2_DCACHE |
| 282 |
RCAR_BL2_DCACHE := 0 |
| 283 |
endif |
| 284 |
$(eval $(call add_define,RCAR_BL2_DCACHE)) |
| 285 |
|
| 286 |
# Process RCAR_DRAM_CHANNEL flag |
| 287 |
ifndef RCAR_DRAM_CHANNEL |
| 288 |
RCAR_DRAM_CHANNEL :=15 |
| 289 |
endif |
| 290 |
$(eval $(call add_define,RCAR_DRAM_CHANNEL)) |
| 291 |
|
| 292 |
#Process RCAR_SYSTEM_RESET_KEEPON_DDR flag |
| 293 |
ifndef RCAR_SYSTEM_RESET_KEEPON_DDR |
| 294 |
RCAR_SYSTEM_RESET_KEEPON_DDR := 0 |
| 295 |
endif |
| 296 |
$(eval $(call add_define,RCAR_SYSTEM_RESET_KEEPON_DDR)) |
| 297 |
|
| 298 |
ifndef RCAR_GEN3_BL33_GZIP |
| 299 |
RCAR_GEN3_BL33_GZIP := 0 |
| 300 |
endif |
| 301 |
$(eval $(call add_define,RCAR_GEN3_BL33_GZIP)) |
| 302 |
|
| 303 |
# RCAR_SYSTEM_RESET_KEEPON_DDR requires power control of PMIC etc. |
| 304 |
# When executing SYSTEM_SUSPEND other than Salvator-X, Salvator-XS and Ebisu, |
| 305 |
# processing equivalent to that implemented in PMIC_ROHM_BD9571 is necessary. |
| 306 |
# Also, it is necessary to enable RCAR_SYSTEM_SUSPEND. |
| 307 |
ifeq (${RCAR_SYSTEM_RESET_KEEPON_DDR},1) |
| 308 |
ifeq (${PMIC_ROHM_BD9571},0) |
| 309 |
$(error "Error: When you want RCAR_SYSTEM_RESET_KEEPON_DDR to be enable, please also set PMIC_ROHM_BD9571 to enable.") |
| 310 |
endif |
| 311 |
ifeq (${RCAR_SYSTEM_SUSPEND},0) |
| 312 |
$(error "Error: When you want RCAR_SYSTEM_RESET_KEEPON_DDR to be enable, please also set RCAR_SYSTEM_SUSPEND to enable.") |
| 313 |
endif |
| 314 |
endif |
| 315 |
|
| 316 |
include drivers/renesas/common/ddr/ddr.mk |
| 317 |
include drivers/renesas/rcar/qos/qos.mk |
| 318 |
include drivers/renesas/rcar/pfc/pfc.mk |
| 319 |
include lib/libfdt/libfdt.mk |
| 320 |
|
| 321 |
PLAT_INCLUDES += -Idrivers/renesas/common/ddr \ |
| 322 |
-Idrivers/renesas/rcar/qos \ |
| 323 |
-Idrivers/renesas/rcar/board \ |
| 324 |
-Idrivers/renesas/rcar/cpld/ \ |
| 325 |
-Idrivers/renesas/common \ |
| 326 |
-Idrivers/renesas/common/iic_dvfs \ |
| 327 |
-Idrivers/renesas/common/avs \ |
| 328 |
-Idrivers/renesas/common/delay \ |
| 329 |
-Idrivers/renesas/common/rom \ |
| 330 |
-Idrivers/renesas/common/scif \ |
| 331 |
-Idrivers/renesas/common/emmc \ |
| 332 |
-Idrivers/renesas/common/pwrc \ |
| 333 |
-Idrivers/renesas/common/io |
| 334 |
|
| 335 |
BL2_SOURCES += plat/renesas/rcar/bl2_plat_setup.c \ |
| 336 |
drivers/renesas/rcar/board/board.c |
| 337 |
|
| 338 |
ifeq (${RCAR_GEN3_BL33_GZIP},1) |
| 339 |
include lib/zlib/zlib.mk |
| 340 |
|
| 341 |
BL2_SOURCES += common/image_decompress.c \ |
| 342 |
$(ZLIB_SOURCES) |
| 343 |
endif |
| 344 |
|
| 345 |
ifneq (${ENABLE_STACK_PROTECTOR},0) |
| 346 |
BL_COMMON_SOURCES += plat/renesas/rcar/rcar_stack_protector.c |
| 347 |
endif |
| 348 |
|
| 349 |
ifeq (${RCAR_GEN3_ULCB},1) |
| 350 |
BL31_SOURCES += drivers/renesas/rcar/cpld/ulcb_cpld.c |
| 351 |
endif |
| 352 |
|
| 353 |
# build the layout images for the bootrom and the necessary srecords |
| 354 |
rcar: rcar_layout_tool rcar_srecord |
| 355 |
distclean realclean clean: clean_layout_tool clean_srecord |
| 356 |
|
| 357 |
# layout images |
| 358 |
LAYOUT_TOOLPATH ?= tools/renesas/rcar_layout_create |
| 359 |
|
| 360 |
clean_layout_tool: |
| 361 |
$(s)echo "clean layout tool" |
| 362 |
$(q)${MAKE} -C ${LAYOUT_TOOLPATH} clean |
| 363 |
|
| 364 |
.PHONY: rcar_layout_tool |
| 365 |
rcar_layout_tool: |
| 366 |
$(s)echo "generating layout srecs" |
| 367 |
$(q)${MAKE} CPPFLAGS="-D=AARCH64" --no-print-directory -C ${LAYOUT_TOOLPATH} |
| 368 |
|
| 369 |
# srecords |
| 370 |
SREC_PATH = ${BUILD_PLAT} |
| 371 |
BL2_ELF_SRC = ${SREC_PATH}/bl2/bl2.elf |
| 372 |
BL31_ELF_SRC = ${SREC_PATH}/bl31/bl31.elf |
| 373 |
|
| 374 |
clean_srecord: |
| 375 |
$(s)echo "clean bl2 and bl31 srecs" |
| 376 |
rm -f ${SREC_PATH}/bl2.srec ${SREC_PATH}/bl31.srec |
| 377 |
|
| 378 |
$(SREC_PATH)/bl2.srec: $(BL2_ELF_SRC) |
| 379 |
$(s)echo "generating srec: $(SREC_PATH)/bl2.srec" |
| 380 |
$(q)$($(ARCH)-oc) -O srec --srec-forceS3 $(BL2_ELF_SRC) $(SREC_PATH)/bl2.srec |
| 381 |
|
| 382 |
$(SREC_PATH)/bl31.srec: $(BL31_ELF_SRC) |
| 383 |
$(s)echo "generating srec: $(SREC_PATH)/bl31.srec" |
| 384 |
$(q)$($(ARCH)-oc) -O srec --srec-forceS3 $(BL31_ELF_SRC) $(SREC_PATH)/bl31.srec |
| 385 |
|
| 386 |
.PHONY: rcar_srecord |
| 387 |
rcar_srecord: $(SREC_PATH)/bl2.srec $(SREC_PATH)/bl31.srec |