platform.mk 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278
  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},G2M)
  13. RCAR_LSI:=${RZ_G2M}
  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},13)
  25. RCAR_LSI_CUT:=3
  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},G2H)
  34. RCAR_LSI:=${RZ_G2H}
  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},G2N)
  49. RCAR_LSI:=${RZ_G2N}
  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
  61. $(error "Error: ${LSI_CUT} is not supported.")
  62. endif
  63. $(eval $(call add_define,RCAR_LSI_CUT))
  64. endif
  65. else ifeq (${LSI},G2E)
  66. RCAR_LSI:=${RZ_G2E}
  67. ifndef LSI_CUT
  68. # enable compatible function.
  69. RCAR_LSI_CUT_COMPAT := 1
  70. $(eval $(call add_define,RCAR_LSI_CUT_COMPAT))
  71. else
  72. # disable compatible function.
  73. ifeq (${LSI_CUT},10)
  74. RCAR_LSI_CUT:=0
  75. else ifeq (${LSI_CUT},11)
  76. RCAR_LSI_CUT:=1
  77. else
  78. $(error "Error: ${LSI_CUT} is not supported.")
  79. endif
  80. $(eval $(call add_define,RCAR_LSI_CUT))
  81. endif
  82. else
  83. $(error "Error: ${LSI} is not supported.")
  84. endif
  85. $(eval $(call add_define,RCAR_LSI))
  86. endif
  87. # Process RZG_LCS_STATE_DETECTION_ENABLE flag
  88. # Enable to get LCS state information
  89. ifndef RZG_LCS_STATE_DETECTION_ENABLE
  90. RZG_LCS_STATE_DETECTION_ENABLE := 0
  91. endif
  92. $(eval $(call add_define,RZG_LCS_STATE_DETECTION_ENABLE))
  93. # Process RCAR_SECURE_BOOT flag
  94. ifndef RCAR_SECURE_BOOT
  95. RCAR_SECURE_BOOT := 0
  96. endif
  97. $(eval $(call add_define,RCAR_SECURE_BOOT))
  98. # LCS state of RZ/G2 Chip is all CM.
  99. # However certain chips(RZ/G2M and RZ/G2E) have incorrect factory Fuse settings
  100. # which results in getting incorrect LCS states
  101. # if need to enable RCAR_SECURE_BOOT, make sure the chip has proper factory Fuse settings.
  102. ifeq (${RCAR_SECURE_BOOT},1)
  103. ifeq (${RZG_LCS_STATE_DETECTION_ENABLE},0)
  104. $(error "Error: Please check the chip has proper factory Fuse settings and set RZG_LCS_STATE_DETECTION_ENABLE to enable.")
  105. endif
  106. endif
  107. # lock RPC HYPERFLASH access by default
  108. # unlock to repogram the ATF firmware from u-boot
  109. ifndef RCAR_RPC_HYPERFLASH_LOCKED
  110. RCAR_RPC_HYPERFLASH_LOCKED := 1
  111. endif
  112. $(eval $(call add_define,RCAR_RPC_HYPERFLASH_LOCKED))
  113. # Process RCAR_QOS_TYPE flag
  114. ifndef RCAR_QOS_TYPE
  115. RCAR_QOS_TYPE := 0
  116. endif
  117. $(eval $(call add_define,RCAR_QOS_TYPE))
  118. # Process RCAR_DRAM_SPLIT flag
  119. ifndef RCAR_DRAM_SPLIT
  120. RCAR_DRAM_SPLIT := 0
  121. endif
  122. $(eval $(call add_define,RCAR_DRAM_SPLIT))
  123. # Process RCAR_BL33_EXECUTION_EL flag
  124. ifndef RCAR_BL33_EXECUTION_EL
  125. RCAR_BL33_EXECUTION_EL := 0
  126. endif
  127. $(eval $(call add_define,RCAR_BL33_EXECUTION_EL))
  128. # Process RCAR_AVS_SETTING_ENABLE flag
  129. ifndef AVS_SETTING_ENABLE
  130. AVS_SETTING_ENABLE := 0
  131. endif
  132. $(eval $(call add_define,AVS_SETTING_ENABLE))
  133. # Process RCAR_LOSSY_ENABLE flag
  134. ifndef RCAR_LOSSY_ENABLE
  135. RCAR_LOSSY_ENABLE := 0
  136. endif
  137. $(eval $(call add_define,RCAR_LOSSY_ENABLE))
  138. # Process LIFEC_DBSC_PROTECT_ENABLE flag
  139. ifndef LIFEC_DBSC_PROTECT_ENABLE
  140. LIFEC_DBSC_PROTECT_ENABLE := 1
  141. endif
  142. $(eval $(call add_define,LIFEC_DBSC_PROTECT_ENABLE))
  143. # Process RCAR_GEN3_ULCB flag
  144. ifndef RCAR_GEN3_ULCB
  145. RCAR_GEN3_ULCB := 0
  146. endif
  147. # Process RCAR_REF_INT flag
  148. ifndef RCAR_REF_INT
  149. RCAR_REF_INT :=0
  150. endif
  151. $(eval $(call add_define,RCAR_REF_INT))
  152. # Process RCAR_REWT_TRAINING flag
  153. ifndef RCAR_REWT_TRAINING
  154. RCAR_REWT_TRAINING := 1
  155. endif
  156. $(eval $(call add_define,RCAR_REWT_TRAINING))
  157. # Process RCAR_SYSTEM_SUSPEND flag
  158. ifndef RCAR_SYSTEM_SUSPEND
  159. RCAR_SYSTEM_SUSPEND := 0
  160. endif
  161. $(eval $(call add_define,RCAR_SYSTEM_SUSPEND))
  162. # Process RCAR_DRAM_LPDDR4_MEMCONF flag
  163. ifndef RCAR_DRAM_LPDDR4_MEMCONF
  164. RCAR_DRAM_LPDDR4_MEMCONF :=1
  165. endif
  166. $(eval $(call add_define,RCAR_DRAM_LPDDR4_MEMCONF))
  167. # Process RCAR_DRAM_DDR3L_MEMCONF flag
  168. ifndef RCAR_DRAM_DDR3L_MEMCONF
  169. RCAR_DRAM_DDR3L_MEMCONF :=1
  170. endif
  171. $(eval $(call add_define,RCAR_DRAM_DDR3L_MEMCONF))
  172. # Process RCAR_DRAM_DDR3L_MEMDUAL flag
  173. ifndef RCAR_DRAM_DDR3L_MEMDUAL
  174. RCAR_DRAM_DDR3L_MEMDUAL :=1
  175. endif
  176. $(eval $(call add_define,RCAR_DRAM_DDR3L_MEMDUAL))
  177. # Process RCAR_BL33_ARG0 flag
  178. ifdef RCAR_BL33_ARG0
  179. $(eval $(call add_define,RCAR_BL33_ARG0))
  180. endif
  181. #Process RCAR_BL2_DCACHE flag
  182. ifndef RCAR_BL2_DCACHE
  183. RCAR_BL2_DCACHE := 0
  184. endif
  185. $(eval $(call add_define,RCAR_BL2_DCACHE))
  186. # Process RCAR_DRAM_CHANNEL flag
  187. ifndef RCAR_DRAM_CHANNEL
  188. RCAR_DRAM_CHANNEL :=15
  189. endif
  190. $(eval $(call add_define,RCAR_DRAM_CHANNEL))
  191. #Process RCAR_SYSTEM_RESET_KEEPON_DDR flag
  192. ifndef RCAR_SYSTEM_RESET_KEEPON_DDR
  193. RCAR_SYSTEM_RESET_KEEPON_DDR := 0
  194. endif
  195. $(eval $(call add_define,RCAR_SYSTEM_RESET_KEEPON_DDR))
  196. RZG_SOC :=1
  197. $(eval $(call add_define,RZG_SOC))
  198. include drivers/renesas/common/ddr/ddr.mk
  199. include drivers/renesas/rzg/qos/qos.mk
  200. include drivers/renesas/rzg/pfc/pfc.mk
  201. include lib/libfdt/libfdt.mk
  202. PLAT_INCLUDES += -Idrivers/renesas/common/ddr \
  203. -Idrivers/renesas/rzg/qos \
  204. -Idrivers/renesas/rzg/board \
  205. -Idrivers/renesas/common \
  206. -Idrivers/renesas/common/iic_dvfs \
  207. -Idrivers/renesas/common/avs \
  208. -Idrivers/renesas/common/delay \
  209. -Idrivers/renesas/common/rom \
  210. -Idrivers/renesas/common/scif \
  211. -Idrivers/renesas/common/emmc \
  212. -Idrivers/renesas/common/pwrc \
  213. -Idrivers/renesas/common/io
  214. BL2_SOURCES += plat/renesas/rzg/bl2_plat_setup.c \
  215. drivers/renesas/rzg/board/board.c
  216. # build the layout images for the bootrom and the necessary srecords
  217. rzg: rzg_layout_create rzg_srecord
  218. distclean realclean clean: clean_layout_tool clean_srecord
  219. # layout images
  220. LAYOUT_TOOLPATH ?= tools/renesas/rzg_layout_create
  221. clean_layout_tool:
  222. $(s)echo "clean layout tool"
  223. $(q)${MAKE} -C ${LAYOUT_TOOLPATH} clean
  224. .PHONY: rzg_layout_create
  225. rzg_layout_create:
  226. $(s)echo "generating layout srecs"
  227. $(q)${MAKE} CPPFLAGS="-D=AARCH64" --no-print-directory -C ${LAYOUT_TOOLPATH}
  228. # srecords
  229. SREC_PATH = ${BUILD_PLAT}
  230. BL2_ELF_SRC = ${SREC_PATH}/bl2/bl2.elf
  231. BL31_ELF_SRC = ${SREC_PATH}/bl31/bl31.elf
  232. clean_srecord:
  233. $(s)echo "clean bl2 and bl31 srecs"
  234. rm -f ${SREC_PATH}/bl2.srec ${SREC_PATH}/bl31.srec
  235. $(SREC_PATH)/bl2.srec: $(BL2_ELF_SRC)
  236. $(s)echo "generating srec: $(SREC_PATH)/bl2.srec"
  237. $(q)$($(ARCH)-oc) -O srec --srec-forceS3 $(BL2_ELF_SRC) $(SREC_PATH)/bl2.srec
  238. $(SREC_PATH)/bl31.srec: $(BL31_ELF_SRC)
  239. $(s)echo "generating srec: $(SREC_PATH)/bl31.srec"
  240. $(q)$($(ARCH)-oc) -O srec --srec-forceS3 $(BL31_ELF_SRC) $(SREC_PATH)/bl31.srec
  241. .PHONY: rzg_srecord
  242. rzg_srecord: $(SREC_PATH)/bl2.srec $(SREC_PATH)/bl31.srec