Commit Graph

236 Commits (5816fbbf22470b687964462e6c1f18165b291f22)

Author SHA1 Message Date
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
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
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
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
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
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
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
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
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
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
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
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
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
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 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
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
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
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 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
Andrew Morton 7e9a0bb00c [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>
2006-05-30 09:06:41 +01:00
Thomas Gleixner f1a28c0284 [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>
2006-05-30 00:37:34 +02:00
Thomas Gleixner 9a1fcdfd4b [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>
2006-05-29 15:06:51 +02:00
Thomas Gleixner 8593fbc68b [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>
2006-05-29 15:06:51 +02:00
Thomas Gleixner 5bd34c091a [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>
2006-05-29 15:06:50 +02:00
Thomas Gleixner ff268fb879 [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>
2006-05-29 15:06:49 +02:00
Thomas Gleixner 8be834f762 [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>
2006-05-29 15:06:49 +02:00
David Woodhouse 33280eac70 [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>
2006-05-29 11:24:29 +01:00
Thomas Gleixner ba0251fe87 [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>
2006-05-27 01:02:13 +02:00
Thomas Gleixner cca3b837bb [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>
2006-05-27 00:47:18 +02:00
David Woodhouse 29da9cea46 [MTD] Fix thinko in nand_write_page_hwecc()
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-05-26 23:05:44 +01:00
Thomas Gleixner f75e5097ef [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>
2006-05-26 18:52:08 +02:00
David Woodhouse e4d222ff18 [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>
2006-05-26 02:06:27 +01:00
David Woodhouse c5b553cc2c [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>
2006-05-25 13:25:17 +01:00
Thomas Gleixner f5bbdacc41 [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>
2006-05-25 12:45:27 +01:00
Thomas Gleixner 7314e9e7d5 [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>
2006-05-25 12:45:27 +01:00
Thomas Gleixner 7a30601b3a [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>
2006-05-25 12:45:26 +01:00
Thomas Gleixner 04bbd0eafb [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>
2006-05-25 12:45:26 +01:00
Thomas Gleixner 12efdde313 [MTD] NAND fix cmd_ctrl breakage
The cmd_ctrl rework lacks some state transition flags.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2006-05-24 23:45:24 +01:00
Thomas Gleixner ace4dfee56 [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>
2006-05-24 23:45:24 +01:00
Thomas Gleixner d470a97c70 [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>
2006-05-23 23:48:57 +02:00
Thomas Gleixner cad74f2c38 [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>
2006-05-23 23:28:48 +02:00
Thomas Gleixner 7abd3ef987 [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>
2006-05-23 23:25:53 +02:00
Thomas Gleixner 3821720d51 [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>
2006-05-23 22:33:52 +02:00
Thomas Gleixner 85b85fee0c [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>
2006-05-23 22:03:39 +02:00
Thomas Gleixner 9223a456da [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>
2006-05-23 17:21:03 +02:00
Thomas Gleixner 2528e8cdf3 [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>
2006-05-23 16:10:00 +02:00
Thomas Gleixner 9d8522df37 [MTD] Remove nand writev support
NAND writev(_ecc) support is not longer necessary. Remove it.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2006-05-23 16:06:03 +02:00
Thomas Gleixner 0cddd6c258 [MTD] ECC rework broke diskonchip
Fix the diskonchip ecc setup.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2006-05-23 15:59:58 +02:00
Thomas Gleixner 4cbb9b80e1 Merge branch 'master' of /home/tglx/work/kernel/git/mtd-2.6/
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2006-05-23 12:37:31 +02:00
Thomas Gleixner 6dfc6d250d [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>
2006-05-23 12:00:46 +02:00
Thomas Gleixner 7aa65bfd67 [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>
2006-05-23 11:54:38 +02:00
Thomas Gleixner 58dd8f2bfd [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>
2006-05-23 11:52:35 +02:00
Thomas Gleixner 2c0a2bed92 [MTD] NAND whitespace and formatting cleanup
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
2006-05-23 11:50:56 +02:00
Thomas Gleixner ce4c61f184 [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>
2006-05-23 11:43:28 +02:00
Thomas Gleixner a36ed2995c [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>
2006-05-23 11:37:03 +02:00
Thomas Gleixner 819d6a32c3 [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>
2006-05-23 11:32:45 +02:00
Joern Engel 5fa433942b [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>
2006-05-22 23:18:29 +02:00
Joern Engel 28318776a8 [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>
2006-05-22 23:18:05 +02:00
Jonathan McDowell 3d12c0c75d [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>
2006-05-21 18:11:55 +01:00
Sergei Shtylyov 35af68b53a NAND: Fix NAND ECC errors on AMD Au1550
On AMD Au1550 the static bus controller fails to keep -CE asserted during
chip ready delay on read commands and the NAND chip being used requires this.
So, the current driver allows nand_base.c to drive -CE manually during the
entire sector read. When the PCMCIA driver is enabled however, occasionally
the ECC errors occur on NAND reads. This happens because the PCMCIA driver
polls sockets periodically and reads one of the board's control/status regs
(BCSRs) which are on the same static bus as the NAND flash, and just use
another chip select (and the NOR flash also resides on that bus), so as the
NAND driver forces NAND chip select asserted and the -RE signal is shared, a
contention occurs on the static bus when BCSR or NOR flash is read while we're
reading from NAND.
    So, we either can't keep interrupts enabled during the whole NAND sector
read (which is hardly acceptable), or have to implement some interlocking
scheme between multiple drivers (which is painful, and makes me shudder :-).
    There's a third way which has proven to work: to force -CE asserted only
while we're waiting for a NAND chip to become ready after a read command,
disabling interrupts for a maximum of 25 microseconds (according to Toshiba
TC58DVM92A1FT00 datasheet -- this chip is mentioned in the board schematics);
for Samsung NAND chip which seems to be actually used this delay is even less,
12 us.

Signed-off-by: Konstantin Baydarov <kbaidarov@ru.mvista.com>
Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-05-16 18:03:18 +01:00
Sergei Shtylyov 155285c477 NAND: AMD Au1550 driver reads write-only register
During the last cleanup of the AMD Au1550 NAND driver the old buglet was
reintroduced: as the MEM_STNDCTL register is write-only and seem to always
read as 0x31, read-modify-write to it done in au1xxx_nand_init() will have the
side effect of enabling -RCS0/1 pin override (via bits 4/5 of this reg.), thus
possibly causing a contention on the static bus when the NOR flash (using
-RCS0) or board control status registers (using -RCS2) are read. Luckily, this
goes away with a first NAND access, since au1550_hwcontrol() doesn't try to
read this register before writing anymore.

Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-05-16 17:25:19 +01:00
David Woodhouse cead4dbc03 [MTD NAND] Make various initfuncs static, remove #ifdef MODULE from exitfuncs
We all inherited the same error from the original NAND board driver which
got copied and changed. Fix them all at once...

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-05-16 13:54:50 +01:00
David Woodhouse f41a5f804a [MTD] Add help text for MTD_NAND_CS553X option.
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-05-16 13:11:47 +01:00
David Woodhouse 52239da1b0 [MTD NAND] Modify check for modules registering NAND devices without ->owner
Make it work even with compilers which lack the wit to notice that
THIS_MODULE is always non-NULL. Use #ifdef MODULE instead. It's only
a temporary debugging check anyway.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-05-14 16:54:39 +01:00
David Woodhouse 151e76590f [MTD] Fix legacy character sets throughout drivers/mtd, include/linux/mtd
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-05-14 01:51:54 +01:00
David Woodhouse 552d920518 [MTD] Fix module refcounting in NAND board drivers.
The _board_ driver needs to be mtd->owner, and it in turn pins the
nand.ko module. Fix them all to actually do that, and fix nand.ko not to
overwrite it -- and also to check that the caller sets it, if the caller
is a module.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2006-05-14 01:20:46 +01:00