mtd: factor out device code from mtd core

This way we can add more core functionality later without
interfering with the mtd character device implementation.
mtd/nand: nand_imx: remove setting mtd->dev

The mtd->dev field is used nowhere else in barebox. This patch
clears the way for removing mtd->dev alltogether.
mtd: remove mtd->dev, nobody uses it anymore
mtd: mtdoob: consistent mtdoob_* naming

This commit mainly intents to clean up the mtd_* namespace
for future patches.
mtd: add mtd_*() core functions from the kernel

This commit is part of the synchronization of the barebox mtd
layer with Linux v3.4.
mtd: make mtd clients use the mtd_*() API calls

Instead of using mtd->{read,write,erase,...} directly, use the
corresponding mtd_*() API call. By doing this we reuse all the
basic sanity checking from the mtd_*() calls and can remove bogus
checks from the drivers later.

This commit is part of the synchronization of the barebox mtd
layer with Linux v3.4.
mtd: add leading underscore to all mtd functions

[backport from linux commit 3c3c10bba1e4ccb75b41442e45c1a072f6cded19]

This patch renames all MTD functions by adding a "_" prefix:

mtd->erase -> mtd->_erase
mtd->read_oob -> mtd->_read_oob
...

The reason is that we are re-working the MTD API and from now on it is
an error to use MTD function pointers directly - we have a corresponding
API call for every pointer. By adding a leading "_" we achieve the following:

1. Make sure we convert every direct pointer users
2. A leading "_" suggests that this interface is internal and it becomes
   less likely that people will use them directly
3. Make sure all the out-of-tree modules stop compiling and the owners
   spot the big API change and amend them.

This commit is part of the synchronization of the barebox mtd layer with
Linux v3.4.
mtd: cleanup nand.h

Along with the changes below, this commit also removes documentation for
fields that do not exist anymore.

[includes kernel commit b46daf7eb1a143169699a8f9df634aa751a6ddde]

Remove tabs between type and name.

[includes kernel commit a0491fc4d4b584ddc23f412e9a57b05d66a21263]

- *var instead of * var
- proper multiline comment
- func(args) instead of func (args)
- 80 lines

This commit is part of the synchronization of the barebox mtd layer with
Linux v3.4.
mtd: nand: add "page" parameter to all read_page/read_page_raw APIs

[backport of linux commit 46a8cf2df2232c0051f29716ff8a166ebeb08daf]

This patch adds a new "page" parameter to all NAND read_page/read_page_raw
APIs.  The read_page API for the new mode ECC_HW_OOB_FIRST requires the
page information to send the READOOB command and read the OOB area before
the data area.

This commit is part of the synchronization of the barebox mtd layer with
Linux v3.4.
mtd: nand: Allow caller to pass alternative ID table to nand_scan_ident()

[backport of linux commit 5e81e88a4c140586d9212999cea683bcd66a15c6]
mtd: nand: improve NAND flash detection via extid

This is based mainly on:

[linux commit 426c457a3216fac74e3d44dd39729b0689f4c7ab]

  mtd: nand: extend NAND flash detection to new MLC chips

[linux commit cfe3fdadb16162327773ef01a575a32000b8c7f4]

  mtd: nand: Fix probe of Samsung NAND chips

[linux commit 2173bae81e17b710328bc877e7b9ade7f4b90064]

  mtd: nand: spansion S30MLxxxP support

[linux commit 34c5bf6cc78e56537e0d508f5979f27ea8a64e31]

  mtd: nand: Samsung MLC - new OOB sizes

This commit is part of the synchronization of the barebox mtd layer with
Linux v3.4.
lib/string: add strim/strstrip functionality
mtd: nand: add support for reading ONFI parameters from NAND device

This commit allows to selectivly build in support for ONFI by setting
CONFIG_NAND_ONFI in the configuration.

Mainly based on the following:

[backport of linux commit d1e1f4e42b5df063712ca2926e50c07b95c96b96]

This patch adds support for reading NAND device ONFI parameters and use
the ONFI informations to define its geometry. In case the device supports
ONFI, the onfi_version field in struct nand_chip contains the version (BCD)
and the onfi_params structure can be used by drivers to set up timings and
such. We currently only support ONFI 1.0 parameters.

[backport of linux commit 6fb277ba847f37489dc22adffed700e0c3ea3acf]

mtd: nand: split ONFI detection logic to its own function

In order to reduce the indentation and improve the readability of nand_get_
flash_type, split the ONFI detection logic to its own function. The detection
logic inside nand_flash_detect_onfi is also rewritten to allow for less
indentation.

This commit is part of the synchronization of the barebox mtd layer with
Linux v3.4.