From patchwork Wed Mar 2 13:06:41 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Stein X-Patchwork-Id: 590986 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2001:1868:205::9]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 74D8E140291 for ; Thu, 3 Mar 2016 00:08:55 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1ab6Ul-0005dq-TJ; Wed, 02 Mar 2016 13:07:15 +0000 Received: from webbox1416.server-home.net ([77.236.96.61]) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1ab6Ui-0005aD-Ui for linux-mtd@lists.infradead.org; Wed, 02 Mar 2016 13:07:13 +0000 Received: from imapserver.systec-electronic.com (unknown [212.185.67.146]) by webbox1416.server-home.net (Postfix) with ESMTPA id 3EB8F27A5BE; Wed, 2 Mar 2016 14:06:52 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by imapserver.systec-electronic.com (Postfix) with ESMTP id 22A91DA0A55; Wed, 2 Mar 2016 14:06:52 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at imapserver.systec-electronic.com Received: from imapserver.systec-electronic.com ([127.0.0.1]) by localhost (imapserver.systec-electronic.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id fclXxZFYN8Ue; Wed, 2 Mar 2016 14:06:50 +0100 (CET) Received: from localhost.localdomain (ws-stein.systec.local [192.168.10.117]) by imapserver.systec-electronic.com (Postfix) with ESMTP id 29576DA0A45; Wed, 2 Mar 2016 14:06:50 +0100 (CET) From: Alexander Stein To: David Woodhouse , Brian Norris Subject: [PATCH v2 1/1] mtd: mtdram: Add parameter for setting writebuf size Date: Wed, 2 Mar 2016 14:06:41 +0100 Message-Id: <1456924001-1000-1-git-send-email-alexander.stein@systec-electronic.com> X-Mailer: git-send-email 2.4.10 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160302_050713_328486_846E88EB X-CRM114-Status: GOOD ( 12.94 ) X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-1.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-mtd@lists.infradead.org, Alexander Stein MIME-Version: 1.0 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org ubifs uses the write buffer size in recovery algorithm. When inspecting an unclean ubifs recovery fails with writebuf size 64 in mtdram while recovery on actual mtd device with writebuf size of 1024 succeeds. So add a parameter for setting this property. Signed-off-by: Alexander Stein Reviewed-by: Richard Weinberger --- Changes in v2: * Added Reviewed-by: Richard Weinberger * Removed outdated comment about CFI NOR flash write buffer sizes drivers/mtd/devices/Kconfig | 10 ++++++++++ drivers/mtd/devices/mtdram.c | 6 +++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/drivers/mtd/devices/Kconfig b/drivers/mtd/devices/Kconfig index f73c416..5431d75 100644 --- a/drivers/mtd/devices/Kconfig +++ b/drivers/mtd/devices/Kconfig @@ -171,6 +171,16 @@ config MTDRAM_ERASE_SIZE as a module, it is also possible to specify this as a parameter when loading the module. +config MTDRAM_WRITEBUF_SIZE + int "MTDRAM write buf size in Bytes" + depends on MTD_MTDRAM + default "64" + help + This allows you to configure the write buffer size in the device + emulated by the MTDRAM driver. If the MTDRAM driver is built + as a module, it is also possible to specify this as a parameter when + loading the module. E.g. ubifs relies this in the recovery algorithm. + #If not a module (I don't want to test it as a module) config MTDRAM_ABS_POS hex "SRAM Hexadecimal Absolute position or 0" diff --git a/drivers/mtd/devices/mtdram.c b/drivers/mtd/devices/mtdram.c index 627a9bc..6977a66 100644 --- a/drivers/mtd/devices/mtdram.c +++ b/drivers/mtd/devices/mtdram.c @@ -19,14 +19,18 @@ static unsigned long total_size = CONFIG_MTDRAM_TOTAL_SIZE; static unsigned long erase_size = CONFIG_MTDRAM_ERASE_SIZE; +static unsigned long writebuf_size = CONFIG_MTDRAM_WRITEBUF_SIZE; #define MTDRAM_TOTAL_SIZE (total_size * 1024) #define MTDRAM_ERASE_SIZE (erase_size * 1024) +#define MTDRAM_WRITEBUF_SIZE (writebuf_size) #ifdef MODULE module_param(total_size, ulong, 0); MODULE_PARM_DESC(total_size, "Total device size in KiB"); module_param(erase_size, ulong, 0); MODULE_PARM_DESC(erase_size, "Device erase block size in KiB"); +module_param(writebuf_size, ulong, 0); +MODULE_PARM_DESC(writebuf_size, "Device write buf size in Bytes"); #endif // We could store these in the mtd structure, but we only support 1 device.. @@ -123,7 +127,7 @@ int mtdram_init_device(struct mtd_info *mtd, void *mapped_address, mtd->flags = MTD_CAP_RAM; mtd->size = size; mtd->writesize = 1; - mtd->writebufsize = 64; /* Mimic CFI NOR flashes */ + mtd->writebufsize = MTDRAM_WRITEBUF_SIZE; mtd->erasesize = MTDRAM_ERASE_SIZE; mtd->priv = mapped_address;