platform/kernel/linux-starfive.git
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: 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>
8 years agomtd: nand: sunxi: fix NFC_CTL setting
Boris Brezillon [Fri, 4 Mar 2016 16:29:20 +0000 (17:29 +0100)]
mtd: nand: sunxi: fix NFC_CTL setting

NFC_PAGE_SHIFT() already takes the real page_shift value and subtract 10
to it.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
8 years agomtd: nand: sunxi: fix the NFC_ECC_ERR_CNT() macro
Boris Brezillon [Fri, 4 Mar 2016 16:25:08 +0000 (17:25 +0100)]
mtd: nand: sunxi: fix the NFC_ECC_ERR_CNT() macro

NFC_ECC_ERR_CNT() is not taking into account the case when the NAND chip
contains more than 4 ECC blocks (NANDs with 4kB+ pages).

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
8 years agomtd: nand: sunxi: let the NAND controller control the CE line
Boris Brezillon [Fri, 4 Mar 2016 16:21:35 +0000 (17:21 +0100)]
mtd: nand: sunxi: let the NAND controller control the CE line

We don't need to manually toggle the CE line since the controller handles
it for us. Moreover, keeping the CE line low when interacting with a DDR
NAND can be problematic (data loss in some corner cases).

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
8 years agomtd: nand: sunxi: improve ->cmd_ctrl() function
Boris Brezillon [Wed, 16 Sep 2015 07:05:31 +0000 (09:05 +0200)]
mtd: nand: sunxi: improve ->cmd_ctrl() function

Try to pack address and command cycles into a single NAND controller
command to avoid polling the status register for each single change
on the NAND bus.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
8 years agomtd: nand: sunxi: implement ->read_subpage()
Boris Brezillon [Wed, 16 Sep 2015 07:01:45 +0000 (09:01 +0200)]
mtd: nand: sunxi: implement ->read_subpage()

Being able to read subpages can greatly improve read performances if the
MTD user is only interested in a small section of a NAND page.
This is particularly true with large pages (>= 8k).

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
8 years agomtd: nand: sunxi: implement ->read_oob()/->write_oob()
Boris Brezillon [Wed, 2 Sep 2015 13:05:52 +0000 (15:05 +0200)]
mtd: nand: sunxi: implement ->read_oob()/->write_oob()

Allwinner's ECC engine is capable of protecting a few bytes of the OOB
area. Implement specific OOB functions to benefit from this capability.

Also, when in raw mode, the randomizer is disabled, which means you'll
only be able to retrieve randomized data, which is not really useful
for most applications.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
8 years agomtd: nand: export default read/write oob functions
Boris Brezillon [Wed, 26 Aug 2015 14:08:12 +0000 (16:08 +0200)]
mtd: nand: export default read/write oob functions

Export the default read/write oob functions (for the standard and syndrome
scheme), so that drivers can use them for their raw implementation and
implement their own functions for the normal oob operation.

This is required if your ECC engine is capable of fixing some of the OOB
data. In this case you have to overload the ->read_oob() and ->write_oob(),
but if you don't specify the ->read/write_oob_raw() functions they are
assigned to the ->read/write_oob() implementation, which is not what you
want.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
8 years agomtd: nand: sunxi: adapt clk_rate to tWB, tADL, tWHR and tRHW timings
Boris Brezillon [Wed, 11 Nov 2015 21:30:30 +0000 (22:30 +0100)]
mtd: nand: sunxi: adapt clk_rate to tWB, tADL, tWHR and tRHW timings

Adapt the NAND controller clk rate to the tWB, tADL, tWHR and tRHW
timings instead of returning an error when the maximum clk divisor is
not big enough to provide an appropriate timing.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
8 years agomtd: nand: sunxi: fix EDO mode selection
Boris Brezillon [Wed, 2 Dec 2015 14:57:20 +0000 (15:57 +0100)]
mtd: nand: sunxi: fix EDO mode selection

The ONFI spec says that EDO should be enabled if the host drives tRC less
than 30ns, but the code just tests for the tRC_min value extracted from
the timings exposed by the NAND chip not the timings actually configured
in the NAND controller.
Fix that by first rounding down the requested clk_rate with
clk_round_rate() and then checking if tRC is actually smaller than 30ns.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
8 years agomtd: nand: sunxi: fix clk rate calculation
Boris Brezillon [Wed, 2 Dec 2015 14:10:40 +0000 (15:10 +0100)]
mtd: nand: sunxi: fix clk rate calculation

Unlike what is specified in the Allwinner datasheets, the NAND clock rate
is not equal to 2/T but 1/T. Fix the clock rate selection accordingly.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
8 years agomtd: nand: sunxi: fix call order in sunxi_nand_chip_init()
Boris Brezillon [Wed, 2 Dec 2015 15:00:57 +0000 (16:00 +0100)]
mtd: nand: sunxi: fix call order in sunxi_nand_chip_init()

sunxi_nand_chip_set_timings() is extracting a pointer to the nfc from the
nand->controller field, but this field is initialized after
sunxi_nand_chip_set_timings() call.
Reorder the calls to avoid any problem.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
8 years agomtd: nand: pxa3xx: rely on generic DT parsing done in nand_scan_ident()
Boris Brezillon [Fri, 1 Apr 2016 12:54:30 +0000 (14:54 +0200)]
mtd: nand: pxa3xx: 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: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
8 years agomtd: nand: atmel: rely on generic DT parsing done in nand_scan_ident()
Boris Brezillon [Fri, 1 Apr 2016 12:54:22 +0000 (14:54 +0200)]
mtd: nand: atmel: 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>
Tested-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Reviewed-by: Nicolas Ferre <nicolas.ferre@atmel.com>
8 years agomtd: nand: pasemi: switch to dev_* printing functions
Rafał Miłecki [Wed, 13 Apr 2016 09:48:05 +0000 (11:48 +0200)]
mtd: nand: pasemi: switch to dev_* printing functions

It also contains some minor related changes:
1) Don't warn if kzalloc fails as it dumps stack on its own
2) Use %pR format for displaying whole resource to avoid invalid format
   warning

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
8 years agomtd: nand: socrates: set ECC algorithm explicitly
Rafał Miłecki [Fri, 8 Apr 2016 10:23:51 +0000 (12:23 +0200)]
mtd: nand: socrates: 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: plat: set ECC algorithm explicitly
Rafał Miłecki [Fri, 8 Apr 2016 10:23:50 +0000 (12:23 +0200)]
mtd: nand: plat: 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: pasemi: set ECC algorithm explicitly
Rafał Miłecki [Fri, 8 Apr 2016 10:23:49 +0000 (12:23 +0200)]
mtd: nand: pasemi: 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: orion: set ECC algorithm explicitly
Rafał Miłecki [Fri, 8 Apr 2016 10:23:48 +0000 (12:23 +0200)]
mtd: nand: orion: 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: nuc900: set ECC algorithm explicitly
Rafał Miłecki [Fri, 8 Apr 2016 10:23:47 +0000 (12:23 +0200)]
mtd: nand: nuc900: 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: mxc: set ECC algorithm explicitly
Rafał Miłecki [Fri, 8 Apr 2016 10:23:46 +0000 (12:23 +0200)]
mtd: nand: mxc: 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: gpio: set ECC algorithm explicitly
Rafał Miłecki [Fri, 8 Apr 2016 10:23:45 +0000 (12:23 +0200)]
mtd: nand: gpio: 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: ams-delta: set ECC algorithm explicitly
Rafał Miłecki [Fri, 8 Apr 2016 10:23:44 +0000 (12:23 +0200)]
mtd: nand: ams-delta: 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: brcm: rely on generic DT parsing done in nand_scan_ident()
Boris Brezillon [Fri, 1 Apr 2016 12:54:24 +0000 (14:54 +0200)]
mtd: nand: brcm: 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: Brian Norris <computersforpeace@gmail.com>
8 years agomtd: nand: omap2: rely on generic DT parsing done in nand_scan_ident()
Boris Brezillon [Tue, 19 Apr 2016 18:29:58 +0000 (20:29 +0200)]
mtd: nand: omap2: 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: Roger Quadros <rogerq@ti.com>
Tested-by: Franklin S Cooper Jr. <fcooper@ti.com>
8 years agomtd: nand: remove unneeded of_mtd.h inclusions
Boris Brezillon [Fri, 1 Apr 2016 12:54:21 +0000 (14:54 +0200)]
mtd: nand: remove unneeded of_mtd.h inclusions

