[PATCH] spi: spi-qpic-snand: remove superfluous qcom_spi_set_read_loc() calls

Gabor Juhos posted 1 patch 2 months, 1 week ago
drivers/spi/spi-qpic-snand.c | 4 ----
1 file changed, 4 deletions(-)
[PATCH] spi: spi-qpic-snand: remove superfluous qcom_spi_set_read_loc() calls
Posted by Gabor Juhos 2 months, 1 week ago
Before configuring the registers related to page read, both the
qcom_spi_read_page_ecc() and the qcom_spi_read_page_oob() functions
are calling qcom_spi_set_read_loc() to set the read location for the
first codeword.

However the qcom_spi_set_read_loc() function puts the passed value
into the register write cache only, from where those gets written
to the corresponding register later via DMA.

Yet, the qcom_spi_set_read_loc() is also gets called within the
internal loops, and during the first iteration the read location
register values written by the initial call gets overwritten in
the register cache.

This means that the values written by the first calls are never
getting used in practice, so remove the calls as those are
superfluous.

Signed-off-by: Gabor Juhos <j4g8y7@gmail.com>
---
 drivers/spi/spi-qpic-snand.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/drivers/spi/spi-qpic-snand.c b/drivers/spi/spi-qpic-snand.c
index 7681a91d67d563fd21fcbd69d223b6e846e97787..0334ba738bef2811e3458d20ce69bd3a213cb20b 100644
--- a/drivers/spi/spi-qpic-snand.c
+++ b/drivers/spi/spi-qpic-snand.c
@@ -850,8 +850,6 @@ static int qcom_spi_read_page_ecc(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_set_read_loc(snandc, 0, 0, 0, ecc_cfg->cw_data, 1);
-
 	qcom_clear_bam_transaction(snandc);
 
 	qcom_write_reg_dma(snandc, &snandc->regs->addr0, NAND_ADDR0, 2, 0);
@@ -941,8 +939,6 @@ 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_set_read_loc(snandc, 0, 0, 0, ecc_cfg->cw_data, 1);
-
 	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,

---
base-commit: cb5c2eb459f4c98d584eaf3d3ea7c3612385d081
change-id: 20251128-qpic-snand-superfluous-readloc-c7c245a20a46

Best regards,
-- 
Gabor Juhos <j4g8y7@gmail.com>
Re: [PATCH] spi: spi-qpic-snand: remove superfluous qcom_spi_set_read_loc() calls
Posted by Mark Brown 1 month, 3 weeks ago
On Sat, 29 Nov 2025 11:29:27 +0100, Gabor Juhos wrote:
> Before configuring the registers related to page read, both the
> qcom_spi_read_page_ecc() and the qcom_spi_read_page_oob() functions
> are calling qcom_spi_set_read_loc() to set the read location for the
> first codeword.
> 
> However the qcom_spi_set_read_loc() function puts the passed value
> into the register write cache only, from where those gets written
> to the corresponding register later via DMA.
> 
> [...]

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next

Thanks!

[1/1] spi: spi-qpic-snand: remove superfluous qcom_spi_set_read_loc() calls
      commit: cde4e63e847b4d41f017c2beb119c2668106a88a

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark