platform/kernel/linux-rpi.git
8 years agoRevert "mtd: atmel_nand: Support variable RB_EDGE interrupts"
Wenyou Yang [Mon, 9 May 2016 06:51:18 +0000 (14:51 +0800)]
Revert "mtd: atmel_nand: Support variable RB_EDGE interrupts"

This reverts commit 5ddc7bd43ccc ("mtd: atmel_nand: Support variable
RB_EDGE interrupts")

Because for current SoCs, the RB_EDGE3(i.e. bit 27) of HSMC_SR
register does not exist, the RB_EDGE0 (i.e. bit 24) is the ready/busy
line edge status bit. It is a datasheet bug.

Cc: <stable@vger.kernel.org>
Fixes: commit 5ddc7bd43ccc ("mtd: atmel_nand: Support variable RB_EDGE interrupts")
Signed-off-by: Wenyou Yang <wenyou.yang@atmel.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: spi-nor: support GigaDevice gd25lq64c
Brian Norris [Fri, 6 May 2016 15:37:41 +0000 (08:37 -0700)]
mtd: spi-nor: support GigaDevice gd25lq64c

Also note the GigaDevice JEDEC ID.

No write-protect support yet, since this flash uses a different status
register layout.

Cc: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Acked-by: Marek Vasut <marex@denx.de>
8 years agomtd: nand_bch: fix spelling of "probably"
Brian Norris [Fri, 6 May 2016 16:31:18 +0000 (09:31 -0700)]
mtd: nand_bch: fix spelling of "probably"

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Acked-by: Boris Brezillon <boris.brezillon@free-electrons.com>
8 years agoMerge tag 'nand/for-4.7' of github.com:linux-nand/linux
Brian Norris [Fri, 6 May 2016 01:04:53 +0000 (18:04 -0700)]
Merge tag 'nand/for-4.7' of github.com:linux-nand/linux

Updates from Boris Brezillon:

This pull request contains the following infrastructure changes:
* introduction of the ECC algo concept to extend the ECC mode one
* replacement of the nand_ecclayout infrastructure by something more
  future-proof.
* addition of an mtd-activity led trigger to replace the nand-activity
  one

And a bunch of specific NAND driver improvements/fixes. Here are the
changes that are worth mentioning:
* rework of the OMAP GPMC and NAND drivers
* prepare the sunxi NAND driver to receive DMA support
* handle bitflips in erased pages on GPMI revisions that do not support
  this in hardware.

* tag 'nand/for-4.7' of github.com:linux-nand/linux: (152 commits)
  mtd: brcmnand: respect ECC algorithm set by NAND subsystem
  gpmi-nand: Handle ECC Errors in erased pages
  Documentation: devicetree: deprecate "soft_bch" nand-ecc-mode value
  mtd: nand: add support for "nand-ecc-algo" DT property
  mtd: mtd: drop NAND_ECC_SOFT_BCH enum value
  mtd: drop support for NAND_ECC_SOFT_BCH as "soft_bch" mapping
  mtd: nand: read ECC algorithm from the new field
  mtd: nand: fsmc: validate ECC setup by checking algorithm directly
  mtd: nand: set ECC algorithm to Hamming on fallback
  staging: mt29f_spinand: set ECC algorithm explicitly
  CRIS v32: nand: set ECC algorithm explicitly
  mtd: nand: atmel: set ECC algorithm explicitly
  mtd: nand: davinci: set ECC algorithm explicitly
  mtd: nand: bf5xx: set ECC algorithm explicitly
  mtd: nand: omap2: Fix high memory dma prefetch transfer
  mtd: nand: omap2: Start dma request before enabling prefetch
  mtd: nandsim: add __init attribute
  mtd: nand: move of_get_nand_xxx() helpers into nand_base.c
  mtd: nand: sh_flctl: rely on generic DT parsing done in nand_scan_ident()
  mtd: nand: mxc: rely on generic DT parsing done in nand_scan_ident()
  ...

8 years agomtd: brcmnand: respect ECC algorithm set by NAND subsystem
Brian Norris [Tue, 26 Apr 2016 05:53:55 +0000 (22:53 -0700)]
mtd: brcmnand: respect ECC algorithm set by NAND subsystem

This is more obvious than guessing based on ECC strength. It allows
using NAND on devices with BCH-1 (e.g. D-Link DIR-885L).

This maintains DT backward compatibility by defaulting to Hamming if a
1-bit ECC algorithm is specified without a corresponding algorithm
selection. i.e., to use BCH-1, you must specify:

  nand-ecc-strength = <1>;
  nand-ecc-step-size = <512>;
  nand-ecc-algo = "bch";

Also adds a check to ensure we haven't allowed someone to get by with SW
ECC. If we want to support SW ECC, we need to refactor some other pieces
of this driver.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Tested-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
8 years agogpmi-nand: Handle ECC Errors in erased pages
Markus Pargmann [Mon, 25 Apr 2016 12:35:12 +0000 (14:35 +0200)]
gpmi-nand: Handle ECC Errors in erased pages

ECC is only calculated for written pages. As erased pages are not
actively written the ECC is always invalid. For this purpose the
Hardware BCH unit is able to check for erased pages and does not raise
an ECC error in this case. This behaviour can be influenced using the
BCH_MODE register which sets the number of allowed bitflips in an erased
page. Unfortunately the unit is not capable of fixing the bitflips in
memory.

To avoid complete software checks for erased pages, we can simply check
buffers with uncorrectable ECC errors because we know that any erased
page with errors is uncorrectable by the BCH unit.

This patch adds the generic nand_check_erased_ecc_chunk() to gpmi-nand
to correct erased pages. To have the valid data in the buffer before
using them, this patch moves the read_page_swap_end() call before the
ECC status checking for-loop.

Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
[Squashed patches by Stefan and Boris to check ECC area]
Tested-by: Stefan Christ <s.christ@phytec.de>
Acked-by: Han xu <han.xu@nxp.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
8 years agoDocumentation: devicetree: deprecate "soft_bch" nand-ecc-mode value
Rafał Miłecki [Fri, 22 Apr 2016 11:23:14 +0000 (13:23 +0200)]
Documentation: devicetree: deprecate "soft_bch" nand-ecc-mode value

Now that we support nand-ecc-algo property it should be used together
with "soft" to specify software BCH ECC.

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
8 years agomtd: nand: add support for "nand-ecc-algo" DT property
Rafał Miłecki [Fri, 22 Apr 2016 11:23:13 +0000 (13:23 +0200)]
mtd: nand: add support for "nand-ecc-algo" DT property

So far it was only possible to specify ECC algorithm using "soft" and
"soft_bch" values of nand-ecc-mode prop. There wasn't a way to specify
it for a hardware ECC mode.

Now that we have independent field in NAND subsystem for storing info
about ECC algorithm we may also add support for this new DT property.

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
8 years agomtd: mtd: drop NAND_ECC_SOFT_BCH enum value
Rafał Miłecki [Sun, 17 Apr 2016 20:53:07 +0000 (22:53 +0200)]
mtd: mtd: drop NAND_ECC_SOFT_BCH enum value

This value should not be part of nand_ecc_modes_t as it specifies
algorithm not a mode. We successfully managed to introduce new "algo"
field which is respected now.

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
8 years agomtd: drop support for NAND_ECC_SOFT_BCH as "soft_bch" mapping
Rafał Miłecki [Sun, 17 Apr 2016 20:53:06 +0000 (22:53 +0200)]
mtd: drop support for NAND_ECC_SOFT_BCH as "soft_bch" mapping

There isn't any difference between handling NAND_ECC_SOFT and
NAND_ECC_SOFT_BCH now. What matters is the new field called "algo".
Please note we're keeping backward DT compatibility. We are still
treating "soft_bch" value as the one setting Hamming algorithm, it's
just handled in of_get_nand_ecc_algo now.

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
8 years agomtd: nand: read ECC algorithm from the new field
Rafał Miłecki [Sun, 17 Apr 2016 20:53:05 +0000 (22:53 +0200)]
mtd: nand: read ECC algorithm from the new field

Now we have all drivers properly setting this new field we can start
using it. For a very short period of time we should support both values:
NAND_ECC_SOFT and NAND_ECC_SOFT_BCH treating them the same. It's because
of_get_nand_ecc_mode may still be setting NAND_ECC_SOFT_BCH.

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
8 years agomtd: nand: fsmc: validate ECC setup by checking algorithm directly
Rafał Miłecki [Sun, 17 Apr 2016 20:53:04 +0000 (22:53 +0200)]
mtd: nand: fsmc: validate ECC setup by checking algorithm directly

NAND core sets ECC algorithm in algo field now and it should be
preferred over the mode field. This also prepares driver for dropping
NAND_ECC_SOFT_BCH.

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
8 years agomtd: nand: set ECC algorithm to Hamming on fallback
Rafał Miłecki [Sun, 17 Apr 2016 20:53:02 +0000 (22:53 +0200)]
mtd: nand: set ECC algorithm to Hamming on fallback

This is part of process deprecating NAND_ECC_SOFT_BCH (and switching to
enum nand_ecc_algo).

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
8 years agostaging: mt29f_spinand: set ECC algorithm explicitly
Rafał Miłecki [Sun, 17 Apr 2016 20:53:01 +0000 (22:53 +0200)]
staging: mt29f_spinand: set ECC algorithm explicitly

This is part of process deprecating NAND_ECC_SOFT_BCH (and switching to
enum nand_ecc_algo).

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
8 years agoCRIS v32: nand: set ECC algorithm explicitly
Rafał Miłecki [Sun, 17 Apr 2016 20:53:00 +0000 (22:53 +0200)]
CRIS v32: nand: set ECC algorithm explicitly

This is part of process deprecating NAND_ECC_SOFT_BCH (and switching to
enum nand_ecc_algo).

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Acked-by: Mikael Starvik <starvik@axis.com>
Acked-by: Jesper Nilsson <jesper.nilsson@axis.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
8 years agomtd: nand: atmel: set ECC algorithm explicitly
Rafał Miłecki [Sun, 17 Apr 2016 20:52:59 +0000 (22:52 +0200)]
mtd: nand: atmel: set ECC algorithm explicitly

This is part of process deprecating NAND_ECC_SOFT_BCH (and switching to
enum nand_ecc_algo).

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
8 years agomtd: nand: davinci: set ECC algorithm explicitly
Rafał Miłecki [Sun, 17 Apr 2016 20:52:58 +0000 (22:52 +0200)]
mtd: nand: davinci: set ECC algorithm explicitly

This is part of process deprecating NAND_ECC_SOFT_BCH (and switching to
enum nand_ecc_algo).

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
8 years agomtd: nand: bf5xx: set ECC algorithm explicitly
Rafał Miłecki [Sun, 17 Apr 2016 20:52:57 +0000 (22:52 +0200)]
mtd: nand: bf5xx: set ECC algorithm explicitly

This is part of process deprecating NAND_ECC_SOFT_BCH (and switching to
enum nand_ecc_algo).

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
8 years agomtd: nand: omap2: Fix high memory dma prefetch transfer
Cooper Jr., Franklin [Fri, 15 Apr 2016 20:28:59 +0000 (15:28 -0500)]
mtd: nand: omap2: Fix high memory dma prefetch transfer

Based on DMA documentation and testing using high memory buffer when doing
dma transfers can lead to various issues including kernel panics.

To workaround this simply use cpu copy.

Signed-off-by: Franklin S Cooper Jr <fcooper@ti.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
8 years agomtd: nand: omap2: Start dma request before enabling prefetch
Cooper Jr., Franklin [Fri, 15 Apr 2016 20:28:58 +0000 (15:28 -0500)]
mtd: nand: omap2: Start dma request before enabling prefetch

The prefetch engine sends a dma request once a FIFO threshold has
been met. No other requests are received until the previous request
is handled.

Starting a dma transfer (dma_async_issue_pending) results in any
previous event for the dma channel to be cleared. Therefore, starting
the prefetch engine before initiating the dma transfer may result in
the prefetch triggering a dma request but instead of it being handled
it can end up being cleared. This will result in a hang since the code
will continue to wait for the dma request to complete.

By initiating the dma request before enabling the prefetch engine this
race condition is avoided and no dma request are missed/cleared.

Signed-off-by: Franklin S Cooper Jr <fcooper@ti.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
8 years agomtd: nandsim: add __init attribute
Julia Lawall [Tue, 19 Apr 2016 12:33:35 +0000 (14:33 +0200)]
mtd: nandsim: add __init attribute

Add __init attribute on functions that are only called from other __init
functions and that are not inlined, at least with gcc version 4.8.4 on an
x86 machine with allyesconfig.  Currently, the functions are put in the
.text.unlikely segment.  Declaring them as __init will cause them to be
put in the .init.text and to disappear after initialization.

The result of objdump -x on the functions before the change is as follows:

000000000000059a l     F .text.unlikely 0000000000000239 alloc_device
000000000000034e l     F .text.unlikely 000000000000002e get_partition_name
00000000000007d3 l     F .text.unlikely 00000000000005da init_nandsim

And after the change it is as follows:

0000000000000029 l     F .init.text 0000000000000234 alloc_device
0000000000000000 l     F .init.text 0000000000000029 get_partition_name
000000000000025d l     F .init.text 00000000000005d5 init_nandsim

Done with the help of Coccinelle.  The semantic patch checks for local
static non-init functions that are called from an __init function and are
not called from any other function.

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
8 years agomtd: nand: move of_get_nand_xxx() helpers into nand_base.c
Boris Brezillon [Fri, 1 Apr 2016 12:54:32 +0000 (14:54 +0200)]
mtd: nand: move of_get_nand_xxx() helpers into nand_base.c

Now that all drivers go through nand_set_flash_node() to parse the generic
NAND properties, we can move all of_get_nand_xxx() helpers in to
nand_base.c, make them static and remove of_mtd.c and of_mtd.h.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
8 years agomtd: nand: sh_flctl: rely on generic DT parsing done in nand_scan_ident()
Boris Brezillon [Fri, 1 Apr 2016 12:54:31 +0000 (14:54 +0200)]
mtd: nand: sh_flctl: rely on generic DT parsing done in nand_scan_ident()

The core now takes care of parsing generic DT properties in
nand_scan_ident() when nand_set_flash_node() has been called.
Rely on this initialization instead of calling of_get_nand_xxx()
manually.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
8 years agomtd: nand: mxc: rely on generic DT parsing done in nand_scan_ident()
Boris Brezillon [Fri, 1 Apr 2016 12:54:29 +0000 (14:54 +0200)]
mtd: nand: mxc: rely on generic DT parsing done in nand_scan_ident()

The core now takes care of parsing generic DT properties in
nand_scan_ident() when nand_set_flash_node() has been called.
Rely on this initialization instead of calling of_get_nand_xxx()
manually.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
8 years agomtd: nand: lpc32xx: rely on generic DT parsing done in nand_scan_ident()
Boris Brezillon [Fri, 1 Apr 2016 12:54:28 +0000 (14:54 +0200)]
mtd: nand: lpc32xx: rely on generic DT parsing done in nand_scan_ident()

The core now takes care of parsing generic DT properties in
nand_scan_ident() when nand_set_flash_node() has been called.
Rely on this initialization instead of calling of_get_nand_xxx()
manually.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
8 years agomtd: nand: hisi504: rely on generic DT parsing done in nand_scan_ident()
Boris Brezillon [Fri, 1 Apr 2016 12:54:27 +0000 (14:54 +0200)]
mtd: nand: hisi504: rely on generic DT parsing done in nand_scan_ident()

The core now takes care of parsing generic DT properties in
nand_scan_ident() when nand_set_flash_node() has been called.
Rely on this initialization instead of calling of_get_nand_xxx()
manually.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
8 years agomtd: nand: davinci: rely on generic DT parsing done in nand_scan_ident()
Boris Brezillon [Fri, 1 Apr 2016 12:54:25 +0000 (14:54 +0200)]
mtd: nand: davinci: rely on generic DT parsing done in nand_scan_ident()

The core now takes care of parsing generic DT properties in
nand_scan_ident() when nand_set_flash_node() has been called.
Rely on this initialization instead of calling of_get_nand_xxx()
manually.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
8 years agomtd: nand: gpmi: rely on generic DT parsing done in nand_scan_ident()
Boris Brezillon [Fri, 1 Apr 2016 12:54:26 +0000 (14:54 +0200)]
mtd: nand: gpmi: rely on generic DT parsing done in nand_scan_ident()

The core now takes care of parsing generic DT properties in
nand_scan_ident() when nand_set_flash_node() has been called.
Rely on this initialization instead of calling of_get_nand_xxx()
manually.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Acked-by: Han xu <han.xu@nxp.com>
8 years agomtd: nand: omap2: fix compare_const_fl.cocci warnings
Julia Lawall [Thu, 14 Apr 2016 06:54:30 +0000 (08:54 +0200)]
mtd: nand: omap2: fix compare_const_fl.cocci warnings

Move constants to the right of binary operators.

Generated by: scripts/coccinelle/misc/compare_const_fl.cocci

CC: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
8 years agomtd: nand: jz4740: Remove unused local variable
Maarten ter Huurne [Mon, 18 Apr 2016 16:04:56 +0000 (18:04 +0200)]
mtd: nand: jz4740: Remove unused local variable

Signed-off-by: Maarten ter Huurne <maarten@treewalker.org>
Acked-by: Harvey Hunt <harvey.hunt@imgtec.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
8 years agomtd: nand: fsl_elbc: set ECC algorithm explicitly
Rafał Miłecki [Wed, 13 Apr 2016 12:07:02 +0000 (14:07 +0200)]
mtd: nand: fsl_elbc: set ECC algorithm explicitly

This is part of process deprecating NAND_ECC_SOFT_BCH (and switching to
enum nand_ecc_algo).

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
8 years agomtd: nand: fsl_ifc: set ECC algorithm explicitly
Rafał Miłecki [Wed, 13 Apr 2016 12:07:01 +0000 (14:07 +0200)]
mtd: nand: fsl_ifc: set ECC algorithm explicitly

This is part of process deprecating NAND_ECC_SOFT_BCH (and switching to
enum nand_ecc_algo).

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
8 years agomtd: nand: fsl_upm: set ECC algorithm explicitly
Rafał Miłecki [Wed, 13 Apr 2016 12:07:00 +0000 (14:07 +0200)]
mtd: nand: fsl_upm: set ECC algorithm explicitly

This is part of process deprecating NAND_ECC_SOFT_BCH (and switching to
enum nand_ecc_algo).

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
8 years agomtd: nand: cmx270: set ECC algorithm explicitly
Rafał Miłecki [Wed, 13 Apr 2016 12:06:59 +0000 (14:06 +0200)]
mtd: nand: cmx270: set ECC algorithm explicitly

This is part of process deprecating NAND_ECC_SOFT_BCH (and switching to
enum nand_ecc_algo).

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
8 years agomtd: nand: mpc5121_nfc: set ECC algorithm explicitly
Rafał Miłecki [Wed, 13 Apr 2016 12:06:58 +0000 (14:06 +0200)]
mtd: nand: mpc5121_nfc: set ECC algorithm explicitly

This is part of process deprecating NAND_ECC_SOFT_BCH (and switching to
enum nand_ecc_algo).

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
8 years agomtd: nand: au1550nd: set ECC algorithm explicitly
Rafał Miłecki [Wed, 13 Apr 2016 12:06:57 +0000 (14:06 +0200)]
mtd: nand: au1550nd: set ECC algorithm explicitly

This is part of process deprecating NAND_ECC_SOFT_BCH (and switching to
enum nand_ecc_algo).

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
8 years agomtd: nand: sh_flctl: set ECC algorithm explicitly
Rafał Miłecki [Wed, 13 Apr 2016 12:06:56 +0000 (14:06 +0200)]
mtd: nand: sh_flctl: set ECC algorithm explicitly

This is part of process deprecating NAND_ECC_SOFT_BCH (and switching to
enum nand_ecc_algo).

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
8 years agomtd: nand: s3c2410: set ECC algorithm explicitly
Rafał Miłecki [Wed, 13 Apr 2016 12:06:55 +0000 (14:06 +0200)]
mtd: nand: s3c2410: set ECC algorithm explicitly

This is part of process deprecating NAND_ECC_SOFT_BCH (and switching to
enum nand_ecc_algo).

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
8 years agomtd: nand: omap2: set ECC algorithm explicitly
Rafał Miłecki [Wed, 13 Apr 2016 12:06:54 +0000 (14:06 +0200)]
mtd: nand: omap2: set ECC algorithm explicitly

This is part of process deprecating NAND_ECC_SOFT_BCH (and switching to
enum nand_ecc_algo).

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
8 years agomtd: kill the nand_ecclayout struct
Boris Brezillon [Thu, 4 Feb 2016 09:16:18 +0000 (10:16 +0100)]
mtd: kill the nand_ecclayout struct

Now that all MTD drivers have moved to the mtd_ooblayout_ops model we can
safely remove the struct nand_ecclayout definition, and all the remaining
places where it was still used.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
8 years agomtd: nand: kill the ecc->layout field
Boris Brezillon [Wed, 3 Feb 2016 18:24:10 +0000 (19:24 +0100)]
mtd: nand: kill the ecc->layout field

Now that all NAND drivers have switched to mtd_ooblayout_ops, we can kill
the ecc->layout field.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
8 years agostaging: mt29f_spinand: switch to mtd_ooblayout_ops
Boris Brezillon [Wed, 3 Feb 2016 18:13:39 +0000 (19:13 +0100)]
staging: mt29f_spinand: switch to mtd_ooblayout_ops

Replace the nand_ecclayout definition by the equivalent mtd_ooblayout_ops
definition.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
8 years agomtd: onenand: switch to mtd_ooblayout_ops
Boris Brezillon [Mon, 7 Dec 2015 21:46:45 +0000 (22:46 +0100)]
mtd: onenand: switch to mtd_ooblayout_ops

Implementing the mtd_ooblayout_ops interface is the new way of exposing
ECC/OOB layout to MTD users. Modify the onenand drivers to switch to this
approach.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
8 years agomtd: nand: qcom: switch to mtd_ooblayout_ops
Boris Brezillon [Fri, 18 Mar 2016 16:54:27 +0000 (17:54 +0100)]
mtd: nand: qcom: switch to mtd_ooblayout_ops

Implementing the mtd_ooblayout_ops interface is the new way of exposing
ECC/OOB layout to MTD users.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Tested-by: Archit Taneja <architt@codeaurora.org>
8 years agomtd: nand: vf610: switch to mtd_ooblayout_ops
Boris Brezillon [Wed, 3 Feb 2016 19:05:45 +0000 (20:05 +0100)]
mtd: nand: vf610: switch to mtd_ooblayout_ops

Implementing the mtd_ooblayout_ops interface is the new way of exposing
ECC/OOB layout to MTD users.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Tested-by: Stefan Agner <stefan@agner.ch>
Acked-by: Stefan Agner <stefan@agner.ch>
8 years agomtd: nand: sunxi: switch to mtd_ooblayout_ops
Boris Brezillon [Wed, 3 Feb 2016 19:05:13 +0000 (20:05 +0100)]
mtd: nand: sunxi: switch to mtd_ooblayout_ops

Implementing the mtd_ooblayout_ops interface is the new way of exposing
ECC/OOB layout to MTD users.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
8 years agomtd: nand: sm_common: switch to mtd_ooblayout_ops
Boris Brezillon [Wed, 3 Feb 2016 19:04:59 +0000 (20:04 +0100)]
mtd: nand: sm_common: switch to mtd_ooblayout_ops

Implementing the mtd_ooblayout_ops interface is the new way of exposing
ECC/OOB layout to MTD users.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
8 years agomtd: nand: sh_flctl: switch to mtd_ooblayout_ops
Boris Brezillon [Wed, 3 Feb 2016 19:03:47 +0000 (20:03 +0100)]
mtd: nand: sh_flctl: switch to mtd_ooblayout_ops

Implementing the mtd_ooblayout_ops interface is the new way of exposing
ECC/OOB layout to MTD users.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
8 years agomtd: nand: s3c2410: switch to mtd_ooblayout_ops
Boris Brezillon [Wed, 3 Feb 2016 19:03:30 +0000 (20:03 +0100)]
mtd: nand: s3c2410: switch to mtd_ooblayout_ops

Implementing the mtd_ooblayout_ops interface is the new way of exposing
ECC/OOB layout to MTD users.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
8 years agomtd: nand: pxa3xx: switch to mtd_ooblayout_ops
Boris Brezillon [Wed, 3 Feb 2016 19:03:18 +0000 (20:03 +0100)]
mtd: nand: pxa3xx: switch to mtd_ooblayout_ops

Implementing the mtd_ooblayout_ops interface is the new way of exposing
ECC/OOB layout to MTD users.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
8 years agomtd: nand: omap2: switch to mtd_ooblayout_ops
Boris Brezillon [Wed, 3 Feb 2016 19:03:04 +0000 (20:03 +0100)]
mtd: nand: omap2: switch to mtd_ooblayout_ops

Implementing the mtd_ooblayout_ops interface is the new way of exposing
ECC/OOB layout to MTD users.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
8 years agomtd: nand: mxc: switch to mtd_ooblayout_ops
Boris Brezillon [Wed, 3 Feb 2016 19:02:54 +0000 (20:02 +0100)]
mtd: nand: mxc: switch to mtd_ooblayout_ops

Implementing the mtd_ooblayout_ops interface is the new way of exposing
ECC/OOB layout to MTD users.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
8 years agomtd: nand: lpc32xx: switch to mtd_ooblayout_ops
Boris Brezillon [Wed, 3 Feb 2016 19:02:41 +0000 (20:02 +0100)]
mtd: nand: lpc32xx: switch to mtd_ooblayout_ops

Implementing the mtd_ooblayout_ops interface is the new way of exposing
ECC/OOB layout to MTD users.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
8 years agomtd: nand: jz4780: switch to mtd_ooblayout_ops
Boris Brezillon [Wed, 3 Feb 2016 19:02:22 +0000 (20:02 +0100)]
mtd: nand: jz4780: switch to mtd_ooblayout_ops

Implementing the mtd_ooblayout_ops interface is the new way of exposing
ECC/OOB layout to MTD users.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Tested-by: Harvey Hunt <harvey.hunt@imgtec.com>
8 years agomtd: nand: hisi504: switch to mtd_ooblayout_ops
Boris Brezillon [Wed, 3 Feb 2016 19:02:09 +0000 (20:02 +0100)]
mtd: nand: hisi504: switch to mtd_ooblayout_ops

Implementing the mtd_ooblayout_ops interface is the new way of exposing
ECC/OOB layout to MTD users.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
8 years agomtd: nand: gpmi: switch to mtd_ooblayout_ops
Boris Brezillon [Wed, 3 Feb 2016 19:01:54 +0000 (20:01 +0100)]
mtd: nand: gpmi: switch to mtd_ooblayout_ops

Implementing the mtd_ooblayout_ops interface is the new way of exposing
ECC/OOB layout to MTD users.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Acked-by: Han Xu <han.xu@nxp.com>
Tested-by: Han Xu <han.xu@nxp.com>
8 years agomtd: nand: fsmc: get rid of the fsmc_nand_eccplace struct
Boris Brezillon [Tue, 9 Feb 2016 14:01:21 +0000 (15:01 +0100)]
mtd: nand: fsmc: get rid of the fsmc_nand_eccplace struct

Now that mtd_ooblayout_ecc() returns the ECC byte position using the
OOB free method, we can get rid of the fsmc_nand_eccplace struct.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
8 years agomtd: nand: fsmc: switch to mtd_ooblayout_ops
Boris Brezillon [Wed, 3 Feb 2016 19:01:42 +0000 (20:01 +0100)]
mtd: nand: fsmc: switch to mtd_ooblayout_ops

Implementing the mtd_ooblayout_ops interface is the new way of exposing
ECC/OOB layout to MTD users.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
8 years agomtd: nand: fsl_ifc: switch to mtd_ooblayout_ops
Boris Brezillon [Tue, 9 Feb 2016 16:01:57 +0000 (17:01 +0100)]
mtd: nand: fsl_ifc: switch to mtd_ooblayout_ops

Implementing the mtd_ooblayout_ops interface is the new way of exposing
ECC/OOB layout to MTD users.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
8 years agomtd: nand: fsl_elbc: switch to mtd_ooblayout_ops
Boris Brezillon [Wed, 3 Feb 2016 19:01:04 +0000 (20:01 +0100)]
mtd: nand: fsl_elbc: switch to mtd_ooblayout_ops

Implementing the mtd_ooblayout_ops interface is the new way of exposing
ECC/OOB layout to MTD users.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
8 years agomtd: nand: docg4: switch to mtd_ooblayout_ops
Boris Brezillon [Wed, 3 Feb 2016 19:00:35 +0000 (20:00 +0100)]
mtd: nand: docg4: switch to mtd_ooblayout_ops

Implementing the mtd_ooblayout_ops interface is the new way of exposing
ECC/OOB layout to MTD users.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
8 years agomtd: nand: diskonchip: switch to mtd_ooblayout_ops
Boris Brezillon [Wed, 3 Feb 2016 19:00:23 +0000 (20:00 +0100)]
mtd: nand: diskonchip: switch to mtd_ooblayout_ops

Implementing the mtd_ooblayout_ops interface is the new way of exposing
ECC/OOB layout to MTD users.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
8 years agomtd: nand: denali: switch to mtd_ooblayout_ops
Boris Brezillon [Wed, 3 Feb 2016 19:00:11 +0000 (20:00 +0100)]
mtd: nand: denali: switch to mtd_ooblayout_ops

Implementing the mtd_ooblayout_ops interface is the new way of exposing
ECC/OOB layout to MTD users.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
8 years agomtd: nand: davinci: switch to mtd_ooblayout_ops
Boris Brezillon [Wed, 3 Feb 2016 18:59:58 +0000 (19:59 +0100)]
mtd: nand: davinci: switch to mtd_ooblayout_ops

Implementing the mtd_ooblayout_ops interface is the new way of exposing
ECC/OOB layout to MTD users.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
8 years agomtd: nand: cafe: switch to mtd_ooblayout_ops
Boris Brezillon [Wed, 3 Feb 2016 18:59:47 +0000 (19:59 +0100)]
mtd: nand: cafe: switch to mtd_ooblayout_ops

Implementing the mtd_ooblayout_ops interface is the new way of exposing
ECC/OOB layout to MTD users.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
8 years agomtd: nand: brcm: switch to mtd_ooblayout_ops
Boris Brezillon [Wed, 3 Feb 2016 18:59:36 +0000 (19:59 +0100)]
mtd: nand: brcm: switch to mtd_ooblayout_ops

Implementing the mtd_ooblayout_ops interface is the new way of exposing
ECC/OOB layout to MTD users.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
8 years agomtd: nand: bf5xx: switch to mtd_ooblayout_ops
Boris Brezillon [Wed, 3 Feb 2016 18:59:25 +0000 (19:59 +0100)]
mtd: nand: bf5xx: switch to mtd_ooblayout_ops

Implementing the mtd_ooblayout_ops interface is the new way of exposing
ECC/OOB layout to MTD users.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
8 years agomtd: nand: atmel: switch to mtd_ooblayout_ops
Boris Brezillon [Wed, 3 Feb 2016 18:59:11 +0000 (19:59 +0100)]
mtd: nand: atmel: switch to mtd_ooblayout_ops

Implementing the mtd_ooblayout_ops interface is the new way of exposing
ECC/OOB layout to MTD users.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Reviewed-by: Nicolas Ferre <nicolas.ferre@atmel.com>
8 years agomtd: nand: jz4740: switch to mtd_ooblayout_ops
Boris Brezillon [Wed, 3 Feb 2016 18:58:55 +0000 (19:58 +0100)]
mtd: nand: jz4740: switch to mtd_ooblayout_ops

Implementing the mtd_ooblayout_ops interface is the new way of exposing
ECC/OOB layout to MTD users.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
8 years agomtd: nand: sharpsl: switch to mtd_ooblayout_ops
Boris Brezillon [Wed, 3 Feb 2016 18:58:11 +0000 (19:58 +0100)]
mtd: nand: sharpsl: switch to mtd_ooblayout_ops

Implementing the mtd_ooblayout_ops interface is the new way of exposing
ECC/OOB layout to MTD users.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
8 years agomtd: nand: bch: switch to mtd_ooblayout_ops
Boris Brezillon [Wed, 3 Feb 2016 18:53:40 +0000 (19:53 +0100)]
mtd: nand: bch: switch to mtd_ooblayout_ops

Replace the nand_ecclayout definition by the equivalent mtd_ooblayout_ops
definition.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
8 years agomtd: pmc551: add __init attribute
Julia Lawall [Tue, 19 Apr 2016 12:33:34 +0000 (14:33 +0200)]
mtd: pmc551: add __init attribute

Add __init attribute on a function that is only called from other __init
functions and that is not inlined, at least with gcc version 4.8.4 on an
x86 machine with allyesconfig.  Currently, the function is put in the
.text.unlikely segment.  Declaring it as __init will cause it to be put in
the .init.text and to disappear after initialization.

The result of objdump -x on the function before the change is as follows:

00000000000000c6 l     F .text.unlikely 000000000000091c fixup_pmc551

And after the change it is as follows:

0000000000000000 l     F .init.text 0000000000000917 fixup_pmc551

Done with the help of Coccinelle.  The semantic patch checks for local
static non-init functions that are called from an __init function and are
not called from any other function.

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: maps: add __init attribute
Julia Lawall [Tue, 19 Apr 2016 12:33:33 +0000 (14:33 +0200)]
mtd: maps: add __init attribute

Add __init attribute on functions that are only called from other __init
functions and that are not inlined, at least with gcc version 4.8.4 on an
x86 machine with allyesconfig.  Currently, the functions are put in the
.text.unlikely segment.  Declaring them as __init will cause them to be
put in the .init.text and to disappear after initialization.

The result of objdump -x on the functions before the change is as follows:

00000000000001bc l     F .text.unlikely 00000000000006a2 ck804xrom_init_one.isra.1
00000000000001aa l     F .text.unlikely 0000000000000764 esb2rom_init_one.isra.1
00000000000001db l     F .text.unlikely 0000000000000716 ichxrom_init_one.isra.1

And after the change it is as follows:

0000000000000000 l     F .init.text 000000000000069d ck804xrom_init_one.isra.1
0000000000000000 l     F .init.text 000000000000075f esb2rom_init_one.isra.1
0000000000000000 l     F .init.text 0000000000000711 ichxrom_init_one.isra.1

Done with the help of Coccinelle.  The semantic patch checks for local
static non-init functions that are called from an __init function and are
not called from any other function.

Note that in each case, the function is stored in the probe field of a
pci_driver structure, but this code is under an #if 0.  The #if 0s have
been unchanged since 2009 at the latest.

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: maps: make uclinux.c driver more explicitly non-modular
Paul Gortmaker [Sun, 27 Mar 2016 16:13:54 +0000 (12:13 -0400)]
mtd: maps: make uclinux.c driver more explicitly non-modular

The Kconfig for this support is currently declared with:

config MTD_UCLINUX
        bool "Generic uClinux RAM/ROM filesystem support"

...meaning that it currently is not being built as a module by anyone.
Lets remove as much of the modular evidence that we can, so that when
reading the driver there is less doubt it is builtin-only.

Since module_init translates to device_initcall in the non-modular
case, the init ordering remains unchanged with this commit.

We also replace module.h with moduleparam.h since the file does use
a module_param,  and leaving it as such is currently the easiest way
to remain compatible with existing boot arg use cases.

We also delete the MODULE_LICENSE tag etc. since all that information
was (or is now) contained at the top of the file in the comments.

Cc: David Woodhouse <dwmw2@infradead.org>
Cc: Greg Ungerer <gerg@snapgear.com>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: nand: implement the default mtd_ooblayout_ops
Boris Brezillon [Wed, 3 Feb 2016 18:06:15 +0000 (19:06 +0100)]
mtd: nand: implement the default mtd_ooblayout_ops

Replace the default nand_ecclayout definitions for large and small page
devices with the equivalent mtd_ooblayout_ops.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
8 years agomtd: docg3: switch to mtd_ooblayout_ops
Boris Brezillon [Wed, 3 Feb 2016 18:05:04 +0000 (19:05 +0100)]
mtd: docg3: switch to mtd_ooblayout_ops

Replace the nand_ecclayout definition by the equivalent mtd_ooblayout_ops
definition.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Acked-by: Robert Jarzmik <robert.jarzmik@free.fr>
8 years agomtd: create an mtd_ooblayout_ops struct to ease ECC layout definition
Boris Brezillon [Wed, 3 Feb 2016 18:01:31 +0000 (19:01 +0100)]
mtd: create an mtd_ooblayout_ops struct to ease ECC layout definition

ECC layout definitions are currently exposed using the nand_ecclayout
struct which embeds oobfree and eccpos arrays with predefined size.
This approach was acceptable when NAND chips were providing relatively
small OOB regions, but MLC and TLC now provide OOB regions of several
hundreds of bytes, which implies a non negligible overhead for everybody
even those who only need to support legacy NANDs.

Create an mtd_ooblayout_ops interface providing the same functionality
(expose the ECC and oobfree layout) without the need for this huge
structure.

The mtd->ecclayout is now deprecated and should be replaced by the
equivalent mtd_ooblayout_ops. In the meantime we provide a wrapper around
the ->ecclayout field to ease migration to this new model.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
8 years agomtd: docg3: use mtd_set_ecclayout() where appropriate
Boris Brezillon [Wed, 3 Feb 2016 19:14:14 +0000 (20:14 +0100)]
mtd: docg3: use mtd_set_ecclayout() where appropriate

Use the mtd_set_ecclayout() helper instead of directly assigning the
mtd->ecclayout field.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Acked-by: Robert Jarzmik <robert.jarzmik@free.fr>
8 years agomtd: onenand: use mtd_set_ecclayout() where appropriate
Boris Brezillon [Wed, 3 Feb 2016 19:14:03 +0000 (20:14 +0100)]
mtd: onenand: use mtd_set_ecclayout() where appropriate

Use the mtd_set_ecclayout() helper instead of directly assigning the
mtd->ecclayout field.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
8 years agomtd: nand: use mtd_set_ecclayout() where appropriate
Boris Brezillon [Wed, 3 Feb 2016 19:13:50 +0000 (20:13 +0100)]
mtd: nand: use mtd_set_ecclayout() where appropriate

Use the mtd_set_ecclayout() helper instead of directly assigning the
mtd->ecclayout field.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
8 years agomtd: use mtd_set_ecclayout() where appropriate
Boris Brezillon [Wed, 3 Feb 2016 19:13:26 +0000 (20:13 +0100)]
mtd: use mtd_set_ecclayout() where appropriate

Use the mtd_set_ecclayout() helper instead of directly assigning the
mtd->ecclayout field.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
8 years agomtd: add mtd_set_ecclayout() helper function
Boris Brezillon [Wed, 3 Feb 2016 17:53:44 +0000 (18:53 +0100)]
mtd: add mtd_set_ecclayout() helper function

Add an mtd_set_ecclayout() helper function to avoid direct accesses to the
mtd->ecclayout field. This will ease future reworks of ECC layout
definition.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
8 years agomtd: onenand: use mtd_ooblayout_xxx() helpers where appropriate
Boris Brezillon [Wed, 3 Feb 2016 19:12:31 +0000 (20:12 +0100)]
mtd: onenand: use mtd_ooblayout_xxx() helpers where appropriate

The mtd_ooblayout_xxx() helper functions have been added to avoid direct
accesses to the ecclayout field, and thus ease for future reworks.
Use these helpers in all places where the oobfree[] and eccpos[] arrays
where directly accessed.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
8 years agomtd: nand: qcom: use mtd_ooblayout_xxx() helpers where appropriate
Boris Brezillon [Fri, 18 Mar 2016 16:53:31 +0000 (17:53 +0100)]
mtd: nand: qcom: use mtd_ooblayout_xxx() helpers where appropriate

The mtd_ooblayout_xxx() helper functions have been added to avoid direct
accesses to ecclayout fields, and thus ease for future reworks.
Use these helpers in all places where the oobfree[] and eccpos[] arrays
where directly accessed.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Tested-by: Archit Taneja <architt@codeaurora.org>
8 years agomtd: nand: omap2: use mtd_ooblayout_xxx() helpers where appropriate
Boris Brezillon [Wed, 3 Feb 2016 19:12:19 +0000 (20:12 +0100)]
mtd: nand: omap2: use mtd_ooblayout_xxx() helpers where appropriate

The mtd_ooblayout_xxx() helper functions have been added to avoid direct
accesses to the ecclayout field, and thus ease for future reworks.
Use these helpers in all places where the oobfree[] and eccpos[] arrays
where directly accessed.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
8 years agomtd: nand: lpc32xx: use mtd_ooblayout_xxx() helpers where appropriate
Boris Brezillon [Wed, 3 Feb 2016 19:12:04 +0000 (20:12 +0100)]
mtd: nand: lpc32xx: use mtd_ooblayout_xxx() helpers where appropriate

The mtd_ooblayout_xxx() helper functions have been added to avoid direct
accesses to the ecclayout field, and thus ease for future reworks.
Use these helpers in all places where the oobfree[] and eccpos[] arrays
where directly accessed.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
8 years agomtd: nand: gpmi: use mtd_ooblayout_xxx() helpers where appropriate
Boris Brezillon [Wed, 3 Feb 2016 19:11:44 +0000 (20:11 +0100)]
mtd: nand: gpmi: use mtd_ooblayout_xxx() helpers where appropriate

The mtd_ooblayout_xxx() helper functions have been added to avoid direct
accesses to the ecclayout field, and thus ease for future reworks.
Use these helpers in all places where the oobfree[] and eccpos[] arrays
where directly accessed.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
8 years agomtd: nand: fsl_ifc: use mtd_ooblayout_xxx() helpers where appropriate
Boris Brezillon [Wed, 3 Feb 2016 19:11:32 +0000 (20:11 +0100)]
mtd: nand: fsl_ifc: use mtd_ooblayout_xxx() helpers where appropriate

The mtd_ooblayout_xxx() helper functions have been added to avoid direct
accesses to the ecclayout field, and thus ease for future reworks.
Use these helpers in all places where the oobfree[] and eccpos[] arrays
where directly accessed.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
8 years agomtd: nand: atmel: use mtd_ooblayout_xxx() helpers where appropriate
Boris Brezillon [Wed, 3 Feb 2016 19:11:14 +0000 (20:11 +0100)]
mtd: nand: atmel: use mtd_ooblayout_xxx() helpers where appropriate

The mtd_ooblayout_xxx() helper functions have been added to avoid direct
accesses to the ecclayout field, and thus ease for future reworks.
Use these helpers in all places where the oobfree[] and eccpos[] arrays
where directly accessed.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Reviewed-by: Nicolas Ferre <nicolas.ferre@atmel.com>
8 years agomtd: nand: core: use mtd_ooblayout_xxx() helpers where appropriate
Boris Brezillon [Wed, 3 Feb 2016 19:11:00 +0000 (20:11 +0100)]
mtd: nand: core: use mtd_ooblayout_xxx() helpers where appropriate

The mtd_ooblayout_xxx() helper functions have been added to avoid direct
accesses to the ecclayout field, and thus ease for future reworks.
Use these helpers in all places where the oobfree[] and eccpos[] arrays
where directly accessed.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
8 years agomtd: use mtd_ooblayout_xxx() helpers where appropriate
Boris Brezillon [Wed, 3 Feb 2016 19:10:30 +0000 (20:10 +0100)]
mtd: use mtd_ooblayout_xxx() helpers where appropriate

The mtd_ooblayout_xxx() helper functions have been added to avoid direct
accesses to the ecclayout field, and thus ease for future reworks.
Use these helpers in all places where the oobfree[] and eccpos[] arrays
where directly accessed.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
8 years agomtd: add mtd_ooblayout_xxx() helper functions
Boris Brezillon [Thu, 4 Feb 2016 08:52:30 +0000 (09:52 +0100)]
mtd: add mtd_ooblayout_xxx() helper functions

In order to make the ecclayout definition completely dynamic we need to
rework the way the OOB layout are defined and iterated.

Create a few mtd_ooblayout_xxx() helpers to ease OOB bytes manipulation
and hide ecclayout internals to their users.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
8 years agomtd: nand: sunxi: make cur_off parameter optional in extra oob helpers
Boris Brezillon [Fri, 4 Mar 2016 17:13:10 +0000 (18:13 +0100)]
mtd: nand: sunxi: make cur_off parameter optional in extra oob helpers

Allow for NULL cur_offs values when the caller does not know where the
NAND page register pointer points to.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
8 years agomtd: nand: sunxi: make OOB retrieval optional
Boris Brezillon [Fri, 4 Mar 2016 17:09:21 +0000 (18:09 +0100)]
mtd: nand: sunxi: make OOB retrieval optional

sunxi_nfc_hw_ecc_read_chunk() always retrieves the ECC and protected free
bytes, no matter if the user really asked for it or not. This can take a
non negligible amount of time, especially on NAND chips exposing large OOB
areas (> 1KB). Make it optional.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
8 years agomtd: nand: sunxi: move some ECC related operations to their own functions
Boris Brezillon [Fri, 4 Mar 2016 16:56:47 +0000 (17:56 +0100)]
mtd: nand: sunxi: move some ECC related operations to their own functions

In order to support DMA operations in a clean way we need to extract some
of the logic coded in sunxi_nfc_hw_ecc_read/write_page() into their own
function.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
8 years agomtd: nand: sunxi: poll for events instead of using interrupts
Boris Brezillon [Mon, 7 Mar 2016 14:34:39 +0000 (15:34 +0100)]
mtd: nand: sunxi: poll for events instead of using interrupts

Some NAND operations are so fast that it doesn't make any sense to use
interrupt based waits (the scheduling overhead is not worth it).
Rename sunxi_nfc_wait_int() into sunxi_nfc_wait_events() and add a
parameter to specify whether polling should be used or not.

Note that all sunxi_nfc_wait_int() are moved to the polling approach now,
but this should change as soon as we have more information about the
approximate time we are about to wait (can be extracted from the NAND
timings, and the type of operation).

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
8 years agomtd: nand: sunxi: make use of readl_poll_timeout()
Boris Brezillon [Mon, 7 Mar 2016 14:25:17 +0000 (15:25 +0100)]
mtd: nand: sunxi: make use of readl_poll_timeout()

Replace open coded polling loops by readl_poll_timeout() calls.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
8 years agomtd: nand: sunxi: fix ->dev_ready() implementation
Boris Brezillon [Mon, 7 Mar 2016 14:10:28 +0000 (15:10 +0100)]
mtd: nand: sunxi: fix ->dev_ready() implementation

->dev_ready() is not supposed to wait for busy to ready solution (this is
the role of ->waitfunc()).

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
8 years agomtd: nand: enable ECC pipelining
Boris Brezillon [Fri, 4 Mar 2016 16:33:10 +0000 (17:33 +0100)]
mtd: nand: enable ECC pipelining

When the NAND controller operates in DMA mode it can pipeline ECC
operations which improves the throughput.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
8 years agomtd: nand: sunxi: disable clks on device removal
Boris Brezillon [Fri, 4 Mar 2016 17:26:40 +0000 (18:26 +0100)]
mtd: nand: sunxi: disable clks on device removal

mod and ahb clocks are not disabled when the NAND controller device is
removed.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>