[RESEND PATCH v3 1/1] mx7ulp: add base SPL support for mx7ulp

Oleksandr Suvorov cryosay at gmail.com
Sun Aug 7 16:39:32 CEST 2022


Hi Stefano,

This patchset is superseded by that one
https://patchwork.ozlabs.org/project/uboot/list/?series=312792

On Mon, Jul 11, 2022 at 5:05 PM Oleksandr Suvorov
<oleksandr.suvorov at foundries.io> wrote:
>
> From: Ricardo Salveti <ricardo at 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 at foundries.io>
> Co-developed-by: Oleksandr Suvorov <oleksandr.suvorov at foundries.io>
> Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov at foundries.io>
> ---
>
> Changes in v3:
> - rebase the patch to the current codebase
>
>  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  | 39 ++++++++++++++++++++++++++++++++++
>  5 files changed, 51 insertions(+), 6 deletions(-)
>  create mode 100644 include/configs/imx7ulp_spl.h
>
> diff --git a/arch/arm/Makefile b/arch/arm/Makefile
> index a37603035d8..7c7e88df61c 100644
> --- a/arch/arm/Makefile
> +++ b/arch/arm/Makefile
> @@ -111,7 +111,7 @@ libs-y += arch/arm/cpu/
>  libs-y += arch/arm/lib/
>
>  ifeq ($(CONFIG_SPL_BUILD),y)
> -ifneq (,$(CONFIG_MX23)$(CONFIG_MX28)$(filter $(SOC), mx25 mx5 mx6 mx7 mx35 imx8m imx8 imx8ulp imxrt))
> +ifneq (,$(CONFIG_MX23)$(CONFIG_MX28)$(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 aa0b6447f14..bbf812776bc 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 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 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 64ca2967721..a033d4f6fa1 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 00000000000..33b0444434e
> --- /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_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)
> +#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 */
> --
> 2.36.1
>


-- 
Best regards
Oleksandr

Oleksandr Suvorov
cryosay at gmail.com


More information about the U-Boot mailing list