Add support for FLexSPI Boot for i.MX8m
Subsystems (2)
cover Add support for FLexSPI Boot for i.MX8m
This series of patch adds support for generating FlexSPI Header file and booting from QSPI on i.MX8m.
Mamta Shukla (5):
tools: mkimage: Add support to generate FlexSPI Header for i.MX8m
dts: imx8mm-uboot: Add support to pack FlexSPI Header using binman
configs: Add config for enabling FSPI boot option for i.MX8m
board: freescale: Add QSPI Boot support in spl for i.MX8m
configs: imx8mm: Define CONFIG_SYS_UBOOT_BASE for i.MX8m
arch/arm/dts/imx8mm-u-boot.dtsi | 22 +++- .../imx8mm_evk/imximage-8mm-lpddr4-fspi.cfg | 9 ++ board/freescale/imx8mm_evk/spl.c | 2 + configs/imx8mm_evk_fspi_defconfig | 116 ++++++++++++++++++ include/configs/imx8mm_evk.h | 7 +- include/imximage.h | 38 ++++++ tools/Kconfig | 59 +++++++++ tools/imx8mimage.c | 75 ++++++++++- 8 files changed, 322 insertions(+), 6 deletions(-) create mode 100644 board/freescale/imx8mm_evk/imximage-8mm-lpddr4-fspi.cfg create mode 100644 configs/imx8mm_evk_fspi_defconfig
Signature · 1 line
2.25.1
PATCH 1/5 tools: mkimage: Add support to generate FlexSPI Header for i.MX8m
Add struct with Flex SPI Configuration Block and enable generating fspi header using mkimage.
Refer i.MX 8M Mini Application Processor Reference Manual for detailed information about parameters for FlexSPI Configuration block.
--- include/imximage.h | 38 +++++++++++++++++++++++ tools/Kconfig | 59 ++++++++++++++++++++++++++++++++++++ tools/imx8mimage.c | 75 +++++++++++++++++++++++++++++++++++++++++++--- 3 files changed, 168 insertions(+), 4 deletions(-)
include/imximage.h +38 -0
@@ -201,6 +201,44 @@ struct imx_header { } header; }; +typedef struct { +uint8_t tag[4 ]; +uint8_t version[4 ]; +uint8_t reserved_1[4 ]; +uint8_t read_sample; +uint8_t datahold; +uint8_t datasetup; +uint8_t coladdrwidth; +uint8_t devcfgenable; +uint8_t reserved_2[3 ]; +uint8_t devmodeseq[4 ]; +uint8_t devmodearg[4 ]; +uint8_t cmd_enable; +uint8_t reserved_3[3 ]; +uint8_t cmd_seq[16 ] ; +uint8_t cmd_arg[16 ]; +uint8_t controllermisc[4 ]; +uint8_t dev_type; +uint8_t sflash_pad; +uint8_t serial_clk; +uint8_t lut_custom ; +uint8_t reserved_4[8 ]; +uint8_t sflashA1[4 ]; +uint8_t sflashA2[4 ]; +uint8_t sflashB1[4 ]; +uint8_t sflashB2[4 ]; +uint8_t cspadover[4 ]; +uint8_t sclkpadover[4 ]; +uint8_t datapadover[4 ]; +uint8_t dqspadover[4 ]; +uint8_t timeout[4 ]; +uint8_t commandInt[4 ]; +uint8_t datavalid[4 ]; +uint8_t busyoffset[2 ]; +uint8_t busybitpolarity[2 ]; +uint8_t lut[256 ]; +} __attribute__((packed))fspi_conf ; + typedef void (*set_dcd_val_t)(struct imx_header *imxhdr, char *name, int lineno, int fld, uint32_t value,
tools/Kconfig +59 -0
63 lines not on this page · raw message
tools/imx8mimage.c +71 -4
101 lines not on this page · raw message
Signature · 1 line
2.25.1
Fabio Estevam
reviewerRe: [PATCH 1/5] tools: mkimage: Add support to generate FlexSPI Header for i.MX8m
Hi Mamta,
Quoted 10 lines · Mamta Shukla
void
build_image(int ofd)
{tools/imx8mimage.c +2
-2-int file_off, header_hdmi_off =0 , header_image_off; -int hdmi_fd, ap_fd, sld_fd; +int file_off, header_hdmi_off =0 , header_image_off, fspi_off; +int hdmi_fd, ap_fd, sld_fd, fspi_fd;uint32_t sld_load_addr =0 ;uint32_t csf_off, sld_csf_off =0 ;int ret;
tools/imx8mimage.c void build_image(int ofd) · line 519
Quoted 6 lines
tools/imx8mimage.c +3
-0@@ -455,6 +514,14 @@ void build_image(int ofd) header_image_off = file_off + ivt_offset; +#ifdef CONFIG_FSPI_CONF_HEADER + fspi =CONFIG_FSPI_CONF_FILE ; + fspi_fd =open (fspi,O_RDWR |O_CREAT ,S_IRWXU );
Please check for error in case open() fails.
PATCH 2/5 dts: imx8mm-uboot: Add support to pack FlexSPI Header using binman
In reply to Mamta ShuklaAdd definition for FSPI configuration block and subsequently new offsets for u-boot-spl and u-boot-itb for CONFIG_FSPI_HEADER option.
--- arch/arm/dts/imx8mm-u-boot.dtsi | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-)
arch/arm/dts/imx8mm-u-boot.dtsi +21 -1
@@ -150,7 +150,26 @@ filename = "flash.bin"; pad-byte = <0x00>; - spl { +#ifdef CONFIG_FSPI_CONF_HEADER + fspi_conf_block { + filename = CONFIG_FSPI_CONF_FILE; + type = "blob-ext"; + size = <0x1000>; + }; + + spl { + filename = "spl.bin"; + offset = <0x1000>; + type = "blob-ext"; + }; + + binman_uboot: uboot { + filename = "u-boot.itb"; + offset = <0x58C00>; + type = "blob-ext"; + }; +#else + spl { filename = "spl.bin"; offset = <0x0>; type = "blob-ext";
@@ -161,6 +180,7 @@ offset = <0x57c00>; type = "blob-ext"; }; +#endif }; };
Signature · 1 line
2.25.1
PATCH 3/5 configs: Add config for enabling FSPI boot option for i.MX8m
In reply to Mamta ShuklaAdd imx8mm_evk_fspi_defconfig to build QSPI boot image.
This config is based on imx8mm_evk_defconfig with addtional config options for FSPI Header,SPL offset and imx-image config to boot from FSPI.
--- .../imx8mm_evk/imximage-8mm-lpddr4-fspi.cfg | 9 ++ configs/imx8mm_evk_fspi_defconfig | 116 ++++++++++++++++++ 2 files changed, 125 insertions(+) create mode 100644 board/freescale/imx8mm_evk/imximage-8mm-lpddr4-fspi.cfg create mode 100644 configs/imx8mm_evk_fspi_defconfig
board/freescale/imx8mm_evk/imximage-8mm-lpddr4-fspi.cfg new file +9 -0
@@ -0,0 +1,9 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* + * Copyright 2021 NXP + */ + +#define __ASSEMBLY__ + +BOOT_FROM fspi +LOADER u-boot-spl-ddr.bin 0x7E2000
configs/imx8mm_evk_fspi_defconfig new file +116 -0
116 lines not on this page · raw message
Signature · 1 line
2.25.1
Fabio Estevam
reviewerRe: [PATCH 3/5] configs: Add config for enabling FSPI boot option for i.MX8m
Hi Mamta,
Quoted 6 lines · Mamta Shukla
Add
imx8mm_evk_fspi_defconfigto build QSPI boot image.
This config is based onimx8mm_evk_defconfigwith addtional config options for FSPI Header,SPL offset and imx-image config to boot from FSPI.
Unneeded blank line. Please remove it.
configs/imx8mm_evk_fspi_defconfig line 108
Quoted 7 lines
Signed-off-by Mamta Shukla <[email protected]>Signed-off-by Thomas Haemmerle <[email protected]>configs/imx8mm_evk_fspi_defconfig new file +4
-0+CONFIG_SF_DEFAULT_CS=0 +CONFIG_SF_DEFAULT_SPEED=40000000 +CONFIG_SF_DEFAULT_MODE=0 +
Unneeded blank line. Please remove it.
Also, could you please add an entry into doc/board/nxp/imx8mm_evk.rst with instructions on how to build and boot from QSPI?
Thanks
Fabio Estevam
reviewerRe: [PATCH 3/5] configs: Add config for enabling FSPI boot option for i.MX8m
In reply to Mamta ShuklaQuoted 6 lines · Mamta Shukla
Add
imx8mm_evk_fspi_defconfigto build QSPI boot image.
This config is based onimx8mm_evk_defconfigwith addtional config options for FSPI Header,SPL offset and imx-image config to boot from FSPI.
Quoted 8 lines
Signed-off-by Mamta Shukla <[email protected]>Signed-off-by Thomas Haemmerle <[email protected]>--- .../imx8mm_evk/imximage-8mm-lpddr4-fspi.cfg | 9 ++ configs/imx8mm_evk_fspi_defconfig | 116 ++++++++++++++++++ 2 files changed, 125 insertions(+) create mode 100644 board/freescale/imx8mm_evk/imximage-8mm-lpddr4-fspi.cfg create mode 100644 configs/imx8mm_evk_fspi_defconfig
Also, please add an entry for the new configs/imx8mm_evk_fspi_defconfig inside board/freescale/imx8mm_evk/MAINTAINERS
Thanks
PATCH 4/5 board: freescale: Add QSPI Boot support in spl for i.MX8m
In reply to Mamta ShuklaAdd QSPI Boot option in u-boot-spl for i.MX8m EVK.
--- board/freescale/imx8mm_evk/spl.c | 2 ++ 1 file changed, 2 insertions(+)
board/freescale/imx8mm_evk/spl.c +2 -0
@@ -39,6 +39,8 @@ int spl_board_boot_device(enum boot_device boot_dev_spl)case SD3_BOOT :case MMC3_BOOT :return BOOT_DEVICE_MMC2 ; +case QSPI_BOOT : +return BOOT_DEVICE_NOR ;default :return BOOT_DEVICE_NONE ; }
Signature · 1 line
2.25.1
PATCH 5/5 configs: imx8mm: Define CONFIG_SYS_UBOOT_BASE for i.MX8m
In reply to Mamta ShuklaThe macro CONFIG_SYS_UBOOT_BASE is used by SPL loaders "NOR" and "XIP" to determine the base address of u-boot.
For "NOR" on i.MX8MM it is the base address of QSPI0 plus the offset of the flattened image tree blob.
Although QSPI0_AMBA_BASE is used to define CONFIG_SYS_UBOOT_BASE in multiple board header files for i.MX8MM, it is not specified.
Specify offset of flattened image tree blob (needs to be set to same value as specified in 'binman' node), base address of QSPI0 and size of FlexSPI configuration block.
--- include/configs/imx8mm_evk.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
include/configs/imx8mm_evk.h +6 -1
@@ -13,8 +13,13 @@#define CONFIG_SYS_BOOTM_LEN (64 * SZ_1M)#define CONFIG_SPL_MAX_SIZE (148 * 1024)#define CONFIG_SYS_MONITOR_LEN SZ_512K +#define UBOOT_ITB_OFFSET 0x57C00 +#define QSPI0_AMBA_BASE 0x08000000 +#define FSPI_CONF_BLOCK_SIZE 0x1000 +#define UBOOT_ITB_OFFSET_FSPI \ + (UBOOT_ITB_OFFSET + FSPI_CONF_BLOCK_SIZE)#define CONFIG_SYS_UBOOT_BASE \ - (QSPI0_AMBA_BASE + CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR * 512) + (QSPI0_AMBA_BASE + UBOOT_ITB_OFFSET_FSPI)#ifdef CONFIG_SPL_BUILD #define CONFIG_SPL_STACK 0x920000
Signature · 1 line
2.25.1
Quoted 11 lines · Mamta Shukla
This series of patch adds support for generating FlexSPI Header file and booting from QSPI on i.MX8m.
Mamta Shukla (5):
tools: mkimage: Add support to generate FlexSPI Header for i.MX8m
dts: imx8mm-uboot: Add support to pack FlexSPI Header using binman
configs: Add config for enabling FSPI boot option for i.MX8m
board: freescale: Add QSPI Boot support in spl for i.MX8m
configs: imx8mm: DefineCONFIG_SYS_UBOOT_BASEfor i.MX8m
Thanks for the series. I have reviewed and made some minor comments.
The series looks good: