Commit Graph

829 Commits (4a537a5518e81dba342eccbffcfa5c27cb5781d4)

Author SHA1 Message Date
Adrian Hunter a5ac8aeb29 [MTD] nandsim: enhance nandsim to allow arbitrary NAND size
A new module parameter has been added called 'overridesize',
which overrides the size that would be determined by the
ID bytes. 'overridesize' is specified in erase blocks and
as the exponent of a power of two e.g. 5 means a size of
32 erase blocks.

Signed-off-by: Adrian Hunter <ext-adrian.hunter@nokia.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-04-17 13:55:55 -04:00
Adrian Hunter 57aa6b545f [MTD] nandsim: Enhance nandsim optionally to report wear information
A new module parameter 'rptwear' specifies how many erases between
reporting wear information.  Zero means never.

Signed-off-by: Adrian Hunter <ext-adrian.hunter@nokia.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-04-17 13:55:29 -04:00
Adrian Hunter 514087e74f [MTD] nandsim: enhance nandsim to simulate flash errors
New module parameters have been added to nandsim to
simulate:

        bitflips        random bit flips
        badblocks       blocks that are initially marked bad
        weakblocks      blocks that fail to erase after a
                        small number of erase cycles
        weakpages       pages that fail to write after a
                        small number of successful writes
        gravepages      pages that fail to read after a
                        small number of successful reads

Signed-off-by: Adrian Hunter <ext-adrian.hunter@nokia.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-04-17 13:55:08 -04:00
Adrian Hunter 2b77a0ed54 [MTD] nandsim: add partition capability to nandsim
Enhance nandsim to be able to create more than 1 partition.
A new module parameter 'parts' may be used to specify partition
sizes.

Signed-off-by: Adrian Hunter <ext-adrian.hunter@nokia.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-04-17 13:54:50 -04:00
Andre Renaud 4226b51037 [MTD] [NAND] Casting bug in nand_default_block_markbad
There is a slight bug in nand_default_block_markbad, where the offset is
cast to an integer, prior to being shifted. This means that on large
offsets, it is incorrectly doing a signed shift & losing bits. Fixed
this by doing the cast after the shift (as is done elsewhere in the code).

Signed-off-by: Andre Renaud <andre@bluewatersys.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-04-17 13:50:59 -04:00
Hans-Jürgen Koch 340ea370c2 [MTD] Driver for AT26Fxxx dataflash devices
Add support for AT26Fxxx dataflash devices. These devices have a quite different
commandset than the AT45xxx chips, which are handled by at91_dataflash.c, so a
combined driver turned out to be more ugly than useful.

Tested only on AT26F004.

Signed-off-by: Hans-Jürgen Koch <hjk@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-04-17 13:42:56 -04:00
Thomas Gleixner 408b483d9c [MTD] Fix length comparison in MEMREADOOB
The ops.len member is not initialized, because it is unused for this
operation. The length check needs to use ops.ooblen instead

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-04-17 13:40:00 -04:00
Thomas Gleixner 1cf9827b68 [MTD] [NAND] Move ancient NAND chip support into a config option
The support for obsolete ancient NAND chips adds .data size and one
of the old ids conflicts with a modern one. Make the support for
such chips depending on a config option.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-04-17 18:30:57 +01:00
Thomas Gleixner 90424de8d0 [MTD] [NAND] Use ecc.read/write_page_raw consequently
Use the functions in the ecc structure instead of the default ones,
so the override by the board driver is effective also for software ecc
code paths.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-04-17 18:28:17 +01:00
sshahrom@micron.com 8c60e5475d [MTD][NAND] Add Micron Manufacturer ID
Add Micron Manufacturer ID.

Signed-off-by: Shahrom Sharif <sshahrom@micron.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-04-17 18:27:06 +01:00
Ralf Baechle 873b6a2306 [MTD] Fix dependencies for MIPS MTD drivers
o A dependency on the processor architecture does not make sense;
   delete it.
 o The Alchemy and MTX drivers requires MTD_PARTITIONS and MTD_CFI to work,
   make those dependencies.

Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-04-17 18:24:51 +01:00
Ralf Baechle 19da63d1d2 [MTD] Alchemy cleanups
Delete RCS $Id string and unused debug code.

Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-04-17 18:19:58 +01:00
Rodolfo Giometti 0ecbc81adf [MTD] [NOR] Support for auto locking flash on power up
Auto unlock sectors on resume for auto locking flash on power up.

Signed-off-by: Rodolfo Giometti <giometti@enneenne.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-04-02 14:12:23 -04:00
Marc St-Jean 68aa0fa87f [MTD] PMC MSP71xx flash/rootfs mappings
Add flash and rootfs mappings for the PMC-Sierra MSP71xx devices.

This patch references some platform support files previously submitted to
the linux-mips@linux-mips.org list.

Signed-off-by: Marc St-Jean <Marc_St-Jean@pmc-sierra.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-04-02 14:10:58 -04:00
David Woodhouse 9333907084 Merge git://git.kernel.org/pub/scm/linux/kernel/git/joern/misc 2007-03-23 17:31:17 +00:00
David Woodhouse 8e5368a1e2 [MTD] [NAND] Remember timing settings for CAFÉ NAND controller.
We'll need them for suspend/resume.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-03-23 10:40:04 +00:00
Kyungmin Park 470bc84436 [MTD] [OneNAND] Classify the page data and oob buffer
Classify the page data and oob buffer
and it prevents the memory fragementation (writesize + oobsize)

Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-03-09 08:08:09 +00:00
Kyungmin Park 5bc399e9ef [MTD] [OneNAND] Exit the loop when transferring/filling of the oob is finished
When transferring/filling of the oob is finished in OOB_AUTO, we exit the loop

Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-03-09 08:06:39 +00:00
Adrian Hunter 81280d5879 [MTD] [OneNAND] add Nokia Copyright and a credit
add Nokia Copyright and a credit

Signed-off-by: Adrian Hunter <ext-adrian.hunter@nokia.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-03-09 08:05:57 +00:00
Kyungmin Park e3da8067b3 [MTD] [OneNAND] Fix typo & wrong comments
Fix typo & wrong comments

Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-03-09 08:05:22 +00:00
Kyungmin Park 91014e9bfa [MTD] [OneNAND] Use oob buffer instead of main one in oob functions
In oob functions, it is used main buffer instead of oob one. So fix it.

Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-03-09 08:04:25 +00:00
Adrian Hunter 74641d7527 [MTD] Correct partition failed erase address
If an erase operation fails, the address at which the
failure occurred is returned by the driver.  The MTD
partition must adjust this address (by subtracting the
partition offset) before returning to the caller.
This was not happening, which caused JFFS2 to mark
the wrong block bad!

Signed-off-by: Adrian Hunter <ext-adrian.hunter@nokia.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-03-08 10:45:04 +00:00
Robert P. J. Day 89e2bf61da [MTD] [NAND] Correct misspelled preprocessor variable.
Replace the apparently misspelled preprocessor variable
"MTD_NAND_DISKONCHIP_BBTWRITE" with the correct form
"CONFIG_MTD_NAND_DISKONCHIP_BBTWRITE".

Signed-off-by: Robert P. J. Day <rpjday@mindspring.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-03-08 09:48:14 +00:00
Alan Cox 99109a6dac [MTD] [MAPS] dilnetpc: Fix printk warning
The type of a resource could be 32 or 64bit depending upon platform or
option so cast it explicitly.

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-03-08 09:46:28 +00:00
Vijay Sampath 83d480917b [MTD] [NOR] Fix oops in cfi_amdstd_sync
The files cfi_cmdset_0002.c and cfi_cmdset_0020.c do not initialize their
wait queues like is done in cfi_cmdset_0001.c.  This causes an oops when
the wait queue is accessed.  I have copied the code from cfi_cmdset_0001.c
that is pertinent to initialization of the wait queue.

Signed-off-by: Vijay Sampath <vsampath@gmail.com>
Acked-by: Joern Engel <joern@lazybastard.org>
Acked-by: Josh Boyer <jwboyer@linux.vnet.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-03-08 09:22:38 +00:00
Cyrill Gorcunov dc164bbb4b [MTD] ESB2 check for closed ROM window
Add checking for closed ROM window on Intel ESB2 Southbridge.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-03-08 09:21:42 +00:00
Vitaly Wool 1f92267c51 [MTD] [NAND] make oobavail public
During the MTD rework the oobavail parameter of mtd_info structure has become
private. This is not quite correct in terms of integrity and logic. If we have
means to write to OOB area, then we'd like to know upfront how many bytes out
of OOB are spare per page to be able to adapt to specific cases.
The patch inlined adds the public oobavail parameter.

Signed-off-by: Vitaly Wool <vwool@ru.mvista.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-03-08 09:17:43 +00:00
Arnaud Patard dff5e44c36 [ARM] 4233/1: nand/s3c2410.c: warning fix
Noticed while building a s3c2410 kernel :
drivers/mtd/nand/s3c2410.c: In function 's3c2440_nand_calculate_ecc':
drivers/mtd/nand/s3c2410.c:476: warning: format '%06x' expects type 'unsigned int', but argument 3 has type 'long unsigned int'

This patch fixes it.

Signed-off-by: Arnaud Patard <arnaud.patard@rtp-net.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2007-02-25 16:41:41 +00:00
Joern Engel 21d31f1f7c [PATCH] [MTD] block2mtd: remove readahead code
Over the years there was a slow trickle of complaints against the readahead
code.  Most of them concerned performance, Peter Zijlstra stumbled over it
when working unrelated changes and I believe there was an actual bug report.
Oh, Andrew Morton also complained about duplicating code from mm/readahead.c.

It is just not worth it.  On flash media like usb sticks, readahead will
make things go slow - very slow.  On spinning disks, readahead may be a
win, but this is definitely not the place to add it.

Signed-off-by: Jörn Engel <joern@lazybastard.org>
2007-02-20 20:22:22 +01:00
Joern Engel 8870530a40 [PATCH] [MTD] block2mtd: remove warning
drivers/mtd/devices/block2mtd.c:311:9: warning: symbol 'dev' shadows an earlier one
drivers/mtd/devices/block2mtd.c:294:23: originally declared here

Signed-off-by: Jörn Engel <joern@lazybastard.org>
2007-02-20 20:21:41 +01:00
Joern Engel 0ffb74ccc0 [PATCH] [MTD] block2mtd: remove casts
Remove two casts - they were not only pointless, but outright harmful.

Spotted by Felix Fietkau <nbd@openwrt.org>

Signed-off-by: Jörn Engel <joern@lazybastard.org>
2007-02-20 20:20:58 +01:00
Linus Torvalds 4935361766 Merge git://git.infradead.org/mtd-2.6
* git://git.infradead.org/mtd-2.6: (49 commits)
  [MTD] [NAND] S3C2412 fix hw ecc
  [MTD] [NAND] Work around false compiler warning in CAFÉ driver
  [JFFS2] printk warning fixes
  [MTD] [MAPS] ichxrom warning fix
  [MTD] [MAPS] amd76xrom warning fix
  [MTD] [MAPS] esb2rom warning fixes
  [MTD] [MAPS] ck804xrom warning fix
  [MTD] [MAPS] netsc520 warning fix
  [MTD] [MAPS] sc520cdp warning fix
  [MTD] [ONENAND] onenand_base warning fix
  [MTD] [NAND] eXcite nand flash driver
  [MTD] Improve heuristic for detecting wrong-endian RedBoot partition table
  [MTD] Fix RedBoot partition parsing regression harder.
  [MTD] [NAND] S3C2410: Hardware ECC correction code
  [JFFS2] Use MTD_OOB_AUTO to automatically place cleanmarker on NAND
  [MTD] Clarify OOB-operation interface comments
  [MTD] remove unused ecctype,eccsize fields from struct mtd_info
  [MTD] [NOR] Intel: remove ugly PROGREGION macros
  [MTD] [NOR] STAA: use writesize instead off eccsize to represent ECC block
  [MTD] OneNAND: Invalidate bufferRAM after erase
  ...
