Commit Graph

91878 Commits

Author SHA1 Message Date
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
Anders Grafström
8a0f572397 [JFFS2] Return values of jffs2_block_check_erase error paths
It looks the error paths in jffs2_block_check_erase() have wrong return 
values. A block that failed to be erased never gets marked as bad.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2008-04-23 10:06:46 +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
David Woodhouse
19e56ceae7 [JFFS2] Finally remove redundant ref->__totlen field.
Haven't had any complaints about it recently, despite having the test
code enabled to verify that the calculated length is correct.

Kill it off, just by #undef TEST_TOTLEN for now; removing it for real
can come a little later.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2008-04-23 01:26:12 +01:00
David Woodhouse
27e6b8e388 [JFFS2] Honour TEST_TOTLEN macro in debugging code. ref->__totlen is going!
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2008-04-23 01:25:33 +01:00
David Woodhouse
85a62db624 [JFFS2] Add paranoia debugging for superblock counts
The problem fixed in commit 014b164e13
(space leak with in-band cleanmarkers) would have been caught a lot
quicker if our paranoid debugging mode had included adding up the size
counts from all the eraseblocks and comparing the totals with the counts
in the superblock. Add that.

Make jffs2_mark_erased_block() file the newly-erased block on the
free_list before calling the debug function, to make it happy.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2008-04-23 01:24:17 +01:00
David Woodhouse
014b164e13 [JFFS2] Fix free space leak with in-band cleanmarkers
We were accounting for the cleanmarker by calling jffs2_link_node_ref()
(without locking!), which adjusted both superblock and per-eraseblock
accounting, subtracting the size of the cleanmarker from {jeb,c}->free_size
and adding it to {jeb,c}->used_size.

But only _then_ were we adding the size of the newly-erased block back
to the superblock counts, and we were adding each of jeb->{free,used}_size
to the corresponding superblock counts. Thus, the size of the cleanmarker
was effectively subtracted from the superblock's free_size _twice_.

Fix this, by always adding a full eraseblock size to c->free_size when
we've erased a block. And call jffs2_link_node_ref() under the proper
lock, while we're at it.

Thanks to Alexander Yurchenko and/or Damir Shayhutdinov for (almost)
pinpointing the problem.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2008-04-22 23:54:38 +01:00
David Woodhouse
cf9d1e428c [JFFS2] Self-sufficient #includes in jffs2_fs_i.h: include <linux/mutex.h>
... instead of <linux/semaphore.h> which we don't need any more anyway.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2008-04-22 23:53:26 +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
David Woodhouse
ced2207036 [JFFS2] semaphore->mutex conversion
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2008-04-22 15:13:40 +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