linux-2.6-block.git
6 years agoMerge tag 'nand/for-4.16' of git://git.infradead.org/linux-mtd into mtd/next
Boris Brezillon [Mon, 29 Jan 2018 08:58:36 +0000 (09:58 +0100)]
Merge tag 'nand/for-4.16' of git://git.infradead.org/linux-mtd into mtd/next

Pull NAND changes from Boris Brezillon:

"
  Core changes:
  * Fix NAND_CMD_NONE handling in nand_command[_lp]() hooks
  * Introduce the ->exec_op() infrastructure
  * Rework NAND buffers handling
  * Fix ECC requirements for K9F4G08U0D
  * Fix nand_do_read_oob() to return the number of bitflips
  * Mark K9F1G08U0E as not supporting subpage writes

  Driver changes:
  * MTK: Rework the driver to support new IP versions
  * OMAP OneNAND: Full rework to use new APIs (libgpio, dmaengine) and fix
    DT support
  * Marvell: Add a new driver to replace the pxa3xx one
"

6 years agoMerge tag 'spi-nor/for-4.16' of git://git.infradead.org/linux-mtd into mtd/next
Boris Brezillon [Mon, 29 Jan 2018 08:55:14 +0000 (09:55 +0100)]
Merge tag 'spi-nor/for-4.16' of git://git.infradead.org/linux-mtd into mtd/next

Pull spi-nor changes from Cyrille Pitchen:

"
  This pull-request contains the following notable changes:

  Core changes:
  * Add support to new ISSI and Cypress/Spansion memory parts.
  * Fix support of Micron memories by checking error bits in the FSR.
  * Fix update of block-protection bits by reading back the SR.
  * Restore the internal state of the SPI flash memory when removing the
    device.

  Driver changes:
  * Maintenance for Freescale, Intel and Metiatek drivers.
  * Add support of the direct access mode for the Cadence QSPI controller.
"

6 years agomtd: nand: sunxi: Fix ECC strength choice
Miquel Raynal [Wed, 24 Jan 2018 22:49:31 +0000 (23:49 +0100)]
mtd: nand: sunxi: Fix ECC strength choice

When the requested ECC strength does not exactly match the strengths
supported by the ECC engine, the driver is selecting the closest
strength meeting the 'selected_strength > requested_strength'
constraint. Fix the fact that, in this particular case, ecc->strength
value was not updated to match the 'selected_strength'.

For instance, one can encounter this issue when no ECC requirement is
filled in the device tree while the NAND chip minimum requirement is not
a strength/step_size combo natively supported by the ECC engine.

Fixes: 1fef62c1423b ("mtd: nand: add sunxi NAND flash controller support")
Cc: <stable@vger.kernel.org>
Suggested-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Miquel Raynal <miquel.raynal@free-electrons.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
6 years agomtd: nand: gpmi: Fix subpage reads
Boris Brezillon [Tue, 23 Jan 2018 10:13:17 +0000 (11:13 +0100)]
mtd: nand: gpmi: Fix subpage reads

