[PATCH v4 1/2] imx: imxrt1050-evk: Add support for SPI flash booting

Neha Malcom Francis n-francis at ti.com
Tue Feb 20 05:45:08 CET 2024


Hi Jesse

On 20/02/24 04:30, Jesse Taube wrote:
> Add support for booting the imxrt1050-evk from spi.
> Add imximage config and the ability for SPL to boot from NOR.
> Enable binman in Kconfig and device tree for imxrt* as it is used to
> prepend fspi_header.bin to SPL and u-boot.img.
> 
> Signed-off-by: Jesse Taube <Mr.Bossman075 at gmail.com>
> ---
> V1 -> V2:
>   - Add defconfig to MAINTAINERS
>   - Change Copyright of imximage-nor.cfg to myself
>   - Fix spelling and grammar
>   - Use imperative mood
> V2 -> V3:
>   - Enabled binman for imxrt*
> V3 -> V4:
>   - Mention binman in commit description
>   - Squash enabled binman and this commit
> ---
>   arch/arm/dts/imxrt1020-evk-u-boot.dtsi        |   4 +
>   arch/arm/dts/imxrt1050-evk-u-boot.dtsi        |  31 ++++++
>   arch/arm/dts/imxrt1170-evk-u-boot.dtsi        |   4 +
>   arch/arm/mach-imx/imxrt/Kconfig               |   1 +
>   board/freescale/imxrt1050-evk/MAINTAINERS     |   1 +
>   .../freescale/imxrt1050-evk/imximage-nor.cfg  |  42 ++++++++
>   board/freescale/imxrt1050-evk/imximage.cfg    |  10 +-
>   board/freescale/imxrt1050-evk/imxrt1050-evk.c |   7 +-
>   configs/imxrt1050-evk_defconfig               |   8 +-
>   configs/imxrt1050-evk_fspi_defconfig          | 100 ++++++++++++++++++
>   include/configs/imxrt1050-evk.h               |   6 ++
>   11 files changed, 208 insertions(+), 6 deletions(-)
>   create mode 100644 board/freescale/imxrt1050-evk/imximage-nor.cfg
>   create mode 100644 configs/imxrt1050-evk_fspi_defconfig
> 
> diff --git a/arch/arm/dts/imxrt1020-evk-u-boot.dtsi b/arch/arm/dts/imxrt1020-evk-u-boot.dtsi
> index 46928c07e9..e246de0299 100644
> --- a/arch/arm/dts/imxrt1020-evk-u-boot.dtsi
> +++ b/arch/arm/dts/imxrt1020-evk-u-boot.dtsi
> @@ -5,6 +5,10 @@
>    */
>   
>   / {
> +	binman: binman {
> +		multiple-images;
> +	};
> +
>   	chosen {
>   		bootph-pre-ram;
>   	};
> diff --git a/arch/arm/dts/imxrt1050-evk-u-boot.dtsi b/arch/arm/dts/imxrt1050-evk-u-boot.dtsi
> index a9095e736b..3f54411b7b 100644
> --- a/arch/arm/dts/imxrt1050-evk-u-boot.dtsi
> +++ b/arch/arm/dts/imxrt1050-evk-u-boot.dtsi
> @@ -8,6 +8,10 @@
>   #include "imxrt1050-pinfunc.h"
>   
>   / {
> +	binman: binman {
> +		multiple-images;
> +	};
> +
>   	aliases {
>   		display0 = &lcdif;
>   		usbphy0 = &usbphy1;
> @@ -113,6 +117,33 @@
>   	};
>   };
>   
> +&binman {
> +#ifdef CONFIG_FSPI_CONF_HEADER
> +	imx-boot {
> +		filename = "flash.bin";
> +		pad-byte = <0x00>;
> +
> +		fspi_conf_block {
> +			filename = CONFIG_FSPI_CONF_FILE;
> +			type = "blob-ext";
> +			offset = <0x0>;
> +		};
> +
> +		spl {
> +			filename = "SPL";
> +			offset = <0x1000>;
> +			type = "blob-ext";
> +		};
> +
> +		binman_uboot: uboot {
> +			filename = "u-boot.img";
> +			offset = <0x10000>;
> +			type = "blob-ext";
> +		};
> +	};
> +#endif
> +};
> +
>   &osc {
>   	bootph-pre-ram;
>   };
> diff --git a/arch/arm/dts/imxrt1170-evk-u-boot.dtsi b/arch/arm/dts/imxrt1170-evk-u-boot.dtsi
> index f923a14301..6e892c1af7 100644
> --- a/arch/arm/dts/imxrt1170-evk-u-boot.dtsi
> +++ b/arch/arm/dts/imxrt1170-evk-u-boot.dtsi
> @@ -6,6 +6,10 @@
>    */
>   
>   / {
> +	binman: binman {
> +		multiple-images;
> +	};
> +
>   	chosen {
>   		bootph-pre-ram;
>   	};
> diff --git a/arch/arm/mach-imx/imxrt/Kconfig b/arch/arm/mach-imx/imxrt/Kconfig
> index c1d6b09e77..ccccf702f6 100644
> --- a/arch/arm/mach-imx/imxrt/Kconfig
> +++ b/arch/arm/mach-imx/imxrt/Kconfig
> @@ -2,6 +2,7 @@ if ARCH_IMXRT
>   
>   config IMXRT
>   	bool
> +	select BINMAN
>   	select SYS_FSL_ERRATUM_ESDHC135
>   
>   config IMXRT1020
> diff --git a/board/freescale/imxrt1050-evk/MAINTAINERS b/board/freescale/imxrt1050-evk/MAINTAINERS
> index a872855452..890825b39a 100644
> --- a/board/freescale/imxrt1050-evk/MAINTAINERS
> +++ b/board/freescale/imxrt1050-evk/MAINTAINERS
> @@ -4,3 +4,4 @@ S:	Maintained
>   F:	board/freescale/imxrt1050-evk
>   F:	include/configs/imxrt1050-evk.h
>   F:	configs/imxrt1050-evk_defconfig
> +F:	configs/imxrt1050-evk_fspi_defconfig
> diff --git a/board/freescale/imxrt1050-evk/imximage-nor.cfg b/board/freescale/imxrt1050-evk/imximage-nor.cfg
> new file mode 100644
> index 0000000000..3b80e1f178
> --- /dev/null
> +++ b/board/freescale/imxrt1050-evk/imximage-nor.cfg
> @@ -0,0 +1,42 @@
> +/* SPDX-License-Identifier: GPL-2.0+ */
> +/*
> + * Copyright (C) 2024
> + * Author(s): Jesse Taube <Mr.Bossman075 at gmail.com>
> + */
> +
> +#include <config.h>
> +
> +/* image version */
> +
> +IMAGE_VERSION 2
> +
> +/*
> + * Boot Device : one of
> + * spi/sd/nand/onenand, qspi/nor
> + */
> +
> +BOOT_FROM	nor
> +
> +/*
> + * Device Configuration Data (DCD)
> + *
> + * Each entry must have the format:
> + * Addr-type           Address        Value
> + *
> + * where:
> + *	Addr-type register length (1,2 or 4 bytes)
> + *	Address	  absolute address of the register
> + *	value	  value to be stored in the register
> + */
> +
> +/*
> + * 0x400AC044 is used to configure the flexram.
> + * Unfortunately setting all to OCRAM only works for MMC
> + * and setting all to DTCM only works for FLEXSPI NOR.
> + * This configuration fortunately works for both SPI and MMC.
> +*/
> +/* Set first two banks FlexRAM as OCRAM(01b) and the rest to DTCM(10b) */
> +DATA 4 0x400AC044 0x55aaaaaa
> +/* Use FLEXRAM_BANK_CFG to config FlexRAM */
> +SET_BIT 4 0x400AC040 0x4
> +
> diff --git a/board/freescale/imxrt1050-evk/imximage.cfg b/board/freescale/imxrt1050-evk/imximage.cfg
> index f1f09fd7eb..b30d852194 100644
> --- a/board/freescale/imxrt1050-evk/imximage.cfg
> +++ b/board/freescale/imxrt1050-evk/imximage.cfg
> @@ -29,7 +29,13 @@ BOOT_FROM	sd
>    *	value	  value to be stored in the register
>    */

As a future plan do you think of moving .cfg files to within binman; you can see 
'ti-board-config' entry as an example (tools/binman/etype/ti_board_config.py)

[...]

-- 
Thanking You
Neha Malcom Francis


More information about the U-Boot mailing list