* [PATCH][02/03] nandsim default values in Kconfig
@ 2005-05-23 7:40 Kluba Patrik
2005-05-23 9:01 ` Artem B. Bityuckiy
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Kluba Patrik @ 2005-05-23 7:40 UTC (permalink / raw)
To: linux-mtd
Hi!
Nandsim uses several module parameters for specifying what chip to simulate.
Some default values are in the source itself. It's much convenient to have them
in Kconfig so you don't need to specify module parameters every time you load
it.
Here is a patch.
Bye,
Patrik Kluba
--
diff -Naur mtd-work/drivers/mtd/nand/Kconfig mtd-work2/drivers/mtd/nand/Kconfig
--- mtd-work/drivers/mtd/nand/Kconfig 2005-05-23 07:43:43.000000000 +0200
+++ mtd-work2/drivers/mtd/nand/Kconfig 2005-05-23 07:56:24.000000000 +0200
@@ -204,4 +204,66 @@
The simulator may simulate verious NAND flash chips for the
MTD nand layer.
+ config MTD_NAND_NANDSIM_DEBUG
+ bool "NAND Simulator debugging"
+ depends on MTD_NAND_NANDSIM
+
+ config MTD_NAND_NANDSIM_LOG
+ bool "NAND Simulator logging"
+ depends on MTD_NAND_NANDSIM
+
+ config MTD_NAND_NANDSIM_DELAY
+ bool "Emulate chip delays"
+ default y
+ depends on MTD_NAND_NANDSIM
+
+ config MTD_NAND_NANDSIM_ACCESS_DELAY
+ int "Access delay"
+ default 25
+ depends on MTD_NAND_NANDSIM_DELAY
+
+ config MTD_NAND_NANDSIM_PROGRAM_DELAY
+ int "Program delay"
+ default 200
+ depends on MTD_NAND_NANDSIM_DELAY
+
+ config MTD_NAND_NANDSIM_ERASE_DELAY
+ int "Erase delay"
+ default 2
+ depends on MTD_NAND_NANDSIM_DELAY
+
+ config MTD_NAND_NANDSIM_OUTPUT_CYCLE
+ int "Output cycle"
+ default 40
+ depends on MTD_NAND_NANDSIM_DELAY
+
+config MTD_NAND_NANDSIM_INPUT_CYCLE
+ int "Input cycle"
+ default 50
+ depends on MTD_NAND_NANDSIM_DELAY
+
+ config MTD_NAND_NANDSIM_FIRST_ID
+ hex "First ID byte"
+ range 0x00 0xff
+ default 0x98
+ depends on MTD_NAND_NANDSIM
+
+ config MTD_NAND_NANDSIM_SECOND_ID
+ hex "Second ID byte"
+ range 0x00 0xff
+ default 0x39
+ depends on MTD_NAND_NANDSIM
+
+ config MTD_NAND_NANDSIM_THIRD_ID
+ hex "Third ID byte"
+ range 0x00 0xff
+ default 0xff
+ depends on MTD_NAND_NANDSIM
+
+ config MTD_NAND_NANDSIM_FOURTH_ID
+ hex "Fourth ID byte"
+ range 0x00 0xff
+ default 0xff
+ depends on MTD_NAND_NANDSIM
+
endmenu
diff -Naur mtd-work/drivers/mtd/nand/nandsim.c mtd-work2/drivers/mtd/nand/nandsim.c
--- mtd-work/drivers/mtd/nand/nandsim.c 2005-05-23 07:48:34.000000000 +0200
+++ mtd-work2/drivers/mtd/nand/nandsim.c 2005-05-23 08:10:34.000000000 +0200
@@ -42,59 +42,71 @@
#include <asm/io.h>
#endif
+# define CONFIG_NANDSIM_FISRT_ID_BYTE CONFIG_MTD_NAND_NANDSIM_FIRST_ID
+# define CONFIG_NANDSIM_SECOND_ID_BYTE CONFIG_MTD_NAND_NANDSIM_SECOND_ID
+# define CONFIG_NANDSIM_THIRD_ID_BYTE CONFIG_MTD_NAND_NANDSIM_THIRD_ID
+# define CONFIG_NANDSIM_FOURTH_ID_BYTE CONFIG_MTD_NAND_NANDSIM_FOURTH_ID
-/* Default simulator parameters values */
-#if !defined(CONFIG_NANDSIM_FIRST_ID_BYTE) || \
- !defined(CONFIG_NANDSIM_SECOND_ID_BYTE) || \
- !defined(CONFIG_NANDSIM_THIRD_ID_BYTE) || \
- !defined(CONFIG_NANDSIM_FOURTH_ID_BYTE)
-#define CONFIG_NANDSIM_FIRST_ID_BYTE 0x98
-#define CONFIG_NANDSIM_SECOND_ID_BYTE 0x39
-#define CONFIG_NANDSIM_THIRD_ID_BYTE 0xFF /* No byte */
-#define CONFIG_NANDSIM_FOURTH_ID_BYTE 0xFF /* No byte */
+#ifndef CONFIG_MTD_NAND_NANDSIM_ACCESS_DELAY
+# define CONFIG_MTD_NAND_NANDSIM_ACCESS_DELAY 25
#endif
-#ifndef CONFIG_NANDSIM_ACCESS_DELAY
-#define CONFIG_NANDSIM_ACCESS_DELAY 25
+#ifndef CONFIG_MTD_NAND_NANDSIM_PROGRAM_DELAY
+# define CONFIG_MTD_NAND_NANDSIM_PROGRAM_DELAY 200
#endif
-#ifndef CONFIG_NANDSIM_PROGRAMM_DELAY
-#define CONFIG_NANDSIM_PROGRAMM_DELAY 200
-#endif
-#ifndef CONFIG_NANDSIM_ERASE_DELAY
-#define CONFIG_NANDSIM_ERASE_DELAY 2
+
+#ifndef CONFIG_MTD_NAND_NANDSIM_ERASE_DELAY
+# define CONFIG_MTD_NAND_NANDSIM_ERASE_DELAY 2
#endif
-#ifndef CONFIG_NANDSIM_OUTPUT_CYCLE
-#define CONFIG_NANDSIM_OUTPUT_CYCLE 40
+
+#ifndef CONFIG_MTD_NAND_NANDSIM_OUTPUT_CYCLE
+# define CONFIG_MTD_NAND_NANDSIM_OUTPUT_CYCLE 40
#endif
-#ifndef CONFIG_NANDSIM_INPUT_CYCLE
-#define CONFIG_NANDSIM_INPUT_CYCLE 50
+
+#ifndef CONFIG_MTD_NAND_NANDSIM_INPUT_CYCLE
+# define CONFIG_MTD_NAND_NANDSIM_INPUT_CYCLE 50
#endif
-#ifndef CONFIG_NANDSIM_BUS_WIDTH
-#define CONFIG_NANDSIM_BUS_WIDTH 8
+
+#ifdef CONFIG_MTD_NAND_NANDSIM_16BIT_BUS
+# define CONFIG_NANDSIM_BUS_WIDTH 16
+#else
+# define CONFIG_NANDSIM_BUS_WIDTH 8
#endif
-#ifndef CONFIG_NANDSIM_DO_DELAYS
-#define CONFIG_NANDSIM_DO_DELAYS 0
+
+#ifndef CONFIG_MTD_NAND_NANDSIM_DELAY
+# define CONFIG_MTD_NAND_NANDSIM_DELAY 0
+#else
+# undef CONFIG_MTD_NAND_NANDSIM_DELAY
+# define CONFIG_MTD_NAND_NANDSIM_DELAY 1
#endif
-#ifndef CONFIG_NANDSIM_LOG
-#define CONFIG_NANDSIM_LOG 0
+
+#ifndef CONFIG_MTD_NAND_NANDSIM_LOG
+# define CONFIG_MTD_NAND_NANDSIM_LOG 0
+#else
+# undef CONFIG_MTD_NAND_NANDSIM_LOG
+# define CONFIG_MTD_NAND_NANDSIM_LOG 1
#endif
-#ifndef CONFIG_NANDSIM_DBG
-#define CONFIG_NANDSIM_DBG 0
+
+#ifndef CONFIG_MTD_NAND_NANDSIM_DEBUG
+# define CONFIG_MTD_NAND_NANDSIM_DEBUG 0
+#else
+# undef CONFIG_MTD_NAND_NANDSIM_DEBUG
+# define CONFIG_MTD_NAND_NANDSIM_DEBUG 1
#endif
static uint first_id_byte = CONFIG_NANDSIM_FIRST_ID_BYTE;
static uint second_id_byte = CONFIG_NANDSIM_SECOND_ID_BYTE;
static uint third_id_byte = CONFIG_NANDSIM_THIRD_ID_BYTE;
static uint fourth_id_byte = CONFIG_NANDSIM_FOURTH_ID_BYTE;
-static uint access_delay = CONFIG_NANDSIM_ACCESS_DELAY;
-static uint programm_delay = CONFIG_NANDSIM_PROGRAMM_DELAY;
-static uint erase_delay = CONFIG_NANDSIM_ERASE_DELAY;
-static uint output_cycle = CONFIG_NANDSIM_OUTPUT_CYCLE;
-static uint input_cycle = CONFIG_NANDSIM_INPUT_CYCLE;
+static uint access_delay = CONFIG_MTD_NAND_NANDSIM_ACCESS_DELAY;
+static uint programm_delay = CONFIG_MTD_NAND_NANDSIM_PROGRAM_DELAY;
+static uint erase_delay = CONFIG_MTD_NAND_NANDSIM_ERASE_DELAY;
+static uint output_cycle = CONFIG_MTD_NAND_NANDSIM_OUTPUT_CYCLE;
+static uint input_cycle = CONFIG_MTD_NAND_NANDSIM_INPUT_CYCLE;
static uint bus_width = CONFIG_NANDSIM_BUS_WIDTH;
-static uint do_delays = CONFIG_NANDSIM_DO_DELAYS;
-static uint log = CONFIG_NANDSIM_LOG;
-static uint dbg = CONFIG_NANDSIM_DBG;
+static uint do_delays = CONFIG_MTD_NAND_NANDSIM_DELAY;
+static uint log = CONFIG_MTD_NAND_NANDSIM_LOG;
+static uint dbg = CONFIG_MTD_NAND_NANDSIM_DEBUG;
module_param(first_id_byte, uint, 0400);
module_param(second_id_byte, uint, 0400);
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH][02/03] nandsim default values in Kconfig
2005-05-23 7:40 [PATCH][02/03] nandsim default values in Kconfig Kluba Patrik
@ 2005-05-23 9:01 ` Artem B. Bityuckiy
2005-05-23 9:24 ` Artem B. Bityuckiy
2005-05-24 13:42 ` Thomas Gleixner
2 siblings, 0 replies; 6+ messages in thread
From: Artem B. Bityuckiy @ 2005-05-23 9:01 UTC (permalink / raw)
To: Kluba Patrik; +Cc: linux-mtd
Kluba Patrik wrote:
> + config MTD_NAND_NANDSIM_ACCESS_DELAY
> + int "Access delay"
> + default 25
> + depends on MTD_NAND_NANDSIM_DELAY
I think the units (microseconds) must be specified here too. I'll do this.
Thanks.
--
Best Regards,
Artem B. Bityuckiy,
St.-Petersburg, Russia.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH][02/03] nandsim default values in Kconfig
2005-05-23 7:40 [PATCH][02/03] nandsim default values in Kconfig Kluba Patrik
2005-05-23 9:01 ` Artem B. Bityuckiy
@ 2005-05-23 9:24 ` Artem B. Bityuckiy
2005-05-24 13:42 ` Thomas Gleixner
2 siblings, 0 replies; 6+ messages in thread
From: Artem B. Bityuckiy @ 2005-05-23 9:24 UTC (permalink / raw)
To: Kluba Patrik; +Cc: linux-mtd
Kluba Patrik wrote:
> +
> + config MTD_NAND_NANDSIM_DELAY
> + bool "Emulate chip delays"
> + default y
> + depends on MTD_NAND_NANDSIM
I presume this should be "no" by default.
--
Best Regards,
Artem B. Bityuckiy,
St.-Petersburg, Russia.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH][02/03] nandsim default values in Kconfig
2005-05-23 7:40 [PATCH][02/03] nandsim default values in Kconfig Kluba Patrik
2005-05-23 9:01 ` Artem B. Bityuckiy
2005-05-23 9:24 ` Artem B. Bityuckiy
@ 2005-05-24 13:42 ` Thomas Gleixner
2005-05-24 14:25 ` Kluba Patrik
2 siblings, 1 reply; 6+ messages in thread
From: Thomas Gleixner @ 2005-05-24 13:42 UTC (permalink / raw)
To: Kluba Patrik; +Cc: Artem B. Bityuckiy, linux-mtd
Hi Patrik,
On Mon, 2005-05-23 at 09:40 +0200, Kluba Patrik wrote:
> Nandsim uses several module parameters for specifying what chip to simulate.
> Some default values are in the source itself. It's much convenient to have them
> in Kconfig so you don't need to specify module parameters every time you load
> it.
I'm not too happy to add two dozen config options for a driver which is
used for development and research only.
If you want to experiment with various chip types, parameters... it
makes not much sense to me to compile the settings into the module.
I'd prefer to have them available as module parameters, so I can change
the settings without recompiling on module load.
> With this patch you can easily construct a NAND geometry for nandsim from within
> Kconfig. The main purpose is to make testing on large page chips possible on
> low-memory systems like mine (eg. test on a 256Mbit chip with large pages) or
Can be solved by module parameters too. You even can use the id of e.g.
a 16GiB chip. Simply limit the max. memory allocation for that chip and
declare all blocks which exceed the available memory as bad blocks so
nothing will ever access them. You can also use partitions for that
purpose.
> test on a chip you do not have and don't know the ID values for it
If you do not have chip ID's handy, then simply supply the device size,
page size, buswidth and let nandsim scan the id table for a matching
chip.
To create a new chip id with handcrafted parameters you can even change
a table entry from nandsim.
As I said yesterday I prefer to have such things nicely hidden in the
nandsim module which should have sane default values for the module so
the average Joe User does not run into trouble.
Having those config switches around provokes wrong assumptions about the
real world usage of the nand driver subsystem. It's scary enough to
imagine them, I dont want to read them :)
tglx
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH][02/03] nandsim default values in Kconfig
2005-05-24 13:42 ` Thomas Gleixner
@ 2005-05-24 14:25 ` Kluba Patrik
2005-05-24 14:58 ` Jörn Engel
0 siblings, 1 reply; 6+ messages in thread
From: Kluba Patrik @ 2005-05-24 14:25 UTC (permalink / raw)
To: Thomas Gleixner; +Cc: Artem B. Bityuckiy, linux-mtd
> I'd prefer to have them available as module parameters, so I can change
> the settings without recompiling on module load.
What if I rewrite nandsim's module parameters for easier setting of the values,
like erase block size, page size, OOB size, etc. instead of to have the
developer enter ID bytes, and change a table entry based on the given values? In
this case, which entry should be changed?
Bye,
Patrik Kluba
kkk
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH][02/03] nandsim default values in Kconfig
2005-05-24 14:25 ` Kluba Patrik
@ 2005-05-24 14:58 ` Jörn Engel
0 siblings, 0 replies; 6+ messages in thread
From: Jörn Engel @ 2005-05-24 14:58 UTC (permalink / raw)
To: Kluba Patrik; +Cc: Artem B. Bityuckiy, Thomas Gleixner, linux-mtd
On Tue, 24 May 2005 16:25:54 +0200, Kluba Patrik wrote:
>
> >I'd prefer to have them available as module parameters, so I can change
> >the settings without recompiling on module load.
>
> What if I rewrite nandsim's module parameters for easier setting of the
> values, like erase block size, page size, OOB size, etc. instead of to have
> the developer enter ID bytes, and change a table entry based on the given
> values? In this case, which entry should be changed?
How about you #include "nandsim_config.h" ?
Then you can edit nandsim_config.h with your favorite editor and have
all the options visible in a couple of lines.
Jörn
--
The wise man seeks everything in himself; the ignorant man tries to get
everything from somebody else.
-- unknown
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2005-05-24 14:58 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-05-23 7:40 [PATCH][02/03] nandsim default values in Kconfig Kluba Patrik
2005-05-23 9:01 ` Artem B. Bityuckiy
2005-05-23 9:24 ` Artem B. Bityuckiy
2005-05-24 13:42 ` Thomas Gleixner
2005-05-24 14:25 ` Kluba Patrik
2005-05-24 14:58 ` Jörn Engel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox