plat_common_def.mk 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. # Copyright 2020-2021 NXP
  2. #
  3. # SPDX-License-Identifier: BSD-3-Clause
  4. #
  5. # Include build macros, for example: SET_NXP_MAKE_FLAG
  6. include plat/nxp/common/plat_make_helper/plat_build_macros.mk
  7. # Adding platform specific defines
  8. $(eval $(call add_define_val,BOARD,'"${BOARD}"'))
  9. ifeq (${POVDD_ENABLE},yes)
  10. $(eval $(call add_define,CONFIG_POVDD_ENABLE))
  11. endif
  12. ifneq (${FLASH_TYPE},)
  13. $(eval $(call add_define,CONFIG_${FLASH_TYPE}))
  14. endif
  15. ifneq (${XSPI_FLASH_SZ},)
  16. $(eval $(call add_define_val,NXP_FLEXSPI_FLASH_SIZE,${XSPI_FLASH_SZ}))
  17. endif
  18. ifneq (${QSPI_FLASH_SZ},)
  19. $(eval $(call add_define_val,NXP_QSPI_FLASH_SIZE,${QSPI_FLASH_SZ}))
  20. endif
  21. ifneq (${NOR_FLASH_SZ},)
  22. $(eval $(call add_define_val,NXP_NOR_FLASH_SIZE,${NOR_FLASH_SZ}))
  23. endif
  24. ifneq (${FSPI_ERASE_4K},)
  25. $(eval $(call add_define_val,CONFIG_FSPI_ERASE_4K,${FSPI_ERASE_4K}))
  26. endif
  27. ifneq (${NUM_OF_DDRC},)
  28. $(eval $(call add_define_val,NUM_OF_DDRC,${NUM_OF_DDRC}))
  29. endif
  30. ifeq (${CONFIG_DDR_NODIMM},1)
  31. $(eval $(call add_define,CONFIG_DDR_NODIMM))
  32. DDRC_NUM_DIMM := 1
  33. endif
  34. ifneq (${DDRC_NUM_DIMM},)
  35. $(eval $(call add_define_val,DDRC_NUM_DIMM,${DDRC_NUM_DIMM}))
  36. endif
  37. ifneq (${DDRC_NUM_CS},)
  38. $(eval $(call add_define_val,DDRC_NUM_CS,${DDRC_NUM_CS}))
  39. endif
  40. ifeq (${DDR_ADDR_DEC},yes)
  41. $(eval $(call add_define,CONFIG_DDR_ADDR_DEC))
  42. endif
  43. ifeq (${DDR_ECC_EN},yes)
  44. $(eval $(call add_define,CONFIG_DDR_ECC_EN))
  45. endif
  46. ifeq (${CONFIG_STATIC_DDR},1)
  47. $(eval $(call add_define,CONFIG_STATIC_DDR))
  48. endif
  49. # Platform can control the base address for non-volatile storage.
  50. #$(eval $(call add_define_val,NV_STORAGE_BASE_ADDR,'${BL2_BIN_XSPI_NOR_END_ADDRESS} - 2 * ${NXP_XSPI_NOR_UNIT_SIZE}'))
  51. ifeq (${WARM_BOOT},yes)
  52. $(eval $(call add_define_val,PHY_TRAINING_REGS_ON_FLASH,'${BL2_BIN_XSPI_NOR_END_ADDRESS} - ${NXP_XSPI_NOR_UNIT_SIZE}'))
  53. endif
  54. # Selecting Boot Source for the TFA images.
  55. define add_boot_mode_define
  56. ifeq ($(1),qspi)
  57. $$(eval $$(call SET_NXP_MAKE_FLAG,QSPI_NEEDED,BL2))
  58. $$(eval $$(call add_define,QSPI_BOOT))
  59. else ifeq ($(1),sd)
  60. $$(eval $$(call SET_NXP_MAKE_FLAG,SD_MMC_NEEDED,BL2))
  61. $$(eval $$(call add_define,SD_BOOT))
  62. else ifeq ($(1),emmc)
  63. $$(eval $$(call SET_NXP_MAKE_FLAG,SD_MMC_NEEDED,BL2))
  64. $$(eval $$(call add_define,EMMC_BOOT))
  65. else ifeq ($(1),nor)
  66. $$(eval $$(call SET_NXP_MAKE_FLAG,IFC_NOR_NEEDED,BL2))
  67. $$(eval $$(call add_define,NOR_BOOT))
  68. else ifeq ($(1),nand)
  69. $$(eval $$(call SET_NXP_MAKE_FLAG,IFC_NAND_NEEDED,BL2))
  70. $$(eval $$(call add_define,NAND_BOOT))
  71. else ifeq ($(1),flexspi_nor)
  72. $$(eval $$(call SET_NXP_MAKE_FLAG,XSPI_NEEDED,BL2))
  73. $$(eval $$(call add_define,FLEXSPI_NOR_BOOT))
  74. else
  75. $$(error $(PLAT) Cannot Support Boot Mode: $(BOOT_MODE))
  76. endif
  77. endef
  78. ifneq (,$(findstring $(BOOT_MODE),$(SUPPORTED_BOOT_MODE)))
  79. $(eval $(call add_boot_mode_define,$(strip $(BOOT_MODE))))
  80. else
  81. $(error $(PLAT) Un-supported Boot Mode = $(BOOT_MODE))
  82. endif