Commit 25f815f66a14 ("mtd: nand: force drivers to explicitly send
READ/PROG commands") added a call to nand_read_page_op() in
gpmi_ecc_read_page(), which means this function now sends a READ0
command and place the data pointer at the beginning of the page. This
logic is breaking gpmi_ecc_read_subpage() which was calling
gpmi_ecc_read_page() and expected it to only retrieve the data without
sending the READ0 command.

Create a gpmi_ecc_read_page_data() helper which only does the data
retrieval and ECC correction steps and implement gpmi_ecc_read_page()
as a wrapper that calls nand_read_page_op()+gpmi_ecc_read_page_data().

This way, gpmi_ecc_read_subpage() can call gpmi_ecc_read_page_data()
which restores the logic we had before commit 25f815f66a14 ("mtd: nand:
force drivers to explicitly send READ/PROG commands").

Fixes: 25f815f66a14 ("mtd: nand: force drivers to explicitly send READ/PROG commands")
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Reviewed-by: Miquel Raynal <miquel.raynal@free-electrons.com>
Acked-by: Han Xu <han.xu@nxp.com>
6 years agomtd: nand: Fix build issues due to an anonymous union
Miquel Raynal [Fri, 19 Jan 2018 18:11:27 +0000 (19:11 +0100)]
mtd: nand: Fix build issues due to an anonymous union

GCC-4.4.4 raises errors when assigning a parameter in an anonymous
union, leading to this kind of failure:

drivers/mtd/nand/marvell_nand.c:1936:
    warning: missing braces around initializer
    warning: (near initialization for '(anonymous)[1].<anonymous>')
    error: unknown field 'data' specified in initializer
    error: unknown field 'addr' specified in initializer

Work around the situation by naming these unions.

Fixes: 8878b126df76 ("mtd: nand: add ->exec_op() implementation")
Reported-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Miquel Raynal <miquel.raynal@free-electrons.com>
Tested-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
6 years agomtd: nand: marvell: Fix missing memory allocation modifier
Miquel Raynal [Fri, 19 Jan 2018 17:39:01 +0000 (18:39 +0100)]
mtd: nand: marvell: Fix missing memory allocation modifier

The function marvell_nfc_init_dma() allocates a DMA buffer without the
GFP_KERNEL modifier, that triggers this warning:
"marvell_nfc_init_dma() error: no modifiers for allocation."

Fix this by using (GFP_KERNEL | GFP_DMA) instead of only GFP_DMA as the
probe happens in non-interrupt context.

Fixes: 02f26ecf8c77 ("mtd: nand: add reworked Marvell NAND controller driver")
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Miquel Raynal <miquel.raynal@free-electrons.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
6 years agomtd: nand: marvell: remove redundant variable 'oob_len'
Colin Ian King [Fri, 19 Jan 2018 07:59:54 +0000 (07:59 +0000)]
mtd: nand: marvell: remove redundant variable 'oob_len'

Variable oob_len is assigned and never read, hence it is redundant and
can be removed.

Cleans up clang warnings:

drivers/mtd/nand/marvell_nand.c:1356:6: warning: Value stored to 'oob_len'
during its initialization is never read
drivers/mtd/nand/marvell_nand.c:1369:4: warning: Value stored to 'oob_len'
is never read

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Acked-by: Miquel Raynal <miquel.raynal@free-electrons.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
6 years agomtd: nand: marvell: fix spelling mistake: "suceed"-> "succeed"
Colin Ian King [Fri, 19 Jan 2018 07:55:31 +0000 (07:55 +0000)]
mtd: nand: marvell: fix spelling mistake: "suceed"-> "succeed"

Trivial fix to spelling mistakes in dev_err error message text.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Acked-by: Miquel Raynal <miquel.raynal@free-electrons.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
6 years agomtd: onenand: omap2: Remove redundant dev_err call in omap2_onenand_probe()
Wei Yongjun [Wed, 17 Jan 2018 11:25:33 +0000 (11:25 +0000)]
mtd: onenand: omap2: Remove redundant dev_err call in omap2_onenand_probe()

There is a error message within devm_ioremap_resource
already, so remove the dev_err call to avoid redundant
error message.

Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
6 years agomtd: Remove duplicate checks on mtd_oob_ops parameter
Boris Brezillon [Tue, 9 Jan 2018 08:50:35 +0000 (09:50 +0100)]
mtd: Remove duplicate checks on mtd_oob_ops parameter

Some of the check done in custom ->_read/write_oob() implementation are
already done by the core (in mtd_check_oob_ops()).

Suggested-by: Peter Pan <peterpansjtu@gmail.com>
[Remove redundant checks done in mtdpart.c]
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Tested-by: Ladislav Michl <ladis@linux-mips.org>
6 years agomtd: Fallback to ->_read/write_oob() when ->_read/write() is missing
Boris Brezillon [Tue, 9 Jan 2018 08:50:34 +0000 (09:50 +0100)]
mtd: Fallback to ->_read/write_oob() when ->_read/write() is missing

Some MTD sublayers/drivers are implementing ->_read/write_oob() and
provide dummy wrappers for their ->_read/write() implementations.
Let the core handle this case instead of duplicating the logic.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Acked-by: Robert Jarzmik <robert.jarzmik@free.fr>
Acked-by: Brian Norris <computersforpeace@gmail.com>
Reviewed-by: Miquel Raynal <miquel.raynal@free-electrons.com>
Tested-by: Ladislav Michl <ladis@linux-mips.org>
6 years agomtd: mtdpart: Make ECC stat handling consistent
Boris Brezillon [Tue, 9 Jan 2018 08:50:33 +0000 (09:50 +0100)]
mtd: mtdpart: Make ECC stat handling consistent

part_read() and part_read_oob() were counting ECC failures and
bitflips differently. Adjust part_read_oob() to mimic what is done in
part_read(). This is needed to use ->_read_oob() as a fallback when
when ->_read() is not implemented.

Note that bitflips and ECC failure accounting on MTD partitions is
broken by design, because nothing prevents concurrent accesses to the
underlying master MTD device between the moment we save the stats in a
local variable and the moment master->_read[_oob]() returns. It's not
something that can easily be fixed, so leave it like that for now.

Suggested-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Tested-by: Ladislav Michl <ladis@linux-mips.org>
6 years agomtd: onenand: omap2: print resource using %pR format string
Arnd Bergmann [Tue, 16 Jan 2018 07:43:40 +0000 (08:43 +0100)]
mtd: onenand: omap2: print resource using %pR format string

The omap2 onenand driver is now available for compile-testing, which
uncovers a warning in configurations that have a 64-bit resource_size_t:

drivers/mtd/onenand/omap2.c: In function 'omap2_onenand_probe':
drivers/mtd/onenand/omap2.c:536:54: error: format '%x' expects argument of type 'unsigned int', but argument 3 has type 'resource_size_t {aka long long unsigned int}' [-Werror=format=]
   dev_err(dev, "Cannot reserve memory region at 0x%08x, size: 0x%x\n",
drivers/mtd/onenand/omap2.c:536:66: error: format '%x' expects argument of type 'unsigned int', but argument 4 has type 'resource_size_t {aka long long unsigned int}' [-Werror=format=]

Changing the format string to the special %pR simplifies the code
and lets it do the right thing in that configuration, while avoiding
the warning.

Fixes: a758f50f10cf ("mtd: onenand: omap2: Configure driver from DT")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
Reviewed-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
6 years agomtd: mtk-nor: modify functions' name more generally
Guochun Mao [Mon, 18 Dec 2017 01:47:35 +0000 (09:47 +0800)]
mtd: mtk-nor: modify functions' name more generally

Since more and more Mediatek's SoC can use this driver to
control spi-nor flash, functions' name with "mt8173_" is
no longer properly. Replacing "mt8173_" with "mtk_" will
be more accurate to describe these functions' usable scope.

Signed-off-by: Guochun Mao <guochun.mao@mediatek.com>
Signed-off-by: Cyrille Pitchen <cyrille.pitchen@wedev4u.fr>
6 years agomtd: onenand: samsung: remove incorrect __iomem annotation
Christophe JAILLET [Sat, 13 Jan 2018 16:56:16 +0000 (17:56 +0100)]
mtd: onenand: samsung: remove incorrect __iomem annotation

'page_buf' and 'oob_buf' are allocated with 'devm_kzalloc()' and should not
have __iomem decoration.

Remove these decorations and some useless casting.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
6 years agoMAINTAINERS: Add entry for Marvell NAND controller driver
Miquel Raynal [Sat, 13 Jan 2018 10:54:10 +0000 (11:54 +0100)]
MAINTAINERS: Add entry for Marvell NAND controller driver

Add entry for Marvell NAND controller driver and its bindings which will
soon replace the old driver pxa3xx_nand.c.

Signed-off-by: Miquel Raynal <miquel.raynal@free-electrons.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
6 years agoARM: OMAP2+: Remove gpmc-onenand
Ladislav Michl [Fri, 12 Jan 2018 13:18:00 +0000 (14:18 +0100)]
ARM: OMAP2+: Remove gpmc-onenand

As OneNAND driver is now using devicetree gpmc-onenand and its
platform data is unused and can be removed.

Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
Reviewed-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Acked-by: Roger Quadros <rogerq@ti.com>
Acked-by: Tony Lindgren <tony@atomide.com>
Tested-by: Tony Lindgren <tony@atomide.com>
Tested-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
6 years agomtd: onenand: omap2: Configure driver from DT
Ladislav Michl [Fri, 12 Jan 2018 13:17:25 +0000 (14:17 +0100)]
mtd: onenand: omap2: Configure driver from DT

Move away from platform data configuration and use pure DT approach.

Use generic probe function to deal with OneNAND node and remove now useless
gpmc_probe_onenand_child function. Import sync mode timing calculation
function from mach-omap2/gpmc-onenand.c

Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
Reviewed-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Tested-by: Tony Lindgren <tony@atomide.com>
Tested-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Acked-by: Roger Quadros <rogerq@ti.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
6 years agomtd: onenand: omap2: Decouple DMA enabling from INT pin availability
Ladislav Michl [Fri, 12 Jan 2018 13:16:57 +0000 (14:16 +0100)]
mtd: onenand: omap2: Decouple DMA enabling from INT pin availability

INT pin (gpio_irq) is not really needed for DMA but only for notification
when a command that needs wait has completed. DMA memcpy can be still used
even without gpio_irq available, so enable it unconditionally.

Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
Reviewed-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Tested-by: Tony Lindgren <tony@atomide.com>
Tested-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Acked-by: Roger Quadros <rogerq@ti.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
6 years agomtd: onenand: omap2: Do not make delay for GPIO OMAP3 specific
Ladislav Michl [Fri, 12 Jan 2018 13:16:28 +0000 (14:16 +0100)]
mtd: onenand: omap2: Do not make delay for GPIO OMAP3 specific

Second commit in driver history (782b7a367d81: "[MTD] [OneNAND] OMAP3:
add delay for GPIO") added quirk for waiting until GPIO line settle.
As DMA was disabled for OMAP2 boards, chances are this problem was
not OMAP3 specific and as it is just one register read, previous
test for SoC type is approximately as expensive as read itself.
Make delay unconditional, which allows removing SoC specific code
alltogether.

Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
Reviewed-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
Acked-by: Roger Quadros <rogerq@ti.com>
Tested-by: Tony Lindgren <tony@atomide.com>
Tested-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
6 years agomtd: onenand: omap2: Convert to use dmaengine for memcpy
Peter Ujfalusi [Fri, 12 Jan 2018 13:16:08 +0000 (14:16 +0100)]
mtd: onenand: omap2: Convert to use dmaengine for memcpy

Do not use the legacy and deprecated omap-dma interface for setting up the
memcpy.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
Acked-by: Roger Quadros <rogerq@ti.com>
Tested-by: Tony Lindgren <tony@atomide.com>
Tested-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
6 years agomtd: onenand: omap2: Unify OMAP2 and OMAP3 DMA implementation
Ladislav Michl [Fri, 12 Jan 2018 13:15:45 +0000 (14:15 +0100)]
mtd: onenand: omap2: Unify OMAP2 and OMAP3 DMA implementation

Since the very first commit (36cd4fb5d277: "[MTD] [OneNAND] Add
OMAP2 / OMAP3 OneNAND driver") DMA is disabled for OMAP2. Later
fixes thus went only into OMAP3 specific DMA functions which
turned out not to be so OMAP3 specific, so merge those two
implementations.

Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
Reviewed-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
Acked-by: Roger Quadros <rogerq@ti.com>
Tested-by: Tony Lindgren <tony@atomide.com>
Tested-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
6 years agomtd: onenand: omap2: Simplify the DMA setup for various paths
Peter Ujfalusi [Fri, 12 Jan 2018 13:15:25 +0000 (14:15 +0100)]
mtd: onenand: omap2: Simplify the DMA setup for various paths

We have 4 functions containing almost identical DMA setup code. Create one
function which can set up the DMA for both read and write and use this in
place for the setup code in the driver.
The new function will use wait_for_completion_io_timeout() and it will
figure out the best data_type to be used for the transfer instead of
hardwiring 32 or 16 bit data.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
Acked-by: Roger Quadros <rogerq@ti.com>
Tested-by: Tony Lindgren <tony@atomide.com>
Tested-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
6 years agomtd: onenand: omap2: Account waiting time as waiting on IO
Ladislav Michl [Fri, 12 Jan 2018 13:14:54 +0000 (14:14 +0100)]
mtd: onenand: omap2: Account waiting time as waiting on IO

Use wait_for_completion_io_timeout, which has an impact on how the
task is accounted in scheduling stats.

Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
Reviewed-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
Acked-by: Roger Quadros <rogerq@ti.com>
Tested-by: Tony Lindgren <tony@atomide.com>
Tested-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
6 years agomtd: onenand: omap2: Remove partitioning support from platform data
Ladislav Michl [Fri, 12 Jan 2018 13:14:17 +0000 (14:14 +0100)]
mtd: onenand: omap2: Remove partitioning support from platform data

No platform data user setups partitioning information, so remove.

Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
Reviewed-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
Acked-by: Roger Quadros <rogerq@ti.com>
Tested-by: Tony Lindgren <tony@atomide.com>
Tested-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
6 years agomtd: onenand: omap2: Remove skip initial unlocking support
Ladislav Michl [Fri, 12 Jan 2018 13:13:56 +0000 (14:13 +0100)]
mtd: onenand: omap2: Remove skip initial unlocking support

No platform data user sets skip_initial_unlocking, so remove test
for this field.

Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
Reviewed-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
Acked-by: Roger Quadros <rogerq@ti.com>
Tested-by: Tony Lindgren <tony@atomide.com>
Tested-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
6 years agomtd: onenand: omap2: Remove regulator support
Ladislav Michl [Fri, 12 Jan 2018 13:13:36 +0000 (14:13 +0100)]
mtd: onenand: omap2: Remove regulator support

As no platform data user sets regulator_can_sleep, regulator code is
no-op and can be deleted.

Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
Reviewed-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
Acked-by: Roger Quadros <rogerq@ti.com>
Tested-by: Tony Lindgren <tony@atomide.com>
Tested-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
6 years agoARM: dts: omap3-igep: Update onenand node timings
Ladislav Michl [Fri, 12 Jan 2018 13:13:19 +0000 (14:13 +0100)]
ARM: dts: omap3-igep: Update onenand node timings

Update node timings to be compatible with actual chip used -
gpmc_cs_show_timings utilized to dump values.

Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
Reviewed-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Acked-by: Roger Quadros <rogerq@ti.com>
Acked-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
6 years agoARM: dts: OMAP2+: Add compatible property to onenand node
Ladislav Michl [Fri, 12 Jan 2018 13:12:56 +0000 (14:12 +0100)]
ARM: dts: OMAP2+: Add compatible property to onenand node

OMAP onenand nodes are missing compatible property, add it.

Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
Reviewed-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Acked-by: Roger Quadros <rogerq@ti.com>
Acked-by: Tony Lindgren <tony@atomide.com>
Tested-by: Tony Lindgren <tony@atomide.com>
Tested-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
6 years agodt-bindings: mtd: gpmc-onenand: Update properties description
Ladislav Michl [Fri, 12 Jan 2018 13:11:53 +0000 (14:11 +0100)]
dt-bindings: mtd: gpmc-onenand: Update properties description

Compatible property is required for OMAP2+ mtd driver. Also
add INT pin gpio description and delete unused dma-channel
property.

Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
Reviewed-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Acked-by: Roger Quadros <rogerq@ti.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
6 years agoMerge tag 'gpmc-omap-for-v4.16-immutable' of https://github.com/rogerq/linux into...
Boris Brezillon [Fri, 12 Jan 2018 14:28:57 +0000 (15:28 +0100)]
Merge tag 'gpmc-omap-for-v4.16-immutable' of https://github.com/rogerq/linux into nand/next

Pull changes needed for omap OneNAND changes from Roger Quadros:

  OMAP-GPMC: driver updates for v4.16
  * Error out only if both 'bank-width' and 'gpmc,device-width' DT properties are missing.

6 years agomtd: nand: use reworked NAND controller driver with Marvell EBU SoCs
Miquel Raynal [Tue, 9 Jan 2018 10:36:34 +0000 (11:36 +0100)]
mtd: nand: use reworked NAND controller driver with Marvell EBU SoCs

Choose to compile and embed marvell_nand.c as NAND controller driver
instead of the legacy pxa3xx_nand.c for platforms with Marvell EBU
SoCs.

Signed-off-by: Miquel Raynal <miquel.raynal@free-electrons.com>
Acked-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
6 years agomtd: nand: add reworked Marvell NAND controller driver
Miquel Raynal [Tue, 9 Jan 2018 10:36:33 +0000 (11:36 +0100)]
mtd: nand: add reworked Marvell NAND controller driver

Add marvell_nand driver which aims at replacing the existing pxa3xx_nand
driver.

The new driver intends to be easier to understand and follows the brand
new NAND framework rules by implementing hooks for every pattern the
controller might support and referencing them inside a parser object
that will be given to the core at each ->exec_op() call.

Raw accessors are implemented, useful to test/debug memory/filesystem
corruptions. Userspace binaries contained in the mtd-utils package may
now be used and their output trusted.

Most of the DT nodes using the old driver kept non-optimal timings from
the bootloader (even if there was some mechanisms to derive them if the
chip was ONFI compliant). The new default is to implement
->setup_data_interface() and follow the core's decision regarding the
chip.

Thanks to the improved timings, implementation of ONFI mode 5 support
(with EDO managed by adding a delay on data sampling), merging the
commands together and optimizing writes in the command registers, the
new driver may achieve faster throughputs in both directions.
Measurements show an improvement of about +23% read throughput and +24%
write throughput. These measurements have been done with an
Armada-385-DB-AP (4kiB NAND pages forced in 4-bit strength BCH ECC
correction) using the userspace tool 'flash_speed' from the MTD test
suite.

Besides these important topics, the new driver addresses several
unsolved known issues in the old driver which:
- did not work with ECC soft neither with ECC none ;
- relied on naked read/write (which is unchanged) while the NFCv1
  embedded in the pxa3xx platforms do not implement it, so several
  NAND commands did not actually ever work without any notice (like
  reading the ONFI PARAM_PAGE or SET/GET_FEATURES) ;
- wrote the OOB data correctly, but was not able to read it correctly
  past the first OOB data chunk ;
- did not retrieve ECC bytes ;
- used device tree bindings that did not allow more than one NAND chip,
  and did not allow to choose the correct chip select if not
  incrementing from 0. Plus, the Ready/Busy line used had to be 0.

Old device tree bindings are still supported but deprecated. A more
hierarchical view has to be used to keep the controller and the NAND
chip structures clearly separated both inside the device tree and also
in the driver code.

Signed-off-by: Miquel Raynal <miquel.raynal@free-electrons.com>
Tested-by: Sean Nyekjaer <sean.nyekjaer@prevas.dk>
Tested-by: Willy Tarreau <w@1wt.eu>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
6 years agodt-bindings: mtd: add Marvell NAND controller documentation
Miquel Raynal [Tue, 9 Jan 2018 10:36:32 +0000 (11:36 +0100)]
dt-bindings: mtd: add Marvell NAND controller documentation

Document the legacy and the new bindings for Marvell NAND controller.

The pxa3xx_nand.c driver does only support legacy bindings, which are
incomplete and inaccurate. A rework of this controller (called
marvell_nand.c) does support both.

Signed-off-by: Miquel Raynal <miquel.raynal@free-electrons.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
6 years agodt-bindings: mtd: document new nand-rb property
Miquel Raynal [Tue, 9 Jan 2018 10:36:31 +0000 (11:36 +0100)]
dt-bindings: mtd: document new nand-rb property

There are already an atmel,rb and an allwinner,rb properties, let's not
make other ones and instead use a generic term: nand-rb to define NAND
chips Ready/Busy lines.

Signed-off-by: Miquel Raynal <miquel.raynal@free-electrons.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
6 years agomtd: nand: Fix nand_do_read_oob() return value
Miquel Raynal [Fri, 12 Jan 2018 09:13:36 +0000 (10:13 +0100)]
mtd: nand: Fix nand_do_read_oob() return value

Starting from commit 041e4575f034 ("mtd: nand: handle ECC errors in
OOB"), nand_do_read_oob() (from the NAND core) did return 0 or a
negative error, and the MTD layer expected it.

However, the trend for the NAND layer is now to return an error or a
positive number of bitflips. Deciding which status to return to the user
belongs to the MTD layer.

Commit e47f68587b82 ("mtd: check for max_bitflips in mtd_read_oob()")
brought this logic to the mtd_read_oob() function while the return value
coming from nand_do_read_oob() (called by the ->_read_oob() hook) was
left unchanged.

Fixes: e47f68587b82 ("mtd: check for max_bitflips in mtd_read_oob()")
Cc: stable@vger.kernel.org
Signed-off-by: Miquel Raynal <miquel.raynal@free-electrons.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
6 years agomtd: mtd_oobtest: Handle bitflips during reads
Miquel Raynal [Thu, 11 Jan 2018 20:39:20 +0000 (21:39 +0100)]
mtd: mtd_oobtest: Handle bitflips during reads

Reads from NAND devices usually trigger bitflips, this is an expected
behavior. While bitflips are under a given threshold, the MTD core
returns 0. However, when the number of corrected bitflips is above this
same threshold, -EUCLEAN is returned to inform the upper layer that this
block is slightly dying and soon the ECC engine will be overtaken so
actions should be taken to move the data out of it.

This particular condition should not be treated like an error and the
test should continue.

Signed-off-by: Miquel Raynal <miquel.raynal@free-electrons.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
6 years agoMAINTAINERS: mtd/nand: update Microchip nand entry
Nicolas Ferre [Thu, 11 Jan 2018 16:26:59 +0000 (17:26 +0100)]
MAINTAINERS: mtd/nand: update Microchip nand entry

Update Wenyou Yang email address.
Take advantage of this update to move this entry to the MICROCHIP / ATMEL
location and add the DT binding documentation link.

Signed-off-by: Nicolas Ferre <nicolas.ferre@microchip.com>
Acked-by: Wenyou Yang <wenyou.yang@microchip.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
6 years agomtd: nand: samsung: Disable subpage writes on E-die NAND
Ladislav Michl [Tue, 9 Jan 2018 13:19:11 +0000 (14:19 +0100)]
mtd: nand: samsung: Disable subpage writes on E-die NAND

Samsung E-die SLC NAND manufactured using 21nm process (K9F1G08U0E)
does not support partial page programming, so disable subpage writes
for it. Manufacturing process is stored in lowest two bits of 5th ID
byte.

Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
6 years agomtd: tests: nandbiterrs: Fix read_page return value
Sascha Hauer [Tue, 9 Jan 2018 09:47:02 +0000 (10:47 +0100)]
mtd: tests: nandbiterrs: Fix read_page return value

The number of corrected bitflips is not correctly reported by
the test until the bitflip threshold is reached.

read_page() shall return the number of corrected bitflips, but
mtd_read() returns 0 or a negative error, so we can't forward
its return value. In the absence of an error we always have
calculate the number of bitflips ourselves.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
6 years agomtd: nand: brcmnand: Disable prefetch by default
Kamal Dasu [Mon, 8 Jan 2018 20:36:48 +0000 (15:36 -0500)]
mtd: nand: brcmnand: Disable prefetch by default

Brcm nand controller prefetch feature needs to be disabled
by default. Enabling affects performance on random reads as
well as dma reads.

Signed-off-by: Kamal Dasu <kdasu.kdev@gmail.com>
Fixes: 27c5b17cd1b1 ("mtd: nand: add NAND driver "library" for Broadcom STB NAND controller")
Cc: <stable@vger.kernel.org>
Acked-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
6 years agospi-nor: intel-spi: Remove unused preopcodes field
Mika Westerberg [Thu, 4 Jan 2018 09:07:44 +0000 (12:07 +0300)]
spi-nor: intel-spi: Remove unused preopcodes field

This field is not used in the driver anymore so remove it.

Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Cyrille Pitchen <cyrille.pitchen@wedev4u.fr>
6 years agomtd: fsl-quadspi: account for const type of of_device_id.data
Julia Lawall [Tue, 2 Jan 2018 13:28:05 +0000 (14:28 +0100)]
mtd: fsl-quadspi: account for const type of of_device_id.data

This driver creates a number of const structures that it stores in the
data field of an of_device_id array.

The data field of an of_device_id structure has type const void *, so
there is no need for a const-discarding cast when putting const values
into such a structure.

Done using Coccinelle.

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Cyrille Pitchen <cyrille.pitchen@wedev4u.fr>
6 years agomtd: spi-nor: cadence-quadspi: Add support for direct access mode
Vignesh R [Fri, 29 Dec 2017 09:11:03 +0000 (14:41 +0530)]
mtd: spi-nor: cadence-quadspi: Add support for direct access mode

Cadence QSPI controller provides direct access mode through which flash
can be accessed in a memory-mapped IO mode. This enables read/write to
flash using memcpy*() functions. This mode provides higher throughput
for both read/write operations when compared to current indirect mode of
operation.

This patch therefore adds support to use QSPI in direct mode. If the
window reserved in SoC's memory map for MMIO access is less that of
flash size(like on most SoCFPGA variants), then the driver falls back
to indirect mode of operation.

On TI's 66AK2G SoC, with ARM running at 600MHz and QSPI at 96MHz
switching to direct mode improves read throughput from 3MB/s to 8MB/s.

Signed-off-by: Vignesh R <vigneshr@ti.com>
Signed-off-by: Cyrille Pitchen <cyrille.pitchen@wedev4u.fr>
6 years agomtd: spi-nor: cadence-quadspi: Refactor indirect read/write sequence.
Vignesh R [Fri, 29 Dec 2017 09:11:02 +0000 (14:41 +0530)]
mtd: spi-nor: cadence-quadspi: Refactor indirect read/write sequence.

Move configuring of indirect read/write start address to
cqspi_indirect_*_execute() function and rename cqspi_indirect_*_setup()
function. This will help to reuse cqspi_indirect_*_setup() function for
supporting direct access mode.

Signed-off-by: Vignesh R <vigneshr@ti.com>
Signed-off-by: Cyrille Pitchen <cyrille.pitchen@wedev4u.fr>
6 years agomtd: nand: qcom: Add a NULL check for devm_kasprintf()
Fabio Estevam [Fri, 5 Jan 2018 20:02:55 +0000 (18:02 -0200)]
mtd: nand: qcom: Add a NULL check for devm_kasprintf()

devm_kasprintf() may fail, so we should better add a NULL check
and propagate an error on failure.

Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
6 years agomtd: Add an helper to make erase request aligned on ->erasesize
Boris Brezillon [Fri, 15 Dec 2017 12:39:52 +0000 (13:39 +0100)]
mtd: Add an helper to make erase request aligned on ->erasesize

There's currently nothing forcing alignment of einfo->addr and
einfo->len on mtd->erasesize. Since we don't know if automatically
aligning those field in mtd_erase() will hurt some drivers, we add an
helper function to let drivers that need such an alignment explicitly
ask for it.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Reviewed-by: Miquel Raynal <miquel.raynal@free-electrons.com>
6 years agomtd: Do not allow MTD devices with inconsistent erase properties
Boris Brezillon [Fri, 15 Dec 2017 12:39:51 +0000 (13:39 +0100)]
mtd: Do not allow MTD devices with inconsistent erase properties

When mtd->erasesize is 0 or mtd->_erase is NULL, that means the device
does not support the erase operation, which in turn means it should
have the MTD_NO_ERASE flag set.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Reviewed-by: Miquel Raynal <miquel.raynal@free-electrons.com>
6 years agomtd: sharpslpart: make local function sharpsl_nand_cleanup_ftl() static
Wei Yongjun [Wed, 20 Dec 2017 05:45:36 +0000 (05:45 +0000)]
mtd: sharpslpart: make local function sharpsl_nand_cleanup_ftl() static

Fixes the following sparse warnings:

drivers/mtd/parsers/sharpslpart.c:222:6: warning:
 symbol 'sharpsl_nand_cleanup_ftl' was not declared. Should it be static?

Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Acked-by: Andrea Adami <andrea.adami@gmail.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
6 years agomtd: nand: brcmnand: Add a NULL check for devm_kasprintf()
Fabio Estevam [Fri, 5 Jan 2018 20:02:56 +0000 (18:02 -0200)]
mtd: nand: brcmnand: Add a NULL check for devm_kasprintf()

devm_kasprintf() may fail, so we should better add a NULL check
and propagate an error on failure.

Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
6 years agomtd: nand: Fix unfinished comment in nand_init_data_interface()
Miquel Raynal [Fri, 22 Dec 2017 17:12:41 +0000 (18:12 +0100)]
mtd: nand: Fix unfinished comment in nand_init_data_interface()

Give an unfinished comment a meaning.

Signed-off-by: Miquel Raynal <miquel.raynal@free-electrons.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
6 years agomtd: spi-nor: Add ISSI is25lp080d support
Romain Porte [Thu, 28 Dec 2017 10:03:24 +0000 (11:03 +0100)]
mtd: spi-nor: Add ISSI is25lp080d support

Add support for a new ISSI 1MB SPI NOR chip that was tested in our lab.
Datasheet is available at: http://www.issi.com/WW/pdf/25LP-WP080D.pdf

Testing was done only without the SPI_NOR_{DUAL,QUAD}_READ flags that
were added later, according to the datasheet.

Tested-by: Pascal Fabreges <pascal.fabreges@nokia.com>
Reviewed-by: Alexander Sverdlin <alexander.sverdlin@nokia.com>
Signed-off-by: Romain Porte <romain.porte@nokia.com>
Signed-off-by: Cyrille Pitchen <cyrille.pitchen@wedev4u.fr>
6 years agomtd: spi-nor: Add support for s25fl128l and s25fl256l
Rafael Gago [Thu, 21 Dec 2017 12:27:30 +0000 (13:27 +0100)]
mtd: spi-nor: Add support for s25fl128l and s25fl256l

They are exactly the same as the s25fl064l but bigger.

Signed-off-by: Rafael Gago Castano <rgc@hms.se>
Signed-off-by: Cyrille Pitchen <cyrille.pitchen@wedev4u.fr>
6 years agoMAINTAINERS: Move all MTD related branches to a single repo
Boris Brezillon [Mon, 18 Dec 2017 15:49:34 +0000 (16:49 +0100)]
MAINTAINERS: Move all MTD related branches to a single repo

Historically, branches targeting the next release (and pulled in
linux-next) have been pushed on the l2-mtd repo and fixes branches on
the linux-mtd one. Now that all MTD maintainers have RW permissions on
linux-mtd tree, there's no good reason to have two different trees.
Move all -next branches to linux-mtd.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Cc: Stephen Rothwell <sfr@canb.auug.org.au>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Cyrille Pitchen <cyrille.pitchen@wedev4u.fr>
Cc: Richard Weinberger <richard@nod.at>
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: Brian Norris <computersforpeace@gmail.com>
Acked-by: Richard Weinberger <richard@nod.at>
Acked-by: Cyrille Pitchen <cyrille.pitchen@wedev4u.fr>
6 years agomtd: spi-nor: indent issi section
Sean Nyekjaer [Fri, 15 Dec 2017 07:33:32 +0000 (08:33 +0100)]
mtd: spi-nor: indent issi section

Signed-off-by: Sean Nyekjaer <sean.nyekjaer@prevas.dk>
Signed-off-by: Cyrille Pitchen <cyrille.pitchen@wedev4u.fr>
6 years agomtd: spi-nor: add support for is25lq040b
Sean Nyekjaer [Fri, 15 Dec 2017 07:33:31 +0000 (08:33 +0100)]
mtd: spi-nor: add support for is25lq040b

Signed-off-by: Sean Nyekjaer <sean.nyekjaer@prevas.dk>
Signed-off-by: Cyrille Pitchen <cyrille.pitchen@wedev4u.fr>
6 years agomtd: onenand: samsung: Remove a useless include
Christophe JAILLET [Thu, 14 Dec 2017 06:03:52 +0000 (07:03 +0100)]
mtd: onenand: samsung: Remove a useless include

This include is not needed, so remove it.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
6 years agomtd: onenand: samsung: Propagate the error returned by 'onenand_scan()'
Christophe JAILLET [Thu, 14 Dec 2017 06:03:51 +0000 (07:03 +0100)]
mtd: onenand: samsung: Propagate the error returned by 'onenand_scan()'

Propagate the error code returned by 'onenand_scan()' instead of a
hard-coded -EFAULT.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
6 years agomtd: onenand: samsung: return an error if 'mtd_device_parse_register()' fails
Christophe JAILLET [Thu, 14 Dec 2017 06:03:50 +0000 (07:03 +0100)]
mtd: onenand: samsung: return an error if 'mtd_device_parse_register()' fails

If 'mtd_device_parse_register()' fails, we still return 0 which mean
success.
Return the error code instead, as done in all the other error handling
paths.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
6 years agomtd: onenand: samsung: use devm_ function to simplify code and fix some leaks
Christophe JAILLET [Thu, 14 Dec 2017 06:03:49 +0000 (07:03 +0100)]
mtd: onenand: samsung: use devm_ function to simplify code and fix some leaks

Convert all error handling code in 's3c_onenand_probe()' to
resource-managed alternatives in order to simplify code.

This fixes a resource leak if 'platform_get_resource()' fails at line 872.

The 'request_irq()' at line 971 was also un-balanced. It is now
resource-managed.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
6 years agomtd: sharpslpart: fix overflow on block_adr calculation
Colin Ian King [Wed, 8 Nov 2017 16:13:23 +0000 (16:13 +0000)]
mtd: sharpslpart: fix overflow on block_adr calculation

Multiplying block_num and mtd->erasesize may potentially overflow
as they are both unsigned ints and so the multiplication is evaluated
in unsigned int arithmetic.  Cast block_adr to off_t to ensure
multiplication is off_t sized to avoid any potential overflow.

Detected by CoverityScan, CID#1461264 ("Unintentional integer overflow")

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Acked-by: Andrea Adami <andrea.adami@gmail.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
6 years agomtd: cfi: convert inline functions to macros
Arnd Bergmann [Wed, 11 Oct 2017 13:54:10 +0000 (15:54 +0200)]
mtd: cfi: convert inline functions to macros

The map_word_() functions, dating back to linux-2.6.8, try to perform
bitwise operations on a 'map_word' structure. This may have worked
with compilers that were current then (gcc-3.4 or earlier), but end
up being rather inefficient on any version I could try now (gcc-4.4 or
higher). Specifically we hit a problem analyzed in gcc PR81715 where we
fail to reuse the stack space for local variables.

This can be seen immediately in the stack consumption for
cfi_staa_erase_varsize() and other functions that (with CONFIG_KASAN)
can be up to 2200 bytes. Changing the inline functions into macros brings
this down to 1280 bytes.  Without KASAN, the same problem exists, but
the stack consumption is lower to start with, my patch shrinks it from
920 to 496 bytes on with arm-linux-gnueabi-gcc-5.4, and saves around
1KB in .text size for cfi_cmdset_0020.c, as it avoids copying map_word
structures for each call to one of these helpers.

With the latest gcc-8 snapshot, the problem is fixed in upstream gcc,
but nobody uses that yet, so we should still work around it in mainline
kernels and probably backport the workaround to stable kernels as well.
We had a couple of other functions that suffered from the same gcc bug,
and all of those had a simpler workaround involving dummy variables
in the inline function. Unfortunately that did not work here, the
macro hack was the best I could come up with.

It would also be helpful to have someone to a little performance testing
on the patch, to see how much it helps in terms of CPU utilitzation.

Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81715
Cc: stable@vger.kernel.org
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Richard Weinberger <richard@nod.at>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
6 years agomtd: mchp23k256: propagate return value of spi_sync()
Antonio Borneo [Sun, 10 Dec 2017 15:19:56 +0000 (16:19 +0100)]
mtd: mchp23k256: propagate return value of spi_sync()

The call to spi_sync() can fail.
Check the return value and propagate it.

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
6 years agomtd: mtdswap: make array 'name' static const, shrinks object size
Colin Ian King [Tue, 28 Nov 2017 18:59:46 +0000 (18:59 +0000)]
mtd: mtdswap: make array 'name' static const, shrinks object size

Don't populate the read-only array 'name' on the stack but instead
make it static and constify it. Makes the object code smaller by 35
bytes:

Before:
   text    data     bss     dec     hex filename
  26304    4444     352   31100    797c drivers/mtd/mtdswap.o

After:
   text    data     bss     dec     hex filename
  26205    4508     352   31065    7959 drivers/mtd/mtdswap.o

(gcc version 7.2.0 x86_64)

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
6 years agomtd: nand: add ->exec_op() implementation
Miquel Raynal [Thu, 9 Nov 2017 13:16:45 +0000 (14:16 +0100)]
mtd: nand: add ->exec_op() implementation

Introduce a new interface to instruct NAND controllers to send specific
NAND operations. The new interface takes the form of a single method
called ->exec_op(). This method is designed to replace ->cmd_ctrl(),
->cmdfunc() and ->read/write_byte/word/buf() hooks.

->exec_op() is passed a set of instructions describing the operation
to execute. Each instruction has a type (ADDR, CMD, DATA, WAITRDY)
and delay. The delay is here to help simple controllers wait enough
time between each instruction, advanced controllers with integrated
timings control can ignore these delays.

Controllers that natively support complex operations (operations
formed of several instructions) can use the NAND op parser
infrastructure. This infrastructure allows controller drivers to
describe the sequence of instructions they support (called
nand_op_pattern) and a hook for each of these supported sequences. The
core then tries to find the best match for a given NAND operation, and
calls the associated hook.

Various other helpers are also added to ease NAND controller drivers
writing.

This new interface should ease support of vendor specific operations
in that NAND manufacturer drivers now have a way to check if the
controller they are connected to supports a specific operation, and
complain or refuse to probe the NAND chip when that's not the case.

Suggested-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Miquel Raynal <miquel.raynal@free-electrons.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
6 years agomtd: nand: samsung: add ECC requirements for K9F4G08U0D
Miquel Raynal [Thu, 7 Dec 2017 09:33:58 +0000 (10:33 +0100)]
mtd: nand: samsung: add ECC requirements for K9F4G08U0D

Samsung NAND chip K9F4G08U0D minimum ECC strength requirement is 1 bit
per 512 bytes. As the chip is not ONFI nor JEDEC and because of the lack
of these values, boards using it fail to probe the NAND controller
driver. Fix this by setting up the default values.

Signed-off-by: Miquel Raynal <miquel.raynal@free-electrons.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
6 years agomtd: nand: Only allocate ecc->{calc, code}_buf when actually needed
Boris Brezillon [Tue, 5 Dec 2017 11:09:29 +0000 (12:09 +0100)]
mtd: nand: Only allocate ecc->{calc, code}_buf when actually needed

The only users of the ecc->{calc,code}_buf buffers are NAND controller
drivers implementing ecc->calculate() and/or ecc->correct(). Since the
->oobsize can be non-negligle, especially on modern NAND devices, we'd
better allocate it only when it is actually required.

Make ecc->{calc,code}_buf allocation dependent on the presence of
ecc->calculate() or ecc->correct().

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Reviewed-by: Masahiro Yamada <yamada.masahiro@socionext.com>
6 years agomtd: nand: denali: Avoid using ecc->code_buf as a temporary buffer
Boris Brezillon [Tue, 5 Dec 2017 11:09:28 +0000 (12:09 +0100)]
mtd: nand: denali: Avoid using ecc->code_buf as a temporary buffer

ECC bytes are contiguous in the ->oob_poi buffer, which means we don't
have to copy them into ->code_buf (here used as a temporary buffer)
before passing them to the nand_check_erased_ecc_chunk() function.

This change will allow us to allocate ecc->{code,calc}_buf only when
ecc->calculate() or ecc->correct() is specified.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Acked-by: Masahiro Yamada <yamada.masahiro@socionext.com>
6 years agomtd: nand: mtk: Support MT7622 NAND flash controller.
RogerCC Lin [Thu, 30 Nov 2017 14:10:45 +0000 (22:10 +0800)]
mtd: nand: mtk: Support MT7622 NAND flash controller.

Add tables to support MT7622 NAND flash controller.

Signed-off-by: RogerCC Lin <rogercc.lin@mediatek.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
6 years agomtd: nand: mtk: Support different MTK NAND flash controller IP
RogerCC Lin [Thu, 30 Nov 2017 14:10:44 +0000 (22:10 +0800)]
mtd: nand: mtk: Support different MTK NAND flash controller IP

MT7622 uses an MTK's earlier NAND flash controller IP which support
different sector size, max spare size per sector and paraity bits...,
some register's offset and definition also been changed in the NAND
flash controller, this patch is the preparation to support MT7622
NAND flash controller.

MT7622 NFC and ECC engine are similar to MT2701's, except below
differences:
(1)MT7622 NFC's max sector size(ECC data size) is 512 bytes, and
   MT2701's is 1024, and MT7622's max sector number is 8.
(2)The parity bit of MT7622 is 13, MT2701 is 14.
(3)MT7622 ECC supports less ECC strength, max to 16 bit ecc strength.
(4)MT7622 supports less spare size per sector, max spare size per
   sector is 28 bytes.
(5)Some register's offset are different, include ECC_ENCIRQ_EN,
   ECC_ENCIRQ_STA, ECC_DECDONE, ECC_DECIRQ_EN and ECC_DECIRQ_STA.
(6)ENC_MODE of ECC_ENCCNFG register is moved from bit 5-6 to bit 4-5.

Signed-off-by: RogerCC Lin <rogercc.lin@mediatek.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
6 years agomtd: nand: mtk: update DT bindings
RogerCC Lin [Thu, 30 Nov 2017 14:10:43 +0000 (22:10 +0800)]
mtd: nand: mtk: update DT bindings

Add MT7622 NAND Flash Controller dt bindings documentation.

Signed-off-by: RogerCC Lin <rogercc.lin@mediatek.com>
Reviewed-by: Matthias Brugger <matthias.bgg@gmail.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
6 years agomtd: onenand: Remove obsolete url from Kconfig help
Ladislav Michl [Mon, 27 Nov 2017 22:52:56 +0000 (23:52 +0100)]
mtd: onenand: Remove obsolete url from Kconfig help

Samsung website no longer host information about OneNAND,
delete it.

Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
6 years agomtd: nand: cafe: clean up DMA address setup
Masahiro Yamada [Tue, 5 Dec 2017 08:49:56 +0000 (17:49 +0900)]
mtd: nand: cafe: clean up DMA address setup

Use macros from <linux/kernel.h> to make the code readable.
The compiler warning will be kept suppressed.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
6 years agomtd: nand: squash struct nand_buffers into struct nand_chip
Masahiro Yamada [Tue, 5 Dec 2017 08:47:16 +0000 (17:47 +0900)]
mtd: nand: squash struct nand_buffers into struct nand_chip

struct nand_buffers is malloc'ed in nand_scan_tail() just for
containing three pointers.  Squash this struct into nand_chip.

Move and rename as follows:

  chip->buffers->ecccalc   ->  chip->ecc.calc_buf
  chip->buffers->ecccode   ->  chip->ecc.code_buf
  chip->buffers->databuf   ->  chip->data_buf

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
6 years agomtd: nand: remove unused NAND_OWN_BUFFERS flag
Masahiro Yamada [Tue, 5 Dec 2017 08:47:15 +0000 (17:47 +0900)]
mtd: nand: remove unused NAND_OWN_BUFFERS flag

The last/only user of NAND_OWN_BUFFERS (cafe_nand.c) has been reworked.
This flag is no longer needed.

Suggested-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
6 years agomtd: nand: cafe: remove use of NAND_OWN_BUFFERS
Masahiro Yamada [Tue, 5 Dec 2017 08:47:14 +0000 (17:47 +0900)]
mtd: nand: cafe: remove use of NAND_OWN_BUFFERS

This driver is the last/only user of NAND_OWN_BUFFERS.  Boris suggested
to remove this flag.

Taking a closer look at this driver, it calls dma_alloc_coherent() for
the concatenated area for the DMA bounce buffer + struct nand_buffers,
but the latter does not need to be DMA-coherent; cafe_{write,read}_buf
simply do memcpy() between buffers when usedma==1.

Let's do dma_alloc_coherent() for the DMA bounce buffer in the front,
and leave the nand_buffers allocation to nand_scan_tail(), then rip off
NAND_OWN_BUFFERS.

The magic number, 2112, is still mysterious (hard-coded writesize +
oobsize ?), but this is not our main interest.  I am keeping it.

Suggested-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
6 years agomtd: nand: provide valid ->data_interface during NAND detection
Miquel Raynal [Thu, 30 Nov 2017 17:01:31 +0000 (18:01 +0100)]
mtd: nand: provide valid ->data_interface during NAND detection

Right now, the chip->data_interface field is populated in
nand_scan_tail(), so after the whole NAND detection has taken place.
This is fine because these timings are not yet used by the core so
early in the probe process, but the situation is about to change with
the introduction of ->exec_op().

Also, by convention, nand_scan_ident() is not supposed to allocate
resources, only nand_scan_tail() can, so this prevent us from
allocating and initializing the data_interface object in
nand_scan_ident().

In order to solve this problem, directly embed a data_interface object
in nand_chip so that we don't have to allocate it, and initialize it to
ONFI SDR mode 0 at the very beginning of nand_scan_ident().

Signed-off-by: Miquel Raynal <miquel.raynal@free-electrons.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
6 years agomtd: nand: force drivers to explicitly send READ/PROG commands
Boris Brezillon [Thu, 30 Nov 2017 17:01:30 +0000 (18:01 +0100)]
mtd: nand: force drivers to explicitly send READ/PROG commands

The core currently send the READ0 and SEQIN+PAGEPROG commands in
nand_do_read/write_ops(). This is inconsistent with
->read/write_oob[_raw]() hooks behavior which are expected to send
these commands.

There's already a flag (NAND_ECC_CUSTOM_PAGE_ACCESS) to inform the core
that a specific controller wants to send the READ/SEQIN+PAGEPROG
commands on its own, but it's an opt-in flag, and existing drivers are
unlikely to be updated to pass it.

Moreover, some controllers cannot dissociate the READ/PAGEPROG commands
from the associated data transfer and ECC engine activation, and
developers have to hack things in their ->cmdfunc() implementation to
handle such complex cases, or have to accept the perf penalty of sending
twice the same command.
To address this problem we are planning on adding a new interface which
is passed all information about a NAND operation (including the amount
of data to transfer) and replacing all calls to ->cmdfunc() to calls to
this new ->exec_op() hook. But, in order to do that, we need to have all
->cmdfunc() calls placed near their associated ->read/write_buf/byte()
calls.

Modify the core and relevant drivers to make NAND_ECC_CUSTOM_PAGE_ACCESS
the default case, and remove this flag.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
[miquel.raynal@free-electrons.com: tested, fixed and rebased on nand/next]
Signed-off-by: Miquel Raynal <miquel.raynal@free-electrons.com>
Acked-by: Masahiro Yamada <yamada.masahiro@socionext.com>
6 years agomtd: nand: provide several helpers to do common NAND operations
Boris Brezillon [Thu, 30 Nov 2017 17:01:29 +0000 (18:01 +0100)]
mtd: nand: provide several helpers to do common NAND operations

This is part of the process of removing direct calls to ->cmdfunc()
outside of the core in order to introduce a better interface to execute
NAND operations.

Here we provide several helpers and make use of them to remove all
direct calls to ->cmdfunc(). This way, we can easily modify those
helpers to make use of the new ->exec_op() interface when available.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
[miquel.raynal@free-electrons.com: rebased and fixed some conflicts]
Signed-off-by: Miquel Raynal <miquel.raynal@free-electrons.com>
Acked-by: Masahiro Yamada <yamada.masahiro@socionext.com>
6 years agomtd: m25p80: restore the status of SPI flash when exiting
Hou Zhiqiang [Wed, 6 Dec 2017 02:53:42 +0000 (10:53 +0800)]
mtd: m25p80: restore the status of SPI flash when exiting

Restore the status to be compatible with legacy devices.
Take Freescale eSPI boot for example, it copies (in 3 Byte
addressing mode) the RCW and bootloader images from SPI flash
without firing a reset signal previously, so the reboot command
will fail without resetting the addressing mode of SPI flash.
This patch implements .shutdown function to restore the status
in reboot process, and add the same operation to the .remove
function.

Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
Signed-off-by: Cyrille Pitchen <cyrille.pitchen@wedev4u.fr>
6 years agomtd: spi-nor: add an API to restore the status of SPI flash chip
Hou Zhiqiang [Wed, 6 Dec 2017 02:53:41 +0000 (10:53 +0800)]
mtd: spi-nor: add an API to restore the status of SPI flash chip

Add this API to restore the status of SPI flash chip to the default
such as addressing mode, whenever detach the driver from device or
reboot the system.

Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
Signed-off-by: Cyrille Pitchen <cyrille.pitchen@wedev4u.fr>
6 years agomtd: spi-nor: Check that BP bits are set properly
Aaron Sierra [Tue, 5 Dec 2017 18:13:44 +0000 (12:13 -0600)]
mtd: spi-nor: Check that BP bits are set properly

Previously, the lock and unlock functions returned success even if the
BP bits were not actually updated in the status register due to
hardware write protection. Introduce write_sr_and_check() to write and
read back the status register to ensure the desired BP bits are
actually set as requested.

Signed-off-by: Joe Schultz <jschultz@xes-inc.com>
Signed-off-by: Aaron Sierra <asierra@xes-inc.com>
Signed-off-by: Cyrille Pitchen <cyrille.pitchen@wedev4u.fr>
6 years agomtd: spi-nor: check FSR error bits for Micron memories
Bean Huo (beanhuo) [Mon, 4 Dec 2017 12:34:47 +0000 (12:34 +0000)]
mtd: spi-nor: check FSR error bits for Micron memories

For Micron spi nor device, when erase/program operation
fails, especially the failure results from intending to
modify protected space, spi-nor upper layers still get
the return which shows the operation succeeds. This is
because current spi_nor_fsr_ready() only uses FSR bit.7
(flag status register) to check device whether ready.
This patch fixes this issue by checking relevant error
bits in FSR.
The FSR is a powerful tool to investigate the status of
device, checking information regarding what the memory is
actually doing and detecting possible error conditions.

Signed-off-by: beanhuo <beanhuo@micron.com>
Signed-off-by: Cyrille Pitchen <cyrille.pitchen@wedev4u.fr>
6 years agodt-bindings: mtd: fsl-quadspi: Pass the qspi clock names
Fabio Estevam [Sun, 3 Dec 2017 22:36:24 +0000 (20:36 -0200)]
dt-bindings: mtd: fsl-quadspi: Pass the qspi clock names

In order to improve the bindings documentation, explicitly pass the name
of the clocks: "qspi_en" and "qspi", which are mandatory.

Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Cyrille Pitchen <cyrille.pitchen@wedev4u.fr>
6 years agomtd: spi-nor: add support for ISSI is25lp128
Angelo Dureghello [Sat, 18 Nov 2017 23:48:23 +0000 (00:48 +0100)]
mtd: spi-nor: add support for ISSI is25lp128

Add support for ISSI is25lp128 spi nor flash.

Signed-off-by: Angelo Dureghello <angelo@sysam.it>
Signed-off-by: Cyrille Pitchen <cyrille.pitchen@wedev4u.fr>
6 years agomemory: omap-gpmc: Make 'bank-width' property optional
Ladislav Michl [Mon, 6 Nov 2017 10:41:04 +0000 (11:41 +0100)]
memory: omap-gpmc: Make 'bank-width' property optional

Error out only if both 'bank-width' and 'gpmc,device-width' are missing.
As 'bank-width' is mostly used for NOR devices and all other devices must
use 'gpmc,device-width' update the error message accordingly.

Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
Signed-off-by: Roger Quadros <rogerq@ti.com>
6 years agomtd: nand: use usual return values for the ->erase() hook
Miquel Raynal [Thu, 30 Nov 2017 17:01:28 +0000 (18:01 +0100)]
mtd: nand: use usual return values for the ->erase() hook

Avoid using specific defined values for checking returned status of the
->erase() hook. Instead, use usual negative error values on failure,
zero otherwise.

Signed-off-by: Miquel Raynal <miquel.raynal@free-electrons.com>
Acked-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
6 years agomtd: nand: denali: rename misleading dma_buf to tmp_buf
Masahiro Yamada [Thu, 23 Nov 2017 13:32:28 +0000 (22:32 +0900)]
mtd: nand: denali: rename misleading dma_buf to tmp_buf

The "dma_buf" is not used for a DMA bounce buffer, but for arranging
the transferred data for the syndrome page layout.  In fact, it is
used in the PIO mode as well, so "dma_buf" is a misleading name.
Rename it to "tmp_buf".

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
6 years agomtd: nand: remove unnecessary extern from driver headers
Masahiro Yamada [Thu, 23 Nov 2017 13:18:43 +0000 (22:18 +0900)]
mtd: nand: remove unnecessary extern from driver headers

'extern' is not necessary for function declarations.

scripts/checkpatch.pl with --strict option reports the following:

  CHECK: extern prototypes should be avoided in .h files

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
6 years agomtd: nand: ifc: update bufnum mask for ver >= 2.0.0
Jagdish Gediya [Thu, 23 Nov 2017 11:34:31 +0000 (17:04 +0530)]
mtd: nand: ifc: update bufnum mask for ver >= 2.0.0

Bufnum mask is used to calculate page position in the internal SRAM.

As IFC version 2.0.0 has 16KB of internal SRAM as compared to older
versions which had 8KB. Hence bufnum mask needs to be updated.

Signed-off-by: Jagdish Gediya <jagdish.gediya@nxp.com>
Signed-off-by: Prabhakar Kushwaha <prabhakar.kushwaha@nxp.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
6 years agomtd: nand: denali_pci: add missing MODULE_DESCRIPTION/AUTHOR/LICENSE
Jesse Chan [Mon, 20 Nov 2017 20:57:13 +0000 (12:57 -0800)]
mtd: nand: denali_pci: add missing MODULE_DESCRIPTION/AUTHOR/LICENSE

This change resolves a new compile-time warning
when built as a loadable module:

WARNING: modpost: missing MODULE_LICENSE() in drivers/mtd/nand/denali_pci.o
see include/linux/module.h for more information

This adds the license as "GPL v2", which matches the header of the file.

MODULE_DESCRIPTION and MODULE_AUTHOR are also added.

Signed-off-by: Jesse Chan <jc@linux.com>
Acked-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
6 years agomtd: nand: gpmi-nand: Remove wrong Kconfig help text
Sascha Hauer [Fri, 17 Nov 2017 11:09:12 +0000 (12:09 +0100)]
mtd: nand: gpmi-nand: Remove wrong Kconfig help text

The GPMI nand Kconfig help texts mentions that the GPMI nand driver
might conflict with SD cards. The only conflict there might really
be is that both controllers use the same pins, but this is resolved
by the pincontroller setup in the device tree. In any way the GPMI
driver can safely be enabled, the text is just wrong. Remove it.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Reviewed-by: Fabio Estevam <fabio.estevam@nxp.com>
Acked-by: Han Xu <han.xu@nxp.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
6 years agomtd: nand: hynix: Don't wait after applying new read-retry params
Boris Brezillon [Mon, 13 Nov 2017 09:59:01 +0000 (10:59 +0100)]
mtd: nand: hynix: Don't wait after applying new read-retry params

Setting read-retry parameters has no impact on the R/B pin, so waiting
for the chip to be ready is useless.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
6 years agomtd: nand: fix interpretation of NAND_CMD_NONE in nand_command[_lp]()
Miquel Raynal [Wed, 8 Nov 2017 16:00:27 +0000 (17:00 +0100)]
mtd: nand: fix interpretation of NAND_CMD_NONE in nand_command[_lp]()

Some drivers (like nand_hynix.c) call ->cmdfunc() with NAND_CMD_NONE
and a column address and expect the controller to only send address
cycles. Right now, the default ->cmdfunc() implementations provided by
the core do not filter out the command cycle in this case and forwards
the request to the controller driver through the ->cmd_ctrl() method.
The thing is, NAND controller drivers can get this wrong and send a
command cycle with a NAND_CMD_NONE opcode and since NAND_CMD_NONE is
-1, and the command field is usually casted to an u8, we end up sending
the 0xFF command which is actually a RESET operation.

Add conditions in nand_command[_lp]() functions to sending the initial
command cycle when command == NAND_CMD_NONE.

Signed-off-by: Miquel Raynal <miquel.raynal@free-electrons.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
6 years agomtd: nand: gpmi: replace _manual_ swap with swap macro
Gustavo A. R. Silva [Fri, 3 Nov 2017 20:31:47 +0000 (15:31 -0500)]
mtd: nand: gpmi: replace _manual_ swap with swap macro

Make use of the swap macro and remove unnecessary variables swap.
This makes the code easier to read and maintain.

This code was detected with the help of Coccinelle.

Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
Acked-by: Han Xu <han.xu@nxp.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
6 years agomtd: nand: mtk: use nand_reset() to reset NAND devices in resume function
Xiaolei Li [Thu, 2 Nov 2017 02:05:07 +0000 (10:05 +0800)]
mtd: nand: mtk: use nand_reset() to reset NAND devices in resume function

Previously, we only select chips and then send reset command to a NAND
device during resuming nand driver. There is a lack of deselecting chips.
It is advised to reset and initialize a NAND device using nand_reset().

Signed-off-by: Xiaolei Li <xiaolei.li@mediatek.com>
Reviewed-by: Matthias Brugger <matthias.bgg@gmail.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
6 years agoLinux 4.15-rc1 v4.15-rc1
Linus Torvalds [Mon, 27 Nov 2017 00:01:47 +0000 (16:01 -0800)]
Linux 4.15-rc1

6 years agoMerge branch 'fixes' of git://git.armlinux.org.uk/~rmk/linux-arm
Linus Torvalds [Sun, 26 Nov 2017 23:03:49 +0000 (15:03 -0800)]
Merge branch 'fixes' of git://git.armlinux.org.uk/~rmk/linux-arm

Pull ARM fixes from Russell King:

 - LPAE fixes for kernel-readonly regions

 - Fix for get_user_pages_fast on LPAE systems

 - avoid tying decompressor to a particular platform if DEBUG_LL is
   enabled

 - BUG if we attempt to return to userspace but the to-be-restored PSR
   value keeps us in privileged mode (defeating an issue that ftracetest
   found)

* 'fixes' of git://git.armlinux.org.uk/~rmk/linux-arm:
  ARM: BUG if jumping to usermode address in kernel mode
  ARM: 8722/1: mm: make STRICT_KERNEL_RWX effective for LPAE
  ARM: 8721/1: mm: dump: check hardware RO bit for LPAE
  ARM: make decompressor debug output user selectable
  ARM: fix get_user_pages_fast

6 years agoMerge branch 'irq-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Sun, 26 Nov 2017 22:39:20 +0000 (14:39 -0800)]
Merge branch 'irq-urgent-for-linus' of git://git./linux/kernel/git/tip/tip

Pull irq fixes from Thomas Glexiner:

 - unbreak the irq trigger type check for legacy platforms

 - a handful fixes for ARM GIC v3/4 interrupt controllers

 - a few trivial fixes all over the place

* 'irq-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  genirq/matrix: Make - vs ?: Precedence explicit
  irqchip/imgpdc: Use resource_size function on resource object
  irqchip/qcom: Fix u32 comparison with value less than zero
  irqchip/exiu: Fix return value check in exiu_init()
  irqchip/gic-v3-its: Remove artificial dependency on PCI
  irqchip/gic-v4: Add forward definition of struct irq_domain_ops
  irqchip/gic-v3: pr_err() strings should end with newlines
  irqchip/s3c24xx: pr_err() strings should end with newlines
  irqchip/gic-v3: Fix ppi-partitions lookup
  irqchip/gic-v4: Clear IRQ_DISABLE_UNLAZY again if mapping fails
  genirq: Track whether the trigger type has been set

6 years agoMerge branch 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Sun, 26 Nov 2017 22:11:54 +0000 (14:11 -0800)]
Merge branch 'x86-urgent-for-linus' of git://git./linux/kernel/git/tip/tip

Pull misc x86 fixes from Ingo Molnar:
 - topology enumeration fixes
 - KASAN fix
 - two entry fixes (not yet the big series related to KASLR)
 - remove obsolete code
 - instruction decoder fix
 - better /dev/mem sanity checks, hopefully working better this time
 - pkeys fixes
 - two ACPI fixes
 - 5-level paging related fixes
 - UMIP fixes that should make application visible faults more debuggable
 - boot fix for weird virtualization environment

* 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (24 commits)
  x86/decoder: Add new TEST instruction pattern
  x86/PCI: Remove unused HyperTransport interrupt support
  x86/umip: Fix insn_get_code_seg_params()'s return value
  x86/boot/KASLR: Remove unused variable
  x86/entry/64: Add missing irqflags tracing to native_load_gs_index()
  x86/mm/kasan: Don't use vmemmap_populate() to initialize shadow
  x86/entry/64: Fix entry_SYSCALL_64_after_hwframe() IRQ tracing
  x86/pkeys/selftests: Fix protection keys write() warning
  x86/pkeys/selftests: Rename 'si_pkey' to 'siginfo_pkey'
  x86/mpx/selftests: Fix up weird arrays
  x86/pkeys: Update documentation about availability
  x86/umip: Print a warning into the syslog if UMIP-protected instructions are used
  x86/smpboot: Fix __max_logical_packages estimate
  x86/topology: Avoid wasting 128k for package id array
  perf/x86/intel/uncore: Cache logical pkg id in uncore driver
  x86/acpi: Reduce code duplication in mp_override_legacy_irq()
  x86/acpi: Handle SCI interrupts above legacy space gracefully
  x86/boot: Fix boot failure when SMP MP-table is based at 0
  x86/mm: Limit mmap() of /dev/mem to valid physical addresses
  x86/selftests: Add test for mapping placement for 5-level paging
  ...