Commit Graph

1304 Commits (5b31f855f10d0053e738baa6d91fb6a3fad35119)

Author SHA1 Message Date
Chris Malley 71a928c0e5 [MTD] Use list_for_each_entry[_safe] where appropriate.
Janitorial work to remove temporary pointers and make some functions a bit
more readable.

Signed-off-by: Chris Malley <mail@chrismalley.co.uk>
Reviewed-By: Jörn Engel <joern@logfs.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2008-06-04 17:53:31 +01:00
Adrian Bunk 59018b6d2a MTD/JFFS2: remove CVS keywords
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>
2008-06-04 17:50:17 +01:00
Adrian Hunter 6eda7a55f7 [MTD] [NAND] nandsim: allow for 64-bit size
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>
2008-06-04 17:47:52 +01:00
Adrian Hunter 07293b2008 [MTD] [NAND] nandsim: fix overridesize
Signed-off-by: Adrian Hunter <ext-adrian.hunter@nokia.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2008-06-04 17:47:43 +01:00
Adrian Hunter af3deccfa6 [MTD] [NAND] nandsim: fix size bug
Signed-off-by: Adrian Hunter <ext-adrian.hunter@nokia.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2008-06-04 17:47:35 +01:00
Kyungmin Park 83973b8793 [MTD] [OneNAND] Check the ECC status first instead of controller
To get the correct information in case of power off recovery,
it should read ECC status first
Also remove previous workaround method.

Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2008-06-04 17:45:39 +01:00
David Woodhouse 271c5c59e0 [MTD] DataFlash: use proper types
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2008-06-04 17:43:22 +01:00
Michael Hennerich e9d42227bd [MTD] DataFlash: fix bug - ATMEL AT45DF321D spi flash card fails to be copied to (v2)
- Add support for binary page size DataFlashes.
 - The driver now prints out pagesize and erasesize.
   Printout valuable information for creating flash filesystems.

Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
Cc: David Brownell <david-b@pacbell.net>
Signed-off-by: Bryan Wu <cooloney@kernel.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2008-06-04 17:39:38 +01:00
Eric Miao 9b62d86431 [MTD] [NAND] pxa: fix incorrect calling of pxa3xx_nand_config() on resume path
Signed-off-by: Eric Miao <eric.miao@marvell.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2008-06-04 17:37:25 +01:00
matthias@kaehlcke.net 856613c98c [MTD] use list_for_each_entry() in del_mtd_device()
Signed-off-by: Matthias Kaehlcke <matthias@kaehlcke.net>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2008-06-04 17:34:48 +01:00
matthias@kaehlcke.net 2606c79759 [MTD] use list_for_each_entry() in add_mtd_device()
Signed-off-by: Matthias Kaehlcke <matthias@kaehlcke.net>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2008-06-04 17:34:39 +01:00
Robert P. J. Day ff0de61c36 [MTD] [NAND] excite_nandflash: simplify code using ARRAY_SIZE() macro.
Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2008-06-04 17:28:03 +01:00
Toralf Förster 437d0d299f [MTD] [NAND] fix 2 "unused variable" warnings in cafe_nand.c
Signed-off-by: Toralf Förster <toralf.foerster@gmx.de>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2008-06-04 17:27:20 +01:00
Mike Rapoport 1b0b30acf3 [MTD] [NOR] Add support for Eon EN29SL800B[BT] NOR flash chips
This patch add support for non-CFI Eon EN29SL800B[BT] NOR flash chips.
The Eon chips have manufacturer ID in the first bank, therefore this patch
depends on support for flash chips with ID in bank other than 0.

