Enable XSPI1 on i.MX943 EVK board
Subsystems (4)
v4 cover Enable XSPI1 on i.MX943 EVK board
Changes for v1:
- Add support for XSPI1 on i.MX943 EVK board
Changes for v2:
- Remove the big-endian related code
- Change compatible to "nxp,imx94-xspi"
Changes for v3:
- Add "depends on ARCH_IMX9" to the NXP_XSPI Kconfig entry to prevent this driver from being enabled on unsupported platforms like sandbox
Changes for v4:
- Remove unused struct nxp_xspi *x in xspi_writel() and xspi_readl()
- Rename boolean parameter 'c' to 'wait_mask_set' in xspi_readl_poll_tout()
- Return clk_enable(&x->clk) directly in nxp_xspi_clk_prep_enable()
- Replace WARN_ON with proper error handling
- Change xspi_update_lut() to accept the number of LUT entries directly instead of calculating it from num_of_seq
- Align macro definitions with Tab
- Replace 0x10000 with SZ_64K
- Remove () from XSPI_LUT_KEY_VAL
---
Alice Guo (2):
spi: nxp_xspi: Add new driver for NXP XSPI controller
imx943_evk: Enable XSPI1
Ye Li (2):
misc: ele_api: Add support for XSPI SET GMID command
imx94_evk: Get ownership of XSPI control registers protected by GMID in SPL
MAINTAINERS | 1 + arch/arm/dts/imx943-evk-u-boot.dtsi | 34 ++ arch/arm/dts/imx943-u-boot.dtsi | 16 + arch/arm/include/asm/mach-imx/ele_api.h | 2 + board/nxp/imx94_evk/spl.c | 12 + configs/imx943_evk_defconfig | 9 + drivers/misc/imx_ele/ele_api.c | 28 + drivers/spi/Kconfig | 8 + drivers/spi/Makefile | 1 + drivers/spi/nxp_xspi.c | 914 ++++++++++++++++++++++++++++++++ drivers/spi/nxp_xspi.h | 703 ++++++++++++++++++++++++ 11 files changed, 1728 insertions(+)
---
base-commit: ba7bf918dafcd093ad733b07ba490baeb20cf5da
change-id: 20260312-xspi-ab3bba69ecd3
Best regards,
Signature · 1 line
Alice Guo <[email protected]>
PATCH v4 1/4 spi: nxp_xspi: Add new driver for NXP XSPI controller
From: Alice Guo <[email protected]>
Add new driver to support NXP XSPI controller for NOR and NAND flash. XSPI controller also uses a programmable sequence engine to provide flexibility to support existing and future memory devices. It supports single, dual, quad, octal modes of operation.
--- MAINTAINERS | 1 + drivers/spi/Kconfig | 8 + drivers/spi/Makefile | 1 + drivers/spi/nxp_xspi.c | 914 +++++++++++++++++++++++++++++++++++++++++++++++++ drivers/spi/nxp_xspi.h | 703 +++++++++++++++++++++++++++++++++++++ 5 files changed, 1627 insertions(+)
MAINTAINERS +1 -0
@@ -323,6 +323,7 @@ F: doc/imx/ F: drivers/mailbox/imx-mailbox.c F: drivers/remoteproc/imx* F: drivers/serial/serial_mxc.c +F: drivers/spi/nxp_xspi.c F: include/imx_container.h ARM HISILICON
drivers/spi/Kconfig +8 -0
@@ -408,6 +408,14 @@ config NXP_FSPI Enable the NXP FlexSPI (FSPI) driver. This driver can be used to access the SPI NOR flash on platforms embedding this NXP IP core. +config NXP_XSPI + bool "NXP XSPI driver" + depends on ARCH_IMX9 + depends on SPI_MEM + help + Enable the NXP External SPI (XSPI) driver. This driver can be used to + access the SPI NOR/NAND flash on platforms embedding this NXP IP core. + config OCTEON_SPI bool "Octeon SPI driver" depends on ARCH_OCTEON || ARCH_OCTEONTX || ARCH_OCTEONTX2
drivers/spi/Makefile +1 -0
@@ -61,6 +61,7 @@ obj-$(CONFIG_MXS_SPI) += mxs_spi.o obj-$(CONFIG_NPCM_FIU_SPI) += npcm_fiu_spi.o obj-$(CONFIG_NPCM_PSPI) += npcm_pspi.o obj-$(CONFIG_NXP_FSPI) += nxp_fspi.o +obj-$(CONFIG_NXP_XSPI) += nxp_xspi.o obj-$(CONFIG_ATCSPI200_SPI) += atcspi200_spi.o obj-$(CONFIG_OCTEON_SPI) += octeon_spi.o obj-$(CONFIG_OMAP3_SPI) += omap3_spi.o
drivers/spi/nxp_xspi.c new file +914 -0
914 lines not on this page · raw message
drivers/spi/nxp_xspi.h new file +703 -0
703 lines not on this page · raw message
Signature · 1 line
2.43.0
PATCH v4 2/4 misc: ele_api: Add support for XSPI SET GMID command
In reply to [email protected]From: Ye Li <[email protected]>
The XSPI SET GMID command is used to assign GMID ownership to the requester, allowing access to protected XSPI control registers. This API must be called in SPL if XSPI GMID-protected settings need to be modified. Otherwise, XSPI configuration depends on the previous GMID owner to provide the correct settings.
--- arch/arm/include/asm/mach-imx/ele_api.h | 2 ++ drivers/misc/imx_ele/ele_api.c | 28 ++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+)
arch/arm/include/asm/mach-imx/ele_api.h +2 -0
@@ -49,6 +49,7 @@#define ELE_ATTEST_REQ (0xDB)#define ELE_RELEASE_PATCH_REQ (0xDC)#define ELE_OTP_SEQ_SWITH_REQ (0xDD) +#define ELE_SET_GMID_REQ (0xE4)#define ELE_WRITE_SHADOW_REQ (0xF2)#define ELE_READ_SHADOW_REQ (0xF3)
@@ -162,6 +163,7 @@ int ele_return_lifecycle_update(ulong signed_msg_blk, u32 *response);int ele_start_rng (void );int ele_write_shadow_fuse (u32 fuse_id,u32 fuse_val,u32 *response);int ele_read_shadow_fuse (u32 fuse_id,u32 *fuse_val,u32 *response); +int ele_set_gmid (u32 *response);int ele_volt_change_start_req (void );int ele_volt_change_finish_req (void );#endif
drivers/misc/imx_ele/ele_api.c +28 -0
@@ -844,3 +844,31 @@ int ele_volt_change_finish_req(void)return ret; } + +int ele_set_gmid (u32 *response) +{ +struct udevice *dev = gd->arch.ele_dev; +int size =sizeof (struct ele_msg ); +struct ele_msg msg = {}; +int ret; + +if (!dev) { +printf ("ele dev is not initialized\n" ); +return -ENODEV ; + } + + msg.version =ELE_VERSION ; + msg.tag =ELE_CMD_TAG ; + msg.size =1 ; + msg.command =ELE_SET_GMID_REQ ; + + ret =misc_call (dev, false, &msg, size, &msg, size); +if (ret) +printf ("Error: %s: ret %d, response 0x%x\n" , + __func__, ret, msg.data[0 ]); + +if (response) + *response = msg.data[0 ]; + +return ret; +}
Signature · 1 line
2.43.0
PATCH v4 3/4 imx94_evk: Get ownership of XSPI control registers protected by GMID in SPL
In reply to [email protected]From: Ye Li <[email protected]>
To gain access to certain registers that are protected by GMID, the SPL must release XSPI ownership to the current core.
--- board/nxp/imx94_evk/spl.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
board/nxp/imx94_evk/spl.c +12 -0
@@ -46,6 +46,16 @@ void spl_board_init(void)printf ("Fail to start RNG: %d\n" , ret); } +static void xspi_nor_reset (void ) +{ +int ret; +u32 resp =0 ; + + ret =ele_set_gmid (&resp); +if (ret) +printf ("Fail to set GMID: %d, resp 0x%x\n" , ret, resp); +} +/* SCMI support by default */ void board_init_f (ulong dummy) {
@@ -76,5 +86,7 @@ void board_init_f(ulong dummy)get_reset_reason (true, false); +xspi_nor_reset (); +board_init_r (NULL ,0 ); }
Signature · 1 line
2.43.0
PATCH v4 4/4 imx943_evk: Enable XSPI1
In reply to [email protected]From: Alice Guo <[email protected]>
With this patch, XSPI1 are functional on the i.MX943 EVK board.
--- arch/arm/dts/imx943-evk-u-boot.dtsi | 34 ++++++++++++++++++++++++++++++++++ arch/arm/dts/imx943-u-boot.dtsi | 16 ++++++++++++++++ configs/imx943_evk_defconfig | 9 +++++++++ 3 files changed, 59 insertions(+)
arch/arm/dts/imx943-evk-u-boot.dtsi +34 -0
@@ -157,6 +157,24 @@ status = "disabled"; }; +&xspi1 { + bootph-pre-ram; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_xspi1>; + status = "okay"; + + mt35xu512aba: flash@0 { + bootph-pre-ram; + reg = <0>; + #address-cells = <1>; + #size-cells = <1>; + compatible = "jedec,spi-nor"; + spi-max-frequency = <200000000>; + spi-tx-bus-width = <8>; + spi-rx-bus-width = <8>; + }; +}; + &scmi_iomuxc { pinctrl_emdio: emdiogrp { fsl,pins = <
@@ -205,6 +223,22 @@ IMX94_PAD_GPIO_IO17__LPI2C3_SCL 0x40000b9e >; }; + + pinctrl_xspi1: xspi1grp { + fsl,pins = < + IMX94_PAD_XSPI1_SCLK__XSPI1_A_SCLK 0x3fe + IMX94_PAD_XSPI1_SS0_B__XSPI1_A_SS0_B 0x3fe + IMX94_PAD_XSPI1_DATA0__XSPI1_A_DATA0 0x3fe + IMX94_PAD_XSPI1_DATA1__XSPI1_A_DATA1 0x3fe + IMX94_PAD_XSPI1_DATA2__XSPI1_A_DATA2 0x3fe + IMX94_PAD_XSPI1_DATA3__XSPI1_A_DATA3 0x3fe + IMX94_PAD_XSPI1_DATA4__XSPI1_A_DATA4 0x3fe + IMX94_PAD_XSPI1_DATA5__XSPI1_A_DATA5 0x3fe + IMX94_PAD_XSPI1_DATA6__XSPI1_A_DATA6 0x3fe + IMX94_PAD_XSPI1_DATA7__XSPI1_A_DATA7 0x3fe + IMX94_PAD_XSPI1_DQS__XSPI1_A_DQS 0x3fe + >; + }; }; &pinctrl_reg_usdhc2_vmmc {
arch/arm/dts/imx943-u-boot.dtsi +16 -0
@@ -141,6 +141,22 @@ &aips3 { bootph-all; + + xspi1: spi@42b90000 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "nxp,imx94-xspi"; + reg = <0x42b90000 0x50000>, <0x28000000 0x08000000>; + reg-names = "xspi_base", "xspi_mmap"; + interrupts = <GIC_SPI 390 IRQ_TYPE_LEVEL_HIGH>, // EENV0 + <GIC_SPI 391 IRQ_TYPE_LEVEL_HIGH>, // EENV1 + <GIC_SPI 392 IRQ_TYPE_LEVEL_HIGH>, // EENV2 + <GIC_SPI 393 IRQ_TYPE_LEVEL_HIGH>, // EENV3 + <GIC_SPI 394 IRQ_TYPE_LEVEL_HIGH>; // EENV4 + clocks = <&scmi_clk IMX94_CLK_XSPI1>; + clock-names = "xspi"; + status = "disabled"; + }; }; &clk_ext1 {
configs/imx943_evk_defconfig +9 -0
@@ -107,6 +107,12 @@ CONFIG_I2C_MUX_PCA954x=y CONFIG_IMX_MU_MBOX=y CONFIG_SUPPORT_EMMC_BOOT=y CONFIG_FSL_USDHC=y +CONFIG_MTD=y +CONFIG_DM_SPI_FLASH=y +CONFIG_SPI_FLASH_SOFT_RESET=y +CONFIG_SPI_FLASH_SOFT_RESET_ON_BOOT=y +CONFIG_SPI_FLASH_STMICRO=y +CONFIG_SPI_FLASH_MT35XU=y CONFIG_PHYLIB=y CONFIG_PHY_REALTEK=y CONFIG_DM_MDIO=y
@@ -127,6 +133,9 @@ CONFIG_DM_REGULATOR_GPIO=y CONFIG_DM_RTC=y CONFIG_DM_SERIAL=y CONFIG_FSL_LPUART=y +CONFIG_SPI=y +CONFIG_DM_SPI=y +CONFIG_NXP_XSPI=y CONFIG_USB=y CONFIG_SPL_DM_USB_GADGET=y CONFIG_USB_XHCI_HCD=y
Signature · 1 line
2.43.0