All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] Support SPL for i.MX7ULP
@ 2021-09-07 14:58 Oleksandr Suvorov
  2021-09-07 14:58 ` [PATCH 1/2] mx7ulp: select soc features Oleksandr Suvorov
  0 siblings, 1 reply; 5+ messages in thread
From: Oleksandr Suvorov @ 2021-09-07 14:58 UTC (permalink / raw)
  To: u-boot
  Cc: Ricardo Salveti, Igor Opaniuk, Jorge Ramirez-Ortiz,
	Oleksandr Suvorov, Fabio Estevam, Franck LENORMAND,
	Harald Seiler, NXP i.MX U-Boot Team, Peng Fan, Simon Glass,
	Stefano Babic


This patchset adds SPL support for mx7ulp-based boards.


Oleksandr Suvorov (1):
  mx7ulp: select soc features

Ricardo Salveti (1):
  mx7ulp: add base SPL support for mx7ulp

 arch/arm/Makefile                |  2 +-
 arch/arm/mach-imx/Makefile       |  2 +-
 arch/arm/mach-imx/mx7ulp/Kconfig |  3 ++
 arch/arm/mach-imx/mx7ulp/soc.c   |  2 +-
 arch/arm/mach-imx/spl.c          | 12 ++++++--
 include/configs/imx7ulp_spl.h    | 52 ++++++++++++++++++++++++++++++++
 6 files changed, 67 insertions(+), 6 deletions(-)
 create mode 100644 include/configs/imx7ulp_spl.h

-- 
2.31.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/2] mx7ulp: select soc features
  2021-09-07 14:58 [PATCH 0/2] Support SPL for i.MX7ULP Oleksandr Suvorov
@ 2021-09-07 14:58 ` Oleksandr Suvorov
  2021-09-07 14:58   ` [PATCH 2/2] mx7ulp: add base SPL support for mx7ulp Oleksandr Suvorov
  0 siblings, 1 reply; 5+ messages in thread
From: Oleksandr Suvorov @ 2021-09-07 14:58 UTC (permalink / raw)
  To: u-boot
  Cc: Ricardo Salveti, Igor Opaniuk, Jorge Ramirez-Ortiz,
	Oleksandr Suvorov, Fabio Estevam, Franck LENORMAND,
	NXP i.MX U-Boot Team, Peng Fan, Stefano Babic

Force selecting features present in SoC i.MX7ULP.

Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@foundries.io>
---

 arch/arm/mach-imx/mx7ulp/Kconfig | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/arm/mach-imx/mx7ulp/Kconfig b/arch/arm/mach-imx/mx7ulp/Kconfig
index 2ffac9cf7c..56a3efd7b9 100644
--- a/arch/arm/mach-imx/mx7ulp/Kconfig
+++ b/arch/arm/mach-imx/mx7ulp/Kconfig
@@ -9,6 +9,9 @@ config LDO_ENABLED_MODE
 	  Select this option to enable the PMC1 LDO.
 
 config MX7ULP
+	select ARCH_SUPPORT_PSCI
+	select CPU_V7_HAS_NONSEC
+	select CPU_V7_HAS_VIRT
 	select HAS_CAAM
 	bool
 
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] mx7ulp: add base SPL support for mx7ulp
  2021-09-07 14:58 ` [PATCH 1/2] mx7ulp: select soc features Oleksandr Suvorov
@ 2021-09-07 14:58   ` Oleksandr Suvorov
  2021-09-07 19:02     ` Fabio Estevam
  0 siblings, 1 reply; 5+ messages in thread
From: Oleksandr Suvorov @ 2021-09-07 14:58 UTC (permalink / raw)
  To: u-boot
  Cc: Ricardo Salveti, Igor Opaniuk, Jorge Ramirez-Ortiz,
	Oleksandr Suvorov, Fabio Estevam, Harald Seiler,
	NXP i.MX U-Boot Team, Simon Glass, Stefano Babic

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>
---

 arch/arm/Makefile              |  2 +-
 arch/arm/mach-imx/Makefile     |  2 +-
 arch/arm/mach-imx/mx7ulp/soc.c |  2 +-
 arch/arm/mach-imx/spl.c        | 12 ++++++--
 include/configs/imx7ulp_spl.h  | 52 ++++++++++++++++++++++++++++++++++
 5 files changed, 64 insertions(+), 6 deletions(-)
 create mode 100644 include/configs/imx7ulp_spl.h

diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index c68e598a67..03582af414 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -107,7 +107,7 @@ libs-y += arch/arm/cpu/
 libs-y += arch/arm/lib/
 
 ifeq ($(CONFIG_SPL_BUILD),y)
