diff options
author | Yoshihiro Shimoda <shimoda.yoshihiro@renesas.com> | 2009-03-24 05:27:24 -0400 |
---|---|---|
committer | David Woodhouse <David.Woodhouse@intel.com> | 2009-03-24 05:39:46 -0400 |
commit | c0e6616ae69774f42fda7a8cc5dc699aff311b40 (patch) | |
tree | 10344150d27569dccbe06c21a28866268d7b7b31 /drivers | |
parent | 158772c2d4178525365dd46b8223184a861df58f (diff) |
[MTD] [NAND] sh_flctl: fix hardware ecc handling for 2048 byte page
Signed-off-by: Jeremy Baker <Jeremy.Baker@renesas.com>
Signed-off-by: Yoshihiro Shimoda <shimoda.yoshihiro@renesas.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/mtd/nand/sh_flctl.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/drivers/mtd/nand/sh_flctl.c b/drivers/mtd/nand/sh_flctl.c index 821acb08ff1c..2bc896623e2d 100644 --- a/drivers/mtd/nand/sh_flctl.c +++ b/drivers/mtd/nand/sh_flctl.c | |||
@@ -58,7 +58,7 @@ static struct nand_bbt_descr flctl_4secc_smallpage = { | |||
58 | }; | 58 | }; |
59 | 59 | ||
60 | static struct nand_bbt_descr flctl_4secc_largepage = { | 60 | static struct nand_bbt_descr flctl_4secc_largepage = { |
61 | .options = 0, | 61 | .options = NAND_BBT_SCAN2NDPAGE, |
62 | .offs = 58, | 62 | .offs = 58, |
63 | .len = 2, | 63 | .len = 2, |
64 | .pattern = scan_ff_pattern, | 64 | .pattern = scan_ff_pattern, |
@@ -149,7 +149,7 @@ static void wait_wfifo_ready(struct sh_flctl *flctl) | |||
149 | printk(KERN_ERR "wait_wfifo_ready(): Timeout occured \n"); | 149 | printk(KERN_ERR "wait_wfifo_ready(): Timeout occured \n"); |
150 | } | 150 | } |
151 | 151 | ||
152 | static int wait_recfifo_ready(struct sh_flctl *flctl) | 152 | static int wait_recfifo_ready(struct sh_flctl *flctl, int sector_number) |
153 | { | 153 | { |
154 | uint32_t timeout = LOOP_TIMEOUT_MAX; | 154 | uint32_t timeout = LOOP_TIMEOUT_MAX; |
155 | int checked[4]; | 155 | int checked[4]; |
@@ -183,7 +183,12 @@ static int wait_recfifo_ready(struct sh_flctl *flctl) | |||
183 | uint8_t org; | 183 | uint8_t org; |
184 | int index; | 184 | int index; |
185 | 185 | ||
186 | index = data >> 16; | 186 | if (flctl->page_size) |
187 | index = (512 * sector_number) + | ||
188 | (data >> 16); | ||
189 | else | ||
190 | index = data >> 16; | ||
191 | |||
187 | org = flctl->done_buff[index]; | 192 | org = flctl->done_buff[index]; |
188 | flctl->done_buff[index] = org ^ (data & 0xFF); | 193 | flctl->done_buff[index] = org ^ (data & 0xFF); |
189 | checked[i] = 1; | 194 | checked[i] = 1; |
@@ -238,14 +243,14 @@ static void read_fiforeg(struct sh_flctl *flctl, int rlen, int offset) | |||
238 | } | 243 | } |
239 | } | 244 | } |
240 | 245 | ||
241 | static int read_ecfiforeg(struct sh_flctl *flctl, uint8_t *buff) | 246 | static int read_ecfiforeg(struct sh_flctl *flctl, uint8_t *buff, int sector) |
242 | { | 247 | { |
243 | int i; | 248 | int i; |
244 | unsigned long *ecc_buf = (unsigned long *)buff; | 249 | unsigned long *ecc_buf = (unsigned long *)buff; |
245 | void *fifo_addr = (void *)FLECFIFO(flctl); | 250 | void *fifo_addr = (void *)FLECFIFO(flctl); |
246 | 251 | ||
247 | for (i = 0; i < 4; i++) { | 252 | for (i = 0; i < 4; i++) { |
248 | if (wait_recfifo_ready(flctl)) | 253 | if (wait_recfifo_ready(flctl , sector)) |
249 | return 1; | 254 | return 1; |
250 | ecc_buf[i] = readl(fifo_addr); | 255 | ecc_buf[i] = readl(fifo_addr); |
251 | ecc_buf[i] = be32_to_cpu(ecc_buf[i]); | 256 | ecc_buf[i] = be32_to_cpu(ecc_buf[i]); |
@@ -384,7 +389,8 @@ static void execmd_read_page_sector(struct mtd_info *mtd, int page_addr) | |||
384 | read_fiforeg(flctl, 512, 512 * sector); | 389 | read_fiforeg(flctl, 512, 512 * sector); |
385 | 390 | ||
386 | ret = read_ecfiforeg(flctl, | 391 | ret = read_ecfiforeg(flctl, |
387 | &flctl->done_buff[mtd->writesize + 16 * sector]); | 392 | &flctl->done_buff[mtd->writesize + 16 * sector], |
393 | sector); | ||
388 | 394 | ||
389 | if (ret) | 395 | if (ret) |
390 | flctl->hwecc_cant_correct[sector] = 1; | 396 | flctl->hwecc_cant_correct[sector] = 1; |