Biju Das | 54f6a43 | 2020-12-07 16:31:01 +0000 | [diff] [blame] | 1 | # |
| 2 | # Copyright (c) 2018-2020, 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 | 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 |
| 35 | else |
| 36 | $(error "Error: ${LSI} is not supported.") |
| 37 | endif |
| 38 | $(eval $(call add_define,RCAR_LSI)) |
| 39 | endif |
| 40 | |
| 41 | # Process RZG_LCS_STATE_DETECTION_ENABLE flag |
| 42 | # Enable to get LCS state information |
| 43 | ifndef RZG_LCS_STATE_DETECTION_ENABLE |
| 44 | RZG_LCS_STATE_DETECTION_ENABLE := 0 |
| 45 | endif |
| 46 | $(eval $(call add_define,RZG_LCS_STATE_DETECTION_ENABLE)) |
| 47 | |
| 48 | # Process RCAR_SECURE_BOOT flag |
| 49 | ifndef RCAR_SECURE_BOOT |
| 50 | RCAR_SECURE_BOOT := 0 |
| 51 | endif |
| 52 | $(eval $(call add_define,RCAR_SECURE_BOOT)) |
| 53 | |
| 54 | # LCS state of RZ/G2 Chip is all CM. |
| 55 | # However certain chips(RZ/G2M and RZ/G2E) have incorrect factory Fuse settings |
| 56 | # which results in getting incorrect LCS states |
| 57 | # if need to enable RCAR_SECURE_BOOT, make sure the chip has proper factory Fuse settings. |
| 58 | ifeq (${RCAR_SECURE_BOOT},1) |
| 59 | ifeq (${RZG_LCS_STATE_DETECTION_ENABLE},0) |
| 60 | $(error "Error: Please check the chip has proper factory Fuse settings and set RZG_LCS_STATE_DETECTION_ENABLE to enable.") |
| 61 | endif |
| 62 | endif |
| 63 | |
| 64 | # lock RPC HYPERFLASH access by default |
| 65 | # unlock to repogram the ATF firmware from u-boot |
| 66 | ifndef RCAR_RPC_HYPERFLASH_LOCKED |
| 67 | RCAR_RPC_HYPERFLASH_LOCKED := 1 |
| 68 | endif |
| 69 | $(eval $(call add_define,RCAR_RPC_HYPERFLASH_LOCKED)) |
| 70 | |
| 71 | # Process RCAR_QOS_TYPE flag |
| 72 | ifndef RCAR_QOS_TYPE |
| 73 | RCAR_QOS_TYPE := 0 |
| 74 | endif |
| 75 | $(eval $(call add_define,RCAR_QOS_TYPE)) |
| 76 | |
| 77 | # Process RCAR_DRAM_SPLIT flag |
| 78 | ifndef RCAR_DRAM_SPLIT |
| 79 | RCAR_DRAM_SPLIT := 0 |
| 80 | endif |
| 81 | $(eval $(call add_define,RCAR_DRAM_SPLIT)) |
| 82 | |
| 83 | # Process RCAR_BL33_EXECUTION_EL flag |
| 84 | ifndef RCAR_BL33_EXECUTION_EL |
| 85 | RCAR_BL33_EXECUTION_EL := 0 |
| 86 | endif |
| 87 | $(eval $(call add_define,RCAR_BL33_EXECUTION_EL)) |
| 88 | |
| 89 | # Process RCAR_AVS_SETTING_ENABLE flag |
| 90 | ifndef AVS_SETTING_ENABLE |
| 91 | AVS_SETTING_ENABLE := 0 |
| 92 | endif |
| 93 | $(eval $(call add_define,AVS_SETTING_ENABLE)) |
| 94 | |
| 95 | # Process RCAR_LOSSY_ENABLE flag |
| 96 | ifndef RCAR_LOSSY_ENABLE |
| 97 | RCAR_LOSSY_ENABLE := 0 |
| 98 | endif |
| 99 | $(eval $(call add_define,RCAR_LOSSY_ENABLE)) |
| 100 | |
| 101 | # Process LIFEC_DBSC_PROTECT_ENABLE flag |
| 102 | ifndef LIFEC_DBSC_PROTECT_ENABLE |
| 103 | LIFEC_DBSC_PROTECT_ENABLE := 1 |
| 104 | endif |
| 105 | $(eval $(call add_define,LIFEC_DBSC_PROTECT_ENABLE)) |
| 106 | |
| 107 | # Process RCAR_GEN3_ULCB flag |
| 108 | ifndef RCAR_GEN3_ULCB |
| 109 | RCAR_GEN3_ULCB := 0 |
| 110 | endif |
| 111 | |
| 112 | # Process RCAR_REF_INT flag |
| 113 | ifndef RCAR_REF_INT |
| 114 | RCAR_REF_INT :=0 |
| 115 | endif |
| 116 | $(eval $(call add_define,RCAR_REF_INT)) |
| 117 | |
| 118 | # Process RCAR_REWT_TRAINING flag |
| 119 | ifndef RCAR_REWT_TRAINING |
| 120 | RCAR_REWT_TRAINING := 1 |
| 121 | endif |
| 122 | $(eval $(call add_define,RCAR_REWT_TRAINING)) |
| 123 | |
| 124 | # Process RCAR_SYSTEM_SUSPEND flag |
| 125 | ifndef RCAR_SYSTEM_SUSPEND |
| 126 | RCAR_SYSTEM_SUSPEND := 0 |
| 127 | endif |
| 128 | $(eval $(call add_define,RCAR_SYSTEM_SUSPEND)) |
| 129 | |
| 130 | # Process RCAR_DRAM_LPDDR4_MEMCONF flag |
| 131 | ifndef RCAR_DRAM_LPDDR4_MEMCONF |
| 132 | RCAR_DRAM_LPDDR4_MEMCONF :=1 |
| 133 | endif |
| 134 | $(eval $(call add_define,RCAR_DRAM_LPDDR4_MEMCONF)) |
| 135 | |
| 136 | # Process RCAR_DRAM_DDR3L_MEMCONF flag |
| 137 | ifndef RCAR_DRAM_DDR3L_MEMCONF |
| 138 | RCAR_DRAM_DDR3L_MEMCONF :=1 |
| 139 | endif |
| 140 | $(eval $(call add_define,RCAR_DRAM_DDR3L_MEMCONF)) |
| 141 | |
| 142 | # Process RCAR_DRAM_DDR3L_MEMDUAL flag |
| 143 | ifndef RCAR_DRAM_DDR3L_MEMDUAL |
| 144 | RCAR_DRAM_DDR3L_MEMDUAL :=1 |
| 145 | endif |
| 146 | $(eval $(call add_define,RCAR_DRAM_DDR3L_MEMDUAL)) |
| 147 | |
| 148 | # Process RCAR_BL33_ARG0 flag |
| 149 | ifdef RCAR_BL33_ARG0 |
| 150 | $(eval $(call add_define,RCAR_BL33_ARG0)) |
| 151 | endif |
| 152 | |
| 153 | #Process RCAR_BL2_DCACHE flag |
| 154 | ifndef RCAR_BL2_DCACHE |
| 155 | RCAR_BL2_DCACHE := 0 |
| 156 | endif |
| 157 | $(eval $(call add_define,RCAR_BL2_DCACHE)) |
| 158 | |
| 159 | # Process RCAR_DRAM_CHANNEL flag |
| 160 | ifndef RCAR_DRAM_CHANNEL |
| 161 | RCAR_DRAM_CHANNEL :=15 |
| 162 | endif |
| 163 | $(eval $(call add_define,RCAR_DRAM_CHANNEL)) |
| 164 | |
| 165 | #Process RCAR_SYSTEM_RESET_KEEPON_DDR flag |
| 166 | ifndef RCAR_SYSTEM_RESET_KEEPON_DDR |
| 167 | RCAR_SYSTEM_RESET_KEEPON_DDR := 0 |
| 168 | endif |
| 169 | $(eval $(call add_define,RCAR_SYSTEM_RESET_KEEPON_DDR)) |
| 170 | |
| 171 | include drivers/renesas/rzg/ddr/ddr.mk |
| 172 | include drivers/renesas/rzg/qos/qos.mk |
| 173 | include drivers/renesas/rzg/pfc/pfc.mk |
| 174 | include lib/libfdt/libfdt.mk |
| 175 | |
| 176 | PLAT_INCLUDES += -Idrivers/renesas/rzg/ddr \ |
| 177 | -Idrivers/renesas/rzg/qos \ |
| 178 | -Idrivers/renesas/rzg/board \ |
| 179 | -Idrivers/renesas/common \ |
| 180 | -Idrivers/renesas/common/iic_dvfs \ |
| 181 | -Idrivers/renesas/common/avs \ |
| 182 | -Idrivers/renesas/common/delay \ |
| 183 | -Idrivers/renesas/common/rom \ |
| 184 | -Idrivers/renesas/common/scif \ |
| 185 | -Idrivers/renesas/common/emmc \ |
| 186 | -Idrivers/renesas/common/pwrc \ |
| 187 | -Idrivers/renesas/common/io |
| 188 | |
| 189 | BL2_SOURCES += plat/renesas/rzg/bl2_plat_setup.c \ |
| 190 | drivers/renesas/rzg/board/board.c |
| 191 | |
| 192 | # build the layout images for the bootrom and the necessary srecords |
| 193 | rzg: rzg_layout_create rzg_srecord |
| 194 | distclean realclean clean: clean_layout_tool clean_srecord |
| 195 | |
| 196 | # layout images |
| 197 | LAYOUT_TOOLPATH ?= tools/renesas/rzg_layout_create |
| 198 | |
| 199 | clean_layout_tool: |
| 200 | @echo "clean layout tool" |
| 201 | ${Q}${MAKE} -C ${LAYOUT_TOOLPATH} clean |
| 202 | |
| 203 | .PHONY: rzg_layout_create |
| 204 | rzg_layout_create: |
| 205 | @echo "generating layout srecs" |
| 206 | ${Q}${MAKE} CPPFLAGS="-D=AARCH64" --no-print-directory -C ${LAYOUT_TOOLPATH} |
| 207 | |
| 208 | # srecords |
| 209 | SREC_PATH = ${BUILD_PLAT} |
| 210 | BL2_ELF_SRC = ${SREC_PATH}/bl2/bl2.elf |
| 211 | BL31_ELF_SRC = ${SREC_PATH}/bl31/bl31.elf |
| 212 | |
| 213 | clean_srecord: |
| 214 | @echo "clean bl2 and bl31 srecs" |
| 215 | rm -f ${SREC_PATH}/bl2.srec ${SREC_PATH}/bl31.srec |
| 216 | |
| 217 | .PHONY: rzg_srecord |
| 218 | rzg_srecord: $(BL2_ELF_SRC) $(BL31_ELF_SRC) |
| 219 | @echo "generating srec: ${SREC_PATH}/bl2.srec" |
| 220 | $(Q)$(OC) -O srec --srec-forceS3 ${BL2_ELF_SRC} ${SREC_PATH}/bl2.srec |
| 221 | @echo "generating srec: ${SREC_PATH}/bl31.srec" |
| 222 | $(Q)$(OC) -O srec --srec-forceS3 ${BL31_ELF_SRC} ${SREC_PATH}/bl31.srec |