Commit Graph

782 Commits

Author SHA1 Message Date
Kyungmin Park 1437085c37 [MTD] [OneNAND] Fix typo related with recent commit
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-10-13 11:26:44 +01:00
David Woodhouse 49defc015f [MTD] [NAND] Avoid deadlock in erase callback; release chip lock first.
When the erase callback performs some other action on the flash, it's
highly likely to deadlock unless we actually release the chip lock
before calling it.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-10-06 15:01:59 -04:00
David Woodhouse 1fcf8ce51e [MTD] [NAND] Resume method for CAFÉ NAND controller
Originally from Marcelo; modified to put the original timing registers
back instead of 0xFFFFFFFF.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-10-06 14:59:32 -04:00
David Woodhouse 06ed24e577 [MTD] [NAND] Fix PCI ident table for CAFÉ NAND controller.
It was only the very early prototypes which made the mistake of using
the same device ident for all three functions on the device -- don't
bother trying to express that in the PCI match table, since the tools
don't cope. We can check in the probe routine instead, just in case.
Also remember to terminate the table.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-10-06 14:44:12 -04:00
David Woodhouse 39fd179a7b Merge branch 'master' of ssh://git.infradead.org/srv/git/mtd-2.6 2007-10-06 13:22:26 -04:00
Ben Dooks b7a7018518 [MTD] [NAND] s3c2410: fix arch moves
Fixup the includes which have been moved around
when changing the s3c24xx arch support.

Signed-off-by: Ben Dooks <ben-linux@fluff.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-09-25 16:44:24 +01:00
Artem Bityutskiy 49dc08eeda [MTD] [OneNAND] fix numerous races
This patch make the OneNAND driver much less racy. It fixes
our "onenand_wait: read timeout!" heisenbugs. The reason of
these bugs was that the driver did not lock the chip when
accessing OTP, and it screwed up OneNAND state when the OTP
was read while JFFS2 was doing FS checking.

This patch also fixes other races I spotted:
1. BBT was not protected
2. Access to ecc_stats was not protected

Now the chip is locked when BBT is accessed.

To fix all of these I basically split all interface functions
on 'function()' and 'function_nolock()' parts.

I tested this patch on N800 hardware - it fixes our problems.
But I tested a little different version because our OneNAND
codebase is slightly out-of-date. But it should be OK.

This patch also includes the prin fixes I posted before.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-09-23 19:58:52 +01:00
David Woodhouse 0bac5111cc [MTD] map driver for NOR flash on the Intel Vermilion Range chipset
The Vermilion Range Expansion Bus supports four chip selects, each of which
has 64MiB of address space.  The 2nd BAR of the Expansion Bus PCI Device
is a 256MiB memory region containing the address spaces for all four of
the chip selects, with start addresses hardcoded on 64MiB boundaries.

This map driver only supports NOR flash on chip select 0.  The buswidth
(either 8 bits or 16 bits) is determined by reading the Expansion Bus Timing
and Control Register for Chip Select 0 (EXP_TIMING_CS0).

Signed-off-by: Andy Lowe <alowe@mvista.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-09-23 18:51:25 +01:00
Andy Lowe 097f2576eb [MTD] fix CFI point method for discontiguous maps
The CFI probe routine is capable of detecting flash banks consisting of
identical chips mapped to physically discontiguous addresses.  (One
common way this can occur is if a flash bank is populated with chips of
less capacity than the hardware was designed to support.)  The CFI
point() routine currently ignores any such gaps.  This patch fixes
the CFI point() routine so that it truncates any request that would
span a gap.

Signed-off-by: Andy Lowe <alowe@mvista.com>
Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-09-23 18:40:49 +01:00
Todd Poynor e644f7d628 [MTD] MAPS: Merge Lubbock and Mainstone drivers into common PXA2xx driver
Replace Lubbock and Mainstone board drivers with common PXA2xx driver,
convert to platform driver (corresponding platform device changes merged
to kernel.org for 2.6.15), add power management callbacks.

Signed-off-by: Todd Poynor <tpoynor@mvista.com>
Signed-off-by: Nicolas Pitre <npitre@mvista.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-09-23 18:40:14 +01:00
Yoichi Yuasa 5041f1f1b7 [MTD] Remove Momenco Ocelot NOR flash support
This patch has removed Momenco Ocelot support from MTD.
Ocelot support has already removed.

