Commit Graph

710 Commits

Author SHA1 Message Date
Jean Delvare b3561ea946 Clean up mutex_trylock noise
Ingo Molnar's semaphore to mutex conversions left some noise on a few
trylock calls. Clean it up.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Acked-by: Ingo Molnar <mingo@elte.hu>
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: Mauro Carvalho Chehab <mchehab@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-05-08 11:15:13 -07:00
Paul Mackerras 02bbc0f09c Merge branch 'linux-2.6' 2007-05-08 13:37:51 +10:00
Vitaly Wool 711fdf627c [MTD] [NAND] platform NAND driver: add driver
This patch adds support for generic platform NAND driver.
Updated after tglx's review/discussion in IRC #mtd channel.

Signed-off-by: Vitaly Wool <vitalywool@gmail.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-05-08 00:41:55 +01:00
Christoph Lameter 50953fe9e0 slab allocators: Remove SLAB_DEBUG_INITIAL flag
I have never seen a use of SLAB_DEBUG_INITIAL.  It is only supported by
SLAB.

I think its purpose was to have a callback after an object has been freed
to verify that the state is the constructor state again?  The callback is
performed before each freeing of an object.

I would think that it is much easier to check the object state manually
before the free.  That also places the check near the code object
manipulation of the object.

Also the SLAB_DEBUG_INITIAL callback is only performed if the kernel was
compiled with SLAB debugging on.  If there would be code in a constructor
handling SLAB_DEBUG_INITIAL then it would have to be conditional on
SLAB_DEBUG otherwise it would just be dead code.  But there is no such code
in the kernel.  I think SLUB_DEBUG_INITIAL is too problematic to make real
use of, difficult to understand and there are easier ways to accomplish the
same effect (i.e.  add debug code before kfree).

There is a related flag SLAB_CTOR_VERIFY that is frequently checked to be
clear in fs inode caches.  Remove the pointless checks (they would even be
pointless without removeal of SLAB_DEBUG_INITIAL) from the fs constructors.

This is the last slab flag that SLUB did not support.  Remove the check for
unimplemented flags from SLUB.

Signed-off-by: Christoph Lameter <clameter@sgi.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-05-07 12:12:57 -07:00
Nick Piggin 6fe6900e1e mm: make read_cache_page synchronous
Ensure pages are uptodate after returning from read_cache_page, which allows
us to cut out most of the filesystem-internal PageUptodate calls.

I didn't have a great look down the call chains, but this appears to fixes 7
possible use-before uptodate in hfs, 2 in hfsplus, 1 in jfs, a few in
ecryptfs, 1 in jffs2, and a possible cleared data overwritten with readpage in
block2mtd.  All depending on whether the filler is async and/or can return
with a !uptodate page.

Signed-off-by: Nick Piggin <npiggin@suse.de>
Cc: Hugh Dickins <hugh@veritas.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-05-07 12:12:51 -07:00
Linus Torvalds 15700770ef Merge git://git.kernel.org/pub/scm/linux/kernel/git/sam/kbuild
* git://git.kernel.org/pub/scm/linux/kernel/git/sam/kbuild: (38 commits)
  kconfig: fix mconf segmentation fault
  kbuild: enable use of code from a different dir
  kconfig: error out if recursive dependencies are found
  kbuild: scripts/basic/fixdep segfault on pathological string-o-death
  kconfig: correct minor typo in Kconfig warning message.
  kconfig: fix path to modules.txt in Kconfig help
  usr/Kconfig: fix typo
  kernel-doc: alphabetically-sorted entries in index.html of 'htmldocs'
  kbuild: be more explicit on missing .config file
  kbuild: clarify the creation of the LOCALVERSION_AUTO string.
  kbuild: propagate errors from find in scripts/gen_initramfs_list.sh
  kconfig: refer to qt3 if we cannot find qt libraries
  kbuild: handle compressed cpio initramfs-es
  kbuild: ignore section mismatch warning for references from .paravirtprobe to .init.text
  kbuild: remove stale comment in modpost.c
  kbuild/mkuboot.sh: allow spaces in CROSS_COMPILE
  kbuild: fix make mrproper for Documentation/DocBook/man
  kbuild: remove kconfig binaries during make mrproper
  kconfig/menuconfig: do not hardcode '.config'
  kbuild: override build timestamp & version
  ...
2007-05-06 13:21:57 -07:00
Andrew Victor 693ef66d89 [MTD] [NAND] at91_nand.c: CMDLINE_PARTS support
This patch allows you to specify at91_nand partitions on the
kernel command line using the mtdparts variable, if
CONFIG_MTD_CMDLINE_PARTS is set.