-ifneq (,$(CONFIG_MX23)$(CONFIG_MX28)$(CONFIG_MX35)$(filter $(SOC), mx25 mx5 mx6 mx7 mx35 imx8m imx8 imx8ulp imxrt))
+ifneq (,$(CONFIG_MX23)$(CONFIG_MX28)$(CONFIG_MX35)$(filter $(SOC), mx25 mx5 mx6 mx7 mx7ulp mx35 imx8m imx8 imx8ulp imxrt))
 libs-y += arch/arm/mach-imx/
 endif
 else
diff --git a/arch/arm/mach-imx/Makefile b/arch/arm/mach-imx/Makefile
index 0ef269563d..2ecd1280d4 100644
--- a/arch/arm/mach-imx/Makefile
+++ b/arch/arm/mach-imx/Makefile
@@ -28,7 +28,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 imxrt))
+ifeq ($(SOC),$(filter $(SOC),mx7 mx7ulp mx6 mxs imx8m imx8 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 320f24dd29..6815d73ca6 100644
--- a/arch/arm/mach-imx/mx7ulp/soc.c
+++ b/arch/arm/mach-imx/mx7ulp/soc.c
@@ -196,7 +196,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 36033d611c..2c5ab67154 100644
--- a/arch/arm/mach-imx/spl.c
+++ b/arch/arm/mach-imx/spl.c
@@ -111,8 +111,12 @@ u32 spl_boot_device(void)
 	return BOOT_DEVICE_NONE;
 }
 
-#elif defined(CONFIG_MX7) || defined(CONFIG_IMX8M) || defined(CONFIG_IMX8)
-/* Translate iMX7/i.MX8M boot device to the SPL boot device enumeration */
+#elif defined(CONFIG_MX7) || defined(CONFIG_MX7ULP) || \
+	defined(CONFIG_IMX8M) || defined(CONFIG_IMX8)
+/*
+ * Translate iMX7/i.MX7ULP/i.MX8M/i.MX8 boot device to the SPL boot
+ * device enumeration
+ */
 u32 spl_boot_device(void)
 {
 #if defined(CONFIG_MX7)
@@ -124,7 +128,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
@@ -182,7 +188,7 @@ u32 spl_boot_device(void)
 		return BOOT_DEVICE_NONE;
 	}
 }
-#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 0000000000..14e5982d29
--- /dev/null
+++ b/include/configs/imx7ulp_spl.h
@@ -0,0 +1,52 @@
+/* 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 then enough for the SPL.
+ */
+#define CONFIG_SPL_MAX_SIZE		0x2EC00
+#define CONFIG_SPL_STACK		0x2F03FEB8
+/*
+ * Pad SPL to 191KB (4KB header + 187KB max size). This allows to write the
+ * SPL/U-Boot combination generated with u-boot-with-spl.imx directly to a
+ * boot media (given that boot media specific offset is configured properly).
+ */
+#define CONFIG_SPL_PAD_TO		0x2FC00
+
+/* MMC support */
+#if CONFIG_IS_ENABLED(SPL_MMC_SUPPORT)
+#define CONFIG_SYS_MMCSD_FS_BOOT_PARTITION	1
+#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)
+# if CONFIG_IS_ENABLED(OF_CONTROL)
+#  define CONFIG_SPL_FS_LOAD_PAYLOAD_NAME	"u-boot-dtb.img"
+# else
+#  define CONFIG_SPL_FS_LOAD_PAYLOAD_NAME	"u-boot.img"
+# endif
+#endif
+
+#define CONFIG_SPL_BSS_START_ADDR      0x68200000
+#define CONFIG_SPL_BSS_MAX_SIZE        0x100000		/* 1 MB */
+#define CONFIG_SYS_SPL_MALLOC_START    0x68300000
+#define CONFIG_SYS_SPL_MALLOC_SIZE     0x100000		/* 1 MB */
+
+#endif /* CONFIG_SPL */
+
+#endif /* __IMX7ULP_SPL_CONFIG_H */
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/2] mx7ulp: add base SPL support for mx7ulp
  2021-09-07 14:58   ` [PATCH 2/2] mx7ulp: add base SPL support for mx7ulp Oleksandr Suvorov
@ 2021-09-07 19:02     ` Fabio Estevam
  2021-09-08 11:51       ` Oleksandr Suvorov
  0 siblings, 1 reply; 5+ messages in thread
From: Fabio Estevam @ 2021-09-07 19:02 UTC (permalink / raw)
  To: Oleksandr Suvorov
  Cc: U-Boot-Denx, Ricardo Salveti, Igor Opaniuk, Jorge Ramirez-Ortiz,
	Harald Seiler, NXP i.MX U-Boot Team, Simon Glass, Stefano Babic

Hi Oleksandr,

On Tue, Sep 7, 2021 at 11:59 AM Oleksandr Suvorov
<oleksandr.suvorov@foundries.io> wrote:

>  arch/arm/Makefile              |  2 +-
>  arch/arm/mach-imx/Makefile     |  2 +-
>  arch/arm/mach-imx/mx7ulp/soc.c |  2 +-
>  arch/arm/mach-imx/spl.c        | 12 ++++++--
>  include/configs/imx7ulp_spl.h  | 52 ++++++++++++++++++++++++++++++++++

Could you also include a user for this header file as part of the series?

> + * 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 then enough for the SPL.

s/then/than

> +/* Define the payload for FAT/EXT support */
> +#if CONFIG_IS_ENABLED(SPL_FS_FAT) || CONFIG_IS_ENABLED(SPL_FS_EXT4)
> +# if CONFIG_IS_ENABLED(OF_CONTROL)
> +#  define CONFIG_SPL_FS_LOAD_PAYLOAD_NAME      "u-boot-dtb.img"
> +# else
> +#  define CONFIG_SPL_FS_LOAD_PAYLOAD_NAME      "u-boot.img"

You could drop the ifdef and assume OF_CONTROL is always present.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/2] mx7ulp: add base SPL support for mx7ulp
  2021-09-07 19:02     ` Fabio Estevam
