Skip to content

Commit 28eed9f

Browse files
Abhishek Sahumiquelraynal
authored andcommitted
mtd: rawnand: qcom: modify write_oob to remove read codeword part
QCOM NAND controller layout protects available OOB data bytes with ECC also so when ecc->write_oob() is being called then it can't update just OOB bytes. Currently, it first reads the last codeword which includes old OOB bytes. Then it updates the old OOB bytes with new ones and then again writes the codeword back. The reading codeword is unnecessary since user is responsible to have these bytes cleared to 0xFF. This patch removes the read part and updates the OOB bytes with data area padded with OxFF. Signed-off-by: Abhishek Sahu <absahu@codeaurora.org> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
1 parent add0cfa commit 28eed9f

File tree

1 file changed

+4
-12
lines changed

1 file changed

+4
-12
lines changed

drivers/mtd/nand/raw/qcom_nandc.c

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2064,11 +2064,9 @@ static int qcom_nandc_write_page_raw(struct mtd_info *mtd,
20642064
/*
20652065
* implements ecc->write_oob()
20662066
*
2067-
* the NAND controller cannot write only data or only oob within a codeword,
2068-
* since ecc is calculated for the combined codeword. we first copy the
2069-
* entire contents for the last codeword(data + oob), replace the old oob
2070-
* with the new one in chip->oob_poi, and then write the entire codeword.
2071-
* this read-copy-write operation results in a slight performance loss.
2067+
* the NAND controller cannot write only data or only OOB within a codeword
2068+
* since ECC is calculated for the combined codeword. So update the OOB from
2069+
* chip->oob_poi, and pad the data area with OxFF before writing.
20722070
*/
20732071
static int qcom_nandc_write_oob(struct mtd_info *mtd, struct nand_chip *chip,
20742072
int page)
@@ -2081,19 +2079,13 @@ static int qcom_nandc_write_oob(struct mtd_info *mtd, struct nand_chip *chip,
20812079
int ret;
20822080

20832081
host->use_ecc = true;
2084-
2085-
clear_bam_transaction(nandc);
2086-
ret = copy_last_cw(host, page);
2087-
if (ret)
2088-
return ret;
2089-
2090-
clear_read_regs(nandc);
20912082
clear_bam_transaction(nandc);
20922083

20932084
/* calculate the data and oob size for the last codeword/step */
20942085
data_size = ecc->size - ((ecc->steps - 1) << 2);
20952086
oob_size = mtd->oobavail;
20962087

2088+
memset(nandc->data_buffer, 0xff, host->cw_data);
20972089
/* override new oob content to last codeword */
20982090
mtd_ooblayout_get_databytes(mtd, nandc->data_buffer + data_size, oob,
20992091
0, mtd->oobavail);

0 commit comments

Comments
 (0)