Signed-off-by: Frank Mandarino <fmandarino@endrelia.com>
Signed-off-by: Andrew Victor <andrew@sanpeople.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-05-03 07:40:41 +01:00
Thomas Knobloch 1a12f46af1 [MTD] [NAND] Tidy up handling of page number in nand_block_bad()
Further to the previous patch fixing the calculation of page number,
both branches are using the same result. Clean up the function 
accordingly, calculating it (and also masking with pagemask) only in one 
place.

Signed-off-by: Thomas Knobloch <knobloch@siemens.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-05-03 07:39:37 +01:00
Jean Delvare 6473d160b4 PCI: Cleanup the includes of <linux/pci.h>
I noticed that many source files include <linux/pci.h> while they do
not appear to need it. Here is an attempt to clean it all up.

In order to find all possibly affected files, I searched for all
files including <linux/pci.h> but without any other occurence of "pci"
or "PCI". I removed the include statement from all of these, then I
compiled an allmodconfig kernel on both i386 and x86_64 and fixed the
false positives manually.

My tests covered 66% of the affected files, so there could be false
positives remaining. Untested files are:

arch/alpha/kernel/err_common.c
arch/alpha/kernel/err_ev6.c
arch/alpha/kernel/err_ev7.c
arch/ia64/sn/kernel/huberror.c
arch/ia64/sn/kernel/xpnet.c
arch/m68knommu/kernel/dma.c
arch/mips/lib/iomap.c
arch/powerpc/platforms/pseries/ras.c
arch/ppc/8260_io/enet.c
arch/ppc/8260_io/fcc_enet.c
arch/ppc/8xx_io/enet.c
arch/ppc/syslib/ppc4xx_sgdma.c
arch/sh64/mach-cayman/iomap.c
arch/xtensa/kernel/xtensa_ksyms.c
arch/xtensa/platform-iss/setup.c
drivers/i2c/busses/i2c-at91.c
drivers/i2c/busses/i2c-mpc.c
drivers/media/video/saa711x.c
drivers/misc/hdpuftrs/hdpu_cpustate.c
drivers/misc/hdpuftrs/hdpu_nexus.c
drivers/net/au1000_eth.c
drivers/net/fec_8xx/fec_main.c
drivers/net/fec_8xx/fec_mii.c
drivers/net/fs_enet/fs_enet-main.c
drivers/net/fs_enet/mac-fcc.c
drivers/net/fs_enet/mac-fec.c
drivers/net/fs_enet/mac-scc.c
drivers/net/fs_enet/mii-bitbang.c
drivers/net/fs_enet/mii-fec.c
drivers/net/ibm_emac/ibm_emac_core.c
drivers/net/lasi_82596.c
drivers/parisc/hppb.c
drivers/sbus/sbus.c
drivers/video/g364fb.c
drivers/video/platinumfb.c
drivers/video/stifb.c
drivers/video/valkyriefb.c
include/asm-arm/arch-ixp4xx/dma.h
sound/oss/au1550_ac97.c

I would welcome test reports for these files. I am fine with removing
the untested files from the patch if the general opinion is that these
changes aren't safe. The tested part would still be nice to have.

Note that this patch depends on another header fixup patch I submitted
to LKML yesterday:
  [PATCH] scatterlist.h needs types.h
  http://lkml.org/lkml/2007/3/01/141

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Cc: Badari Pulavarty <pbadari@us.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-05-02 19:02:35 -07:00
Alexander E. Patrakov 39f5fb3035 kconfig: fix path to modules.txt in Kconfig help
Documentation/modules.txt doesn't exist, but
Documentation/kbuild/modules.txt does.

Signed-off-by: Alexander E. Patrakov
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
2007-05-02 20:58:11 +02:00
Adrian Bunk 4839f0481d [MTD] block2mtd_paramline[] mustn't be __initdata
block2mtd_paramline[] is used in the non-__init block2mtd_setup()

Signed-off-by: Adrian Bunk <bunk@stusta.de>
Acked-by: Joern Engel <joern@lazybastard.org>
Cc: <stable@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-05-02 12:33:17 +01:00
David Woodhouse 048c37b490 [MTD] [NAND] Support multiple chips in CAFÉ driver
The CAFÉ can handle two chip on separate chipselect lines. Hook up the
undocumented chipselect bits in the driver and probe both.

