xref: /rk3399_ARM-atf/plat/renesas/rcar/platform.mk (revision cf6c30e08ba54a22a0ce8abd6eac8b1d1ccad324)
1#
2# Copyright (c) 2018, Renesas Electronics Corporation. All rights reserved.
3#
4# SPDX-License-Identifier: BSD-3-Clause
5#
6
7PROGRAMMABLE_RESET_ADDRESS	:= 0
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
16CRASH_REPORTING			:= 1
17HANDLE_EA_EL3_FIRST		:= 1
18
19$(eval $(call add_define,PLAT_EXTRA_LD_SCRIPT))
20
21ifeq (${SPD},none)
22  SPD_NONE:=1
23  $(eval $(call add_define,SPD_NONE))
24endif
25
26# LSI setting common define
27RCAR_H3:=0
28RCAR_M3:=1
29RCAR_M3N:=2
30RCAR_E3:=3
31RCAR_H3N:=4
32RCAR_AUTO:=99
33$(eval $(call add_define,RCAR_H3))
34$(eval $(call add_define,RCAR_M3))
35$(eval $(call add_define,RCAR_M3N))
36$(eval $(call add_define,RCAR_E3))
37$(eval $(call add_define,RCAR_H3N))
38$(eval $(call add_define,RCAR_AUTO))
39RCAR_CUT_10:=0
40RCAR_CUT_11:=1
41RCAR_CUT_13:=3
42RCAR_CUT_20:=10
43RCAR_CUT_30:=20
44$(eval $(call add_define,RCAR_CUT_10))
45$(eval $(call add_define,RCAR_CUT_11))
46$(eval $(call add_define,RCAR_CUT_13))
47$(eval $(call add_define,RCAR_CUT_20))
48$(eval $(call add_define,RCAR_CUT_30))
49
50ifndef LSI
51  $(error "Error: Unknown LSI. Please use LSI=<LSI name> to specify the LSI")
52else
53  ifeq (${LSI},AUTO)
54    RCAR_LSI:=${RCAR_AUTO}
55  else ifeq (${LSI},H3)
56    RCAR_LSI:=${RCAR_H3}
57    ifndef LSI_CUT
58      # enable compatible function.
59      RCAR_LSI_CUT_COMPAT := 1
60      $(eval $(call add_define,RCAR_LSI_CUT_COMPAT))
61    else
62      # disable compatible function.
63      ifeq (${LSI_CUT},10)
64        RCAR_LSI_CUT:=0
65      else ifeq (${LSI_CUT},11)
66        RCAR_LSI_CUT:=1
67      else ifeq (${LSI_CUT},20)
68        RCAR_LSI_CUT:=10
69      else ifeq (${LSI_CUT},30)
70        RCAR_LSI_CUT:=20
71      else
72        $(error "Error: ${LSI_CUT} is not supported.")
73      endif
74      $(eval $(call add_define,RCAR_LSI_CUT))
75    endif
76  else ifeq (${LSI},H3N)
77    RCAR_LSI:=${RCAR_H3N}
78    ifndef LSI_CUT
79      # enable compatible function.
80      RCAR_LSI_CUT_COMPAT := 1
81      $(eval $(call add_define,RCAR_LSI_CUT_COMPAT))
82    else
83      # disable compatible function.
84      ifeq (${LSI_CUT},30)
85        RCAR_LSI_CUT:=20
86      else
87        $(error "Error: ${LSI_CUT} is not supported.")
88      endif
89      $(eval $(call add_define,RCAR_LSI_CUT))
90    endif
91  else ifeq (${LSI},M3)
92    RCAR_LSI:=${RCAR_M3}
93    ifndef LSI_CUT
94      # enable compatible function.
95      RCAR_LSI_CUT_COMPAT := 1
96      $(eval $(call add_define,RCAR_LSI_CUT_COMPAT))
97    else
98      # disable compatible function.
99      ifeq (${LSI_CUT},10)
100        RCAR_LSI_CUT:=0
101      else ifeq (${LSI_CUT},11)
102        RCAR_LSI_CUT:=1
103      else ifeq (${LSI_CUT},13)
104        RCAR_LSI_CUT:=3
105      else ifeq (${LSI_CUT},30)
106        RCAR_LSI_CUT:=20
107      else
108        $(error "Error: ${LSI_CUT} is not supported.")
109      endif
110      $(eval $(call add_define,RCAR_LSI_CUT))
111    endif
112  else ifeq (${LSI},M3N)
113    RCAR_LSI:=${RCAR_M3N}
114    ifndef LSI_CUT
115      # enable compatible function.
116      RCAR_LSI_CUT_COMPAT := 1
117      $(eval $(call add_define,RCAR_LSI_CUT_COMPAT))
118    else
119      # disable compatible function.
120      ifeq (${LSI_CUT},10)
121        RCAR_LSI_CUT:=0
122      else ifeq (${LSI_CUT},11)
123        RCAR_LSI_CUT:=1
124      else
125        $(error "Error: ${LSI_CUT} is not supported.")
126      endif
127      $(eval $(call add_define,RCAR_LSI_CUT))
128    endif
129  else ifeq (${LSI},E3)
130    RCAR_LSI:=${RCAR_E3}
131    ifndef LSI_CUT
132      # enable compatible function.
133      RCAR_LSI_CUT_COMPAT := 1
134      $(eval $(call add_define,RCAR_LSI_CUT_COMPAT))
135    else
136      # disable compatible function.
137      ifeq (${LSI_CUT},10)
138        RCAR_LSI_CUT:=0
139      else ifeq (${LSI_CUT},11)
140        RCAR_LSI_CUT:=1
141      else
142        $(error "Error: ${LSI_CUT} is not supported.")
143      endif
144      $(eval $(call add_define,RCAR_LSI_CUT))
145    endif
146  else
147    $(error "Error: ${LSI} is not supported.")
148  endif
149  $(eval $(call add_define,RCAR_LSI))
150endif
151
152# lock RPC HYPERFLASH access by default
153# unlock to repogram the ATF firmware from u-boot
154ifndef RCAR_RPC_HYPERFLASH_LOCKED
155RCAR_RPC_HYPERFLASH_LOCKED := 1
156endif
157$(eval $(call add_define,RCAR_RPC_HYPERFLASH_LOCKED))
158
159# Process RCAR_SECURE_BOOT flag
160ifndef RCAR_SECURE_BOOT
161RCAR_SECURE_BOOT := 1
162endif
163$(eval $(call add_define,RCAR_SECURE_BOOT))
164
165# Process RCAR_QOS_TYPE flag
166ifndef RCAR_QOS_TYPE
167RCAR_QOS_TYPE := 0
168endif
169$(eval $(call add_define,RCAR_QOS_TYPE))
170
171# Process RCAR_DRAM_SPLIT flag
172ifndef RCAR_DRAM_SPLIT
173RCAR_DRAM_SPLIT := 0
174endif
175$(eval $(call add_define,RCAR_DRAM_SPLIT))
176
177# Process RCAR_BL33_EXECUTION_EL flag
178ifndef RCAR_BL33_EXECUTION_EL
179RCAR_BL33_EXECUTION_EL := 0
180endif
181$(eval $(call add_define,RCAR_BL33_EXECUTION_EL))
182
183# Process RCAR_AVS_SETTING_ENABLE flag
184ifeq (${RCAR_AVS_SETTING_ENABLE},0)
185AVS_SETTING_ENABLE := 0
186else
187AVS_SETTING_ENABLE := 1
188endif
189$(eval $(call add_define,AVS_SETTING_ENABLE))
190
191# Process RCAR_LOSSY_ENABLE flag
192ifndef RCAR_LOSSY_ENABLE
193RCAR_LOSSY_ENABLE := 0
194endif
195$(eval $(call add_define,RCAR_LOSSY_ENABLE))
196
197# Process LIFEC_DBSC_PROTECT_ENABLE flag
198ifndef LIFEC_DBSC_PROTECT_ENABLE
199LIFEC_DBSC_PROTECT_ENABLE := 1
200endif
201$(eval $(call add_define,LIFEC_DBSC_PROTECT_ENABLE))
202
203# Process PMIC_ROHM_BD9571 flag
204ifndef PMIC_ROHM_BD9571
205PMIC_ROHM_BD9571 := 1
206endif
207$(eval $(call add_define,PMIC_ROHM_BD9571))
208
209# Process PMIC_LEVEL_MODE flag
210ifndef PMIC_LEVEL_MODE
211PMIC_LEVEL_MODE := 1
212endif
213$(eval $(call add_define,PMIC_LEVEL_MODE))
214
215# Process RCAR_GEN3_ULCB flag
216ifndef RCAR_GEN3_ULCB
217RCAR_GEN3_ULCB := 0
218endif
219ifeq (${RCAR_GEN3_ULCB},1)
220 BOARD_DEFAULT := 0x10
221 $(eval $(call add_define,BOARD_DEFAULT))
222endif
223$(eval $(call add_define,RCAR_GEN3_ULCB))
224
225# Process RCAR_REF_INT flag
226ifndef RCAR_REF_INT
227RCAR_REF_INT :=0
228endif
229$(eval $(call add_define,RCAR_REF_INT))
230
231# Process RCAR_REWT_TRAINING flag
232ifndef RCAR_REWT_TRAINING
233RCAR_REWT_TRAINING := 0
234endif
235$(eval $(call add_define,RCAR_REWT_TRAINING))
236
237# Process RCAR_SYSTEM_SUSPEND flag
238ifndef RCAR_SYSTEM_SUSPEND
239RCAR_SYSTEM_SUSPEND := 1
240endif
241$(eval $(call add_define,RCAR_SYSTEM_SUSPEND))
242
243# SYSTEM_SUSPEND requires power control of PMIC etc.
244# When executing SYSTEM_SUSPEND other than Salvator-X, Salvator-XS and Ebisu,
245# processing equivalent to that implemented in PMIC_ROHM_BD9571 is necessary.
246ifeq (${RCAR_SYSTEM_SUSPEND},1)
247  ifeq (${PMIC_ROHM_BD9571},0)
248    $(error "Error: When you want RCAR_SYSTEM_SUSPEND to be enable, please also set PMIC_ROHM_BD9571 to enable.")
249  endif
250endif
251
252# Process RCAR_DRAM_LPDDR4_MEMCONF flag
253ifndef RCAR_DRAM_LPDDR4_MEMCONF
254RCAR_DRAM_LPDDR4_MEMCONF :=1
255endif
256$(eval $(call add_define,RCAR_DRAM_LPDDR4_MEMCONF))
257
258# Process RCAR_DRAM_DDR3L_MEMCONF flag
259ifndef RCAR_DRAM_DDR3L_MEMCONF
260RCAR_DRAM_DDR3L_MEMCONF :=1
261endif
262$(eval $(call add_define,RCAR_DRAM_DDR3L_MEMCONF))
263
264# Process RCAR_DRAM_DDR3L_MEMDUAL flag
265ifndef RCAR_DRAM_DDR3L_MEMDUAL
266RCAR_DRAM_DDR3L_MEMDUAL :=1
267endif
268$(eval $(call add_define,RCAR_DRAM_DDR3L_MEMDUAL))
269
270# Process RCAR_BL33_ARG0 flag
271ifdef RCAR_BL33_ARG0
272$(eval $(call add_define,RCAR_BL33_ARG0))
273endif
274
275#Process RCAR_BL2_DCACHE flag
276ifndef RCAR_BL2_DCACHE
277RCAR_BL2_DCACHE := 0
278endif
279$(eval $(call add_define,RCAR_BL2_DCACHE))
280
281# Process RCAR_DRAM_CHANNEL flag
282ifndef RCAR_DRAM_CHANNEL
283RCAR_DRAM_CHANNEL :=15
284endif
285$(eval $(call add_define,RCAR_DRAM_CHANNEL))
286
287#Process RCAR_SYSTEM_RESET_KEEPON_DDR flag
288ifndef RCAR_SYSTEM_RESET_KEEPON_DDR
289RCAR_SYSTEM_RESET_KEEPON_DDR := 0
290endif
291$(eval $(call add_define,RCAR_SYSTEM_RESET_KEEPON_DDR))
292
293# RCAR_SYSTEM_RESET_KEEPON_DDR requires power control of PMIC etc.
294# When executing SYSTEM_SUSPEND other than Salvator-X, Salvator-XS and Ebisu,
295# processing equivalent to that implemented in PMIC_ROHM_BD9571 is necessary.
296# Also, it is necessary to enable RCAR_SYSTEM_SUSPEND.
297ifeq (${RCAR_SYSTEM_RESET_KEEPON_DDR},1)
298  ifeq (${PMIC_ROHM_BD9571},0)
299    $(error "Error: When you want RCAR_SYSTEM_RESET_KEEPON_DDR to be enable, please also set PMIC_ROHM_BD9571 to enable.")
300  endif
301  ifeq (${RCAR_SYSTEM_SUSPEND},0)
302    $(error "Error: When you want RCAR_SYSTEM_RESET_KEEPON_DDR to be enable, please also set RCAR_SYSTEM_SUSPEND to enable.")
303  endif
304endif
305
306# Enable workarounds for selected Cortex-A53 erratas.
307ERRATA_A53_835769  := 1
308ERRATA_A53_843419  := 1
309ERRATA_A53_855873  := 1
310
311# Enable workarounds for selected Cortex-A57 erratas.
312ERRATA_A57_859972  := 1
313ERRATA_A57_813419  := 1
314
315include drivers/staging/renesas/rcar/ddr/ddr.mk
316include drivers/staging/renesas/rcar/qos/qos.mk
317include drivers/staging/renesas/rcar/pfc/pfc.mk
318include lib/libfdt/libfdt.mk
319
320PLAT_INCLUDES	:=	-Idrivers/staging/renesas/rcar/ddr	\
321			-Idrivers/staging/renesas/rcar/qos	\
322			-Idrivers/renesas/rcar/iic_dvfs		\
323			-Idrivers/renesas/rcar/board		\
324			-Idrivers/renesas/rcar/cpld/		\
325			-Idrivers/renesas/rcar/avs		\
326			-Idrivers/renesas/rcar/delay		\
327			-Idrivers/renesas/rcar/rom		\
328			-Idrivers/renesas/rcar/scif		\
329			-Idrivers/renesas/rcar/emmc		\
330			-Idrivers/renesas/rcar/pwrc		\
331			-Idrivers/renesas/rcar/io		\
332			-Iplat/renesas/rcar/include/registers	\
333			-Iplat/renesas/rcar/include		\
334			-Iplat/renesas/rcar
335
336PLAT_BL_COMMON_SOURCES	:=	drivers/renesas/rcar/iic_dvfs/iic_dvfs.c \
337				plat/renesas/rcar/rcar_common.c
338
339RCAR_GIC_SOURCES	:=	drivers/arm/gic/common/gic_common.c	\
340				drivers/arm/gic/v2/gicv2_main.c		\
341				drivers/arm/gic/v2/gicv2_helpers.c	\
342				plat/common/plat_gicv2.c
343
344BL2_SOURCES	+=	${RCAR_GIC_SOURCES}				\
345			lib/cpus/aarch64/cortex_a53.S			\
346			lib/cpus/aarch64/cortex_a57.S			\
347			${LIBFDT_SRCS}					\
348			common/desc_image_load.c			\
349			plat/renesas/rcar/aarch64/platform_common.c	\
350			plat/renesas/rcar/aarch64/plat_helpers.S	\
351			plat/renesas/rcar/bl2_interrupt_error.c		\
352			plat/renesas/rcar/bl2_secure_setting.c		\
353			plat/renesas/rcar/bl2_plat_setup.c		\
354			plat/renesas/rcar/plat_storage.c		\
355			plat/renesas/rcar/bl2_plat_mem_params_desc.c	\
356			plat/renesas/rcar/plat_image_load.c		\
357			plat/renesas/rcar/bl2_cpg_init.c		\
358			drivers/renesas/rcar/console/rcar_printf.c	\
359			drivers/renesas/rcar/scif/scif.S		\
360			drivers/renesas/rcar/common.c			\
361			drivers/renesas/rcar/io/io_emmcdrv.c		\
362			drivers/renesas/rcar/io/io_memdrv.c		\
363			drivers/renesas/rcar/io/io_rcar.c		\
364			drivers/renesas/rcar/auth/auth_mod.c		\
365			drivers/renesas/rcar/rpc/rpc_driver.c		\
366			drivers/renesas/rcar/dma/dma_driver.c		\
367			drivers/renesas/rcar/avs/avs_driver.c		\
368			drivers/renesas/rcar/delay/micro_delay.c	\
369			drivers/renesas/rcar/emmc/emmc_interrupt.c	\
370			drivers/renesas/rcar/emmc/emmc_utility.c	\
371			drivers/renesas/rcar/emmc/emmc_mount.c		\
372			drivers/renesas/rcar/emmc/emmc_init.c		\
373			drivers/renesas/rcar/emmc/emmc_read.c		\
374			drivers/renesas/rcar/emmc/emmc_cmd.c		\
375			drivers/renesas/rcar/watchdog/swdt.c		\
376			drivers/renesas/rcar/rom/rom_api.c		\
377			drivers/renesas/rcar/board/board.c		\
378			drivers/io/io_storage.c
379
380BL31_SOURCES	+=	${RCAR_GIC_SOURCES}				\
381			lib/cpus/aarch64/cortex_a53.S			\
382			lib/cpus/aarch64/cortex_a57.S			\
383			plat/common/plat_psci_common.c			\
384			plat/renesas/rcar/plat_topology.c		\
385			plat/renesas/rcar/aarch64/plat_helpers.S	\
386			plat/renesas/rcar/aarch64/platform_common.c	\
387			plat/renesas/rcar/bl31_plat_setup.c		\
388			plat/renesas/rcar/plat_pm.c			\
389			drivers/renesas/rcar/console/rcar_console.S	\
390			drivers/renesas/rcar/console/rcar_printf.c	\
391			drivers/renesas/rcar/delay/micro_delay.c	\
392			drivers/renesas/rcar/pwrc/call_sram.S		\
393			drivers/renesas/rcar/pwrc/pwrc.c		\
394			drivers/renesas/rcar/common.c			\
395			drivers/arm/cci/cci.c
396
397ifeq (${RCAR_GEN3_ULCB},1)
398BL31_SOURCES		+=	drivers/renesas/rcar/cpld/ulcb_cpld.c
399endif
400
401include lib/xlat_tables_v2/xlat_tables.mk
402include drivers/auth/mbedtls/mbedtls_crypto.mk
403PLAT_BL_COMMON_SOURCES	+=	${XLAT_TABLES_LIB_SRCS}
404
405# build the layout images for the bootrom and the necessary srecords
406rcar: rcar_layout_tool rcar_srecord
407distclean realclean clean: clean_layout_tool clean_srecord
408
409# layout images
410LAYOUT_TOOLPATH ?= tools/renesas/rcar_layout_create
411
412clean_layout_tool:
413	@echo "clean layout tool"
414	${Q}${MAKE} -C ${LAYOUT_TOOLPATH} clean
415
416.PHONY: rcar_layout_tool
417rcar_layout_tool:
418	@echo "generating layout srecs"
419	${Q}${MAKE} CPPFLAGS="-D=AARCH64" --no-print-directory -C ${LAYOUT_TOOLPATH}
420
421# srecords
422SREC_PATH	= ${BUILD_PLAT}
423BL2_ELF_SRC	= ${SREC_PATH}/bl2/bl2.elf
424BL31_ELF_SRC	= ${SREC_PATH}/bl31/bl31.elf
425
426clean_srecord:
427	@echo "clean bl2 and bl31 srecs"
428	rm -f ${SREC_PATH}/bl2.srec ${SREC_PATH}/bl31.srec
429
430.PHONY: rcar_srecord
431rcar_srecord: $(BL2_ELF_SRC) $(BL31_ELF_SRC)
432	@echo "generating srec: ${SREC_PATH}/bl2.srec"
433	$(Q)$(OC) -O srec --srec-forceS3 ${BL2_ELF_SRC}  ${SREC_PATH}/bl2.srec
434	@echo "generating srec: ${SREC_PATH}/bl31.srec"
435	$(Q)$(OC) -O srec --srec-forceS3 ${BL31_ELF_SRC} ${SREC_PATH}/bl31.srec
436
437