Some drivers are including linux/of_mtd.h even if they don't use any of
the of_get_nand_xxx() helpers.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Acked-by: Harvey Hunt <harvey.hunt@imgtec.com>
8 years agomtd: nand: s3c2410: fix bug in s3c2410_nand_correct_data()
Zhaoxiu Zeng [Tue, 12 Apr 2016 07:30:35 +0000 (15:30 +0800)]
mtd: nand: s3c2410: fix bug in s3c2410_nand_correct_data()

If there is only one bit difference in the ECC, the function should
return 1.
The result of "diff0 & ~(1<<fls(diff0))" is equal to diff0, so the
function actually returns -1.

Signed-off-by: Zhaoxiu Zeng <zhaoxiu.zeng@gmail.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
8 years agomtd/ifc: Add support for IFC controller version 2.0
Raghav Dogra [Wed, 17 Feb 2016 11:24:18 +0000 (16:54 +0530)]
mtd/ifc: Add support for IFC controller version 2.0

The new IFC controller version 2.0 has a different memory map page.
Upto IFC 1.4 PAGE size is 4 KB and from IFC2.0 PAGE size is 64KB.
This patch segregates the IFC global and runtime registers to appropriate
PAGE sizes.

Signed-off-by: Jaiprakash Singh <b44839@freescale.com>
Signed-off-by: Raghav Dogra <raghav@freescale.com>
Acked-by: Li Yang <leoyang.li@nxp.com>
Signed-off-by: Raghav Dogra <raghav.dogra@nxp.com>
Acked-by: Scott Wood <oss@buserror.net>
Acked-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
8 years agomtd: nand: Remove BUG() abuse in nand_scan_tail
Ezequiel García [Fri, 1 Apr 2016 21:29:24 +0000 (18:29 -0300)]
mtd: nand: Remove BUG() abuse in nand_scan_tail

There's no reason to BUG() when parameters are being
validated. Drivers can get things wrong, and it's much nicer
to just throw a noisy warn and fail gracefully, than calling
BUG() and throwing the whole system down the drain.

Signed-off-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
Reviewed-by: Richard Weinberger <richard@nod.at>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
8 years agomtd: gpmi: fix raw_buffer pointer double free issue
Han Xu [Mon, 4 Apr 2016 20:41:29 +0000 (15:41 -0500)]
mtd: gpmi: fix raw_buffer pointer double free issue

fix the raw_buffer pointer double free issue found by coverify.