In the case of OLPC, it's not actually two separate devices -- it's a
single '1GiB' package with two 512MiB dies internally. So clear the
NAND_BBT_PERCHIP flag to treat it as a single chip for BBT purposes, and
make life easier for the firmware.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-05-02 12:26:37 +01:00
David Woodhouse 14448005ab [MTD] [NAND] Rename cafe.c to cafe_nand.c and remove the multi-obj magic
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-05-02 12:04:57 +01:00
Segher Boessenkool 8c61b7a7f4 [MTD] [NAND] Use rslib for CAFÉ ECC
Signed-off-by: Segher Boessenkool <segher@kernel.crashing.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-05-02 12:00:20 +01:00
Stephen Rothwell 40cd3a4564 [POWERPC] Rename get_property to of_get_property: drivers
These are all the remaining instances of get_property.  Simple rename of
get_property to of_get_property.

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2007-05-02 20:04:32 +10:00
Adrian Bunk 28b57cddb3 [MTD] [MAPS] drivers/mtd/maps/ck804xrom.c: convert pci_module_init()
This patch converts the pci_module_init() usage to pci_register_driver().

It's currently #if 0'ed, but still not a bad idea to change it.

Signed-off-by: Adrian Bunk <bunk@stusta.de>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-04-27 23:34:21 +01:00
Mike Rapoport 54d33c4c71 [MTD] [NAND] CM-x270 MTD driver
This patch provides MTD support for NAND flash devices on CM-x270 modules.

Signed-off-by: Mike Rapoport <mike@compulab.co.il>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-04-27 23:04:32 +01:00
David Woodhouse d1da4e50e5 Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
Conflicts:

	drivers/mtd/Kconfig

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-04-27 19:16:19 +01:00
Linus Torvalds b928ed5618 Merge branch 'for-linus' of git://git.infradead.org/ubi-2.6
* 'for-linus' of git://git.infradead.org/ubi-2.6:
  UBI: remove unused variable
  UBI: add me to MAINTAINERS
  JFFS2: add UBI support
  UBI: Unsorted Block Images
2007-04-27 10:42:35 -07:00
Knobloch, Thomas 78ab67da10 [MTD] [NAND] Wrong calculation of page number in nand_block_bad()
In case that there is no memory based bad block table available the
function nand_block_checkbad() in drivers/mtd/nand/nand_base.c will call
nand_block_bad() directly. When parameter 'getchip' is set to zero,
nand_block_bad() will not right shift the offset to calculate the
correct page number.

Signed-off-by: Thomas Knobloch <knobloch@siemens.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-04-27 15:13:53 +01:00
Artem Bityutskiy d468a03002 UBI: remove unused variable
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
2007-04-27 15:11:44 +03:00
Artem B. Bityutskiy 801c135ce7 UBI: Unsorted Block Images
UBI (Latin: "where?") manages multiple logical volumes on a single
flash device, specifically supporting NAND flash devices. UBI provides
a flexible partitioning concept which still allows for wear-levelling
across the whole flash device.

In a sense, UBI may be compared to the Logical Volume Manager
(LVM). Whereas LVM maps logical sector numbers to physical HDD sector
numbers, UBI maps logical eraseblocks to physical eraseblocks.

More information may be found at
http://www.linux-mtd.infradead.org/doc/ubi.html

Partitioning/Re-partitioning

  An UBI volume occupies a certain number of erase blocks. This is
  limited by a configured maximum volume size, which could also be
  viewed as the partition size. Each individual UBI volume's size can
  be changed independently of the other UBI volumes, provided that the
  sum of all volume sizes doesn't exceed a certain limit.

  UBI supports dynamic volumes and static volumes. Static volumes are
  read-only and their contents are protected by CRC check sums.

Bad eraseblocks handling

  UBI transparently handles bad eraseblocks. When a physical
  eraseblock becomes bad, it is substituted by a good physical
  eraseblock, and the user does not even notice this.

Scrubbing

  On a NAND flash bit flips can occur on any write operation,
  sometimes also on read. If bit flips persist on the device, at first
  they can still be corrected by ECC, but once they accumulate,
  correction will become impossible. Thus it is best to actively scrub
  the affected eraseblock, by first copying it to a free eraseblock
  and then erasing the original. The UBI layer performs this type of
  scrubbing under the covers, transparently to the UBI volume users.

Erase Counts

  UBI maintains an erase count header per eraseblock. This frees
  higher-level layers (like file systems) from doing this and allows
  for centralized erase count management instead. The erase counts are
  used by the wear-levelling algorithm in the UBI layer. The algorithm
  itself is exchangeable.

Booting from NAND

  For booting directly from NAND flash the hardware must at least be
  capable of fetching and executing a small portion of the NAND
  flash. Some NAND flash controllers have this kind of support. They
  usually limit the window to a few kilobytes in erase block 0. This
  "initial program loader" (IPL) must then contain sufficient logic to
  load and execute the next boot phase.

  Due to bad eraseblocks, which may be randomly scattered over the
  flash device, it is problematic to store the "secondary program
  loader" (SPL) statically. Also, due to bit-flips it may become
  corrupted over time. UBI allows to solve this problem gracefully by
  storing the SPL in a small static UBI volume.

