Biju Das | 54f6a43 | 2020-12-07 16:31:01 +0000 | [diff] [blame] | 1 | # |
Lad Prabhakar | 9f2b579 | 2021-03-10 14:30:20 +0000 | [diff] [blame] | 2 | # Copyright (c) 2018-2021, Renesas Electronics Corporation. All rights reserved. |
Biju Das | 54f6a43 | 2020-12-07 16:31:01 +0000 | [diff] [blame] | 3 | # |
| 4 | # SPDX-License-Identifier: BSD-3-Clause |
| 5 | # |
| 6 | |
| 7 | include plat/renesas/common/common.mk |
| 8 | |
| 9 | ifndef LSI |
| 10 | $(error "Error: Unknown LSI. Please use LSI=<LSI name> to specify the LSI") |
| 11 | else |
| 12 | ifeq (${LSI},AUTO) |
| 13 | RCAR_LSI:=${RCAR_AUTO} |
| 14 | else ifeq (${LSI},G2M) |
| 15 | RCAR_LSI:=${RZ_G2M} |
| 16 | ifndef LSI_CUT |
| 17 | # enable compatible function. |
| 18 | RCAR_LSI_CUT_COMPAT := 1 |
| 19 | $(eval $(call add_define,RCAR_LSI_CUT_COMPAT)) |
| 20 | else |
| 21 | # disable compatible function. |
| 22 | ifeq (${LSI_CUT},10) |
| 23 | RCAR_LSI_CUT:=0 |
| 24 | else ifeq (${LSI_CUT},11) |
| 25 | RCAR_LSI_CUT:=1 |
| 26 | else ifeq (${LSI_CUT},13) |
| 27 | RCAR_LSI_CUT:=3 |
| 28 | else ifeq (${LSI_CUT},30) |
| 29 | RCAR_LSI_CUT:=20 |
| 30 | else |
| 31 | $(error "Error: ${LSI_CUT} is not supported.") |
| 32 | endif |
| 33 | $(eval $(call add_define,RCAR_LSI_CUT)) |
| 34 | endif |
Lad Prabhakar | e1c0f74 | 2020-12-21 13:51:58 +0000 | [diff] [blame] | 35 | else ifeq (${LSI},G2H) |
| 36 | RCAR_LSI:=${RZ_G2H} |
| 37 | ifndef LSI_CUT |
| 38 | # enable compatible function. |
| 39 | RCAR_LSI_CUT_COMPAT := 1 |
| 40 | $(eval $(call add_define,RCAR_LSI_CUT_COMPAT)) |
| 41 | else |
| 42 | # disable compatible function. |
| 43 | ifeq (${LSI_CUT},30) |
| 44 | RCAR_LSI_CUT:=20 |
| 45 | else |
| 46 | $(error "Error: ${LSI_CUT} is not supported.") |
| 47 | endif |
| 48 | $(eval $(call add_define,RCAR_LSI_CUT)) |
| 49 | endif |
Lad Prabhakar | 21d04f0 | 2021-03-19 12:01:00 +0000 | [diff] [blame] | 50 | else ifeq (${LSI},G2N) |
| 51 | RCAR_LSI:=${RZ_G2N} |
| 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 |
| 63 | $(error "Error: ${LSI_CUT} is not supported.") |
| 64 | endif |
| 65 | $(eval $(call add_define,RCAR_LSI_CUT)) |
| 66 | endif |
Biju Das | 54f6a43 | 2020-12-07 16:31:01 +0000 | [diff] [blame] | 67 | else |
| 68 | $(error "Error: ${LSI} is not supported.") |
| 69 | endif |
| 70 | $(eval $(call add_define,RCAR_LSI)) |
| 71 | endif |
| 72 | |
| 73 | # Process RZG_LCS_STATE_DETECTION_ENABLE flag |
| 74 | # Enable to get LCS state information |
| 75 | ifndef RZG_LCS_STATE_DETECTION_ENABLE |
| 76 | RZG_LCS_STATE_DETECTION_ENABLE := 0 |
| 77 | endif |
| 78 | $(eval $(call add_define,RZG_LCS_STATE_DETECTION_ENABLE)) |
| 79 | |
| 80 | # Process RCAR_SECURE_BOOT flag |
| 81 | ifndef RCAR_SECURE_BOOT |
| 82 | RCAR_SECURE_BOOT := 0 |
| 83 | endif |
| 84 | $(eval $(call add_define,RCAR_SECURE_BOOT)) |
| 85 | |
| 86 | # LCS state of RZ/G2 Chip is all CM. |
| 87 | # However certain chips(RZ/G2M and RZ/G2E) have incorrect factory Fuse settings |
| 88 | # which results in getting incorrect LCS states |
| 89 | # if need to enable RCAR_SECURE_BOOT, make sure the chip has proper factory Fuse settings. |
| 90 | ifeq (${RCAR_SECURE_BOOT},1) |
| 91 | ifeq (${RZG_LCS_STATE_DETECTION_ENABLE},0) |
| 92 | $(error "Error: Please check the chip has proper factory Fuse settings and set RZG_LCS_STATE_DETECTION_ENABLE to enable.") |
| 93 | endif |
| 94 | endif |
| 95 | |
| 96 | # lock RPC HYPERFLASH access by default |
| 97 | # unlock to repogram the ATF firmware from u-boot |
| 98 | ifndef RCAR_RPC_HYPERFLASH_LOCKED |
| 99 | RCAR_RPC_HYPERFLASH_LOCKED := 1 |
| 100 | endif |
| 101 | $(eval $(call add_define,RCAR_RPC_HYPERFLASH_LOCKED)) |
| 102 | |
| 103 | # Process RCAR_QOS_TYPE flag |
| 104 | ifndef RCAR_QOS_TYPE |
| 105 | RCAR_QOS_TYPE := 0 |
| 106 | endif |
| 107 | $(eval $(call add_define,RCAR_QOS_TYPE)) |
| 108 | |
| 109 | # Process RCAR_DRAM_SPLIT flag |
| 110 | ifndef RCAR_DRAM_SPLIT |
| 111 | RCAR_DRAM_SPLIT := 0 |
| 112 | endif |
| 113 | $(eval $(call add_define,RCAR_DRAM_SPLIT)) |
| 114 | |
| 115 | # Process RCAR_BL33_EXECUTION_EL flag |
| 116 | ifndef RCAR_BL33_EXECUTION_EL |
| 117 | RCAR_BL33_EXECUTION_EL := 0 |
| 118 | endif |
| 119 | $(eval $(call add_define,RCAR_BL33_EXECUTION_EL)) |
| 120 | |
| 121 | # Process RCAR_AVS_SETTING_ENABLE flag |
| 122 | ifndef AVS_SETTING_ENABLE |
| 123 | AVS_SETTING_ENABLE := 0 |
| 124 | endif |
| 125 | $(eval $(call add_define,AVS_SETTING_ENABLE)) |
| 126 | |
| 127 | # Process RCAR_LOSSY_ENABLE flag |
| 128 | ifndef RCAR_LOSSY_ENABLE |
| 129 | RCAR_LOSSY_ENABLE := 0 |
| 130 | endif |
| 131 | $(eval $(call add_define,RCAR_LOSSY_ENABLE)) |
| 132 | |
| 133 | # Process LIFEC_DBSC_PROTECT_ENABLE flag |
| 134 | ifndef LIFEC_DBSC_PROTECT_ENABLE |
| 135 | LIFEC_DBSC_PROTECT_ENABLE := 1 |
| 136 | endif |
| 137 | $(eval $(call add_define,LIFEC_DBSC_PROTECT_ENABLE)) |
| 138 | |
| 139 | # Process RCAR_GEN3_ULCB flag |
| 140 | ifndef RCAR_GEN3_ULCB |
| 141 | RCAR_GEN3_ULCB := 0 |
| 142 | endif |
| 143 | |
| 144 | # Process RCAR_REF_INT flag |
| 145 | ifndef RCAR_REF_INT |
| 146 | RCAR_REF_INT :=0 |
| 147 | endif |
| 148 | $(eval $(call add_define,RCAR_REF_INT)) |
| 149 | |
| 150 | # Process RCAR_REWT_TRAINING flag |
| 151 | ifndef RCAR_REWT_TRAINING |
| 152 | RCAR_REWT_TRAINING := 1 |
| 153 | endif |
| 154 | $(eval $(call add_define,RCAR_REWT_TRAINING)) |
| 155 | |
| 156 | # Process RCAR_SYSTEM_SUSPEND flag |
| 157 | ifndef RCAR_SYSTEM_SUSPEND |
| 158 | RCAR_SYSTEM_SUSPEND := 0 |
| 159 | endif |
| 160 | $(eval $(call add_define,RCAR_SYSTEM_SUSPEND)) |
| 161 | |
| 162 | # Process RCAR_DRAM_LPDDR4_MEMCONF flag |
| 163 | ifndef RCAR_DRAM_LPDDR4_MEMCONF |
| 164 | RCAR_DRAM_LPDDR4_MEMCONF :=1 |
| 165 | endif |
| 166 | $(eval $(call add_define,RCAR_DRAM_LPDDR4_MEMCONF)) |
| 167 | |
| 168 | # Process RCAR_DRAM_DDR3L_MEMCONF flag |
| 169 | ifndef RCAR_DRAM_DDR3L_MEMCONF |
| 170 | RCAR_DRAM_DDR3L_MEMCONF :=1 |
| 171 | endif |
| 172 | $(eval $(call add_define,RCAR_DRAM_DDR3L_MEMCONF)) |
| 173 | |
| 174 | # Process RCAR_DRAM_DDR3L_MEMDUAL flag |
| 175 | ifndef RCAR_DRAM_DDR3L_MEMDUAL |
| 176 | RCAR_DRAM_DDR3L_MEMDUAL :=1 |
| 177 | endif |
| 178 | $(eval $(call add_define,RCAR_DRAM_DDR3L_MEMDUAL)) |
| 179 | |
| 180 | # Process RCAR_BL33_ARG0 flag |
| 181 | ifdef RCAR_BL33_ARG0 |
| 182 | $(eval $(call add_define,RCAR_BL33_ARG0)) |
| 183 | endif |
| 184 | |
| 185 | #Process RCAR_BL2_DCACHE flag |
| 186 | ifndef RCAR_BL2_DCACHE |
| 187 | RCAR_BL2_DCACHE := 0 |
| 188 | endif |
| 189 | $(eval $(call add_define,RCAR_BL2_DCACHE)) |
| 190 | |
| 191 | # Process RCAR_DRAM_CHANNEL flag |
| 192 | ifndef RCAR_DRAM_CHANNEL |
| 193 | RCAR_DRAM_CHANNEL :=15 |
| 194 | endif |
| 195 | $(eval $(call add_define,RCAR_DRAM_CHANNEL)) |
| 196 | |
| 197 | #Process RCAR_SYSTEM_RESET_KEEPON_DDR flag |
| 198 | ifndef RCAR_SYSTEM_RESET_KEEPON_DDR |
| 199 | RCAR_SYSTEM_RESET_KEEPON_DDR := 0 |
| 200 | endif |
| 201 | $(eval $(call add_define,RCAR_SYSTEM_RESET_KEEPON_DDR)) |
| 202 | |
Lad Prabhakar | 9f2b579 | 2021-03-10 14:30:20 +0000 | [diff] [blame] | 203 | RZG_SOC :=1 |
| 204 | $(eval $(call add_define,RZG_SOC)) |
| 205 | |
| 206 | include drivers/renesas/common/ddr/ddr.mk |
Biju Das | 54f6a43 | 2020-12-07 16:31:01 +0000 | [diff] [blame] | 207 | include drivers/renesas/rzg/qos/qos.mk |
| 208 | include drivers/renesas/rzg/pfc/pfc.mk |
| 209 | include lib/libfdt/libfdt.mk |
| 210 | |
Lad Prabhakar | 9f2b579 | 2021-03-10 14:30:20 +0000 | [diff] [blame] | 211 | PLAT_INCLUDES += -Idrivers/renesas/common/ddr \ |
Biju Das | 54f6a43 | 2020-12-07 16:31:01 +0000 | [diff] [blame] | 212 | -Idrivers/renesas/rzg/qos \ |
| 213 | -Idrivers/renesas/rzg/board \ |
| 214 | -Idrivers/renesas/common \ |
| 215 | -Idrivers/renesas/common/iic_dvfs \ |
| 216 | -Idrivers/renesas/common/avs \ |
| 217 | -Idrivers/renesas/common/delay \ |
| 218 | -Idrivers/renesas/common/rom \ |
| 219 | -Idrivers/renesas/common/scif \ |
| 220 | -Idrivers/renesas/common/emmc \ |
| 221 | -Idrivers/renesas/common/pwrc \ |
| 222 | -Idrivers/renesas/common/io |
| 223 | |
| 224 | BL2_SOURCES += plat/renesas/rzg/bl2_plat_setup.c \ |
| 225 | drivers/renesas/rzg/board/board.c |
| 226 | |
| 227 | # build the layout images for the bootrom and the necessary srecords |
| 228 | rzg: rzg_layout_create rzg_srecord |
| 229 | distclean realclean clean: clean_layout_tool clean_srecord |
| 230 | |
| 231 | # layout images |
| 232 | LAYOUT_TOOLPATH ?= tools/renesas/rzg_layout_create |
| 233 | |
| 234 | clean_layout_tool: |
| 235 | @echo "clean layout tool" |
| 236 | ${Q}${MAKE} -C ${LAYOUT_TOOLPATH} clean |
| 237 | |
| 238 | .PHONY: rzg_layout_create |
| 239 | rzg_layout_create: |
| 240 | @echo "generating layout srecs" |
| 241 | ${Q}${MAKE} CPPFLAGS="-D=AARCH64" --no-print-directory -C ${LAYOUT_TOOLPATH} |
| 242 | |
| 243 | # srecords |
| 244 | SREC_PATH = ${BUILD_PLAT} |
| 245 | BL2_ELF_SRC = ${SREC_PATH}/bl2/bl2.elf |
| 246 | BL31_ELF_SRC = ${SREC_PATH}/bl31/bl31.elf |
| 247 | |
| 248 | clean_srecord: |
| 249 | @echo "clean bl2 and bl31 srecs" |
| 250 | rm -f ${SREC_PATH}/bl2.srec ${SREC_PATH}/bl31.srec |
| 251 | |
| 252 | .PHONY: rzg_srecord |
| 253 | rzg_srecord: $(BL2_ELF_SRC) $(BL31_ELF_SRC) |
| 254 | @echo "generating srec: ${SREC_PATH}/bl2.srec" |
| 255 | $(Q)$(OC) -O srec --srec-forceS3 ${BL2_ELF_SRC} ${SREC_PATH}/bl2.srec |
| 256 | @echo "generating srec: ${SREC_PATH}/bl31.srec" |
| 257 | $(Q)$(OC) -O srec --srec-forceS3 ${BL31_ELF_SRC} ${SREC_PATH}/bl31.srec |