From: Md Sadre Alam <md.alam@oss.qualcomm.com>
To: Mark Brown <broonie@kernel.org>
Cc: linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-arm-msm@vger.kernel.org,
Md Sadre Alam <mdalam@qti.qualcomm.com>,
Md Sadre Alam <md.alam@oss.qualcomm.com>
Subject: [PATCH v2 1/3] spi: spi-qpic-snand: move command mapping helper
Date: Fri, 07 Aug 2026 21:33:55 +0530 [thread overview]
Message-ID: <20260807-quad-v2-1-8ec821e2f22b@oss.qualcomm.com> (raw)
In-Reply-To: <20260807-quad-v2-0-8ec821e2f22b@oss.qualcomm.com>
Move qcom_spi_cmd_mapping() above qcom_spi_read_page() so it can be
used by read path changes added in a subsequent patch.
No functional change.
Signed-off-by: Md Sadre Alam <md.alam@oss.qualcomm.com>
---
drivers/spi/spi-qpic-snand.c | 96 ++++++++++++++++++++++----------------------
1 file changed, 48 insertions(+), 48 deletions(-)
diff --git a/drivers/spi/spi-qpic-snand.c b/drivers/spi/spi-qpic-snand.c
index 1e2fc875cd66..db105b3fd601 100644
--- a/drivers/spi/spi-qpic-snand.c
+++ b/drivers/spi/spi-qpic-snand.c
@@ -1004,6 +1004,54 @@ static int qcom_spi_read_page_oob(struct qcom_nand_controller *snandc,
return qcom_spi_check_error(snandc);
}
+static int qcom_spi_cmd_mapping(struct qcom_nand_controller *snandc, u32 opcode, u32 *cmd)
+{
+ switch (opcode) {
+ case SPINAND_RESET:
+ *cmd = (SPI_WP | SPI_HOLD | SPI_TRANSFER_MODE_x1 | OP_RESET_DEVICE);
+ break;
+ case SPINAND_READID:
+ *cmd = (SPI_WP | SPI_HOLD | SPI_TRANSFER_MODE_x1 | OP_FETCH_ID);
+ break;
+ case SPINAND_GET_FEATURE:
+ *cmd = (SPI_TRANSFER_MODE_x1 | SPI_WP | SPI_HOLD | ACC_FEATURE);
+ break;
+ case SPINAND_SET_FEATURE:
+ *cmd = (SPI_TRANSFER_MODE_x1 | SPI_WP | SPI_HOLD | ACC_FEATURE |
+ QPIC_SET_FEATURE);
+ break;
+ case SPINAND_READ:
+ if (snandc->qspi->raw_rw) {
+ *cmd = (PAGE_ACC | LAST_PAGE | SPI_TRANSFER_MODE_x1 |
+ SPI_WP | SPI_HOLD | OP_PAGE_READ);
+ } else {
+ *cmd = (PAGE_ACC | LAST_PAGE | SPI_TRANSFER_MODE_x1 |
+ SPI_WP | SPI_HOLD | OP_PAGE_READ_WITH_ECC);
+ }
+
+ break;
+ case SPINAND_ERASE:
+ *cmd = OP_BLOCK_ERASE | PAGE_ACC | LAST_PAGE | SPI_WP |
+ SPI_HOLD | SPI_TRANSFER_MODE_x1;
+ break;
+ case SPINAND_WRITE_EN:
+ *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);
+ break;
+ case SPINAND_PROGRAM_LOAD:
+ *cmd = SPINAND_PROGRAM_LOAD;
+ break;
+ default:
+ dev_err(snandc->dev, "Opcode not supported: %u\n", opcode);
+ return -EOPNOTSUPP;
+ }
+
+ return 0;
+}
+
static int qcom_spi_read_page(struct qcom_nand_controller *snandc,
const struct spi_mem_op *op)
{
@@ -1268,54 +1316,6 @@ static int qcom_spi_program_execute(struct qcom_nand_controller *snandc,
return 0;
}
-static int qcom_spi_cmd_mapping(struct qcom_nand_controller *snandc, u32 opcode, u32 *cmd)
-{
- switch (opcode) {
- case SPINAND_RESET:
- *cmd = (SPI_WP | SPI_HOLD | SPI_TRANSFER_MODE_x1 | OP_RESET_DEVICE);
- break;
- case SPINAND_READID:
- *cmd = (SPI_WP | SPI_HOLD | SPI_TRANSFER_MODE_x1 | OP_FETCH_ID);
- break;
- case SPINAND_GET_FEATURE:
- *cmd = (SPI_TRANSFER_MODE_x1 | SPI_WP | SPI_HOLD | ACC_FEATURE);
- break;
- case SPINAND_SET_FEATURE:
- *cmd = (SPI_TRANSFER_MODE_x1 | SPI_WP | SPI_HOLD | ACC_FEATURE |
- QPIC_SET_FEATURE);
- break;
- case SPINAND_READ:
- if (snandc->qspi->raw_rw) {
- *cmd = (PAGE_ACC | LAST_PAGE | SPI_TRANSFER_MODE_x1 |
- SPI_WP | SPI_HOLD | OP_PAGE_READ);
- } else {
- *cmd = (PAGE_ACC | LAST_PAGE | SPI_TRANSFER_MODE_x1 |
- SPI_WP | SPI_HOLD | OP_PAGE_READ_WITH_ECC);
- }
-
- break;
- case SPINAND_ERASE:
- *cmd = OP_BLOCK_ERASE | PAGE_ACC | LAST_PAGE | SPI_WP |
- SPI_HOLD | SPI_TRANSFER_MODE_x1;
- break;
- case SPINAND_WRITE_EN:
- *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);
- break;
- case SPINAND_PROGRAM_LOAD:
- *cmd = SPINAND_PROGRAM_LOAD;
- break;
- default:
- dev_err(snandc->dev, "Opcode not supported: %u\n", opcode);
- return -EOPNOTSUPP;
- }
-
- return 0;
-}
-
static int qcom_spi_write_page(struct qcom_nand_controller *snandc,
const struct spi_mem_op *op)
{
--
2.34.1
next prev parent reply other threads:[~2026-08-07 16:04 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-07 16:03 [PATCH v2 0/3] Add quad mode support for QPIC SNAND Md Sadre Alam
2026-08-07 16:03 ` Md Sadre Alam [this message]
2026-08-07 16:03 ` [PATCH v2 2/3] spi: spi-qpic-snand: add quad mode support Md Sadre Alam
2026-08-07 16:03 ` [PATCH v2 3/3] spi: spi-qpic-snand: Handle Macronix quad read opcode 0x6b Md Sadre Alam
2026-08-11 21:15 ` [PATCH v2 0/3] Add quad mode support for QPIC SNAND Mark Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260807-quad-v2-1-8ec821e2f22b@oss.qualcomm.com \
--to=md.alam@oss.qualcomm.com \
--cc=broonie@kernel.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-spi@vger.kernel.org \
--cc=mdalam@qti.qualcomm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®