Signed-off-by: Mike Rapoport <mike@compulab.co.il>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2008-06-04 17:23:12 +01:00
Mike Rapoport 5c9c11e1c4 [MTD] [NOR] Add support for flash chips with ID in bank other than 0
According to JEDEC "Standard Manufacturer's Identification Code"
(http://www.jedec.org/download/search/jep106W.pdf)
several first banks of NOR flash can contain 0x7f instead of actual ID.
This patch adds support for reading manufacturer ID from banks other than 0.

Signed-off-by: Mike Rapoport <mike@compulab.co.il>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2008-06-04 17:22:59 +01:00
Mike Rapoport 8fd310a1cc [MTD] [NOR] Add support for AMD AM29SL800D[BT] NOR flash chips
Signed-off-by: Mike Rapoport <mike@compulab.co.il>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2008-06-04 17:20:48 +01:00
David Woodhouse edb2301f29 ck804rom: fix driver_data in probe table.
There's a reason why using C99 initialisers even in the supposedly
trivial structs is a good idea.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-05-27 07:34:38 -07:00
Nate Case deb1a5f113 [MTD] [NOR] Support for M50FLW080A and M50FLW080B
Add support for M50FLW080A and M50FLW080B revisions of LPC flash
devices.

Signed-off-by: Aaron Lindner <alindner@xes-inc.com>
Signed-off-by: Nate Case <ncase@xes-inc.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2008-05-14 11:03:46 +01:00
Paul Mundt e35e283fa0 mtd: solutionengine flash map depends on solution engine mach group.
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-05-08 19:51:40 +09:00
Adrian Bunk f5f826c685 sh: remove the broken SH_MPC1211 support
SH_MPC1211 has been marked as BROKEN for some time.

Unless someone is working on reviving it now, I'd therefore suggest this
patch to remove it.

Signed-off-by: Adrian Bunk <bunk@kernel.org>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2008-05-08 19:51:39 +09:00
Alexander Belyakov 91949d6454 [MTD] [NOR] Remove cfi_cmdset_0001.c erase suspend fixup typo
Fix typo in erase suspend while write fixup code leading to compile time 
error if CMDSET0001_DISABLE_ERASE_SUSPEND_ON_WRITE was defined.

drivers/mtd/chips/cfi_cmdset_0001.c: In function 'fixup_intel_strataflash':
drivers/mtd/chips/cfi_cmdset_0001.c:212: error: 'struct cfi_pri_amdstd' has no member named 'SuspendCmdSupport'

Signed-off-by: Alexander Belyakov <abelyako@googlemail.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2008-05-06 15:49:21 +01:00
Linus Torvalds 2c4aabcca8 Merge git://git.infradead.org/mtd-2.6
* git://git.infradead.org/mtd-2.6:
  [MTD][NOR] Add physical address to point() method
  [JFFS2] Track parent inode for directories (for NFS export)
  [JFFS2] Invert last argument of jffs2_gc_fetch_inode(), make it boolean.
  [JFFS2] Quiet lockdep false positive.
  [JFFS2] Clean up jffs2_alloc_inode() and jffs2_i_init_once()
  [MTD] Delete long-unused jedec.h header file.
  [MTD] [NAND] at91_nand: use at91_nand_{en,dis}able consistently.
2008-05-01 11:15:28 -07:00
Jared Hulbert a98889f3d8 [MTD][NOR] Add physical address to point() method
Adding the ability to get a physical address from point() in addition
to virtual address.  This physical address is required for XIP of
userspace code from flash.

Signed-off-by: Jared Hulbert <jaredeh@gmail.com>
Reviewed-by: Jörn Engel <joern@logfs.org>
Acked-by: Nicolas Pitre <nico@cam.org>
Acked-by: Greg Ungerer <gerg@uclinux.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2008-05-01 18:59:11 +01:00
Harvey Harrison a01e035ebb drivers: fix integer as NULL pointer warnings
Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-04-28 17:31:13 -07:00
Atsushi Nemoto 8136508cd6 [MTD] [NAND] at91_nand: use at91_nand_{en,dis}able consistently.
Use at91_nand_enable(), at91_nand_disable() to manipulate enable_pin.
No functional changes.

Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2008-04-26 18:41:16 +01:00
Michael Hennerich 3887ed5231 [MTD] m25p80: Add Support for ATMEL AT25DF641 64-Megabit SPI Flash
Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Bryan Wu <cooloney@kernel.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2008-04-25 09:14:23 +01:00
Bryan Wu 2230b76b38 [MTD] m25p80: add FAST_READ access support to M25Pxx
Signed-off-by: Bryan Wu <cooloney@kernel.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2008-04-25 09:13:52 +01:00
Michael Hennerich afc4bca639 [MTD] [NAND] bf5xx_nand: Avoid crash if bfin_mac is installed.
http://blackfin.uclinux.org/gf/project/uclinux-dist/tracker/?action=TrackerItemEdit&tracker_item_id=4053

Singed-off-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Bryan Wu <cooloney@kernel.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2008-04-25 09:10:55 +01:00
Atsushi Nemoto 2314488e81 [MTD] [NAND] at91_nand: control NCE signal
This driver did not control NCE signal during normal operations (only
enable NCE on probing and disable NCE on removing).  This patch make
NCE signal inactive on idle state.

Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2008-04-25 09:08:05 +01:00
Richard Genoud d43fa14996 [MTD] [NAND] AT91 hardware ECC compile fix for at91sam9263 / at91sam9260
The sam926x docs allegedly don't list an "ECC_PARITY" field, and the 
header files in the upstream kernel don't have it either.

Masking with it was useless anyway, so just remove it.

Signed-off-by: Richard Genoud <richard.genoud@gmail.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2008-04-25 08:38:56 +01:00
Richard Genoud 77f5492c43 [MTD] [NAND] Hardware ECC controller on at91sam9263 / at91sam9260
This is a patch to use the hardware ECC controller of
the AT91SAM9260 and AT91SAM9263 for the AT91 nand.
On AT91 NAND, there's now a choice between ECC soft,
ECC hard or no ECC (for debug).

It has been tested on AT91SAM9263 with 8 bits large
and small page NAND.

Signed-off-by: Richard Genoud <richard.genoud@gmail.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2008-04-23 23:34:28 +01:00
Artem Bityutskiy 697fa9721c UBI: add a message
UBI scan takes quite a time on some systems, so it is nice
to print a message that we started attaching an MTD device.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2008-04-23 11:32:10 +01:00
David Woodhouse e43fe686e4 Merge git://git.infradead.org/~dedekind/ubi-2.6 2008-04-23 09:57:25 +01:00
David Woodhouse 986ee0139a [MTD] Clean up AR7 partition map support
drivers/mtd/ar7part.c: In function ‘create_mtd_partitions’:
drivers/mtd/ar7part.c:69: warning: passing argument 4 of ‘master->read’ from incompatible pointer type
drivers/mtd/ar7part.c:91: warning: passing argument 4 of ‘master->read’ from incompatible pointer type
drivers/mtd/ar7part.c:99: warning: passing argument 4 of ‘master->read’ from incompatible pointer type
drivers/mtd/ar7part.c:110: warning: passing argument 4 of ‘master->read’ from incompatible pointer type
drivers/mtd/ar7part.c:111: error: ‘SQUASHFS_MAGIC’ undeclared (first use in this function)
drivers/mtd/ar7part.c:111: error: (Each undeclared identifier is reported only once
drivers/mtd/ar7part.c:111: error: for each function it appears in.)

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2008-04-23 09:39:49 +01:00
Thomas Kunze fe224668df [MTD] [NOR] Fix Intel CFI driver for collie flash
collie seems to contain LH28F640BF flash chips. According to
http://sharp-world.com/products/device/flash/pdf/*FUM00701*@E.pdf
(page 83) if they have 0x51 of Extended Query Table (number of hardware
partitions) set to zero, they have a single fixed partition.
This patch makes those chips work.

Signed-off-by: Thomas Kunze <thommycheck@gmx.de>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2008-04-23 01:32:12 +01:00
Ben Dooks ed8165c75e [MTD] [NAND] Verify probe by retrying to checking the results match
With modern systems using bus-hold instead of bus pull-up, it can
often lead to erroneous reporting of NAND devices where there are
none. Do a double probe to ensure that the result we got the first
time is repeatable, and if it is not then return that there is no
chip there.

Signed-off-by: Ben Dooks <ben-linux@fluff.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2008-04-22 21:43:06 +01:00
Ben Dooks 37e5ffa3f1 [MTD] [NAND] S3C2410 Allow ECC disable to be specified by the board
Add support to disable ECC checking for a given chip
when passed by the board via the platform data.

Signed-off-by: Ben Dooks <ben-linux@fluff.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2008-04-22 21:41:32 +01:00
Ben Dooks 1c21ab67b7 [MTD] [NAND] S3C2410 Allow ECC layout to be passed through platform data
Add support for the ECC layout to be passed via the
platform data specified by the board.

Signed-off-by: Ben Dooks <ben-linux@fluff.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2008-04-22 21:41:19 +01:00
Ben Dooks c45c6c6833 [MTD] [NAND] S3C2410 Allow unset ecc to be ignored for ecc correction
If a block's ecc field is all 0xff, then ignore the ECC
correction. This is for systems where some of the blocks,
such as the initial cramfs are written without ECC and
need to be loaded on start.

Signed-off-by: Ben Dooks <ben-linux@fluff.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2008-04-22 21:41:03 +01:00
Ben Dooks 71d54f3855 [MTD] [NAND] S3C2410 Large page NAND support
This adds support for using large page NAND devices
with the S3C24XX NAND controller. This also adds the
file Documentation/arm/Samsung-S3C24XX/NAND.txt to
describe the differences.

Signed-off-by: Ben Dooks <ben-linux@fluff.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2008-04-22 21:39:16 +01:00
Ben Dooks 0916083210 [MTD] [NAND] S3C2410 Fix previous nFCE suspend save patch
Commit 03680b1e00 incorrectly
was assuming S3C2410_NFCONF was being used to select the
NAND chip. Fix this error by ising the sel_reg.

Signed-off-by: Ben Dooks <ben-linux@fluff.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2008-04-22 21:32:23 +01:00
Adrian Hunter 67e5a28b35 [MTD] [OneNAND] Allow for controller errors when reading
A power loss while writing can result in a page becoming unreadable.  
When the device is mounted again, reading that page gives controller 
errors. Upper level software like JFFS2 treat -EIO as fatal, refusing to 
mount at all.  That means it is necessary to treat the error as an ECC 
error to allow recovery. Note that typically in this case, the 
eraseblock can still be erased and rewritten i.e. it has not become a 
bad block.

Signed-off-by: Adrian Hunter <ext-adrian.hunter@nokia.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2008-04-22 21:26:16 +01:00
David Brownell f1ebe4eba4 [MTD] [MAPS] omap_nor section fixes
Minor tweaks to omap_nor ... as with most platform drivers, its probe
and remove logic can (and should!) safely vanish in most configs.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2008-04-22 21:24:00 +01:00
Trent Piepho 70b072550a [MTD] [NOR] Fixup for incorrect CFI data in Spansion S29GL064/32N flash chips
This is a known erratum confirmed by Spansion.  I have an errata document,
but I can't find a link to it anywhere on their site to include here.

Some of the S29GL064N chips report 64 sectors when they should report 128,
and some of S29GL032N chips report 127 sectors when they should report 63.

Note that when the chip dies are fixed by Spansion, they will still have
the same id.  The fix is done in such a way that it won't affect corrected
chips.

The fixups use the extended id made available by a previous patch.  Without
that, virtually all newer AMD/Spansion chips will have the same ID (0x227e)
and it's not possible to apply the fixup to the correct chips.

Signed-off-by: Trent Piepho <tpiepho@freescale.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2008-04-22 21:17:27 +01:00
Trent Piepho fecb8865de [MTD] [NOR] Read extended device ID from AMD/Spansion CFI flash chips
AMD/Spansion use a device id of 0x7e to indicate an extended device is
present at offset 0xe and 0xf in the query data.

I've verified with Spansion that all their chips (mfr == 0x01) with an id
of 0x7e use it to indicate an extended id is present.  What's more, there
are no chips with a NON-extended id that is the same as a different chip's
extended id.  In other words, when the extended ID is present, one can
replace the normal id with the extended id without losing any information.
Which is what I've done.

Signed-off-by: Trent Piepho <tpiepho@freescale.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2008-04-22 21:16:09 +01:00
Anton Vorontsov 0ff6631be1 [MTD] [NAND] fsl_elbc_nand: workaround for hangs during nand write
Using current driver elbc sometimes hangs during nand write. Reading back
last byte helps though (thanks to Scott Wood for the idea).

Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
Acked-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2008-04-22 21:13:53 +01:00
Hamish Moffatt 93919d384d [MTD] [NAND] plat_nand: set mtd->name
This patch sets mtd->name to the platform bus ID in the plat_nand
driver, so that you can specify partitions readily with mtdparts=.

Currently it relies on nand_base filling in the name from the device,
which results in names like "NAND 256MiB 3,3V 8-bit", that you can't
use with cmdlineparts.

Signed-off-by: Hamish Moffatt <hamish@cloud.net.au>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2008-04-22 21:11:54 +01:00
Mike Hench 1938de46cb [MTD] [NAND] corrected MPC8313 NAND fixes
Fix a race condition in fsl_elbc_run_command
Fix incorrect usage of clearbits32 that bashed option register
Remove work around for bashed register

Signed-off-by: Mike Hench <mhench@elutions.com>
Acked-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2008-04-22 20:52:09 +01:00
Anton Vorontsov 9ebed3e60f [MTD] [NAND] fsl_elbc_nand: fix mtd name
Currently fsl_elbc_nand doesn't initialize mtd->name, and this causes
nand_get_flash_type() to assign name that is equal to chip type, like
this:

   root@b1:~# cat /proc/mtd
   dev:    size   erasesize  name
   mtd0: 00800000 00010000 "fe000000.flash"
   mtd1: 02000000 00004000 "NAND 32MiB 3,3V 8-bit"

mtd0 is physmap_of flash (normal name), and mtd1 is fsl_elbc_nand.

Despite inconsistency, with mtd name like this specifying paritions
from the kernel command line becomes a torture (though, I didn't tried
and not sure if mtdparts= can handle spaces at all). Plus, this causes
real bugs when multiple fsl_elbc_nand chips registered.

With this patch applied fsl_elbc_nand chip will have proper name:

   root@b1:~# cat /proc/mtd
   dev:    size   erasesize  name
   mtd0: 00800000 00010000 "fe000000.flash"
   mtd1: 02000000 00004000 "e0600000.flash"

p.s. We can't use priv->dev->bus_id as in physmap_of, because
fsl_elbc_nand pretends to be a localbus controller, so its bus_id is
"address.localbus", which is incorrect and thus will also not work
for multiple chips.

Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2008-04-22 20:50:31 +01:00
Matteo Croce f0797881d5 [MTD] AR7 mtd partition map
Signed-off-by: Matteo Croce <technoboy85@gmail.com>
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: Eugene Konev <ejka@imfi.kspu.ru>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2008-04-22 20:48:12 +01:00
Anton Vorontsov 5c249c5a57 [MTD] [NAND] FSL UPM NAND driver
This is very simple driver, NAND is connected through localbus,
and User-Programmable Machine is doing various adjustments to
speak NAND. No special efforts needed to do read and write cycles,
though to control ALE and CLE phases, we ask UPM to generate exact
pre-programmed signals on the localbus lines.

Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2008-04-22 20:46:30 +01:00
David Woodhouse a1c06ee11f [MTD] [NAND] Fix checkpatch errors in pxa3xx_nand
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2008-04-22 20:39:43 +01:00
Andrei Dolnikov 1b0a062be7 [MTD] [NOR] Add JEDEC support for the SST 36VF3203 flash chip
Add support for the SST 36VF3203 flash chip. It is used on Emerson 
KSI8560 board.

Signed-off-by: Andrei Dolnikov <adolnikov@ru.mvista.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2008-04-22 20:24:59 +01:00
Florian Fainelli 757570063a [MTD] [MAPS] Extend plat-ram to support a supplied probe type
This enhances plat-ram to take a map_probes argument in
the platform_data structure which allow plat-ram to support
any direct-mapped device that MTD supports (jedec, cfi, amd ..)

A few items are also fixed:
- Don't panic if probes is 0
- Actually use the partition list that is passed in

Signed-off-by: Florian Fainelli <florian.fainelli@telecomint.eu>
Signed-off-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2008-04-22 20:10:10 +01:00
Paulius Zaleckas ca5c23c3b8 [MTD] XIP: Use generic xip_iprefetch() instead of asm volatile (...)
Untested, but shouldn't break anything... Makes MTD_XIP arch
independent. I guess this is why xip_iprefetch() was made for.

Signed-off-by: Paulius Zaleckas <paulius.zaleckas@teltonika.lt>
Acked-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2008-04-22 19:47:42 +01:00
eric miao fe69af002e [MTD] [NAND] support for pxa3xx
This is preliminary since:

1. It supports only _one_ chip select at the moment. As there is no
   existing platforms available using two chip selects of the NAND
   controller, it shall really not include code for supporting the
   2nd chip select for now, as such code cannot be verified.

2. It resorts to the default and simpliest memory based badblock
   table

3. Only limited types of nand flash are currently supported. Most
   PXA3xx processors come with on-chip NAND flash dies, so there
   isn't much flexibility for other types of NAND.

4. The NAND controller should be configured to detect the device's
   ID, thus making it difficult to use nand_scan_ident() to assist
   the detection process (though it's not impossible)

TODO: fix all the above limitations of cuz :-)

Signed-off-by: eric miao <eric.miao@marvell.com>
Cc: Sergey Podstavin <spodstavin@ru.mvista.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2008-04-22 19:27:27 +01:00
Roel Kluin b73d7e4381 [MTD] [OneNAND] unlikely(x) || unlikely(y) => unlikely(x || y)
Acked-By: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2008-04-22 19:15:28 +01:00
Thomas Petazzoni 8e2537e4cb [MTD] fix minor typo in the MTD map driver for SHARP SL series
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2008-04-22 19:12:44 +01:00
Peter Korsgaard b0d06afb60 [MTD] cmdlinepart: Missing partition info is not an error
Return 0 partitions instead of -EINVAL on no mtdpart= argument in kernel
cmdline or missing partition info for device.

Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
Acked-by: Stefan Roese <sr@denx.de>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2008-04-22 19:10:15 +01:00
Carl-Daniel Hailfinger c3f08b3535 [MTD] [MAPS] add support for Nvidia MCP55 to ck804xrom
This patch extends the existing MAPS driver for the Nvidia CK804 chipset
(ck804xrom.c) to also work on the Nvidia MCP55 chipset. As both chipsets
are rather similar, suporting them both with the same driver is easy.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2008-04-22 18:11:35 +01:00
Adrian Bunk 7fe9296c80 [MTD] make struct rfd_ftl_tr static
This patch makes the needlessly global struct rfd_ftl_tr static.

Signed-off-by: Adrian Bunk <bunk@kernel.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2008-04-22 15:59:25 +01:00
Adrian Bunk 607d1cb104 [MTD] [OneNAND] proper onenand_bbt_read_oob() prototype
This patch adds a proper prototype for onenand_bbt_read_oob() in
include/linux/mtd/onenand.h

Signed-off-by: Adrian Bunk <bunk@kernel.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2008-04-22 15:59:13 +01:00
Adrian Bunk eb8e31831a [MTD] [NOR] cfi_cmdset_0020.c: make a function static
This patch makes the needlessly global cfi_staa_erase_varsize() static.

Signed-off-by: Adrian Bunk <bunk@kernel.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2008-04-22 15:56:16 +01:00
Adrian Bunk 5ce45d5005 [MTD] ftl.c: make code static
This patch makes the following needlessly global code static:
- ftl_freepart()
- struct ftl_tr

Signed-off-by: Adrian Bunk <bunk@kernel.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2008-04-22 15:56:00 +01:00
Adrian Bunk ed262c4f5c [MTD] cmdlinepart.c: don't compare pointers with 0
Sparse spotted that 0 was compared to pointers.

While I was at it, I also moved the assignments out of the if's.

Signed-off-by: Adrian Bunk <bunk@kernel.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2008-04-22 15:55:38 +01:00
Adrian Bunk 456d9fc92e [MTD] mtdram.c should #include <linux/mtd/mtdram.h>
Every file should include the headers containing the externs for its
global functions (in this case for mtdram_init_device()).

Signed-off-by: Adrian Bunk <bunk@kernel.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2008-04-22 15:55:07 +01:00
Adrian Bunk 51ee83df61 [MTD] proper prototypes for nftl_{read,write}_oob()
This patch adds proper prototypes for nftl_{read,write}_oob() in
include/linux/mtd/nftl.h

Signed-off-by: Adrian Bunk <bunk@kernel.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2008-04-22 15:54:29 +01:00
Adrian Bunk a8e8aa2569 [MTD] proper prototypes for inftl_{read,write}_oob()
This patch adds proper prototypes for inftl_{read,write}_oob() in
include/linux/mtd/inftl.h

Signed-off-by: Adrian Bunk <bunk@kernel.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2008-04-22 15:54:16 +01:00
Adrian Bunk 950bcb2582 [MTD] mtd/ofpart.c: add MODULE_LICENSE
This patch adds the missing MODULE_LICENSE("GPL").

Signed-off-by: Adrian Bunk <bunk@kernel.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2008-04-22 15:53:52 +01:00
Scott Wood 576506645d [MTD] [NAND] fsl_elbc_nand: Fix SEQIN handling for large pages.
Previously, a READ command was erroneously issued rather than SEQIN.

Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2008-04-22 15:36:24 +01:00
Mark Hindley f72561cf6c [MTD] Correct phram module param description
Signed-off-by: Mark Hindley <mark@hindley.org.uk>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2008-04-22 15:19:48 +01:00
Atsushi Nemoto 52f8301437 [MTD] [NAND] at91_nand: Make part_probes[] static
The part_probes[] should be static.

Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Acked-by: Jörn Engel <joern@logfs.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2008-04-22 14:50:40 +01:00
Kay Sievers 1ff184225b [MTD] [NAND] fix platform driver hotplug/coldplug
Since 43cc71eed1, the platform modalias is
prefixed with "platform:".  Add MODULE_ALIAS() to the hotpluggable MTD NAND
platform drivers, to re-enable auto loading.

NOTE: at91_nand for some reason disallows modular builds.  I'm assuming that's
just an oversight that will be fixed.

[dbrownell@users.sourceforge.net: minor fix]
Signed-off-by: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2008-04-22 14:17:47 +01:00
Kay Sievers 41d867c9ac [MTD] [MAPS] fix platform driver hotplug/coldplug
Since 43cc71eed1, the platform modalias is
prefixed with "platform:".  Add MODULE_ALIAS() to the hotpluggable MTD mapping
platform drivers, to re-enable auto loading.

NOTE oddness with physmap ...  it's a legacy driver in some configs, which
means it can't always support hotplugging.  (Not that most of these mapping
drivers would often be used as modules...)

