Skip to contentSkip to conversation

Add FlexSPI support for i.MX RT1170

RFC PATCH Superseded Jonathan Currier 2 participants 8 messages Apr 19, 2025 – May 5, 2025 1 message not in the archive

Subsystems (6)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

cover Add FlexSPI support for i.MX RT1170

The nxp_fspi driver is missing some per-device quirks that are needed for imxrt1170 support.

Fortunately, linux (where the driver originated) has since added support for these qirks.

This series cherry-picks the linux commit, then adds the imxrt1170 usage of the quirks.

I believe Jesse Taube is also working on this problem for the i.mxrt1050, however the patches I saw were quite a bit different, thus this RFC.

Jonathan Currier (3):
spi: fspi: involve lut_num for struct nxp_fspi_devtype_data
spi: fspi: Add imxrt1170 device data
spi: fspi: dev_dbg() call assumes fdt_addr_t always a long long

 arch/arm/dts/imxrt1170-evk.dts              | 28 +++++++++++
 arch/arm/dts/imxrt1170.dtsi                 | 13 +++++
 drivers/clk/imx/clk-imxrt1170.c             |  9 ++++
 drivers/spi/nxp_fspi.c                      | 55 +++++++++++++--------
 include/dt-bindings/clock/imxrt1170-clock.h |  4 +-
 5 files changed, 88 insertions(+), 21 deletions(-)
Signature · 1 line
2.45.3
#2 lore raw

RFC PATCH 1/3 spi: fspi: involve lut_num for struct nxp_fspi_devtype_data

The flexspi on different SoCs may have different number of LUTs. So involve lut_num in nxp_fspi_devtype_data to make distinguish. This patch prepare for the adding of imx8ulp.

Fixes ef89fd56bdfc ("arm64: dts: imx8ulp: add flexspi node")

(Picked from linux 190b7e2efb1ed8435fc7431d9c7a2447d05d5066)

---
 drivers/spi/nxp_fspi.c | 42 +++++++++++++++++++++++-------------------
 1 file changed, 23 insertions(+), 19 deletions(-)
drivers/spi/nxp_fspi.c +23 -19
index 7489c896f9d..3d0f659ecb2 100644
@@ -52,13 +52,6 @@
 #include <linux/bug.h>
 #include <linux/err.h>
 
-/*
- * The driver only uses one single LUT entry, that is updated on
- * each call of exec_op(). Index 0 is preset at boot with a basic
- * read operation, so let's use the last entry (31).
- */
-#define	SEQID_LUT			31
-
 /* Registers used by the driver */
 #define FSPI_MCR0			0x00
 #define FSPI_MCR0_AHB_TIMEOUT(x)	((x) << 24)
@@ -242,9 +235,6 @@
 #define FSPI_TFDR			0x180
 
 #define FSPI_LUT_BASE			0x200
-#define FSPI_LUT_OFFSET			(SEQID_LUT * 4 * 4)
-#define FSPI_LUT_REG(idx) \
-	(FSPI_LUT_BASE + FSPI_LUT_OFFSET + (idx) * 4)
 
 /* register map end */
 
@@ -316,6 +306,7 @@ struct nxp_fspi_devtype_data {
 	unsigned int txfifo;
 	unsigned int ahb_buf_size;
 	unsigned int quirks;
+	unsigned int lut_num;
 	bool little_endian;
 };
 
@@ -324,6 +315,7 @@ static struct nxp_fspi_devtype_data lx2160a_data = {
 	.txfifo = SZ_1K,        /* (128 * 64 bits)  */
 	.ahb_buf_size = SZ_2K,  /* (256 * 64 bits)  */
 	.quirks = 0,
+	.lut_num = 32,
 	.little_endian = true,  /* little-endian    */
 };
 
@@ -332,6 +324,7 @@ static struct nxp_fspi_devtype_data imx8mm_data = {
 	.txfifo = SZ_1K,        /* (128 * 64 bits)  */
 	.ahb_buf_size = SZ_2K,  /* (256 * 64 bits)  */
 	.quirks = 0,
+	.lut_num = 32,
 	.little_endian = true,  /* little-endian    */
 };
 
