diff options
author | Wu, Josh <Josh.wu@atmel.com> | 2014-08-08 05:12:34 -0400 |
---|---|---|
committer | Brian Norris <computersforpeace@gmail.com> | 2014-09-18 02:05:10 -0400 |
commit | c9447fff34aacc04f2e7df39612d2d6e234643f3 (patch) | |
tree | 4148edd0726aec038a8f0baaf27b0a6be0e586eb /drivers/mtd/nand | |
parent | fef775caa705255358cdf7bbaf9bbc2fd1111761 (diff) |
mtd: atmel_nand: remove pmecc_sector_number, use ecc.steps instead
For PMECC, the pmecc_sector_number has same meaning as ecc.steps.
So use ecc.steps to replace the pmecc_sector_number.
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 | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/drivers/mtd/nand/atmel_nand.c b/drivers/mtd/nand/atmel_nand.c index d1e502f8dbd0..5c76704f4080 100644 --- a/drivers/mtd/nand/atmel_nand.c +++ b/drivers/mtd/nand/atmel_nand.c | |||
@@ -132,7 +132,6 @@ struct atmel_nand_host { | |||
132 | u32 pmecc_lookup_table_offset_1024; | 132 | u32 pmecc_lookup_table_offset_1024; |
133 | 133 | ||
134 | int pmecc_bytes_per_sector; | 134 | int pmecc_bytes_per_sector; |
135 | int pmecc_sector_number; | ||
136 | int pmecc_degree; /* Degree of remainders */ | 135 | int pmecc_degree; /* Degree of remainders */ |
137 | int pmecc_cw_len; /* Length of codeword */ | 136 | int pmecc_cw_len; /* Length of codeword */ |
138 | 137 | ||
@@ -877,7 +876,7 @@ static int pmecc_correction(struct mtd_info *mtd, u32 pmecc_stat, uint8_t *buf, | |||
877 | return 0; | 876 | return 0; |
878 | 877 | ||
879 | normal_check: | 878 | normal_check: |
880 | for (i = 0; i < host->pmecc_sector_number; i++) { | 879 | for (i = 0; i < nand_chip->ecc.steps; i++) { |
881 | err_nbr = 0; | 880 | err_nbr = 0; |
882 | if (pmecc_stat & 0x1) { | 881 | if (pmecc_stat & 0x1) { |
883 | buf_pos = buf + i * host->pmecc_sector_size; | 882 | buf_pos = buf + i * host->pmecc_sector_size; |
@@ -987,7 +986,7 @@ static int atmel_nand_pmecc_write_page(struct mtd_info *mtd, | |||
987 | cpu_relax(); | 986 | cpu_relax(); |
988 | } | 987 | } |
989 | 988 | ||
990 | for (i = 0; i < host->pmecc_sector_number; i++) { | 989 | for (i = 0; i < chip->ecc.steps; i++) { |
991 | for (j = 0; j < host->pmecc_bytes_per_sector; j++) { | 990 | for (j = 0; j < host->pmecc_bytes_per_sector; j++) { |
992 | int pos; | 991 | int pos; |
993 | 992 | ||
@@ -1034,7 +1033,7 @@ static void atmel_pmecc_core_init(struct mtd_info *mtd) | |||
1034 | else if (host->pmecc_sector_size == 1024) | 1033 | else if (host->pmecc_sector_size == 1024) |
1035 | val |= PMECC_CFG_SECTOR1024; | 1034 | val |= PMECC_CFG_SECTOR1024; |
1036 | 1035 | ||
1037 | switch (host->pmecc_sector_number) { | 1036 | switch (nand_chip->ecc.steps) { |
1038 | case 1: | 1037 | case 1: |
1039 | val |= PMECC_CFG_PAGE_1SECTOR; | 1038 | val |= PMECC_CFG_PAGE_1SECTOR; |
1040 | break; | 1039 | break; |
@@ -1187,18 +1186,17 @@ static int atmel_pmecc_nand_init_params(struct platform_device *pdev, | |||
1187 | host->pmecc_degree = (sector_size == 512) ? | 1186 | host->pmecc_degree = (sector_size == 512) ? |
1188 | PMECC_GF_DIMENSION_13 : PMECC_GF_DIMENSION_14; | 1187 | PMECC_GF_DIMENSION_13 : PMECC_GF_DIMENSION_14; |
1189 | host->pmecc_cw_len = (1 << host->pmecc_degree) - 1; | 1188 | host->pmecc_cw_len = (1 << host->pmecc_degree) - 1; |
1190 | host->pmecc_sector_number = mtd->writesize / sector_size; | ||
1191 | host->pmecc_bytes_per_sector = pmecc_get_ecc_bytes( | 1189 | host->pmecc_bytes_per_sector = pmecc_get_ecc_bytes( |
1192 | cap, sector_size); | 1190 | cap, sector_size); |
1193 | host->pmecc_alpha_to = pmecc_get_alpha_to(host); | 1191 | host->pmecc_alpha_to = pmecc_get_alpha_to(host); |
1194 | host->pmecc_index_of = host->pmecc_rom_base + | 1192 | host->pmecc_index_of = host->pmecc_rom_base + |
1195 | host->pmecc_lookup_table_offset; | 1193 | host->pmecc_lookup_table_offset; |
1196 | 1194 | ||
1197 | nand_chip->ecc.steps = host->pmecc_sector_number; | ||
1198 | nand_chip->ecc.strength = cap; | 1195 | nand_chip->ecc.strength = cap; |
1199 | nand_chip->ecc.bytes = host->pmecc_bytes_per_sector; | 1196 | nand_chip->ecc.bytes = host->pmecc_bytes_per_sector; |
1200 | nand_chip->ecc.total = host->pmecc_bytes_per_sector * | 1197 | nand_chip->ecc.steps = mtd->writesize / sector_size; |
1201 | host->pmecc_sector_number; | 1198 | nand_chip->ecc.total = nand_chip->ecc.bytes * |
1199 | nand_chip->ecc.steps; | ||
1202 | if (nand_chip->ecc.total > mtd->oobsize - 2) { | 1200 | if (nand_chip->ecc.total > mtd->oobsize - 2) { |
1203 | dev_err(host->dev, "No room for ECC bytes\n"); | 1201 | dev_err(host->dev, "No room for ECC bytes\n"); |
1204 | err_no = -EINVAL; | 1202 | err_no = -EINVAL; |