platform.mk 10 KB

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