public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH] mtd: onenand: bugfix for 2x mode bad block handling
@ 2010-12-02 13:28 Roman Tereshonkov
  2010-12-02 23:24 ` Kyungmin Park
  2010-12-03 16:14 ` Artem Bityutskiy
  0 siblings, 2 replies; 3+ messages in thread
From: Roman Tereshonkov @ 2010-12-02 13:28 UTC (permalink / raw)
  To: linux-mtd; +Cc: kyungmin.park, dwmw2, Roman Tereshonkov

This bug becomes visible in 2x mode when chip->writesize
is different from mtd->writesize (= 2 * chip->writesize).
At this case the bad block information is read from
the first and the third physical pages instead of
the first and the second as specification states.

Signed-off-by: Roman Tereshonkov <roman.tereshonkov@nokia.com>
---
 drivers/mtd/onenand/onenand_bbt.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/mtd/onenand/onenand_bbt.c b/drivers/mtd/onenand/onenand_bbt.c
index 01ab5b3..905209b 100644
--- a/drivers/mtd/onenand/onenand_bbt.c
+++ b/drivers/mtd/onenand/onenand_bbt.c
@@ -91,13 +91,15 @@ static int create_bbt(struct mtd_info *mtd, uint8_t *buf, struct nand_bbt_descr
 		for (j = 0; j < len; j++) {
 			/* No need to read pages fully,
 			 * just read required OOB bytes */
-			ret = onenand_bbt_read_oob(mtd, from + j * mtd->writesize + bd->offs, &ops);
+			ret = onenand_bbt_read_oob(mtd,
+				from + j * this->writesize + bd->offs, &ops);
 
 			/* If it is a initial bad block, just ignore it */
 			if (ret == ONENAND_BBT_READ_FATAL_ERROR)
 				return -EIO;
 
-			if (ret || check_short_pattern(&buf[j * scanlen], scanlen, mtd->writesize, bd)) {
+			if (ret || check_short_pattern(&buf[j * scanlen],
+					       scanlen, this->writesize, bd)) {
 				bbm->bbt[i >> 3] |= 0x03 << (i & 0x6);
 				printk(KERN_WARNING "Bad eraseblock %d at 0x%08x\n",
 					i >> 1, (unsigned int) from);
-- 
1.7.0.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] mtd: onenand: bugfix for 2x mode bad block handling
  2010-12-02 13:28 [PATCH] mtd: onenand: bugfix for 2x mode bad block handling Roman Tereshonkov
@ 2010-12-02 23:24 ` Kyungmin Park
  2010-12-03 16:14 ` Artem Bityutskiy
  1 sibling, 0 replies; 3+ messages in thread
From: Kyungmin Park @ 2010-12-02 23:24 UTC (permalink / raw)
  To: Roman Tereshonkov; +Cc: dwmw2, linux-mtd

Acked-by: Kyungmin Park <kyungmin.park@samsung.com>

On Thu, Dec 2, 2010 at 10:28 PM, Roman Tereshonkov
<roman.tereshonkov@nokia.com> wrote:
> This bug becomes visible in 2x mode when chip->writesize
> is different from mtd->writesize (= 2 * chip->writesize).
> At this case the bad block information is read from
> the first and the third physical pages instead of
> the first and the second as specification states.
>
> Signed-off-by: Roman Tereshonkov <roman.tereshonkov@nokia.com>
> ---
>  drivers/mtd/onenand/onenand_bbt.c |    6 ++++--
>  1 files changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/mtd/onenand/onenand_bbt.c b/drivers/mtd/onenand/onenand_bbt.c
> index 01ab5b3..905209b 100644
> --- a/drivers/mtd/onenand/onenand_bbt.c
> +++ b/drivers/mtd/onenand/onenand_bbt.c
> @@ -91,13 +91,15 @@ static int create_bbt(struct mtd_info *mtd, uint8_t *buf, struct nand_bbt_descr
>                for (j = 0; j < len; j++) {
>                        /* No need to read pages fully,
>                         * just read required OOB bytes */
> -                       ret = onenand_bbt_read_oob(mtd, from + j * mtd->writesize + bd->offs, &ops);
> +                       ret = onenand_bbt_read_oob(mtd,
> +                               from + j * this->writesize + bd->offs, &ops);
>
>                        /* If it is a initial bad block, just ignore it */
>                        if (ret == ONENAND_BBT_READ_FATAL_ERROR)
>                                return -EIO;
>
> -                       if (ret || check_short_pattern(&buf[j * scanlen], scanlen, mtd->writesize, bd)) {
> +                       if (ret || check_short_pattern(&buf[j * scanlen],
> +                                              scanlen, this->writesize, bd)) {
>                                bbm->bbt[i >> 3] |= 0x03 << (i & 0x6);
>                                printk(KERN_WARNING "Bad eraseblock %d at 0x%08x\n",
>                                        i >> 1, (unsigned int) from);
> --
> 1.7.0.4
>
>
> ______________________________________________________
> Linux MTD discussion mailing list
> http://lists.infradead.org/mailman/listinfo/linux-mtd/
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] mtd: onenand: bugfix for 2x mode bad block handling
  2010-12-02 13:28 [PATCH] mtd: onenand: bugfix for 2x mode bad block handling Roman Tereshonkov
  2010-12-02 23:24 ` Kyungmin Park
@ 2010-12-03 16:14 ` Artem Bityutskiy
  1 sibling, 0 replies; 3+ messages in thread
From: Artem Bityutskiy @ 2010-12-03 16:14 UTC (permalink / raw)
  To: Roman Tereshonkov; +Cc: dwmw2, kyungmin.park, linux-mtd

On Thu, 2010-12-02 at 15:28 +0200, Roman Tereshonkov wrote:
> This bug becomes visible in 2x mode when chip->writesize
> is different from mtd->writesize (= 2 * chip->writesize).
> At this case the bad block information is read from
> the first and the third physical pages instead of
> the first and the second as specification states.
> 
> Signed-off-by: Roman Tereshonkov <roman.tereshonkov@nokia.com>

Pushed to l2-mtd-2.6.git, thanks.

-- 
Best Regards,
Artem Bityutskiy (Артём Битюцкий)

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-12-03 16:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-02 13:28 [PATCH] mtd: onenand: bugfix for 2x mode bad block handling Roman Tereshonkov
2010-12-02 23:24 ` Kyungmin Park
2010-12-03 16:14 ` Artem Bityutskiy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox