Thomas Gleixner [Tue, 20 Jun 2006 18:05:05 +0000 (20:05 +0200)]
[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>
Vitaly Wool [Wed, 7 Jun 2006 05:34:37 +0000 (09:34 +0400)]
[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>
Thomas Gleixner [Fri, 16 Jun 2006 16:10:09 +0000 (18:10 +0200)]
[MTD] NAND Fixup NDFC merge brokeness
Remove the remains of a broken merge.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Ben Dooks [Mon, 19 Jun 2006 08:43:23 +0000 (09:43 +0100)]
[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>
Ben Dooks [Mon, 19 Jun 2006 08:29:38 +0000 (09:29 +0100)]
[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>
David Woodhouse [Sun, 18 Jun 2006 21:44:21 +0000 (22:44 +0100)]
[JFFS2] Check CRC32 on dirent and data nodes each time they're read
Also, make sure dirents are marked REF_UNCHECKED when we 'discover' them
through eraseblock summary.
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
David Woodhouse [Sun, 18 Jun 2006 17:35:10 +0000 (18:35 +0100)]
[JFFS2] When retiring nextblock, allocate a node_ref for the wasted space
Failing to do so makes the calculated length of the last node incorrect,
when we're not using eraseblock summaries.
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
David Woodhouse [Sun, 18 Jun 2006 09:22:40 +0000 (10:22 +0100)]
[JFFS2] Mark XATTR support as experimental, for now
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
David Woodhouse [Sat, 17 Jun 2006 23:05:26 +0000 (00:05 +0100)]
[JFFS2] Don't trust node headers before the CRC is checked.
Especially when summary code is used, we can have in-memory data
structures referencing certain nodes without them actually being readable
on the flash. Discard the nodes gracefully in that case, rather than
triggering a BUG().
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
David Woodhouse [Wed, 14 Jun 2006 20:39:48 +0000 (21:39 +0100)]
[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>
Artem B. Bityutskiy [Wed, 14 Jun 2006 15:53:44 +0000 (19:53 +0400)]
[MTD] assume mtd->writesize is 1 for NOR flashes
Signed-off-by: Artem B. Bityitskiy
David Woodhouse [Fri, 9 Jun 2006 23:53:16 +0000 (00:53 +0100)]
[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>
Andrew Morton [Fri, 9 Jun 2006 14:12:34 +0000 (15:12 +0100)]
[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>
David Woodhouse [Fri, 9 Jun 2006 14:06:42 +0000 (15:06 +0100)]
[JFFS2] Fix more breakage caused by janitorial meddling.
jffs2_zlib_exit() and free_workspaces() shouldn't be marked __exit because
they get called in the error case from the init functions.
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
David Woodhouse [Fri, 2 Jun 2006 23:25:50 +0000 (00:25 +0100)]
[JFFS2] Remove stray __exit from jffs2_compressors_exit()
It's used from the initfunc in case of failure too. We could actually do
with an '__initexit' for this kind of thing -- when built in to the
kernel, it could do with being dropped with the init text. We _could_
actually just use __init for it, but that would break if/when we start
dropping init text from modules. So let's just leave it as it was for now,
and mutter a little more about random 'janitorial' fixes from people who
aren't paying attention to what they're doing.
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Joern Engel [Tue, 30 May 2006 12:25:46 +0000 (14:25 +0200)]
[MTD] Allow alternate JFFS2 mount variant for root filesystem.
With this patch, "root=mtd3" and "root=mtd:foo" work for a JFFS2 rootfs.
Signed-off-by: Joern Engel <joern@wh.fh-wedel.de>
Joern Engel [Tue, 30 May 2006 12:25:35 +0000 (14:25 +0200)]
[MTD] Disconnect struct mtd_info from ABI
mtdchar.c direcly copied part of struct mtd_info to userspace, thereby
implicitly making it part of the ABI. With this patch, struct
mtd_info is independent of the ABI and can have its fields removed,
reordered, etc.
Signed-off-by: Joern Engel <joern@wh.fh-wedel.de>
Joern Engel [Tue, 30 May 2006 12:25:24 +0000 (14:25 +0200)]
[MTD] replace MTD_RAM with MTD_GENERIC_TYPE
Ram devices get the extra capability of MTD_NO_ERASE - not requiring
an explicit erase before writing to it. Currently only mtdblock uses
this capability. Rest of the patch is a simple text replacement.
Signed-off-by: Joern Engel <joern@wh.fh-wedel.de>
Joern Engel [Tue, 30 May 2006 12:25:17 +0000 (14:25 +0200)]
[MTD] replace MTD_ROM with MTD_GENERIC_TYPE
No mtd user should ever check for the device type. Instead, device features
should be checked by the flags - if at all.
As a first step towards type removal, change MTD_ROM into MTD_GENERIC_TYPE.
Signed-off-by: Joern Engel <joern@wh.fh-wedel.de>
Joern Engel [Tue, 30 May 2006 12:25:05 +0000 (14:25 +0200)]
[MTD] remove a forgotten MTD_XIP
MTD_XIP definition was removed in an earlier patch. This invocation
was left by mistake.
Signed-off-by: Joern Engel <joern@wh.fh-wedel.de>
Andrew Morton [Tue, 30 May 2006 08:06:41 +0000 (09:06 +0100)]
[MTD] Fix build warnings (and debug build error) in nand_base.c
drivers/mtd/nand/nand_base.c: In function 'nand_transfer_oob':
drivers/mtd/nand/nand_base.c:909: warning: comparison of distinct pointer types lacks a cast
drivers/mtd/nand/nand_base.c: In function 'nand_do_read_oob':
drivers/mtd/nand/nand_base.c:1097: error: 'len' undeclared (first use in this function)
drivers/mtd/nand/nand_base.c:1097: error: (Each undeclared identifier is reported only once
drivers/mtd/nand/nand_base.c:1097: error: for each function it appears in.)
drivers/mtd/nand/nand_base.c: In function 'nand_fill_oob':
drivers/mtd/nand/nand_base.c:1411: warning: comparison of distinct pointer types lacks a cast
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
David Woodhouse [Tue, 30 May 2006 08:00:14 +0000 (09:00 +0100)]
[JFFS2] Preallocate node refs for cleanmarker in summary scan
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
David Woodhouse [Tue, 30 May 2006 07:59:34 +0000 (08:59 +0100)]
[JFFS2] Fix calculation of potential summary marker offset on NOR flash.
Helps if we look _inside_ the buffer, rather than adding jeb->offset to
it. Doh.
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Thomas Gleixner [Mon, 29 May 2006 22:37:34 +0000 (00:37 +0200)]
[MTD] NAND Expose the new raw mode function and status info to userspace
The raw read/write access to NAND (without ECC) has been changed in the
NAND rework. Expose the new way - setting the file mode via ioctl - to
userspace. Also allow to read out the ecc statistics information so userspace
tools can see that bitflips happened and whether errors where correctable
or not. Also expose the number of bad blocks for the partition, so nandwrite
can check if the data fits into the parition before writing to it.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Thomas Gleixner [Mon, 29 May 2006 12:56:39 +0000 (14:56 +0200)]
[MTD] NAND Signal that a bitflip was corrected by ECC
Return -EUCLEAN on read when a bitflip was detected and corrected, so the
clients can react and eventually copy the affected block to a spare one.
Make all in kernel users aware of the change.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Thomas Gleixner [Mon, 29 May 2006 01:26:58 +0000 (03:26 +0200)]
[MTD] Rework the out of band handling completely
Hopefully the last iteration on this!
The handling of out of band data on NAND was accompanied by tons of fruitless
discussions and halfarsed patches to make it work for a particular
problem. Sufficiently annoyed by I all those "I know it better" mails and the
resonable amount of discarded "it solves my problem" patches, I finally decided
to go for the big rework. After removing the _ecc variants of mtd read/write
functions the solution to satisfy the various requirements was to refactor the
read/write _oob functions in mtd.
The major change is that read/write_oob now takes a pointer to an operation
descriptor structure "struct mtd_oob_ops".instead of having a function with at
least seven arguments.
read/write_oob which should probably renamed to a more descriptive name, can do
the following tasks:
- read/write out of band data
- read/write data content and out of band data
- read/write raw data content and out of band data (ecc disabled)
struct mtd_oob_ops has a mode field, which determines the oob handling mode.
Aside of the MTD_OOB_RAW mode, which is intended to be especially for
diagnostic purposes and some internal functions e.g. bad block table creation,
the other two modes are for mtd clients:
MTD_OOB_PLACE puts/gets the given oob data exactly to/from the place which is
described by the ooboffs and ooblen fields of the mtd_oob_ops strcuture. It's
up to the caller to make sure that the byte positions are not used by the ECC
placement algorithms.
MTD_OOB_AUTO puts/gets the given oob data automaticaly to/from the places in
the out of band area which are described by the oobfree tuples in the ecclayout
data structre which is associated to the devicee.
The decision whether data plus oob or oob only handling is done depends on the
setting of the datbuf member of the data structure. When datbuf == NULL then
the internal read/write_oob functions are selected, otherwise the read/write
data routines are invoked.
Tested on a few platforms with all variants. Please be aware of possible
regressions for your particular device / application scenario
Disclaimer: Any whining will be ignored from those who just contributed "hot
air blurb" and never sat down to tackle the underlying problem of the mess in
the NAND driver grown over time and the big chunk of work to fix up the
existing users. The problem was not the holiness of the existing MTD
interfaces. The problems was the lack of time to go for the big overhaul. It's
easy to add more mess to the existing one, but it takes alot of effort to go
for a real solution.
Improvements and bugfixes are welcome!
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Thomas Gleixner [Sun, 28 May 2006 09:01:53 +0000 (11:01 +0200)]
[MTD] Remove silly MTD_WRITE/READ macros
Most of those macros are unused and the used ones just obfuscate
the code. Remove them and fixup all users.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Thomas Gleixner [Sat, 27 May 2006 20:16:10 +0000 (22:16 +0200)]
[MTD] NAND Replace oobinfo by ecclayout
The nand_oobinfo structure is not fitting the newer error correction
demands anymore. Replace it by struct nand_ecclayout and fixup the users
all over the place. Keep the nand_oobinfo based ioctl for user space
compability reasons.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Thomas Gleixner [Sat, 27 May 2006 18:36:12 +0000 (20:36 +0200)]
[MTD] NAND Consolidate oobinfo handling
The info structure for out of band data was copied into
the mtd structure. Make it a pointer and remove the ability
to set it from userspace. The position of ecc bytes is
defined by the hardware and should not be changed by software.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Thomas Gleixner [Sat, 27 May 2006 18:05:26 +0000 (20:05 +0200)]
[MTD] NAND Fix platform structure and NDFC driver
The platform structure was lacking an oobinfo field.
The NDFC driver had some remains from another tree.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Andrew Morton [Mon, 29 May 2006 10:33:33 +0000 (11:33 +0100)]
[MTD] Fix debug printk format warning in m25p80 SPI chip driver, again.
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
David Woodhouse [Mon, 29 May 2006 10:24:29 +0000 (11:24 +0100)]
[MTD] AMD Geode NAND support can depend on X86_32; we won't see it on x86_64
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
David Woodhouse [Sun, 28 May 2006 23:41:11 +0000 (00:41 +0100)]
[JFFS2] Preallocate raw_node_refs in a couple of missing places in scan
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
David Woodhouse [Sun, 28 May 2006 21:13:25 +0000 (22:13 +0100)]
[JFFS2] Fix oops when marking space dirty in scan, but no previous node exists.
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
David Woodhouse [Sat, 27 May 2006 12:15:16 +0000 (13:15 +0100)]
[JFFS2] Fix wbuf recovery of f->metadata->raw node.
A data node might not be in the fraglist; it could be f->metadata.
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Thomas Gleixner [Fri, 26 May 2006 23:02:13 +0000 (01:02 +0200)]
[MTD] NAND Consolidate references and add back default name setting
We have a type pointer. Make use of it instead of the error prone nand_ids[i]
reference.
The NAND driver used to set default name settings from the chip ID
string for the device. The feature got lost during the rework. Add it back.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Thomas Gleixner [Fri, 26 May 2006 22:47:18 +0000 (00:47 +0200)]
[MTD] NAND simplify nand_chip_select
nCE setting can be done when the first command is issued to the device.
We keep the deselect functionality as it makes sense to deassert nCE
when the device becomes idle.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
David Woodhouse [Fri, 26 May 2006 22:05:44 +0000 (23:05 +0100)]
[MTD] Fix thinko in nand_write_page_hwecc()
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
David Woodhouse [Fri, 26 May 2006 20:19:05 +0000 (21:19 +0100)]
[JFFS2] Switch to using an array of jffs2_raw_node_refs instead of a list.
This allows us to drop another pointer from the struct jffs2_raw_node_ref,
shrinking it to 8 bytes on 32-bit machines (if the TEST_TOTLEN) paranoia
check is turned off, which will be committed soon).
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Thomas Gleixner [Fri, 26 May 2006 16:52:08 +0000 (18:52 +0200)]
[MTD] NAND modularize write function
Modularize the write function and reorganaize the internal buffer
management. Remove obsolete chip options and fixup all affected
users.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
David Woodhouse [Fri, 26 May 2006 01:06:27 +0000 (02:06 +0100)]
[MTD] Remove PCI dependency for Geode CS553[56] NAND controller.
PCI is faked on these devices by SMM traps. Don't depend on that --
check for the chipset directly instead.
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
David Woodhouse [Thu, 25 May 2006 12:30:24 +0000 (13:30 +0100)]
[JFFS2] Fix 64-bit size_t problems in XATTR code.
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
David Woodhouse [Thu, 25 May 2006 12:25:17 +0000 (13:25 +0100)]
[MTD] Fix NAND_VERIFY_WRITE case to build with tglx's recent changes
Bad tglx. No biscuit.
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Thomas Gleixner [Thu, 25 May 2006 11:38:45 +0000 (13:38 +0200)]
[MTD] Remove the only useless readv implementation
Removing readv from struct mtd_info broke block2mtd. Remove the
reference and the useless default implementation.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Thomas Gleixner [Thu, 25 May 2006 08:07:16 +0000 (10:07 +0200)]
[MTD] NAND Modularize read function
Split the core of the read function out and implement
seperate handling functions for software and hardware
ECC.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Thomas Gleixner [Thu, 25 May 2006 08:04:31 +0000 (10:04 +0200)]
[MTD] NAND Add read/write function pointers to struct nand_ecc_ctrl
Add read/write function pointers to struct nand_ecc_ctrl to
prepare the modulaization of nand_read/write functions. The
current implementation handles every type of ecc mode
software/hardware and all kinds of strange ecc placement
schemes in one switch/if construct. Thats too complex to
maintain and too inflexible to expand. Modularization will
also shorten the code pathes of the read/write functions.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Thomas Gleixner [Thu, 25 May 2006 07:57:31 +0000 (09:57 +0200)]
[MTD] Add ECC statistics to struct mtd_info
FLASH - especially NAND FLASH - will become less reliable
and bit flips more likely. Add an ECC statistics struct
to struct mtd_info to keep track of this.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Thomas Gleixner [Thu, 25 May 2006 07:51:54 +0000 (09:51 +0200)]
[MTD] NAND Cleanup oob functions
Cleanup the code in the oob related functions and
make use of the new NO_READRDY flag.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Thomas Gleixner [Thu, 25 May 2006 07:50:16 +0000 (09:50 +0200)]
[MTD] NAND Introduce NAND_NO_READRDY option
The nand driver has a superflous read ready / command
delay in the read functions. This was added to handle
chips which have an automatic read forward. Newer
chips do not have this functionality anymore. Add this
option to avoid the delay / I/O operation. Mark all
large page chips with the new option flag.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Thomas Gleixner [Thu, 25 May 2006 07:45:29 +0000 (09:45 +0200)]
[MTD] NAND Initialize controller lock and wq only once
The lock simplifying patch did not move the lock and waitqueue
initialization into the controller allocation patch.
This reinitializes waitqueue and spinlocks also for driver
supplied controller stuctures. Move it into the allocation path.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
David Woodhouse [Thu, 25 May 2006 00:53:09 +0000 (01:53 +0100)]
[JFFS2] Fix and improve debugging output during scan.
Print wasted_size in scanned eraseblocks, print range correctly for
summary dirent and inode entries.
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
David Woodhouse [Thu, 25 May 2006 00:50:35 +0000 (01:50 +0100)]
[JFFS2] Add 'jeb' argument to jffs2_prealloc_raw_node_refs()
Preallocation of refs is shortly going to be a per-eraseblock thing,
rather than per-filesystem. Add the required argument to the function.
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
David Woodhouse [Thu, 25 May 2006 00:42:40 +0000 (01:42 +0100)]
[JFFS2] Correctly handle wasted space before summary node.
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
David Woodhouse [Thu, 25 May 2006 00:38:27 +0000 (01:38 +0100)]
[JFFS2] jffs2_free_all_node_refs() doesn't free them all. Rename it.
... to jffs2_free_jeb_node_refs() since that's what it does.
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
David Woodhouse [Thu, 25 May 2006 00:37:28 +0000 (01:37 +0100)]
[JFFS2] Allocate node_ref for wasted space when skipping to page boundary
One more place where we were changing the accounting info without
actually allocating a ref for the lost space...
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Thomas Gleixner [Wed, 24 May 2006 20:57:09 +0000 (22:57 +0200)]
[MTD] NAND fix cmd_ctrl breakage
The cmd_ctrl rework lacks some state transition flags.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Thomas Gleixner [Wed, 24 May 2006 10:07:37 +0000 (12:07 +0200)]
[MTD] NAND coding style and namespace cleanup
Cleanup the functions which are not going to change in the
next steps.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
David Woodhouse [Wed, 24 May 2006 13:24:02 +0000 (14:24 +0100)]
[JFFS2] Revert Artem's Bunkage in debug messages.
Random unthinking 'cleanup' caused debug messages like this:
Obsoleting node at 0x0006daf4 of len 0x3a4: <7>Dirtying
If messages are continuation of an existing line, they don't need
to be prefixed with KERN_DEBUG.
THINK. Or you will be replaced by a small shell script.
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
David Woodhouse [Wed, 24 May 2006 09:01:43 +0000 (10:01 +0100)]
Merge branch 'master' of git://git.infradead.org/~gleixner/mtd-nand-2.6.git
David Woodhouse [Wed, 24 May 2006 08:04:17 +0000 (09:04 +0100)]
[JFFS2] Introduce ref_next() macro for finding next physical node
Another part of the preparation for switching to an array...
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
David Woodhouse [Wed, 24 May 2006 01:04:45 +0000 (02:04 +0100)]
[JFFS2] Reduce visibility of raw_node_ref to upper layers of JFFS2 code.
As the first step towards eliminating the ref->next_phys member and saving
memory by using an _array_ of struct jffs2_raw_node_ref per eraseblock,
stop the write functions from allocating their own refs; have them just
_reserve_ the appropriate number instead. Then jffs2_link_node_ref() can
just fill them in.
Use a linked list of pre-allocated refs in the superblock, for now. Once
we switch to an array, it'll just be a case of extending that array.
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Thomas Gleixner [Tue, 23 May 2006 21:48:57 +0000 (23:48 +0200)]
[MTD] NAND LED support cleanup
Move the define out of the middle of the code and add an
appropriate comment.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Thomas Gleixner [Tue, 23 May 2006 21:28:48 +0000 (23:28 +0200)]
[MTD] NAND remove write_byte/word function from nand_chip
The previous change of the command / hardware control allows to
remove the write_byte/word functions completely, as their only
user were nand_command and nand_command_lp.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Thomas Gleixner [Tue, 23 May 2006 21:25:53 +0000 (23:25 +0200)]
[MTD] Refactor NAND hwcontrol to cmd_ctrl
The hwcontrol function enforced a step by step state machine
for any kind of hardware chip access. Let the hardware driver
know which control bits are set and inform it about a change
of the control lines. Let the hardware driver write out the
command and address bytes directly. This gives a peformance
advantage for address bus controlled chips and simplifies the
quirks in the hardware drivers.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Thomas Gleixner [Tue, 23 May 2006 20:33:52 +0000 (22:33 +0200)]
[MTD] Export nand_write_raw
The previous _ecc removal / cleanup broke (i)nftl module usage.
Export the missing symbol.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Thomas Gleixner [Tue, 23 May 2006 20:03:39 +0000 (22:03 +0200)]
[MTD] Mark NAND drivers TOTO and PPChameleon broken
Both drivers can not be fixed and compiled due to missing header files.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Thomas Gleixner [Tue, 23 May 2006 15:21:03 +0000 (17:21 +0200)]
[MTD] Remove read/write _ecc variants
MTD clients are agnostic of FLASH which needs ECC suppport.
Remove the functions and fixup the callers.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Thomas Gleixner [Tue, 23 May 2006 14:10:00 +0000 (16:10 +0200)]
[MTD] Remove readv/readv_ecc
These functions were never implemented and added only bloat to
partition and concat code.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Thomas Gleixner [Tue, 23 May 2006 14:06:03 +0000 (16:06 +0200)]
[MTD] Remove nand writev support
NAND writev(_ecc) support is not longer necessary. Remove it.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Thomas Gleixner [Tue, 23 May 2006 13:59:58 +0000 (15:59 +0200)]
[MTD] ECC rework broke diskonchip
Fix the diskonchip ecc setup.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Thomas Gleixner [Tue, 23 May 2006 13:58:23 +0000 (15:58 +0200)]
[MTD] NAND ECC hwctl function has no return value
Fix the broken prototype
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Thomas Gleixner [Tue, 23 May 2006 10:37:31 +0000 (12:37 +0200)]
Merge branch 'master' of /home/tglx/work/kernel/git/mtd-2.6/
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Thomas Gleixner [Tue, 23 May 2006 10:00:46 +0000 (12:00 +0200)]
[MTD] NAND modularize ECC
First step of modularizing ECC support.
- Move ECC related functionality into a seperate embedded data structure
- Get rid of the hardware dependend constants to simplify new ECC models
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Thomas Gleixner [Tue, 23 May 2006 09:54:38 +0000 (11:54 +0200)]
[MTD] NAND cleanup nand_scan
Seperate functionality out of nand_scan so the code is more
readable. No functional change. First step of simplifying
the nand driver.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Thomas Gleixner [Tue, 23 May 2006 09:52:35 +0000 (11:52 +0200)]
[MTD] NAND consolidate data types
The NAND driver used a mix of unsigned char, u_char amd uint8_t
data types. Consolidate to uint8_t usage
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Thomas Gleixner [Tue, 23 May 2006 09:50:56 +0000 (11:50 +0200)]
[MTD] NAND whitespace and formatting cleanup
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Thomas Gleixner [Tue, 23 May 2006 09:49:14 +0000 (11:49 +0200)]
[JFFS2] Simplify writebuffer handling
The writev based write buffer implementation was far to complex as
in most use cases the write buffer had to be handled anyway.
Simplify the write buffer handling and use mtd->write instead.
From extensive testing no performance impact has been noted.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Thomas Gleixner [Tue, 23 May 2006 09:43:28 +0000 (11:43 +0200)]
[MTD] Add support for NDFC NAND controller
NDFC NAND Flash controller is embedded in PPC EP44x SoCs.
Add platform driver based support.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Thomas Gleixner [Tue, 23 May 2006 09:38:59 +0000 (11:38 +0200)]
[MTD] Add platform support for NAND
Add the data structures necessary to provide platform device support
for NAND
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Thomas Gleixner [Tue, 23 May 2006 09:37:03 +0000 (11:37 +0200)]
[MTD] Simplify NAND locking
Replace the chip lock by a the controller lock. For simple drivers a
dummy controller structure is created by the scan code.
This simplifies the locking algorithm in nand_get/release_chip().
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Thomas Gleixner [Tue, 23 May 2006 09:32:45 +0000 (11:32 +0200)]
[MTD] Improve software ECC calculation
Unrolling the loops produces denser and much faster code.
Add a config switch which allows to select the byte order of the
resulting ecc code. The current Linux implementation has a byte
swap versus the SmartMedia specification
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
David Woodhouse [Mon, 22 May 2006 23:38:06 +0000 (00:38 +0100)]
[JFFS2] Remove flash offset argument from various functions.
We don't need the upper layers to deal with the physical offset. It's
_always_ c->nextblock->offset + c->sector_size - c->nextblock->free_size
so we might as well just let the actual write functions deal with that.
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Joern Engel [Mon, 22 May 2006 21:18:29 +0000 (23:18 +0200)]
[MTD] Introduce MTD_BIT_WRITEABLE
o Add a flag MTD_BIT_WRITEABLE for devices that allow single bits to be
cleared.
o Replace MTD_PROGRAM_REGIONS with a cleared MTD_BIT_WRITEABLE flag for
STMicro and Intel Sibley flashes with internal ECC. Those flashes
disallow clearing of single bits, unlike regular NOR flashes, so the
new flag models their behaviour better.
o Remove MTD_ECC. After the STMicro/Sibley merge, this flag is only set
and never checked.
Signed-off-by: Joern Engel <joern@wh.fh-wedel.de>
Joern Engel [Mon, 22 May 2006 21:18:12 +0000 (23:18 +0200)]
[MTD] Merge STMicro NOR_ECC code with Intel Sibley code
In 2002, STMicro started producing NOR flashes with internal ECC protection
for small blocks (8 or 16 bytes). Support for those flashes was added by me.
In 2005, Intel Sibley flashes copied this strategy and Nico added support for
those. Merge the code for both.
Signed-off-by: Joern Engel <joern@wh.fh-wedel.de>
Joern Engel [Mon, 22 May 2006 21:18:05 +0000 (23:18 +0200)]
[MTD] Introduce writesize
At least two flashes exists that have the concept of a minimum write unit,
similar to NAND pages, but no other NAND characteristics. Therefore, rename
the minimum write unit to "writesize" for all flashes, including NAND.
Signed-off-by: Joern Engel <joern@wh.fh-wedel.de>
Joern Engel [Mon, 22 May 2006 21:17:23 +0000 (23:17 +0200)]
[MTD] Use single flag to mark writeable devices.
Two flags exist to decide whether a device is writeable or not. None of
those two flags is checked for independently, so they are clearly redundant,
if not an invitation to bugs. This patch removed both of them, replacing
them with a single new flag.
Signed-off-by: Joern Engel <joern@wh.fh-wedel.de>
David Woodhouse [Mon, 22 May 2006 15:32:05 +0000 (16:32 +0100)]
[JFFS2] Put list of nodes in common part of ic/x_ref/x_datum structure
We'll be using a proper list of nodes in the jffs2_xattr_datum and
jffs2_xattr_ref structures, because the existing code to overwrite
them is just broken. Put it in the common part at the front of the
structure which is shared with the jffs2_inode_cache, so that the
jffs2_link_node_ref() function can do the right thing.
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
David Woodhouse [Mon, 22 May 2006 15:29:23 +0000 (16:29 +0100)]
[JFFS2] Add some preemptive BUG checks for XATTR code
In a couple of places, we assume that what's at the end of the
->next_in_ino list is a struct jffs2_inode_cache. Let's check
for that, since we expect it to change soon.
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
David Woodhouse [Mon, 22 May 2006 14:23:10 +0000 (15:23 +0100)]
[JFFS2] Extend jffs2_link_node_ref() to link into per-inode list too.
Let's avoid the potential for forgetting to set ref->next_in_ino, by doing
it within jffs2_link_node_ref() instead.
This highlights the ugliness of what we're currently doing with
xattr_datum and xattr_ref structures -- we should find a nicer way of
dealing with that.
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
David Woodhouse [Mon, 22 May 2006 12:55:46 +0000 (13:55 +0100)]
[JFFS2] Initialise ref->next_in_ino when marking dirty space in wbuf flush
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
David Woodhouse [Mon, 22 May 2006 11:15:47 +0000 (12:15 +0100)]
[JFFS2] Fix accounting error in jffs2_link_node_ref()
When filing REF_OBSOLETE nodes, we'd add their size to the global
'dirty_size' count, but then to the eraseblock's 'used_size' count.
That's not clever.
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
David Woodhouse [Mon, 22 May 2006 10:27:14 +0000 (11:27 +0100)]
[JFFS2] Fix dummy jffs2_sum_scan_sumnode() macro for !SUMMARY case.
I added an argument to the real function...
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
David Woodhouse [Sun, 21 May 2006 18:05:55 +0000 (19:05 +0100)]
Merge git://git.infradead.org/jffs2-devel-2.6
David Woodhouse [Sun, 21 May 2006 18:03:21 +0000 (19:03 +0100)]
[MTD] Account for MODULE_SYMBOL_PREFIX when requesting NOR chip driver
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
David Woodhouse [Sun, 21 May 2006 17:38:51 +0000 (18:38 +0100)]
[MTD] Use symbol_request() in old DiskOnChip probe code to find actual driver
The previous code wouldn't work correctly on architectures which have a
non-empty MODULE_SYMBOL_PREFIX, and this version is neater if slightly
less optimal in the built-in case.
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Jonathan McDowell [Sun, 21 May 2006 17:11:55 +0000 (18:11 +0100)]
[MTD] Add Amstrad Delta NAND support
The patch below adds support for the NAND device on the Amstrad Delta.
This is a 32MiB 8bit Toshiba device, with the data bus connected to the
OMAP MPUIO pins and ALE, CLE, NCE, NRE, NWE and NWP all connected to the
Delta's latch2 16bit latch.
Signed-Off-By: Jonathan McDowell <noodles@earth.li>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
David Woodhouse [Sun, 21 May 2006 12:29:11 +0000 (13:29 +0100)]
[JFFS2] Finally eliminate __totlen field from struct jffs2_raw_node_ref
Well, almost. We'll actually keep a 'TEST_TOTLEN' macro set for now, and keep
doing some paranoia checks to make sure it's all working correctly. But if
TEST_TOTLEN is unset, the size of struct jffs2_raw_node_ref drops from 16
bytes to 12 on 32-bit machines. That's a saving of about half a megabyte of
memory on the OLPC prototype board, with 125K or so nodes in its 512MiB of
flash.
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
David Woodhouse [Sun, 21 May 2006 12:15:59 +0000 (13:15 +0100)]
[JFFS2] Locking issues in summary write code.
We can't use jffs2_scan_dirty_space() because it doesn't do any locking; it's
only for use at scan time -- hence the 'scan' in the name.
Also, don't allocate refs while we have c->erase_completion_lock held.
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
David Woodhouse [Sun, 21 May 2006 12:13:45 +0000 (13:13 +0100)]
[JFFS2] Remove stray kfree of summary info in XATTR code.
We don't allocate this locally any more -- it's given to us and owner by
our caller. Also improve the debug messages a little.
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
David Woodhouse [Sun, 21 May 2006 12:00:54 +0000 (13:00 +0100)]
[JFFS2] File node reference for wasted space when flushing wbuf
Next step in ongoing campaign to file a struct jffs2_raw_node_ref for every
piece of dirty space in the system, so that __totlen can be killed off....
Signed-off-by: David Woodhouse <dwmw2@infradead.org>