From 6652e5cd21a2246e030c6c5c7a8a2867e1b49cb1 Mon Sep 17 00:00:00 2001 From: Andy Lowe Date: Fri, 12 Jan 2007 18:05:10 -0500 Subject: [PATCH] --- yaml --- r: 68523 b: refs/heads/master c: 097f2576eb7dbc8cd5f610847f229f4fea305b80 h: refs/heads/master i: 68521: 6e9df7e9576ddcc88f62376abc4f3aad0875e626 68519: 38db195996791ae44df22ca4fc484cc3a7eb89a7 v: v3 --- [refs] | 2 +- trunk/drivers/mtd/chips/cfi_cmdset_0001.c | 15 +++++++++++---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/[refs] b/[refs] index 64980062cfe0..8ad484b946fc 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: e644f7d6289456657996df4192de76c5d0a9f9c7 +refs/heads/master: 097f2576eb7dbc8cd5f610847f229f4fea305b80 diff --git a/trunk/drivers/mtd/chips/cfi_cmdset_0001.c b/trunk/drivers/mtd/chips/cfi_cmdset_0001.c index 39eff9ff575c..c655e971c158 100644 --- a/trunk/drivers/mtd/chips/cfi_cmdset_0001.c +++ b/trunk/drivers/mtd/chips/cfi_cmdset_0001.c @@ -1166,28 +1166,34 @@ static int cfi_intelext_point (struct mtd_info *mtd, loff_t from, size_t len, si { struct map_info *map = mtd->priv; struct cfi_private *cfi = map->fldrv_priv; - unsigned long ofs; + unsigned long ofs, last_end = 0; int chipnum; int ret = 0; if (!map->virt || (from + len > mtd->size)) return -EINVAL; - *mtdbuf = (void *)map->virt + from; - *retlen = 0; - /* Now lock the chip(s) to POINT state */ /* ofs: offset within the first chip that the first read should start */ chipnum = (from >> cfi->chipshift); ofs = from - (chipnum << cfi->chipshift); + *mtdbuf = (void *)map->virt + cfi->chips[chipnum].start + ofs; + *retlen = 0; + while (len) { unsigned long thislen; if (chipnum >= cfi->numchips) break; + /* We cannot point across chips that are virtually disjoint */ + if (!last_end) + last_end = cfi->chips[chipnum].start; + else if (cfi->chips[chipnum].start != last_end) + break; + if ((len + ofs -1) >> cfi->chipshift) thislen = (1<chipshift) - ofs; else @@ -1201,6 +1207,7 @@ static int cfi_intelext_point (struct mtd_info *mtd, loff_t from, size_t len, si len -= thislen; ofs = 0; + last_end += 1 << cfi->chipshift; chipnum++; } return 0;