[PATCH 6/9] mtd: nand: qcom: support for checking read errors for last codeword

From: Abhishek Sahu
Date: Wed Apr 04 2018 - 08:43:26 EST


Add boolean function argument in parse_read_errors to identify
whether the read error has been called for complete page read or
only last codeword read. This will help in subsequent patches to
detect ECC errors in case of last codeword read.

Signed-off-by: Abhishek Sahu <absahu@xxxxxxxxxxxxxx>
---
drivers/mtd/nand/qcom_nandc.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/mtd/nand/qcom_nandc.c b/drivers/mtd/nand/qcom_nandc.c
index ba43752..dce97e8 100644
--- a/drivers/mtd/nand/qcom_nandc.c
+++ b/drivers/mtd/nand/qcom_nandc.c
@@ -1570,7 +1570,7 @@ struct read_stats {
* errors. this is equivalent to what 'ecc->correct()' would do.
*/
static int parse_read_errors(struct qcom_nand_host *host, u8 *data_buf,
- u8 *oob_buf)
+ u8 *oob_buf, bool last_cw)
{
struct nand_chip *chip = &host->chip;
struct qcom_nand_controller *nandc = get_qcom_nand_controller(chip);
@@ -1579,12 +1579,12 @@ static int parse_read_errors(struct qcom_nand_host *host, u8 *data_buf,
unsigned int max_bitflips = 0;
struct read_stats *buf;
bool flash_op_err = false;
- int i;
+ int i, cw_cnt = last_cw ? 1 : ecc->steps;

buf = (struct read_stats *)nandc->reg_read_buf;
nandc_read_buffer_sync(nandc, true);

- for (i = 0; i < ecc->steps; i++, buf++) {
+ for (i = 0; i < cw_cnt; i++, buf++) {
u32 flash, buffer, erased_cw;
int data_len, oob_len;

@@ -1743,7 +1743,8 @@ static int read_page_ecc(struct qcom_nand_host *host, u8 *data_buf,
free_descs(nandc);

if (!ret)
- ret = parse_read_errors(host, data_buf_start, oob_buf_start);
+ ret = parse_read_errors(host, data_buf_start, oob_buf_start,
+ false);

return ret;
}
--
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation