platform.mk 9.9 KB

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