@@ -486,6 +479,8 @@ static void nxp_fspi_prepare_lut(struct nxp_fspi *f,
 	void __iomem *base = f->iobase;
 	u32 lutval[4] = {};
 	int lutidx = 1, i;
+	u32 lut_offset = (f->devtype_data->lut_num - 1) * 4 * 4;
+	u32 target_lut_reg;
 
 	/* cmd */
 	lutval[0] |= LUT_DEF(0, LUT_CMD, LUT_PAD(op->cmd.buswidth),
@@ -530,8 +525,10 @@ static void nxp_fspi_prepare_lut(struct nxp_fspi *f,
 	fspi_writel(f, FSPI_LCKER_UNLOCK, f->iobase + FSPI_LCKCR);
 
 	/* fill LUT */
-	for (i = 0; i < ARRAY_SIZE(lutval); i++)
-		fspi_writel(f, lutval[i], base + FSPI_LUT_REG(i));
+	for (i = 0; i < ARRAY_SIZE(lutval); i++) {
+		target_lut_reg = FSPI_LUT_BASE + lut_offset + i * 4;
+		fspi_writel(f, lutval[i], base + target_lut_reg);
+	}
 
 	dev_dbg(f->dev, "CMD[%x] lutval[0:%x \t 1:%x \t 2:%x \t 3:%x], size: 0x%08x\n",
 		op->cmd.opcode, lutval[0], lutval[1], lutval[2], lutval[3], op->data.nbytes);
@@ -731,7 +728,7 @@ static int nxp_fspi_do_op(struct nxp_fspi *f, const struct spi_mem_op *op)
 	void __iomem *base = f->iobase;
 	int seqnum = 0;
 	int err = 0;
-	u32 reg;
+	u32 reg, seqid_lut;
 
 	reg = fspi_readl(f, base + FSPI_IPRXFCR);
 	/* invalid RXFIFO first */
@@ -745,8 +742,9 @@ static int nxp_fspi_do_op(struct nxp_fspi *f, const struct spi_mem_op *op)
 	 * the LUT at each exec_op() call. And also specify the DATA
 	 * length, since it's has not been specified in the LUT.
 	 */
+	seqid_lut = f->devtype_data->lut_num - 1;
 	fspi_writel(f, op->data.nbytes |
-		 (SEQID_LUT << FSPI_IPCR1_SEQID_SHIFT) |
+		 (seqid_lut << FSPI_IPCR1_SEQID_SHIFT) |
 		 (seqnum << FSPI_IPCR1_SEQNUM_SHIFT),
 		 base + FSPI_IPCR1);
 
@@ -862,7 +860,7 @@ static int nxp_fspi_default_setup(struct nxp_fspi *f)
 {
 	void __iomem *base = f->iobase;
 	int ret, i;
-	u32 reg;
+	u32 reg, seqid_lut;
 
 #if CONFIG_IS_ENABLED(CLK)
 	/* the default frequency, we will change it later if necessary. */
@@ -933,11 +931,17 @@ static int nxp_fspi_default_setup(struct nxp_fspi *f)
 	fspi_writel(f, reg, base + FSPI_FLSHB1CR1);
 	fspi_writel(f, reg, base + FSPI_FLSHB2CR1);
 
+	/*
+	 * The driver only uses one single LUT entry, that is updated on
+	 * each call of exec_op(). Index 0 is preset at boot with a basic
+	 * read operation, so let's use the last entry.
+	 */
+	seqid_lut = f->devtype_data->lut_num - 1;
 	/* AHB Read - Set lut sequence ID for all CS. */
-	fspi_writel(f, SEQID_LUT, base + FSPI_FLSHA1CR2);
-	fspi_writel(f, SEQID_LUT, base + FSPI_FLSHA2CR2);
-	fspi_writel(f, SEQID_LUT, base + FSPI_FLSHB1CR2);
-	fspi_writel(f, SEQID_LUT, base + FSPI_FLSHB2CR2);
+	fspi_writel(f, seqid_lut, base + FSPI_FLSHA1CR2);
+	fspi_writel(f, seqid_lut, base + FSPI_FLSHA2CR2);
+	fspi_writel(f, seqid_lut, base + FSPI_FLSHB1CR2);
+	fspi_writel(f, seqid_lut, base + FSPI_FLSHB2CR2);
 
 	return 0;
 }
Signature · 1 line
2.45.3
#3 lore raw

RFC PATCH 2/3 spi: fspi: Add imxrt1170 device data

In reply to Jonathan Currier

Add the device specific driver data, the device tree entry, and the clock configuration.

---
 arch/arm/dts/imxrt1170-evk.dts              | 28 +++++++++++++++++++++
 arch/arm/dts/imxrt1170.dtsi                 | 13 ++++++++++
 drivers/clk/imx/clk-imxrt1170.c             |  9 +++++++
 drivers/spi/nxp_fspi.c                      | 10 ++++++++
 include/dt-bindings/clock/imxrt1170-clock.h |  4 ++-
 5 files changed, 63 insertions(+), 1 deletion(-)
arch/arm/dts/imxrt1170-evk.dts +28 -0
index 0d8e7016860..354352477c7 100644
@@ -234,6 +234,34 @@
 					(IMX_PAD_SION | 8)	/* SEMC_DQS */
 			>;
 		};
+
+		pinctrl_flexspi1: flexspi1grp {
+			fsl,pins = <
+				IOMUXC_GPIO_SD_B2_05_FLEXSPI1_A_DQS     0xa
+				IOMUXC_GPIO_SD_B2_06_FLEXSPI1_A_SS0_B   0xa
+				IOMUXC_GPIO_SD_B2_07_FLEXSPI1_A_SCLK    0xa
+				IOMUXC_GPIO_SD_B2_08_FLEXSPI1_A_DATA00  0xa
+				IOMUXC_GPIO_SD_B2_09_FLEXSPI1_A_DATA01  0xa
+				IOMUXC_GPIO_SD_B2_10_FLEXSPI1_A_DATA02  0xa
+				IOMUXC_GPIO_SD_B2_11_FLEXSPI1_A_DATA03  0xa
+			>;
+		};
+	};
+};
+
+&flexspi1 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&pinctrl_flexspi1>;
+	status = "okay";
+
+	flash@0 {
+		compatible = "jedec,spi-nor";
+		reg = <0>;
+		#address-cells = <1>;
+		#size-cells = <1>;
+		spi-max-frequency = <250000000>;
+		spi-tx-bus-width = <4>;
+		spi-rx-bus-width = <4>;
 	};
 };
 
