[PATCH v2 3/3] mx7ulp_com: add support for SPL

Oleksandr Suvorov oleksandr.suvorov at foundries.io
Sun Sep 12 16:32:57 CEST 2021


From: Ricardo Salveti <ricardo at foundries.io>

Add EA iMX7ULP COM board support for building SPL.

Signed-off-by: Ricardo Salveti <ricardo at foundries.io>
Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov at foundries.io>
---

Changes in v2:
- add a patch with SPL support for mx7ulp_com board.

 arch/arm/dts/imx7ulp-com-u-boot.dtsi | 37 ++++++++++++++++++++++++++++
 arch/arm/dts/imx7ulp-com.dts         |  1 +
 arch/arm/mach-imx/mx7ulp/Kconfig     | 12 +++++++++
 board/ea/mx7ulp_com/mx7ulp_com.c     | 26 +++++++++++++++++++
 include/configs/mx7ulp_com.h         |  6 +++++
 5 files changed, 82 insertions(+)
 create mode 100644 arch/arm/dts/imx7ulp-com-u-boot.dtsi

diff --git a/arch/arm/dts/imx7ulp-com-u-boot.dtsi b/arch/arm/dts/imx7ulp-com-u-boot.dtsi
new file mode 100644
index 0000000000..d73bfbf7a0
--- /dev/null
+++ b/arch/arm/dts/imx7ulp-com-u-boot.dtsi
@@ -0,0 +1,37 @@
+// SPDX-License-Identifier: GPL-2.0+ OR X11
+/*
+ * Copyright 2019 Foundries.io
+ */
+
+&iomuxc1 {
+	u-boot,dm-spl;
+};
+
+&ahbbridge0 {
+	u-boot,dm-spl;
+};
+
+&ahbbridge1 {
+	u-boot,dm-spl;
+};
+
+&lpuart4 {
+	u-boot,dm-spl;
+};
+
+&usbotg1 {
+	extcon = <&usbphy1>;
+	u-boot,dm-spl;
+};
+
+&usbphy1 {
+	u-boot,dm-spl;
+};
+
+&usdhc0 {
+	u-boot,dm-spl;
+};
+
+&gpio0 {
+	u-boot,dm-spl;
+};
diff --git a/arch/arm/dts/imx7ulp-com.dts b/arch/arm/dts/imx7ulp-com.dts
index c01e03dd06..dcfa37441f 100644
--- a/arch/arm/dts/imx7ulp-com.dts
+++ b/arch/arm/dts/imx7ulp-com.dts
@@ -6,6 +6,7 @@
 /dts-v1/;
 
 #include "imx7ulp.dtsi"
+#include "imx7ulp-com-u-boot.dtsi"
 
 / {
 	model = "Embedded Artists i.MX7ULP COM";
diff --git a/arch/arm/mach-imx/mx7ulp/Kconfig b/arch/arm/mach-imx/mx7ulp/Kconfig
index 56a3efd7b9..15c3ab6dae 100644
--- a/arch/arm/mach-imx/mx7ulp/Kconfig
+++ b/arch/arm/mach-imx/mx7ulp/Kconfig
@@ -23,6 +23,18 @@ config TARGET_MX7ULP_COM
 	bool "Support MX7ULP COM board"
 	select MX7ULP
 	select SYS_ARCH_TIMER
+	select SPL_DM if SPL
+	select SPL_GPIO_SUPPORT if SPL
+	select SPL_LIBCOMMON_SUPPORT if SPL
+	select SPL_LIBDISK_SUPPORT if SPL
+	select SPL_LIBGENERIC_SUPPORT if SPL
+	select SPL_MMC_SUPPORT if SPL
+	select SPL_OF_CONTROL if SPL
+	select SPL_OF_LIBFDT if SPL
+	select SPL_PINCTRL if SPL
+	select SPL_SEPARATE_BSS if SPL
+	select SPL_SERIAL_SUPPORT if SPL
+	select SUPPORT_SPL
 
 config TARGET_MX7ULP_EVK
 	bool "Support mx7ulp EVK board"
diff --git a/board/ea/mx7ulp_com/mx7ulp_com.c b/board/ea/mx7ulp_com/mx7ulp_com.c
index 5b2d444366..fd9cc5b914 100644
--- a/board/ea/mx7ulp_com/mx7ulp_com.c
+++ b/board/ea/mx7ulp_com/mx7ulp_com.c
@@ -48,3 +48,29 @@ int board_init(void)
 
 	return 0;
 }
+
+#ifdef CONFIG_SPL_BUILD
+#include <spl.h>
+
+#ifdef CONFIG_SPL_LOAD_FIT
+int board_fit_config_name_match(const char *name)
+{
+	if (!strcmp(name, "imx7ulp-com"))
+		return 0;
+
+	return -1;
+}
+#endif
+
+void spl_board_init(void)
+{
+	preloader_console_init();
+}
+
+void board_init_f(ulong dummy)
+{
+	arch_cpu_init();
+
+	board_early_init_f();
+}
+#endif
diff --git a/include/configs/mx7ulp_com.h b/include/configs/mx7ulp_com.h
index 28672c4f94..ad1fdef1f9 100644
--- a/include/configs/mx7ulp_com.h
+++ b/include/configs/mx7ulp_com.h
@@ -11,6 +11,10 @@
 #include <linux/sizes.h>
 #include <asm/arch/imx-regs.h>
 
+#ifdef CONFIG_SPL
+#include "imx7ulp_spl.h"
+#endif
+
 #define CONFIG_BOARD_POSTCLK_INIT
 #define CONFIG_SYS_BOOTM_LEN		0x1000000
 
@@ -84,5 +88,7 @@
 #define CONFIG_SYS_INIT_SP_ADDR \
 	(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET)
 
+#define CONFIG_ARMV7_SECURE_BASE	0x2F000000
+
 #define CONFIG_MXC_USB_PORTSC		(PORT_PTS_UTMI | PORT_PTS_PTW)
 #endif	/* __CONFIG_H */
-- 
2.31.1



More information about the U-Boot mailing list