Commit a3557105 authored by Wu, Josh's avatar Wu, Josh Committed by Brian Norris

mtd: atmel_nand: add pmecc support for 512, 1k, 4k, 8k page size

PMECC can support 512, 1k, 2k, 4k, 8k page size.
The driver currently only support 2k page size nand flash. So this patch
add support to 512, 1k, 4k and 8k page size nand flash.
Signed-off-by: default avatarJosh Wu <josh.wu@atmel.com>
Signed-off-by: default avatarBrian Norris <computersforpeace@gmail.com>
parent 796fe364
...@@ -1174,7 +1174,17 @@ static int atmel_pmecc_nand_init_params(struct platform_device *pdev, ...@@ -1174,7 +1174,17 @@ static int atmel_pmecc_nand_init_params(struct platform_device *pdev,
/* set ECC page size and oob layout */ /* set ECC page size and oob layout */
switch (mtd->writesize) { switch (mtd->writesize) {
case 512:
case 1024:
case 2048: case 2048:
case 4096:
case 8192:
if (sector_size > mtd->writesize) {
dev_err(host->dev, "pmecc sector size is bigger than the page size!\n");
err_no = -EINVAL;
goto err;
}
host->pmecc_degree = (sector_size == 512) ? host->pmecc_degree = (sector_size == 512) ?
PMECC_GF_DIMENSION_13 : PMECC_GF_DIMENSION_14; PMECC_GF_DIMENSION_13 : PMECC_GF_DIMENSION_14;
host->pmecc_cw_len = (1 << host->pmecc_degree) - 1; host->pmecc_cw_len = (1 << host->pmecc_degree) - 1;
...@@ -1201,13 +1211,9 @@ static int atmel_pmecc_nand_init_params(struct platform_device *pdev, ...@@ -1201,13 +1211,9 @@ static int atmel_pmecc_nand_init_params(struct platform_device *pdev,
nand_chip->ecc.layout = &atmel_pmecc_oobinfo; nand_chip->ecc.layout = &atmel_pmecc_oobinfo;
break; break;
case 512: default:
case 1024:
case 4096:
/* TODO */
dev_warn(host->dev, dev_warn(host->dev,
"Unsupported page size for PMECC, use Software ECC\n"); "Unsupported page size for PMECC, use Software ECC\n");
default:
/* page size not handled by HW ECC */ /* page size not handled by HW ECC */
/* switching back to soft ECC */ /* switching back to soft ECC */
nand_chip->ecc.mode = NAND_ECC_SOFT; nand_chip->ecc.mode = NAND_ECC_SOFT;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment