All of lore.kernel.org
 help / color / mirror / Atom feed
* mtd-util, flash_erase: MEMGETOOBSEL on davinci based board fail
@ 2011-09-20  7:58 Heiko Schocher
  2011-09-20  8:08 ` Artem Bityutskiy
  2011-09-20 11:27 ` Artem Bityutskiy
  0 siblings, 2 replies; 9+ messages in thread
From: Heiko Schocher @ 2011-09-20  7:58 UTC (permalink / raw)
  To: linux-mtd

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

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

end of thread, other threads:[~2011-09-21  6:38 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-09-20  7:58 mtd-util, flash_erase: MEMGETOOBSEL on davinci based board fail Heiko Schocher
2011-09-20  8:08 ` 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

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.