From patchwork Tue Nov 29 01:01:17 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Dunn X-Patchwork-Id: 128180 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 5455D1007D2 for ; Tue, 29 Nov 2011 12:03:16 +1100 (EST) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1RVC5E-0004Xm-PC; Tue, 29 Nov 2011 01:02:04 +0000 Received: from casper.infradead.org ([2001:770:15f::2]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1RVC5B-0004XR-Nu for linux-mtd@merlin.infradead.org; Tue, 29 Nov 2011 01:02:02 +0000 Received: from smtp.newsguy.com ([74.209.136.69]) by casper.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1RVC59-0002Mf-M5 for linux-mtd@lists.infradead.org; Tue, 29 Nov 2011 01:02:00 +0000 Received: from localhost.localdomain (206.sub-166-250-1.myvzw.com [166.250.1.206]) by smtp.newsguy.com (8.14.3/8.14.3) with ESMTP id pAT11VYc000731 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 28 Nov 2011 17:01:33 -0800 (PST) (envelope-from mikedunn@newsguy.com) From: Mike Dunn To: linux-mtd@lists.infradead.org Subject: [PATCH 1/5] mtd api changed to return bitflips on read operations Date: Mon, 28 Nov 2011 17:01:17 -0800 Message-Id: <1322528477-19666-1-git-send-email-mikedunn@newsguy.com> X-Mailer: git-send-email 1.7.3.4 To: linux-mtd@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20111129_010200_015530_99C2E216 X-CRM114-Status: GOOD ( 13.82 ) X-Spam-Score: -3.1 (---) X-Spam-Report: SpamAssassin version 3.3.2 on casper.infradead.org summary: Content analysis details: (-3.1 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record -1.2 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: Artem Bityutskiy , Lars-Peter Clausen , Mike Dunn , Scott Branden , Wan ZongShun , Dmitry Eremin-Solenikov , Robert Jarzmik , Sukumar Ghorai , Manuel Lauss , Haojian Zhuang , Kyungmin Park , Vimal Singh , Ralf Baechle , Jiandong Zheng , Andres Salomon , Olof Johansson , Jamie Iles , Brian Norris , David Woodhouse X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-mtd-bounces@lists.infradead.org Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Proposed mtd api change. Signed-off-by: Mike Dunn --- include/linux/mtd/mtd.h | 11 ++++++++++- 1 files changed, 10 insertions(+), 1 deletions(-) diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h index 9f5b312..67f4bbc 100644 --- a/include/linux/mtd/mtd.h +++ b/include/linux/mtd/mtd.h @@ -81,6 +81,9 @@ struct mtd_erase_region_info { * mode = MTD_OPS_PLACE_OOB or MTD_OPS_RAW) * @datbuf: data buffer - if NULL only oob data are read/written * @oobbuf: oob data buffer + * @max_bitflips: for read operations, greatest number of bit errors corrected + * on any one minimum i/o unit (e.g., nand page) + * (value returned to caller by the driver) * * Note, it is allowed to read more than one OOB area at one go, but not write. * The interface assumes that the OOB write requests program only one page's @@ -95,6 +98,7 @@ struct mtd_oob_ops { uint32_t ooboffs; uint8_t *datbuf; uint8_t *oobbuf; + unsigned int max_bitflips; }; #define MTD_MAX_OOBFREE_ENTRIES_LARGE 32 @@ -201,8 +205,13 @@ struct mtd_info { */ struct backing_dev_info *backing_dev_info; + /* + * max_bitflips returns to caller the greatest number of bit errors + * corrected on any one minimum i/o unit (e.g., nand page) + */ + int (*read) (struct mtd_info *mtd, loff_t from, size_t len, + size_t *retlen, u_char *buf, unsigned int *max_bitflips); - int (*read) (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf); int (*write) (struct mtd_info *mtd, loff_t to, size_t len, size_t *retlen, const u_char *buf); /* In blackbox flight recorder like scenarios we want to make successful