Skip to contentSkip to conversation

Enable XSPI1 on i.MX943 EVK board

PATCH Superseded [email protected] 3 participants 8 messages Dec 26, 2025 – Jan 8

Subsystems (4)

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

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

CI: https://github.com/u-boot/u-boot/pull/846/checks
link to the upstream submission:
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/tree/drivers/spi/spi-cadence-xspi.c?h=next-20251219

---
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/freescale/imx94_evk/spl.c         |  12 +
 configs/imx943_evk_defconfig            |   9 +
 drivers/misc/imx_ele/ele_api.c          |  28 +
 drivers/spi/Kconfig                     |   7 +
 drivers/spi/Makefile                    |   1 +
 drivers/spi/nxp_xspi.c                  | 881 ++++++++++++++++++++++++++++++++
 drivers/spi/nxp_xspi.h                  | 705 +++++++++++++++++++++++++
 11 files changed, 1696 insertions(+)

---
base-commit: 56cac250b0839ddbad1311d3ca4231f532b5aadf
change-id: 20251226-xspi-00123b687915

Best regards,

Signature · 1 line
Alice Guo <[email protected]>
#1 lore raw

PATCH v2 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    |   7 +
 drivers/spi/Makefile   |   1 +
 drivers/spi/nxp_xspi.c | 881 +++++++++++++++++++++++++++++++++++++++++++++++++
 drivers/spi/nxp_xspi.h | 705 +++++++++++++++++++++++++++++++++++++++
 5 files changed, 1595 insertions(+)
MAINTAINERS +1 -0
index 6ce0bbce13d..262cd85b1f4 100644
@@ -322,6 +322,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 +7 -0
index 2afb15fff1e..f703c880563 100644
@@ -406,6 +406,13 @@ 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 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
index d5d1e543588..db54a2deb6b 100644
@@ -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 +881 -0

881 lines not on this page · raw message

drivers/spi/nxp_xspi.h new file +705 -0

705 lines not on this page · raw message

Signature · 1 line
2.43.0
#2 lore raw

Re: [PATCH v2 1/4] spi: nxp_xspi: Add new driver for NXP XSPI controller

Quoted 34 lines · On Fri, Dec 26, 2025 at 10:27:40PM +0800, [email protected] wrote:

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    |   7 +
 drivers/spi/Makefile   |   1 +
 drivers/spi/nxp_xspi.c | 881 +++++++++++++++++++++++++++++++++++++++++++++++++
 drivers/spi/nxp_xspi.h | 705 +++++++++++++++++++++++++++++++++++++++
 5 files changed, 1595 insertions(+)
MAINTAINERS +1 -0
index 6ce0bbce13d..262cd85b1f4 100644
@@ -322,6 +322,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 +0 -0
index 2afb15fff1e..f703c880563 100644

drivers/spi/Kconfig config NXP_FSPI · line 414

Quoted 9 lines
drivers/spi/Kconfig +6 -0
@@ -406,6 +406,13 @@ 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 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.

Does this driver build on sandbox? If yes, great, if not, this needs more specific "depends on" logic.

Signature · 1 line
Tom
reviewer
#3 lore raw

Re: [PATCH v2 1/4] spi: nxp_xspi: Add new driver for NXP XSPI controller

Hi Alice,

Quoted 9 lines · Tom Rini

drivers/spi/Kconfig config NXP_FSPI · line 414

Quoted 6 lines
drivers/spi/Kconfig +6 -0
+config NXP_XSPI
+     bool "NXP XSPI driver"
+     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.

Does this driver build on sandbox? If yes, great, if not, this needs more specific "depends on" logic.

Please address Tom's question so we can move forward with this series.

Thanks

#4 lore raw

Re: [PATCH v2 1/4] spi: nxp_xspi: Add new driver for NXP XSPI controller

Quoted 11 lines · Fabio Estevam

Hi Alice,

Quoted 7 lines · Tom Rini
Quoted 6 lines
drivers/spi/Kconfig +6 -0
+config NXP_XSPI
+     bool "NXP XSPI driver"
+     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.
Quoted 4 lines
Quoted 2 lines

Does this driver build on sandbox? If yes, great, if not, this needs more specific "depends on" logic.

Please address Tom's question so we can move forward with this series.

Especially now that CI runs "allyesconfig".

Signature · 1 line
Tom
#5 lore raw

PATCH v2 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
index 64b243dcaaa..09511a7e0d5 100644
@@ -47,6 +47,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)
 
@@ -160,4 +161,5 @@ 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);
 #endif
drivers/misc/imx_ele/ele_api.c +28 -0
index 661f70cf870..e194091fa9d 100644
@@ -794,3 +794,31 @@ int ele_generate_dek_blob(u32 key_id, u32 src_paddr, u32 dst_paddr, u32 max_outp
 
 	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
#6 lore raw

PATCH v2 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/freescale/imx94_evk/spl.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
board/freescale/imx94_evk/spl.c +12 -0
index 341b165b3c8..f4529fb5fb2 100644
@@ -45,6 +45,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)
 {
@@ -77,5 +87,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
#7 lore raw

PATCH v2 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
index 528b3b02a3f..247a7ed6838 100644
@@ -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
index 2b93ba9a38b..3457442a3b0 100644
@@ -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
index 0371dbe28a9..04ac97c1b49 100644
@@ -108,6 +108,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
@@ -128,6 +134,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