From patchwork Tue Sep 20 07:58:08 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiko Schocher X-Patchwork-Id: 115462 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:4978:20e::2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 304ACB71D0 for ; Tue, 20 Sep 2011 17:58:40 +1000 (EST) Received: from canuck.infradead.org ([2001:4978:20e::1]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1R5vDi-0001Ju-Fk; Tue, 20 Sep 2011 07:58:22 +0000 Received: from localhost ([127.0.0.1] helo=canuck.infradead.org) by canuck.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1R5vDi-0000Sa-2j; Tue, 20 Sep 2011 07:58:22 +0000 Received: from a.relay.invitel.net ([62.77.203.3]) by canuck.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1R5vDf-0000SG-4k for linux-mtd@lists.infradead.org; Tue, 20 Sep 2011 07:58:19 +0000 Received: from mail.invitel.hu (mail.invitel.hu [213.163.59.4]) by a.relay.invitel.net (Invitel Core SMTP Transmitter) with ESMTP id 857C211A06C; Tue, 20 Sep 2011 09:58:13 +0200 (CEST) Received: from [192.168.1.6] ([87.97.121.153]) by mail.invitel.hu (Invitel Messaging Server) with ESMTPA id <0LRT00JHVA4YXXG0@invitel.hu>; Tue, 20 Sep 2011 09:58:11 +0200 (CEST) Date: Tue, 20 Sep 2011 09:58:08 +0200 From: Heiko Schocher Subject: mtd-util, flash_erase: MEMGETOOBSEL on davinci based board fail To: linux-mtd@lists.infradead.org Message-id: <4E784790.4010601@denx.de> Organization: DENX Software Engineering MIME-version: 1.0 User-Agent: Thunderbird 2.0.0.6 (X11/20070801) X-CRM114-Version: 20090807-BlameThorstenAndJenny ( TRE 0.7.6 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20110920_035819_339783_07C8EBED X-CRM114-Status: GOOD ( 16.64 ) X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.3.1 on canuck.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [62.77.203.3 listed in list.dnswl.org] X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.12 Precedence: list Reply-To: hs@denx.de List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-mtd-bounces@lists.infradead.org Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org 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: 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 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 {