linux-omap 2.6.39: initial add with beagleboard support
[openembedded.git] / recipes / linux / linux-omap-2.6.39 / sakoman / 0026-omap-nand-fix-subpage-ecc-issue-with-prefetch.patch
blobc8dacdc985aa5037f590f7c69b0ee3e645d7e7fa
1 From 1f0278a4f5475cc9ad67e007763368dfdd7dee29 Mon Sep 17 00:00:00 2001
2 From: kishore kadiyala <kishore.kadiyala@ti.com>
3 Date: Mon, 2 May 2011 11:10:38 +0000
4 Subject: [PATCH 26/28] omap : nand : fix subpage ecc issue with prefetch
6 For prefetch engine, read and write got broken in commit '2c01946c'.
7 We never hit a scenario of not getting 'gpmc_prefetch_enable'
8 call success.
9 When reading/writing a subpage with a non divisible by 4 ecc number
10 of bytes, the mis-aligned bytes gets handled first before enabling
11 the Prefetch engine, then it reads/writes rest of the bytes.
13 Signed-off-by: Kishore Kadiyala <kishore.kadiyala@ti.com>
14 Signed-off-by: Vimal Singh <vimal.newwork@gmail.com>
15 Reported-by: Bryan DE FARIA <bdefaria@adeneo-embedded.com>
16 ---
17 drivers/mtd/nand/omap2.c | 12 +++++-------
18 1 files changed, 5 insertions(+), 7 deletions(-)
20 diff --git a/drivers/mtd/nand/omap2.c b/drivers/mtd/nand/omap2.c
21 index 832f111..471a39b 100644
22 --- a/drivers/mtd/nand/omap2.c
23 +++ b/drivers/mtd/nand/omap2.c
24 @@ -275,11 +275,10 @@ static void omap_read_buf_pref(struct mtd_info *mtd, u_char *buf, int len)
25 if (ret) {
26 /* PFPW engine is busy, use cpu copy method */
27 if (info->nand.options & NAND_BUSWIDTH_16)
28 - omap_read_buf16(mtd, buf, len);
29 + omap_read_buf16(mtd, (u_char *)p, len);
30 else
31 - omap_read_buf8(mtd, buf, len);
32 + omap_read_buf8(mtd, (u_char *)p, len);
33 } else {
34 - p = (u32 *) buf;
35 do {
36 r_count = gpmc_read_status(GPMC_PREFETCH_FIFO_CNT);
37 r_count = r_count >> 2;
38 @@ -305,7 +304,7 @@ static void omap_write_buf_pref(struct mtd_info *mtd,
39 struct omap_nand_info, mtd);
40 uint32_t w_count = 0;
41 int i = 0, ret = 0;
42 - u16 *p;
43 + u16 *p = (u16 *)buf;
44 unsigned long tim, limit;
46 /* take care of subpage writes */
47 @@ -321,11 +320,10 @@ static void omap_write_buf_pref(struct mtd_info *mtd,
48 if (ret) {
49 /* PFPW engine is busy, use cpu copy method */
50 if (info->nand.options & NAND_BUSWIDTH_16)
51 - omap_write_buf16(mtd, buf, len);
52 + omap_write_buf16(mtd, (u_char *)p, len);
53 else
54 - omap_write_buf8(mtd, buf, len);
55 + omap_write_buf8(mtd, (u_char *)p, len);
56 } else {
57 - p = (u16 *) buf;
58 while (len) {
59 w_count = gpmc_read_status(GPMC_PREFETCH_FIFO_CNT);
60 w_count = w_count >> 1;
61 --
62 1.6.6.1