mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Gabor Juhos <j4g8y7@gmail.com>
To: Manivannan Sadhasivam <mani@kernel.org>,
	 Miquel Raynal <miquel.raynal@bootlin.com>,
	 Richard Weinberger <richard@nod.at>,
	Vignesh Raghavendra <vigneshr@ti.com>
Cc: Md Sadre Alam <md.alam@oss.qualcomm.com>,
	linux-mtd@lists.infradead.org,  linux-arm-msm@vger.kernel.org,
	linux-kernel@vger.kernel.org,  Gabor Juhos <j4g8y7@gmail.com>
Subject: [PATCH 3/8] mtd: rawnand: qcom: make config_nand_page_write() more generic
Date: Thu, 24 Sep 2026 22:04:18 +0200	[thread overview]
Message-ID: <20260924-qcom_nandc-share-more-code-v1-3-f3012199b161@gmail.com> (raw)
In-Reply-To: <20260924-qcom_nandc-share-more-code-v1-0-f3012199b161@gmail.com>

The function gets a 'nand_chip' pointer as a parameter but it is
only used to extract a pointer to the nand controller's private
structure from that.

In order to make the function more generic, change the declaration
to get a 'qcom_nandc_controller' pointer directly, and update the
callers accordingly. While at it, also change the function name to
use a 'qpic_nandc' prefix.

No functional changes intended. This is in preparation of moving
the function into the 'qpic_common' code to allow reusing it from
the 'spi-qpic-snand' driver.

Signed-off-by: Gabor Juhos <j4g8y7@gmail.com>
---
 drivers/mtd/nand/raw/qcom_nandc.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/drivers/mtd/nand/raw/qcom_nandc.c b/drivers/mtd/nand/raw/qcom_nandc.c
index c65a8416c3f5..1f3c00823309 100644
--- a/drivers/mtd/nand/raw/qcom_nandc.c
+++ b/drivers/mtd/nand/raw/qcom_nandc.c
@@ -365,10 +365,8 @@ config_nand_single_cw_page_read(struct nand_chip *chip,
  * Helper to prepare DMA descriptors used to configure registers needed for
  * before writing a NAND page.
  */
-static void config_nand_page_write(struct nand_chip *chip)
+static void qcom_nandc_config_page_write(struct qcom_nand_controller *nandc)
 {
-	struct qcom_nand_controller *nandc = get_qcom_nand_controller(chip);
-
 	qcom_write_reg_dma(nandc, &nandc->regs->addr0, NAND_ADDR0, 2, 0);
 	qcom_write_reg_dma(nandc, &nandc->regs->cfg0, NAND_DEV0_CFG0, 3, 0);
 	if (!nandc->props->qpic_version2)
@@ -989,7 +987,7 @@ static int qcom_nandc_write_page(struct nand_chip *chip, const u8 *buf,
 
 	host->use_ecc = true;
 	update_rw_regs(host, ecc->steps, false, 0);
-	config_nand_page_write(chip);
+	qcom_nandc_config_page_write(nandc);
 
 	for (i = 0; i < ecc->steps; i++) {
 		int data_size, oob_size;
@@ -1059,7 +1057,7 @@ static int qcom_nandc_write_page_raw(struct nand_chip *chip,
 
 	host->use_ecc = false;
 	update_rw_regs(host, ecc->steps, false, 0);
-	config_nand_page_write(chip);
+	qcom_nandc_config_page_write(nandc);
 
 	for (i = 0; i < ecc->steps; i++) {
 		int data_size1, data_size2, oob_size1, oob_size2;
@@ -1143,7 +1141,7 @@ static int qcom_nandc_write_oob(struct nand_chip *chip, int page)
 	set_address(host, host->cw_size * (ecc->steps - 1), page);
 	update_rw_regs(host, 1, false, 0);
 
-	config_nand_page_write(chip);
+	qcom_nandc_config_page_write(nandc);
 	qcom_write_data_dma(nandc, FLASH_BUF_ACC,
 			    nandc->data_buffer, data_size + oob_size, 0);
 	config_nand_cw_write(chip);
@@ -1219,7 +1217,7 @@ static int qcom_nandc_block_markbad(struct nand_chip *chip, loff_t ofs)
 	set_address(host, host->cw_size * (ecc->steps - 1), page);
 	update_rw_regs(host, 1, false, ecc->steps - 1);
 
-	config_nand_page_write(chip);
+	qcom_nandc_config_page_write(nandc);
 	qcom_write_data_dma(nandc, FLASH_BUF_ACC,
 			    nandc->data_buffer, host->cw_size, 0);
 	config_nand_cw_write(chip);

-- 
2.55.0


  parent reply	other threads:[~2026-09-24 20:04 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-24 20:04 [PATCH 0/8] mtd: rawnand: qcom: share more common code Gabor Juhos
2026-09-24 20:04 ` [PATCH 1/8] mtd: rawnand: qcom: make check_flash_errors() more generic Gabor Juhos
2026-09-24 20:09   ` sashiko-bot
2026-09-24 20:22     ` Gabor Juhos
2026-09-24 20:04 ` [PATCH 2/8] mtd: rawnand: qcom: make config_nand_page_read() " Gabor Juhos
2026-09-24 20:10   ` sashiko-bot
2026-09-24 20:04 ` Gabor Juhos [this message]
2026-09-24 20:09   ` [PATCH 3/8] mtd: rawnand: qcom: make config_nand_page_write() " sashiko-bot
2026-09-24 20:04 ` [PATCH 4/8] mtd: rawnand: qcom: make config_nand_cw_write() " Gabor Juhos
2026-09-24 20:09   ` sashiko-bot
2026-09-24 20:04 ` [PATCH 5/8] mtd: rawnand: qcom: make nandc_set_read_loc_first() " Gabor Juhos
2026-09-24 20:10   ` sashiko-bot
2026-09-24 20:04 ` [PATCH 6/8] mtd: rawnand: qcom: make nandc_set_read_loc_last() " Gabor Juhos
2026-09-24 20:09   ` sashiko-bot
2026-09-24 20:04 ` [PATCH 7/8] mtd: rawnand: qcom: rename 'nand_stats' structure Gabor Juhos
2026-09-24 20:04 ` [PATCH 8/8] mtd: rawnand: qcom: move common code to the 'qpic_common' module 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=20260924-qcom_nandc-share-more-code-v1-3-f3012199b161@gmail.com \
    --to=j4g8y7@gmail.com \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=mani@kernel.org \
    --cc=md.alam@oss.qualcomm.com \
    --cc=miquel.raynal@bootlin.com \
    --cc=richard@nod.at \
    --cc=vigneshr@ti.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®