Skip to content

Commit add0cfa

Browse files
Abhishek Sahumiquelraynal
authored andcommitted
mtd: rawnand: qcom: parse read errors for read oob also
read_page and read_oob both calls the read_page_ecc function. The QCOM NAND controller protect the OOB available bytes with ECC so read errors should be checked for read_oob also. This patch moves the error checking code inside read_page_ecc so caller does not have to check explicitly for read errors. Signed-off-by: Abhishek Sahu <absahu@codeaurora.org> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
1 parent 2f61038 commit add0cfa

File tree

1 file changed

+9
-17
lines changed

1 file changed

+9
-17
lines changed

drivers/mtd/nand/raw/qcom_nandc.c

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1698,6 +1698,7 @@ static int read_page_ecc(struct qcom_nand_host *host, u8 *data_buf,
16981698
struct nand_chip *chip = &host->chip;
16991699
struct qcom_nand_controller *nandc = get_qcom_nand_controller(chip);
17001700
struct nand_ecc_ctrl *ecc = &chip->ecc;
1701+
u8 *data_buf_start = data_buf, *oob_buf_start = oob_buf;
17011702
int i, ret;
17021703

17031704
config_nand_page_read(nandc);
@@ -1758,12 +1759,14 @@ static int read_page_ecc(struct qcom_nand_host *host, u8 *data_buf,
17581759
}
17591760

17601761
ret = submit_descs(nandc);
1761-
if (ret)
1762-
dev_err(nandc->dev, "failure to read page/oob\n");
1763-
17641762
free_descs(nandc);
17651763

1766-
return ret;
1764+
if (ret) {
1765+
dev_err(nandc->dev, "failure to read page/oob\n");
1766+
return ret;
1767+
}
1768+
1769+
return parse_read_errors(host, data_buf_start, oob_buf_start);
17671770
}
17681771

17691772
/*
@@ -1808,20 +1811,14 @@ static int qcom_nandc_read_page(struct mtd_info *mtd, struct nand_chip *chip,
18081811
struct qcom_nand_host *host = to_qcom_nand_host(chip);
18091812
struct qcom_nand_controller *nandc = get_qcom_nand_controller(chip);
18101813
u8 *data_buf, *oob_buf = NULL;
1811-
int ret;
18121814

18131815
nand_read_page_op(chip, page, 0, NULL, 0);
18141816
data_buf = buf;
18151817
oob_buf = oob_required ? chip->oob_poi : NULL;
18161818

18171819
clear_bam_transaction(nandc);
1818-
ret = read_page_ecc(host, data_buf, oob_buf);
1819-
if (ret) {
1820-
dev_err(nandc->dev, "failure to read page\n");
1821-
return ret;
1822-
}
18231820

1824-
return parse_read_errors(host, data_buf, oob_buf);
1821+
return read_page_ecc(host, data_buf, oob_buf);
18251822
}
18261823

18271824
/* implements ecc->read_page_raw() */
@@ -1911,7 +1908,6 @@ static int qcom_nandc_read_oob(struct mtd_info *mtd, struct nand_chip *chip,
19111908
struct qcom_nand_host *host = to_qcom_nand_host(chip);
19121909
struct qcom_nand_controller *nandc = get_qcom_nand_controller(chip);
19131910
struct nand_ecc_ctrl *ecc = &chip->ecc;
1914-
int ret;
19151911

19161912
clear_read_regs(nandc);
19171913
clear_bam_transaction(nandc);
@@ -1920,11 +1916,7 @@ static int qcom_nandc_read_oob(struct mtd_info *mtd, struct nand_chip *chip,
19201916
set_address(host, 0, page);
19211917
update_rw_regs(host, ecc->steps, true);
19221918

1923-
ret = read_page_ecc(host, NULL, chip->oob_poi);
1924-
if (ret)
1925-
dev_err(nandc->dev, "failure to read oob\n");
1926-
1927-
return ret;
1919+
return read_page_ecc(host, NULL, chip->oob_poi);
19281920
}
19291921

19301922
/* implements ecc->write_page() */

0 commit comments

Comments
 (0)