2007-02-19 13:34:11 -08:00
Matthieu CASTET 4f65992381 [MTD] [NAND] S3C2412 fix hw ecc
S3C2412 use differents registers than s3c2440 for hw ecc handling.

Signed-off-by: Matthieu CASTET <matthieu.castet@parrot.fr>
Acked-by: Ben Dooks <ben-linux@fluff.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-02-18 16:47:47 +00:00
Andrew Morton 2a7295b277 [MTD] [NAND] Work around false compiler warning in CAFÉ driver
drivers/mtd/nand/cafe.c: In function 'cafe_nand_cmdfunc':
drivers/mtd/nand/cafe.c:269: warning: 'irqs' may be used uninitialized in this function

Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-02-18 16:45:05 +00:00
Andrew Morton 3a38d3af92 [MTD] [MAPS] ichxrom warning fix
drivers/mtd/maps/ichxrom.c: In function 'ichxrom_init_one':
drivers/mtd/maps/ichxrom.c:231: warning: format '%08lx' expects type 'long unsigned int', but argument 4 has type 'resource_size_t'
drivers/mtd/maps/ichxrom.c:231: warning: format '%08lx' expects type 'long unsigned int', but argument 4 has type 'resource_size_t'

Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-02-18 16:42:51 +00:00
Andrew Morton 1a6284cb6f [MTD] [MAPS] amd76xrom warning fix
drivers/mtd/maps/amd76xrom.c: In function 'amd76xrom_init_one':
drivers/mtd/maps/amd76xrom.c:209: warning: format '%08lx' expects type 'long unsigned int', but argument 4 has type 'resource_size_t'

Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-02-18 16:42:25 +00:00
Andrew Morton 5ad0fdc6dd [MTD] [MAPS] esb2rom warning fixes
drivers/mtd/maps/esb2rom.c: In function 'esb2rom_init_one':
drivers/mtd/maps/esb2rom.c:293: warning: format '%08lx' expects type 'long unsigned int', but argument 4 has type 'resource_size_t'

Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-02-18 16:42:03 +00:00
Andrew Morton 65af07141b [MTD] [MAPS] ck804xrom warning fix
drivers/mtd/maps/ck804xrom.c: In function 'ck804xrom_init_one':
drivers/mtd/maps/ck804xrom.c:211: warning: format '%08lx' expects type 'long unsigned int', but argument 4 has type 'resource_size_t'
drivers/mtd/maps/ck804xrom.c:211: warning: format '%08lx' expects type 'long unsigned int', but argument 4 has type 'resource_size_t'

Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-02-18 16:41:47 +00:00
Andrew Morton 3ce32f5d12 [MTD] [MAPS] netsc520 warning fix
drivers/mtd/maps/netsc520.c: In function 'init_netsc520':
drivers/mtd/maps/netsc520.c:97: warning: format '%lx' expects type 'long unsigned int', but argument 3 has type 'resource_size_t'

Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-02-18 16:41:31 +00:00
Andrew Morton e389612dec [MTD] [MAPS] sc520cdp warning fix
drivers/mtd/maps/sc520cdp.c:241: warning: format '%lx' expects type 'long unsigned int', but argument 3 has type 'resource_size_t'
drivers/mtd/maps/netsc520.c: In function 'init_netsc520':

Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-02-18 16:41:01 +00:00
Andrew Morton 5785bdd6fc [MTD] [ONENAND] onenand_base warning fix
drivers/mtd/onenand/onenand_base.c: In function 'onenand_bbt_read_oob':
drivers/mtd/onenand/onenand_base.c:1033: warning: format '%i' expects type 'int', but argument 3 has type 'size_t'

Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-02-18 16:38:32 +00:00
Thomas Gleixner 2db6346f76 [PATCH] Scheduled removal of SA_xxx interrupt flags fixups 2
The obsolete SA_xxx interrupt flags have been used despite the scheduled
removal.  Fixup the remaining users in -mm.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-02-14 08:09:55 -08:00
Tim Schmielau cd354f1ae7 [PATCH] remove many unneeded #includes of sched.h
After Al Viro (finally) succeeded in removing the sched.h #include in module.h
recently, it makes sense again to remove other superfluous sched.h includes.
There are quite a lot of files which include it but don't actually need
anything defined in there.  Presumably these includes were once needed for
macros that used to live in sched.h, but moved to other header files in the
course of cleaning it up.

To ease the pain, this time I did not fiddle with any header files and only
removed #includes from .c-files, which tend to cause less trouble.

Compile tested against 2.6.20-rc2 and 2.6.20-rc2-mm2 (with offsets) on alpha,
arm, i386, ia64, mips, powerpc, and x86_64 with allnoconfig, defconfig,
allmodconfig, and allyesconfig as well as a few randconfigs on x86_64 and all
configs in arch/arm/configs on arm.  I also checked that no new warnings were
introduced by the patch (actually, some warnings are removed that were emitted
by unnecessarily included header files).

Signed-off-by: Tim Schmielau <tim@physik3.uni-rostock.de>
Acked-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-02-14 08:09:54 -08:00
Arjan van de Ven d54b1fdb1d [PATCH] mark struct file_operations const 5
Many struct file_operations in the kernel can be "const".  Marking them const
moves these to the .rodata section, which avoids false sharing with potential
dirty data.  In addition it'll catch accidental writes at compile time to
these shared resources.

Signed-off-by: Arjan van de Ven <arjan@linux.intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-02-12 09:48:45 -08:00
Andrew Morton fc0ecff698 [PATCH] remove invalidate_inode_pages()
Convert all calls to invalidate_inode_pages() into open-coded calls to
invalidate_mapping_pages().

Leave the invalidate_inode_pages() wrapper in place for now, marked as
deprecated.

Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-02-11 10:51:31 -08:00
Thomas Koeller 67a9c7af1f [MTD] [NAND] eXcite nand flash driver
This is a nand flash driver for the eXcite series of intelligent
cameras manufactured by Basler Vision Technologies AG.

Signed-off-by: Thomas Koeller <thomas.koeller@baslerweb.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-02-11 17:57:49 +01:00
David Woodhouse 7ca353a428 [MTD] Improve heuristic for detecting wrong-endian RedBoot partition table
Also limit the amount we scan to one eraseblock.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-02-10 09:58:31 +00:00
Rod Whitby 11192146e5 [MTD] Fix RedBoot partition parsing regression harder.
Correct the location of the recalculation of the FIS directory size,
and also add the same recalculation for the byte-swapped case.

Signed-off-by: Rod Whitby <rod@whitby.id.au>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-02-10 09:26:48 +00:00
Ben Dooks a2593247d7 [MTD] [NAND] S3C2410: Hardware ECC correction code
Add support for correcting errors detected by the
hardware ECC.

