From patchwork Thu Jan 20 16:17:00 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Holger Brunck X-Patchwork-Id: 79714 X-Patchwork-Delegate: sr@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id D7EFAB70EC for ; Fri, 21 Jan 2011 03:17:19 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 967E62813A; Thu, 20 Jan 2011 17:17:18 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id aR8KAXn3Rc0X; Thu, 20 Jan 2011 17:17:18 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 6DB1128129; Thu, 20 Jan 2011 17:17:15 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id B71E828129 for ; Thu, 20 Jan 2011 17:17:13 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id tSg8UFZysJsK for ; Thu, 20 Jan 2011 17:17:13 +0100 (CET) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail.de.keymile.com (mail.de.keymile.com [195.8.104.1]) by theia.denx.de (Postfix) with SMTP id 15B1628125 for ; Thu, 20 Jan 2011 17:17:12 +0100 (CET) Received: from mailrelay.de.keymile.net ([10.9.1.54]) by eSafe SMTP Relay 1291979143; Thu, 20 Jan 2011 16:59:31 +0100 Received: from localhost.localdomain (chber1-10403x.ch.keymile.net [172.31.31.43]) by mailrelay.de.keymile.net (8.12.2/8.12.2) with ESMTP id p0KGCR06012881; Thu, 20 Jan 2011 17:12:27 +0100 (MET) From: Holger Brunck To: u-boot@lists.denx.de Date: Thu, 20 Jan 2011 17:17:00 +0100 Message-Id: <1295540225-11083-1-git-send-email-holger.brunck@keymile.com> X-Mailer: git-send-email 1.7.0.5 X-ESAFE-STATUS: Mail allowed X-ESAFE-DETAILS: Cc: Holger Brunck Subject: [U-Boot] [PATCH 1/6] mtd: add writebufsize field to mtd_info struct X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.9 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de This field will be used to indicate the write buffer size of the MTD device. UBI will set it's minimal I/O unit size (min_io_size) to the indicated write buffer size. By this change we intend to fix failed recovery of UBIFS partitions we currently observe on NOR flash when mounting the partition after unclean unmount. Currently the min_io_size is set to mtd->writesize (which is 1 byte for NOR flash). But flash programming is often done from prepared write buffer containing multiple bytes and is performed in one programming operation which could be interrupted by a power cut or a system reset causing corrupted (partially written) areas in a flash sector. Knowing the size of potentially corrupted areas UBIFS scanning and recovery algorithms are able to perform successful recovery. Signed-off-by: Holger Brunck --- include/linux/mtd/mtd.h | 11 +++++++++++ 1 files changed, 11 insertions(+), 0 deletions(-) diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h index 3b18d7d..14d6f70 100644 --- a/include/linux/mtd/mtd.h +++ b/include/linux/mtd/mtd.h @@ -129,6 +129,17 @@ struct mtd_info { */ u_int32_t writesize; + /* + * Size of the write buffer used by the MTD. MTD devices having a write + * buffer can write multiple writesize chunks at a time. E.g. while + * writing 4 * writesize bytes to a device with 2 * writesize bytes + * buffer the MTD driver can (but doesn't have to) do 2 writesize + * operations, but not 4. Currently, all NANDs have writebufsize + * equivalent to writesize (NAND page size). Some NOR flashes do have + * writebufsize greater than writesize. + */ + u_int32_t writebufsize; + u_int32_t oobsize; /* Amount of OOB data per block (e.g. 16) */ u_int32_t oobavail; /* Available OOB bytes per block */