UBI volumes vs. static partitions

  UBI volumes are still very similar to static MTD partitions:

    * both consist of eraseblocks (logical eraseblocks in case of UBI
      volumes, and physical eraseblocks in case of static partitions;
    * both support three basic operations - read, write, erase.

  But UBI volumes have the following advantages over traditional
  static MTD partitions:

    * there are no eraseblock wear-leveling constraints in case of UBI
      volumes, so the user should not care about this;
    * there are no bit-flips and bad eraseblocks in case of UBI volumes.

  So, UBI volumes may be considered as flash devices with relaxed
  restrictions.

Where can it be found?

  Documentation, kernel code and applications can be found in the MTD
  gits.

What are the applications for?

  The applications help to create binary flash images for two purposes: pfi
  files (partial flash images) for in-system update of UBI volumes, and plain
  binary images, with or without OOB data in case of NAND, for a manufacturing
  step. Furthermore some tools are/and will be created that allow flash content
  analysis after a system has crashed..

Who did UBI?

  The original ideas, where UBI is based on, were developed by Andreas
  Arnez, Frank Haverkamp and Thomas Gleixner. Josh W. Boyer and some others
  were involved too. The implementation of the kernel layer was done by Artem
  B. Bityutskiy. The user-space applications and tools were written by Oliver
  Lohmann with contributions from Frank Haverkamp, Andreas Arnez, and Artem.
  Joern Engel contributed a patch which modifies JFFS2 so that it can be run on
  a UBI volume. Thomas Gleixner did modifications to the NAND layer. Alexander
  Schmidt made some testing work as well as core functionality improvements.

Signed-off-by: Artem B. Bityutskiy <dedekind@linutronix.de>
Signed-off-by: Frank Haverkamp <haver@vnet.ibm.com>
2007-04-27 14:23:33 +03:00
Stephen Rothwell ccf0dec6fc [SPARC/64] constify of_get_property return: drivers
The only unfortunate bit here is that the name field of struct map_info
is not const, so for now we put a cast on the assignment of it.

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
2007-04-26 01:54:27 -07:00
Randy Dunlap 06d63cc51d [MTD] [MAPS] fix plat-ram printk format
drivers/mtd/maps/plat-ram.c:172: warning: format '%lx' expects type 'long unsigned int', but argument 4 has type 'resource_size_t'

Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-04-26 07:28:58 +01:00
Adrian Hunter c36c46d53b [MTD] [OneNAND] Exit loop only when column start with 0
The JFFS2 requests OOB function from column 0.
But the oobtest in nand-tests doesn't.
So we only exit loop only when column start with 0.

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-04-25 11:09:37 +01:00
Kyungmin Park ad28634366 [MTD] [OneNAND] Fix access the past of the real oobfree array
Here it's not the case: all the entries are occupied by
OOB chunks. Therefore, once we get into a loop like

        for (free = this->ecclayout->oobfree; free->length; ++free) {
	}

we might end up scanning past the real oobfree array.

Probably the best way out, as the same thing might happen for common NAND
as well, is to check index against MTD_MAX_OOBFREE_ENTRIES.

Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-04-25 11:09:23 +01:00
Kyungmin Park c19df27ec7 [MTD] [OneNAND] Update Samsung OneNAND official URL
Update Samsung OneNAND official URL.

Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-04-25 11:09:06 +01:00
Christoph Hellwig 3e67fe4543 [MTD] Finish conversion mtd_blkdevs to use the kthread API
Remove waitqueue, 'exiting' flag and completion; use kthread APIs instead.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-04-22 20:48:29 +01:00
Jan Engelhardt ec98c681a5 Use menuconfig objects: MTD
Use menuconfigs instead of menus, so the whole menu can be disabled at once
instead of going through all options.

Signed-off-by: Jan Engelhardt <jengelh@gmx.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-04-19 16:21:41 -05:00
Eric W. Biederman 99f9b2431e [MTD] mtd_blkdevs: Convert to use the kthread API
thread_run is used intead of kernel_thread, daemonize, and mucking
around blocking signals directly.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-04-19 16:16:46 -05:00
Shashi Rao e6be133b68 [MTD] Fix fwh_lock locking
This is on a custom board with a mapping driver access to an ST
M50LPW080 chip. This chip is probed successfully with
do_map_probe("jedec_probe",...). If I use the mtdchar interface to
perform unlock->erase->program->lock on any of the 16 eraseblocks in the
chip, the chip is left in FL_STATUS mode while the data structures
believe that the chip is in FL_READY mode. Hence, any subsequent reads
to any flash byte results in 0x80 being read.

Signed-off-by: Shashi Rao <shashi@sun.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2007-04-17 14:11:20 -04:00
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