Skip to content

Commit 1f590fa

Browse files
juhosgbroonie
authored andcommitted
spi: spi-qpic-snand: simplify bad block marker duplication
Due to the expectations of the SPINAND code, the driver duplicates the bad block markers during raw OOB reads. It has been implemented by using two if statements, and due to the opposite conditions one of conditional codepaths always runs. Since the effect of both codepaths is the same, remove the if statements and use a single line solution instead. Also add a note about why the duplication is required. No functional changes intended. Signed-off-by: Gabor Juhos <[email protected]> Link: https://patch.msgid.link/20250711-qpic-snand-simplify-bbm-copy-v1-1-dd2608325f72@gmail.com Signed-off-by: Mark Brown <[email protected]>
1 parent 69e536c commit 1f590fa

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

drivers/spi/spi-qpic-snand.c

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -613,10 +613,16 @@ static int qcom_spi_read_last_cw(struct qcom_nand_controller *snandc,
613613

614614
bbpos = mtd->writesize - ecc_cfg->cw_size * (num_cw - 1);
615615

616-
if (snandc->data_buffer[bbpos] == 0xff)
617-
snandc->data_buffer[bbpos + 1] = 0xff;
618-
if (snandc->data_buffer[bbpos] != 0xff)
619-
snandc->data_buffer[bbpos + 1] = snandc->data_buffer[bbpos];
616+
/*
617+
* TODO: The SPINAND code expects two bad block marker bytes
618+
* at the beginning of the OOB area, but the OOB layout used by
619+
* the driver has only one. Duplicate that for now in order to
620+
* avoid certain blocks to be marked as bad.
621+
*
622+
* This can be removed once single-byte bad block marker support
623+
* gets implemented in the SPINAND code.
624+
*/
625+
snandc->data_buffer[bbpos + 1] = snandc->data_buffer[bbpos];
620626

621627
memcpy(op->data.buf.in, snandc->data_buffer + bbpos, op->data.nbytes);
622628

0 commit comments

Comments
 (0)