platform.mk 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380
  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. # Process RCAR_SECURE_BOOT flag
  147. ifndef RCAR_SECURE_BOOT
  148. RCAR_SECURE_BOOT := 1
  149. endif
  150. $(eval $(call add_define,RCAR_SECURE_BOOT))
  151. # Process RCAR_QOS_TYPE flag
  152. ifndef RCAR_QOS_TYPE
  153. RCAR_QOS_TYPE := 0
  154. endif
  155. $(eval $(call add_define,RCAR_QOS_TYPE))
  156. # Process RCAR_DRAM_SPLIT flag
  157. ifndef RCAR_DRAM_SPLIT
  158. RCAR_DRAM_SPLIT := 0
  159. endif
  160. $(eval $(call add_define,RCAR_DRAM_SPLIT))
  161. # Process RCAR_BL33_EXECUTION_EL flag
  162. ifndef RCAR_BL33_EXECUTION_EL
  163. RCAR_BL33_EXECUTION_EL := 0
  164. endif
  165. $(eval $(call add_define,RCAR_BL33_EXECUTION_EL))
  166. # Process RCAR_AVS_SETTING_ENABLE flag
  167. ifeq (${RCAR_AVS_SETTING_ENABLE},0)
  168. AVS_SETTING_ENABLE := 0
  169. else
  170. AVS_SETTING_ENABLE := 1
  171. endif
  172. $(eval $(call add_define,AVS_SETTING_ENABLE))
  173. # Process RCAR_LOSSY_ENABLE flag
  174. ifndef RCAR_LOSSY_ENABLE
  175. RCAR_LOSSY_ENABLE := 0
  176. endif
  177. $(eval $(call add_define,RCAR_LOSSY_ENABLE))
  178. # Process LIFEC_DBSC_PROTECT_ENABLE flag
  179. ifndef LIFEC_DBSC_PROTECT_ENABLE
  180. LIFEC_DBSC_PROTECT_ENABLE := 1
  181. endif
  182. $(eval $(call add_define,LIFEC_DBSC_PROTECT_ENABLE))
  183. # Process PMIC_ROHM_BD9571 flag
  184. ifndef PMIC_ROHM_BD9571
  185. PMIC_ROHM_BD9571 := 1
  186. endif
  187. $(eval $(call add_define,PMIC_ROHM_BD9571))
  188. # Process PMIC_LEVEL_MODE flag
  189. ifndef PMIC_LEVEL_MODE
  190. PMIC_LEVEL_MODE := 1
  191. endif
  192. $(eval $(call add_define,PMIC_LEVEL_MODE))
  193. # Process RCAR_GEN3_ULCB flag
  194. ifndef RCAR_GEN3_ULCB
  195. RCAR_GEN3_ULCB := 0
  196. endif
  197. ifeq (${RCAR_GEN3_ULCB},1)
  198. BOARD_DEFAULT := 0x10
  199. $(eval $(call add_define,BOARD_DEFAULT))
  200. endif
  201. $(eval $(call add_define,RCAR_GEN3_ULCB))
  202. # Process RCAR_REF_INT flag
  203. ifndef RCAR_REF_INT
  204. RCAR_REF_INT :=0
  205. endif
  206. $(eval $(call add_define,RCAR_REF_INT))
  207. # Process RCAR_REWT_TRAINING flag
  208. ifndef RCAR_REWT_TRAINING
  209. RCAR_REWT_TRAINING := 1
  210. endif
  211. $(eval $(call add_define,RCAR_REWT_TRAINING))
  212. # Process RCAR_SYSTEM_SUSPEND flag
  213. ifndef RCAR_SYSTEM_SUSPEND
  214. RCAR_SYSTEM_SUSPEND := 1
  215. endif
  216. $(eval $(call add_define,RCAR_SYSTEM_SUSPEND))
  217. # SYSTEM_SUSPEND requires power control of PMIC etc.
  218. # When executing SYSTEM_SUSPEND other than Salvator-X, Salvator-XS and Ebisu,
  219. # processing equivalent to that implemented in PMIC_ROHM_BD9571 is necessary.
  220. ifeq (${RCAR_SYSTEM_SUSPEND},1)
  221. ifeq (${PMIC_ROHM_BD9571},0)
  222. $(error "Error: When you want RCAR_SYSTEM_SUSPEND to be enable, please also set PMIC_ROHM_BD9571 to enable.")
  223. endif
  224. endif
  225. # Process RCAR_DRAM_LPDDR4_MEMCONF flag
  226. ifndef RCAR_DRAM_LPDDR4_MEMCONF
  227. RCAR_DRAM_LPDDR4_MEMCONF :=1
  228. endif
  229. $(eval $(call add_define,RCAR_DRAM_LPDDR4_MEMCONF))
  230. # Process RCAR_DRAM_MEMRANK flag
  231. ifndef RCAR_DRAM_MEMRANK
  232. RCAR_DRAM_MEMRANK :=0
  233. endif
  234. $(eval $(call add_define,RCAR_DRAM_MEMRANK))
  235. # Process RCAR_DRAM_DDR3L_MEMCONF flag
  236. ifndef RCAR_DRAM_DDR3L_MEMCONF
  237. RCAR_DRAM_DDR3L_MEMCONF :=1
  238. endif
  239. $(eval $(call add_define,RCAR_DRAM_DDR3L_MEMCONF))
  240. # Process RCAR_DRAM_DDR3L_MEMDUAL flag
  241. ifndef RCAR_DRAM_DDR3L_MEMDUAL
  242. RCAR_DRAM_DDR3L_MEMDUAL :=1
  243. endif
  244. $(eval $(call add_define,RCAR_DRAM_DDR3L_MEMDUAL))
  245. # Process RCAR_BL33_ARG0 flag
  246. ifdef RCAR_BL33_ARG0
  247. $(eval $(call add_define,RCAR_BL33_ARG0))
  248. endif
  249. #Process RCAR_BL2_DCACHE flag
  250. ifndef RCAR_BL2_DCACHE
  251. RCAR_BL2_DCACHE := 0
  252. endif
  253. $(eval $(call add_define,RCAR_BL2_DCACHE))
  254. # Process RCAR_DRAM_CHANNEL flag
  255. ifndef RCAR_DRAM_CHANNEL
  256. RCAR_DRAM_CHANNEL :=15
  257. endif
  258. $(eval $(call add_define,RCAR_DRAM_CHANNEL))
  259. #Process RCAR_SYSTEM_RESET_KEEPON_DDR flag
  260. ifndef RCAR_SYSTEM_RESET_KEEPON_DDR
  261. RCAR_SYSTEM_RESET_KEEPON_DDR := 0
  262. endif
  263. $(eval $(call add_define,RCAR_SYSTEM_RESET_KEEPON_DDR))
  264. ifndef RCAR_GEN3_BL33_GZIP
  265. RCAR_GEN3_BL33_GZIP := 0
  266. endif
  267. $(eval $(call add_define,RCAR_GEN3_BL33_GZIP))
  268. # RCAR_SYSTEM_RESET_KEEPON_DDR requires power control of PMIC etc.
  269. # When executing SYSTEM_SUSPEND other than Salvator-X, Salvator-XS and Ebisu,
  270. # processing equivalent to that implemented in PMIC_ROHM_BD9571 is necessary.
  271. # Also, it is necessary to enable RCAR_SYSTEM_SUSPEND.
  272. ifeq (${RCAR_SYSTEM_RESET_KEEPON_DDR},1)
  273. ifeq (${PMIC_ROHM_BD9571},0)
  274. $(error "Error: When you want RCAR_SYSTEM_RESET_KEEPON_DDR to be enable, please also set PMIC_ROHM_BD9571 to enable.")
  275. endif
  276. ifeq (${RCAR_SYSTEM_SUSPEND},0)
  277. $(error "Error: When you want RCAR_SYSTEM_RESET_KEEPON_DDR to be enable, please also set RCAR_SYSTEM_SUSPEND to enable.")
  278. endif
  279. endif
  280. include drivers/renesas/common/ddr/ddr.mk
  281. include drivers/renesas/rcar/qos/qos.mk
  282. include drivers/renesas/rcar/pfc/pfc.mk
  283. include lib/libfdt/libfdt.mk
  284. PLAT_INCLUDES += -Idrivers/renesas/common/ddr \
  285. -Idrivers/renesas/rcar/qos \
  286. -Idrivers/renesas/rcar/board \
  287. -Idrivers/renesas/rcar/cpld/ \
  288. -Idrivers/renesas/common \
  289. -Idrivers/renesas/common/iic_dvfs \
  290. -Idrivers/renesas/common/avs \
  291. -Idrivers/renesas/common/delay \
  292. -Idrivers/renesas/common/rom \
  293. -Idrivers/renesas/common/scif \
  294. -Idrivers/renesas/common/emmc \
  295. -Idrivers/renesas/common/pwrc \
  296. -Idrivers/renesas/common/io
  297. BL2_SOURCES += plat/renesas/rcar/bl2_plat_setup.c \
  298. drivers/renesas/rcar/board/board.c
  299. ifeq (${RCAR_GEN3_BL33_GZIP},1)
  300. include lib/zlib/zlib.mk
  301. BL2_SOURCES += common/image_decompress.c \
  302. $(ZLIB_SOURCES)
  303. endif
  304. ifneq (${ENABLE_STACK_PROTECTOR},0)
  305. BL_COMMON_SOURCES += plat/renesas/rcar/rcar_stack_protector.c
  306. endif
  307. ifeq (${RCAR_GEN3_ULCB},1)
  308. BL31_SOURCES += drivers/renesas/rcar/cpld/ulcb_cpld.c
  309. endif
  310. # build the layout images for the bootrom and the necessary srecords
  311. rcar: rcar_layout_tool rcar_srecord
  312. distclean realclean clean: clean_layout_tool clean_srecord
  313. # layout images
  314. LAYOUT_TOOLPATH ?= tools/renesas/rcar_layout_create
  315. clean_layout_tool:
  316. $(s)echo "clean layout tool"
  317. $(q)${MAKE} -C ${LAYOUT_TOOLPATH} clean
  318. .PHONY: rcar_layout_tool
  319. rcar_layout_tool:
  320. $(s)echo "generating layout srecs"
  321. $(q)${MAKE} CPPFLAGS="-D=AARCH64" --no-print-directory -C ${LAYOUT_TOOLPATH}
  322. # srecords
  323. SREC_PATH = ${BUILD_PLAT}
  324. BL2_ELF_SRC = ${SREC_PATH}/bl2/bl2.elf
  325. BL31_ELF_SRC = ${SREC_PATH}/bl31/bl31.elf
  326. clean_srecord:
  327. $(s)echo "clean bl2 and bl31 srecs"
  328. rm -f ${SREC_PATH}/bl2.srec ${SREC_PATH}/bl31.srec
  329. $(SREC_PATH)/bl2.srec: $(BL2_ELF_SRC)
  330. $(s)echo "generating srec: $(SREC_PATH)/bl2.srec"
  331. $(q)$($(ARCH)-oc) -O srec --srec-forceS3 $(BL2_ELF_SRC) $(SREC_PATH)/bl2.srec
  332. $(SREC_PATH)/bl31.srec: $(BL31_ELF_SRC)
  333. $(s)echo "generating srec: $(SREC_PATH)/bl31.srec"
  334. $(q)$($(ARCH)-oc) -O srec --srec-forceS3 $(BL31_ELF_SRC) $(SREC_PATH)/bl31.srec
  335. .PHONY: rcar_srecord
  336. rcar_srecord: $(SREC_PATH)/bl2.srec $(SREC_PATH)/bl31.srec