|
@@ -44,6 +44,7 @@ struct atmel_nand_host {
|
|
|
u8 pmecc_corr_cap;
|
|
|
u16 pmecc_sector_size;
|
|
|
u32 pmecc_index_table_offset;
|
|
|
+ u32 pmecc_version;
|
|
|
|
|
|
int pmecc_bytes_per_sector;
|
|
|
int pmecc_sector_number;
|
|
@@ -486,6 +487,10 @@ static int pmecc_correction(struct mtd_info *mtd, u32 pmecc_stat, uint8_t *buf,
|
|
|
int i, err_nbr, eccbytes;
|
|
|
uint8_t *buf_pos;
|
|
|
|
|
|
+ /* SAMA5D4 PMECC IP can correct errors for all 0xff page */
|
|
|
+ if (host->pmecc_version >= PMECC_VERSION_SAMA5D4)
|
|
|
+ goto normal_check;
|
|
|
+
|
|
|
eccbytes = nand_chip->ecc.bytes;
|
|
|
for (i = 0; i < eccbytes; i++)
|
|
|
if (ecc[i] != 0xff)
|
|
@@ -961,6 +966,10 @@ static int atmel_pmecc_nand_init_params(struct nand_chip *nand,
|
|
|
nand->ecc.write_page = atmel_nand_pmecc_write_page;
|
|
|
nand->ecc.strength = cap;
|
|
|
|
|
|
+ /* Check the PMECC ip version */
|
|
|
+ host->pmecc_version = pmecc_readl(host->pmerrloc, version);
|
|
|
+ dev_dbg(host->dev, "PMECC IP version is: %x\n", host->pmecc_version);
|
|
|
+
|
|
|
atmel_pmecc_core_init(mtd);
|
|
|
|
|
|
return 0;
|