Signed-off-by: Ben Dooks <ben-linux@fluff.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-02-09 17:12:59 +00:00
Artem Bityutskiy 64f6071056 [MTD] remove unused ecctype,eccsize fields from struct mtd_info
Remove unused and broken mtd->ecctype and mtd->eccsize fields
from struct mtd_info. Do not remove them from userspace API
data structures (don't want to breake userspace) but mark them
as obsolete by a comment. Any userspace program which uses them
should be half-broken anyway, so this is more about saving
data structure size.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-02-09 15:27:12 +00:00
Artem Bityutskiy d416085572 [MTD] [NOR] Intel: remove ugly PROGREGION macros
Remove ugly and weird MTD_PROGREGION_CTRLMODE_VALID() and
MTD_PROGREGION_CTRLMODE_INVALID() macros. There is only one
user of them and they are used locally just for printing.

Anyway, this patch is a preparation for removing mtd->ecctype
and mtd->eccsize, but these macros use them. Fix this.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-02-09 15:26:37 +00:00
Artem Bityutskiy 992c9d24c4 [MTD] [NOR] STAA: use writesize instead off eccsize to represent ECC block
The cfi_staa_write_buffers() uses mtd->eccsize but means mtd->writesize.
BTW, mtd-eccsize is broken and is not initialized, which means the code
fixed by this patch is broken/unused anyway.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-02-09 15:26:10 +00:00
Adrian Hunter 480b9dfb1f [MTD] OneNAND: Invalidate bufferRAM after erase
OneNAND has internal bufferRAMs.  The driver keeps track of
what is in the bufferRAM to save having to load from the
NAND core.  After an erase operation, the driver must
mark bufferRAM invalid if it refers to the erased block.

Signed-off-by: Adrian Hunter <ext-adrian.hunter@nokia.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-02-09 15:16:55 +00:00
Martin Michlmayr 678c857f3c [MTD] Don't oops when the RedBoot partition table is empty
This fixes a regression with the RedBoot parsing code introduced by
commit 0b47d65408

Signed-off-by: Martin Michlmayr <tbm@cyrius.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-02-09 15:06:53 +00:00
Adrian Bunk d24030f0f7 [MTD] [NAND] Fix an off-by-one in a BUG_ON in CAFÉ ECC correction.
err_pos_lut[4096] of an array with 4096 elements is a bug.

Spotted by the Coverity checker.

While I was at it, I also converted it to ARRAY_SIZE().

Signed-off-by: Adrian Bunk <bunk@stusta.de>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-02-09 15:06:02 +00:00
Adrian Hunter 0373615579 [MTD] [NAND] Correctly validate out-of-band offset and length
Add checks to ensure that out-of-band reads and writes are
not attempted with an invalid offset or length.  Specifically,
the offset must be less than the size of oob for a page
and the length must not go beyond the size of the device.
Additionally the checks must adjust for auto-placement
(MTD_OOB_AUTO) of oob data.

Signed-off-by: Adrian Hunter <ext-adrian.hunter@nokia.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-02-09 15:02:40 +00:00
David Woodhouse 2a5bd59672 [MTD] Fix default timeouts for Intel NOR flash
In commit c172471b78 Nico switched to using
common code for polling for command completion. Unfortunately he also used
a common default timeout for both write and erase commands, despite the
fact that erases can take a _whole_ lot longer. Use a more sensible
default for erase timeout.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-02-09 14:39:10 +00:00
David Woodhouse c1f1625860 Merge branch 'master' of git://git.infradead.org/~kmpark/onenand-mtd-2.6 2007-02-09 12:36:22 +00:00
akpm@osdl.org 862c93b991 [MTD] CK804XROM must depend on PCI
CONFIG_MTD_CK804XROM=y, CONFIG_PCI=n results in the following compile
error:

  CC      drivers/mtd/maps/ck804xrom.o
ck804xrom.c: In function 'ck804xrom_init_one':
ck804xrom.c:114: error: implicit declaration of function 'pci_dev_get'
ck804xrom.c:114: warning: assignment makes pointer from integer without a cast
make[4]: *** [drivers/mtd/maps/ck804xrom.o] Error 1

Considering what hardware this driver is driving, a dependency on PCI
also seems logical.

Signed-off-by: Adrian Bunk <bunk@stusta.de>
Cc: Ryan Jackson <rjackson@lnxi.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-02-09 11:40:06 +00:00
Adrian Hunter cde36b37d6 [MTD] OneNAND: Select correct chip's bufferRAM for DDP
OneNAND double-density package (DDP) has two chips, each with
their own bufferRAM.  The driver will skip loading data from
the NAND core if the data can be found in a bufferRAM, however
in that case, the correct chip's bufferRAM must be selected
before reading from bufferRAM.

Signed-off-by: Adrian Hunter <ext-adrian.hunter@nokia.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
2007-02-09 09:42:42 +09:00
Kyungmin Park 211ac75f5e [MTD] OneNAND: Error message printing and bad block scan erros
Provide the bad block scan with its own read function so that important error
messages that are not from the the bad block scan, can always be printed.

Signed-off-by: Adrian Hunter <ext-adrian.hunter@nokia.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
2007-02-07 12:15:01 +09:00
Adrian Hunter 81f38e1123 [MTD] OneNAND: Subpage write returned incorrect length written
When a write is done, the length written is returned.  When a
single subpage is written the length returned should be the
subpage size, however the page size was being returned.

Signed-off-by: Adrian Hunter <ext-adrian.hunter@nokia.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
2007-02-07 10:55:23 +09:00
Adrian Hunter 52e4200a6d [MTD] OneNAND: Do not allow oob write past end of page
OneNAND can write oob to successive pages, but NAND
does not do that.  For compatibility, disallow OneNAND
from writing past the end of the page.

Signed-off-by: Adrian Hunter <ext-adrian.hunter@nokia.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
2007-02-06 09:15:39 +09:00
David Woodhouse aa8f127855 [MTD NAND] CAFÉ controller depends, perhaps unsurprisingly, on NAND
Noticed by Ingo.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-02-05 13:32:55 +00:00
David Woodhouse 4285431fb6 Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6 2007-02-05 13:25:21 +00:00
Kyungmin Park 5b4246f1b0 [MTD] OneNAND: Fix typo and remove unnecessary goto statement
In previos patch, there's typo so fix it
Remove unnecessary goto statement

Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
2007-02-02 09:39:21 +09:00
Kyungmin Park abf3c0f23d [MTD] OneNAND: Reduce internal BufferRAM operations
It use blockpage instead of a pair (block, page). It can also cover a small chunk access. 0x00, 0x20, 0x40 and so on.

And in JFFS2 behavior, sometimes it reads two pages alternatively.
e.g., It first reads A page, B page and A page.
So we check another bufferram to find requested page.

Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
2007-02-02 09:29:36 +09:00
Kyungmin Park 4f4fad27ac [MTD] OneNAND: Remove line of code that was meant to be deleted in OOB_AUTO
- Iterations of the patch to add oob auto-placement support to OneNAND left a line of code that was meant to have been deleted.
- read mtd->oobsize in onenand_transfer_auto_oob to optimized memcpy

Signed-off-by: Adrian Hunter <ext-adrian.hunter@nokia.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
2007-02-02 09:22:21 +09:00
Adrian Hunter a5e7c7b447 [MTD] OneNAND: Add support for auto-placement of out-of-band data
Enable the use of oob operation mode MTD_OOB_AUTO with OneNAND.
Note that MTD_OOB_RAW is still not supported.

Signed-off-by: Adrian Hunter <ext-adrian.hunter@nokia.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
2007-02-01 09:28:18 +09:00
Alan c033a7e3d5 [MTD] ck804xrom: fix a pci_find_device
Going over the bugs and warnings I found this one left over. The other
changes have already been correctly done for this driver but the actual
switch to pci_get_device that they assume has not.

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-01-31 17:26:02 +00:00
Kyungmin Park 9bfbc9b24f [MTD] OneNAND: Remove unused fields
- Remove unused fields
- Fix typo

Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
2007-01-31 14:25:21 +09:00
Al Viro a12743026c [PATCH] mtd/nand/cafe.c missing include of dma-mapping.h
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-01-30 08:39:20 -08:00
Adrian Hunter 8b29c0b6eb [MTD] OneNAND: Amend write-verify to compare to original buffer
When write-verify is enabled (CONFIG_MTD_ONENAND_VERIFY_WRITE),
the data written is read back and compared.  The comparison
was being made between dataRAM buffers, but this does not
verify that the data made it to the dataRAM correctly in
the first place.  This patch amends write-verify to
compare back to the original buffer.  It also now verifies
sub-page writes.

Signed-off-by: Adrian Hunter <ext-adrian.hunter@nokia.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
2007-01-25 14:06:33 +09:00
David Woodhouse f7c37d7b8a [MTD] [NAND] Remove debugging cruft from CAFÉ NAND driver.
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-01-23 23:36:43 +08:00
David Woodhouse 527a4f45ef [MTD] [NAND] Inherit CAFÉ NAND timing setup from firmware
The precise timings are board-specific (or NAND chip specific) and don't
belong here. If they're set already, then use what we find there.
Otherwise, revert to the most conservative default values (and whinge).

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-01-23 23:36:42 +08:00
Adrian Hunter ec255e3406 [MTD] OneNAND: Check first or second pages for bad block information
OneNAND records bad block information in the out-of-band area of either the first or second page of a block.  Due to a logic error, only the first page was being checked.

Signed-off-by: Adrian Hunter <ext-adrian.hunter@nokia.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
2007-01-22 21:30:31 +09:00
Adrian Hunter f00b0046d2 [MTD] OneNAND: Free the bad block table when the device is released
OneNAND does 2 memory allocations for bad block information.
Only one of them was being freed.

Signed-off-by: Adrian Hunter <ext-adrian.hunter@nokia.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
2007-01-22 21:27:56 +09:00
Kyungmin Park 75384b0d9c [MTD] OneNAND: Update copyrights and code cleanup
Update copyrights and code cleanup

Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
2007-01-18 11:10:57 +09:00
Kyungmin Park 738d61f537 [MTD] OneNAND: Reduce Double Density Package (DDP) operations
- DDP code clean-up
- Reduce block & bufferram operations in DDP

Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
2007-01-18 11:00:31 +09:00
Adrian Hunter 9d03280129 [MTD] OneNAND: Return an error if a read timeout occurs
If OneNAND is operating within specification, all operations should easily be
completed within the 20 millisecond timeout.
This patch faithlessly adds a check for the timeout and returns an error in
that case.

Signed-off-by: Adrian Hunter <ext-adrian.hunter@nokia.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
2007-01-18 10:59:44 +09:00
Kyungmin Park 10b7a2bd6b [MTD] OneNAND: Fix unlock all status error
We have to set ONENAND_REG_START_BLOCK_ADDRESS to avoid status error

Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
2007-01-18 10:59:16 +09:00
David Woodhouse 9cdf083f98 Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6 2007-01-18 10:34:51 +11:00
Adrian Hunter 0fc2ccea4c [MTD] OneNAND: Handle DDP chip boundary during read-while-load
The read-while-load method of reading from OneNAND needs to allow
for the change of bufferRAM address at the boundary between the
two chips in a double density (DDP) device.

Signed-off-by: Adrian Hunter <ext-adrian.hunter@nokia.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
2007-01-10 15:05:22 +02:00
Kyungmin Park b3c9f8bfe7 [MTD] OneNAND: return ecc error code only when 2-bit ecc occurs
we don't need to return ecc error when 1-bit ecc.
We only return error code when 2-bit ecc error

Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
2007-01-10 15:04:28 +02:00
Adrian Hunter a8de85d557 [MTD] OneNAND: Implement read-while-load
Read-while-load enables higher performance read operations.

Signed-off-by: Adrian Hunter <ext-adrian.hunter@nokia.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
2007-01-10 14:58:42 +02:00
Kyungmin Park 2fd32d4af8 [MTD] OneNAND: fix onenand_wait bug in read ecc error
Even though there is ECC error. OneNAND driver updates the buffram as valid

Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
2007-01-10 14:40:16 +02:00
Artem Bityutskiy 61a7e1983e [MTD] OneNAND: release CPU in cycles
This patch teaches OneNAND to release processor in
read/write/erase cycles and let other processes proceed.
Also, remove buggi touch watchdog call which only hides
the problem instead of solving it.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
2007-01-10 14:39:57 +02:00
Kyungmin Park 60d84f9739 [MTD] OneNAND: add subpage write support
OneNAND supports up to 4 writes at one NAND page. Add support of this feature.

Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
2007-01-10 14:35:00 +02:00
Kyungmin Park f627248736 [MTD] OneNAND: fix onenand_wait bug
Fix onenand_wait error reporting

Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
2007-01-10 14:34:42 +02:00
David Brownell de4fa99266 [PATCH] SPI/MTD: mtd_dataflash oops prevention
Return a fault code if the Dataflash driver runs into a "no device present"
error when the MISO line has a pulldown (it currently expects a pullup), so
that rmmod won't oops.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Cc: David Woodhouse <dwmw2@infradead.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-12-30 10:56:42 -08:00
David Brownell 17c65d6990 [PATCH] m25p80 build fixes (with MTD debug)
Fix build issues that show up with the m25p80 SPI flash driver when
building with MTD debug enabled.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Cc: David Woodhouse <dwmw2@infradead.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-12-30 10:56:42 -08:00
Robert P. J. Day 5cbded585d [PATCH] getting rid of all casts of k[cmz]alloc() calls
Run this:

	#!/bin/sh
	for f in $(grep -Erl "\([^\)]*\) *k[cmz]alloc" *) ; do
	  echo "De-casting $f..."
	  perl -pi -e "s/ ?= ?\([^\)]*\) *(k[cmz]alloc) *\(/ = \1\(/" $f
	done

And then go through and reinstate those cases where code is casting pointers
to non-pointers.

And then drop a few hunks which conflicted with outstanding work.

Cc: Russell King <rmk@arm.linux.org.uk>, Ian Molton <spyro@f2s.com>
Cc: Mikael Starvik <starvik@axis.com>
Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
Cc: Roman Zippel <zippel@linux-m68k.org>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Kyle McMartin <kyle@mcmartin.ca>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Jeff Dike <jdike@addtoit.com>
Cc: Greg KH <greg@kroah.com>
Cc: Jens Axboe <jens.axboe@oracle.com>
Cc: Paul Fulghum <paulkf@microgate.com>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: Karsten Keil <kkeil@suse.de>
Cc: Mauro Carvalho Chehab <mchehab@infradead.org>
Cc: Jeff Garzik <jeff@garzik.org>
Cc: James Bottomley <James.Bottomley@steeleye.com>
Cc: Ian Kent <raven@themaw.net>
Cc: Steven French <sfrench@us.ibm.com>
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: Neil Brown <neilb@cse.unsw.edu.au>
Cc: Jaroslav Kysela <perex@suse.cz>
Cc: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-12-13 09:05:58 -08:00
Robert P. J. Day cd86128088 [PATCH] Fix numerous kcalloc() calls, convert to kzalloc()
All kcalloc() calls of the form "kcalloc(1,...)" are converted to the
equivalent kzalloc() calls, and a few kcalloc() calls with the incorrect
ordering of the first two arguments are fixed.

Signed-off-by: Robert P. J. Day <rpjday@mindspring.com>
Cc: Jeff Garzik <jeff@garzik.org>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: Dominik Brodowski <linux@dominikbrodowski.net>
Cc: Adam Belay <ambx1@neo.rr.com>
Cc: James Bottomley <James.Bottomley@steeleye.com>
Cc: Greg KH <greg@kroah.com>
Cc: Mark Fasheh <mark.fasheh@oracle.com>
Cc: Trond Myklebust <trond.myklebust@fys.uio.no>
Cc: Neil Brown <neilb@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-12-13 09:05:52 -08:00
Ralf Baechle 0bf3a9d82a [MTD] Nuke IVR leftovers
Support for the ITE8172 based boards was deleted a while ago so this is
dead code.

The Kconfig dependency on MIPS was wrong anyway, MIPS is a processor
architecture and nothing else; guesses on systems architecture are likely
to be wrong ...

Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-12-11 16:30:26 +00:00
Kyungmin Park 66a1e421b9 [MTD] OneNAND: fix oob handling in recent oob patch
There are missing place in recent MTD oob patch

http://git.infradead.org/?p=mtd-2.6.git;a=commitdiff;h=7014568bad55c20b7ee4f439d78c9e875912d51f

Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-12-11 10:46:20 +00:00
David Woodhouse 76ab40e465 [MTD] Fix ssfdc blksize typo
I will not commit even trivial and obvious one-line fixes without building.
I will not commit even trivial and obvious one-line fixes without building.
I will not commit even trivial and obvious one-line fixes without building.
I will not commit even trivial and obvious one-line fixes without building.
Only clever people can get away with that.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-12-11 09:43:38 +00:00
David Woodhouse db06e2a93f [MTD] Fix SSFDC build for variable blocksize.
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-12-10 11:48:54 +00:00
Randy Dunlap dffbc42b5a [MTD] ESB2ROM uses PCI
ESB2ROM uses PCI interface functions.

With CONFIG_PCI=n:
drivers/mtd/maps/esb2rom.c: In function 'esb2rom_init_one':
drivers/mtd/maps/esb2rom.c:167: warning: implicit declaration of function 'pci_dev_get'

Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-12-10 11:43:21 +00:00
Vitaly Wool a2c2fe4b24 [MTD] of_device-based physmap driver
inlined below is the patch that adds physmap driver for of_device.
It's an MTD part of the two-part support for flash/ROM devices based
on Open Firmware descriptions. The arch part (currently only PowerPC
which is no surprise) was introduced to powerpc folks earlier and
recently the older version of the powerpc part has been included into
the powerpc.git tree
(see http://www.kernel.org/git/?p=linux/kernel/git/paulus/powerpc.git;a=commitdiff;h=28f9ec349ae47c91768b7bc5607db4442c818e11).

 drivers/mtd/maps/Kconfig      |    9 +
 drivers/mtd/maps/Makefile     |    1
 drivers/mtd/maps/physmap_of.c |  255 ++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 265 insertions(+)

Signed-off-by: Vitaly Wool <vwool@ru.mvista.com>
Signed-off-by: Sergey Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-12-08 13:32:34 +00:00
Rod Whitby f33665d931 [MTD] Support combined RedBoot FIS directory and configuration area
RedBoot supports storing the FIS directory and the RedBoot
configuration area in the same block of flash memory.  This is
not the most common RedBoot configuration, but it is used on
commercially available boards supported by the kernel.

A recent patch to mtd/redboot.c (http://lkml.org/lkml/2006/3/20/410)
which corrected the skipping of deleted table entries has exposed the
latent problem of the kernel redboot parser running off the end of the
FIS directory and interpreting the RedBoot configuration information
as table entries.

This patch terminates the table parsing when the first truly empty
entry is found (table entry deletion only clears the first byte of the
name, so two cleared bytes in a row indicates the end of the table),
thereby supporting the combined redboot FIS directory and RedBoot
configuration information flash layout scenario.

Signed-off-by: Rod Whitby <rod@whitby.id.au>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-12-08 13:28:26 +00:00
Andrew Victor dd11b8cdf0 [MTD] NAND: Support for 16-bit bus-width on AT91.
Add support for 16-bit NAND bus-width for the AT91 NAND driver.

The 16-bit NAND is found on the Atmel AT91SAM9260-EK and AT91SAM9261-EK
boards.

Orignal Patch from Patrice Vilchez

Signed-off-by: Andrew Victor <andrew@sanpeople.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-12-08 13:25:17 +00:00
Artem Bityutskiy 4a0c50c07a [MTD] nandsim: bugfix in page addressing
Number of address bytes for 64-128 MiB NANDs is 4, not 5.

Signed-off-by: Artem Bityutskiy <dedekind@infradead.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-12-08 13:22:54 +00:00
Christoph Lameter e94b176609 [PATCH] slab: remove SLAB_KERNEL
SLAB_KERNEL is an alias of GFP_KERNEL.

Signed-off-by: Christoph Lameter <clameter@sgi.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-12-07 08:39:24 -08:00
Timo Lindhorst 418b2e56b8 [MTD] NAND: use SmartMedia ECC byte order for ndfc
Select MTD_NAND_ECC_SMC (ECC byte order according to the Smart Media
Specification) if MTD_NAND_NDFC is used.
Using the wrong byte order causes fatal, unnoticed data damage.

For further information see:
http://lists.infradead.org/pipermail/linux-mtd/2006-November/016920.html

Signed-off-by: Timo Lindhorst <lindhors@linux.vnet.ibm.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-12-05 18:00:13 +00:00
Yoshinori Sato 0b47d65408 [MTD] redboot partition combined fis / config problem
Can't analyze FIS directory in CYGSEM_REDBOOT_FLASH_COMBINED_FIS_AND_CONFIG
really.

Signed-off-by: Yoshinori Sato <ysato@users.sourceforge.jp>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-12-01 10:01:50 +00:00
Mariusz Kozlowski 7dcb483de3 [MTD] [NAND] Compile fix in rfc_from4.c
Signed-off-by: Mariusz Kozlowski <m.kozlowski@tuxland.pl>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-12-01 09:59:49 +00:00
David Woodhouse bd3c97a7c7 Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6 2006-12-01 09:56:43 +00:00
Haavard Skinnemoen 6c33cafc79 [MTD] bugfix: DataFlash is not bit writable
This patch fixes the
"jffs2_flash_writev(): Non-contiguous write to 00825300 with mtd_dataflash" bug.

Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
Signed-off-by: Artem Bityutskiy <dedekind@infradead.org>
2006-12-01 10:30:45 +02:00
David Woodhouse c9ac597729 [MTD] Remove trailing whitespace
The newly-added cafe_ecc.c had a lot of it because of the way the lookup
table was auto-generated; clean up the other files too while we're at it.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-11-30 08:17:38 +00:00
Jan Engelhardt 03a67a46af Fix typos in doc and comments
Changes persistant -> persistent. www.dictionary.com does not know
persistant (with an A), but should it be one of those things you can
spell in more than one correct way, let me know.

Signed-off-by: Jan Engelhardt <jengelh@gmx.de>
Signed-off-by: Adrian Bunk <bunk@stusta.de>
2006-11-30 05:32:19 +01:00
Matt LaPlante 3cb2fccc5f Fix misc Kconfig typos
Fix various Kconfig typos.

Signed-off-by: Matt LaPlante <kernel1@cyberdogtech.com>
Acked-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: Adrian Bunk <bunk@stusta.de>
2006-11-30 05:22:59 +01:00
David Woodhouse dd36f26735 [MTD] Use EXPORT_SYMBOL_GPL() for exported symbols.
While we're fixing up the newly-added symbol, change the neighbouring ones
too, for consistency and also to reflect the author's interpretation of
the GPL -- which is that _no_ non-GPL modules are permitted. The author
always intended his code to be released under the GPL, and believes that
any new interpretation of 'EXPORT_SYMBOL' as being any different from
'EXPORT_SYMBOL_GPL' is entirely invalid; the GPL requires that _all_
exports have the semantics of the new 'EXPORT_SYMBOL_GPL', which means the
extra four characters are entirely redundant.

But since those four extra characters trigger the check for illegal
modules in a way that just EXPORT_SYMBOL does not, it's useful to change
anyway. This action in no way indicates an admission that there is any
legal distinction between the two states, and in particular does not
indicate that the author believes that non-GPL modules may use symbols
exported with EXPORT_SYMBOL alone.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-11-29 16:33:03 +00:00
Artem Bityutskiy 9c74034f8f [MTD] return error code from get_mtd_device()
get_mtd_device() returns NULL in case of any failure. Teach it to return an
error code instead. Fix all users as well.

Signed-off-by: Artem Bityutskiy <dedekind@infradead.org>
2006-11-29 17:06:38 +02:00
Artem Bityutskiy 9fe912cea3 [MTD] add get and put methods
This patch adds get_device() and put_device() methods to the MTD description
structure (struct mtd_info). These methods are called by MTD whenever the MTD
device is get or put. They are needed when the underlying driver is something
smarter then just flash chip driver, for example UBI.

Signed-off-by: Artem Bityutskiy <dedekind@infradead.org>
2006-11-29 17:04:53 +02:00
Artem Bityutskiy 7799308f34 [MTD] add get_mtd_device_nm() function
This patch adds one more function to the MTD interface to make it possible to
open MTD devices by their names, not only numbers. This is very handy in many
situations. Also, MTD device number depend on load order and may vary, while
names are fixed.

Signed-off-by: Artem Bityutskiy <dedekind@infradead.org>
2006-11-29 17:04:31 +02:00
Thomas Gleixner 29072b9607 [MTD] NAND: add subpage write support
Many SLC NANDs support up to 4 writes at one NAND page. Add support
of this feature.

Signed-off-by: Artem Bityutskiy <dedekind@infradead.org>
2006-11-29 17:03:52 +02:00
Josh Boyer f6a7ecb18d [MTD] add MTD_BLKDEVS Kconfig option
Add a MTD_BLKDEVS Kconfig option to cleanup the makefile a bit

Signed-off-by: Josh Boyer <jwboyer@linux.vnet.ibm.com>
Signed-off-by: Artem Bityutskiy <dedekind@infradead.org>
2006-11-29 16:58:15 +02:00
Yoichi Yuasa eb6cf7bb71 [MTD] fix map probe name for cstm_mips_ixx
This patch has fixed name of map probe for cstm_mips_ixx.c

Signed-off-by: Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>
Signed-off-by: Artem Bityutskiy <dedekind@infradead.org>
2006-11-29 16:57:55 +02:00
Joakim Tjernlund 967bf623e9 [PATCH] Fix Intel/Sharp command set erase suspend bug
When we sleep and wait for a suspended operation to be resumed, go
back and check until it's ready -- don't just continue after the first
time we're woken. This can cause file system corruption.

Signed-off-by: Joakim Tjernlund <Joakim.Tjernlund@transmode.se>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-11-28 17:26:50 -08:00
Andrew Morton ce1060494a [MTD] Tidy bitrev usage in rtc_from4.c
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-11-29 00:19:14 +00:00
Timo Lindhorst fc02919499 [MTD] [NAND] fix ifdef option in nand_ecc.c
Fix up the config option in the #ifdef statements in nand_ecc.c

Signed-off-by: Timo Lindhorst <lindhors@linux.vnet.ibm.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-11-29 00:11:39 +00:00
David Woodhouse 28bdd4a72d [MTD] [NAND] Update CAFÉ driver interrupt handler prototype
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-11-29 00:04:59 +00:00
David Woodhouse 103e40f633 Merge git://git.infradead.org/~kmpark/onenand-mtd-2.6 2006-11-29 00:03:10 +00:00
Burman Yan 95b93a0cd4 [MTD] replace kmalloc+memset with kzalloc
Signed-off-by: Yan Burman <yan_952@hotmail.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-11-28 23:47:21 +00:00
Randy Dunlap 998a43e72d [MTD] Fix printk format warning in physmap. (resources again)
Fix printk format warning:
drivers/mtd/maps/physmap.c:93: warning: long long unsigned int format, long unsigned int arg (arg 2)

Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-11-28 23:40:46 +00:00
David Woodhouse 1aaaeabf36 Merge git://git.infradead.org/~dwmw2/cafe-2.6 2006-11-28 22:43:10 +00:00
Vitaly Wool 7014568bad [MTD] [NAND] remove len/ooblen confusion.
As was discussed between Ricard Wanderlöf, David Woodhouse, Artem 
Bityutskiy and me, the current API for reading/writing OOB is confusing. 

The thing that introduces confusion is the need to specify ops.len 
together with ops.ooblen for reads/writes that concern only OOB not data 
area. So, ops.len is overloaded: when ops.datbuf != NULL it serves to 
specify the length of the data read, and when ops.datbuf == NULL, it 
serves to specify the full OOB read length.

The patch inlined below is the slightly updated version of the previous 
patch serving the same purpose, but with the new Artem's comments taken 
into account.

Artem, BTW, thanks a lot for your valuable input!

Signed-off-by: Vitaly Wool <vwool@ru.mvista.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-11-28 22:39:03 +00:00
Richard Purdie 1918767299 [MTD] Allow variable block sizes in mtd_blkdevs
Currently, mtd_blkdevs enforces a block size of 512, even if the drivers
can seemingly request a different size. This patch fixes mtd_blkdevs so
block sizes other than 512 work correctly.

Signed-off-by: Richard Purdie <rpurdie@openedhand.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-11-28 22:27:47 +00:00
Dave Olsen 90afffc8bd [MTD] [MAPS] Support for BIOS flash chips on the nvidia ck804 southbridge
Add support for accessing BIOS flash chips connected to the NVIDIA ck804 southbridge.

Signed-off-by: Ryan Jackson <rjackson@lnxi.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-11-28 22:25:27 +00:00
Stefan Roese 4010db56c8 [MTD] [NAND] Fix endianess bug in ndfc.c
The writel() call accidentally clears all bits in the NDFC_CCR
register (endianess problem). Now __raw_writel() is used instead.

Tested on Bamboo with NAND on chip select 0 and chip select 1.

Signed-off-by: Stefan Roese <sr@denx.de>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-11-28 22:22:55 +00:00
Adrian Bunk ddacff1f20 [MTD] make drivers/mtd/cmdlinepart.c:mtdpart_setup() static
This patch makes the needlessly global mtdpart_setup() static.

Signed-off-by: Adrian Bunk <bunk@stusta.de>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-11-28 22:19:16 +00:00
Adrian Bunk 1605cd3d9c [MTD] [NAND] rtc_from4.c: use lib/bitrev.c
This patch converts drivers/mtd/nand/rtc_from4.c to use the new
lib/bitrev.c

Signed-off-by: Adrian Bunk <bunk@stusta.de>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-11-28 22:18:52 +00:00
Kyungmin Park f4f91ac3c8 [MTD] OneNAND: Single bit error detection
Idea from Jarkko Lavinen

Signed-off-by: Jarkko Lavinen <jarkko.lavinen@nokia.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
2006-11-16 12:03:56 +09:00
Kyungmin Park 08f782b60a [MTD] OneNAND: lock support
Now you can use mtd lock inferface on OneNAND

The idea is from Nemakal, Vijaya, thanks

Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
2006-11-16 11:29:39 +09:00
Kyungmin Park 2c22120fbd MTD: OneNAND: interrupt based wait support
We can use the two methods to wait.
  1. polling: read interrupt status register
  2. interrupt: use kernel ineterrupt mechanism

  To use interrupt method, you first connect onenand interrupt pin to your
platform and configure interrupt properly

Signed-off-by: Kyungmin Park <kyungmin.park at samsung.com>
2006-11-16 11:23:48 +09:00
David Woodhouse cad40654c3 [MTD] NAND: Fix ECC settings in CAFÉ controller driver.
We were resetting cafe->ctl2 to zero after an erase (and also during a
write, but it was correctly reset after that). This meant that ECC reads
after an erase were failing. Doh.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-11-01 08:19:20 +08:00
David Woodhouse be8444bdf3 [MTD] NAND: Add register debugging spew option to CAFÉ driver
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-10-31 12:36:04 +08:00
David Woodhouse 195a253b66 [MTD] NAND: Use register #defines throughout CAFÉ driver, not numbers
Also use cafe_readl() and cafe_writel() abstraction to make code
slightly cleaner -- especially if we want to use it in PIO mode.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-10-31 12:30:11 +08:00
David Woodhouse a020727b16 [MTD] NAND: Fix timing calculation in CAFÉ debugging message
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-10-28 17:08:38 +03:00
Jesper Juhl efbfe96c5d [PATCH] silence 'make xmldocs' warning by adding missing description of 'raw' in nand_base.c:1485
Add description of 'raw' in comments for
drivers/mtd/nand/nand_base.c::nand_write_page_syndrome() so 'make xmldocs'
will not spew a warning at us.

Signed-off-by: Jesper Juhl <jesper.juhl@gmail.com>
Acked-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-10-27 15:34:51 -07:00
David Woodhouse 63a1423763 [MTD] NAND: Remove empty block ECC workaround
They fixed the hardware so that ECC doesn't fail on reading an empty
block.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-10-27 22:12:02 +03:00
David Woodhouse 7608194c4a [MTD] NAND: Add ECC debugging for CAFÉ
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-10-27 15:40:51 +03:00
David Woodhouse b478c775a0 [MTD] CAFÉ NAND: Add 'slowtiming' parameter, default usedma and checkecc on
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-10-27 14:50:04 +03:00
David Woodhouse dcc41bc81c [MTD] NAND: Reset Café controller before initialising.
Fixes http://dev.laptop.org/ticket/237

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-10-27 09:55:34 +03:00
David Woodhouse 2c8cfdcbeb [MTD] NAND: Café ECC -- remove spurious BUG_ON() in err_pos()
Being a value which isn't in the table is a case we explicitly check for
in the caller. Don't BUG_ON() because it does actually happen in
practice.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-10-27 09:53:08 +03:00
Ricard Wanderlöf ff0dab64b4 [MTD] NAND: Fix nand_default_mark_blockbad() when flash-based BBT disabled
When a flash-based BBT is not used, nand_default_mark_blockbad() is supposed
to mark the block bad in the oob. However, it sets the wrong length variable
so that no bad block marker is in fact written. This patch attempts to
rectify that.

(As note, it seems to be that logically, it shouldn't be necessary to set
both length variables, as one appears to be for the main buffer, and
one for the oob buffer, but this is how it is done in several places,
including the code for the mtd character device MEMWRITEOOB and MEMREADOOB
ioctls. I'm not sure if this is a temporary solution during some rework of
the mtd infrastructure, or whether there is a deeper thought here.)

Signed-off-by: Ricard Wanderlöf <ricardw@axis.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-10-26 13:17:49 +03:00
David Woodhouse 470b0a90d6 [MTD] NAND: Disable ECC checking on CAFÉ since it's broken for now
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-10-23 14:29:04 +01:00
David Woodhouse fbad5696c5 [MTD] NAND: CAFÉ NAND driver cleanup, fix ECC on reading empty flash
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-10-22 15:09:33 +01:00
David Woodhouse 04459d7c62 [MTD] NAND: Add hardware ECC correction support to CAFÉ NAND driver
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-10-22 02:18:48 +01:00
David Woodhouse c45aa055c3 Merge git://git.infradead.org/~dwmw2/cafe-2.6
Conflicts:

	drivers/mtd/nand/Kconfig
2006-10-22 02:17:05 +01:00
David Woodhouse 784f4d5e66 [MTD] NAND: Correct setting of chip->oob_poi OOB buffer
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-10-22 01:47:45 +01:00
David Woodhouse 7dcdcbef5d [MTD] NAND: Combined oob buffer so it's contiguous with data
Ditch the separate oobrbuf and oobwbuf fields from the chip buffers,
and use only a single buffer immediately after the data. This accommodates
NAND controllers such as the OLPC CAFÉ chip, which can't do scatter/gather
DMA so needs the OOB buffer to be contiguous with the data, for both read
and write.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-10-21 17:48:58 +01:00
David Woodhouse 513b046c96 Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6 2006-10-21 16:46:04 +01:00
Artem Bityutskiy 82810b7b6c [MTD] NAND: nandsim: support subpage write
As flash cannot do 0->1 bit transitions when programming, do not do this in
the simulator too. This makes nandsim able to accept subpage writes.

Signed-off-by: Artem Bityutskiy <dedekind@infradead.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-10-21 16:44:23 +01:00
David Anders a86aaa6ddf [MTD] NOR: leave Intel chips in read-array mode on suspend
During some testing with several samsung s3c24xx based
devices it was discovered that often the
cfi_cmdset_0001.c would not leave the chip in
read-array mode on suspend. this is an issue if the
same flash chip is used for the bootloader that needs
to be read on resume.

Signed-off-by: David Anders <danders@amltd.com>
Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-10-21 16:43:53 +01:00
Artem Bityutskiy d29ebdbee4 [MTD] core: trivial comments fix
Signed-off-by: Artem Bityutskiy <dedekind@infradead.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-10-21 16:42:53 +01:00
Vijay Kumar a5602146c5 [MTD] NAND: nandsim coding style fix
Removes line break after return type in function definitions, to be
consistent with the Linux coding style.

Signed-off-by: Vijay Kumar <vijaykumar@bravegnu.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-10-21 16:40:55 +01:00
Vijay Kumar d086d43640 [MTD] NAND: nandsim page-wise allocation (2/2)
For page wise allocation, an array of flash page pointers is allocated
during initialization. The flash pages are themselves allocated when a
write occurs to the page. The flash pages are deallocated when they
are erased.

Signed-off-by: Vijay Kumar <vijaykumar@bravegnu.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-10-21 16:40:27 +01:00
Vijay Kumar 47e3774338 [MTD] NAND: nandsim page-wise allocation (1/2)
This patch removes code that does chip mapping. The chip mapping code
is no longer used.

Signed-off-by: Vijay Kumar <vijaykumar@bravegnu.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-10-21 16:39:56 +01:00
Yoichi Yuasa 6652018c82 [MTD] MAPS: Remove ITE 8172G and Globespan IVR MTD support
This patch has removed ITE 8172G and Globespan IVR MTD support.
These boards support have already been removed.

Signed-off-by: Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>
Acked-by: Ralf Bächle <ralf@linux-mips.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-10-21 16:35:05 +01:00
Ricard Wanderlöf d25ade71ef [MTD] mtdchar: Fix MEMGETOOBSEL and ECCGETLAYOUT ioctls
1. The ECCGETLAYOUT ioctl copy_to_user() call has a superfluous '&'
causing the resulting information to be garbage rather than the intended
mtd->ecclayout.

2. The MEMGETOOBSEL misses copying mtd->ecclayout->eccbytes so the
resulting field of the returned structure contains garbage.

Signed-off-by: Ricard Wanderlöf <ricardw@axis.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-10-21 16:33:17 +01:00
Andrew Victor 42cb1403af [MTD] NAND: AT91 NAND driver
This version only differs from version posted by Savin Zlobec (20 Jun
2006) in that the AT91RM9200-specific chip-select / bus setup code has
been moved from the at91_nand.c driver into the processor-specific file.

From: Savin Zlobec <savin@epico.si>
Signed-off-by: Andrew Victor <andrew@sanpeople.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-10-21 16:28:26 +01:00
Alan Cox c7438d02b3 [MTD] MAPS: esb2rom: use hotplug safe interfaces
Fairly self explanatory.  Keep a reference initially, drop it when we free up
the driver resources.

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-10-21 16:22:58 +01:00
Alexey Dobriyan f33686b5a7 [MTD] JEDEC probe: fix comment typo (devic)
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-10-21 16:22:04 +01:00
Lew Glendenning 29175778b0 [MTD] MAPS: Support for BIOS flash chips on Intel ESB2 southbridge
Add MTD map driver for BIOS flash chips connected to the Intel ESB2
southbridge.

[akpm@osdl.org: coding-style fixes, build fix]
Signed-off-by: Ryan Jackson <rjackson@lnxi.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-10-21 16:21:04 +01:00
Ryan Jackson 89072ef993 [MTD] CHIPS: Support for SST 49LF040B flash chip
Add chip driver and JEDEC probe support for the SST 49LF040B flash chip.

Signed-off-by: Ryan Jackson <rjackson@lnxi.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-10-21 16:18:51 +01:00
Ryan Jackson c9073ce02a [MTD] MAPS: Add parameter to amd76xrom to override rom window size
The 2 bits controlling the window size are often set to allow reading the
BIOS, but too small to allow writing, since the lock registers are 4MiB
lower in the address space than the data.  This is intended to prevent
flashing the bios, perhaps accidentally.

The bits are 6 and 7.  If both bits are set, it is a 5MiB window. If only
the 7 Bit is set, it is a 4MiB window.  Otherwise, it is a 64KiB window.

This parameter allows the driver to override the BIOS settings.

Signed-off-by: Ryan Jackson <rjackson@lnxi.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-10-21 16:15:43 +01:00
David Woodhouse 8dd851de81 [MTD NAND] OLPC CAFÉ driver update
- Fix OOB handling, bad block table marker placement
- Some cleanups, enable runtime-optional debugging
- Allow BBT stuff to be skipped

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-10-20 02:11:40 +01:00
Al Viro afc12d30a7 [PATCH] mtd: remove several bogus casts to void * in iounmap() argument
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-10-10 15:37:22 -07:00
Adrian Bunk 1ef93a0f66 [MTD] SSFDC must depend on BLOCK
This patch fixes the following compile error with
CONFIG_SSFDC=m, CONFIG_BLOCK=n:

<--  snip  -->

...
  CC [M]  drivers/mtd/mtd_blkdevs.o
/home/bunk/linux/kernel-2.6/git/linux-2.6/drivers/mtd/mtd_blkdevs.c:40: warning: ‘struct request’ declared inside parameter list
/home/bunk/linux/kernel-2.6/git/linux-2.6/drivers/mtd/mtd_blkdevs.c:40: warning: its scope is only this definition or declaration, which is probably not what you want
/home/bunk/linux/kernel-2.6/git/linux-2.6/drivers/mtd/mtd_blkdevs.c: In function ‘do_blktrans_request’:
/home/bunk/linux/kernel-2.6/git/linux-2.6/drivers/mtd/mtd_blkdevs.c:45: error: dereferencing pointer to incomplete type
...
make[3]: *** [drivers/mtd/mtd_blkdevs.o] Error 1

<--  snip  -->

Bug report by Jesper Juhl.

This patch also removes a pointless "default n" from the SSFDC option.

Signed-off-by: Adrian Bunk <bunk@stusta.de>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-10-09 07:25:28 +01:00
David Woodhouse 5467fb0255 [MTD NAND] Initial import of CAFÉ NAND driver.
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-10-06 15:36:29 +01:00
Uwe Zeisberger f30c226954 fix file specification in comments
Many files include the filename at the beginning, serveral used a wrong one.

Signed-off-by: Uwe Zeisberger <Uwe_Zeisberger@digi.com>
Signed-off-by: Adrian Bunk <bunk@stusta.de>
2006-10-03 23:01:26 +02:00
Matt LaPlante 095096038d Fix several typos in drivers/
Signed-off-by: Adrian Bunk <bunk@stusta.de>
2006-10-03 22:31:37 +02:00
Amol Lad 76a5027c37 [MTD] Cleanup of 'ioremap balanced with iounmap for drivers/mtd subsystem'
Updated version of patch, in response to comments from Francois Romieu
<romieu@fr.zoreil.com>

Remove gratuitous casts from iounmap and initialisation of variables.

Signed-off-by: Amol Lad <amol@verismonetworks.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-10-02 09:48:23 +01:00
Frederik Deweerdt 553a801208 [MTD] fix nftl_write warning
Building 2.6.18-mm2 issues the following warning if CONFIG_NFTL_RW is not set:

  CC [M]  drivers/mtd/nftlcore.o
drivers/mtd/nftlcore.c:183: warning: 'nftl_write' defined but not used
The following patch only compiles nftl_write if CONFIG_NFTL_RW is set.

Signed-off-by: Frederik Deweerdt <frederik.deweerdt@gmail.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-10-02 09:42:25 +01:00
Jeff Garzik 9a29230825 [MTD] fix printk warning
gcc spits out this warning:

drivers/mtd/mtd_blkdevs.c: In function ‘do_blktrans_request’:
drivers/mtd/mtd_blkdevs.c:72: warning: format ‘%ld’ expects type ‘long int’, but argument 2 has type ‘unsigned int’

This could be fixed any number of ways, including use of BUG().
rq_data_dir() only returns 0 or 1, so this entire case is superfluous.
I did the most simple fix.

Signed-off-by: Jeff Garzik <jeff@garzik.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-10-01 17:57:26 +01:00
David Woodhouse 8a84fc15ae Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
Manually resolve conflict in include/mtd/Kbuild

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-10-01 17:55:53 +01:00
David Howells 9361401eb7 [PATCH] BLOCK: Make it possible to disable the block layer [try #6]
Make it possible to disable the block layer.  Not all embedded devices require
it, some can make do with just JFFS2, NFS, ramfs, etc - none of which require
the block layer to be present.

This patch does the following:

 (*) Introduces CONFIG_BLOCK to disable the block layer, buffering and blockdev
     support.

 (*) Adds dependencies on CONFIG_BLOCK to any configuration item that controls
     an item that uses the block layer.  This includes:

     (*) Block I/O tracing.

     (*) Disk partition code.

     (*) All filesystems that are block based, eg: Ext3, ReiserFS, ISOFS.

     (*) The SCSI layer.  As far as I can tell, even SCSI chardevs use the
     	 block layer to do scheduling.  Some drivers that use SCSI facilities -
     	 such as USB storage - end up disabled indirectly from this.

     (*) Various block-based device drivers, such as IDE and the old CDROM
     	 drivers.

     (*) MTD blockdev handling and FTL.

     (*) JFFS - which uses set_bdev_super(), something it could avoid doing by
     	 taking a leaf out of JFFS2's book.

 (*) Makes most of the contents of linux/blkdev.h, linux/buffer_head.h and
     linux/elevator.h contingent on CONFIG_BLOCK being set.  sector_div() is,
     however, still used in places, and so is still available.

 (*) Also made contingent are the contents of linux/mpage.h, linux/genhd.h and
     parts of linux/fs.h.

 (*) Makes a number of files in fs/ contingent on CONFIG_BLOCK.

 (*) Makes mm/bounce.c (bounce buffering) contingent on CONFIG_BLOCK.

 (*) set_page_dirty() doesn't call __set_page_dirty_buffers() if CONFIG_BLOCK
     is not enabled.

 (*) fs/no-block.c is created to hold out-of-line stubs and things that are
     required when CONFIG_BLOCK is not set:

     (*) Default blockdev file operations (to give error ENODEV on opening).

 (*) Makes some /proc changes:

     (*) /proc/devices does not list any blockdevs.

     (*) /proc/diskstats and /proc/partitions are contingent on CONFIG_BLOCK.

 (*) Makes some compat ioctl handling contingent on CONFIG_BLOCK.

 (*) If CONFIG_BLOCK is not defined, makes sys_quotactl() return -ENODEV if
     given command other than Q_SYNC or if a special device is specified.

 (*) In init/do_mounts.c, no reference is made to the blockdev routines if
     CONFIG_BLOCK is not defined.  This does not prohibit NFS roots or JFFS2.

 (*) The bdflush, ioprio_set and ioprio_get syscalls can now be absent (return
     error ENOSYS by way of cond_syscall if so).

 (*) The seclvl_bd_claim() and seclvl_bd_release() security calls do nothing if
     CONFIG_BLOCK is not set, since they can't then happen.

Signed-Off-By: David Howells <dhowells@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2006-09-30 20:52:31 +02:00
Jens Axboe 4aff5e2333 [PATCH] Split struct request ->flags into two parts
Right now ->flags is a bit of a mess: some are request types, and
others are just modifiers. Clean this up by splitting it into
->cmd_type and ->cmd_flags. This allows introduction of generic
Linux block message types, useful for sending generic Linux commands
to block devices.

Signed-off-by: Jens Axboe <axboe@suse.de>
2006-09-30 20:23:37 +02:00
Kyungmin Park 28b79ff966 [MTD ONENAND] Check OneNAND lock scheme & all block unlock command support
OneNAND lock scheme depends on density and process of chip.
Some OneNAND chips support all block unlock

Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-09-26 16:46:28 +01:00
Kyungmin Park 98638ee2ed [MTD ONENAND] Remove unused MTD_ONENAND_SYNC_READ configuration
Now the bootloader configures the OneNAND sync. burst mode.
So we don't access Sync. burst mode related registers in kernel.

Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-09-26 10:02:37 +01:00
Kyungmin Park 47e777e02e [MTD ONENAND] Fix OneNAND probe
- fix OneNAND probe whether OneNAND Sync. Burst read mode or not
        - fix OneNAND reset wait problem

Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-09-26 09:16:06 +01:00
David Woodhouse 956e944c76 [MTD NAND] Allow override of page read and write functions.
- allow high-level nand_write_page() function to be overridden
- likewise low-level write_page_raw() and read_page_raw() functions
- Clean up the abuse of chip->ecc.{write,read}_page() with MTD_OOB_RAW

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-09-25 17:12:39 +01:00
David Woodhouse 4bf63fcb83 [MTD NAND] Allocate chip->buffers separately to allow it to be overridden
In particular, the board driver might need it to be DMAable.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-09-25 17:08:04 +01:00
David Woodhouse 3b85c3211e [MTD NAND] Split nand_scan() into two parts; allow board driver to intervene
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-09-25 17:06:53 +01:00
David Woodhouse 4b648b0253 [MTD NAND] Export nand_wait_ready() for use by board drivers
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-09-25 17:05:24 +01:00
David Woodhouse 08d3ad6a51 [MTD] Whitespace cleanup in SSFDC driver.
Says akpm: ' - search for "( " and " )", fix.'

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-09-23 16:20:48 +01:00
David Woodhouse 9a05eded5d [MTD] SSFDC translation layer minor cleanup
Don't include <linux/config.h>.
Don't say 'MB' where you mean 'MiB'.
Don't allocate 512 bytes on the stack.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-09-23 10:56:24 +01:00
David Woodhouse 892e4fba1c [MTD] Fix dependencies with CONFIG_MTD=m
CMDLINEPARTS shouldn't be selectable, and neither should SSFDC, which
can be a tristate anyway.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-09-23 10:24:36 +01:00
David Woodhouse e4e3295f0c Revert "[MTD] blkdev helper code: fix printk format warning"
This reverts commit 668040fcd1.

The 'flags' field of the struct request is 'unsigned long'. Quite
how Randy came to see 'long int format, different type arg' I don't
know, but it doesn't seem to be the case any more.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-09-22 11:05:42 +01:00
Claudio Lanconelli 51197abf29 [MTD] Add SSFDC (SmartMedia) read-only translation layer
Signed-off-by: Claudio Lanconelli <lanconelli.claudio@eptar.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-09-22 11:01:37 +01:00
Jiri Slaby 98aacdfde0 [MTD] pmc551 pci cleanup
Use pci_resource_start for getting start of regions and pci_iomap to not
doing this directly by using dev->resource... (Thanks to Rolf Eike Beer)

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-09-22 10:34:15 +01:00
Jiri Slaby 7fefb924d7 [MTD] pmc551 use kzalloc
Use kzalloc instad of kmalloc+memset(0).

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-09-22 10:33:52 +01:00
Jiri Slaby cdf0a7d169 [MTD] pmc551 whitespace cleanup
Spaces were used for indent, there was more than 80 columns per line. Get
rid of that stuff.

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-09-22 10:33:31 +01:00
Lennert Buytenhek e417fcfb85 [MTD] Remove iq80310 map driver
The iq80310 mtd map driver depends on ARCH_IQ80310, which isn't
defined anywhere in the tree (as we don't have 80310 support), and
furthermore, everything the driver does can be done with physmap
instead.

Signed-off-by: Lennert Buytenhek <buytenh@wantstofly.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-09-22 10:31:01 +01:00
Frank Haverkamp 6a545a0d60 [MTD NAND] Fix in typo ndfc.c causing wrong ECC layout
Due to this typo, a wrong ECC layout table is chosen.

Signed-off-by: Frank Haverkamp <haver@vnet.ibm.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-09-22 10:30:25 +01:00
Lennert Buytenhek 17c2dae3aa [MTD] physmap: add power management support
Implement PM handling for physmap.  Idea from Steven Scholz, patch
by David Anders.

Signed-off-by: Lennert Buytenhek <buytenh@wantstofly.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-09-22 10:26:56 +01:00
Amol Lad 25f0c659fe ioremap balanced with iounmap for drivers/mtd subsystem
ioremap must be balanced by an iounmap and failing to do so can result
in a memory leak.

Tested (compilation only) with:
- allmodconfig
- Modifying drivers/mtd/maps/Kconfig and drivers/mtd/nand/Kconfig to
make sure that the changed file is compiling without warning

Signed-off-by: Amol Lad <amol@verismonetworks.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-09-22 10:24:31 +01:00
Alan Cox dd8e9ed6ed [MTD] Switch to pci_get_device and do ref counting
Signed-off-by: Alan Cox <alan@redhat.com>
Cc: Greg KH <greg@kroah.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-09-22 10:19:20 +01:00
Randy Dunlap 668040fcd1 [MTD] blkdev helper code: fix printk format warning
Fix printk format warning(s):
drivers/mtd/mtd_blkdevs.c:72: warning: long int format, different type arg (arg 2)

Signed-off-by: Randy Dunlap <rdunlap@xenotime.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-09-22 10:17:28 +01:00
Brian Walsh f40a6f1cc7 [MTD] Fix ixp4xx partition parsing.
If the amount of flash is not divisible by 2 then the mask in
parse_mtd_partitions would fail to work as designed.  Passing in the base
address corrects this problem.

Signed-off-by: Brian Walsh <brian@walsh.ws>
Cc: Deepak Sanexa <dsanexa@mvista.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-09-22 10:16:16 +01:00
Michal Piotrowski cbc88ba83f [MTD NAND] Remove old code in au1550nd.c
Signed-off-by: Michal Piotrowski <michal.k.k.piotrowski@gmail.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-09-22 10:09:44 +01:00
Håvard Skinnemoen 187ef15268 [MTD] Unlock NOR flash automatically where necessary
Introduce the MTD_STUPID_LOCK flag which indicates that the flash chip is
always locked after power-up, so all sectors need to be unlocked before it
is usable.

If this flag is set, and the chip provides an unlock() operation,
mtd_add_device will unlock the whole MTD device if it's writeable.  This
means that non-writeable partitions will stay locked.

Set MTD_STUPID_LOCK in fixup_use_atmel_lock() so that these chips will work
as expected.

Signed-off-by: Håvard Skinnemoen <hskinnemoen@atmel.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-09-22 10:07:08 +01:00
Josef 'Jeff' Sipek ea59830db0 [MTD] Use SEEK_{SET,CUR,END} instead of hardcoded values in mtdchar lseek()
Signed-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-09-17 17:04:23 +01:00
Håvard Skinnemoen de591dacf3 MTD: Fix bug in fixup_convert_atmel_pri
The memset() in fixup_convert_atmel_pri is supposed to zero out
everything except the first 5 bytes in *extp, but it ends up zeroing
out something way outside the struct instead. Fix this potentially
dangerous code by casting the pointer to char * before doing
arithmetic.

Signed-off-by: Håvard Skinnemoen <hskinnemoen@atmel.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-09-16 13:54:17 +01:00
Aubrey Lee fa6c220a7f [PATCH] [MTD] DEVICES: Fill more device IDs in the structure of m25p80
The flash_info structure has a bunch of missing fields which causes problems
when actually tryin to use some ST parts as it gets detected incorrectly.

Signed-off-by: Aubrey L1 <aubreylee@gmail.com>
Signed-off-by: Josh Boyer <jwboyer@gmail.com>
2006-09-05 05:55:07 -05:00
David Woodhouse 0a7d5f8ce9 Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6 2006-08-30 23:30:38 +01:00
Jonathan McDowell fb8d81e477 [PATCH] MTD NAND: Fix ams-delta after core conversion
The recent hwctrl core conversion for MTD NAND devices broke the Amstrad
Delta driver.  This fixes it up and uses the existing control line defines
rather than unclear magic numbers.

Signed-off-by: Jonathan McDowell <noodles@earth.li>
Acked-by: David Woodhouse <dwmw2@infradead.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-08-27 11:01:30 -07:00
Richard Purdie 7fd5aecc5d [PATCH] mtd corruption fix
Read the return value before we release the nand device otherwise the
value can become corrupted by another user of chip->ops, ultimately
resulting in filesystem corruption.

Signed-off-by: Richard Purdie <rpurdie@rpsys.net>
Cc: David Woodhouse <dwmw2@infradead.org>
Acked-by: Josh Boyer <jwboyer@gmail.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-08-27 11:01:29 -07:00
Haavard Skinnemoen 0165508c80 MTD: Add lock/unlock operations for Atmel AT49BV6416
The AT49BV6416 is locked by default, so we really need to provide
at least the unlock() operation for write and erase to work. This
patch implements both ->lock() and ->unlock() and provides a fixup
to install them when an AT49BV6416 chip is detected.

These functions are probably valid on more Atmel chips, but I believe
it's mostly obsolete ones. The AT49BV6416 is in fact obsolete, but
it's used on all current AT32STK1000 development boards.

Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
Signed-off-by: Josh Boyer <jwboyer@gmail.com>
2006-08-16 20:16:43 -05:00
Haavard Skinnemoen 5b0c5c2c0d MTD: Convert Atmel PRI information to AMD format
Atmel flash chips don't have PRI information in the same format as
AMD flash chips. This patch installs a fixup for all Atmel chips that
converts the relevant PRI fields into AMD format.

Only the fields that are actually used by the command set is actually
converted. The rest are initialized to zero (which should be safe)

Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
Signed-off-by: Josh Boyer <jwboyer@gmail.com>
2006-08-16 20:13:06 -05:00
Takashi YOSHII 79b9cd586f [PATCH] [MTD] Maps: Add dependency on alternate probe methods to physmap
map/physmap.c tries to probe "cfi_probe", "jedec_probe" and "map_rom", but
map/Kconfig says it depends on MTD_CFI only.
This patch adds  MTD_JEDECPROBE and MTD_ROM to the dependency condition.

Signed-off-by: Takashi YOSHII <takasi-y@ops.dti.ne.jp>
Signed-off-by: Josh Boyer <jwboyer@gmail.com>
2006-08-15 07:26:32 -05:00
Takashi YOSHI c4e6952ffd [PATCH] MTD: Add Macronix MX29F040 to JEDEC
Signed-off-by: Takashi YOSHII <takasi-y@ops.dti.ne.jp>
Signed-off-by: Josh Boyer <jwboyer@gmail.com>
2006-08-14 19:48:30 -05:00
Alexey Korolev 46a1652c28 [MTD] Fixes of performance and stability issues in CFI driver.
Fix of performance and stability issues on Intel NOR chips. It fixes:

1. Very low write performance on Sibley (perf tests demonstrated write
   performance less than 100Kb/sec when it should be over 400Kb/sec).

2. Low erase performance. (perf tests on Sibleuy demonstrated erase
   performance 246Kb/sec when it should be over 300Kb/sec).

3. Error on JFFS2 tests with CPU loading application when MTD returns
   "block erase error: (status timeout)" To fix the issue it does the
   following:
     1. Removes the timeout tuning from inval_cache_and_wait_for_operation.
     2. Waiting conditions in inval_cache_and_wait_for_operation now is
         based on timer resolution
        If timeout is lower than timer resolution then we do in cycle
	  "Checking the status"
	  udelay(1);
	  cond_resched();
        If timeout is greater than timer resolution (probably erase
        operation) We do the following
	  sleep for half of operation timeout and do in cycle the following
	    "Checking the status"
	    sleep for timer resolution

Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Alexey Korolev <akorolev@infradead.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-07-15 13:43:59 +01:00
Ville Herva c4e7fb3137 block2mtd.c: Make kernel boot command line arguments work (try 4)
Trying to pass kernel command line arguments to block2mtd at boot-time does
not work currently. block2mtd_setup() is called so early that kmalloc()
fails nevermind being able to do open_bdev_excl() (which requires rootfs to
be mounted. This patch only saves the option string at the early boot stage,
and parses them later when block2mtd_init() is called. If open_bdev_excl()
fails, open_by_devnum(name_to_dev_t()) is tried instead, which makes it
possible to initialize the driver before rootfs has been mounted. Also gets
rid of the superfluous parse_name() that only checks if name is longer than
80 chars and copies it to a string that is not kfreed.

With this patch, I can boot statically compiled block2mtd, and mount jffs2
as rootfs (without modules or initrd), with lilo config like this:

   root=/dev/mtdblock0
   append="rootfstype=jffs2 block2mtd.block2mtd=/dev/hdc2,65536"

(Note that rootfstype=jffs2 is required, since the kernel only tries
filesystems without "nodev" attribute by default, and jffs is "nodev").

Compared to first version of this patch, this one does not copy the
parameters to the global buffer if init has already been called, and the
global array is marked as __initdata.

Compared to the second version of this patch, module build is fixed.

Compared to the third version of this patch, statically compiled block2mtd
driver with no boot-time parameter no longer gives spurious error 'cannot
open device ""'

Signed-off-by: Ville Herva <vherva@vianova.fi>
Acked-by: Jörn Engel <joern@wohnheim.fh-wedel.de>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-07-15 13:39:10 +01:00
David Woodhouse 9a909867d2 [MTD NAND] Fix lookup error in nand_get_flash_type()
Spotted by liyu <liyu@ccoss.com.cn>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-07-15 13:26:18 +01:00
Rolf Eike Beer 9d05cd5178 remove #error on !PCI from pmc551.c
PMC551 depends on PCI in Kconfig so there is no need to #error in code if PCI
is not set.

Signed-off-by: Rolf Eike Beer <eike-kernel@sf-tec.de>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-07-15 13:19:55 +01:00
Richard Purdie 6a5a297cf7 MTD: [NAND] Fix the sharpsl driver after breakage from a core conversion
The CNE bits are inverted on the device and writeb function is missing a
NOT operation.

Signed-off-by: Richard Purdie <rpurdie@rpsys.net>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-07-15 13:19:24 +01:00
Vitaly Wool 8b0036eefd [MTD] NAND: OOB buffer offset fixups
In the case of data-pad-ecc-pad-data... layout the oob start position
has to be sizeof(data) in nand_write_oob_syndrom().

In nand_fill_oob() we need to copy to buf + buffer offset instead of
buf + write offset.

From: Vitaly Wool <vwool@ru.mvista.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2006-07-11 09:11:25 +02:00
Artem B. Bityutskiy 220b0f5755 [PATCH] [MTD] NAND: fix dead URL in Kconfig
Signed-off-by: Artem B. Bityutskiy <dedekind@infradead.org>
2006-07-05 14:45:11 +01:00
Linus Torvalds 0d1782144e Merge git://git.infradead.org/mtd-2.6
* git://git.infradead.org/mtd-2.6:
  [JFFS2][XATTR] Fix memory leak in POSIX-ACL support
  fs/jffs2/: make 2 functions static
  [MTD] NAND: Fix broken sharpsl driver
  [JFFS2][XATTR] Fix xd->refcnt race condition
  MTD: kernel-doc fixes + additions
  MTD: fix all kernel-doc warnings
  [MTD] DOC: Fixup read functions and do a little cleanup
2006-07-03 21:29:08 -07:00
Jörn Engel 6ab3d5624e Remove obsolete #include <linux/config.h>
Signed-off-by: Jörn Engel <joern@wohnheim.fh-wedel.de>
Signed-off-by: Adrian Bunk <bunk@stusta.de>
2006-06-30 19:25:36 +02:00
Thomas Gleixner 27a288677d [MTD] NAND: Fix broken sharpsl driver
Remove the not longer supported NO_VIRTBLOCKS flag and remove
an unused variable while at it.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2006-06-29 21:25:10 +02:00
Linus Torvalds 1903ac54f8 Merge master.kernel.org:/pub/scm/linux/kernel/git/gregkh/pci-2.6
* master.kernel.org:/pub/scm/linux/kernel/git/gregkh/pci-2.6:
  [PATCH] i386: export memory more than 4G through /proc/iomem
  [PATCH] 64bit Resource: finally enable 64bit resource sizes
  [PATCH] 64bit Resource: convert a few remaining drivers to use resource_size_t where needed
  [PATCH] 64bit resource: change pnp core to use resource_size_t
  [PATCH] 64bit resource: change pci core and arch code to use resource_size_t
  [PATCH] 64bit resource: change resource core to use resource_size_t
  [PATCH] 64bit resource: introduce resource_size_t for the start and end of struct resource
  [PATCH] 64bit resource: fix up printks for resources in misc drivers
  [PATCH] 64bit resource: fix up printks for resources in arch and core code
  [PATCH] 64bit resource: fix up printks for resources in pcmcia drivers
  [PATCH] 64bit resource: fix up printks for resources in video drivers
  [PATCH] 64bit resource: fix up printks for resources in ide drivers
  [PATCH] 64bit resource: fix up printks for resources in mtd drivers
  [PATCH] 64bit resource: fix up printks for resources in pci core and hotplug drivers
  [PATCH] 64bit resource: fix up printks for resources in networks drivers
  [PATCH] 64bit resource: fix up printks for resources in sound drivers
  [PATCH] 64bit resource: C99 changes for struct resource declarations

Fixed up trivial conflict in drivers/ide/pci/cmd64x.c (the printk that
was changed by the 64-bit resources had been deleted in the meantime ;)
2006-06-29 10:49:17 -07:00
Randy Dunlap 844d3b427e MTD: fix all kernel-doc warnings
Fix all kernel-doc warnings in MTD headers and source files:
- add some missing struct fields;
- correct some function parameter names;
- use kernel-doc format for function doc. headers;
- nand_ecc.c contains only exported interfaces, no internal ones;

Signed-off-by: Randy Dunlap <rdunlap@xenotime.net>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-06-29 08:55:00 +01:00
Thomas Gleixner 7f8a894066 [MTD] DOC: Fixup read functions and do a little cleanup
The NAND rework resulted in non ECC based reads. Fix it up and
do a bit of cleanup while at it.

Pointed out by Adrian Bunk.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2006-06-28 10:11:33 +02:00
Linus Torvalds 936813a880 Merge git://git.infradead.org/mtd-2.6
* git://git.infradead.org/mtd-2.6:
  [MTD] NAND: Select chip before checking write protect status
  [MTD] CORE mtdchar.c: fix off-by-one error in lseek()
  [MTD] NAND: Fix typo in mtd/nand/ts7250.c
  [JFFS2][XATTR] coexistence between xattr and write buffering support.
  [JFFS2][XATTR] Fix wrong copyright
  [JFFS2][XATTR] Re-define xd->refcnt as atomic_t
  [JFFS2][XATTR] Fix memory leak with jffs2_xattr_ref
  [JFFS2][XATTR] rid unnecessary writing of delete marker.
  [JFFS2][XATTR] Fix ACL bug when updating null xattr by null ACL.
  [JFFS2][XATTR] using 'delete marker' for xdatum/xref deletion
  [MTD] Fix off-by-one error in physmap.c
  [MTD] Remove unused 'nr_banks' variable from ixp2000 map driver
  [MTD NAND] s3c2412 support in s3c2410.c
  [MTD] Initialize 'writesize'
  [MTD] NAND: ndfc fix address offset thinko
  [MTD] NAND: S3C2410 convert prinks to dev_*()s
  [MTD] NAND: Missing fixups
2006-06-27 19:13:56 -07:00
Thomas Gleixner 6a93096195 [MTD] NAND: Select chip before checking write protect status
The other way round works not really well with boards which have a
static NAND chipselect.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-06-27 23:24:09 +01:00
Herbert Valerio Riedel 1887f517e3 [MTD] CORE mtdchar.c: fix off-by-one error in lseek()
Allow lseek(mtdchar_fd, 0, SEEK_END) to succeed, which currently fails
with EINVAL.

lseek(fd, 0, SEEK_END) should result into the same fileposition as
lseek(fd, 0, SEEK_SET) + read(fd, buf, length(fd))

Furthermore, lseek(fd, 0, SEEK_CUR) should return the current file position,
which in case of an encountered EOF should not result in EINVAL

Signed-off-by: Herbert Valerio Riedel <hvr@gnu.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-06-27 23:22:07 +01:00
Petr Stetiar 0e4ced59de [MTD] NAND: Fix typo in mtd/nand/ts7250.c
I was unable to compile ts7250.c after your refactor commit,
it's a typo probably.

-- ynezz

From: Petr Stetiar <ynezz@true.cz>
Signed-off-by: Thomas Gleixner  <tglx@linutronix.de>
2006-06-27 23:20:48 +01:00
Greg Kroah-Hartman 176dfc633b [PATCH] 64bit resource: fix up printks for resources in mtd drivers
This is needed if we wish to change the size of the resource structures.

Based on an original patch from Vivek Goyal <vgoyal@in.ibm.com>

Cc: Vivek Goyal <vgoyal@in.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-06-27 09:23:58 -07:00
Sascha Hauer 6d4f8224d4 [MTD] Fix off-by-one error in physmap.c
This patch fixes a simple off-by-one error in the mtd physmap driver.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Lennert Buytenhek <buytenh@wantstofly.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-06-27 14:38:15 +01:00
Lennert Buytenhek ce5b0968b1 [MTD] Remove unused 'nr_banks' variable from ixp2000 map driver
Signed-off-by: Lennert Buytenhek <buytenh@wantstofly.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-06-27 14:36:20 +01:00
Ben Dooks 2c06a08217 [MTD NAND] s3c2412 support in s3c2410.c
Add support for both the S3C2412 and S3C2412 Samsung SoCs to
the increasingly mis-named s3c2410.c driver.

This currently only supports SLC ECCs, and a chip on nFCE0.

Signed-off-by: Ben Dooks <ben-linux@fluff.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-06-27 14:35:46 +01:00
Linus Torvalds 2a2ed2db35 Merge git://git.kernel.org/pub/scm/linux/kernel/git/sam/kbuild
* git://git.kernel.org/pub/scm/linux/kernel/git/sam/kbuild: (40 commits)
  kbuild: trivial fixes in Makefile
  kbuild: adding symbols in Kconfig and defconfig to TAGS
  kbuild: replace abort() with exit(1)
  kbuild: support for %.symtypes files
  kbuild: fix silentoldconfig recursion
  kbuild: add option for stripping modules while installing them
  kbuild: kill some false positives from modpost
  kbuild: export-symbol usage report generator
  kbuild: fix make -rR breakage
  kbuild: append -dirty for updated but uncommited changes
  kbuild: append git revision for all untagged commits
  kbuild: fix module.symvers parsing in modpost
  kbuild: ignore make's built-in rules & variables
  kbuild: bugfix with initramfs
  kbuild: modpost build fix
  kbuild: check license compatibility when building modules
  kbuild: export-type enhancement to modpost.c
  kbuild: add dependency on kernel.release to the package targets
  kbuild: `make kernelrelease' speedup
  kconfig: KCONFIG_OVERWRITECONFIG
  ...
2006-06-26 11:05:15 -07:00
David S. Miller 29f7ac7ecc [MTD] sun_uflash: Port to new EBUS device layer.
Signed-off-by: David S. Miller <davem@davemloft.net>
2006-06-25 23:14:51 -07:00
Artem B. Bityutskiy 17ffc7ba6d [MTD] Initialize 'writesize'
Signed-off-by: Artem B. Bityutskiy <dedekind@infradead.org>
2006-06-22 18:15:48 +04:00
Thomas Gleixner 1794c13002 [MTD] NAND: ndfc fix address offset thinko
The rework of the command handling in the nand driver
led to wrong address setting in the command control
function. Use the correct address again.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2006-06-22 13:06:43 +02:00
Ben Dooks 99974c62b6 [MTD] NAND: S3C2410 convert prinks to dev_*()s
Convert the use of printk() to the correct dev_info/dev_err
functions

Signed-off-by: Ben Dooks <ben-linux@fluff.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2006-06-21 18:56:34 +02:00
Savin Zlobec 0d420f9d61 [MTD] NAND: Missing fixups
The oob fixups broke a return value and missed one patch from
the Mailing List.

Signed-off-by: Savin Zlobec <savin@epico.si>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2006-06-21 13:11:56 +01:00
Thomas Gleixner 7bc3312bef [MTD] NAND: Fix breakage all over the place
Following problems are addressed:

- wrong status caused early break out of nand_wait()
- removed the bogus status check in nand_wait() which
  is a relict of the abandoned support for interrupted
  erase.
- status check moved to the correct place in read_oob
- oob support for syndrom based ecc with strange layouts
- use given offset in the AUTOOOB based oob operations

Partially based on a patch from Vitaly Vool <vwool@ru.mvista.com>
Thanks to Savin Zlobec <savin@epico.si> for tracking down the
status problem.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2006-06-20 20:31:24 +01:00
Vitaly Wool 7e4178f90e [PATCH] NAND: fix remaining OOB length calculation
In nand_read_page_syndrome/nand_write_page_syndrome the calculation of
the remaining oob length which is not used by the prepad/ecc/postpad
areas is wrong.

Signed-off-by: Vitaly Wool <vwool@ru.mvista.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2006-06-20 20:31:23 +01:00
Thomas Gleixner b6d5ee00e3 [MTD] NAND Fixup NDFC merge brokeness
Remove the remains of a broken merge.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2006-06-20 20:31:23 +01:00
Ben Dooks ad3b5fb772 [MTD NAND] S3C2410 driver cleanup
Fix unused variables and commenting since tglx's
new NAND updates

Signed-off-by: Ben Dooks <ben-linux@fluff.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-06-19 09:43:23 +01:00
Ben Dooks d1fef3c5e1 [MTD NAND] s3c24x0 board: Fix clock handling, ensure proper initialisation.
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-06-19 09:29:38 +01:00
David Woodhouse 21c8db9eff [MTD] Restore MTD_ROM and MTD_RAM types
Let's not attempt the abolition of mtd->type until/unless it's properly
thought through. And certainly, let's not do it by halves.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-06-14 21:39:48 +01:00
Artem B. Bityutskiy 783ed81ff3 [MTD] assume mtd->writesize is 1 for NOR flashes
Signed-off-by: Artem B. Bityitskiy
2006-06-14 19:53:44 +04:00
David Woodhouse f9068876f5 [MTD NAND] Fix s3c2410 NAND driver so it at least _looks_ like it compiles
Fix the control bit handling so it even looks like it might work, too.
Bad tglx. No biscuit.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-06-10 00:53:16 +01:00
Roman Zippel e55a3e8aed kconfig: remove leading whitespace in menu prompts
This removes all the leading whitespace kconfig now warns about.

Signed-off-by: Roman Zippel <zippel@linux-m68k.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
2006-06-09 16:28:07 +02:00
Andrew Morton f24ff6bf8c [MTD] Prepare physmap for 64-bit-resources
Fallout from the incoming 64-bit-resource stuff:

drivers/mtd/maps/physmap.c: In function 'physmap_flash_probe':
drivers/mtd/maps/physmap.c:94: warning: format '%.8lx' expects type 'long
unsigned int', but argument 2 has type 'resource_size_t'
drivers/mtd/maps/physmap.c:94: warning: format '%.8lx' expects type 'long
unsigned int', but argument 3 has type 'resource_size_t'

Cc: Vivek Goyal <vgoyal@in.ibm.com>
Cc: Greg KH <greg@kroah.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-06-09 15:12:34 +01:00