diff options
author | Wu, Josh <Josh.wu@atmel.com> | 2014-08-08 17:12:35 +0800 |
---|---|---|
committer | Brian Norris <computersforpeace@gmail.com> | 2014-09-17 23:05:11 -0700 |
commit | 022a478ce650f5c36d2a9badfd805368a90fb506 (patch) | |
tree | cbe973f9ba39f01c39fa4bd7371fd2e468a69c3d /drivers/mtd/nand | |
parent | c9447fff34aacc04f2e7df39612d2d6e234643f3 (diff) | |
download | linux-022a478ce650f5c36d2a9badfd805368a90fb506.tar.gz linux-022a478ce650f5c36d2a9badfd805368a90fb506.tar.bz2 linux-022a478ce650f5c36d2a9badfd805368a90fb506.zip |
mtd: atmel_nand: remove pmecc_bytes_per_sector, use chip->ecc.bytes instead
For PMECC, the pmecc_bytes_per_sector has same meaning as ecc.bytes.
So remove pmecc_bytes_per_sector and use ecc.bytes instead.
Signed-off-by: Josh Wu <josh.wu@atmel.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Diffstat (limited to 'drivers/mtd/nand')
-rw-r--r-- | drivers/mtd/nand/atmel_nand.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/drivers/mtd/nand/atmel_nand.c b/drivers/mtd/nand/atmel_nand.c index 5c76704f4080..19d1e9d17bf9 100644 --- a/drivers/mtd/nand/atmel_nand.c +++ b/drivers/mtd/nand/atmel_nand.c @@ -131,7 +131,6 @@ struct atmel_nand_host { u32 pmecc_lookup_table_offset_512; u32 pmecc_lookup_table_offset_1024; - int pmecc_bytes_per_sector; int pmecc_degree; /* Degree of remainders */ int pmecc_cw_len; /* Length of codeword */ @@ -843,7 +842,7 @@ static void pmecc_correct_data(struct mtd_info *mtd, uint8_t *buf, uint8_t *ecc, pos, bit_pos, err_byte, *(buf + byte_pos)); } else { /* Bit flip in OOB area */ - tmp = sector_num * host->pmecc_bytes_per_sector + tmp = sector_num * nand_chip->ecc.bytes + (byte_pos - sector_size); err_byte = ecc[tmp]; ecc[tmp] ^= (1 << bit_pos); @@ -892,7 +891,7 @@ normal_check: return -EIO; } else { pmecc_correct_data(mtd, buf_pos, ecc, i, - host->pmecc_bytes_per_sector, err_nbr); + nand_chip->ecc.bytes, err_nbr); mtd->ecc_stats.corrected += err_nbr; total_err += err_nbr; } @@ -987,10 +986,10 @@ static int atmel_nand_pmecc_write_page(struct mtd_info *mtd, } for (i = 0; i < chip->ecc.steps; i++) { - for (j = 0; j < host->pmecc_bytes_per_sector; j++) { + for (j = 0; j < chip->ecc.bytes; j++) { int pos; - pos = i * host->pmecc_bytes_per_sector + j; + pos = i * chip->ecc.bytes + j; chip->oob_poi[eccpos[pos]] = pmecc_readb_ecc_relaxed(host->ecc, i, j); } @@ -1186,14 +1185,12 @@ static int atmel_pmecc_nand_init_params(struct platform_device *pdev, host->pmecc_degree = (sector_size == 512) ? PMECC_GF_DIMENSION_13 : PMECC_GF_DIMENSION_14; host->pmecc_cw_len = (1 << host->pmecc_degree) - 1; - host->pmecc_bytes_per_sector = pmecc_get_ecc_bytes( - cap, sector_size); host->pmecc_alpha_to = pmecc_get_alpha_to(host); host->pmecc_index_of = host->pmecc_rom_base + host->pmecc_lookup_table_offset; nand_chip->ecc.strength = cap; - nand_chip->ecc.bytes = host->pmecc_bytes_per_sector; + nand_chip->ecc.bytes = pmecc_get_ecc_bytes(cap, sector_size); nand_chip->ecc.steps = mtd->writesize / sector_size; nand_chip->ecc.total = nand_chip->ecc.bytes * nand_chip->ecc.steps; |