Re: [PATCH 2/3] spi: spi-qpic-snand: add quad mode support

From: Mark Brown

Date: Wed Jul 29 2026 - 11:22:58 EST


On Thu, Jul 16, 2026 at 10:57:46AM +0530, Md Sadre Alam wrote:
> Add support for quad (x4) transfer mode in the QPIC SPI NAND driver.
> The controller supports both single (x1) and quad (x4) SPI transfers,
> but the driver currently operates only in x1 mode.

> @@ -1025,12 +1040,16 @@ static int qcom_spi_cmd_mapping(struct qcom_nand_controller *snandc, u32 opcode,
> *cmd = SPINAND_WRITE_EN;
> break;
> case SPINAND_PROGRAM_EXECUTE:
> - *cmd = (PAGE_ACC | LAST_PAGE | SPI_TRANSFER_MODE_x1 |
> - SPI_WP | SPI_HOLD | OP_PROGRAM_PAGE);
> + if (snandc->qspi->quad_mode)
> + *cmd = (PAGE_ACC | LAST_PAGE | transfer_mode |
> + SPI_WP | SPI_HOLD | OP_PROGRAM_PAGE);

This succeeds but does not initialize cmd, previously we'd accept and
use x1.

> @@ -1042,6 +1061,15 @@ static int qcom_spi_cmd_mapping(struct qcom_nand_controller *snandc, u32 opcode,
> static int qcom_spi_read_page(struct qcom_nand_controller *snandc,
> const struct spi_mem_op *op)
> {
> + int ret;
> + u32 cmd;
> + /* Call mapping once again to update the quad mode based on
> + * buswidth
> + */
> + ret = qcom_spi_cmd_mapping(snandc, op, &cmd);
> + if (ret < 0)
> + return ret;
> +
> if (snandc->qspi->page_rw && snandc->qspi->raw_rw)
> return qcom_spi_read_page_raw(snandc, op);

We never reference cmd in the rest of the function, either we didn't
need to do the mapping or there's a missing update.

Attachment: signature.asc
Description: PGP signature