
Hi Oleksandr, Ricardo,
On 05.08.22 20:19, Oleksandr Suvorov wrote:
From: Ricardo Salveti ricardo@foundries.io
Add a base implementation of mx7ulp SPL config header and soc, and changes in makefiles in order to allow building SPL on mx7ulp based devices.
Signed-off-by: Ricardo Salveti ricardo@foundries.io Co-developed-by: Oleksandr Suvorov oleksandr.suvorov@foundries.io Signed-off-by: Oleksandr Suvorov oleksandr.suvorov@foundries.io
Changes in v4:
- rebase to the current master
- fix a reference to a non-existent option SPL_MMC_SUPPORT
Changes in v3:
rebase the patch to the current codebase
arch/arm/mach-imx/Makefile | 2 +- arch/arm/mach-imx/mx7ulp/soc.c | 2 +- arch/arm/mach-imx/spl.c | 6 ++++-- include/configs/imx7ulp_spl.h | 39 ++++++++++++++++++++++++++++++++++ 4 files changed, 45 insertions(+), 4 deletions(-) create mode 100644 include/configs/imx7ulp_spl.h
diff --git a/arch/arm/mach-imx/Makefile b/arch/arm/mach-imx/Makefile index 80c497e6d81..71e6cac2f63 100644 --- a/arch/arm/mach-imx/Makefile +++ b/arch/arm/mach-imx/Makefile @@ -29,7 +29,7 @@ endif obj-$(CONFIG_GPT_TIMER) += timer.o obj-$(CONFIG_SYS_I2C_MXC) += i2c-mxv7.o endif -ifeq ($(SOC),$(filter $(SOC),mx7 mx6 mxs imx8m imx8 imx9 imxrt)) +ifeq ($(SOC),$(filter $(SOC),mx7 mx7ulp mx6 mxs imx8m imx8 imx9 imxrt)) obj-y += misc.o obj-$(CONFIG_CMD_PRIBLOB) += priblob.o obj-$(CONFIG_SPL_BUILD) += spl.o diff --git a/arch/arm/mach-imx/mx7ulp/soc.c b/arch/arm/mach-imx/mx7ulp/soc.c index 217b7c45867..951b1888c58 100644 --- a/arch/arm/mach-imx/mx7ulp/soc.c +++ b/arch/arm/mach-imx/mx7ulp/soc.c @@ -234,7 +234,7 @@ void s_init(void) } #endif
-#ifndef CONFIG_ULP_WATCHDOG +#if !CONFIG_IS_ENABLED(ULP_WATCHDOG) || CONFIG_IS_ENABLED(SPL_BUILD) void reset_cpu(void) { setbits_le32(SIM0_RBASE, SIM_SOPT1_A7_SW_RESET); diff --git a/arch/arm/mach-imx/spl.c b/arch/arm/mach-imx/spl.c index ef00969a5e0..bca0b1123a7 100644 --- a/arch/arm/mach-imx/spl.c +++ b/arch/arm/mach-imx/spl.c @@ -147,7 +147,7 @@ u32 spl_boot_device(void) return BOOT_DEVICE_NONE; }
-#elif defined(CONFIG_MX7) || defined(CONFIG_IMX8M) || defined(CONFIG_IMX8) || defined(CONFIG_IMX9) +#elif defined(CONFIG_MX7) || defined(CONFIG_MX7ULP) || defined(CONFIG_IMX8M) || defined(CONFIG_IMX8) || defined(CONFIG_IMX9) /* Translate iMX7/i.MX8M boot device to the SPL boot device enumeration */ u32 spl_boot_device(void) { @@ -160,7 +160,9 @@ u32 spl_boot_device(void) */ if (((bmode >> 24) & 0x03) == 0x01) /* Serial Downloader */ return BOOT_DEVICE_BOARD; +#endif
+#if defined(CONFIG_MX7) || defined(CONFIG_MX7ULP) /* * The above method does not detect that the boot ROM used * serial downloader in case the boot ROM decided to use the @@ -178,7 +180,7 @@ u32 spl_boot_device(void)
return spl_board_boot_device(boot_device_spl); } -#endif /* CONFIG_MX7 || CONFIG_IMX8M || CONFIG_IMX8 */ +#endif /* CONFIG_MX7 || CONFIG_MX7ULP || CONFIG_IMX8M || CONFIG_IMX8 */
#ifdef CONFIG_SPL_USB_GADGET int g_dnl_bind_fixup(struct usb_device_descriptor *dev, const char *name) diff --git a/include/configs/imx7ulp_spl.h b/include/configs/imx7ulp_spl.h new file mode 100644 index 00000000000..516238ec02e --- /dev/null +++ b/include/configs/imx7ulp_spl.h @@ -0,0 +1,39 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/*
- SPL definitions for the i.MX7ULP SPL
- (C) Copyright 2019 Foundries.io
- */
+#ifndef __IMX7ULP_SPL_CONFIG_H +#define __IMX7ULP_SPL_CONFIG_H
+#if CONFIG_IS_ENABLED(SPL) +/*
- see figure 35-5 in i.MX 7ULP Reference manual:
- IMX7ULP A7 OCRAM free area RAM is from 0x2F010000 to 0x2F03FF00.
- Set the stack at the end of the free area section, at 0x2003FEB8.
- The BOOT ROM loads what they consider the firmware image
- which consists of a 4K header in front of us that contains the IVT, DCD,
- and some padding thus 'our' max size is really 0x2F03FF00 - 0x2F011000.
- 187KB is more than enough for the SPL.
- */
+#define CONFIG_SPL_STACK 0x2F03FEB8
+/* MMC support */ +#if CONFIG_IS_ENABLED(SPL_MMC) +#define CONFIG_SYS_MMCSD_FS_BOOT_PARTITION 1
This should be in defconfig and it is not accepted anymore in header, it raises an error. See :
https://source.denx.de/u-boot/custodians/u-boot-imx/-/jobs/516648
Best regards, Stefano
+#define CONFIG_SYS_MONITOR_LEN 409600 /* 400 KB */ +#endif
+/* Define the payload for FAT/EXT support */ +#if CONFIG_IS_ENABLED(SPL_FS_FAT) || CONFIG_IS_ENABLED(SPL_FS_EXT4) +#define CONFIG_SPL_FS_LOAD_PAYLOAD_NAME "u-boot-dtb.img" +#endif
+#define CONFIG_SYS_SPL_MALLOC_START 0x68300000 +#define CONFIG_SYS_SPL_MALLOC_SIZE 0x100000 /* 1 MB */
+#endif /* CONFIG_SPL */
+#endif /* __IMX7ULP_SPL_CONFIG_H */