spi: nxp_fspi: Use second last LUT entry for AHB read
PATCH 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.7.4
PATCH 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.7.4
PATCH 3/4 spi: nxp_fspi: Support i.MX8DXL flexspi
In reply to Ye LiDue to a errata on i.MX8DXL flexspi, 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.7.4
Re: [PATCH 3/4] spi: nxp_fspi: Support i.MX8DXL flexspi
Quoted 2 lines · Ye Li
Due to a errata on i.MX8DXL flexspi, we can't use AHB read, only can
Is this erratum public? If so, please add a reference to it.
Re: [PATCH 3/4] spi: nxp_fspi: Support i.MX8DXL flexspi
Quoted 5 lines · Fabio Estevam
Quoted 2 lines · Ye Li
Due to a errata on i.MX8DXL flexspi, we can't use AHB read, only can
Is this erratum public? If so, please add a reference to it.
It is a errata ERR050601 for 8DXL A1 silicon. Latest B0 silicon has it fixed. The public errata doc is only for B0, so this one is not included. I will update the commit log in v2 to add detail description.
Best regards,
Ye Li
PATCH 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.7.4
Hi Ye Li,
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]>
As Tom pointed out in other patches you submitted, please make sure to run checkpatch on all the submissions:
CHECK: Alignment should match open parenthesis #156: FILE: drivers/spi/nxp_fspi.c:543:
+ if (op->data.nbytes && op->data.dir == SPI_MEM_DATA_IN &&
+ op->addr.nbytes) {
total: 0 errors, 0 warnings, 1 checks, 27 lines checked
Please fix and submit a v2.