aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/mtd/nand/nand_base.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index 01946b7c3a8d..9d01c4df838c 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -1174,13 +1174,14 @@ static int nand_read_subpage(struct mtd_info *mtd, struct nand_chip *chip,
1174 int data_col_addr, i, gaps = 0; 1174 int data_col_addr, i, gaps = 0;
1175 int datafrag_len, eccfrag_len, aligned_len, aligned_pos; 1175 int datafrag_len, eccfrag_len, aligned_len, aligned_pos;
1176 int busw = (chip->options & NAND_BUSWIDTH_16) ? 2 : 1; 1176 int busw = (chip->options & NAND_BUSWIDTH_16) ? 2 : 1;
1177 int index = 0; 1177 int index;
1178 unsigned int max_bitflips = 0; 1178 unsigned int max_bitflips = 0;
1179 1179
1180 /* Column address within the page aligned to ECC size (256bytes) */ 1180 /* Column address within the page aligned to ECC size (256bytes) */
1181 start_step = data_offs / chip->ecc.size; 1181 start_step = data_offs / chip->ecc.size;
1182 end_step = (data_offs + readlen - 1) / chip->ecc.size; 1182 end_step = (data_offs + readlen - 1) / chip->ecc.size;
1183 num_steps = end_step - start_step + 1; 1183 num_steps = end_step - start_step + 1;
1184 index = start_step * chip->ecc.bytes;
1184 1185
1185 /* Data size aligned to ECC ecc.size */ 1186 /* Data size aligned to ECC ecc.size */
1186 datafrag_len = num_steps * chip->ecc.size; 1187 datafrag_len = num_steps * chip->ecc.size;
@@ -1217,8 +1218,6 @@ static int nand_read_subpage(struct mtd_info *mtd, struct nand_chip *chip,
1217 * Send the command to read the particular ECC bytes take care 1218 * Send the command to read the particular ECC bytes take care
1218 * about buswidth alignment in read_buf. 1219 * about buswidth alignment in read_buf.
1219 */ 1220 */
1220 index = start_step * chip->ecc.bytes;
1221
1222 aligned_pos = eccpos[index] & ~(busw - 1); 1221 aligned_pos = eccpos[index] & ~(busw - 1);
1223 aligned_len = eccfrag_len; 1222 aligned_len = eccfrag_len;
1224 if (eccpos[index] & (busw - 1)) 1223 if (eccpos[index] & (busw - 1))