* [PATCH v2 0/2] mtd: rawnand: brcmnand: ECC error handling on EDU transfers @ 2020-06-12 21:29 ` Kamal Dasu 0 siblings, 0 replies; 10+ messages in thread From: Kamal Dasu @ 2020-06-12 21:29 UTC (permalink / raw) To: computersforpeace, kdasu.kdev, miquel.raynal, richard, vigneshr Cc: bcm-kernel-feedback-list, linux-mtd, linux-kernel V2 changes: "mtd: rawnand: brcmnand: Don't default to edu transfer" - no change "mtd: rawnand: brcmnand: ECC error handling on EDU transfers" - Fix typos in commit message and clarify bitflips threhold use - Fix typos in code comments - change bool edu_read to bool edu_err in brcmnand_read() Kamal Dasu (2): mtd: rawnand: brcmnand: Don't default to edu transfer mtd: rawnand: brcmnand: ECC error handling on EDU transfers drivers/mtd/nand/raw/brcmnand/brcmnand.c | 31 ++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) -- 2.17.1 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/ ^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH v2 0/2] mtd: rawnand: brcmnand: ECC error handling on EDU transfers @ 2020-06-12 21:29 ` Kamal Dasu 0 siblings, 0 replies; 10+ messages in thread From: Kamal Dasu @ 2020-06-12 21:29 UTC (permalink / raw) To: computersforpeace, kdasu.kdev, miquel.raynal, richard, vigneshr Cc: linux-mtd, bcm-kernel-feedback-list, linux-kernel V2 changes: "mtd: rawnand: brcmnand: Don't default to edu transfer" - no change "mtd: rawnand: brcmnand: ECC error handling on EDU transfers" - Fix typos in commit message and clarify bitflips threhold use - Fix typos in code comments - change bool edu_read to bool edu_err in brcmnand_read() Kamal Dasu (2): mtd: rawnand: brcmnand: Don't default to edu transfer mtd: rawnand: brcmnand: ECC error handling on EDU transfers drivers/mtd/nand/raw/brcmnand/brcmnand.c | 31 ++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) -- 2.17.1 ^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH v2 1/2] mtd: rawnand: brcmnand: Don't default to edu transfer 2020-06-12 21:29 ` Kamal Dasu @ 2020-06-12 21:29 ` Kamal Dasu -1 siblings, 0 replies; 10+ messages in thread From: Kamal Dasu @ 2020-06-12 21:29 UTC (permalink / raw) To: computersforpeace, kdasu.kdev, miquel.raynal, richard, vigneshr Cc: bcm-kernel-feedback-list, linux-mtd, linux-kernel When flash-dma is absent do not default to using flash-edu. Make sure flash-edu is enabled before setting EDU transfer function. Fixes: a5d53ad26a8b ("mtd: rawnand: brcmnand: Add support for flash-edu for dma transfers") Signed-off-by: Kamal Dasu <kdasu.kdev@gmail.com> --- drivers/mtd/nand/raw/brcmnand/brcmnand.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/mtd/nand/raw/brcmnand/brcmnand.c b/drivers/mtd/nand/raw/brcmnand/brcmnand.c index 8f9ffb46a09f..0c1d6e543586 100644 --- a/drivers/mtd/nand/raw/brcmnand/brcmnand.c +++ b/drivers/mtd/nand/raw/brcmnand/brcmnand.c @@ -2953,8 +2953,9 @@ int brcmnand_probe(struct platform_device *pdev, struct brcmnand_soc *soc) if (ret < 0) goto err; - /* set edu transfer function to call */ - ctrl->dma_trans = brcmnand_edu_trans; + if (has_edu(ctrl)) + /* set edu transfer function to call */ + ctrl->dma_trans = brcmnand_edu_trans; } /* Disable automatic device ID config, direct addressing */ -- 2.17.1 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/ ^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH v2 1/2] mtd: rawnand: brcmnand: Don't default to edu transfer @ 2020-06-12 21:29 ` Kamal Dasu 0 siblings, 0 replies; 10+ messages in thread From: Kamal Dasu @ 2020-06-12 21:29 UTC (permalink / raw) To: computersforpeace, kdasu.kdev, miquel.raynal, richard, vigneshr Cc: linux-mtd, bcm-kernel-feedback-list, linux-kernel When flash-dma is absent do not default to using flash-edu. Make sure flash-edu is enabled before setting EDU transfer function. Fixes: a5d53ad26a8b ("mtd: rawnand: brcmnand: Add support for flash-edu for dma transfers") Signed-off-by: Kamal Dasu <kdasu.kdev@gmail.com> --- drivers/mtd/nand/raw/brcmnand/brcmnand.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/mtd/nand/raw/brcmnand/brcmnand.c b/drivers/mtd/nand/raw/brcmnand/brcmnand.c index 8f9ffb46a09f..0c1d6e543586 100644 --- a/drivers/mtd/nand/raw/brcmnand/brcmnand.c +++ b/drivers/mtd/nand/raw/brcmnand/brcmnand.c @@ -2953,8 +2953,9 @@ int brcmnand_probe(struct platform_device *pdev, struct brcmnand_soc *soc) if (ret < 0) goto err; - /* set edu transfer function to call */ - ctrl->dma_trans = brcmnand_edu_trans; + if (has_edu(ctrl)) + /* set edu transfer function to call */ + ctrl->dma_trans = brcmnand_edu_trans; } /* Disable automatic device ID config, direct addressing */ -- 2.17.1 ^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH v2 1/2] mtd: rawnand: brcmnand: Don't default to edu transfer 2020-06-12 21:29 ` Kamal Dasu @ 2020-06-15 8:59 ` Miquel Raynal -1 siblings, 0 replies; 10+ messages in thread From: Miquel Raynal @ 2020-06-15 8:59 UTC (permalink / raw) To: Kamal Dasu, computersforpeace, miquel.raynal, richard, vigneshr Cc: linux-mtd, bcm-kernel-feedback-list, linux-kernel On Fri, 2020-06-12 at 21:29:01 UTC, Kamal Dasu wrote: > When flash-dma is absent do not default to using flash-edu. > Make sure flash-edu is enabled before setting EDU transfer > function. > > Fixes: a5d53ad26a8b ("mtd: rawnand: brcmnand: Add support for flash-edu for dma transfers") > Signed-off-by: Kamal Dasu <kdasu.kdev@gmail.com> Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git nand/next, thanks. Miquel ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/ ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v2 1/2] mtd: rawnand: brcmnand: Don't default to edu transfer @ 2020-06-15 8:59 ` Miquel Raynal 0 siblings, 0 replies; 10+ messages in thread From: Miquel Raynal @ 2020-06-15 8:59 UTC (permalink / raw) To: Kamal Dasu, computersforpeace, miquel.raynal, richard, vigneshr Cc: bcm-kernel-feedback-list, linux-mtd, linux-kernel On Fri, 2020-06-12 at 21:29:01 UTC, Kamal Dasu wrote: > When flash-dma is absent do not default to using flash-edu. > Make sure flash-edu is enabled before setting EDU transfer > function. > > Fixes: a5d53ad26a8b ("mtd: rawnand: brcmnand: Add support for flash-edu for dma transfers") > Signed-off-by: Kamal Dasu <kdasu.kdev@gmail.com> Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git nand/next, thanks. Miquel ^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH v2 2/2] mtd: rawnand: brcmnand: ECC error handling on EDU transfers 2020-06-12 21:29 ` Kamal Dasu @ 2020-06-12 21:29 ` Kamal Dasu -1 siblings, 0 replies; 10+ messages in thread From: Kamal Dasu @ 2020-06-12 21:29 UTC (permalink / raw) To: computersforpeace, kdasu.kdev, miquel.raynal, richard, vigneshr Cc: bcm-kernel-feedback-list, linux-mtd, linux-kernel Implement ECC correctable and uncorrectable error handling for EDU reads. If ECC correctable bitflips are encountered on EDU transfer, read page again using PIO. This is needed due to a NAND controller limitation where corrected data is not transferred to the DMA buffer on ECC error. This applies to ECC correctable errors that are reported by the controller hardware based on set number of bitflips threshold in the controller threshold register, bitflips below the threshold are corrected silently and are not reported by the controller hardware. Fixes: a5d53ad26a8b ("mtd: rawnand: brcmnand: Add support for flash-edu for dma transfers") Signed-off-by: Kamal Dasu <kdasu.kdev@gmail.com> --- drivers/mtd/nand/raw/brcmnand/brcmnand.c | 26 ++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/drivers/mtd/nand/raw/brcmnand/brcmnand.c b/drivers/mtd/nand/raw/brcmnand/brcmnand.c index 0c1d6e543586..131d5d6e2626 100644 --- a/drivers/mtd/nand/raw/brcmnand/brcmnand.c +++ b/drivers/mtd/nand/raw/brcmnand/brcmnand.c @@ -1855,6 +1855,22 @@ static int brcmnand_edu_trans(struct brcmnand_host *host, u64 addr, u32 *buf, edu_writel(ctrl, EDU_STOP, 0); /* force stop */ edu_readl(ctrl, EDU_STOP); + if (!ret && edu_cmd == EDU_CMD_READ) { + u64 err_addr = 0; + + /* + * check for ECC errors here, subpage ECC errors are + * retained in ECC error address register + */ + err_addr = brcmnand_get_uncorrecc_addr(ctrl); + if (!err_addr) { + err_addr = brcmnand_get_correcc_addr(ctrl); + if (err_addr) + ret = -EUCLEAN; + } else + ret = -EBADMSG; + } + return ret; } @@ -2058,6 +2074,7 @@ static int brcmnand_read(struct mtd_info *mtd, struct nand_chip *chip, u64 err_addr = 0; int err; bool retry = true; + bool edu_err = false; dev_dbg(ctrl->dev, "read %llx -> %p\n", (unsigned long long)addr, buf); @@ -2075,6 +2092,10 @@ static int brcmnand_read(struct mtd_info *mtd, struct nand_chip *chip, else return -EIO; } + + if (has_edu(ctrl) && err_addr) + edu_err = true; + } else { if (oob) memset(oob, 0x99, mtd->oobsize); @@ -2122,6 +2143,11 @@ static int brcmnand_read(struct mtd_info *mtd, struct nand_chip *chip, if (mtd_is_bitflip(err)) { unsigned int corrected = brcmnand_count_corrected(ctrl); + /* in case of EDU correctable error we read again using PIO */ + if (edu_err) + err = brcmnand_read_by_pio(mtd, chip, addr, trans, buf, + oob, &err_addr); + dev_dbg(ctrl->dev, "corrected error at 0x%llx\n", (unsigned long long)err_addr); mtd->ecc_stats.corrected += corrected; -- 2.17.1 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/ ^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH v2 2/2] mtd: rawnand: brcmnand: ECC error handling on EDU transfers @ 2020-06-12 21:29 ` Kamal Dasu 0 siblings, 0 replies; 10+ messages in thread From: Kamal Dasu @ 2020-06-12 21:29 UTC (permalink / raw) To: computersforpeace, kdasu.kdev, miquel.raynal, richard, vigneshr Cc: linux-mtd, bcm-kernel-feedback-list, linux-kernel Implement ECC correctable and uncorrectable error handling for EDU reads. If ECC correctable bitflips are encountered on EDU transfer, read page again using PIO. This is needed due to a NAND controller limitation where corrected data is not transferred to the DMA buffer on ECC error. This applies to ECC correctable errors that are reported by the controller hardware based on set number of bitflips threshold in the controller threshold register, bitflips below the threshold are corrected silently and are not reported by the controller hardware. Fixes: a5d53ad26a8b ("mtd: rawnand: brcmnand: Add support for flash-edu for dma transfers") Signed-off-by: Kamal Dasu <kdasu.kdev@gmail.com> --- drivers/mtd/nand/raw/brcmnand/brcmnand.c | 26 ++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/drivers/mtd/nand/raw/brcmnand/brcmnand.c b/drivers/mtd/nand/raw/brcmnand/brcmnand.c index 0c1d6e543586..131d5d6e2626 100644 --- a/drivers/mtd/nand/raw/brcmnand/brcmnand.c +++ b/drivers/mtd/nand/raw/brcmnand/brcmnand.c @@ -1855,6 +1855,22 @@ static int brcmnand_edu_trans(struct brcmnand_host *host, u64 addr, u32 *buf, edu_writel(ctrl, EDU_STOP, 0); /* force stop */ edu_readl(ctrl, EDU_STOP); + if (!ret && edu_cmd == EDU_CMD_READ) { + u64 err_addr = 0; + + /* + * check for ECC errors here, subpage ECC errors are + * retained in ECC error address register + */ + err_addr = brcmnand_get_uncorrecc_addr(ctrl); + if (!err_addr) { + err_addr = brcmnand_get_correcc_addr(ctrl); + if (err_addr) + ret = -EUCLEAN; + } else + ret = -EBADMSG; + } + return ret; } @@ -2058,6 +2074,7 @@ static int brcmnand_read(struct mtd_info *mtd, struct nand_chip *chip, u64 err_addr = 0; int err; bool retry = true; + bool edu_err = false; dev_dbg(ctrl->dev, "read %llx -> %p\n", (unsigned long long)addr, buf); @@ -2075,6 +2092,10 @@ static int brcmnand_read(struct mtd_info *mtd, struct nand_chip *chip, else return -EIO; } + + if (has_edu(ctrl) && err_addr) + edu_err = true; + } else { if (oob) memset(oob, 0x99, mtd->oobsize); @@ -2122,6 +2143,11 @@ static int brcmnand_read(struct mtd_info *mtd, struct nand_chip *chip, if (mtd_is_bitflip(err)) { unsigned int corrected = brcmnand_count_corrected(ctrl); + /* in case of EDU correctable error we read again using PIO */ + if (edu_err) + err = brcmnand_read_by_pio(mtd, chip, addr, trans, buf, + oob, &err_addr); + dev_dbg(ctrl->dev, "corrected error at 0x%llx\n", (unsigned long long)err_addr); mtd->ecc_stats.corrected += corrected; -- 2.17.1 ^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH v2 2/2] mtd: rawnand: brcmnand: ECC error handling on EDU transfers 2020-06-12 21:29 ` Kamal Dasu @ 2020-06-15 8:59 ` Miquel Raynal -1 siblings, 0 replies; 10+ messages in thread From: Miquel Raynal @ 2020-06-15 8:59 UTC (permalink / raw) To: Kamal Dasu, computersforpeace, miquel.raynal, richard, vigneshr Cc: linux-mtd, bcm-kernel-feedback-list, linux-kernel On Fri, 2020-06-12 at 21:29:02 UTC, Kamal Dasu wrote: > Implement ECC correctable and uncorrectable error handling for EDU > reads. If ECC correctable bitflips are encountered on EDU transfer, > read page again using PIO. This is needed due to a NAND controller > limitation where corrected data is not transferred to the DMA buffer > on ECC error. This applies to ECC correctable errors that are reported > by the controller hardware based on set number of bitflips threshold in > the controller threshold register, bitflips below the threshold are > corrected silently and are not reported by the controller hardware. > > Fixes: a5d53ad26a8b ("mtd: rawnand: brcmnand: Add support for flash-edu for dma transfers") > Signed-off-by: Kamal Dasu <kdasu.kdev@gmail.com> Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git nand/next, thanks. Miquel ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/ ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v2 2/2] mtd: rawnand: brcmnand: ECC error handling on EDU transfers @ 2020-06-15 8:59 ` Miquel Raynal 0 siblings, 0 replies; 10+ messages in thread From: Miquel Raynal @ 2020-06-15 8:59 UTC (permalink / raw) To: Kamal Dasu, computersforpeace, miquel.raynal, richard, vigneshr Cc: bcm-kernel-feedback-list, linux-mtd, linux-kernel On Fri, 2020-06-12 at 21:29:02 UTC, Kamal Dasu wrote: > Implement ECC correctable and uncorrectable error handling for EDU > reads. If ECC correctable bitflips are encountered on EDU transfer, > read page again using PIO. This is needed due to a NAND controller > limitation where corrected data is not transferred to the DMA buffer > on ECC error. This applies to ECC correctable errors that are reported > by the controller hardware based on set number of bitflips threshold in > the controller threshold register, bitflips below the threshold are > corrected silently and are not reported by the controller hardware. > > Fixes: a5d53ad26a8b ("mtd: rawnand: brcmnand: Add support for flash-edu for dma transfers") > Signed-off-by: Kamal Dasu <kdasu.kdev@gmail.com> Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git nand/next, thanks. Miquel ^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2020-06-15 8:59 UTC | newest] Thread overview: 10+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2020-06-12 21:29 [PATCH v2 0/2] mtd: rawnand: brcmnand: ECC error handling on EDU transfers Kamal Dasu 2020-06-12 21:29 ` Kamal Dasu 2020-06-12 21:29 ` [PATCH v2 1/2] mtd: rawnand: brcmnand: Don't default to edu transfer Kamal Dasu 2020-06-12 21:29 ` Kamal Dasu 2020-06-15 8:59 ` Miquel Raynal 2020-06-15 8:59 ` Miquel Raynal 2020-06-12 21:29 ` [PATCH v2 2/2] mtd: rawnand: brcmnand: ECC error handling on EDU transfers Kamal Dasu 2020-06-12 21:29 ` Kamal Dasu 2020-06-15 8:59 ` Miquel Raynal 2020-06-15 8:59 ` Miquel Raynal
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.