mirror of
https://github.com/torvalds/linux.git
synced 2024-12-25 12:21:37 +00:00
mtd: nand: sunxi: prefer 1k ECC blocks when applicable
Switching to 1k ECC blocks when possible provides better resistance against concentrated bitflips. Say you have those two configurations: 1/ 16bits/512bytes 2/ 32bits/1024bytes Both of them require the same amount of ECC bytes (only true for this specific engine), but the second config allows you to correct the case where most of your bitflips are concentrated in a single 512bytes portion. This fact makes the 1k ECC block size more advantageous than the 512bytes one. Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
This commit is contained in:
parent
252173c69e
commit
872164e41f
@ -1786,6 +1786,12 @@ static int sunxi_nand_hw_common_ecc_ctrl_init(struct mtd_info *mtd,
|
||||
if (!data)
|
||||
return -ENOMEM;
|
||||
|
||||
/* Prefer 1k ECC chunk over 512 ones */
|
||||
if (ecc->size == 512 && mtd->writesize > 512) {
|
||||
ecc->size = 1024;
|
||||
ecc->strength *= 2;
|
||||
}
|
||||
|
||||
/* Add ECC info retrieval from DT */
|
||||
for (i = 0; i < ARRAY_SIZE(strengths); i++) {
|
||||
if (ecc->strength <= strengths[i])
|
||||
|
Loading…
Reference in New Issue
Block a user