CID 18344 (#2 of 2): Double free (USE_AFTER_FREE)
3. double_free: Calling gpmi_alloc_dma_buffer frees pointer
this->raw_buffer which has already been freed

Signed-off-by: Han Xu <han.xu@nxp.com>
Reviewed-by: Richard Weinberger <richard@nod.at>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
8 years agomtd: brcmnand: Add support for v6.2 controllers
Florian Fainelli [Thu, 10 Mar 2016 23:34:16 +0000 (15:34 -0800)]
mtd: brcmnand: Add support for v6.2 controllers

Document and match the brcm,brcmnand-v6.2 compatible string, the controller has
a register layout identical to the v6.0 version and supports prefetch. Update the
command shift logic to account for v6.2 controller which are the first ones to
use a shift of 0 (6.1 used a shift of 24).

Signed-off-by: Kamal Dasu <kdasu.kdev@gmail.com>
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Acked-by: Rob Herring <robh@kernel.org>
Acked-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
8 years agomtd: nand: document the NAND controller/NAND chip DT representation
Boris Brezillon [Fri, 1 Apr 2016 12:26:35 +0000 (14:26 +0200)]
mtd: nand: document the NAND controller/NAND chip DT representation

Standardize the NAND controller/NAND chip DT representation. Now, all new
NAND controller drivers should comply with this representation, even if
they are only supporting a single NAND chip.

Existing drivers can keep support for the old representation (where only
the NAND chip was described), but are encouraged to also support the new
one.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Acked-by: Brian Norris <computersforpeace@gmail.com>
Acked-by: Rob Herring <robh@kernel.org>
8 years agomtd: nand: jz4780: fixup, device structure assigned at probe
Jorge Ramirez-Ortiz [Thu, 24 Mar 2016 01:53:27 +0000 (21:53 -0400)]
mtd: nand: jz4780: fixup, device structure assigned at probe

bch->dev is already assigned to &pdev->dev in the probe function.
Remove the duplicate assignment done in jz4780_bch_get().

Signed-off-by: Jorge Ramirez-Ortiz <jorge.ramirez-ortiz@linaro.org>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Acked-by: Acked-by: Harvey Hunt <harvey.hunt@imgtec.com>
8 years agomtd: nand: atmel: correct bitflips in erased pages for pre-sama5d4 SoCs
Boris Brezillon [Tue, 1 Mar 2016 13:11:52 +0000 (14:11 +0100)]
mtd: nand: atmel: correct bitflips in erased pages for pre-sama5d4 SoCs

New atmel SoCs are able to fix bitflips in erased pages, but old ones
are still impacted by this problem. Use nand_check_erased_ecc_chunk() to
handle this case.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Reported-by: Herve Codina <herve.CODINA@celad.com>
Reviewed-by: Herve Codina <herve.CODINA@celad.com>
Tested-by: Herve Codina <herve.CODINA@celad.com>
8 years agomtd: nand: nandsim: set ECC algorithm explicitly
Rafał Miłecki [Wed, 23 Mar 2016 10:19:03 +0000 (11:19 +0100)]
mtd: nand: nandsim: set ECC algorithm explicitly

This follows recent work on switching to enum nand_ecc_algo and
deprecating 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 in nand_dt_init
Rafał Miłecki [Wed, 23 Mar 2016 10:19:02 +0000 (11:19 +0100)]
mtd: nand: set ECC algorithm in nand_dt_init

Use recently added of_get_nand_ecc_algo for that.

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
8 years agoof: mtd: prepare helper reading NAND ECC algo from DT
Rafał Miłecki [Wed, 23 Mar 2016 10:19:01 +0000 (11:19 +0100)]
of: mtd: prepare helper reading NAND ECC algo from DT

NAND subsystem is being slightly reworked to store ECC details in
separated fields. In future we'll want to add support for more DT
properties as specifying every possible setup with a single
"nand-ecc-mode" is a pretty bad idea.
To allow this let's add a helper that will support something like
"nand-ecc-algo" in future. Right now we use it for keeping backward
compatibility.

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
8 years agomtd: nand: add new enum for storing ECC algorithm
Rafał Miłecki [Wed, 23 Mar 2016 10:19:00 +0000 (11:19 +0100)]
mtd: nand: add new enum for storing ECC algorithm

Our nand_ecc_modes_t is already a bit abused by value NAND_ECC_SOFT_BCH.
This enum should store ECC mode only and putting algorithm details there
is a bad idea. It would result in too many values impossible to support
in a sane way.

To solve this problem let's add a new enum. We'll have to modify all
drivers to set it properly but once it's done it'll be possible to drop
NAND_ECC_SOFT_BCH. That will result in a cleaner design and more
possibilities like setting ECC algorithm for hardware ECC mode.

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
8 years agoMerge branch 'mtd-nand-trigger' of git://git.kernel.org/pub/scm/linux/kernel/git...
Boris Brezillon [Tue, 19 Apr 2016 19:44:11 +0000 (21:44 +0200)]
Merge branch 'mtd-nand-trigger' of git://git./linux/kernel/git/j.anaszewski/linux-leds into nand/next

Pull leds-trigger changes from Jacek Anaszewski.
Create a generic mtd led-trigger to replace the exisitng nand led-trigger
implementation.

* 'mtd-nand-trigger' of git://git.kernel.org/pub/scm/linux/kernel/git/j.anaszewski/linux-leds:
  mtd: Hook I/O activity to the MTD LED trigger
  mtd: nand: Remove the "nand-disk" LED trigger
  leds: trigger: Introduce a MTD (NAND/NOR) trigger
  mtd: Uninline mtd_write_oob and move it to mtdcore.c
  leds: trigger: Introduce a kernel panic LED trigger

8 years agoMerge branch 'for-v4.7/gpmc-mtd-common' of github.com:rogerq/linux into nand/next
Boris Brezillon [Tue, 19 Apr 2016 19:39:22 +0000 (21:39 +0200)]
Merge branch 'for-v4.7/gpmc-mtd-common' of github.com:rogerq/linux into nand/next

Pull NAND/GPMC updates from Roger Quadros:
 "We do a couple of things in this series which result in cleaner device
  tree implementation, faster perfomance and multi-platform support. As
  an added bonus we get to use the GPMC_WAIT pins as GPI/Interrupts.

  - Establish a custom interface between NAND and GPMC driver. This is
    needed because all of the NAND registers sit in the GPMC register
    space.

  - Clean up device tree support so that omap-gpmc IP and the omap2 NAND
    driver can be used on non-OMAP platforms. e.g. Keystone.

  - Implement GPIOCHIP for the GPMC WAITPINS. SoCs can contain 2 to 4 of
    these and most of them would be unused otherwise. It also allows a
    cleaner implementation of NAND Ready pin status for the NAND driver.

  - Implement GPMC IRQ domain to proivde the 2 NAND events and GPMC
    WAITPIN edge interrupts.

  - Implement GPIOlib based NAND ready pin checking for OMAP NAND driver.
    On dra7-evm, Read speed increases from 13768 KiB/ to 17246 KiB/s.
    Write speed was unchanged at 7123 KiB/s."

* 'for-v4.7/gpmc-mtd-common' of github.com:rogerq/linux:
  mtd: nand: omap2: Implement NAND ready using gpiolib
  memory: omap-gpmc: Prevent GPMC_STATUS from being accessed via gpmc_regs
  memory: omap-gpmc: Support WAIT pin edge interrupts
  memory: omap-gpmc: Reserve WAITPIN if needed for WAIT monitoring
  memory: omap-gpmc: Support general purpose input for WAITPINs
  memory: omap-gpmc: Move device tree binding to correct location
  memory: omap-gpmc: Prevent mapping into 1st 16MB
  mtd: nand: omap: Update DT binding documentation
  mtd: nand: omap: Clean up device tree support
  mtd: nand: omap: Copy platform data parameters to omap_nand_info data
  mtd: nand: omap: Switch to using GPMC-NAND ops for writebuffer empty check
  mtd: nand: omap: Use gpmc_omap_get_nand_ops() to get NAND registers
  memory: omap-gpmc: Implement IRQ domain for NAND IRQs
  memory: omap-gpmc: Add GPMC-NAND ops to get writebufferempty status
  memory: omap-gpmc: Introduce GPMC to NAND interface
  ARM: OMAP2+: gpmc: Add gpmc timings and settings to platform data
  ARM: OMAP2+: gpmc: Add platform data

8 years agomtd: nand: omap2: Implement NAND ready using gpiolib
Roger Quadros [Thu, 6 Aug 2015 14:39:35 +0000 (17:39 +0300)]
mtd: nand: omap2: Implement NAND ready using gpiolib

The GPMC WAIT pin status are now available over gpiolib.
Update the omap_dev_ready() function to use gpio instead of
directly accessing GPMC register space.

Signed-off-by: Roger Quadros <rogerq@ti.com>
Acked-by: Brian Norris <computersforpeace@gmail.com>
Acked-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Acked-by: Tony Lindgren <tony@atomide.com>
8 years agomemory: omap-gpmc: Prevent GPMC_STATUS from being accessed via gpmc_regs
Roger Quadros [Fri, 7 Aug 2015 07:38:13 +0000 (10:38 +0300)]
memory: omap-gpmc: Prevent GPMC_STATUS from being accessed via gpmc_regs

GPMC_STATUS register is private to the GPMC module and must not be
accessed directly by NAND driver through the gpmc_regs.

They must use gpmc_omap_get_nand_ops() instead.

Signed-off-by: Roger Quadros <rogerq@ti.com>
Acked-by: Tony Lindgren <tony@atomide.com>
8 years agomemory: omap-gpmc: Support WAIT pin edge interrupts
Roger Quadros [Fri, 19 Feb 2016 09:01:02 +0000 (11:01 +0200)]
memory: omap-gpmc: Support WAIT pin edge interrupts

OMAPs can have 2 to 4 WAITPINs that can be used as edge triggered
interrupts if not used for memory wait state insertion.

Support these interrupts via the gpmc IRQ domain.

The gpmc IRQ domain interrupt map is:

0 - NAND_fifoevent
1 - NAND_termcount
2 - GPMC_WAIT0 edge
3 - GPMC_WAIT1 edge, and so on

Signed-off-by: Roger Quadros <rogerq@ti.com>
Acked-by: Rob Herring <robh@kernel.org>
Acked-by: Tony Lindgren <tony@atomide.com>
8 years agomemory: omap-gpmc: Reserve WAITPIN if needed for WAIT monitoring
Roger Quadros [Thu, 6 Aug 2015 10:21:40 +0000 (13:21 +0300)]
memory: omap-gpmc: Reserve WAITPIN if needed for WAIT monitoring

If the device attached to GPMC wants to use the WAIT pin
for WAIT monitoring then we reserve it internally for
exclusive use.

Signed-off-by: Roger Quadros <rogerq@ti.com>
Acked-by: Tony Lindgren <tony@atomide.com>
8 years agomemory: omap-gpmc: Support general purpose input for WAITPINs
Roger Quadros [Mon, 7 Mar 2016 10:18:43 +0000 (12:18 +0200)]
memory: omap-gpmc: Support general purpose input for WAITPINs

OMAPs can have 2 to 4 WAITPINs that can be used as general purpose
input if not used for memory wait state insertion.

The first user will be the OMAP NAND chip to get the NAND
read/busy status using gpiolib.

Signed-off-by: Roger Quadros <rogerq@ti.com>
Acked-by: Rob Herring <robh@kernel.org>
Acked-by: Tony Lindgren <tony@atomide.com>
8 years agomemory: omap-gpmc: Move device tree binding to correct location
Roger Quadros [Wed, 5 Aug 2015 14:01:54 +0000 (17:01 +0300)]
memory: omap-gpmc: Move device tree binding to correct location

omap-gpmc.c is a memory controller so move the binding to the
right place.

Signed-off-by: Roger Quadros <rogerq@ti.com>
Acked-by: Rob Herring <robh@kernel.org>
Acked-by: Tony Lindgren <tony@atomide.com>
8 years agomemory: omap-gpmc: Prevent mapping into 1st 16MB
Roger Quadros [Thu, 9 Jul 2015 14:31:45 +0000 (17:31 +0300)]
memory: omap-gpmc: Prevent mapping into 1st 16MB

We have been preventing mapping GPMC children in the
first 1MB but really it has to be the first 16MB as
the minimum GPMC partition size is 16MB.

Also print an error message if CS mapping fails
due to DT requesting address outside the GPMC
map.

Signed-off-by: Roger Quadros <rogerq@ti.com>
Acked-by: Tony Lindgren <tony@atomide.com>
8 years agomtd: nand: omap: Update DT binding documentation
Roger Quadros [Mon, 26 May 2014 08:54:45 +0000 (11:54 +0300)]
mtd: nand: omap: Update DT binding documentation

Add compatible id and interrupts. The NAND interrupts are
provided by the GPMC controller node.

Signed-off-by: Roger Quadros <rogerq@ti.com>
Acked-by: Rob Herring <robh@kernel.org>
Acked-by: Brian Norris <computersforpeace@gmail.com>
Acked-by: Tony Lindgren <tony@atomide.com>
8 years agomtd: nand: omap: Clean up device tree support
Roger Quadros [Wed, 21 May 2014 04:29:03 +0000 (07:29 +0300)]
mtd: nand: omap: Clean up device tree support

Move NAND specific device tree parsing to NAND driver.

The NAND controller node must have a compatible id, register space
resource and interrupt resource.

Signed-off-by: Roger Quadros <rogerq@ti.com>
Acked-by: Brian Norris <computersforpeace@gmail.com>
Acked-by: Tony Lindgren <tony@atomide.com>
8 years agomtd: nand: omap: Copy platform data parameters to omap_nand_info data
Roger Quadros [Tue, 20 May 2014 19:29:28 +0000 (22:29 +0300)]
mtd: nand: omap: Copy platform data parameters to omap_nand_info data

Copy all the platform data parameters to the driver's local data
structure 'omap_nand_info' and use it in the entire driver. This will
make it easer for device tree migration.

Signed-off-by: Roger Quadros <rogerq@ti.com>
Acked-by: Brian Norris <computersforpeace@gmail.com>
Acked-by: Tony Lindgren <tony@atomide.com>
8 years agomtd: nand: omap: Switch to using GPMC-NAND ops for writebuffer empty check
Roger Quadros [Wed, 5 Aug 2015 10:36:43 +0000 (13:36 +0300)]
mtd: nand: omap: Switch to using GPMC-NAND ops for writebuffer empty check

Instead of accessing the gpmc_status register directly start
using the gpmc_nand_ops->nand_writebuffer_empty() helper
to check write buffer empty status.

Signed-off-by: Roger Quadros <rogerq@ti.com>
Acked-by: Brian Norris <computersforpeace@gmail.com>
Acked-by: Tony Lindgren <tony@atomide.com>
8 years agomtd: nand: omap: Use gpmc_omap_get_nand_ops() to get NAND registers
Roger Quadros [Wed, 5 Aug 2015 11:01:50 +0000 (14:01 +0300)]
mtd: nand: omap: Use gpmc_omap_get_nand_ops() to get NAND registers

Deprecate nand register passing via platform data and use
gpmc_omap_get_nand_ops() instead.

Signed-off-by: Roger Quadros <rogerq@ti.com>
Acked-by: Brian Norris <computersforpeace@gmail.com>
Acked-by: Tony Lindgren <tony@atomide.com>
8 years agomemory: omap-gpmc: Implement IRQ domain for NAND IRQs
Roger Quadros [Thu, 30 Jul 2015 11:49:23 +0000 (14:49 +0300)]
memory: omap-gpmc: Implement IRQ domain for NAND IRQs

GPMC provides 2 interrupts for NAND use. i.e. fifoevent and termcount.
Use IRQ domain for this. NAND device tree node can then
get the necessary interrupts by using gpmc as the interrupt parent.

Legacy boot uses gpmc_get_client_irq to get the
NAND interrupts from the GPMC IRQ domain.
Get rid of custom bitmasks and use IRQ domain for that
as well.

Signed-off-by: Roger Quadros <rogerq@ti.com>
Acked-by: Rob Herring <robh@kernel.org>
Acked-by: Tony Lindgren <tony@atomide.com>
8 years agomemory: omap-gpmc: Add GPMC-NAND ops to get writebufferempty status
Roger Quadros [Wed, 5 Aug 2015 10:34:50 +0000 (13:34 +0300)]
memory: omap-gpmc: Add GPMC-NAND ops to get writebufferempty status

This is needed by OMAP NAND driver to poll the empty status
of the writebuffer.

Signed-off-by: Roger Quadros <rogerq@ti.com>
Acked-by: Tony Lindgren <tony@atomide.com>
8 years agomemory: omap-gpmc: Introduce GPMC to NAND interface
Roger Quadros [Wed, 5 Aug 2015 10:58:01 +0000 (13:58 +0300)]
memory: omap-gpmc: Introduce GPMC to NAND interface

The OMAP GPMC module has certain registers dedicated for NAND
access and some NAND bits mixed with other GPMC functionality.

For the NAND dedicated registers we have the struct gpmc_nand_regs.

The NAND driver needs to access NAND specific bits from the
following non-dedicated registers
- EMPTYWRITEBUFFERSTATUS from GPMC_STATUS

For accessing these bits we introduce the struct gpmc_nand_ops.

Add gpmc_omap_get_nand_ops() that returns the gpmc_nand_ops along
with updating the gpmc_nand_regs. This API will be called by the
OMAP NAND driver to access the necessary bits in GPMC register space.

Signed-off-by: Roger Quadros <rogerq@ti.com>
Acked-by: Tony Lindgren <tony@atomide.com>
8 years agoARM: OMAP2+: gpmc: Add gpmc timings and settings to platform data
Roger Quadros [Fri, 10 Jul 2015 12:23:29 +0000 (15:23 +0300)]
ARM: OMAP2+: gpmc: Add gpmc timings and settings to platform data

Add device_timings, gpmc_timings and gpmc_setting to
gpmc platform data.

Signed-off-by: Roger Quadros <rogerq@ti.com>
Acked-by: Tony Lindgren <tony@atomide.com>
8 years agoARM: OMAP2+: gpmc: Add platform data
Roger Quadros [Fri, 10 Jul 2015 12:23:28 +0000 (15:23 +0300)]
ARM: OMAP2+: gpmc: Add platform data

Add a platform data structure for GPMC. It contains all the necessary
platform information that needs to be passed from platform init code
to GPMC driver.

Signed-off-by: Roger Quadros <rogerq@ti.com>
Acked-by: Tony Lindgren <tony@atomide.com>
8 years agomtd: Hook I/O activity to the MTD LED trigger
Ezequiel Garcia [Tue, 12 Apr 2016 20:46:42 +0000 (17:46 -0300)]
mtd: Hook I/O activity to the MTD LED trigger

Now that we've added the MTD LED trigger, we need
to call each I/O path to ledtrig_mtd_activity.

Signed-off-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
Acked-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
8 years agomtd: nand: Remove the "nand-disk" LED trigger
Ezequiel Garcia [Tue, 12 Apr 2016 20:46:41 +0000 (17:46 -0300)]
mtd: nand: Remove the "nand-disk" LED trigger

This commit removes the "nand-disk" LED trigger from the
NAND code.

A trigger with the same name is already available selecting
LEDS_TRIGGER_MTD. Note that "nand-disk" trigger is being
deprecated in favor of the "mtd" trigger.

Signed-off-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
Acked-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
8 years agoleds: trigger: Introduce a MTD (NAND/NOR) trigger
Ezequiel Garcia [Tue, 12 Apr 2016 20:46:40 +0000 (17:46 -0300)]
leds: trigger: Introduce a MTD (NAND/NOR) trigger

This commit introduces a MTD trigger for flash (NAND/NOR) device
activity. The implementation is copied from IDE disk.

This trigger deprecates the "nand-disk" LED trigger, but for backwards
compatibility, we still keep the "nand-disk" trigger around.

The motivation for deprecating the "nand-disk" LED trigger is that
it only works for NAND drivers, whereas the "mtd" LED trigger
is more generic (in fact, "nand-disk" currently only works for
certain NAND drivers).

Signed-off-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
Acked-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
8 years agomtd: Uninline mtd_write_oob and move it to mtdcore.c
Ezequiel Garcia [Tue, 12 Apr 2016 20:46:39 +0000 (17:46 -0300)]
mtd: Uninline mtd_write_oob and move it to mtdcore.c

There's no reason for having mtd_write_oob inlined in mtd.h header.
Move it to mtdcore.c where it belongs.

Signed-off-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
Acked-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
8 years agoleds: trigger: Introduce a kernel panic LED trigger
Ezequiel Garcia [Tue, 29 Mar 2016 20:35:47 +0000 (17:35 -0300)]
leds: trigger: Introduce a kernel panic LED trigger

This commit introduces a new LED trigger which allows to configure
a LED to blink on a kernel panic (through panic_blink).

Notice that currently the Openmoko FreeRunner (GTA02) mach code
sets panic_blink to blink a hard-coded LED. The new trigger is
meant to introduce a generic mechanism to achieve this.

Signed-off-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
8 years agoLinux 4.6-rc1
Linus Torvalds [Sat, 26 Mar 2016 23:03:24 +0000 (16:03 -0700)]
Linux 4.6-rc1