stm32mp1: add u-boot config fragments

Add U_BOOT_CONFIG_FRAGMENTS variable to add U-Boot configuration
fragments for specific needs.

If a fragment file exists for a given stm32mp1 platform, defined by
its DTS file name, it is used for U-boot configuration.

When WITH_RPMB_TEST is enabled, add a U-Boot config fragment to
enable RPMB support in U-Boot.

Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
Signed-off-by: Etienne Carriere <etienne.carriere@foss.st.com>
diff --git a/stm32mp/u-boot_rpmb.conf b/stm32mp/u-boot_rpmb.conf
new file mode 100644
index 0000000..4f57535
--- /dev/null
+++ b/stm32mp/u-boot_rpmb.conf
@@ -0,0 +1 @@
+CONFIG_SUPPORT_EMMC_RPMB=y
diff --git a/stm32mp1.mk b/stm32mp1.mk
index bbdff8e..ea87f3b 100644
--- a/stm32mp1.mk
+++ b/stm32mp1.mk
@@ -189,8 +189,15 @@
 ################################################################################
 U_BOOT_EXPORTS ?= CROSS_COMPILE="$(CCACHE)$(AARCH32_CROSS_COMPILE)"
 
+ifneq (,$(wildcard stm32mp/u-boot_$(STM32MP1_DTS_U_BOOT).conf))
+U_BOOT_CONFIG_FRAGMENTS += $(BUILD_PATH)/stm32mp/u-boot_$(STM32MP1_DTS_U_BOOT).conf
+endif
+ifeq ($(WITH_RPMB_TEST),y)
+U_BOOT_CONFIG_FRAGMENTS += $(BUILD_PATH)/stm32mp/u-boot_rpmb.conf
+endif
+
 u-boot:
-	$(U_BOOT_EXPORTS) $(MAKE) -C $(U_BOOT_PATH) $(STM32MP1_DEFCONFIG_U_BOOT)
+	cd $(U_BOOT_PATH) && scripts/kconfig/merge_config.sh configs/$(STM32MP1_DEFCONFIG_U_BOOT) $(U_BOOT_CONFIG_FRAGMENTS)
 	$(U_BOOT_EXPORTS) $(MAKE) -C $(U_BOOT_PATH) DEVICE_TREE=$(STM32MP1_DTS_U_BOOT) all
 	@$(call install_in_binaries,$(U_BOOT_PATH)/$(U_BOOT_BIN))
 	@$(call install_in_binaries,$(U_BOOT_PATH)/$(U_BOOT_DTB))