Re: [PATCH v2] mtd: rawnand: nandsim: Add support to disable subpage writes.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



So there was a comment from Richard on the original patch that got mangled so it did not even have a subject line.

The original intent for this patch was to make it possible to setup the simulator with the same parameters as some real hardware. That is the command "mtdinfo /dev/mtdX" would show the same on the simulator as the real hardware.

It's true that you could change the vid offset with ubiattach but that require you know that the LEB missmatch error you get is fixed by a different vid offset and you need to understand what that value should be. This way you only need to match the basic mtd parameters and the rest will just work automatically.


On 2018-12-22 13:40, Kenneth Johansson wrote:
This is needed if you try to use an already existing ubifs image that
is created for hardware that do not support subpage write.

It is not enough that you can select what nandchip to emulate as the
subpage support might not exist in the actual nand driver.

Signed-off-by: Kenneth Johansson <ken@xxxxxxxxx>
---
  drivers/mtd/nand/raw/nandsim.c | 7 +++++++
  1 file changed, 7 insertions(+)

diff --git a/drivers/mtd/nand/raw/nandsim.c b/drivers/mtd/nand/raw/nandsim.c
index c452819..3e9eaa2 100644
--- a/drivers/mtd/nand/raw/nandsim.c
+++ b/drivers/mtd/nand/raw/nandsim.c
@@ -110,6 +110,7 @@ static unsigned int overridesize = 0;
  static char *cache_file = NULL;
  static unsigned int bbt;
  static unsigned int bch;
+static unsigned int no_subpage;
  static u_char id_bytes[8] = {
  	[0] = CONFIG_NANDSIM_FIRST_ID_BYTE,
  	[1] = CONFIG_NANDSIM_SECOND_ID_BYTE,
@@ -142,6 +143,7 @@ module_param(overridesize,   uint, 0400);
  module_param(cache_file,     charp, 0400);
  module_param(bbt,	     uint, 0400);
  module_param(bch,	     uint, 0400);
+module_param(no_subpage,     uint, 0400);
MODULE_PARM_DESC(id_bytes, "The ID bytes returned by NAND Flash 'read ID' command");
  MODULE_PARM_DESC(first_id_byte,  "The first byte returned by NAND Flash 'read ID' command (manufacturer ID) (obsolete)");
@@ -177,6 +179,7 @@ MODULE_PARM_DESC(cache_file,     "File to use to cache nand pages instead of mem
  MODULE_PARM_DESC(bbt,		 "0 OOB, 1 BBT with marker in OOB, 2 BBT with marker in data area");
  MODULE_PARM_DESC(bch,		 "Enable BCH ecc and set how many bits should "
  				 "be correctable in 512-byte blocks");
+MODULE_PARM_DESC(no_subpage,	 "Disable use of subpage write");
/* The largest possible page size */
  #define NS_LARGEST_PAGE_SIZE	4096
@@ -2260,6 +2263,10 @@ static int __init ns_init_module(void)
  	/* and 'badblocks' parameters to work */
  	chip->options   |= NAND_SKIP_BBTSCAN;
+ /* turn off subpage to be able to simulate using a nand controller without subpage support */
+	if (no_subpage)
+		chip->options   |= NAND_NO_SUBPAGE_WRITE;
+
  	switch (bbt) {
  	case 2:
  		 chip->bbt_options |= NAND_BBT_NO_OOB;



______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/



[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux