spi: nxp_fspi: Use second last LUT entry for AHB read
PATCH v2 1/4 spi: nxp_fspi: Use second last LUT entry for AHB read
Use a dedicated LUT (second last) for AHB read command, so we can directly read from the AHB memory-mapped address and booting M core for XIP on Flexspi NOR.
--- drivers/spi/nxp_fspi.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)
drivers/spi/nxp_fspi.c +12 -2
@@ -539,6 +539,15 @@ static void nxp_fspi_prepare_lut(struct nxp_fspi *f,fspi_writel (f, lutval[i], base + target_lut_reg); } +if (op->data.nbytes && op->data.dir ==SPI_MEM_DATA_IN && + op->addr.nbytes) { + lut_offset = (f->devtype_data->lut_num -2 ) *4 *4 ; +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);
@@ -943,9 +952,10 @@ static int nxp_fspi_default_setup(struct nxp_fspi *f)/* * 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. +* read operation, last entry is used for dynamic lut, the second +* last entry is used for AHB read. */ - seqid_lut = f->devtype_data->lut_num -1 ; + seqid_lut = f->devtype_data->lut_num -2 ;/* 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 );
Signature · 1 line
2.37.1
PATCH v2 2/4 spi: nxp_fspi: Support i.MX8QXP flexspi
Add the compatible string and driver data for i.MX8QXP.
--- drivers/spi/nxp_fspi.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/spi/nxp_fspi.c +10 -0
@@ -337,6 +337,15 @@ static struct nxp_fspi_devtype_data imxrt1170_data = { .little_endian = true, }; +static const struct nxp_fspi_devtype_data imx8qxp_data = { + .rxfifo =SZ_512 ,/* (64 * 64 bits) */ + .txfifo =SZ_1K ,/* (128 * 64 bits) */ + .ahb_buf_size =SZ_2K ,/* (256 * 64 bits) */ + .quirks =0 , + .lut_num =32 , + .little_endian = true,/* little-endian */ +}; +struct nxp_fspi {struct udevice *dev;void __iomem *iobase;
@@ -1081,6 +1090,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,imx8qxp-fspi", .data = (ulong)&imx8qxp_data, }, { .compatible = "nxp,imxrt1170-fspi", .data = (ulong)&imxrt1170_data, }, { } };
Signature · 1 line
2.37.1
PATCH v2 3/4 spi: nxp_fspi: Support i.MX8DXL flexspi
In reply to Ye LiAccording to i.MX8DXL A1 errata ERR050601, concurrent read accesses from the A35 cores to the peripherals within the LSIO subsystem (region 0_5DXX_XXXX) and address spaces in the regions [0_0000_0000 – 0_1BFF_FFFF] and [4_0000_0000 – 4_3FFF_FFFF] can collide and cause data corruption in the returned data, with no failure report. Even a single A35 core accessing both these regions can trigger the issue because an A35 core can have more than one parallel read operation in progress.
The flexspi0 AHB memory is in LSIO region mentioned in above errata. So we can't use AHB read, only can read data from FIFO. Add the compatible string for 8DXL and use a flag for the IPS read.
--- drivers/spi/nxp_fspi.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/spi/nxp_fspi.c +10 -0
@@ -346,6 +346,15 @@ static const struct nxp_fspi_devtype_data imx8qxp_data = { .little_endian = true, /* little-endian */ }; +static const struct nxp_fspi_devtype_data imx8dxl_data = { + .rxfifo =SZ_512 ,/* (64 * 64 bits) */ + .txfifo =SZ_1K ,/* (128 * 64 bits) */ + .ahb_buf_size =SZ_2K ,/* (256 * 64 bits) */ + .quirks =FSPI_QUIRK_USE_IP_ONLY , + .lut_num =32 , + .little_endian = true,/* little-endian */ +}; +struct nxp_fspi {struct udevice *dev;void __iomem *iobase;
@@ -1091,6 +1100,7 @@ static const struct udevice_id nxp_fspi_ids[] = { { .compatible = "nxp,imx8mm-fspi", .data = (ulong)&imx8mm_data, }, { .compatible = "nxp,imx8mp-fspi", .data = (ulong)&imx8mm_data, }, { .compatible = "nxp,imx8qxp-fspi", .data = (ulong)&imx8qxp_data, }, + { .compatible = "nxp,imx8dxl-fspi", .data = (ulong)&imx8dxl_data, }, { .compatible = "nxp,imxrt1170-fspi", .data = (ulong)&imxrt1170_data, }, { } };
Signature · 1 line
2.37.1
PATCH v2 4/4 spi: nxp_fspi: Support i.MX8ULP flexspi
In reply to Ye LiAdd i.MX8ULP flexspi compatible string and driver data.
The flexspi on i.MX8ULP only has 16 LUT sequences and uses 1KB RX FIFO.
--- drivers/spi/nxp_fspi.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/spi/nxp_fspi.c +10 -0
@@ -355,6 +355,15 @@ static const struct nxp_fspi_devtype_data imx8dxl_data = { .little_endian = true, /* little-endian */ }; +static const struct nxp_fspi_devtype_data imx8ulp_data = { + .rxfifo =SZ_1K ,/* (128 * 64 bits) */ + .txfifo =SZ_1K ,/* (128 * 64 bits) */ + .ahb_buf_size =SZ_2K ,/* (256 * 64 bits) */ + .quirks =0 , + .lut_num =16 , + .little_endian = true,/* little-endian */ +}; +struct nxp_fspi {struct udevice *dev;void __iomem *iobase;
@@ -1101,6 +1110,7 @@ static const struct udevice_id nxp_fspi_ids[] = { { .compatible = "nxp,imx8mp-fspi", .data = (ulong)&imx8mm_data, }, { .compatible = "nxp,imx8qxp-fspi", .data = (ulong)&imx8qxp_data, }, { .compatible = "nxp,imx8dxl-fspi", .data = (ulong)&imx8dxl_data, }, + { .compatible = "nxp,imx8ulp-fspi", .data = (ulong)&imx8ulp_data, }, { .compatible = "nxp,imxrt1170-fspi", .data = (ulong)&imxrt1170_data, }, { } };
Signature · 1 line
2.37.1
Quoted 6 lines · Ye Li
Use a dedicated LUT (second last) for AHB read command, so we can directly read from the AHB memory-mapped address and booting M core for XIP on Flexspi NOR.
Signed-off-by Ye Li <[email protected]>
Series applied to -next, thanks.