aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/nand/sh_flctl.c
diff options
context:
space:
mode:
authorBastian Hecht <hechtb@googlemail.com>2012-05-14 08:14:44 -0400
committerDavid Woodhouse <David.Woodhouse@intel.com>2012-07-06 13:17:03 -0400
commit50ed399cc3fbe5e16de78f7b62a39b8280f9001b (patch)
treed67fe586b9a296a067831725ba3e4861c83e45cd /drivers/mtd/nand/sh_flctl.c
parentef4ce0bcb3c91375d2bdefd7a0e2fead95c97620 (diff)
mtd: sh_flctl: Simplify the hardware ecc page read/write
As the equation mtd->writesize == eccsteps * eccsize holds, we can simplify the code. The second loop of the 1st hunk is never entered, so we delete it. Signed-off-by: Bastian Hecht <hechtb@gmail.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Diffstat (limited to 'drivers/mtd/nand/sh_flctl.c')
-rw-r--r--drivers/mtd/nand/sh_flctl.c25
1 files changed, 2 insertions, 23 deletions
diff --git a/drivers/mtd/nand/sh_flctl.c b/drivers/mtd/nand/sh_flctl.c
index 8633b5b98a13..1cc19eb1c302 100644
--- a/drivers/mtd/nand/sh_flctl.c
+++ b/drivers/mtd/nand/sh_flctl.c
@@ -353,35 +353,14 @@ static void set_cmd_regs(struct mtd_info *mtd, uint32_t cmd, uint32_t flcmcdr_va
353static int flctl_read_page_hwecc(struct mtd_info *mtd, struct nand_chip *chip, 353static int flctl_read_page_hwecc(struct mtd_info *mtd, struct nand_chip *chip,
354 uint8_t *buf, int oob_required, int page) 354 uint8_t *buf, int oob_required, int page)
355{ 355{
356 int i, eccsize = chip->ecc.size; 356 chip->read_buf(mtd, buf, mtd->writesize);
357 int eccbytes = chip->ecc.bytes;
358 int eccsteps = chip->ecc.steps;
359 uint8_t *p = buf;
360 struct sh_flctl *flctl = mtd_to_flctl(mtd);
361
362 for (i = 0; eccsteps; eccsteps--, i += eccbytes, p += eccsize)
363 chip->read_buf(mtd, p, eccsize);
364
365 for (i = 0; eccsteps; eccsteps--, i += eccbytes, p += eccsize) {
366 if (flctl->hwecc_cant_correct[i])
367 mtd->ecc_stats.failed++;
368 else
369 mtd->ecc_stats.corrected += 0; /* FIXME */
370 }
371
372 return 0; 357 return 0;
373} 358}
374 359
375static void flctl_write_page_hwecc(struct mtd_info *mtd, struct nand_chip *chip, 360static void flctl_write_page_hwecc(struct mtd_info *mtd, struct nand_chip *chip,
376 const uint8_t *buf, int oob_required) 361 const uint8_t *buf, int oob_required)
377{ 362{
378 int i, eccsize = chip->ecc.size; 363 chip->write_buf(mtd, buf, mtd->writesize);
379 int eccbytes = chip->ecc.bytes;
380 int eccsteps = chip->ecc.steps;
381 const uint8_t *p = buf;
382
383 for (i = 0; eccsteps; eccsteps--, i += eccbytes, p += eccsize)
384 chip->write_buf(mtd, p, eccsize);
385} 364}
386 365
387static void execmd_read_page_sector(struct mtd_info *mtd, int page_addr) 366static void execmd_read_page_sector(struct mtd_info *mtd, int page_addr)