* [PATCH 2/2] spi: spi-qpic-snand: remove 'clr*status' members of struct 'qpic_ecc'
2025-08-10 14:38 [PATCH 0/2] spi: spi-qpic-snand: cleanup 'qpic_ecc' structure Gabor Juhos
2025-08-10 14:38 ` [PATCH 1/2] spi: spi-qpic-snand: remove unused 'dev' member of struct 'qpic_ecc' Gabor Juhos
@ 2025-08-10 14:38 ` Gabor Juhos
2025-08-12 14:27 ` [PATCH 0/2] spi: spi-qpic-snand: cleanup 'qpic_ecc' structure Mark Brown
2 siblings, 0 replies; 5+ messages in thread
From: Gabor Juhos @ 2025-08-10 14:38 UTC (permalink / raw)
To: Mark Brown
Cc: Md Sadre Alam, Varadarajan Narayanan, Sricharan Ramabadhran,
linux-spi, linux-mtd, linux-arm-msm, linux-kernel, Gabor Juhos
In the qcom_spi_ecc_init_ctx_pipelined() function, the 'clrflashstatus'
and the 'clrreadstatus' members of the ECC context gets initialized with
constant values. Then these values are used by several functions to set
the corresponding members in the register cache.
Because the values are never modified, change the code to set the those
directly in the register cache by the qcom_spi_ecc_init_ctx_pipelined()
function, and remove the repetitive code from the other functions to
reduce code duplication.
Also, remove the respective members from the 'qpic_ecc' structure as
those became unused due to the change.
No functional changes intended.
Signed-off-by: Gabor Juhos <j4g8y7@gmail.com>
---
drivers/spi/spi-qpic-snand.c | 16 ++--------------
1 file changed, 2 insertions(+), 14 deletions(-)
diff --git a/drivers/spi/spi-qpic-snand.c b/drivers/spi/spi-qpic-snand.c
index bc2158e560be3b0ab1b26882e4de524ecf662d14..01f16f49d4cafa608373a176cd1bd88bd00d2a99 100644
--- a/drivers/spi/spi-qpic-snand.c
+++ b/drivers/spi/spi-qpic-snand.c
@@ -94,8 +94,6 @@ struct qpic_ecc {
u32 cfg1_raw;
u32 ecc_buf_cfg;
u32 ecc_bch_cfg;
- u32 clrflashstatus;
- u32 clrreadstatus;
bool bch_enabled;
};
@@ -381,12 +379,12 @@ static int qcom_spi_ecc_init_ctx_pipelined(struct nand_device *nand)
FIELD_PREP(ECC_PARITY_SIZE_BYTES_BCH_MASK, ecc_cfg->ecc_bytes_hw);
ecc_cfg->ecc_buf_cfg = FIELD_PREP(NUM_STEPS_MASK, 0x203);
- ecc_cfg->clrflashstatus = FS_READY_BSY_N;
- ecc_cfg->clrreadstatus = 0xc0;
conf->step_size = ecc_cfg->step_size;
conf->strength = ecc_cfg->strength;
+ snandc->regs->clrflashstatus = cpu_to_le32(FS_READY_BSY_N);
+ snandc->regs->clrreadstatus = cpu_to_le32(0xc0);
snandc->regs->erased_cw_detect_cfg_clr = cpu_to_le32(CLR_ERASED_PAGE_DET);
snandc->regs->erased_cw_detect_cfg_set = cpu_to_le32(SET_ERASED_PAGE_DET);
@@ -598,8 +596,6 @@ static int qcom_spi_read_last_cw(struct qcom_nand_controller *snandc,
snandc->regs->cfg0 = cpu_to_le32(cfg0);
snandc->regs->cfg1 = cpu_to_le32(cfg1);
snandc->regs->ecc_bch_cfg = cpu_to_le32(ecc_bch_cfg);
- snandc->regs->clrflashstatus = cpu_to_le32(ecc_cfg->clrflashstatus);
- snandc->regs->clrreadstatus = cpu_to_le32(ecc_cfg->clrreadstatus);
snandc->regs->exec = cpu_to_le32(1);
qcom_spi_set_read_loc(snandc, num_cw - 1, 0, 0, ecc_cfg->cw_size, 1);
@@ -733,8 +729,6 @@ static int qcom_spi_read_cw_raw(struct qcom_nand_controller *snandc, u8 *data_bu
snandc->regs->cfg0 = cpu_to_le32(cfg0);
snandc->regs->cfg1 = cpu_to_le32(cfg1);
snandc->regs->ecc_bch_cfg = cpu_to_le32(ecc_bch_cfg);
- snandc->regs->clrflashstatus = cpu_to_le32(ecc_cfg->clrflashstatus);
- snandc->regs->clrreadstatus = cpu_to_le32(ecc_cfg->clrreadstatus);
snandc->regs->exec = cpu_to_le32(1);
qcom_spi_set_read_loc(snandc, raw_cw, 0, 0, ecc_cfg->cw_size, 1);
@@ -849,8 +843,6 @@ static int qcom_spi_read_page_ecc(struct qcom_nand_controller *snandc,
snandc->regs->cfg0 = cpu_to_le32(cfg0);
snandc->regs->cfg1 = cpu_to_le32(cfg1);
snandc->regs->ecc_bch_cfg = cpu_to_le32(ecc_bch_cfg);
- snandc->regs->clrflashstatus = cpu_to_le32(ecc_cfg->clrflashstatus);
- snandc->regs->clrreadstatus = cpu_to_le32(ecc_cfg->clrreadstatus);
snandc->regs->exec = cpu_to_le32(1);
qcom_spi_set_read_loc(snandc, 0, 0, 0, ecc_cfg->cw_data, 1);
@@ -942,8 +934,6 @@ static int qcom_spi_read_page_oob(struct qcom_nand_controller *snandc,
snandc->regs->cfg0 = cpu_to_le32(cfg0);
snandc->regs->cfg1 = cpu_to_le32(cfg1);
snandc->regs->ecc_bch_cfg = cpu_to_le32(ecc_bch_cfg);
- snandc->regs->clrflashstatus = cpu_to_le32(ecc_cfg->clrflashstatus);
- snandc->regs->clrreadstatus = cpu_to_le32(ecc_cfg->clrreadstatus);
snandc->regs->exec = cpu_to_le32(1);
qcom_spi_set_read_loc(snandc, 0, 0, 0, ecc_cfg->cw_data, 1);
@@ -1063,8 +1053,6 @@ static int qcom_spi_program_raw(struct qcom_nand_controller *snandc,
snandc->regs->cfg0 = cpu_to_le32(cfg0);
snandc->regs->cfg1 = cpu_to_le32(cfg1);
snandc->regs->ecc_bch_cfg = cpu_to_le32(ecc_bch_cfg);
- snandc->regs->clrflashstatus = cpu_to_le32(ecc_cfg->clrflashstatus);
- snandc->regs->clrreadstatus = cpu_to_le32(ecc_cfg->clrreadstatus);
snandc->regs->exec = cpu_to_le32(1);
qcom_spi_config_page_write(snandc);
--
2.50.1
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH 0/2] spi: spi-qpic-snand: cleanup 'qpic_ecc' structure
2025-08-10 14:38 [PATCH 0/2] spi: spi-qpic-snand: cleanup 'qpic_ecc' structure Gabor Juhos
2025-08-10 14:38 ` [PATCH 1/2] spi: spi-qpic-snand: remove unused 'dev' member of struct 'qpic_ecc' Gabor Juhos
2025-08-10 14:38 ` [PATCH 2/2] spi: spi-qpic-snand: remove 'clr*status' members " Gabor Juhos
@ 2025-08-12 14:27 ` Mark Brown
2 siblings, 0 replies; 5+ messages in thread
From: Mark Brown @ 2025-08-12 14:27 UTC (permalink / raw)
To: Gabor Juhos
Cc: Md Sadre Alam, Varadarajan Narayanan, Sricharan Ramabadhran,
linux-spi, linux-mtd, linux-arm-msm, linux-kernel
On Sun, 10 Aug 2025 16:38:49 +0200, Gabor Juhos wrote:
> The series consist of two small patches to clean up the qpic_ecc structure
> in the spi-qpic-snand driver. The first one removes an unused member from
> the structure, whereas the second reduces code duplication and removes
> another two members from the same.
>
>
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next
Thanks!
[1/2] spi: spi-qpic-snand: remove unused 'dev' member of struct 'qpic_ecc'
commit: fbec18dc9940a89e094bae890b8dc0af00ddc4ff
[2/2] spi: spi-qpic-snand: remove 'clr*status' members of struct 'qpic_ecc'
commit: 6b7e2aa50bdaf88cd4c2a5e2059a7bf32d85a8b1
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
^ permalink raw reply [flat|nested] 5+ messages in thread