All of lore.kernel.org
 help / color / mirror / Atom feed
From: Heiko Schocher <hs@denx.de>
To: linux-mtd@lists.infradead.org
Subject: mtd-util, flash_erase: MEMGETOOBSEL on davinci based board fail
Date: Tue, 20 Sep 2011 09:58:08 +0200	[thread overview]
Message-ID: <4E784790.4010601@denx.de> (raw)

Hello,

I tried to use mtd-util:flash_erase on a davinci am1808 based board,
and get the following error:

flash_erase -j /dev/mtd5 0 0
flash_erase: error!: /dev/mtd5: unable to get NAND oobinfo
              error 22 (Invalid argument)

The problem is here:

drivers/mtd/mtdchar.c line 786:

                if (mtd->ecclayout->eccbytes > ARRAY_SIZE(oi.eccpos))
                        return -EINVAL;

On such a plattform we have:

mtd->ecclayout->eccbytes = 40
ARRAY_SIZE(oi.eccpos) = 32

following patch solves the issue:

diff --git a/include/mtd/mtd-abi.h b/include/mtd/mtd-abi.h
index a86364a..5dc6ed1 100644
--- a/include/mtd/mtd-abi.h
+++ b/include/mtd/mtd-abi.h
@@ -136,7 +136,7 @@ struct nand_oobinfo {
        __u32 useecc;
        __u32 eccbytes;
        __u32 oobfree[8][2];
-       __u32 eccpos[32];
+       __u32 eccpos[40];
 };

 struct nand_oobfree {

Now the questions:

a) is this fix Ok? (Has it i chance to go in mainline?)
b) in include/mtd/mtd-abi.h I found this comment:

/*
 * Obsolete legacy interface. Keep it in order not to break userspace
 * interfaces
 */
struct nand_oobinfo {

so this Interface should not be used ... which Interface should be
used instead?

Thanks!

bye,
Heiko
-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany

             reply	other threads:[~2011-09-20  7:58 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-20  7:58 Heiko Schocher [this message]
2011-09-20  8:08 ` mtd-util, flash_erase: MEMGETOOBSEL on davinci based board fail Artem Bityutskiy
2011-09-20  8:20   ` Heiko Schocher
2011-09-20 11:27 ` Artem Bityutskiy
2011-09-20 12:45   ` Artem Bityutskiy
2011-09-20 12:51     ` Heiko Schocher
2011-09-20 13:27     ` Heiko Schocher
2011-09-20 20:48       ` Brian Norris
2011-09-21  6:37         ` Heiko Schocher

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4E784790.4010601@denx.de \
    --to=hs@denx.de \
    --cc=linux-mtd@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.