@ 2021-09-08 11:51       ` Oleksandr Suvorov
  0 siblings, 0 replies; 5+ messages in thread
From: Oleksandr Suvorov @ 2021-09-08 11:51 UTC (permalink / raw)
  To: Fabio Estevam
  Cc: U-Boot-Denx, Ricardo Salveti, Igor Opaniuk, Jorge Ramirez-Ortiz,
	Harald Seiler, NXP i.MX U-Boot Team, Simon Glass, Stefano Babic

Hi Fabio,

On Tue, Sep 7, 2021 at 10:03 PM Fabio Estevam <festevam@gmail.com> wrote:
>
> Hi Oleksandr,
>
> On Tue, Sep 7, 2021 at 11:59 AM Oleksandr Suvorov
> <oleksandr.suvorov@foundries.io> wrote:
>
> >  arch/arm/Makefile              |  2 +-
> >  arch/arm/mach-imx/Makefile     |  2 +-
> >  arch/arm/mach-imx/mx7ulp/soc.c |  2 +-
> >  arch/arm/mach-imx/spl.c        | 12 ++++++--
> >  include/configs/imx7ulp_spl.h  | 52 ++++++++++++++++++++++++++++++++++
>
> Could you also include a user for this header file as part of the series?

A user is the EA imx7ulp com board (TARGET_MX7ULP_COM), upstreaming
all stuff for
SPL on that board is impossible right now due to limited resources -
there is a lot of work
for splitting monolithic commits. I can't predict how much time
preparing the SPL-version
of the EA imx7ulp com board will take.
The current patchset is generic for any 7ulp-based board so I think it
will be useful in itself.

> > + * 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 then enough for the SPL.
>
> s/then/than

Thanks, good catch! I'll fix it in the next version.

> > +/* Define the payload for FAT/EXT support */
> > +#if CONFIG_IS_ENABLED(SPL_FS_FAT) || CONFIG_IS_ENABLED(SPL_FS_EXT4)
> > +# if CONFIG_IS_ENABLED(OF_CONTROL)
> > +#  define CONFIG_SPL_FS_LOAD_PAYLOAD_NAME      "u-boot-dtb.img"
> > +# else
> > +#  define CONFIG_SPL_FS_LOAD_PAYLOAD_NAME      "u-boot.img"
>
> You could drop the ifdef and assume OF_CONTROL is always present.

Sure, thanks!

-- 
Best regards,

Oleksandr Suvorov
Software Engineer
W: www.foundries.io

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-09-08 11:52 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-07 14:58 [PATCH 0/2] Support SPL for i.MX7ULP Oleksandr Suvorov
2021-09-07 14:58 ` [PATCH 1/2] mx7ulp: select soc features Oleksandr Suvorov
2021-09-07 14:58   ` [PATCH 2/2] mx7ulp: add base SPL support for mx7ulp Oleksandr Suvorov
2021-09-07 19:02     ` Fabio Estevam
2021-09-08 11:51       ` Oleksandr Suvorov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.