Signed-off-by: Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-09-09 17:17:46 +01:00
Artem Bityutskiy 98b830d260 [MTD] [NAND] nandsim: avoid deadlocking FS
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>
2007-09-06 10:16:22 +01:00
Kyungmin Park d15057b703 [MTD] [OneNAND] main read/write ops support for yaffs2
Now we can use yaffs2 on OneNAND

Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-09-06 09:27:03 +01:00
Kyungmin Park 12f77c9eed [MTD] [OneNAND] Use mtd_oob_ops at oob functions
To enable the main read/write at oob ops

Next time we will commit the main read/write support for yaffs2

Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-08-30 01:46:28 +01:00
Jörn Engel e208520ed6 [MTD] [NAND] Driver for Olympus MAUSB-10 and Fujifilm DPC-R1 card readers
Unlike most stuff on the market the chip inside these two allows raw
flash access and doesn't implement and FTL, leaving that functionality
to the device driver.

Raw flash access in a cheap USB cardreader!  An MTD test device one can
attach to a PC!  What a deal!

The command set of the chip is not documented, so information was
obtained from the existing mass-storage driver
(drivers/usb/storage/alauda.c), its documentation
(http://alauda.sourceforge.net/wikka.php?wakka=BulkCommandReference),
additional reverse engineering and comparison with a vendor driver for a
related chip
(http://www.ratocsystems.com/english/download/driver/linux/sma03u.html).

Signed-off-by: Joern Engel <joern@logfs.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-08-29 17:37:23 +01:00
David Woodhouse 62d24d9110 Merge branch 'mtd-2.6.24' of master.kernel.org:/pub/scm/linux/kernel/git/galak/powerpc 2007-08-23 10:44:17 +01:00
David Woodhouse ac0c955d50 Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6 2007-08-23 10:43:14 +01:00
Kumar Gala 34a27ffdf5 [MTD] Remove dead maps
The tqm834x map Kconfig options depends on TQM834x which does not
exist anywhere else in the kernel.

The pq2fads map Kconfig/makefile support was removed a while ago but
the actual file persisted.

Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
2007-08-22 22:57:54 -05:00
Josh Boyer 3feb0ff160 [MTD] 4xx: Don't build arch/ppc dependent drivers in arch/powerpc
These drivers are specific to 4xx support in arch/ppc at the moment.  Make
sure they don't get built on arch/powerpc.

Signed-off-by: Josh Boyer <jwboyer@linux.vnet.ibm.com>
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
2007-08-22 22:50:54 -05:00
Andrew Morton 68d09b1b67 [MTD] mtdoops printk warning fixes
drivers/mtd/mtdoops.c: In function 'mtdoops_inc_counter':
drivers/mtd/mtdoops.c:109: warning: format '%d' expects type 'int', but argument 3 has type 'size_t'
drivers/mtd/mtdoops.c: In function 'mtdoops_console_sync':
drivers/mtd/mtdoops.c:277: warning: format '%d' expects type 'int', but argument 3 has type 'size_t'

someone buy Dave an x86_64 box.

Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-08-22 12:43:13 +01:00
Andrew Morton 0c1eafdb06 mtdchar build fix
sh:

drivers/mtd/mtdchar.c: In function `mtd_mmap':
drivers/mtd/mtdchar.c:817: error: dereferencing pointer to incomplete type
drivers/mtd/mtdchar.c:817: error: `VM_SHARED' undeclared (first use in this function)
drivers/mtd/mtdchar.c:817: error: (Each undeclared identifier is reported only once

Cc: David Woodhouse <dwmw2@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-08-11 15:47:41 -07:00
David Woodhouse 471f717a48 Revert "[MTD] Driver for AT26Fxxx dataflash devices"
This reverts commit 340ea370c2.

It's not needed given the other m25p80 patch (which now handles
at26 "dataflash" as well as most other standard SPI flash chips),
and requires a controller driver that won't be merged upstream
(supplanted by drivers/spi/atmel_spi.c) ... the submitter of
that at91_dataflash26.c driver concurred.

Requested by David Brownell <david-b@pacbell.net>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-08-03 23:02:02 +01:00
Satyam Sharma bec4947756 [MTD] Makefile fix for mtdsuper
We want drivers/mtd/{mtdcore, mtdsuper, mtdpart}.c to be built and linked
into the same mtd.ko module. Fix the Makefile to ensure this, and remove
duplicate MODULE_ declarations in mtdpart.c, as mtdcore.c already has them.

Signed-off-by: Satyam Sharma <satyam@infradead.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-08-03 12:42:40 +01:00
Ben Dooks 515495a1da [MTD] [NAND] nand_base.c: fix type of eccpos pointer
The nand_base.c driver implicitly casts the uint32_t
eccpos array to 'int *', which is not only not guaranteed
to be the same sign as the source, but is not guaranteed
to be the same size.

Fix by changing nand_base.c to use uint32_t
referencing the eccpos fields.

Signed-off-by: Ben Dooks <ben-linux@fluff.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-08-02 21:47:01 +01:00
Ivan Kuten a4265f8d92 [MTD] [NAND] at91_nand rdy_pin fix
The patch below fixes nand driver for AT91 boards which do not have NAND
R/B signal connected to gpio (rdy_pin is not connected).

Signed-off-by: Ivan Kuten <ivan.kuten@promwad.com>
Acked-by: Andrew Victor <andrew@sanpeople.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-08-02 21:46:48 +01:00
Artem Bityutskiy 06a7643cd3 [MTD] [NAND] fix race in nand_base.c
When we mark block bad we have to get chip because this involves
writing to the page's OOB. We hit this bug in UBI - we observed
random obscure crashes when it marks block bad from the background
thread and there is some parallel task which utilizes flash.

This patch also adds a TODO note about BBT table protection which
it seems does not exist.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-08-02 21:46:21 +01:00
Roland Stigge 9d7b4b5562 [MTD] [NAND] Fix refactoring of EDB7312 hwcontrol function.
The patch ensures that the current code (kernel 2.6.22) uses the bits
like the code prior to the refactoring. The variable "bits" is employed
in a useful way now.

Signed-off-by: Roland Stigge <stigge@antcom.de>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-08-02 21:46:07 +01:00
Florin Malita 47af05dd4b [MTD] Fix potential leak in rfd_ftl_add_mtd
This fixes a leak in the !mtd->erasesize error path (Coverity 1765).

Signed-off-by: Florin Malita <fmalita@gmail.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-08-02 21:44:10 +01:00
David Woodhouse 440fdb53b4 Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6 2007-08-01 11:23:57 +01:00
maximilian attems 8b2b403ce0 [MTD] [NAND] nand_base.c fix broken link
replace with working link from nand Kconfig help text
fixes bugzilla 7815

Signed-off-by: maximilian attems <max@stro.at>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-08-01 11:12:21 +01:00
Adrian Bunk 73ff007537 [MTD] [ONENAND] onenand_sim.c: make struct info static
This patch makes the needlessly global struct info static.

Signed-off-by: Adrian Bunk <bunk@stusta.de>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-08-01 11:04:26 +01:00
Mariusz Kozlowski d9b0744d6c [UBI] drivers/mtd/ubi/scan.c: kmalloc + memset conversion to kzalloc
To be able to convert kmalloc + memset(..., 1, ...) to kzalloc this patch
reverses the logic around 'buf'.

Signed-off-by: Mariusz Kozlowski <m.kozlowski@tuxland.pl>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-08-01 11:04:05 +01:00
Mariusz Kozlowski 4fb4caa639 [MTD] pmcmsp-flash.c: kmalloc + memset conversion to k[cz]alloc
Signed-off-by: Mariusz Kozlowski <m.kozlowski@tuxland.pl>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-08-01 11:03:35 +01:00
Mariusz Kozlowski d67d1d7fc3 [MTD] drivers/mtd/inftlmount.c: kmalloc + memset conversion to kcalloc
Signed-off-by: Mariusz Kozlowski <m.kozlowski@tuxland.pl>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-08-01 11:02:40 +01:00
Mariusz Kozlowski 8f0f23f97a [MTD] remove redundant/dead code from physmap_of.c
This patch removes redundant memset() and dead return line from
of_physmap_probe(). No functional change.

Signed-off-by: Mariusz Kozlowski <m.kozlowski@tuxland.pl>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-08-01 10:59:43 +01:00
Ralf Baechle 0b0ef2ea00 [MIPS] Remove Momentum Ocelot support.
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
2007-07-31 21:35:29 +01:00
Al Viro e0e5de00b0 sun userflash is PCI-dependent
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-07-26 11:11:56 -07:00
Artem Bityutskiy c0b8ba7bfe [MTD] [NAND] fix race in nand_base.c
When we mark block bad we have to get chip because this involves
writing to the page's OOB. We hit this bug in UBI - we observed
random obscure crashes when it marks block bad from the background
thread and there is some parallel task which utilizes flash.

This patch also adds a TODO note about BBT table protection which
it seems does not exist.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-07-23 13:09:52 +01:00
David Woodhouse 0bf9733d0d [MTD] Fix do_div() type warning in mtdconcat
It expects a uint64_t; give it one.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-07-23 13:07:06 +01:00
Robert P. J. Day e733450b67 [MTD] Remove useless references to MIPS_HYDROGEN3 and MIPS_MIRAGE_WHY.
Signed-off-by: Robert P. J. Day <rpjday@mindspring.com>
Acked-by: Ralf Baechle <ralf@linux-mips.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-07-23 12:50:51 +01:00
Roland Stigge 4a32cfa0f5 [MTD] [NAND] Fix refactoring of EDB7312 hwcontrol function.
The patch ensures that the current code (kernel 2.6.22) uses the bits 
like the code prior to the refactoring. The variable "bits" is employed 
in a useful way now.

Signed-off-by: Roland Stigge <stigge@antcom.de>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-07-23 12:49:13 +01:00
akpm@linux-foundation.org 030f9e13be [MTD] Remove embedded return in RFD FTL.
embedded returns are evil.

Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-07-23 12:06:52 +01:00
Florin Malita 1050643431 [MTD] Fix potential leak in rfd_ftl_add_mtd
This fixes a leak in the !mtd->erasesize error path (Coverity 1765).

Signed-off-by: Florin Malita <fmalita@gmail.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-07-23 12:05:07 +01:00
Jesper Juhl 4cfff0db3a [MTD] Clean up duplicate includes in drivers/mtd/
This patch cleans up duplicate includes in
	drivers/mtd/

Signed-off-by: Jesper Juhl <jesper.juhl@gmail.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-07-23 11:56:27 +01:00
Steven J. Hill 30eb0db07d [MTD] [NAND] Add NAND manufacturer AMD.
This patch adds the manufacturer ID for AMD flash.

Signed-off-by: Steven J. Hill <sjhill1@rockwellcollins.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-07-23 11:51:53 +01:00
David Woodhouse 39fe5434cb Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6 2007-07-23 10:20:10 +01:00
Paul Mundt 20c2df83d2 mm: Remove slab destructors from kmem_cache_create().
Slab destructors were no longer supported after Christoph's
c59def9f22 change. They've been
BUGs for both slab and slub, and slob never supported them
either.

This rips out support for the dtor pointer from kmem_cache_create()
completely and fixes up every single callsite in the kernel (there were
about 224, not including the slab allocator definitions themselves,
or the documentation references).

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2007-07-20 10:11:58 +09:00
Paul Mundt add0b43ca6 UBI: fix compile warning
cdev.c whines in current git:

drivers/mtd/ubi/cdev.c: In function `major_to_device':
drivers/mtd/ubi/cdev.c:67: warning: control reaches end of non-void function

Shut it up.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2007-07-18 16:59:17 +03:00
Artem Bityutskiy 784c145444 UBI: fix error handling in erase worker
Do not switch to read-only mode in case of -EINTR and some
other obvious cases. Switch to RO mode only when we do not
know what is the error.

Reported-by: Vinit Agnihotri <vinit.agnihotri@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2007-07-18 16:59:09 +03:00
Artem Bityutskiy 63b6c1ed56 UBI: fix comments
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2007-07-18 16:59:01 +03:00