Skip to content

Commit

Permalink
atmel_nand: Add 32 bit ecc support for sama5d2 chip
Browse files Browse the repository at this point in the history
Also if minimum ecc requirment is bigger then what we support, then just
use our maxium pmecc support.
But it is not safe, so we'll output a warning about this.

Signed-off-by: Josh Wu <[email protected]>
Acked-by: Scott Wood <[email protected]>
Reviewed-by: Andreas Bießmann <[email protected]>
  • Loading branch information
JoshWu authored and Andreas Bießmann committed Feb 2, 2016
1 parent fa651f5 commit 258b21f
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion drivers/mtd/nand/atmel_nand.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ static struct nand_ecclayout atmel_pmecc_oobinfo;
* 8-bits 13-bytes 14-bytes
* 12-bits 20-bytes 21-bytes
* 24-bits 39-bytes 42-bytes
* 32-bits 52-bytes 56-bytes
*/
static int pmecc_get_ecc_bytes(int cap, int sector_size)
{
Expand Down Expand Up @@ -638,6 +639,9 @@ static void atmel_pmecc_core_init(struct mtd_info *mtd)
case 24:
val = PMECC_CFG_BCH_ERR24;
break;
case 32:
val = PMECC_CFG_BCH_ERR32;
break;
}

if (host->pmecc_sector_size == 512)
Expand Down Expand Up @@ -723,7 +727,11 @@ static int pmecc_choose_ecc(struct atmel_nand_host *host,
else if (*cap <= 24)
host->pmecc_corr_cap = 24;
else
return -EINVAL;
#ifdef CONFIG_SAMA5D2
host->pmecc_corr_cap = 32;
#else
host->pmecc_corr_cap = 24;
#endif
}
if (host->pmecc_sector_size == 0) {
/* use the most fitable sector size (the near smaller one ) */
Expand Down

0 comments on commit 258b21f

Please sign in to comment.