arch/arm/dts/imxrt1170.dtsi +13 -0
index 2de775f043f..08665eaf06a 100644
@@ -246,6 +246,19 @@
 			#interrupt-cells = <2>;
 		};
 
+		flexspi1: spi@400cc000 {
+			compatible = "nxp,imxrt1170-fspi";
+			reg = <0x400cc000 0x800>, <0x30000000 0x10000000>;
+			reg-names = "fspi_base", "fspi_mmap";
+			#address-cells = <1>;
+			#size-cells = <0>;
+			interrupts = <130>;
+			clocks = <&clks IMXRT1170_CLK_DUMMY>,
+				<&clks IMXRT1170_CLK_FLEXSPI1>;
+			clock-names = "fspi_en", "fspi";
+			status = "disabled";
+		};
+
 		gpt1: gpt1@400ec000 {
 			compatible = "fsl,imxrt-gpt";
 			reg = <0x400ec000 0x4000>;
drivers/clk/imx/clk-imxrt1170.c +9 -0
index 88a294f4165..440fb0b001d 100644
@@ -105,6 +105,8 @@ static const char * const usdhc1_sels[] = {"rcosc48M_div2", "osc", "rcosc400M",
 "pll2_pfd2", "pll2_pfd0", "pll1_div5", "pll_arm"};
 static const char * const semc_sels[] = {"rcosc48M_div2", "osc", "rcosc400M", "rcosc16M",
 "pll1_div5", "pll2_sys", "pll2_pfd2", "pll3_pfd0"};
+static const char * const flexspi1_sels[] = {"rcosc48M_div2", "osc", "rcosc400M", "rcosc16M",
+"pll3_pdf0", "pll2_clk", "pll2_pfd2", "pll3_clk"};
 
 static int imxrt1170_clk_probe(struct udevice *dev)
 {
@@ -163,6 +165,13 @@ static int imxrt1170_clk_probe(struct udevice *dev)
 	       imx_clk_divider("lpuart1", "lpuart1_sel",
 			       base + (25 * 0x80), 0, 8));
 
+	clk_dm(IMXRT1170_CLK_FLEXSPI1_SEL,
+	       imx_clk_mux("flexspi1_sel", base + (20 * 0x80), 8, 3,
+			   flexspi1_sels, ARRAY_SIZE(flexspi1_sels)));
+	clk_dm(IMXRT1170_CLK_FLEXSPI1,
+	       imx_clk_divider("flexspi1", "flexspi1_sel",
+			       base + (20 * 0x80), 0, 8));
+
 	clk_dm(IMXRT1170_CLK_USDHC1_SEL,
 	       imx_clk_mux("usdhc1_sel", base + (58 * 0x80), 8, 3,
 			   usdhc1_sels, ARRAY_SIZE(usdhc1_sels)));
drivers/spi/nxp_fspi.c +10 -0
index 3d0f659ecb2..95ad7fcff7f 100644
@@ -328,6 +328,15 @@ static struct nxp_fspi_devtype_data imx8mm_data = {
 	.little_endian = true,  /* little-endian    */
 };
 
+static struct nxp_fspi_devtype_data imxrt1170_data = {
+	.rxfifo = SZ_256,
+	.txfifo = SZ_256,
+	.ahb_buf_size = SZ_4K,
+	.quirks = 0,
+	.lut_num = 16,
+	.little_endian = true,
+};
+
 struct nxp_fspi {
 	struct udevice *dev;
 	void __iomem *iobase;
@@ -1061,6 +1070,7 @@ static const struct udevice_id nxp_fspi_ids[] = {
 	{ .compatible = "nxp,lx2160a-fspi", .data = (ulong)&lx2160a_data, },
 	{ .compatible = "nxp,imx8mm-fspi", .data = (ulong)&imx8mm_data, },
 	{ .compatible = "nxp,imx8mp-fspi", .data = (ulong)&imx8mm_data, },
+	{ .compatible = "nxp,imxrt1170-fspi", .data = (ulong)&imxrt1170_data, },
 	{ }
 };
 
include/dt-bindings/clock/imxrt1170-clock.h +3 -1
index 8ab8018a15e..d3d21cf310d 100644
@@ -43,6 +43,8 @@
 #define IMXRT1170_CLK_GPT1			33
 #define IMXRT1170_CLK_SEMC_SEL			34
 #define IMXRT1170_CLK_SEMC			35
-#define IMXRT1170_CLK_END			36
+#define IMXRT1170_CLK_FLEXSPI1_SEL		36
+#define IMXRT1170_CLK_FLEXSPI1			37
+#define IMXRT1170_CLK_END			38
 
 #endif /* __DT_BINDINGS_CLOCK_IMXRT1170_H */
Signature · 1 line
2.45.3
reviewer
#4 lore raw

Re: [RFC PATCH 2/3] spi: fspi: Add imxrt1170 device data

Hi Jonathan,

Quoted 11 lines · Jonathan Currier

Add the device specific driver data, the device tree entry, and the clock configuration.

---
 arch/arm/dts/imxrt1170-evk.dts              | 28 +++++++++++++++++++++
 arch/arm/dts/imxrt1170.dtsi                 | 13 ++++++++++
 drivers/clk/imx/clk-imxrt1170.c             |  9 +++++++
 drivers/spi/nxp_fspi.c                      | 10 ++++++++
 include/dt-bindings/clock/imxrt1170-clock.h |  4 ++-

Please split the devicetree parts and driver change into two separate patches.

drivers/clk/imx/clk-imxrt1170.c static int imxrt1170_clk_probe(struct udevice *dev) · line 174

Quoted 7 lines
drivers/clk/imx/clk-imxrt1170.c +7 -0
+       clk_dm(IMXRT1170_CLK_FLEXSPI1_SEL,
+              imx_clk_mux("flexspi1_sel", base + (20 * 0x80), 8, 3,
+                          flexspi1_sels, ARRAY_SIZE(flexspi1_sels)));
+       clk_dm(IMXRT1170_CLK_FLEXSPI1,
+              imx_clk_divider("flexspi1", "flexspi1_sel",
+                              base + (20 * 0x80), 0, 8));
+

CI reported the following error:

       arm:  +   imxrt1170-evk

+drivers/clk/imx/clk-imxrt1170.c: In function 'imxrt1170_clk_probe':
+drivers/clk/imx/clk-imxrt1170.c:169:28: error: passing argument 1 of 'imx_clk_mux' from incompatible pointer type [-Wincompatible-pointer-types]

+  169 |                imx_clk_mux("flexspi1_sel", base + (20 * 0x80), 8, 3,
+      |                            ^~~~~~~~~~~~~~
+      |                            |
+      |                            char *

+In file included from drivers/clk/imx/clk-imxrt1170.c:15:
+drivers/clk/imx/clk.h:195:55: note: expected 'struct udevice *' but argument is of type 'char *'
+ 195 | static inline struct clk *imx_clk_mux(struct udevice *dev, const char *name,
+ | ~~~~~~~~~~~~~~~~^~~
+drivers/clk/imx/clk-imxrt1170.c:169:64: error: passing argument 3 of 'imx_clk_mux' makes pointer from integer without a cast [-Wint-conversion]

+      |                                                                ^
+      |                                                                |
+      |                                                                int

+drivers/clk/imx/clk.h:196:39: note: expected 'void *' but argument is of type 'int'
+ 196 | void __iomem *reg, u8 shift, u8
width, const char * const *parents,
+ | ~~~~~~~~~~~~~~^~~
+drivers/clk/imx/clk-imxrt1170.c:170:28: error: passing argument 5 of 'imx_clk_mux' makes integer from pointer without a cast [-Wint-conversion]

+  170 |                            flexspi1_sels, ARRAY_SIZE(flexspi1_sels)));
+      |                            ^~~~~~~~~~~~~
+      |                            const char * const*

+drivers/clk/imx/clk.h:196:57: note: expected 'u8' {aka 'unsigned char'} but argument is of type 'const char * const*'
+ | ~~~^~~~~
+In file included from include/linux/libfdt_env.h:13,

+                 from include/linux/libfdt.h:6,
+                 from include/fdtdec.h:17,
+                 from include/dm/ofnode.h:11,
+                 from include/clk.h:11,
+                 from drivers/clk/imx/clk-imxrt1170.c:7:
+include/linux/kernel.h:44:23: error: passing argument 6 of
'imx_clk_mux' makes pointer from integer without a cast
[-Wint-conversion]
+   44 | #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
+      |                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
+      |                       |
+      |                       unsigned int

+drivers/clk/imx/clk-imxrt1170.c:170:43: note: in expansion of macro 'ARRAY_SIZE'
+ | ^~~~~~~~~~
+drivers/clk/imx/clk.h:196:84: note: expected 'const char * const*' but argument is of type 'unsigned int'
+ |
~~~~~~~~~~~~~~~~~~~~^~~~~~~
+drivers/clk/imx/clk-imxrt1170.c:169:16: error: too few arguments to function 'imx_clk_mux'
+ | ^~~~~~~~~~~
+drivers/clk/imx/clk.h:195:27: note: declared here
+ | ^~~~~~~~~~~
+drivers/clk/imx/clk-imxrt1170.c:172:32: error: passing argument 1 of 'imx_clk_divider' from incompatible pointer type [-Wincompatible-pointer-types]

+  172 |                imx_clk_divider("flexspi1", "flexspi1_sel",
+      |                                ^~~~~~~~~~
+      |                                |
+      |                                char *

+drivers/clk/imx/clk.h:142:59: note: expected 'struct udevice *' but argument is of type 'char *'
+ 142 | static inline struct clk *imx_clk_divider(struct udevice *dev, const char *name,
+ | ~~~~~~~~~~~~~~~~^~~
+drivers/clk/imx/clk-imxrt1170.c:172:16: error: too few arguments to function 'imx_clk_divider'
+ | ^~~~~~~~~~~~~~~
+drivers/clk/imx/clk.h:142:27: note: declared here
+ | ^~~~~~~~~~~~~~~
+make[4]: *** [scripts/Makefile.build:257:
drivers/clk/imx/clk-imxrt1170.o] Error 1
+make[3]: *** [scripts/Makefile.build:398: drivers/clk/imx] Error 2 +make[2]: *** [scripts/Makefile.build:398: drivers/clk] Error 2 +make[1]: *** [Makefile:1919: drivers] Error 2
+make: *** [Makefile:177: sub-make] Error 2

Please fix and resend.

author
#5 lore raw

Re: [RFC PATCH 2/3] spi: fspi: Add imxrt1170 device data

Quoted 15 lines · Fabio Estevam

Hi Jonathan,

Quoted 11 lines · Jonathan Currier

Add the device specific driver data, the device tree entry, and the clock configuration.

---
 arch/arm/dts/imxrt1170-evk.dts              | 28 +++++++++++++++++++++
 arch/arm/dts/imxrt1170.dtsi                 | 13 ++++++++++
 drivers/clk/imx/clk-imxrt1170.c             |  9 +++++++
 drivers/spi/nxp_fspi.c                      | 10 ++++++++
 include/dt-bindings/clock/imxrt1170-clock.h |  4 ++-
Quoted 1 line

Please split the devicetree parts and driver change into two separate patches.

Sure.
Should the dt-bindings include update be part of the driver changes, or the devicetree commit?

Quoted 95 lines

drivers/clk/imx/clk-imxrt1170.c static int imxrt1170_clk_probe(struct udevice *dev) · line 174

Quoted 8 lines
drivers/clk/imx/clk-imxrt1170.c +7 -0
+       clk_dm(IMXRT1170_CLK_FLEXSPI1_SEL,
+              imx_clk_mux("flexspi1_sel", base + (20 * 0x80), 8, 3,
+                          flexspi1_sels, ARRAY_SIZE(flexspi1_sels)));
+       clk_dm(IMXRT1170_CLK_FLEXSPI1,
+              imx_clk_divider("flexspi1", "flexspi1_sel",
+                              base + (20 * 0x80), 0, 8));
+

CI reported the following error:

       arm:  +   imxrt1170-evk
(quoted diff) +2 -0
+drivers/clk/imx/clk-imxrt1170.c: In function 'imxrt1170_clk_probe':
+drivers/clk/imx/clk-imxrt1170.c:169:28: error: passing argument 1 of

'imx_clk_mux' from incompatible pointer type
[-Wincompatible-pointer-types]

(quoted diff) +6 -0
+  169 |                imx_clk_mux("flexspi1_sel", base + (20 * 0x80), 8, 3,
+      |                            ^~~~~~~~~~~~~~
+      |                            |
+      |                            char *
+In file included from drivers/clk/imx/clk-imxrt1170.c:15:
+drivers/clk/imx/clk.h:195:55: note: expected 'struct udevice *' but

argument is of type 'char *'
+ 195 | static inline struct clk *imx_clk_mux(struct udevice *dev, const char *name,

(quoted diff) +2 -0
+      |                                       ~~~~~~~~~~~~~~~~^~~
+drivers/clk/imx/clk-imxrt1170.c:169:64: error: passing argument 3 of

'imx_clk_mux' makes pointer from integer without a cast [-Wint-conversion]

(quoted diff) +4 -0
+      |                                                                ^
+      |                                                                |
+      |                                                                int
+drivers/clk/imx/clk.h:196:39: note: expected 'void *' but argument is

of type 'int'
+ 196 | void __iomem *reg, u8 shift, u8
width, const char * const *parents,

(quoted diff) +2 -0
+      |                         ~~~~~~~~~~~~~~^~~
+drivers/clk/imx/clk-imxrt1170.c:170:28: error: passing argument 5 of

'imx_clk_mux' makes integer from pointer without a cast [-Wint-conversion]

(quoted diff) +4 -0
+  170 |                            flexspi1_sels, ARRAY_SIZE(flexspi1_sels)));
+      |                            ^~~~~~~~~~~~~
+      |                            const char * const*
+drivers/clk/imx/clk.h:196:57: note: expected 'u8' {aka 'unsigned

char'} but argument is of type 'const char * const*'

(quoted diff) +8 -0
+      |                                                      ~~~^~~~~
+In file included from include/linux/libfdt_env.h:13,
+                 from include/linux/libfdt.h:6,
+                 from include/fdtdec.h:17,
+                 from include/dm/ofnode.h:11,
+                 from include/clk.h:11,
+                 from drivers/clk/imx/clk-imxrt1170.c:7:
+include/linux/kernel.h:44:23: error: passing argument 6 of

'imx_clk_mux' makes pointer from integer without a cast [-Wint-conversion]

(quoted diff) +5 -0
+   44 | #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
+      |                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
+      |                       |
+      |                       unsigned int
+drivers/clk/imx/clk-imxrt1170.c:170:43: note: in expansion of macro

'ARRAY_SIZE'

(quoted diff) +2 -0
+      |                                           ^~~~~~~~~~
+drivers/clk/imx/clk.h:196:84: note: expected 'const char * const*'

but argument is of type 'unsigned int'

(quoted diff) +2 -0
+      |
 ~~~~~~~~~~~~~~~~~~~~^~~~~~~
+drivers/clk/imx/clk-imxrt1170.c:169:16: error: too few arguments to

function 'imx_clk_mux'

(quoted diff) +4 -0
+      |                ^~~~~~~~~~~
+drivers/clk/imx/clk.h:195:27: note: declared here
+      |                           ^~~~~~~~~~~
+drivers/clk/imx/clk-imxrt1170.c:172:32: error: passing argument 1 of

'imx_clk_divider' from incompatible pointer type
[-Wincompatible-pointer-types]

(quoted diff) +5 -0
+  172 |                imx_clk_divider("flexspi1", "flexspi1_sel",
+      |                                ^~~~~~~~~~
+      |                                |
+      |                                char *
+drivers/clk/imx/clk.h:142:59: note: expected 'struct udevice *' but

argument is of type 'char *'
+ 142 | static inline struct clk *imx_clk_divider(struct udevice *dev, const char *name,

(quoted diff) +2 -0
+      |                                           ~~~~~~~~~~~~~~~~^~~
+drivers/clk/imx/clk-imxrt1170.c:172:16: error: too few arguments to

function 'imx_clk_divider'

(quoted diff) +4 -0
+      |                ^~~~~~~~~~~~~~~
+drivers/clk/imx/clk.h:142:27: note: declared here
+      |                           ^~~~~~~~~~~~~~~
+make[4]: *** [scripts/Makefile.build:257:

drivers/clk/imx/clk-imxrt1170.o] Error 1

(quoted diff) +4 -0
+make[3]: *** [scripts/Makefile.build:398: drivers/clk/imx] Error 2
+make[2]: *** [scripts/Makefile.build:398: drivers/clk] Error 2
+make[1]: *** [Makefile:1919: drivers] Error 2
+make: *** [Makefile:177: sub-make] Error 2
Quoted 1 line

Please fix and resend.

Looks like master changed the function signatures. I'll rebase, test, etc for the next version.

Sincerely
Jonathan Currier

reviewer
#6 lore raw

Re: [RFC PATCH 2/3] spi: fspi: Add imxrt1170 device data

Hi Jonathan,

Quoted 2 lines · Dullfire

Sure.
Should the dt-bindings include update be part of the driver changes, or the devicetree commit?

It should be part of the devicetree patch.

#7 lore raw

RFC PATCH 3/3 spi: fspi: dev_dbg() call assumes fdt_addr_t always a long long

In reply to Jonathan Currier

On 32-bit systems, e.g. i.mxrt-1170 fdt_addr_t may only be 32-bit. Cast to a "long long" for garbage avoidance.

---
 drivers/spi/nxp_fspi.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/spi/nxp_fspi.c +2 -1
index 95ad7fcff7f..6d97b8eefc9 100644
@@ -1048,7 +1048,8 @@ static int nxp_fspi_of_to_plat(struct udevice *bus)
 	}
 #endif
 
-	dev_dbg(bus, "iobase=<0x%llx>, ahb_addr=<0x%llx>\n", iobase, ahb_addr);
+	dev_dbg(bus, "iobase=<0x%llx>, ahb_addr=<0x%llx>\n",
+			(long long)iobase, (long long)ahb_addr);
 
 	return 0;
 }
Signature · 1 line
2.45.3
reviewer
#8 lore raw
In reply to Jonathan Currier

Hi Jonathan,

Thanks for your patches.

Quoted 7 lines · Jonathan Currier

The nxp_fspi driver is missing some per-device quirks that are needed for imxrt1170 support.

Fortunately, linux (where the driver originated) has since added support for these qirks.

Quoted 6 lines

This series cherry-picks the linux commit, then adds the imxrt1170 usage of the quirks.

I believe Jesse Taube is also working on this problem for the i.mxrt1050, however the patches I saw were quite a bit different, thus this RFC.

Jesse, could you please help test and review this series?

Thanks