[dbrownell@users.sourceforge.net: bugfix, more drivers, registration fixes]
Signed-off-by: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2008-04-22 14:14:26 +01:00
Sebastian Siewior c27e9b80be [MTD] [NAND] fix possible Ooops in rfc_from4
I found this while I was looking how the rs_lib is working.  The rs_decoder is
initialized _after_ the nand core code read the BBT table and _after_ the
partition table has been added.  The driver has a private BBT description
which is in located in flash data so we Ooops if there is a bit flip _or_ if a
bit flips while reading the partition table.

This patch moves the initialization of the rs_lib before the first possible
access by nand core.

Signed-off-by: Sebastian Siewior <bigeasy@linutronix.de>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Jörn Engel <joern@wh.fh-wedel.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2008-04-22 14:13:14 +01:00
Harvey Harrison cb53b3b999 [MTD] replace remaining __FUNCTION__ occurrences
__FUNCTION__ is gcc-specific, use __func__

Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2008-04-22 12:36:04 +01:00
David Woodhouse 35d086b143 [MTD] [JEDEC] Fix whitespace noise in chip table
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2008-04-22 12:35:54 +01:00
Gordon Farquharson 30d6a24eb8 [MTD] [JEDEC] add support for the ST M29W400DB flash chip
Add support for the ST M29W400DB flash chip.  which is used on the GLAN Tank
NAS.

Signed-off-by: Gordon Farquharson <gordonfarquharson@gmail.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2008-04-22 12:35:52 +01:00
Stephane Chazelas 0bc88c59cc [MTD] block2mtd: logging typo fixes
Address a number of small issues mainly regarding the output made by this
driver to dmesg:

- Some of the blkmtd's had not been changed to block2mtd which caused
  display problem

- the parse_err() macro was displaying "block2mtd: " twice

Signed-off-by: Stéphane Chazelas <stephane.chazelas@emerson.com>
Acked-by: Jörn Engel <joern@lazybastard.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2008-04-22 12:35:49 +01:00
Adrian Bunk ec12cc74e9 [MTD] [NAND] mtd/nand/cs553x_nand.c:part_probes[] static
Make the needlessly global part_probes[] static.

Signed-off-by: Adrian Bunk <bunk@kernel.org>
Acked-by: Mart Raudsepp <mart.raudsepp@artecdesign.ee>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2008-04-22 12:35:40 +01:00
Adrian Bunk 7903cbabcb [MTD] mtdoops.c: make struct oops_cxt static again
struct oops_cxt needlessly became global.

Signed-off-by: Adrian Bunk <bunk@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2008-04-22 12:35:34 +01:00
Mike Frysinger 41bdf96006 [MTD] [MAPS] Document MTD_PHYSMAP module name in kconfig
Help out users by telling them the module name in the Kconfig help when
using the MTD_PHYSMAP option.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2008-04-22 12:35:26 +01:00
David Woodhouse f838bad1b3 Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6 2008-04-22 12:34:25 +01:00
Linus Torvalds 9a64388d83 Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc
* 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc: (202 commits)
  [POWERPC] Fix compile breakage for 64-bit UP configs
  [POWERPC] Define copy_siginfo_from_user32
  [POWERPC] Add compat handler for PTRACE_GETSIGINFO
  [POWERPC] i2c: Fix build breakage introduced by OF helpers
  [POWERPC] Optimize fls64() on 64-bit processors
  [POWERPC] irqtrace support for 64-bit powerpc
  [POWERPC] Stacktrace support for lockdep
  [POWERPC] Move stackframe definitions to common header
  [POWERPC] Fix device-tree locking vs. interrupts
  [POWERPC] Make pci_bus_to_host()'s struct pci_bus * argument const
  [POWERPC] Remove unused __max_memory variable
  [POWERPC] Simplify xics direct/lpar irq_host setup
  [POWERPC] Use pseries_setup_i8259_cascade() in pseries_mpic_init_IRQ()
  [POWERPC] Turn xics_setup_8259_cascade() into a generic pseries_setup_i8259_cascade()
  [POWERPC] Move xics_setup_8259_cascade() into platforms/pseries/setup.c
  [POWERPC] Use asm-generic/bitops/find.h in bitops.h
  [POWERPC] 83xx: mpc8315 - fix USB UTMI Host setup
  [POWERPC] 85xx: Fix the size of qe muram for MPC8568E
  [POWERPC] 86xx: mpc86xx_hpcn - Temporarily accept old dts node identifier.
  [POWERPC] 86xx: mark functions static, other minor cleanups
  ...
2008-04-21 15:50:49 -07:00
Artem Bityutskiy 434b825e1f UBI: print media information earlier
Print information about logicale eraseblock size, sub-page
size and so on at early stage, befor an attempt to attach
the MTD device was made. This is more convenient to do so
because the attempt to attach may fail, and the information
is never printed then.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2008-04-20 18:02:42 +03:00
Artem Bityutskiy 4bc1dca4b0 UBI: fix mean EC calculation
(a + b) / (c + d) != a / c + b / d. The old code errornously
assumed this incorrect formuld. Instead, just sum all erase
counters in a 64-bit variable and divide to the number of EBs
at the end.

Thanks to Adrian Hunter for pointing this out.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2008-04-19 20:49:41 +03:00
Russell King adf6d34e46 Merge branch 'omap2-upstream' into devel 2008-04-19 17:17:29 +01:00
Jan Altenberg cbd8a9d2cd UBI: initialize static volumes with vol->used_bytes
I came across a problem which seems to be present since:

commit 941dfb07ed
UBI: set correct gluebi device size

ubi_create_gluebi() leaves mtd->size = 0 for static volumes. So even
existing static volumes are initialized with a size of 0.

Signed-off-by: Jan Altenberg <jan.altenberg@linutronix.de>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2008-04-17 11:32:02 +03:00
Artem Bityutskiy 6e0c84e37e UBI: improve Kconfig documentation
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2008-04-17 11:32:00 +03:00
Artem Bityutskiy c4506092c1 UBI: fix error printing
Use existing ubi_err() as the rest of the code does.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2008-04-17 11:31:59 +03:00
Artem Bityutskiy 92a74f1c1c UBI: make ubi-header.h local
The new trend in linux is not to store headers which define
on-media format in the include/ directory, but instead, store
them locally. This is because these headers "do not define any
kernel<->userspace interface".

Do so for UBI as well.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2008-04-17 11:31:58 +03:00
Artem Bityutskiy a4f0fcdfb2 UBI: be verbose when debuggin is enabled
Make I/O function to be always verbose when about CRC errors
and magic number errors when I/O debugging is enabled.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2008-04-17 11:31:58 +03:00
Anton Vorontsov d4a32fe40a [POWERPC] fsl_elbc_nand: factor out localbus defines
This is needed to support other localbus peripherals, such as
NAND on FSL UPM.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
2008-04-17 01:01:38 -05:00
Dmitry Adamushko f8e30e447c mtd/chips: add missing set_current_state() to cfi_{amdstd,staa}_sync()
cfi_amdstd_sync() and cfi_staa_sync() call schedule() without changing task's
state appropriately.

In case of e.g.  chip->state == FL_ERASING, cfi_*_sync() will be busy-looping
either redundantly for a fixed interval of time (for SCHED_NORMAL tasks) or
possibly endlessly (for RT tasks and UP).

Signed-off-by: Dmitry Adamushko <dmitry.adamushko@gmail.com>
Cc: David Woodhouse <dwmw2@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-04-08 18:25:53 -07:00
Alexey Korolev fb6d080c6f mtd: fix broken state in CFI driver caused by FL_SHUTDOWN
THe CFI driver in 2.6.24 kernel is broken.  Not so intensive read/write
operations cause incomplete writes which lead to kernel panics in JFFS2.

We investigated the issue - it is caused by bug in FL_SHUTDOWN parsing code.
Sometimes chip returns -EIO as if it is in FL_SHUTDOWN state when it should
wait in FL_PONT (error in order of conditions).

The following patch fixes the bug in state parsing code of CFI.  Also I've
added comments to notify developers if they want to add new case in future.

