summaryrefslogtreecommitdiffstats
path: root/drivers/mtd/nand/nandsim.c
Commit message (Collapse)AuthorAgeFilesLines
* mtd: nandsim: remove casts from voidKulikov Vasiliy2010-08-021-7/+7
| | | | | | | | Remove unnesessary casts from void*. Signed-off-by: Kulikov Vasiliy <segooon@gmail.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
* mtd: nandsim: make some structures anonymousArtem Bityutskiy2010-05-101-3/+3
| | | | | | | | | | | We do not need these names. Moreover, there are spelling typos there: "nansin" instead of "nandsim". This patch is just a clean up, no functional changes. Reported-by: Ferenc Wagner <wferi@niif.hu> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
* mtd: nandsim: Define CONFIG_NANDSIM_MAX_PARTS and use it instead of ↵Ben Hutchings2010-02-251-2/+5
| | | | | | | | | | MAX_MTD_DEVICES MAX_MTD_DEVICES is about to be removed. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
* mtd: nandsim: fix spellingAndrey Yurovsky2010-02-251-2/+2
| | | | | | | | s/nanodeconds/nanoseconds Signed-off-by: Andrey Yurovsky <yurovsky@gmail.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
* mtd: nandsim: add support for 4KiB pagesSebastian Andrzej Siewior2009-12-011-2/+5
| | | | | | | | | | | | I was going to play with a faulty nand image from real flash and noticed that nandsim does not work with: first_id_byte=0xec second_id_byte=0xd5 third_id_byte=0x51 fourth_id_byte=0xa6 This patch seems to fix it. Signed-off-by: Sebastian Andrzej Siewior <sebastian@breakpoint.cc> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
* [MTD] [NAND] fix nandsim sched.h referencesRandy Dunlap2009-01-051-0/+1
| | | | | | | | | | | | | | | Fix sched.h references: build-r7149.out:/local/linsrc/linux-next-20081215/drivers/mtd/nand/nandsim.c:1326: error: dereferencing pointer to incomplete type build-r7149.out:/local/linsrc/linux-next-20081215/drivers/mtd/nand/nandsim.c:1326: error: 'PF_MEMALLOC' undeclared (first use in this function) build-r7149.out:/local/linsrc/linux-next-20081215/drivers/mtd/nand/nandsim.c:1328: error: dereferencing pointer to incomplete type build-r7149.out:/local/linsrc/linux-next-20081215/drivers/mtd/nand/nandsim.c:1335: error: dereferencing pointer to incomplete type build-r7149.out:/local/linsrc/linux-next-20081215/drivers/mtd/nand/nandsim.c:1335: error: 'PF_MEMALLOC' undeclared (first use in this function) build-r7149.out:make[4]: *** [drivers/mtd/nand/nandsim.o] Error 1 Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
* [MTD] [NAND] Remove strange u_int64_t types from nandsimDavid Woodhouse2008-12-101-5/+5
| | | | Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
* MTD: nandsim: use less RAMAlexey Korolev2008-12-101-7/+18
| | | | | | | | | | | | | | | | | | | | Nandsim consumes ~2x more RAM than the density of simulated device. It becomes critical if we need to simulate 256MB NAND and run stress tests on it. We investigated the reasons. nandsim allocates space for pages using kmalloc function. The size of LP nand page is 2112 bytes. kmalloc gets space from slab pools by chunks 2^n. So if we need to kmalloc 2112 bytes, 4096 bytes will be consumed by system. The best way to avoid this issue would be using kmem_cache allocations. AFAIK this mechanism specially designed to handle cases when arrays of allocations are used. Signed-off-by: Alexey Korolev <akorolev@infradead.org> Tested-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com> Acked-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
* MTD: nandsim: add option to use a file to cache pagesAdrian Hunter2008-12-101-24/+261
| | | | | | | | | | | Add a new module parameter 'cache_file' which causes nandsim to use that file instead of memory to cache nand data. Using a file allows the simulation of NAND that is bigger than the available memory. Signed-off-by: Adrian Hunter <ext-adrian.hunter@nokia.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
* MTD: nandsim: suppress unnecessary warningAdrian Hunter2008-12-101-7/+11
| | | | | | | | | nand_base sometimes reads only 2 bytes of a 4 byte id. It is OK. Do not print a warning in that case. Signed-off-by: Adrian Hunter <ext-adrian.hunter@nokia.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
* [MTD] [NAND] drivers/mtd/nand/nandsim.c: remove duplicated #includeHuang Weiyi2008-08-111-1/+0
| | | | | | | | Removed duplicated include <asm/div64.h> in drivers/mtd/nand/nandsim.c. Signed-off-by: Huang Weiyi <weiyi.huang@gmail.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
* [MTD] [NAND] drivers/mtd/nand/nandsim.c: fix printk warningsAndrew Morton2008-08-011-3/+5
| | | | | Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
* [MTD] [NAND] drivers/mtd/nand/nandsim.c needs div64.hAndrew Morton2008-08-011-0/+1
| | | | | | | | | drivers/mtd/nand/nandsim.c: In function 'divide': drivers/mtd/nand/nandsim.c:462: error: implicit declaration of function 'do_div' Cc: Stephen Rothwell <sfr@canb.auug.org.au> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
* [MTD] [NAND] nandsim: support random page read commandArtem Bityutskiy2008-07-301-17/+40
| | | | | | | | | | Commit 3d45955962496879dead8d4dd70bb9a23b07154b ("subpage read feature as a way to improve performance") broke nandsim because nandsim does not support the "random page read" NAND command. This patch adds corresponding support. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
* [MTD] [NAND] nandsim: missing header for do_divRandy Dunlap2008-06-051-0/+1
| | | | | | | | | | Fix nandsim build error, missing #include: linux-next-20080605/drivers/mtd/nand/nandsim.c: In function 'divide': linux-next-20080605/drivers/mtd/nand/nandsim.c:462: error: implicit declaration of function 'do_div' Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com> Signed-off-by: David Woodhouse <dwmw2@infradead.org>
* MTD/JFFS2: remove CVS keywordsAdrian Bunk2008-06-041-2/+0
| | | | | | | | | | | | Once upon a time, the MTD repository was using CVS. This patch therefore removes all usages of the no longer updated CVS keywords from the MTD code. This also includes code that printed them to the user. Signed-off-by: Adrian Bunk <bunk@kernel.org> Signed-off-by: David Woodhouse <dwmw2@infradead.org>
* [MTD] [NAND] nandsim: allow for 64-bit sizeAdrian Hunter2008-06-041-14/+21
| | | | | | | Amend nandsim so that it does not assume 32-bit flash size. Signed-off-by: Adrian Hunter <ext-adrian.hunter@nokia.com> Signed-off-by: David Woodhouse <dwmw2@infradead.org>
* [MTD] [NAND] nandsim: fix overridesizeAdrian Hunter2008-06-041-0/+1
| | | | | Signed-off-by: Adrian Hunter <ext-adrian.hunter@nokia.com> Signed-off-by: David Woodhouse <dwmw2@infradead.org>
* [MTD] [NAND] nandsim: fix size bugAdrian Hunter2008-06-041-1/+1
| | | | | Signed-off-by: Adrian Hunter <ext-adrian.hunter@nokia.com> Signed-off-by: David Woodhouse <dwmw2@infradead.org>
* drivers/mtd/: Spelling fixesJoe Perches2008-02-031-1/+1
| | | | | Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Adrian Bunk <bunk@kernel.org>
* [MTD] [NAND] nandsim: bugfix in initializationArtem Bityutskiy2007-10-201-1/+1
| | | | | | | | NAND of > 32MiB in size use 4 bytes in address cycle, not 3. Reported-by: bhsong <bhsong@augustatek.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com> Signed-off-by: David Woodhouse <dwmw2@infradead.org>
* [MTD] [NAND] nandsim: avoid deadlocking FSArtem Bityutskiy2007-09-061-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Make nandsim use GFP_NOFS when allocating memory, because it might be used by a file-system (e.g. UBIFS2) which means, if we are short of memory, we may deadlock. Indee, UBIFS is holding a lock, writes to the media, reaches this place in NANDsim, kmalloc does not find the requested amount of RAM, calls memory shrinker, which decides to writeback inodes, calls FS, and it deadlocks on the lock which is already being held. Below is the UBIFS backtrace which demonstrates that: [<c03717dc>] __mutex_lock_slowpath+0xc8/0x2e6 [<c0371a16>] mutex_lock+0x1c/0x1f [<f8b9d076>] reserve_space+0x3d/0xa9 [ubifs] [<f8b9d1bd>] make_one_reservation+0x2b/0x86 [ubifs] [<f8b9d3fc>] ubifs_jrn_write_block+0xda/0x12f [ubifs] [<f8b9ff3a>] ubifs_writepage+0x11d/0x1ec [ubifs] [<c015d6ab>] shrink_inactive_list+0x7fa/0x969 [<c015d8c8>] shrink_zone+0xae/0x10c [<c015e3b4>] try_to_free_pages+0x159/0x251 [<c015980a>] __alloc_pages+0x125/0x2f0 [<c016ff6a>] cache_alloc_refill+0x380/0x6ba [<c01703f3>] __kmalloc+0x14f/0x157 [<f885722a>] do_state_action+0xab7/0xc74 [nandsim] [<f885760c>] switch_state+0x225/0x402 [nandsim] [<f8857e7e>] ns_hwcontrol+0x3e2/0x620 [nandsim] [<f8862f53>] nand_command+0x2e/0x1a5 [nand] [<f8861ad8>] nand_write_page+0x4a/0x9a [nand] [<f88617b4>] nand_do_write_ops+0x1cf/0x343 [nand] [<f8861a70>] nand_write+0x88/0xa6 [nand] [<f8850b0e>] part_write+0x72/0x8b [mtd] [<f88e19c5>] ubi_io_write+0x189/0x29c [ubi] [<f88dfb98>] ubi_eba_write_leb+0xb6/0x699 [ubi] [<f88def93>] ubi_leb_write+0xe4/0xe9 [ubi] [<f8ba3b82>] ubifs_wbuf_write_nolock+0x333/0x4c9 [ubifs] [<f8b9d28c>] write_node+0x74/0x8e [ubifs] [<f8b9d422>] ubifs_jrn_write_block+0x100/0x12f [ubifs] [<f8b9ff3a>] ubifs_writepage+0x11d/0x1ec [ubifs] [<c0159e5b>] __writepage+0xb/0x26 [<c015a318>] write_cache_pages+0x203/0x2d9 [<c015a411>] generic_writepages+0x23/0x2d [<c015a452>] do_writepages+0x37/0x39 [<c018e24a>] __writeback_single_inode+0x96/0x399 [<c018e903>] sync_sb_inodes+0x1a3/0x274 [<c018ebf3>] writeback_inodes+0xa6/0xd8 [<c015a9dd>] background_writeout+0x86/0x9e [<c015ae9c>] pdflush+0xfb/0x1b6 [<c01387d7>] kthread+0x37/0x59 [<c0104dc3>] kernel_thread_helper+0x7/0x14 The deadlock is funny because it starts in pdflush/writeback, and comes back to writeback, then deadlocks. It seems we should look carefully for other places in UBI and MTD and use GFP_NOFS instead of GFP_KERNEL. Caught-by: Adrian Hunter <ext-adrian.hunter@nokia.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com> Signed-off-by: David Woodhouse <dwmw2@infradead.org>
* [MTD] nandsim: enhance nandsim to allow arbitrary NAND sizeAdrian Hunter2007-04-171-1/+20
| | | | | | | | | | | | A new module parameter has been added called 'overridesize', which overrides the size that would be determined by the ID bytes. 'overridesize' is specified in erase blocks and as the exponent of a power of two e.g. 5 means a size of 32 erase blocks. Signed-off-by: Adrian Hunter <ext-adrian.hunter@nokia.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com> Signed-off-by: David Woodhouse <dwmw2@infradead.org>
* [MTD] nandsim: Enhance nandsim optionally to report wear informationAdrian Hunter2007-04-171-0/+99
| | | | | | | | | A new module parameter 'rptwear' specifies how many erases between reporting wear information. Zero means never. Signed-off-by: Adrian Hunter <ext-adrian.hunter@nokia.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com> Signed-off-by: David Woodhouse <dwmw2@infradead.org>
* [MTD] nandsim: enhance nandsim to simulate flash errorsAdrian Hunter2007-04-171-1/+300
| | | | | | | | | | | | | | | | | | New module parameters have been added to nandsim to simulate: bitflips random bit flips badblocks blocks that are initially marked bad weakblocks blocks that fail to erase after a small number of erase cycles weakpages pages that fail to write after a small number of successful writes gravepages pages that fail to read after a small number of successful reads Signed-off-by: Adrian Hunter <ext-adrian.hunter@nokia.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com> Signed-off-by: David Woodhouse <dwmw2@infradead.org>
* [MTD] nandsim: add partition capability to nandsimAdrian Hunter2007-04-171-24/+73
| | | | | | | | | | Enhance nandsim to be able to create more than 1 partition. A new module parameter 'parts' may be used to specify partition sizes. Signed-off-by: Adrian Hunter <ext-adrian.hunter@nokia.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com> Signed-off-by: David Woodhouse <dwmw2@infradead.org>
* [MTD] nandsim: bugfix in page addressingArtem Bityutskiy2006-12-081-2/+2
| | | | | | | Number of address bytes for 64-128 MiB NANDs is 4, not 5. Signed-off-by: Artem Bityutskiy <dedekind@infradead.org> Signed-off-by: David Woodhouse <dwmw2@infradead.org>
* [MTD] replace kmalloc+memset with kzallocBurman Yan2006-11-281-3/+1
| | | | | Signed-off-by: Yan Burman <yan_952@hotmail.com> Signed-off-by: David Woodhouse <dwmw2@infradead.org>
* [MTD] NAND: nandsim: support subpage writeArtem Bityutskiy2006-10-211-1/+3
| | | | | | | | As flash cannot do 0->1 bit transitions when programming, do not do this in the simulator too. This makes nandsim able to accept subpage writes. Signed-off-by: Artem Bityutskiy <dedekind@infradead.org> Signed-off-by: David Woodhouse <dwmw2@infradead.org>
* [MTD] NAND: nandsim coding style fixVijay Kumar2006-10-211-38/+19
| | | | | | | | Removes line break after return type in function definitions, to be consistent with the Linux coding style. Signed-off-by: Vijay Kumar <vijaykumar@bravegnu.org> Signed-off-by: David Woodhouse <dwmw2@infradead.org>
* [MTD] NAND: nandsim page-wise allocation (2/2)Vijay Kumar2006-10-211-24/+138
| | | | | | | | | | For page wise allocation, an array of flash page pointers is allocated during initialization. The flash pages are themselves allocated when a write occurs to the page. The flash pages are deallocated when they are erased. Signed-off-by: Vijay Kumar <vijaykumar@bravegnu.org> Signed-off-by: David Woodhouse <dwmw2@infradead.org>
* [MTD] NAND: nandsim page-wise allocation (1/2)Vijay Kumar2006-10-211-22/+0
| | | | | | | | This patch removes code that does chip mapping. The chip mapping code is no longer used. Signed-off-by: Vijay Kumar <vijaykumar@bravegnu.org> Signed-off-by: David Woodhouse <dwmw2@infradead.org>
* Remove obsolete #include <linux/config.h>Jörn Engel2006-06-301-1/+0
| | | | | Signed-off-by: Jörn Engel <joern@wohnheim.fh-wedel.de> Signed-off-by: Adrian Bunk <bunk@stusta.de>
* [MTD] NAND remove write_byte/word function from nand_chipThomas Gleixner2006-05-231-13/+0
| | | | | | | | The previous change of the command / hardware control allows to remove the write_byte/word functions completely, as their only user were nand_command and nand_command_lp. Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
* [MTD] Refactor NAND hwcontrol to cmd_ctrlThomas Gleixner2006-05-231-63/+13
| | | | | | | | | | | | The hwcontrol function enforced a step by step state machine for any kind of hardware chip access. Let the hardware driver know which control bits are set and inform it about a change of the control lines. Let the hardware driver write out the command and address bytes directly. This gives a peformance advantage for address bus controlled chips and simplifies the quirks in the hardware drivers. Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
* Merge branch 'master' of /home/tglx/work/kernel/git/mtd-2.6/Thomas Gleixner2006-05-231-1/+1
|\ | | | | | | Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
| * [MTD] Introduce writesizeJoern Engel2006-05-221-1/+1
| | | | | | | | | | | | | | | | At least two flashes exists that have the concept of a minimum write unit, similar to NAND pages, but no other NAND characteristics. Therefore, rename the minimum write unit to "writesize" for all flashes, including NAND. Signed-off-by: Joern Engel <joern@wh.fh-wedel.de>
* | [MTD] NAND modularize ECCThomas Gleixner2006-05-231-1/+1
|/ | | | | | | | First step of modularizing ECC support. - Move ECC related functionality into a seperate embedded data structure - Get rid of the hardware dependend constants to simplify new ECC models Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
* [MTD] Fix module refcounting in NAND board drivers.David Woodhouse2006-05-141-0/+2
| | | | | | | | | The _board_ driver needs to be mtd->owner, and it in turn pins the nand.ko module. Fix them all to actually do that, and fix nand.ko not to overwrite it -- and also to check that the caller sets it, if the caller is a module. Signed-off-by: David Woodhouse <dwmw2@infradead.org>
* [MTD] Make functions static, include header files with prototypesAdrian Bunk2005-11-291-1/+1
| | | | | | | | | | | This patch contains the following possible cleanups: - every file should #include the headers containing the prototypes for it's global functions - make needlessly global functions static Signed-off-by: Adrian Bunk <bunk@stusta.de> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
* [MTD] NAND: Clean up trailing white spacesThomas Gleixner2005-11-071-81/+81
| | | | Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
* [MTD] NAND nandsim: Use NAND_SKIP_BBT optionArtem B. Bityuckiy2005-05-231-29/+12
| | | | | | | | Use the new NAND_SKIP_BBT option instead of defining a fake scan_bbt handler. Signed-off-by: Artem B. Bityuckiy <dedekind@infradead.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
* Linux-2.6.12-rc2v2.6.12-rc2Linus Torvalds2005-04-161-0/+1613
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!
OpenPOWER on IntegriCloud