[MTD] OneNAND: Fix unlock all status error

We have to set ONENAND_REG_START_BLOCK_ADDRESS to avoid status error

Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
[MTD] OneNAND: Return an error if a read timeout occurs

If OneNAND is operating within specification, all operations should easily be
completed within the 20 millisecond timeout.
This patch faithlessly adds a check for the timeout and returns an error in
that case.

Signed-off-by: Adrian Hunter <ext-adrian.hunter@nokia.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
[MTD] OneNAND: Reduce Double Density Package (DDP) operations

- DDP code clean-up
- Reduce block & bufferram operations in DDP

Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
[MTD] OneNAND: Update copyrights and code cleanup

Update copyrights and code cleanup

Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
[MTD] OneNAND: Free the bad block table when the device is released

OneNAND does 2 memory allocations for bad block information.
Only one of them was being freed.

Signed-off-by: Adrian Hunter <ext-adrian.hunter@nokia.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
[MTD] OneNAND: Check first or second pages for bad block information

OneNAND records bad block information in the out-of-band area of either the first or second page of a block.  Due to a logic error, only the first page was being checked.

Signed-off-by: Adrian Hunter <ext-adrian.hunter@nokia.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
[MTD] [NAND] Inherit CAFÉ NAND timing setup from firmware

The precise timings are board-specific (or NAND chip specific) and don't
belong here. If they're set already, then use what we find there.
Otherwise, revert to the most conservative default values (and whinge).

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
[MTD] [NAND] Remove debugging cruft from CAFÉ NAND driver.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
[MTD] OneNAND: Amend write-verify to compare to original buffer

When write-verify is enabled (CONFIG_MTD_ONENAND_VERIFY_WRITE),
the data written is read back and compared.  The comparison
was being made between dataRAM buffers, but this does not
verify that the data made it to the dataRAM correctly in
the first place.  This patch amends write-verify to
compare back to the original buffer.  It also now verifies
sub-page writes.

Signed-off-by: Adrian Hunter <ext-adrian.hunter@nokia.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
[MTD] OneNAND: Remove unused fields

- Remove unused fields
- Fix typo

Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
[MTD] ck804xrom: fix a pci_find_device

Going over the bugs and warnings I found this one left over. The other
changes have already been correctly done for this driver but the actual
switch to pci_get_device that they assume has not.

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
[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>
[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>
[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>
[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>
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
[MTD NAND] CAFÉ controller depends, perhaps unsurprisingly, on NAND

Noticed by Ingo.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
[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>
[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>
[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>