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