* [U-Boot] [PATCH] mtd: nand: arasan_nfc: Correct nand ecc initialization
@ 2016-05-25 9:50 Siva Durga Prasad Paladugu
2016-05-25 11:12 ` Michal Simek
0 siblings, 1 reply; 2+ messages in thread
From: Siva Durga Prasad Paladugu @ 2016-05-25 9:50 UTC (permalink / raw)
To: u-boot
Correct the nand ecc initialization code
This fixes the issue of incorrect nand ecc
init if no device is found in ecc_matrix then
it endsup ecc init with junk initialization
instead of the most suited one.
Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
---
drivers/mtd/nand/arasan_nfc.c | 18 +++++++++---------
1 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/drivers/mtd/nand/arasan_nfc.c b/drivers/mtd/nand/arasan_nfc.c
index 2d73a05..caa7982 100644
--- a/drivers/mtd/nand/arasan_nfc.c
+++ b/drivers/mtd/nand/arasan_nfc.c
@@ -1058,20 +1058,20 @@ static int arasan_nand_ecc_init(struct mtd_info *mtd)
if (found < 0)
return 1;
- regval = ecc_matrix[i].eccaddr |
- (ecc_matrix[i].eccsize << ARASAN_NAND_ECC_SIZE_SHIFT) |
- (ecc_matrix[i].bch << ARASAN_NAND_ECC_BCH_SHIFT);
+ regval = ecc_matrix[found].eccaddr |
+ (ecc_matrix[found].eccsize << ARASAN_NAND_ECC_SIZE_SHIFT) |
+ (ecc_matrix[found].bch << ARASAN_NAND_ECC_BCH_SHIFT);
writel(regval, &arasan_nand_base->ecc_reg);
- if (ecc_matrix[i].bch) {
+ if (ecc_matrix[found].bch) {
regval = readl(&arasan_nand_base->memadr_reg2);
regval &= ~ARASAN_NAND_MEM_ADDR2_BCH_MASK;
- regval |= (ecc_matrix[i].bchval <<
+ regval |= (ecc_matrix[found].bchval <<
ARASAN_NAND_MEM_ADDR2_BCH_SHIFT);
writel(regval, &arasan_nand_base->memadr_reg2);
}
- nand_oob.eccbytes = ecc_matrix[i].eccsize;
+ nand_oob.eccbytes = ecc_matrix[found].eccsize;
eccpos_start = mtd->oobsize - nand_oob.eccbytes;
for (i = 0; i < nand_oob.eccbytes; i++)
@@ -1080,9 +1080,9 @@ static int arasan_nand_ecc_init(struct mtd_info *mtd)
nand_oob.oobfree[0].offset = 2;
nand_oob.oobfree[0].length = eccpos_start - 2;
- nand_chip->ecc.size = ecc_matrix[i].ecc_codeword_size;
- nand_chip->ecc.strength = ecc_matrix[i].eccbits;
- nand_chip->ecc.bytes = ecc_matrix[i].eccsize;
+ nand_chip->ecc.size = ecc_matrix[found].ecc_codeword_size;
+ nand_chip->ecc.strength = ecc_matrix[found].eccbits;
+ nand_chip->ecc.bytes = ecc_matrix[found].eccsize;
nand_chip->ecc.layout = &nand_oob;
return 0;
--
1.7.1
^ permalink raw reply related [flat|nested] 2+ messages in thread* [U-Boot] [PATCH] mtd: nand: arasan_nfc: Correct nand ecc initialization
2016-05-25 9:50 [U-Boot] [PATCH] mtd: nand: arasan_nfc: Correct nand ecc initialization Siva Durga Prasad Paladugu
@ 2016-05-25 11:12 ` Michal Simek
0 siblings, 0 replies; 2+ messages in thread
From: Michal Simek @ 2016-05-25 11:12 UTC (permalink / raw)
To: u-boot
On 25.5.2016 11:50, Siva Durga Prasad Paladugu wrote:
> Correct the nand ecc initialization code
> This fixes the issue of incorrect nand ecc
> init if no device is found in ecc_matrix then
> it endsup ecc init with junk initialization
> instead of the most suited one.
>
> Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
> ---
> drivers/mtd/nand/arasan_nfc.c | 18 +++++++++---------
> 1 files changed, 9 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/mtd/nand/arasan_nfc.c b/drivers/mtd/nand/arasan_nfc.c
> index 2d73a05..caa7982 100644
> --- a/drivers/mtd/nand/arasan_nfc.c
> +++ b/drivers/mtd/nand/arasan_nfc.c
> @@ -1058,20 +1058,20 @@ static int arasan_nand_ecc_init(struct mtd_info *mtd)
> if (found < 0)
> return 1;
>
> - regval = ecc_matrix[i].eccaddr |
> - (ecc_matrix[i].eccsize << ARASAN_NAND_ECC_SIZE_SHIFT) |
> - (ecc_matrix[i].bch << ARASAN_NAND_ECC_BCH_SHIFT);
> + regval = ecc_matrix[found].eccaddr |
> + (ecc_matrix[found].eccsize << ARASAN_NAND_ECC_SIZE_SHIFT) |
> + (ecc_matrix[found].bch << ARASAN_NAND_ECC_BCH_SHIFT);
> writel(regval, &arasan_nand_base->ecc_reg);
>
> - if (ecc_matrix[i].bch) {
> + if (ecc_matrix[found].bch) {
> regval = readl(&arasan_nand_base->memadr_reg2);
> regval &= ~ARASAN_NAND_MEM_ADDR2_BCH_MASK;
> - regval |= (ecc_matrix[i].bchval <<
> + regval |= (ecc_matrix[found].bchval <<
> ARASAN_NAND_MEM_ADDR2_BCH_SHIFT);
> writel(regval, &arasan_nand_base->memadr_reg2);
> }
>
> - nand_oob.eccbytes = ecc_matrix[i].eccsize;
> + nand_oob.eccbytes = ecc_matrix[found].eccsize;
> eccpos_start = mtd->oobsize - nand_oob.eccbytes;
>
> for (i = 0; i < nand_oob.eccbytes; i++)
> @@ -1080,9 +1080,9 @@ static int arasan_nand_ecc_init(struct mtd_info *mtd)
> nand_oob.oobfree[0].offset = 2;
> nand_oob.oobfree[0].length = eccpos_start - 2;
>
> - nand_chip->ecc.size = ecc_matrix[i].ecc_codeword_size;
> - nand_chip->ecc.strength = ecc_matrix[i].eccbits;
> - nand_chip->ecc.bytes = ecc_matrix[i].eccsize;
> + nand_chip->ecc.size = ecc_matrix[found].ecc_codeword_size;
> + nand_chip->ecc.strength = ecc_matrix[found].eccbits;
> + nand_chip->ecc.bytes = ecc_matrix[found].eccsize;
> nand_chip->ecc.layout = &nand_oob;
>
> return 0;
>
Tested-by: Michal Simek <michal.simek@xilinx.com>
Thanks,
Michal
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-05-25 11:12 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-25 9:50 [U-Boot] [PATCH] mtd: nand: arasan_nfc: Correct nand ecc initialization Siva Durga Prasad Paladugu
2016-05-25 11:12 ` Michal Simek
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox