mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Gabor Juhos <j4g8y7@gmail.com>
To: Mark Brown <broonie@kernel.org>
Cc: Md Sadre Alam <md.alam@oss.qualcomm.com>,
	 Sricharan Ramabadhran <quic_srichara@quicinc.com>,
	 Varadarajan Narayanan <varadarajan.narayanan@oss.qualcomm.com>,
	 linux-spi@vger.kernel.org, linux-mtd@lists.infradead.org,
	 linux-kernel@vger.kernel.org, Gabor Juhos <j4g8y7@gmail.com>
Subject: [PATCH v2 2/7] spi: spi-qpic-snand: use the common qcom_nandc_config_page_read() function
Date: Wed, 02 Dec 2026 21:40:37 +0100	[thread overview]
Message-ID: <20261202-qpic-snand-use-common-functions-v2-2-5dab26aeb815@gmail.com> (raw)
In-Reply-To: <20261202-qpic-snand-use-common-functions-v2-0-5dab26aeb815@gmail.com>

The common function from the 'qpic_common' module provides the same
functionality as the locally implemented counterpart.

Use the common function and remove the local one in order to reduce
code duplication.

No functional changes intended.

Note: in comparison to the local version, the generic function runs
additional code when the 'nandc->props->qpic_version2' flag is not
set, but that does not affect the behaviour of the current driver,
because the respective flag is set since commit 52efc89ccf66 ("spi:
spi-qpic-snand: set 'qpic_version2' flag").

Signed-off-by: Gabor Juhos <j4g8y7@gmail.com>
---
Changes in v2:
- rework to avoid depedency of change-id:
  '20260922-qpic-snand-fix-singlecw-readloc-c4c89b4369f5:v2'
---
 drivers/spi/spi-qpic-snand.c | 19 ++++---------------
 1 file changed, 4 insertions(+), 15 deletions(-)

diff --git a/drivers/spi/spi-qpic-snand.c b/drivers/spi/spi-qpic-snand.c
index 1f5d67c9be36d..23bf86396445f 100644
--- a/drivers/spi/spi-qpic-snand.c
+++ b/drivers/spi/spi-qpic-snand.c
@@ -518,17 +518,6 @@ static void qcom_spi_set_read_loc(struct qcom_nand_controller *snandc, int cw, i
 						   read_size, is_last_read_loc);
 }
 
-static void qcom_spi_config_page_read(struct qcom_nand_controller *snandc)
-{
-	qcom_write_reg_dma(snandc, &snandc->regs->addr0, NAND_ADDR0, 2, 0);
-	qcom_write_reg_dma(snandc, &snandc->regs->cfg0, NAND_DEV0_CFG0, 3, 0);
-	qcom_write_reg_dma(snandc, &snandc->regs->erased_cw_detect_cfg_clr,
-			   NAND_ERASED_CW_DETECT_CFG, 1, 0);
-	qcom_write_reg_dma(snandc, &snandc->regs->erased_cw_detect_cfg_set,
-			   NAND_ERASED_CW_DETECT_CFG, 1,
-			   NAND_ERASED_CW_SET | NAND_BAM_NEXT_SGL);
-}
-
 static void
 qcom_spi_config_cw_read(struct qcom_nand_controller *snandc, bool use_ecc, int cw)
 {
@@ -591,7 +580,7 @@ static void qcom_spi_config_single_cw_page_read(struct qcom_nand_controller *sna
 	__le32 *reg = &snandc->regs->read_location0;
 	int num_cw = snandc->qspi->num_cw;
 
-	qcom_spi_config_page_read(snandc);
+	qcom_nandc_config_page_read(snandc);
 
 	if (cw == (num_cw - 1)) {
 		reg = &snandc->regs->read_location_last0;
@@ -769,7 +758,7 @@ static int qcom_spi_read_cw_raw(struct qcom_nand_controller *snandc, u8 *data_bu
 	snandc->regs->exec = cpu_to_le32(1);
 
 	qcom_spi_set_read_loc(snandc, raw_cw, 0, 0, ecc_cfg->cw_size, 1);
-	qcom_spi_config_page_read(snandc);
+	qcom_nandc_config_page_read(snandc);
 
 	data_size1 = mtd->writesize - ecc_cfg->cw_size * (num_cw - 1);
 	oob_size1 = ecc_cfg->bbm_size;
@@ -874,7 +863,7 @@ static int qcom_spi_read_page_ecc(struct qcom_nand_controller *snandc,
 	snandc->regs->exec = cpu_to_le32(1);
 
 	qcom_clear_bam_transaction(snandc);
-	qcom_spi_config_page_read(snandc);
+	qcom_nandc_config_page_read(snandc);
 
 	for (i = 0; i < num_cw; i++) {
 		int data_size, oob_size;
@@ -955,7 +944,7 @@ static int qcom_spi_read_page_oob(struct qcom_nand_controller *snandc,
 	snandc->regs->ecc_bch_cfg = cpu_to_le32(ecc_bch_cfg);
 	snandc->regs->exec = cpu_to_le32(1);
 
-	qcom_spi_config_page_read(snandc);
+	qcom_nandc_config_page_read(snandc);
 
 	for (i = 0; i < num_cw; i++) {
 		int data_size, oob_size;

-- 
2.56.1


  parent reply	other threads:[~2026-12-02 20:40 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-02 20:40 [PATCH v2 0/7] spi: spi-qpic-snand: use generic code from the 'qpic_common' module Gabor Juhos
2026-12-02 20:40 ` [PATCH v2 1/7] spi: spi-qpic-snand: use the common qcom_nandc_check_flash_errors() function Gabor Juhos
2026-12-02 20:40 ` Gabor Juhos [this message]
2026-12-02 20:40 ` [PATCH v2 3/7] spi: spi-qpic-snand: use the common qcom_nandc_config_page_write() function Gabor Juhos
2026-12-02 20:40 ` [PATCH v2 4/7] spi: spi-qpic-snand: use the common qcom_nandc_config_cw_write() function Gabor Juhos
2026-12-02 20:40 ` [PATCH v2 5/7] spi: spi-qpic-snand: use the common qcom_nandc_set_read_loc_first() function Gabor Juhos
2026-12-02 20:40 ` [PATCH v2 6/7] spi: spi-qpic-snand: use the common qcom_nandc_set_read_loc_last() function Gabor Juhos
2026-12-02 20:40 ` [PATCH v2 7/7] spi: spi-qpic-snand: use the common 'qcom_nandc_read_stats' structure Gabor Juhos

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=20261202-qpic-snand-use-common-functions-v2-2-5dab26aeb815@gmail.com \
    --to=j4g8y7@gmail.com \
    --cc=broonie@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=md.alam@oss.qualcomm.com \
    --cc=quic_srichara@quicinc.com \
    --cc=varadarajan.narayanan@oss.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®