Signed-off-by: Alexey Korolev <akorolev@infradead.org>
Reviewed-by: Joern Engel <joern@logfs.org>
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: <stable@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-04-04 14:46:26 -07:00
Anton Vorontsov 4a5691c0f7 mtd: maps/physmap: fix oops in suspend/resume/shutdown ops
# reboot
...
[   42.351266] Flash device refused suspend due to active operation (state 0)
[   42.358195] Unable to handle kernel NULL pointer dereference at virtual address 00000078
[   42.360060] pgd = c7d9c000
[   42.362769] [00000078] *pgd=a7d8d031, *pte=00000000, *ppte=00000000
[   42.372902] Internal error: Oops: 17 [#1]
[   42.376911] Modules linked in:
[   42.379980] CPU: 0    Not tainted  (2.6.25-rc2-10642-ge8f2594-dirty #73)
[   42.380000] PC is at physmap_flash_shutdown+0x28/0x54
...
[   42.380000] Backtrace:
[   42.380000] [<c0130c1c>] (physmap_flash_shutdown+0x0/0x54) from [<c01207c0>] (platform_drv_shutdown+0x20/0x24)
[   42.380000]  r5:28121969 r4:c0229e08
[   42.380000] [<c01207a0>] (platform_drv_shutdown+0x0/0x24) from [<c011cd40>] (device_shutdown+0x60/0x88)
[   42.380000] [<c011cce0>] (device_shutdown+0x0/0x88) from [<c003e8a4>] (kernel_restart_prepare+0x2c/0x3c)
[   42.380000]  r4:00000000
[   42.380000] [<c003e878>] (kernel_restart_prepare+0x0/0x3c) from [<c003ea00>] (kernel_restart+0x14/0x48)
[   42.380000] [<c003e9ec>] (kernel_restart+0x0/0x48) from [<c003fdc0>] (sys_reboot+0xe8/0x1f8)
[   42.380000]  r4:01234567
[   42.380000] [<c003fcd8>] (sys_reboot+0x0/0x1f8) from [<c001aa00>] (ret_fast_syscall+0x0/0x2c)
[   42.380000]  r7:00000058 r6:00000004 r5:00000001 r4:00000000
[   42.380000] Code: 0a000009 e7953004 e1a00003 e1a0e00f (e593f078)
[   42.650051] ---[ end trace 6d6c26a0fc3141de ]---
Segmentation fault
INIT: no more processes left in this runlevel

While looping for mtd[i]s, we should stop at the mtd[i] == NULL.

This patch also removes unnecessary "if (info)" checks:
suspend/resume/shutdown ops are executed only if probe() is succeeded, so info
is guaranteed to be !NULL.

Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
Cc: David Brownell <david-b@pacbell.net>
Cc: David Woodhouse <dwmw2@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-03-28 14:45:22 -07:00
Sebastian Siewior 6f5afaed58 mtd: nand: add out label in rfc_from4
This has been forgotten in commit f5bbdacc41 ("[MTD] NAND Modularize
read function") and nobody compiled the driver.

Signed-off-by: Sebastian Siewior <bigeasy@linutronix.de>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: Joern Engel <joern@wh.fh-wedel.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-03-28 14:45:21 -07:00
Lennert Buytenhek 5d4294c524 plat-orion: make orion_nand available for all Orion families
Signed-off-by: Lennert Buytenhek <buytenh@marvell.com>
Reviewed-by: Tzachi Perelstein <tzachi@marvell.com>
Acked-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Nicolas Pitre <nico@marvell.com>
2008-03-27 14:51:40 -04:00
Ingo van Lil 2875fb65f8 mtd: memory corruption in block2mtd.c
The block2mtd driver (drivers/mtd/devices/block2mtd.c) will kfree an on-stack
pointer when handling an invalid argument line (e.g.
block2mtd=/dev/loop0,xxx).

The kfree was added some time ago when "name" was dynamically allocated.

Signed-off-by: Ingo van Lil <inguin@gmx.de>
Acked-by: Joern Engel <joern@lazybastard.org>
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: <stable@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-03-24 19:22:19 -07:00
Adrian Bunk f7f0283776 UBI: mtd/ubi/vtbl.c: fix memory leak
This patch fixes a memory leak introduced by commit
4ccf8cffa9 and spotted by the Coverity
checker.

Signed-off-by: Adrian Bunk <bunk@kernel.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2008-03-04 11:03:09 +02:00
Harvey Harrison 8eee9f100b UBI: fix sparse errors in ubi.h
In C, signed 1-bit bitfields can only take the values 0 and -1, only 0 and 1
are ever assigned in current code.  Make them unsigned bitfields.

Fixes the (repeated) sparse errors:
drivers/mtd/ubi/ubi.h:220:15: error: dubious one-bit signed bitfield
drivers/mtd/ubi/ubi.h:221:17: error: dubious one-bit signed bitfield
drivers/mtd/ubi/ubi.h:222:18: error: dubious one-bit signed bitfield
drivers/mtd/ubi/ubi.h:223:16: error: dubious one-bit signed bitfield
drivers/mtd/ubi/ubi.h:224:20: error: dubious one-bit signed bitfield

Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
Cc: Artem Bityutskiy <dedekind@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2008-03-04 11:02:50 +02:00
Artem Bityutskiy 19cd7b7de1 UBI: fix error message
Make it print "UBI error: cannot attach mtd4"
instead of "UBI error: cannot attach 4"

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2008-03-04 11:02:26 +02:00
S.Çağlar Onur fc398769ac UBI: silence warning
drivers/mtd/ubi/vmt.c: In function `ubi_create_volume':
drivers/mtd/ubi/vmt.c:379: warning: statement with no effect

Signed-off-by: S.Çağlar Onur <caglar@pardus.org.tr>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2008-03-04 11:02:04 +02:00
Kyungmin Park 66a10506d6 [MTD] [OneNAND] Fix unlock all in Double Density Package (DDP)
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2008-02-16 15:15:55 +00:00
Jan Blunck 1d957f9bf8 Introduce path_put()
* Add path_put() functions for releasing a reference to the dentry and
  vfsmount of a struct path in the right order

* Switch from path_release(nd) to path_put(&nd->path)

* Rename dput_path() to path_put_conditional()

[akpm@linux-foundation.org: fix cifs]
Signed-off-by: Jan Blunck <jblunck@suse.de>
Signed-off-by: Andreas Gruenbacher <agruen@suse.de>
Acked-by: Christoph Hellwig <hch@lst.de>
Cc: <linux-fsdevel@vger.kernel.org>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Steven French <sfrench@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-02-14 21:13:33 -08:00
Jan Blunck 4ac9137858 Embed a struct path into struct nameidata instead of nd->{dentry,mnt}
This is the central patch of a cleanup series. In most cases there is no good
reason why someone would want to use a dentry for itself. This series reflects
that fact and embeds a struct path into nameidata.

Together with the other patches of this series
- it enforced the correct order of getting/releasing the reference count on
  <dentry,vfsmount> pairs
- it prepares the VFS for stacking support since it is essential to have a
  struct path in every place where the stack can be traversed
- it reduces the overall code size:

without patch series:
   text    data     bss     dec     hex filename
5321639  858418  715768 6895825  6938d1 vmlinux

with patch series:
   text    data     bss     dec     hex filename
5320026  858418  715768 6894212  693284 vmlinux

This patch:

Switch from nd->{dentry,mnt} to nd->path.{dentry,mnt} everywhere.

[akpm@linux-foundation.org: coding-style fixes]
[akpm@linux-foundation.org: fix cifs]
[akpm@linux-foundation.org: fix smack]
Signed-off-by: Jan Blunck <jblunck@suse.de>
Signed-off-by: Andreas Gruenbacher <agruen@suse.de>
Acked-by: Christoph Hellwig <hch@lst.de>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Casey Schaufler <casey@schaufler-ca.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-02-14 21:13:33 -08:00
Mart Raudsepp 641f43669f [MTD] [NAND] cs553x_nand: command line partitioning support
Implements kernel command line partitioning support for the CS5535/CS5536 chipsets driver.

For that the following is done:

* cs553x_cleanup(): try the cleanup for all chip selects to not leak memory
* Assign a unique name for each chip select to be separately addressable in the command line mtd-id portion(s)
* Use the already defined PIN_OPT_IDE constant where appropriate for readability
* Include command line partitioning support when CONFIG_MTD_PARTS is set

Signed-off-by: Mart Raudsepp <mart.raudsepp@artecdesign.ee>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2008-02-09 08:21:31 +00:00
Linus Torvalds a8e98d6d51 Merge git://git.infradead.org/mtd-2.6
* git://git.infradead.org/mtd-2.6: (120 commits)
  [MTD] Fix mtdoops.c compilation
  [MTD] [NOR] fix startup lock when using multiple nor flash chips
  [MTD] [DOC200x] eccbuf is statically defined and always evaluate to true
  [MTD] Fix maps/physmap.c compilation with CONFIG_PM
  [MTD] onenand: Add panic_write function to the onenand driver
  [MTD] mtdoops: Use the panic_write function when present
  [MTD] Add mtd panic_write function pointer
  [MTD] [NAND] Freescale enhanced Local Bus Controller FCM NAND support.
  [MTD] physmap.c: Add support for multiple resources
  [MTD] [NAND] Fix misparenthesization introduced by commit 78b65179...
  [MTD] [NAND] Fix Blackfin NFC ECC calculating bug with page size 512 bytes
  [MTD] [NAND] Remove wrong operation in PM function of the BF54x NFC driver
  [MTD] [NAND] Remove unused variable in plat_nand_remove
  [MTD] Unlocking all Intel flash that is locked on power up.
  [MTD] [NAND] at91_nand: Make mtdparts option can override board info
  [MTD] mtdoops: Various minor cleanups
  [MTD] mtdoops: Ensure sequential write to the buffer
  [MTD] mtdoops: Perform write operations in a workqueue
  [MTD] mtdoops: Add further error return code checking
  [MTD] [NOR] Test devtype, not definition in flash_probe(), drivers/mtd/devices/lart.c
  ...
2008-02-07 10:20:31 -08:00
David Woodhouse f9f7dd2223 [MTD] Fix mtdoops.c compilation
drivers/mtd/mtdoops.c: In function ‘mtdoops_console_sync’:
drivers/mtd/mtdoops.c:329: error: implicit declaration of function ‘in_interrupt’

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2008-02-07 10:50:57 +00:00
Rizzo Davide 484b8e64c8 [MTD] [NOR] fix startup lock when using multiple nor flash chips
Taken from http://bugzilla.kernel.org/show_bug.cgi?id=9829

I found and solved the problem, at line 115 of drivers/mtd/chips/gen_probe.c
(kernel 2.6.24): mapsize value must be calculated in bytes, not in long.

Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2008-02-07 10:38:12 +00:00
Samuel Tardieu 53fb84a069 [MTD] [DOC200x] eccbuf is statically defined and always evaluate to true
Signed-off-by: Samuel Tardieu <sam@rfc1149.net>
Acked-by: Joern Engel <joern@logfs.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2008-02-07 10:34:36 +00:00
akpm@linux-foundation.org d5476689af [MTD] Fix maps/physmap.c compilation with CONFIG_PM
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2008-02-07 10:33:40 +00:00
Richard Purdie 6c77fd649f [MTD] onenand: Add panic_write function to the onenand driver
Implement the panic_write function for the onenand driver. This waits
for any active command to complete/timeout, performs the write, waits
for it to complete and then returns.

Signed-off-by: Richard Purdie <rpurdie@rpsys.net>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2008-02-07 10:31:23 +00:00
Richard Purdie 621e4f8e9b [MTD] mtdoops: Use the panic_write function when present
When the MTD provides a panic_write function, use it.

Signed-off-by: Richard Purdie <rpurdie@rpsys.net>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2008-02-07 10:31:04 +00:00
Richard Purdie 388bbb09b9 [MTD] Add mtd panic_write function pointer
MTDs are well suited for logging critical data and the mtdoops driver
allows kernel panics/oops to be written to flash in a blackbox flight
recorder fashion allowing better debugging and analysis of crashes.

Any kernel oops in user context can be easily handled since the kernel
continues as normal and any queued mtd writes are scheduled. Any kernel
oops in interrupt context results in a panic and the delayed writes will
not be scheduled however. The existing mtd->write function cannot be
called in interrupt context so these messages can never be written to
flash.

This patch adds a panic_write function pointer that drivers can
optionally implement which can be called in interrupt context. It is
only intended to be called when its known the kernel is about to panic
and we need to write to succeed. Since the kernel is not going to be
running for much longer, this function can break locks and delay to
ensure the write succeeds (but not sleep).

Signed-off-by: Richard Purdie <rpurdie@rpsys.net>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2008-02-07 10:30:48 +00:00
Scott Wood 76b1046716 [MTD] [NAND] Freescale enhanced Local Bus Controller FCM NAND support.
Signed-off-by: Nick Spence <nick.spence@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2008-02-07 10:26:57 +00:00
Joern Engel 2b54aaef7a Claim maintainership for block2mtd and update email addresses
I have been prime author and maintainer of block2mtd from day one, but
neither MAINTAINERS nor the module source makes this fact clear.  And while
I'm at it, update my email addresses tree-wide, as the old address
currently bounces and change my name to "joern" as unicode will likely
continue to cause trouble until the end of this century.

Signed-off-by: Joern Engel <joern@lazybastard.org>
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: Andy Whitcroft <apw@shadowen.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-02-06 10:41:09 -08:00
Joe Perches 8e87d7820a drivers/mtd/: Spelling fixes
Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Adrian Bunk <bunk@kernel.org>
2008-02-03 17:22:34 +02:00
Paulius Zaleckas efad798b9f Spelling fixes: lenght->length
Signed-off-by: Paulius Zaleckas <pauliusz@yahoo.com>
Signed-off-by: Adrian Bunk <bunk@kernel.org>
2008-02-03 15:42:53 +02:00
Uwe Kleine-König a247b5d594 fix typo 'the same the\>'
Signed-off-by: Uwe Kleine-König <Uwe.Kleine-Koenig@digi.com>
Signed-off-by: Adrian Bunk <bunk@kernel.org>
2008-02-03 14:59:11 +02:00
Stefan Roese df66e7167a [MTD] physmap.c: Add support for multiple resources
This patch extends the physmap mapping driver to support multiple
resources for non-identical NOR chips that will be concatenated together
when selected.

This is needed for example for Intel 48F4400 512MBit chips, since they
consist of 2 single different NOR chips with different geometries. The
first (lower) one has botton boot sectors and the 2nd (upper) has top
boot sectors. This currently isn't handled correctly by calling the
physmap driver once with only one resource covering both chips in one
memory region. The same geometrie is used for both chips.

With this patch the following resource structure can be used to
describe the 48F4400 chip correctly:

static struct resource board_nor_resource[] = {
	[0] = {
		.start = 0xf8000000,
		.end = 0xfbffffff,
		.flags = IORESOURCE_MEM,
	},
	[1] = {
		.start = 0xfc000000,
		.end = 0xffffffff,
		.flags = IORESOURCE_MEM,
	}
};

Signed-off-by: Stefan Roese <sr@denx.de>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2008-02-03 22:16:02 +11:00
Scott Wood 1c45f60406 [MTD] [NAND] Fix misparenthesization introduced by commit 78b65179...
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2008-02-03 22:14:12 +11:00
David Woodhouse 6208e77e7f Merge git://git.infradead.org/~dedekind/ubi-2.6 2008-02-03 22:07:40 +11:00
Bryan Wu 5eb91034f3 [MTD] [NAND] Fix Blackfin NFC ECC calculating bug with page size 512 bytes
Signed-off-by: Bryan Wu <bryan.wu@analog.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2008-02-03 18:55:16 +11:00
Bryan Wu f4dda0914e [MTD] [NAND] Remove wrong operation in PM function of the BF54x NFC driver
There is no suspend/resume operation in NFC driver at all, currently.

Signed-off-by: Bryan Wu <bryan.wu@analog.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2008-02-03 18:54:46 +11:00
Li Zefan a50367784e [MTD] [NAND] Remove unused variable in plat_nand_remove
With CONFIG_MTD_PARTITIONS not set, got this:
drivers/mtd/nand/plat_nand.c:113: warning: unused variable 'pdata'

Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2008-02-03 18:31:52 +11:00
David Woodhouse b7e23d913a Merge git://git.infradead.org/~kmpark/onenand-mtd-2.6 2008-02-03 18:31:04 +11:00
David Woodhouse c1f3ee120b Merge git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git 2008-02-03 18:30:32 +11:00
Justin Treon e619a75ff6 [MTD] Unlocking all Intel flash that is locked on power up.
Patch for unlocking all Intel flash that has instant locking on power up.
The patch has been tested on Intel M18, P30 and J3D Strata Flash.
  1.    The automatic unlocking can be disabled for a particular partition
         in the map or the command line.
     a. For the bit mask in the map it should look like:
         .mask_flags   = MTD_POWERUP_LOCK,
     b. For the command line parsing it should look like:
         mtdparts=0x80000(bootloader)lk
  2.    This will only unlock parts with instant individual block locking.
         Intel parts with legacy unlocking will not be unlocked.

Signed-off-by: Justin Treon <justin_treon@yahoo.com>
Signed-off-by: Jared Hulbert <jaredeh@gmail.com>
Acked-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2008-02-03 18:25:16 +11:00
Atsushi Nemoto 842b1a105c [MTD] [NAND] at91_nand: Make mtdparts option can override board info
Call parse_mtd_partitions before checking board's partition_info, so
that "mtdparts=" option can override board's default setting.

Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2008-02-03 18:21:01 +11:00
Richard Purdie 79dcd8e9e1 [MTD] mtdoops: Various minor cleanups
Various minor cleaups to mtdoops:
  * Don't support the mtd->erasesize < OOPS_PAGE_SIZE case
  * Tweak printks and make the device mtdoops connects to more visible
  * CON_PRINTBUFFER flag is uneeded

Signed-off-by: Richard Purdie <rpurdie@rpsys.net>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2008-02-03 18:19:24 +11:00
Richard Purdie 47c152b88c [MTD] mtdoops: Ensure sequential write to the buffer
Add a spinlock to ensure writes to the mtdoops buffer memory are
sequential and don't race.

Signed-off-by: Richard Purdie <rpurdie@rpsys.net>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2008-02-03 18:18:58 +11:00
Richard Purdie 6ce0a856c1 [MTD] mtdoops: Perform write operations in a workqueue
Writing to the flash needs to be done in a workqueue. The console
write functions may be called in any context which can lead to
lockups otherwise.

Signed-off-by: Richard Purdie <rpurdie@rpsys.net>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2008-02-03 18:14:41 +11:00
Richard Purdie 2986bd2a33 [MTD] mtdoops: Add further error return code checking
Add further error return code checks to the mtdoops driver.

Signed-off-by: Richard Purdie <rpurdie@rpsys.net>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2008-02-03 18:14:35 +11:00
Roel Kluin 0bdf77f85b [MTD] [NOR] Test devtype, not definition in flash_probe(), drivers/mtd/devices/lart.c
drivers/mtd/devices/lart.c:119:#define FLASH_DEVICE_16mbit_BOTTOM 0x88f488f4
As was, unless "manufacturer != FLASH_MANUFACTURER" this returned true

Signed-off-by: Roel Kluin <12o3l@tiscali.nl>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2008-02-03 18:12:09 +11:00
akpm@linux-foundation.org 9308758c50 [UBI] drivers/mtd/ubi/scan.c: fix uninitialized var warning
drivers/mtd/ubi/scan.c: In function 'ubi_scan':
drivers/mtd/ubi/scan.c:772: warning: 'ec' may be used uninitialized in this function

Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2008-02-03 18:10:00 +11:00
akpm@linux-foundation.org 4354c5a4ef [UBI] drivers/mtd/ubi/wl.c: fix uninitialized var warning
drivers/mtd/ubi/wl.c:746: warning: 'pe' may be used uninitialized in this function

Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2008-02-03 18:09:45 +11:00
akpm@linux-foundation.org 5b1defe73a [UBI] drivers/mtd/ubi/cdev.c: unused var
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2008-02-03 18:09:27 +11:00
Scott Wood 9a310d2119 [MTD] Factor out OF partition support from the NOR driver.
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2008-02-03 18:06:48 +11:00
Ilpo Järvinen c0d2a48a65 [MTD] jedec probe: drop unnecessary forward declarations
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2008-02-03 17:58:05 +11:00
Ilpo Järvinen 53d8855392 [MTD] JEDEC probe: kill some inline bloat
$ codiff $OBJ.old $OBJ
drivers/mtd/chips/jedec_probe.c:
  cfi_jedec_setup  | -320
  jedec_probe_chip | -7073
 2 functions changed, 7393 bytes removed, diff: -7393

drivers/mtd/chips/jedec_probe.c:
  jedec_reset | +1151
 1 function changed, 1151 bytes added, diff: +1151

drivers/mtd/chips/jedec_probe.o:
 3 functions changed, 1151 bytes added, 7393 bytes removed, diff: -6242

Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2008-02-03 17:55:41 +11:00
Artem Bityutskiy 6dc4a8717f UBI: do not flush queue on each vtbl change
This is just not necessary. We re-write whole layout copy, so
the old contents cannot show up again sice scan process will
drop it.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2008-02-01 13:48:49 +02:00
Kyungmin Park 69d79186dc [MTD] [OneNAND] Use pre-alloced oob buffer instead of local buffer
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
2008-01-29 17:14:01 +09:00
Sheng Yongjie (Sam 978cb38a29 [MTD] [OneNAND] Use the u_char instead of char in oobbuf
In function onenand_verify_oob, local variable oobbuf shall be unsigned char.

In the case of a value is >= 0x80, it's unequal in comparing the value in an unsigned char and signed char.

Signed-off-by: Sheng Yongjie (Sam) <samsheng@trident.com.cn>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
2008-01-29 17:13:24 +09:00
Kyungmin Park b2581be291 [MTD] [OneNAND] Check the initial bad block using ONENAND_CTRL_ERROR
Some chips don't set the ONENAND_CTRL_LOAD bit.

Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
2008-01-29 17:12:32 +09:00
Kyungmin Park e71f04fc92 [MTD] [OneNAND] Get correct density from device ID
Use the higher bits for other purpose.

Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
2008-01-29 17:11:38 +09:00
Kyungmin Park b21b72cf33 [MTD] [OneNAND] Consolidate OneNAND operation order
Consolidate OneNAND operation order as OneNAND Spec.
It also doesn't break previous operation order.

Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
2008-01-29 17:10:28 +09:00
Adrian Hunter 9d2f0b7a3d [MTD] [OneNAND] fix call to onenand_verify when writing subpages
Signed-off-by: Adrian Hunter <ext-adrian.hunter@nokia.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
2008-01-29 17:07:30 +09:00
Adrian Hunter d0b36d8cc8 [MTD] [OneNAND] Do not release chip twice
Signed-off-by: Adrian Hunter <ext-adrian.hunter@nokia.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
2008-01-29 17:07:06 +09:00
Matt Reimer d0bf37932a [MTD] [NAND] fix s3c2410 error correction
The single-bit error correction was, well, incorrect. For determing which
bit to correct it was using P1' P2' P4' P8' instead of P1 P2 P4 P8, and
it was using P16' P32' P64' P128' P256' P512' P1024' P2048' instead of
P16 P32 P64 P128 P256 P512 P1024 P2048.

Signed-off-by: Matt Reimer <mreimer@vpop.net>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2008-01-26 21:11:38 +08:00
Artem Bityutskiy e653879c26 UBI: implement atomic LEB change ioctl
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2008-01-25 16:41:26 +02:00
Artem Bityutskiy 60c031531a UBI: handle zero-length case
ubi_eba_atomic_leb_change() has to just map the LEB to a free PEB
if data length is zero.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2008-01-25 16:41:25 +02:00
Artem Bityutskiy 1b68d0eea5 UBI: simplify internal interfaces
Instead of passing vol_id to all functions and then find
struct ubi_volume, pass struct ubi_volume pointer.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2008-01-25 16:41:25 +02:00
Artem Bityutskiy 0411e73531 UBI: do not change file pointer while updating
Since we do not change semantics of seek(), changing the file
pointer while updating does not make much sense.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2008-01-25 16:41:25 +02:00
Artem Bityutskiy 91f2d53cd7 UBI: add layout volume information
Add more information about layout volume to make userspace tools
use the macros instead of constants. Also rename UBI_LAYOUT_VOL_ID
to make it consistent with other macros.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2008-01-25 16:41:25 +02:00
Artem Bityutskiy c18a84186c UBI: fix warnings
Old gcc complains:

CC      drivers/mtd/ubi/wl.o
drivers/mtd/ubi/wl.c: In function 'wear_leveling_worker':
drivers/mtd/ubi/wl.c:746: warning: 'pe' may be used uninitialized in this function
CC      drivers/mtd/ubi/scan.o
drivers/mtd/ubi/scan.c: In function 'ubi_scan':
drivers/mtd/ubi/scan.c:772: warning: 'ec' may be used uninitialized in this function
drivers/mtd/ubi/scan.c:772: note: 'ec' was declared here

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2008-01-25 16:41:25 +02:00
Artem Bityutskiy 64203195ed UBI: add sanity check
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2008-01-25 16:41:25 +02:00
Artem Bityutskiy 2f9270e7fe UBI: remove bogus assertion
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2008-01-25 16:41:25 +02:00
Artem Bityutskiy d536058752 UBI: bugfix: calculate data offset properly
Data offset is VID header offset + VID header size aligned to
the min. I/O unit size up.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2008-01-25 16:41:24 +02:00
Artem Bityutskiy ddc4939161 UBI: amend array size
Since the data offset parameter was removed, the size of
the parameters array is now 2, not 3.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2008-01-25 16:41:24 +02:00
Artem Bityutskiy 4ccf8cffa9 UBI: add auto-resize feature
The problem: NAND flashes have different amount of initial bad physical
eraseblocks (marked as bad by the manufacturer). For example, for 256MiB
Samsung OneNAND flash there might be from 0 to 40 bad initial eraseblocks,
which is about 2%. When UBI is used as the base system, one needs to know
the exact amount of good physical eraseblocks, because this number is
needed to create the UBI image which is put to the devices during
production. But this number is not know, which forces us to use the
minimum number of good physical eraseblocks. And UBI additionally
reserves some percentage of physical eraseblocks for bad block handling
(default is 1%), so we have 1-3% of PEBs reserved at the end, depending
on the amount of initial bad PEBs. But it is desired to always have
1% (or more, depending on the configuration).

Solution: this patch adds an "auto-resize" flag to the volume table.
The volume which has the "auto-resize" flag will automatically be re-sized
(enlarged) on the first UBI initialization. UBI clears the flag when
the volume is re-sized. Only one volume may have the "auto-resize" flag.

So, the production UBI image may have one volume with "auto-resize"
flag set, and its size is automatically adjusted on the first boot
of the device.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2008-01-25 16:41:24 +02:00
Artem Bityutskiy 896c0c06aa UBI: use bit-fields
Save 12 bytes of RAM per volume by using bit-fields instead of integers.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2008-01-25 16:41:24 +02:00
Artem Bityutskiy ae616e1be1 UBI: fix warnings
drivers/mtd/ubi/cdev.c: In function ‘vol_cdev_read’:
drivers/mtd/ubi/cdev.c:187: warning: unused variable ‘vol_id’
CC [M]  drivers/mtd/ubi/kapi.o
drivers/mtd/ubi/kapi.c: In function ‘ubi_leb_erase’:
drivers/mtd/ubi/kapi.c:483: warning: unused variable ‘vol_id’
drivers/mtd/ubi/kapi.c: In function ‘ubi_leb_unmap’:
drivers/mtd/ubi/kapi.c:544: warning: unused variable ‘vol_id’
drivers/mtd/ubi/kapi.c: In function ‘ubi_leb_map’:
drivers/mtd/ubi/kapi.c:582: warning: unused variable ‘vol_id’

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2008-01-25 16:41:24 +02:00
Artem Bityutskiy b9a06623d9 UBI: get rid of ubi_ltree_slab
This slab cache is not really needed since the number of objects
is low and the constructor does not make much sense because we
allocate oblects when doint I/O, which is way slower then allocation.

Suggested-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2008-01-25 16:41:24 +02:00
Tony Jones a98894ab02 mtd: Convert from class_device to device for MTD/mtdchar
struct class_device is going away, this converts the code to use struct
device instead.

Signed-off-by: Tony Jones <tonyj@suse.de>
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-01-24 20:40:06 -08:00
Matt Reimer 4fac9f6984 [MTD] [NAND] make s3c2410 indicate an error for multi-bit read errors
If there were multiple bit errors in the data s3c2410_nand_correct_data()
was returning 0 (no error) instead of -1, so the upper layers (like JFFS2)
would not know the data is corrupt.

Signed-off-by: Matt Reimer <mreimer@vpop.net>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2008-01-12 14:46:31 +00:00
Massimo Cirillo 646fd12784 cache invalidation error for buffered write
The bug causes corruptions of data read from flash.

The original code performs cache invalidation from "adr" to "adr + len"
in do_write_buffer().  Since len and adr could be updated in the code
before invalidation - it causes improper setting of cache invalidation
regions.

Signed-off-by: Massimo Cirillo <maxcir@gmail.com>
Signed-off-by: Giuseppe D'Eliseo <giuseppedeliseo@gmail.com>
Acked-by: Nicolas Pitre <nico@cam.org>
Acked-by: Jörn Engel <joern@logfs.org>
Signed-off-by: David Woohouse <dwmw2@infradead.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-01-11 11:44:37 -08:00
Bartlomiej Sieka de7921f01a [MTD] [NOR] Fix incorrect interface code for x16/x32 chips
According to "Common Flash Memory Interface Publication 100" dated December 1,
2001, the interface code for x16/x32 chips is 0x0005, and not 0x0004 used so
far.

Signed-off-by: Bartlomiej Sieka <tur@semihalf.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2008-01-10 22:07:12 +00:00
Scott Wood 78b65179d0 [MTD] [NAND] Don't panic if a controller driver does ecc its own way.
Some hardware, such as the enhanced local bus controller used on some
mpc83xx chips, does ecc transparently when reading and writing data, rather
than providing a generic calculate/correct mechanism that can be exported to
the nand subsystem.

The subsystem should not BUG() when calculate, correct, or hwctl are
missing, if the methods that call them have been overridden.

Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2008-01-08 07:51:57 +00:00
David Woodhouse 71053fb1c6 [MTD] [MAPS] Remove Photron PNC-2000 map driver
It should be done as a physmap device, and people keep turning it on and
whining about it.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2008-01-08 07:46:23 +00:00
David Scidmore e9d8d48253 [MTD] mtdchar.c: ioctl always returns 0 as size written for ppc64
"include/linux/mtd/mtd.h" declares "mtd_oob_ops.retlen" as size_t, which
is 64 bits on targets with a 64 bit addressing. The MEMWRITEOOB ioctl
calls copy_to_user() to write it back to "mtd_oob_buf.length", which is
declared in "include/linux/mtd-abi.h" as uint32_t. Since powerpc is a
big endian architecture, this only copies the upper 32 bits of the
address, which is always 0.

Signed-off-by: David Scidmore <dscidmore@xes-inc.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2008-01-08 07:46:12 +00:00
Artem Bityutskiy 4b3cc34061 UBI: bugfix: do not forget to increment vol_count
When creating a new volume, do not forget to increment the
vol_count variable.

Also, users are not interested in internal volumes, so do not show
them in the volumes_count sysfs file.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2007-12-26 19:15:18 +02:00
Artem Bityutskiy aeddb87718 UBI: do not support kiB
Be strict and accept only KiB, MiB and GiB, not Kib, not kib, etc.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2007-12-26 19:15:18 +02:00
Artem Bityutskiy b6b76ba466 UBI: add mtd_num sysfs attribute
Expose number or the underlying MTD device in sysfs.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2007-12-26 19:15:17 +02:00
Artem Bityutskiy d1f3dd6cc0 UBI: fix mtd device string parsing
UBI allows to specify MTD device name or number when the module is being
loaded. When parsing MTD device identity string, it first tries to treat
it as device NAME, and if that fails, it treats it as device number.

Make it vice-versa as this is more logical and makes less troubles when
you have an MTD device named "1" and try to load mtd1 which has different
name. This is especially easy to hit when gluebi is enabled.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2007-12-26 19:15:17 +02:00
Artem Bityutskiy 783b273afa UBI: use separate mutex for volumes checking
Introduce a separate mutex which serializes volumes checking,
because we cammot really use volumes_mutex - it cases reverse
locking problems with mtd_tbl_mutex when gluebi is used -
thanks to lockdep.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2007-12-26 19:15:17 +02:00
Artem Bityutskiy 897a316c9e UBI: handle attach ioctl
Actually implement the MTD device attach/detach handlers.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2007-12-26 19:15:17 +02:00
Artem Bityutskiy dd38fccfbc UBI: remove data_offset
'data_offset' parameter does not really make sense and it is not
needed. Get rid of it.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2007-12-26 19:15:17 +02:00
Artem Bityutskiy cdfa788acd UBI: prepare attach and detach functions
Prepare the attach and detach functions to by used outside of
module initialization:

* detach function checks reference count before detaching
* it kills the background thread as well

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2007-12-26 19:15:17 +02:00
Artem Bityutskiy e73f4459d9 UBI: add UBI devices reference counting
This is one more step on the way to "removable" UBI devices. It
adds reference counting for UBI devices. Every time a volume on
this device is opened - the device's refcount is increased. It
is also increased if someone is reading any sysfs file of this
UBI device or of one of its volumes.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2007-12-26 19:15:17 +02:00
Artem Bityutskiy 9f961b5756 UBI: add UBI control device
This patch is a preparation to make UBI devices dynamic. It
adds an UBI control device which has dynamically allocated
major number and registers itself as "ubi_ctrl". It does not
do anything so far. The idea is that this device will allow
to attach/detach MTD devices from userspace.

This is symilar to what the Linux device mapper has.

The next things to do are:
* Fix UBI, because it now assumes UBI devices cannot go away
* Implement control device ioctls which will attach/detach MTD
  devices

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2007-12-26 19:15:17 +02:00
Artem Bityutskiy 16f557ecbf UBI: fix comment
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2007-12-26 19:15:16 +02:00
Artem Bityutskiy 593dd33c92 UBI: fix ubi_wl_flush
The flush function should finish all the pending jobs. But if
somebody else is doing a work, this function should wait and let
it finish.

This patche uses rw semaphore for synchronization purpose - it
just looks quite convinient.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2007-12-26 19:15:16 +02:00
Artem Bityutskiy 458dbb3d07 UBI: fix printk
Add proper log level to printk's.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2007-12-26 19:15:16 +02:00
Artem Bityutskiy 43f9b25a9c UBI: bugfix: protect from volume removal
When the WL worker is moving an LEB, the volume might go away
occasionally. UBI does not handle these situations correctly.

This patch introduces a new mutex which serializes wear-levelling
worker and the the 'ubi_wl_put_peb()' function. Now, if one puts
an LEB, and its PEB is being moved, it will wait on the mutex.
And because we unmap all LEBs when removing volumes, this will make
the volume remove function to wait while the LEB movement
finishes.

Below is an example of an oops which should be fixed by this patch:

Pid: 9167, comm: io_paral Not tainted (2.6.24-rc5-ubi-2.6.git #2)
EIP: 0060:[<f884a379>] EFLAGS: 00010246 CPU: 0
EIP is at prot_tree_del+0x2a/0x63 [ubi]
EAX: f39a90e0 EBX: 00000000 ECX: 00000000 EDX: 00000134
ESI: f39a90e0 EDI: f39a90e0 EBP: f2d55ddc ESP: f2d55dd4
 DS: 007b ES: 007b FS: 00d8 GS: 0033 SS: 0068
Process io_paral (pid: 9167, ti=f2d54000 task=f72a8030 task.ti=f2d54000)
Stack: f39a95f8 ef6aae50 f2d55e08 f884a511 f88538e1 f884ecea 00000134 00000000
       f39a9604 f39a95f0 efea8280 00000000 f39a90e0 f2d55e40 f8847261 f8850c3c
       f884eaad 00000001 000000b9 00000134 00000172 000000b9 00000134 00000001
Call Trace:
 [<c0105227>] show_trace_log_lvl+0x1a/0x30
 [<c01052e2>] show_stack_log_lvl+0xa5/0xca
 [<c01053d6>] show_registers+0xcf/0x21b
 [<c0105648>] die+0x126/0x224
 [<c0119a62>] do_page_fault+0x27f/0x60d
 [<c037dd62>] error_code+0x72/0x78
 [<f884a511>] ubi_wl_put_peb+0xf0/0x191 [ubi]
 [<f8847261>] ubi_eba_unmap_leb+0xaf/0xcc [ubi]
 [<f8843c21>] ubi_remove_volume+0x102/0x1e8 [ubi]
 [<f8846077>] ubi_cdev_ioctl+0x22a/0x383 [ubi]
 [<c017d768>] do_ioctl+0x68/0x71
 [<c017d7c6>] vfs_ioctl+0x55/0x271
 [<c017da15>] sys_ioctl+0x33/0x52
 [<c0104152>] sysenter_past_esp+0x5f/0xa5
 =======================

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2007-12-26 19:15:16 +02:00
Artem Bityutskiy d2c4685509 UBI: improve comment
Explain better the purpose of thie 'move_to_put' stuff.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2007-12-26 19:15:16 +02:00
Artem Bityutskiy d19bafd99d UBI: add PID to debugging prints
Also, use single dbg_msg() macro for all prints.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2007-12-26 19:15:16 +02:00
Artem Bityutskiy 40e4d0c166 UBI: tweak volumes locking some more
Make the code more consistent by requiring the caller to lock the
ubi->volume_mutex, because this is what we do for updates.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2007-12-26 19:15:16 +02:00
Artem Bityutskiy d05c77a816 UBI: introduce volume refcounting
Add ref_count field to UBI volumes and remove weired "vol->removed"
field. This way things are better understandable and we do not have
to do whold show_attr operation under spinlock.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2007-12-26 19:15:16 +02:00
Artem Bityutskiy db6e5770ef UBI: simplify error handling
If we fail halfway through sysfs file creation, we may just call
sysfs remove function and it will delete all the files we created.
For non-existing files it will also be OK - the remove functions
just return -ENOENT.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2007-12-26 19:15:15 +02:00
Artem Bityutskiy 35ad5fb76c UBI: fix and cleanup volume opening functions
This patch fixes error codes of the functions - if the device number
is out of range, -EINVAL should be returned. It also removes unneeded
try_module_get call from the open by name function.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2007-12-26 19:15:15 +02:00
Artem Bityutskiy fc75a1e166 UBI: fix error path
Error path in volume creation is bogus. First of, it ovverrides the
'err' variable and returns zero to the caller. Second, ubi_assert()
in the release function is wrong.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2007-12-26 19:15:15 +02:00
Artem Bityutskiy 450f872a8e UBI: get device when opening volume
When a volume is opened, get its kref via get_device() call.
And put the reference when closing the volume. With this, we
may have a bit saner volume delete.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2007-12-26 19:15:15 +02:00
Artem Bityutskiy c63a491d37 UBI: add some more comments
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2007-12-26 19:15:15 +02:00
Artem Bityutskiy cae0a77125 UBI: tweak volumes locking
Transform vtbl_mutex to volumes_mutex - this just makes code
easier to understand.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2007-12-26 19:15:15 +02:00
Artem Bityutskiy 89b96b6929 UBI: improve internal interfaces
Pass volume description object to the EBA function which makes
more sense, and EBA function do not have to find the volume
description object by volume ID.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2007-12-26 19:15:15 +02:00
Artem Bityutskiy 77c722dde9 UBI: bugfix: dont oops with NULL module parameter
E.g., it oopsed in case of: modprobe ubi mtd = 0

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2007-12-26 19:15:15 +02:00
Artem Bityutskiy b96bf4c33d UBI: remove ubi_devices_cnt
This global variablea is not really needed, remove it

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2007-12-26 19:15:15 +02:00
Artem Bityutskiy 06b68ba156 UBI: create ubi_wl_entry slab on initialization
Similarly to ltree_entry_slab, it makes more sense to create
and destroy ubi_wl_entry slab on module initialization/exit.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2007-12-26 19:15:14 +02:00
Artem Bityutskiy 3a8d464286 UBI: create ltree_entry slab on initialization
Since the ltree_entry slab cache is a global entity, which is
used by all UBI devices, it is more logical to create it on
module initialization time and destro on module exit time.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2007-12-26 19:15:14 +02:00
Artem Bityutskiy 01f7b309e4 UBI: improve error messages
Always print error code with error messages, sometimes it is
extremely helpful info.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2007-12-26 19:15:14 +02:00
Artem Bityutskiy 49dfc29928 UBI: remove redundant field
Remove redundant ubi->major field - we have it in ubi->cdev.dev
already.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2007-12-26 19:15:14 +02:00
Artem Bityutskiy 732aeacff6 UBI: minor tidy-ups
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2007-12-26 19:15:14 +02:00
Jesper Juhl 54b2c8f93d UBI: silence a warning
This patch silences the following warning :

  drivers/mtd/ubi/vmt.c:73: warning: 'ret' may be used uninitialized in this function

gcc can't see that we always initialize ret in all situations where it is
actually used. The one case where it's not initialized is when we BUG(),
but gcc doesn't know that we won't then continue and use an uninitialized
'ret'.

This patch results in code that does exactely the same as before, but it
also makes gcc shut up, so we generate one less line of warning noise.

Signed-off-by: Jesper Juhl <jesper.juhl@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2007-12-26 19:15:14 +02:00
Artem Bityutskiy 393852ecfe UBI: add ubi_leb_map interface
The idea of this interface belongs to Adrian Hunter. The
interface is extremely useful when one has to have a guarantee
that an LEB will contain all 0xFFs even in case of an unclean
reboot. UBI does have an 'ubi_leb_erase()' call which may do
this, but it is stupid and ineffecient, because it flushes whole
queue. I should be re-worked to just be a pair of unmap,
map calls.

The user of the interfaci is UBIFS at the moment.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2007-12-26 19:15:14 +02:00
Artem Bityutskiy 94780d4de2 UBI: bugfix: allocate mandatory EBs first
First allocate the necessary eraseblocks, then the optional ones.
Otherwise it allocates all PEBs for bad EB handling, and fails
on then following EBA LEB allocation.

Reported-by: Adrian Hunter <ext-adrian.hunter@nokia.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2007-12-26 19:15:14 +02:00
Artem Bityutskiy 2362a53ec5 UBI: fix error code in ubi_io_read()
When NAND detects an ECC error, it returns -EBADMSG. It does not
stop reading requested data if one page has an ECC error, it keeps
going and reads all the requested data. If it fails to read all
the data, it does not return -EBADMSG, but returns the error code
which reflects the reason of the failure.

But some drivers may have bugs (e.g., OneNAND had) and stop reading
after the first ECC error, so it returns -EBADMSG. In turn, UBI
propagates this up to the caller. The caller will treat this as
"all the requested data was read, but there was an ECC error".

So we change the error code to -EIO if it is -EBADMSG and the read
length is less then the requested length. We also add an assertion,
so if UBI debugging is enabled, UBI will bug.

Pointed-to-by: Adrian Hunter <ext-adrian.hunter@nokia.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2007-12-26 19:15:13 +02:00
Peter Korsgaard 235d6200ea [MTD] mtdoops cleanup
Use memcpy instead of open coding a copy loop.

Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-12-03 14:00:16 +00:00
Peter Korsgaard 256331d53a [MTD] mtdoops: Document usage in Kconfig
Add usage instructions to Kconfig for mtdoops driver.

Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-12-03 14:00:06 +00:00
Tzachi Perelstein 2a1dba2931 [MTD] [NAND] Marvell Orion device bus NAND controller
Driver for the device bus NAND controller in the Marvell Orion family
of ARM SoCs.

Signed-off-by: Tzachi Perelstein <tzachi@marvell.com>
Signed-off-by: Lennert Buytenhek <buytenh@marvell.com>
Acked-by: Jörn Engel <joern@logfs.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-12-03 13:03:46 +00:00
David Woodhouse cec80bf2cc [MTD] [NOR] Attempt to clean up the JEDEC unlock address confusion
Use a single unlock address, adjust it for the device type in the
knowledge that it'll be adjusted back again. This has the desirable
effect of masking out the least significant bit of the address for x16
devices.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-12-03 13:01:21 +00:00
David Woodhouse f6f0f81895 [MTD] [NOR] Fix overflow check in jedec_probe
Having laid the code out so that it's easier to read instead of sticking
to the 80-column guideline even when it doesn't make sense, a bug is
immediately spotted... we were only checking _one_ of the unlock
addresses to see if it runs off the end of the map.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-12-03 12:49:38 +00:00
David Woodhouse 5d3cce3b8e [MTD] [NOR] Clean up jedec_probe, remove unlock address arrays
This should have no functional effects -- we've been ignoring all but
the first address in the array for a long time, and using it only to
indicate which device types are supported.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-12-03 12:48:57 +00:00
David Woodhouse ce37ab42ad [MTD] Always initialise mutex in new mtd_blktrans_dev.
We were only initialising the mutex in the case where the new device was
automatically allocated the highest minor number. If the caller
specified a minor number, or if it filled in a free slot which was made
by a previous device deregistering, the mutex wouldn't get initialised
when we jumped out of the loop.

Reported by Monte Copeland <catboat@texas.net>

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-12-03 12:46:12 +00:00
Egor Martovetsky 846fc31d06 [MTD] [NAND] pasemi_nand driver
Plumbing for NAND connected via localbus on PA Semi PWRficient-based
boards.

From: Egor Martovetsky <egor@pasemi.com>
Signed-off-by: Olof Johansson <olof@lixom.net>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-11-29 00:47:13 +00:00
Ben Dooks 03680b1e00 [MTD] [NAND] S3C2410 correctly set nFCE over resume
Ensure the nFCE line is de-asserted over suspend and
then re-initialised when the system resumes. This is
to ensure that the NAND is kept in lowest power mode
over suspend (power settings are only specified for
nFCE inactive) as well as fixing the Simtec Osiris
which relies on nFCE being inactive.

Signed-off-by: Ben Dooks <ben-linux@fluff.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-11-28 11:57:45 +00:00
Stanislav Brabec 73061e4c2d [MTD] fix CONFIG_MTD_SHARP_SL if CONFIG_MTD=m
Sharp Zaurus SL-C3200 with CONFIG_MTD=m and CONFIG_MTD_SHARP_SL=y (as it
is bool) lost support for the ROM flash. With CONFIG_MTD=y it has no
problems.

It is caused by losing of compiled code of
drivers/mtd/maps/sharpsl-flash.o.
It was linked to drivers/mtd/maps/built-in.o and drivers/mtd/built-in.o,
but lost and not linked to drivers/built-in.o (because CONFIG_MTD!=y).

Patch below fixes this problem by creating sharpsl-flash.ko (and the
code works correctly as a module).

Signed-off-by: Stanislav Brabec <utx@penguin.cz>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-11-28 11:56:19 +00:00
Andrew Victor cccb45d4b3 [MTD] mtd_dataflash: Incorrect compare-after-write check
After writing to a Dataflash page, the built-in compare operation is
used to check that the page was successfully written.  A logic bug in
checking the results of the comparison currently causes the compare to
never fail.

This bug was originally in the legacy at91_dataflash.c driver.

Signed-off-by: Andrew Victor <andrew@sanpeople.com>
Acked-by: David Brownell <david-b@pacbell.net>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-11-28 11:55:32 +00:00
Alexander Belyakov 6c24e4161e [MTD] [NOR] Prevent erase command invocation on suspended chip
while running stress tests we have met cfi_cmdset_0001.c driver issue.
Working on multipartitional devices with erase suspend on write
feature enabled it is possible to get erase operation invoked on chip
with suspended erase. get_chip() looses information about earlier
suspended erase and new erase operation gets issued. New erase
operations report successful completion, but blocks remain dirty
causing, for example, JFFS2 error messages like:

...
Newly-erased block contained word 0x20031985 at offset 0x00200000
Newly-erased block contained word 0x20031985 at offset 0x00280000
Newly-erased block contained word 0x20031985 at offset 0x00240000
...

The patch below fixes that issue.

Signed-off-by: Alexander Belyakov <alexander.belyakov@intel.com>
Acked-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-11-26 15:54:16 +00:00
Adrian Hunter 5f4d47d5d1 [MTD] [OneNAND] Do not stop reading for ECC errors
When an ECC error occurs, the read should be completed
anyway before returning -EBADMSG.  Returning -EBADMSG
straight away is incorrect.

Signed-off-by: Adrian Hunter <ext-adrian.hunter@nokia.com>
Acked-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-11-26 13:16:29 +00:00
Alexey Korolev b1c9c9be6d [MTD] [NOR] Support Intel P3x flash support with CFI version 1.5
Signed-off-by: Alexey Korolev <akorolev@infradead.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-11-23 09:35:41 +00:00
David Howells 8547e583a1 [MTD] [NOR] Add support for the SST 39VF1601 flash chip
Add support for the SST 39VF1601 flash chip.

Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-11-09 22:34:07 +00:00
Hans-Christian Egtvedt d10a39d1a5 [MTD] [NOR] More CFI fixups for Atmel chips
Convert CFI tables from Atmel cmdset_0001 chips to Intel format and set
BufWrite timeouts to 0 for Atmel cmdset_0001 and cmdset_0002 chips.
Some chips may indicate support for buffered writes even though they
only support dual-word writes.

The CFI fixup must run before fixup_use_write_buffers for this to work.

Signed-off-by: Håvard Skinnemoen <hskinnemoen@atmel.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-10-30 12:06:42 -04:00
Valentine Barshak 4edaf56e0f MTD: small physmap_of partition parsing fixes
Use of_get_next_child for proper ref counting as suggested by Stephen Rothwell
and remove add_mtd_partitions from parse_partitions to avoid duplicate
mtd device registration for RedBoot partitions.

Signed-off-by: Valentine Barshak <vbarshak@ru.mvista.com>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
Heckled-for-on-IRC-by: Josh Boyer <jwboyer@linux.vnet.ibm.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-10-30 08:54:39 -04:00
Michael Hennerich a25b7fee53 [MTD] [NAND] Add Blackfin BF52x support in bf5xx_nand driver
Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Bryan Wu <bryan.wu@analog.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-10-30 08:50:46 -04:00
David Woodhouse 3c441baa03 [MTD] Skip bad blocks when checking for RedBoot partition table
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-10-28 21:57:02 -04:00
David Woodhouse 9c37f3329a [MTD] [NAND] Check for RedBoot partitions on CAFÉ NAND
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-10-28 21:56:39 -04:00
Jeff Garzik 06efcad0d4 Eliminate pointless casts from void* in a few driver irq handlers.
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2007-10-23 19:53:16 -04:00
Alexey Korolev 5a37cf19ef [MTD] [NOR] Fix deadlock in Intel chip driver caused by get_chip recursion
This patch solves kernel deadlock issue seen on JFFF2 simultaneous 
operations. Detailed investigation of the issue showed that the kernel 
deadlock is caused by tons of recursive get_chip calls.

Signed-off-by: Alexey Korolev <akorolev@infradead.org>
Acked-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-10-23 12:07:52 +01:00
Kyungmin Park c21f900cb8 [MTD] [OneNAND] Fix wrong free the static address in onenand_sim
Reported-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-10-22 09:57:28 +01:00
Jörn Engel eb68450715 [MTD] [NAND] Replace -1 with -EBADMSG in nand error correction code
Magic numerical values are just bad style.  Particularly so when
undocumented.

Signed-off-by: Jörn Engel <joern@logfs.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-10-20 22:30:54 +01:00
Matt Reimer c32b8dcc45 [MTD] [NAND] treat any negative return value from correct() as an error
Treat any negative return value from a NAND driver's correct() function
as a failure, rather than just -1.

Signed-off-by: Matt Reimer <mreimer@vpop.net>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-10-20 22:27:22 +01:00
Artem Bityutskiy 39e73fc10e [MTD] [NAND] nandsim: bugfix in initialization
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>
2007-10-20 15:00:29 +01:00
Dave Jones 42265940ed [MTD] Fix typo in Alauda config option help text.
Signed-off-by: Dave Jones <davej@redhat.com>
Signed-off-by: Joern Engel <joern@logfs.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-10-20 14:59:26 +01:00
Matt Reimer b773bb2e70 [MTD] [NAND] add s3c2440-specific read_buf/write_buf
Add read_buf/write_buf for s3c2440, which can read/write 32 bits at a
time rather than just 8. In my testing on an s3c2440a running at 400 MHz
with a 100 MHz HCLK, read performance improves by 36% (from 5.19 MB/s
to 7.07 MB/s).

Signed-off-by: Matt Reimer <mreimer@vpop.net>
Acked-by: Ben Dooks <ben-linux@fluff.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-10-20 14:54:26 +01:00
Randy Dunlap 19e75ea72b [MTD] [OneNAND] onenand-sim: fix kernel-doc and typos
Correct kernel-doc notation and descriptions.
Correct other typos.

Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-10-20 14:11:44 +01:00
Matt LaPlante 01dd2fbf0d typo fixes
Most of these fixes were already submitted for old kernel versions, and were
approved, but for some reason they never made it into the releases.

Because this is a consolidation of a couple old missed patches, it touches both
Kconfigs and documentation texts.

Signed-off-by: Matt LaPlante <kernel1@cyberdogtech.com>
Acked-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: Adrian Bunk <bunk@kernel.org>
2007-10-20 01:34:40 +02:00
Pavel Emelyanov ba25f9dcc4 Use helpers to obtain task pid in printks
The task_struct->pid member is going to be deprecated, so start
using the helpers (task_pid_nr/task_pid_vnr/task_pid_nr_ns) in
the kernel.

The first thing to start with is the pid, printed to dmesg - in
this case we may safely use task_pid_nr(). Besides, printks produce
more (much more) than a half of all the explicit pid usage.

[akpm@linux-foundation.org: git-drm went and changed lots of stuff]
Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Cc: Dave Airlie <airlied@linux.ie>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-10-19 11:53:43 -07:00
Joe Perches 898eb71cb1 Add missing newlines to some uses of dev_<level> messages
Found these while looking at printk uses.

Add missing newlines to dev_<level> uses
Add missing KERN_<level> prefixes to multiline dev_<level>s
Fixed a wierd->weird spelling typo
Added a newline to a printk

Signed-off-by: Joe Perches <joe@perches.com>
Cc: "Luck, Tony" <tony.luck@intel.com>
Cc: Jens Axboe <jens.axboe@oracle.com>
Cc: Mark M. Hoffman <mhoffman@lightlink.com>
Cc: Roland Dreier <rolandd@cisco.com>
Cc: Tilman Schmidt <tilman@imap.cc>
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: Jeff Garzik <jeff@garzik.org>
Cc: Stephen Hemminger <shemminger@linux-foundation.org>
Cc: Greg KH <greg@kroah.com>
Cc: Jeremy Fitzhardinge <jeremy@goop.org>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Cc: David Brownell <david-b@pacbell.net>
Cc: James Smart <James.Smart@Emulex.Com>
Cc: Andrew Vasquez <andrew.vasquez@qlogic.com>
Cc: "Antonino A. Daplas" <adaplas@pol.net>
Cc: Evgeniy Polyakov <johnpol@2ka.mipt.ru>
Cc: Russell King <rmk@arm.linux.org.uk>
Cc: Jaroslav Kysela <perex@suse.cz>
Cc: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-10-18 14:37:28 -07:00
Christoph Lameter 4ba9b9d0ba Slab API: remove useless ctor parameter and reorder parameters
Slab constructors currently have a flags parameter that is never used.  And
the order of the arguments is opposite to other slab functions.  The object
pointer is placed before the kmem_cache pointer.

Convert

        ctor(void *object, struct kmem_cache *s, unsigned long flags)

to

        ctor(struct kmem_cache *s, void *object)

throughout the kernel

[akpm@linux-foundation.org: coupla fixes]
Signed-off-by: Christoph Lameter <clameter@sgi.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-10-17 08:42:45 -07:00
Linus Torvalds 355aaffdaf Reinstate lost flush_ioremap_region() fix to pxa2xx-flash driver
Commit 90833fdab8 ("[ARM] 4554/1: replace
consistent_sync() with flush_ioremap_region()") introduced a new
"flush_ioremap_region()" function to be used by the MTD mainstone-flash
and lubbock-flash drivers to fix a regression from around 2.6.18.

Those drivers were independently merged into a single driver by Todd
Poynor in commit e644f7d628 ("[MTD] MAPS:
Merge Lubbock and Mainstone drivers into common PXA2xx driver")

Later, those two commits were merged into the main MTD tree by commit
b160292cc2 ("Merge Linux 2.6.23") by David
Woodhouse, but in that merge, the fix to use flush_iomap_region() got
lost (as it was to files that now no longer existed).

This reinstates the fix in the new driver.

Noticed-by: Russell King <rmk@arm.linux.org.uk>
Tested-and-acked-by: Nicolas Pitre <nico@cam.org>
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: Jared Hulbert <jaredeh@gmail.com>
Cc: Todd Poynor <tpoynor@mvista.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-10-15 12:55:20 -07:00
Al Viro 64a6f9500d signedness: module_param_array nump argument
... should be unsigned int

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-10-14 12:41:52 -07:00
David Woodhouse e3d18658d4 Merge branch 'master' of git://git.infradead.org/~dedekind/ubi-2.6 2007-10-14 14:29:00 +01:00
Chris Paulson-Ellis a2e1b833d9 [MTD] fix mtdconcat for subpage-write NAND
This allows the mtdconcat driver to work with NAND flash devices that
support sub-page writes.

Signed-off-by: Chris Paulson-Ellis <chris@edesix.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-10-14 13:38:02 +01:00
Adrian Hunter 3cd3a86b6f [MTD] [OneNAND] 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.

This patch mirrors that same change already done for NAND.

Signed-off-by: Adrian Hunter <ext-adrian.hunter@nokia.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-10-14 13:37:53 +01:00
Adrian Hunter 30a7eb298a [MTD] [OneNAND] Return only negative error codes
The OneNAND driver was confusing JFFS2 by returning positive error
codes.

Signed-off-by: Adrian Hunter <ext-adrian.hunter@nokia.com>
Acked-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-10-14 13:37:41 +01:00
Adrian Hunter 34627f0e76 [MTD] [OneNAND] Synchronize block locking operations
Ensure OneNAND's block locking operations are synchronized
like all other operations.

Signed-off-by: Adrian Hunter <ext-adrian.hunter@nokia.com>
Acked-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-10-14 13:37:28 +01:00
Artem Bityutskiy cc5f4f2875 UBI: return correct error code
Fix the following warning:

drivers/mtd/ubi/eba.c: In function 'ubi_eba_init_scan':
drivers/mtd/ubi/eba.c:1116: warning: 'err' may be used uninitialized in this function

Pointed-to-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2007-10-14 13:10:21 +03:00
Artem Bityutskiy 5abde384e3 UBI: remove useless inlines
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2007-10-14 13:10:21 +03:00
Artem Bityutskiy e8823bd63d UBI: fix atomic LEB change problems
When the UBI device is nearly full, i.e. all LEBs are mapped, we have
only one spare LEB left - the one we reserved for WL purposes. Well,
I do not count the LEBs which were reserved for bad PEB handling -
suppose NOR flash for simplicity. If an "atomic LEB change operation"
is run, and the WL unit is moving a LEB, we have no spare LEBs to
finish the operation and fail, which is not good. Moreover, if there
are 2 or more simultanious "atomic LEB change" requests, only one of
them has chances to succeed, the other will fail with -ENOSPC. Not
good either.

This patch does 2 things:
1. Reserves one PEB for the "atomic LEB change" operation.
2. Serealize the operations so that only on of them may run
   at a time (by means of a mutex).

Pointed-to-by: Brijesh Singh <brijesh.s.singh@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2007-10-14 13:10:21 +03:00
Artem Bityutskiy 6986646ba7 UBI: use byte hexdump
More handy since word hexdump prints in host endian.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2007-10-14 13:10:21 +03:00
Artem Bityutskiy e88d6e10e5 UBI: do not use vmalloc on I/O path
Similar reason as in case of the previous patch: it causes
deadlocks if a filesystem with writeback support works on top
of UBI. So pre-allocate needed buffers when attaching MTD device.
We also need mutexes to protect the buffers, but they do not
cause much contantion because they are used in recovery, torture,
and WL copy routines, which are called seldom.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2007-10-14 13:10:21 +03:00
Artem Bityutskiy 33818bbb84 UBI: allocate memory with GFP_NOFS
Use GFP_NOFS flag when allocating memory on I/O path, because otherwise
we may deadlock the filesystem which works on top of us. We observed
the deadlocks with UBIFS. Example:

VFS->FS lock a lock->UBI->kmalloc()->VFS writeback->FS locks the same
lock again.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2007-10-14 13:10:20 +03:00
Artem Bityutskiy ef6075fbfc UBI: use linux print_hex_dump(), not home-grown one
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2007-10-14 13:10:20 +03:00
Jesper Juhl 0169b49d52 UBI: don't use array index before testing if it is negative
I can't find anything guaranteeing that 'ubi_num' cannot be <0 in
drivers/mtd/ubi/kapi.c::ubi_open_volume(), and in fact the code
even tests for that and errors out if so. Unfortunately the test
for "ubi_num < 0" happens after we've already used 'ubi_num' as
an array index - bad thing to do if it is negative.
This patch moves the test earlier in the function and then moves
the indexing using that variable after the check. A bit safer :-)

Signed-off-by: Jesper Juhl <jesper.juhl@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2007-10-14 13:10:20 +03:00
Artem Bityutskiy 8d2d4011f1 UBI: add more prints
I hit those situations and found out lack of print messages. Add more prints
when erase problems occur.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2007-10-14 13:10:20 +03:00
Artem Bityutskiy 8bc2296196 UBI: fix sparse warnings
Fix "symbol shadows an earlier one" warnings. Although they are harmless
but it does not hurt to fix them and make sparse happy.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2007-10-14 13:10:20 +03:00
Florin Malita dcec4c3bdc UBI: fix leak in ubi_scan_erase_peb
Coverity (1769) found the following problem: if the erase counter
overflow check triggers, ec_hdr is leaked.

Moving the allocation after the overflow check should take care of it.

Signed-off-by: Florin Malita <fmalita@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2007-10-14 13:10:20 +03:00
David Woodhouse ebf8889bd1 Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6 2007-10-13 14:58:23 +01:00
David Woodhouse b160292cc2 Merge Linux 2.6.23 2007-10-13 14:43:54 +01:00
Bryan Wu b37bde1478 [MTD] [NAND] Blackfin on-chip NAND Flash Controller driver
This is the driver for latest Blackfin on-chip nand flash controller

 - use nand_chip and mtd_info common nand driver interface
 - provide both PIO and dma operation
 - compiled with ezkit bf548 configuration
 - use hardware 1-bit ECC
 - tested with YAFFS2 and can mount YAFFS2 filesystem as rootfs

ChangeLog from try#1
 - use hweight32() instead of count_bits()
 - replace bf54x with bf5xx and BF54X with BF5XX
 - compare against plat->page_size in 2 cases when enable hardware ECC

ChangeLog from try#2
 - passed nand_test suites
 - use cpu_relax() instead of busy wait loop
 - some coding style issue pointed out by Andrew

Signed-off-by: Bryan Wu <bryan.wu@analog.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-10-13 14:36:49 +01:00
Kevin Hao c4a9f88daf [MTD] [NOR] fix ctrl-alt-del can't reboot for intel flash bug
When we press ctrl-alt-del,kernel_restart_prepare will invoke 
cfi_intelext_reboot which will set flash to read array mode, but later 
when device_shutdown is invoked which may put current work queue to 
sleep and other process may be scheduled to running and programming 
flash in not FL_READY mode again. So we can't boot up if this flash is 
used for bootloader.

Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-10-13 14:36:18 +01:00
akpm@linux-foundation.org f96880d1e8 [MTD] [NAND] Fix compiler warning in Alauda driver
drivers/mtd/nand/alauda.c: In function 'alauda_bounce_read':
drivers/mtd/nand/alauda.c:412: warning: comparison of distinct pointer types lacks a cast

Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-10-13 14:33:27 +01:00
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
David Gibson c4d5e37547 [POWERPC] Cleanups for physmap_of.c (v2)
This patch includes a whole batch of smallish cleanups for
drivers/mtd/physmap_of.c.

	- A bunch of uneeded #includes are removed
	- We switch to the modern linux/of.h etc. in place of
asm/prom.h
	- Use some helper macros to avoid some ugly inline #ifdefs
	- A few lines of unreachable code are removed
	- A number of indentation / line-wrapping fixes
	- More consistent use of kernel idioms such as if (!p) instead
of if (p == NULL)
	- Clarify some printk()s and other informative strings.
	- parse_obsolete_partitions() now returns 0 if no partition
information is found, instead of returning -ENOENT which the caller
had to handle specially.
	- (the big one) Despite the name, this driver really has
nothing to do with drivers/mtd/physmap.c.  The fact that the flash
chips must be physically direct mapped is a constrant, but doesn't
really say anything about the actual purpose of this driver, which is
to instantiate MTD devices based on information from the device tree.
Therefore the physmap name is replaced everywhere within the file with
"of_flash".  The file itself and the Kconfig option is not renamed for
now (so that the diff is actually a diff).  That can come later.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Josh Boyer <jwboyer@linux.vnet.ibm.com>
2007-09-20 07:37:16 -05:00
Josh Boyer 8d9ae994d8 [POWERPC] Make partitions optional in physmap_of
The latest physmap_of driver has a small error where it will fail the probe
with:

physmap-flash: probe of fff00000.small-flas failed with error -2

if there are no partition subnodes in the device tree and the old style binding
is not used.  Since partition definitions are optional, the probe should still
succeed.

Signed-off-by: Josh Boyer <jwboyer@linux.vnet.ibm.com>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
2007-09-19 21:13:16 -05:00
Paul Mackerras 0ce49a3945 Merge branch 'linux-2.6' 2007-09-20 10:09:27 +10:00
Kees Cook 248bdd5efc pci: fix unterminated pci_device_id lists
Fix a couple drivers that do not correctly terminate their pci_device_id
lists.  This results in garbage being spewed into modules.pcimap when the
module happens to not have 28 NULL bytes following the table, and/or the
last PCI ID is actually truncated from the table when calculating the
modules.alias PCI aliases, cause those unfortunate device IDs to not
auto-load.

Signed-off-by: Kees Cook <kees@ubuntu.com>
Acked-by: Corey Minyard <minyard@acm.org>
Cc: David Woodhouse <dwmw2@infradead.org>
Acked-by: Jeff Garzik <jeff@garzik.org>
Cc: Greg KH <greg@kroah.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-09-19 11:24:17 -07:00
David Gibson 2099172d61 [POWERPC] Document and implement an improved flash device binding for powerpc
This replaces the binding for flash chips in booting-without-of.txt
with an clarified and improved version.  It also makes
drivers/mtd/maps/physmap_of.c recognize this new binding.  Finally it
revises the Ebony device tree source to use the new binding as an
example.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Acked-by: Segher Boessenkool <segher@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2007-09-14 01:33:25 +10:00
Paul Mackerras b2315372ea Merge branch 'linux-2.6' into for-2.6.24 2007-09-14 01:24:25 +10: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
David Howells 48440e893d [MTD] Initialise s_flags in get_sb_mtd_aux()
Initialise s_flags in get_sb_mtd_aux() from the flags parameter.

Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-09-02 18:18:46 +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
Jared Hulbert 90833fdab8 [ARM] 4554/1: replace consistent_sync() with flush_ioremap_region()
This fixes a regression from around 2.6.18, consistent_sync() will now BUG()
under these circumstances.  The use of consistent_sync() was a hack, replacing
it's usage here with a new function, flush_ioremap_region().

Signed-off-by: Jared Hulbert <jaredeh@gmail.com>
Acked-by: Pavel Pisa <pisa@cmp.felk.cvut.cz>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2007-08-23 12:31:31 +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
David Gibson 0d279d4761 [POWERPC] Fixes to allow use of Ebony's flash chips through physmap_of
This patch contains a handful of small fixes to allow the Ebony's
flash to be exposed as MTD devices via the physmap_of driver.
Specifically it:
	- Makes a small addition to the device tree and zImage wrapper
to record the correct address for the flash in the device tree based
on the board switches as reported via an FPGA register.
	- Prohibits building the old hard-coded "Ebony" flash map on
arch/powerpc kernels, in favour of using physmap_of's device tree
based approach.
	- Enables MTD and physmap_of in the Ebony defconfig.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2007-08-17 11:01:51 +10: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