All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dirk Behme <dirk.behme@de.bosch.com>
To: <linux-mtd@lists.infradead.org>, Richard Weinberger <richard@nod.at>
Cc: <manfred@colorfullife.com>, <dirk.behme@de.bosch.com>,
	Manfred Spraul <manfred.spraul@de.bosch.com>
Subject: [PATCH 1/5] mtdram: expose write size and writebuf size as module parameters
Date: Wed, 6 Dec 2017 09:50:35 +0100	[thread overview]
Message-ID: <20171206085039.27164-2-dirk.behme@de.bosch.com> (raw)
In-Reply-To: <20171206085039.27164-1-dirk.behme@de.bosch.com>

From: Manfred Spraul <manfred@colorfullife.com>

Right now, mtdram reports itself as a device with a 1 byte write
size, and the writebuf size can only be changed at compile time.

The patch:
- allows to change the write size, both at compile and at
  module load time
- allows to change the writebuf size at module load time.

Increasing the write size e.g. speeds up nandwrite significantly,
and it allows to test how UBI behaves with/without subpage writes.

Signed-off-by: Manfred Spraul <manfred.spraul@de.bosch.com>
Cc: Manfred Spraul <manfred@colorfullife.com>
---
 drivers/mtd/devices/Kconfig  | 19 +++++++++++++++++++
 drivers/mtd/devices/mtdram.c |  7 +++++--
 2 files changed, 24 insertions(+), 2 deletions(-)

diff --git a/drivers/mtd/devices/Kconfig b/drivers/mtd/devices/Kconfig
index 6def5445e03e..d8b67ba0b5de 100644
--- a/drivers/mtd/devices/Kconfig
+++ b/drivers/mtd/devices/Kconfig
@@ -181,6 +181,25 @@ config MTDRAM_ERASE_SIZE
 	  as a module, it is also possible to specify this as a parameter when
 	  loading the module.
 
+config MTDRAM_WRITE_SIZE
+	int "MTDRAM write size in bytes"
+	depends on MTD_MTDRAM
+	default "1"
+	help
+	  This allows you to configure the minimum write 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. Common values are 1 (NOR), 512 (NAND with sub-
+	  page writes) or 2048 (NAND without sub-page writes).
+
+config MTDRAM_WRITEBUF_SIZE
+	int "MTDRAM writebuf size in bytes"
+	depends on MTD_MTDRAM
+	default "64"
+	help
+	  This allows you to specify the writebuf size that is reported
+	  by the device emulated by the MTDRAM driver.
+
 config MTD_BLOCK2MTD
 	tristate "MTD using block device"
 	depends on BLOCK
diff --git a/drivers/mtd/devices/mtdram.c b/drivers/mtd/devices/mtdram.c
index 0bf4aeaf0cb8..0c8652ac0395 100644
--- a/drivers/mtd/devices/mtdram.c
+++ b/drivers/mtd/devices/mtdram.c
@@ -20,7 +20,8 @@
 
 static unsigned long total_size = CONFIG_MTDRAM_TOTAL_SIZE;
 static unsigned long erase_size = CONFIG_MTDRAM_ERASE_SIZE;
-static unsigned long writebuf_size = 64;
+static unsigned long writebuf_size = CONFIG_MTDRAM_WRITEBUF_SIZE;
+static unsigned long write_size = CONFIG_MTDRAM_WRITE_SIZE;
 #define MTDRAM_TOTAL_SIZE (total_size * 1024)
 #define MTDRAM_ERASE_SIZE (erase_size * 1024)
 
@@ -31,6 +32,8 @@ 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 (Default: 64)");
+module_param(write_size, ulong, 0);
+MODULE_PARM_DESC(write_size, "Device write size in Bytes (Default: 1)");
 #endif
 
 // We could store these in the mtd structure, but we only support 1 device..
@@ -134,7 +137,7 @@ int mtdram_init_device(struct mtd_info *mtd, void *mapped_address,
 	mtd->type = MTD_RAM;
 	mtd->flags = MTD_CAP_RAM;
 	mtd->size = size;
-	mtd->writesize = 1;
+	mtd->writesize = write_size;
 	mtd->writebufsize = writebuf_size;
 	mtd->erasesize = MTDRAM_ERASE_SIZE;
 	mtd->priv = mapped_address;
-- 
2.14.1

  reply	other threads:[~2017-12-06  8:59 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-06  8:50 [PATCH 0/5] Add flight recorder to MTDRAM Dirk Behme
2017-12-06  8:50 ` Dirk Behme [this message]
2017-12-06  8:50 ` [PATCH 2/5] mtdram: Add flight recorder Dirk Behme
2017-12-06  8:50 ` [PATCH 3/5] mtdram: Allow to enable/disable flight recorder mode at runtime Dirk Behme
2017-12-06  8:50 ` [PATCH 4/5] mtdram: Convert the flight recorder to a ring buffer Dirk Behme
2017-12-06  8:50 ` [PATCH 5/5] mtdram flight recorder: Add checksums Dirk Behme
2017-12-06 10:41 ` [PATCH 0/5] Add flight recorder to MTDRAM Richard Weinberger
2017-12-06 19:44   ` Manfred Spraul
2017-12-06 19:59     ` Richard Weinberger
2017-12-06 20:57       ` Richard Weinberger
2017-12-07 16:06         ` Manfred Spraul

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171206085039.27164-2-dirk.behme@de.bosch.com \
    --to=dirk.behme@de.bosch.com \
    --cc=linux-mtd@lists.infradead.org \
    --cc=manfred.spraul@de.bosch.com \
    --cc=manfred@colorfullife.com \
    --cc=richard@nod.at \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.