projects/linux·commit e109f506

Merge tag 'mtd/for-5.7' of git://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux

e109f506 · Linus Torvalds <[email protected]> · 2020-04-02 16:45:46 -07:00

Pull MTD updates from Miquel Raynal:
 "MTD core changes:
   - Fix issue where write_cached_data() fails but write() still returns
     success

   - maps: sa1100-flash: Replace zero-length array with flexible-array
     member

   - phram: Fix a double free issue in error path

   - Convert fallthrough comments into statements

   - MAINTAINERS: Add the IRC channel to the MTD related subsystems

  Raw NAND core changes:
   - Add support for manufacturer specific suspend/resume operation

   - Add support for manufacturer specific lock/unlock operation

   - Replace zero-length array with flexible-array member

   - Fix a typo ("manufecturer")

   - Ensure nand_soft_waitrdy wait period is enough

  Raw NAND controller driver changes:
   - Brcmnand:
       * Add support for flash-edu for dma transfers (+ bindings)

   - Cadence:
       * Reinit completion before executing a new command
       * Change bad block marker size
       * Fix the calculation of the avaialble OOB size
       * Get meta data size from registers

   - Qualcom:
       * Use dma_request_chan() instead dma_request_slave_channel()
       * Release resources on failure within qcom_nandc_alloc()

   - Allwinner:
       * Use dma_request_chan() instead dma_request_slave_channel()

   - Marvell:
       * Use dma_request_chan() instead dma_request_slave_channel()
       * Release DMA channel on error

   - Freescale:
       * Use dma_request_chan() instead dma_request_slave_channel()

   - Macronix:
       * Add support for Macronix NAND randomizer (+ bindings)

   - Ams-delta:
       * Rename structures and functions to gpio_nand*
       * Make the driver custom I/O ready
       * Drop useless local variable
       * Support custom driver initialisation
       * Add module device tables
       * Handle more GPIO pins as optional
       * Make read pulses optional
       * Don't hardcode read/write pulse widths
       * Push inversion handling to gpiolib
       * Enable OF partition info support
       * Drop board specific partition info
       * Use struct gpio_nand_platdata
       * Write protect device during probe

   - Ingenic:
       * Use devm_platform_ioremap_resource()
       * Add dependency on MIPS || COMPILE_TEST

   - Denali:
       * Deassert write protect pin

   - ST:
       * Use dma_request_chan() instead dma_request_slave_channel()

  Raw NAND chip driver changes:
   - Toshiba:
       * Support reading the number of bitflips for BENAND (Built-in ECC NAND)

   - Macronix:
       * Add support for deep power down mode
       * Add support for block protection

  SPI-NAND core changes:
   - Do not erase the block before writing a bad block marker

   - Explicitly use MTD_OPS_RAW to write the bad block marker to OOB

   - Stop using spinand->oobbuf for buffering bad block markers

   - Rework detect procedure for different READ_ID operation

  SPI-NAND driver changes:
   - Toshiba:
       * Support for new Kioxia Serial NAND
       * Rename function name to change suffix and prefix (8Gbit)
       * Add comment about Kioxia ID

   - Micron:
       * Add new Micron SPI NAND devices with multiple dies
       * Add M70A series Micron SPI NAND devices
       * identify SPI NAND device with Continuous Read mode
       * Add new Micron SPI NAND devices
       * Describe the SPI NAND device MT29F2G01ABAGD
       * Generalize the OOB layout structure and function names

  SPI NOR core changes:
   - Move all the manufacturer specific quirks/code out of the core, to
     make the core logic more readable and thus ease maintenance.

   - Move the SFDP logic out of the core, it provides a better
     separation between the SFDP parsing and core logic.

   - Trim what is exposed in spi-nor.h. The SPI NOR controllers drivers
     must not be able to use structures that are meant just for the SPI
     NOR core.

   - Use the spi-mem direct mapping API to let advanced controllers
     optimize the read/write operations when they support direct
     mapping.

   - Add generic formula for the Status Register block protection
     handling. It fixes some long standing locking limitations and eases
     the addition of the 4bit block protection support.

   - Add block protection support for flashes with 4 block protection
     bits in the Status Register.

  SPI NOR controller drivers changes:
   - The mtk-quadspi driver is replaced by the new spi-mem spi-mtk-nor
     driver.

   - Merge tag 'mtk-mtd-spi-move' into spi-nor/next to avoid conflicts.

  HyperBus changes:
   - Print error msg when compatible is wrong or missing

   - Move mapping of direct access window from core to individual
     drivers"

* tag 'mtd/for-5.7' of git://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux: (103 commits)
  mtd: Convert fallthrough comments into statements
  mtd: rawnand: toshiba: Support reading the number of bitflips for BENAND (Built-in ECC NAND)
  MAINTAINERS: Add the IRC channel to the MTD related subsystems
  mtd: Fix issue where write_cached_data() fails but write() still returns success
  mtd: maps: sa1100-flash: Replace zero-length array with flexible-array member
  mtd: phram: fix a double free issue in error path
  mtd: spinand: toshiba: Support for new Kioxia Serial NAND
  mtd: spinand: toshiba: Rename function name to change suffix and prefix (8Gbit)
  mtd: rawnand: macronix: Add support for deep power down mode
  mtd: rawnand: Add support for manufacturer specific suspend/resume operation
  mtd: spi-nor: Enable locking for n25q512ax3/n25q512a
  mtd: spi-nor: Add SR 4bit block protection support
  mtd: spi-nor: Add generic formula for SR block protection handling
  mtd: spi-nor: Set all BP bits to one when lock_len == mtd->size
  mtd: spi-nor: controllers: aspeed-smc: Replace zero-length array with flexible-array member
  mtd: spi-nor: Clear WEL bit when erase or program errors occur
  MAINTAINERS: update entry after SPI NOR controller move
  mtd: spi-nor: Trim what is exposed in spi-nor.h
  mtd: spi-nor: Drop the MFR definitions
  mtd: spi-nor: Get rid of the now empty spi_nor_ids[] table
  ...
Commit
e109f506074152b7241bcbd3949a099e776cb802
Parents
e964f1e0 · 025a06c1

Merge commit. Changes below are compared with the first parent: e964f1e0.

Changes

94 files changed · +5528 −4005

FileStatusAddDelContent
Documentation/devicetree/bindings/mtd/brcm,brcmnand.txtmodified+5−5View file
Documentation/devicetree/bindings/mtd/nand-macronix.txtadded+27−0View file
MAINTAINERSmodified+7−1View file
arch/arm/mach-omap1/board-ams-delta.cmodified+43−4View file
arch/mips/boot/dts/brcm/bcm7425.dtsimodified+2−2View file
drivers/mtd/chips/cfi_cmdset_0001.cmodified+2−2View file
drivers/mtd/chips/cfi_cmdset_0002.cmodified+2−3View file
drivers/mtd/chips/cfi_cmdset_0020.cmodified+6−11View file
drivers/mtd/chips/cfi_util.cmodified+6−6View file
drivers/mtd/devices/block2mtd.cmodified+2−2View file
drivers/mtd/devices/phram.cmodified+11−8View file
drivers/mtd/hyperbus/hbmc-am654.cmodified+12−0View file
drivers/mtd/hyperbus/hyperbus-core.cmodified+3−12View file
drivers/mtd/inftlmount.cmodified+1−1View file
drivers/mtd/lpddr/lpddr_cmds.cmodified+1−3View file
drivers/mtd/maps/sa1100-flash.cmodified+2−3View file
drivers/mtd/mtdblock.cmodified+3−2View file
drivers/mtd/mtdchar.cmodified+7−5View file
drivers/mtd/mtdcore.cmodified+179−71View file
drivers/mtd/mtdpart.cmodified+177−518View file
drivers/mtd/nand/onenand/onenand_base.cmodified+1−1View file
drivers/mtd/nand/raw/ams-delta.cmodified+155−82View file
drivers/mtd/nand/raw/brcmnand/brcmnand.cmodified+287−6View file
drivers/mtd/nand/raw/cadence-nand-controller.cmodified+20−14View file
drivers/mtd/nand/raw/denali.cmodified+1−0View file
drivers/mtd/nand/raw/denali.hmodified+1−1View file
drivers/mtd/nand/raw/diskonchip.cmodified+2−2View file
drivers/mtd/nand/raw/fsl_elbc_nand.cmodified+1−2View file
drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.cmodified+11−10View file
drivers/mtd/nand/raw/ingenic/Kconfigmodified+1−0View file
drivers/mtd/nand/raw/ingenic/ingenic_ecc.cmodified+1−3View file
drivers/mtd/nand/raw/ingenic/ingenic_nand_drv.cmodified+1−1View file
drivers/mtd/nand/raw/ingenic/jz4725b_bch.cmodified+2−2View file
drivers/mtd/nand/raw/ingenic/jz4780_bch.cmodified+2−2View file
drivers/mtd/nand/raw/internals.hmodified+1−0View file
drivers/mtd/nand/raw/marvell_nand.cmodified+28−12View file
drivers/mtd/nand/raw/meson_nand.cmodified+1−1View file
drivers/mtd/nand/raw/mtk_nand.cmodified+1−1View file
drivers/mtd/nand/raw/nand_base.cmodified+58−13View file
drivers/mtd/nand/raw/nand_hynix.cmodified+1−1View file
drivers/mtd/nand/raw/nand_legacy.cmodified+2−4View file
drivers/mtd/nand/raw/nand_macronix.cmodified+227−0View file
drivers/mtd/nand/raw/nand_toshiba.cmodified+56−2View file
drivers/mtd/nand/raw/nandsim.cmodified+2−2View file
drivers/mtd/nand/raw/omap_elm.cmodified+4−4View file
drivers/mtd/nand/raw/qcom_nandc.cmodified+64−41View file
drivers/mtd/nand/raw/stm32_fmc2_nand.cmodified+37−7View file
drivers/mtd/nand/raw/sunxi_nand.cmodified+11−6View file
drivers/mtd/nand/spi/core.cmodified+71−33View file
drivers/mtd/nand/spi/gigadevice.cmodified+12−33View file
drivers/mtd/nand/spi/macronix.cmodified+6−24View file
drivers/mtd/nand/spi/micron.cmodified+142−30View file
drivers/mtd/nand/spi/paragon.cmodified+6−22View file
drivers/mtd/nand/spi/toshiba.cmodified+145−63View file
drivers/mtd/nand/spi/winbond.cmodified+6−28View file
drivers/mtd/spi-nor/Kconfigmodified+1−74View file
drivers/mtd/spi-nor/Makefilemodified+18−7View file
drivers/mtd/spi-nor/atmel.cadded+46−0View file
drivers/mtd/spi-nor/catalyst.cadded+29−0View file
drivers/mtd/spi-nor/controllers/Kconfigadded+75−0View file
drivers/mtd/spi-nor/controllers/Makefileadded+8−0View file
drivers/mtd/spi-nor/aspeed-smc.c → drivers/mtd/spi-nor/controllers/aspeed-smc.crenamed+2−2View file
drivers/mtd/spi-nor/cadence-quadspi.c → drivers/mtd/spi-nor/controllers/cadence-quadspi.crenamed+0−0View file
drivers/mtd/spi-nor/hisi-sfc.c → drivers/mtd/spi-nor/controllers/hisi-sfc.crenamed+0−0View file
drivers/mtd/spi-nor/intel-spi-pci.c → drivers/mtd/spi-nor/controllers/intel-spi-pci.crenamed+0−0View file
drivers/mtd/spi-nor/intel-spi-platform.c → drivers/mtd/spi-nor/controllers/intel-spi-platform.crenamed+0−0View file
drivers/mtd/spi-nor/intel-spi.c → drivers/mtd/spi-nor/controllers/intel-spi.crenamed+0−0View file
drivers/mtd/spi-nor/intel-spi.h → drivers/mtd/spi-nor/controllers/intel-spi.hrenamed+0−0View file
drivers/mtd/spi-nor/nxp-spifi.c → drivers/mtd/spi-nor/controllers/nxp-spifi.crenamed+0−0View file
drivers/mtd/spi-nor/spi-nor.c → drivers/mtd/spi-nor/core.crenamed+539−2507View file
drivers/mtd/spi-nor/core.hadded+441−0View file
drivers/mtd/spi-nor/eon.cadded+34−0View file
drivers/mtd/spi-nor/esmt.cadded+25−0View file
drivers/mtd/spi-nor/everspin.cadded+27−0View file
drivers/mtd/spi-nor/fujitsu.cadded+20−0View file
drivers/mtd/spi-nor/gigadevice.cadded+59−0View file
drivers/mtd/spi-nor/intel.cadded+32−0View file
drivers/mtd/spi-nor/issi.cadded+83−0View file
drivers/mtd/spi-nor/macronix.cadded+98−0View file
drivers/mtd/spi-nor/micron-st.cadded+157−0View file
drivers/mtd/spi-nor/sfdp.cadded+1204−0View file
drivers/mtd/spi-nor/sfdp.hadded+98−0View file
drivers/mtd/spi-nor/spansion.cadded+95−0View file
drivers/mtd/spi-nor/sst.cadded+151−0View file
drivers/mtd/spi-nor/winbond.cadded+112−0View file
drivers/mtd/spi-nor/xilinx.cadded+94−0View file
drivers/mtd/spi-nor/xmc.cadded+23−0View file
drivers/mtd/ubi/attach.cmodified+1−1View file
drivers/mtd/ubi/build.cmodified+2−2View file
include/linux/mtd/mtd.hmodified+115−10View file
include/linux/mtd/partitions.hmodified+0−1View file
include/linux/mtd/rawnand.hmodified+10−1View file
include/linux/mtd/spi-nor.hmodified+19−266View file
include/linux/mtd/spinand.hmodified+45−22View file

Only the first 600 diff lines are shown. Download the complete patch.

Documentation/devicetree/bindings/mtd/brcm,brcmnand.txt

View file
diff --git a/Documentation/devicetree/bindings/mtd/brcm,brcmnand.txt b/Documentation/devicetree/bindings/mtd/brcm,brcmnand.txt
index 82156dc..05651a6 100644
--- a/Documentation/devicetree/bindings/mtd/brcm,brcmnand.txt
+++ b/Documentation/devicetree/bindings/mtd/brcm,brcmnand.txt
@@ -35,11 +35,11 @@ Required properties:
(optional) NAND flash cache range (if at non-standard offset)
- reg-names : a list of the names corresponding to the previous register
ranges. Should contain "nand" and (optionally)
- "flash-dma" and/or "nand-cache".
-- interrupts : The NAND CTLRDY interrupt and (if Flash DMA is available)
- FLASH_DMA_DONE
-- interrupt-names : May be "nand_ctlrdy" or "flash_dma_done", if broken out as
- individual interrupts.
+ "flash-dma" or "flash-edu" and/or "nand-cache".
+- interrupts : The NAND CTLRDY interrupt, (if Flash DMA is available)
+ FLASH_DMA_DONE and if EDU is avaialble and used FLASH_EDU_DONE
+- interrupt-names : May be "nand_ctlrdy" or "flash_dma_done" or "flash_edu_done",
+ if broken out as individual interrupts.
May be "nand", if the SoC has the individual NAND
interrupts multiplexed behind another custom piece of
hardware

Documentation/devicetree/bindings/mtd/nand-macronix.txt

View file
diff --git a/Documentation/devicetree/bindings/mtd/nand-macronix.txt b/Documentation/devicetree/bindings/mtd/nand-macronix.txt
new file mode 100644
index 0000000..ffab28a
--- /dev/null
+++ b/Documentation/devicetree/bindings/mtd/nand-macronix.txt
@@ -0,0 +1,27 @@
+Macronix NANDs Device Tree Bindings
+-----------------------------------
+
+Macronix NANDs support randomizer operation for scrambling user data,
+which can be enabled with a SET_FEATURE. The penalty when using the
+randomizer are subpage accesses prohibited and more time period needed
+for program operation, i.e., tPROG 300us to 340us (randomizer enabled).
+Enabling the randomizer is a one time persistent and non reversible
+operation.
+
+For more high-reliability concern, if subpage write is not available
+with hardware ECC and not enabled at UBI level, then enabling the
+randomizer is recommended by default by adding a new specific property
+in children nodes.
+
+Required NAND chip properties in children mode:
+- randomizer enable: should be "mxic,enable-randomizer-otp"
+
+Example:
+
+ nand: nand-controller@unit-address {
+
+ nand@0 {
+ reg = <0>;
+ mxic,enable-randomizer-otp;
+ };
+ };

MAINTAINERS

View file
diff --git a/MAINTAINERS b/MAINTAINERS
index 1a84dee..8630116 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1945,7 +1945,7 @@ F: Documentation/devicetree/bindings/i2c/i2c-lpc2k.txt
F: arch/arm/boot/dts/lpc43*
F: drivers/i2c/busses/i2c-lpc2k.c
F: drivers/memory/pl172.c
-F: drivers/mtd/spi-nor/nxp-spifi.c
+F: drivers/mtd/spi-nor/controllers/nxp-spifi.c
F: drivers/rtc/rtc-lpc24xx.c
N: lpc18xx
@@ -7851,6 +7851,10 @@ F: Documentation/ABI/testing/debugfs-hyperv
HYPERBUS SUPPORT
M: Vignesh Raghavendra <[email protected]>
+Q: http://patchwork.ozlabs.org/project/linux-mtd/list/
+T: git git://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git cfi/next
+C: irc://irc.oftc.net/mtd
S: Supported
F: drivers/mtd/hyperbus/
F: include/linux/mtd/hyperbus.h
@@ -11552,6 +11556,7 @@ L: [email protected]
W: http://www.linux-mtd.infradead.org/
Q: http://patchwork.ozlabs.org/project/linux-mtd/list/
T: git git://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git nand/next
+C: irc://irc.oftc.net/mtd
S: Maintained
F: drivers/mtd/nand/
F: include/linux/mtd/*nand*.h
@@ -15835,6 +15840,7 @@ L: [email protected]
W: http://www.linux-mtd.infradead.org/
Q: http://patchwork.ozlabs.org/project/linux-mtd/list/
T: git git://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git spi-nor/next
+C: irc://irc.oftc.net/mtd
S: Maintained
F: drivers/mtd/spi-nor/
F: include/linux/mtd/spi-nor.h

arch/arm/mach-omap1/board-ams-delta.c

View file
diff --git a/arch/arm/mach-omap1/board-ams-delta.c b/arch/arm/mach-omap1/board-ams-delta.c
index a2aa7a1..8d32894 100644
--- a/arch/arm/mach-omap1/board-ams-delta.c
+++ b/arch/arm/mach-omap1/board-ams-delta.c
@@ -17,6 +17,8 @@
#include <linux/input.h>
#include <linux/interrupt.h>
#include <linux/leds.h>
+#include <linux/mtd/nand-gpio.h>
+#include <linux/mtd/partitions.h>
#include <linux/platform_device.h>
#include <linux/regulator/consumer.h>
#include <linux/regulator/fixed.h>
@@ -294,9 +296,42 @@ struct modem_private_data {
static struct modem_private_data modem_priv;
+/*
+ * Define partitions for flash device
+ */
+
+static struct mtd_partition partition_info[] = {
+ { .name = "Kernel",
+ .offset = 0,
+ .size = 3 * SZ_1M + SZ_512K },
+ { .name = "u-boot",
+ .offset = 3 * SZ_1M + SZ_512K,
+ .size = SZ_256K },
+ { .name = "u-boot params",
+ .offset = 3 * SZ_1M + SZ_512K + SZ_256K,
+ .size = SZ_256K },
+ { .name = "Amstrad LDR",
+ .offset = 4 * SZ_1M,
+ .size = SZ_256K },
+ { .name = "File system",
+ .offset = 4 * SZ_1M + 1 * SZ_256K,
+ .size = 27 * SZ_1M },
+ { .name = "PBL reserved",
+ .offset = 32 * SZ_1M - 3 * SZ_256K,
+ .size = 3 * SZ_256K },
+};
+
+static struct gpio_nand_platdata nand_platdata = {
+ .parts = partition_info,
+ .num_parts = ARRAY_SIZE(partition_info),
+};
+
static struct platform_device ams_delta_nand_device = {
.name = "ams-delta-nand",
.id = -1,
+ .dev = {
+ .platform_data = &nand_platdata,
+ },
};
#define OMAP_GPIO_LABEL "gpio-0-15"
@@ -306,10 +341,14 @@ static struct gpiod_lookup_table ams_delta_nand_gpio_table = {
.table = {
GPIO_LOOKUP(OMAP_GPIO_LABEL, AMS_DELTA_GPIO_PIN_NAND_RB, "rdy",
0),
- GPIO_LOOKUP(LATCH2_LABEL, LATCH2_PIN_NAND_NCE, "nce", 0),
- GPIO_LOOKUP(LATCH2_LABEL, LATCH2_PIN_NAND_NRE, "nre", 0),
- GPIO_LOOKUP(LATCH2_LABEL, LATCH2_PIN_NAND_NWP, "nwp", 0),
- GPIO_LOOKUP(LATCH2_LABEL, LATCH2_PIN_NAND_NWE, "nwe", 0),
+ GPIO_LOOKUP(LATCH2_LABEL, LATCH2_PIN_NAND_NCE, "nce",
+ GPIO_ACTIVE_LOW),
+ GPIO_LOOKUP(LATCH2_LABEL, LATCH2_PIN_NAND_NRE, "nre",
+ GPIO_ACTIVE_LOW),
+ GPIO_LOOKUP(LATCH2_LABEL, LATCH2_PIN_NAND_NWP, "nwp",
+ GPIO_ACTIVE_LOW),
+ GPIO_LOOKUP(LATCH2_LABEL, LATCH2_PIN_NAND_NWE, "nwe",
+ GPIO_ACTIVE_LOW),
GPIO_LOOKUP(LATCH2_LABEL, LATCH2_PIN_NAND_ALE, "ale", 0),
GPIO_LOOKUP(LATCH2_LABEL, LATCH2_PIN_NAND_CLE, "cle", 0),
GPIO_LOOKUP_IDX(OMAP_MPUIO_LABEL, 0, "data", 0, 0),

arch/mips/boot/dts/brcm/bcm7425.dtsi

View file
diff --git a/arch/mips/boot/dts/brcm/bcm7425.dtsi b/arch/mips/boot/dts/brcm/bcm7425.dtsi
index 410e61e..aa0b2d3 100644
--- a/arch/mips/boot/dts/brcm/bcm7425.dtsi
+++ b/arch/mips/boot/dts/brcm/bcm7425.dtsi
@@ -403,8 +403,8 @@
compatible = "brcm,brcmnand-v5.0", "brcm,brcmnand";
#address-cells = <1>;
#size-cells = <0>;
- reg-names = "nand";
- reg = <0x41b800 0x400>;
+ reg-names = "nand", "flash-edu";
+ reg = <0x41b800 0x400>, <0x41bc00 0x24>;
interrupt-parent = <&hif_l2_intc>;
interrupts = <24>;
status = "disabled";

drivers/mtd/chips/cfi_cmdset_0001.c

View file
diff --git a/drivers/mtd/chips/cfi_cmdset_0001.c b/drivers/mtd/chips/cfi_cmdset_0001.c
index 00a7948..142c0f9 100644
--- a/drivers/mtd/chips/cfi_cmdset_0001.c
+++ b/drivers/mtd/chips/cfi_cmdset_0001.c
@@ -834,7 +834,7 @@ static int chip_ready (struct map_info *map, struct flchip *chip, unsigned long
/* Someone else might have been playing with it. */
return -EAGAIN;
}
- /* Fall through */
+ fallthrough;
case FL_READY:
case FL_CFI_QUERY:
case FL_JEDEC_QUERY:
@@ -907,7 +907,7 @@ static int chip_ready (struct map_info *map, struct flchip *chip, unsigned long
/* Only if there's no operation suspended... */
if (mode == FL_READY && chip->oldstate == FL_READY)
return 0;
- /* Fall through */
+ fallthrough;
default:
sleep:
set_current_state(TASK_UNINTERRUPTIBLE);

drivers/mtd/chips/cfi_cmdset_0002.c

View file
diff --git a/drivers/mtd/chips/cfi_cmdset_0002.c b/drivers/mtd/chips/cfi_cmdset_0002.c
index 04b383b..a1f3e10 100644
--- a/drivers/mtd/chips/cfi_cmdset_0002.c
+++ b/drivers/mtd/chips/cfi_cmdset_0002.c
@@ -966,8 +966,7 @@ static int get_chip(struct map_info *map, struct flchip *chip, unsigned long adr
/* Only if there's no operation suspended... */
if (mode == FL_READY && chip->oldstate == FL_READY)
return 0;
- /* fall through */
-
+ fallthrough;
default:
sleep:
set_current_state(TASK_UNINTERRUPTIBLE);
@@ -2935,7 +2934,7 @@ static void cfi_amdstd_sync (struct mtd_info *mtd)
* as the whole point is that nobody can do anything
* with the chip now anyway.
*/
- /* fall through */
+ fallthrough;
case FL_SYNCING:
mutex_unlock(&chip->mutex);
break;

drivers/mtd/chips/cfi_cmdset_0020.c

View file
diff --git a/drivers/mtd/chips/cfi_cmdset_0020.c b/drivers/mtd/chips/cfi_cmdset_0020.c
index 54edae6..270322b 100644
--- a/drivers/mtd/chips/cfi_cmdset_0020.c
+++ b/drivers/mtd/chips/cfi_cmdset_0020.c
@@ -324,8 +324,7 @@ static inline int do_read_onechip(struct map_info *map, struct flchip *chip, lof
case FL_JEDEC_QUERY:
map_write(map, CMD(0x70), cmd_addr);
chip->state = FL_STATUS;
- /* Fall through */
-
+ fallthrough;
case FL_STATUS:
status = map_read(map, cmd_addr);
if (map_word_andequal(map, status, status_OK, status_OK)) {
@@ -462,8 +461,7 @@ static int do_write_buffer(struct map_info *map, struct flchip *chip,
#ifdef DEBUG_CFI_FEATURES
printk("%s: 1 status[%x]\n", __func__, map_read(map, cmd_adr));
#endif
- /* Fall through */
-
+ fallthrough;
case FL_STATUS:
status = map_read(map, cmd_adr);
if (map_word_andequal(map, status, status_OK, status_OK))
@@ -756,8 +754,7 @@ retry:
case FL_READY:
map_write(map, CMD(0x70), adr);
chip->state = FL_STATUS;
- /* Fall through */
-
+ fallthrough;
case FL_STATUS:
status = map_read(map, adr);
if (map_word_andequal(map, status, status_OK, status_OK))
@@ -998,7 +995,7 @@ static void cfi_staa_sync (struct mtd_info *mtd)
* as the whole point is that nobody can do anything
* with the chip now anyway.
*/
- /* Fall through */
+ fallthrough;
case FL_SYNCING:
mutex_unlock(&chip->mutex);
break;
@@ -1054,8 +1051,7 @@ retry:
case FL_READY:
map_write(map, CMD(0x70), adr);
chip->state = FL_STATUS;
- /* Fall through */
-
+ fallthrough;
case FL_STATUS:
status = map_read(map, adr);
if (map_word_andequal(map, status, status_OK, status_OK))
@@ -1201,8 +1197,7 @@ retry:
case FL_READY:
map_write(map, CMD(0x70), adr);
chip->state = FL_STATUS;
- /* Fall through */
-
+ fallthrough;
case FL_STATUS:
status = map_read(map, adr);
if (map_word_andequal(map, status, status_OK, status_OK))

drivers/mtd/chips/cfi_util.c

View file
diff --git a/drivers/mtd/chips/cfi_util.c b/drivers/mtd/chips/cfi_util.c
index e2d4db0..99b7986 100644
--- a/drivers/mtd/chips/cfi_util.c
+++ b/drivers/mtd/chips/cfi_util.c
@@ -109,13 +109,13 @@ map_word cfi_build_cmd(u_long cmd, struct map_info *map, struct cfi_private *cfi
case 8:
onecmd |= (onecmd << (chip_mode * 32));
#endif
- /* fall through */
+ fallthrough;
case 4:
onecmd |= (onecmd << (chip_mode * 16));
- /* fall through */
+ fallthrough;
case 2:
onecmd |= (onecmd << (chip_mode * 8));
- /* fall through */
+ fallthrough;
case 1:
;
}
@@ -165,13 +165,13 @@ unsigned long cfi_merge_status(map_word val, struct map_info *map,
case 8:
res |= (onestat >> (chip_mode * 32));
#endif
- /* fall through */
+ fallthrough;
case 4:
res |= (onestat >> (chip_mode * 16));
- /* fall through */
+ fallthrough;
case 2:
res |= (onestat >> (chip_mode * 8));
- /* fall through */
+ fallthrough;
case 1:
;
}

drivers/mtd/devices/block2mtd.c

View file
diff --git a/drivers/mtd/devices/block2mtd.c b/drivers/mtd/devices/block2mtd.c
index 36aa082..c08721b 100644
--- a/drivers/mtd/devices/block2mtd.c
+++ b/drivers/mtd/devices/block2mtd.c
@@ -329,10 +329,10 @@ static int ustrtoul(const char *cp, char **endp, unsigned int base)
switch (**endp) {
case 'G' :
result *= 1024;
- /* fall through */
+ fallthrough;
case 'M':
result *= 1024;
- /* fall through */
+ fallthrough;
case 'K':
case 'k':
result *= 1024;

drivers/mtd/devices/phram.c

View file
diff --git a/drivers/mtd/devices/phram.c b/drivers/mtd/devices/phram.c
index 931e5c2..087b5e8 100644
--- a/drivers/mtd/devices/phram.c
+++ b/drivers/mtd/devices/phram.c
@@ -148,10 +148,10 @@ static int parse_num64(uint64_t *num64, char *token)
switch (token[len - 2]) {
case 'G':
shift += 10;
- /* fall through */
+ fallthrough;
case 'M':
shift += 10;
- /* fall through */
+ fallthrough;
case 'k':
shift += 10;
token[len - 2] = 0;
@@ -243,22 +243,25 @@ static int phram_setup(const char *val)
ret = parse_num64(&start, token[1]);
if (ret) {
- kfree(name);
parse_err("illegal start address\n");
+ goto error;
}
ret = parse_num64(&len, token[2]);
if (ret) {
- kfree(name);
parse_err("illegal device length\n");
+ goto error;
}
ret = register_device(name, start, len);
- if (!ret)
- pr_info("%s device: %#llx at %#llx\n", name, len, start);
- else
- kfree(name);
+ if (ret)
+ goto error;
+
+ pr_info("%s device: %#llx at %#llx\n", name, len, start);
+ return 0;
+error:
+ kfree(name);
return ret;
}

drivers/mtd/hyperbus/hbmc-am654.c

View file
diff --git a/drivers/mtd/hyperbus/hbmc-am654.c b/drivers/mtd/hyperbus/hbmc-am654.c
index 08d543b..f350a08 100644
--- a/drivers/mtd/hyperbus/hbmc-am654.c
+++ b/drivers/mtd/hyperbus/hbmc-am654.c
@@ -11,6 +11,7 @@
#include <linux/mtd/mtd.h>
#include <linux/mux/consumer.h>
#include <linux/of.h>
+#include <linux/of_address.h>
#include <linux/platform_device.h>
#include <linux/pm_runtime.h>
#include <linux/types.h>
@@ -57,8 +58,10 @@ static const struct hyperbus_ops am654_hbmc_ops = {
static int am654_hbmc_probe(struct platform_device *pdev)
{
+ struct device_node *np = pdev->dev.of_node;
struct device *dev = &pdev->dev;
struct am654_hbmc_priv *priv;
+ struct resource res;
int ret;
priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
@@ -67,6 +70,10 @@ static int am654_hbmc_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, priv);
+ ret = of_address_to_resource(np, 0, &res);
+ if (ret)
+ return ret;
+
if (of_property_read_bool(dev->of_node, "mux-controls")) {
struct mux_control *control = devm_mux_control_get(dev, NULL);
@@ -88,6 +95,11 @@ static int am654_hbmc_probe(struct platform_device *pdev)
goto disable_pm;
}
+ priv->hbdev.map.size = resource_size(&res);
+ priv->hbdev.map.virt = devm_ioremap_resource(dev, &res);
+ if (IS_ERR(priv->hbdev.map.virt))
+ return PTR_ERR(priv->hbdev.map.virt);
+
priv->ctlr.dev = dev;
priv->ctlr.ops = &am654_hbmc_ops;
priv->hbdev.ctlr = &priv->ctlr;

drivers/mtd/hyperbus/hyperbus-core.c

View file
diff --git a/drivers/mtd/hyperbus/hyperbus-core.c b/drivers/mtd/hyperbus/hyperbus-core.c
index 6af9ea3..32685e8 100644
--- a/drivers/mtd/hyperbus/hyperbus-core.c
+++ b/drivers/mtd/hyperbus/hyperbus-core.c
@@ -10,7 +10,6 @@
#include <linux/mtd/map.h>
#include <linux/mtd/mtd.h>
#include <linux/of.h>
-#include <linux/of_address.h>
#include <linux/types.h>
static struct hyperbus_device *map_to_hbdev(struct map_info *map)
@@ -62,7 +61,6 @@ int hyperbus_register_device(struct hyperbus_device *hbdev)
struct hyperbus_ctlr *ctlr;
struct device_node *np;
struct map_info *map;
- struct resource res;
struct device *dev;
int ret;
@@ -73,22 +71,15 @@ int hyperbus_register_device(struct hyperbus_device *hbdev)
np = hbdev->np;
ctlr = hbdev->ctlr;
- if (!of_device_is_compatible(np, "cypress,hyperflash"))
+ if (!of_device_is_compatible(np, "cypress,hyperflash")) {
+ dev_err(ctlr->dev, "\"cypress,hyperflash\" compatible missing\n");
return -ENODEV;
+ }
hbdev->memtype = HYPERFLASH;
- ret = of_address_to_resource(np, 0, &res);
- if (ret)
- return ret;
-
dev = ctlr->dev;
map = &hbdev->map;
- map->size = resource_size(&res);
- map->virt = devm_ioremap_resource(dev, &res);
- if (IS_ERR(map->virt))
- return PTR_ERR(map->virt);
-
map->name = dev_name(dev);
map->bankwidth = 2;
map->device_node = np;

drivers/mtd/inftlmount.c

View file
diff --git a/drivers/mtd/inftlmount.c b/drivers/mtd/inftlmount.c
index 54b176d..af16d34 100644
--- a/drivers/mtd/inftlmount.c
+++ b/drivers/mtd/inftlmount.c
@@ -130,7 +130,7 @@ static int find_boot_record(struct INFTLrecord *inftl)
" NoOfBootImageBlocks = %d\n"
" NoOfBinaryPartitions = %d\n"
" NoOfBDTLPartitions = %d\n"
- " BlockMultiplerBits = %d\n"
+ " BlockMultiplierBits = %d\n"
" FormatFlgs = %d\n"
" OsakVersion = 0x%x\n"
" PercentUsed = %d\n",

drivers/mtd/lpddr/lpddr_cmds.c

View file
diff --git a/drivers/mtd/lpddr/lpddr_cmds.c b/drivers/mtd/lpddr/lpddr_cmds.c
index 1efc643..fb1cbc9 100644
--- a/drivers/mtd/lpddr/lpddr_cmds.c
+++ b/drivers/mtd/lpddr/lpddr_cmds.c
@@ -68,7 +68,6 @@ struct mtd_info *lpddr_cmdset(struct map_info *map)
shared = kmalloc_array(lpddr->numchips, sizeof(struct flchip_shared),
GFP_KERNEL);
if (!shared) {
- kfree(lpddr);
kfree(mtd);
return NULL;
}
@@ -305,8 +304,7 @@ static int chip_ready(struct map_info *map, struct flchip *chip, int mode)
/* Only if there's no operation suspended... */
if (mode == FL_READY && chip->oldstate == FL_READY)
return 0;
- /* fall through */
-
+ fallthrough;
default:
sleep:
set_current_state(TASK_UNINTERRUPTIBLE);

drivers/mtd/maps/sa1100-flash.c

View file
diff --git a/drivers/mtd/maps/sa1100-flash.c b/drivers/mtd/maps/sa1100-flash.c
index 47602af..d3d4e98 100644
--- a/drivers/mtd/maps/sa1100-flash.c
+++ b/drivers/mtd/maps/sa1100-flash.c
@@ -34,7 +34,7 @@ struct sa_subdev_info {
struct sa_info {
struct mtd_info *mtd;
int num_subdev;
- struct sa_subdev_info subdev[0];
+ struct sa_subdev_info subdev[];
};
static DEFINE_SPINLOCK(sa1100_vpp_lock);
@@ -81,8 +81,7 @@ static int sa1100_probe_subdev(struct sa_subdev_info *subdev, struct resource *r
default:
printk(KERN_WARNING "SA1100 flash: unknown base address "
"0x%08lx, assuming CS0\n", phys);
- /* Fall through */
-
+ fallthrough;
case SA1100_CS0_PHYS:
subdev->map.bankwidth = (MSC0 & MSC_RBW) ? 2 : 4;
break;

drivers/mtd/mtdblock.c

View file
diff --git a/drivers/mtd/mtdblock.c b/drivers/mtd/mtdblock.c
index c06b532..078e0f6 100644
--- a/drivers/mtd/mtdblock.c
+++ b/drivers/mtd/mtdblock.c
@@ -294,12 +294,13 @@ static void mtdblock_release(struct mtd_blktrans_dev *mbd)
static int mtdblock_flush(struct mtd_blktrans_dev *dev)
{
struct mtdblk_dev *mtdblk = container_of(dev, struct mtdblk_dev, mbd);
+ int ret;
mutex_lock(&mtdblk->cache_mutex);
- write_cached_data(mtdblk);
+ ret = write_cached_data(mtdblk);
mutex_unlock(&mtdblk->cache_mutex);
mtd_sync(dev->mtd);
- return 0;
+ return ret;
}
static void mtdblock_add_mtd(struct mtd_blktrans_ops *tr, struct mtd_info *mtd)

drivers/mtd/mtdchar.c

View file
diff --git a/drivers/mtd/mtdchar.c b/drivers/mtd/mtdchar.c
index b841008..c5935b2 100644
--- a/drivers/mtd/mtdchar.c
+++ b/drivers/mtd/mtdchar.c
@@ -349,6 +349,7 @@ static int mtdchar_writeoob(struct file *file, struct mtd_info *mtd,
uint64_t start, uint32_t length, void __user *ptr,
uint32_t __user *retp)
{
+ struct mtd_info *master = mtd_get_master(mtd);
struct mtd_file_info *mfi = file->private_data;
struct mtd_oob_ops ops = {};
uint32_t retlen;
@@ -360,7 +361,7 @@ static int mtdchar_writeoob(struct file *file, struct mtd_info *mtd,
if (length > 4096)
return -EINVAL;
- if (!mtd->_write_oob)
+ if (!master->_write_oob)
return -EOPNOTSUPP;
ops.ooblen = length;
@@ -586,6 +587,7 @@ static int mtdchar_blkpg_ioctl(struct mtd_info *mtd,
static int mtdchar_write_ioctl(struct mtd_info *mtd,
struct mtd_write_req __user *argp)
{
+ struct mtd_info *master = mtd_get_master(mtd);
struct mtd_write_req req;
struct mtd_oob_ops ops = {};
const void __user *usr_data, *usr_oob;
@@ -597,9 +599,8 @@ static int mtdchar_write_ioctl(struct mtd_info *mtd,
usr_data = (const void __user *)(uintptr_t)req.usr_data;
usr_oob = (const void __user *)(uintptr_t)req.usr_oob;
- if (!mtd->_write_oob)

This diff is incomplete. Download the complete patch.

drivers/mtd/mtdcore.c

View file

This diff is incomplete. Download the complete patch.

drivers/mtd/mtdpart.c

View file

This diff is incomplete. Download the complete patch.

drivers/mtd/nand/onenand/onenand_base.c

View file

This diff is incomplete. Download the complete patch.

drivers/mtd/nand/raw/ams-delta.c

View file

This diff is incomplete. Download the complete patch.

drivers/mtd/nand/raw/brcmnand/brcmnand.c

View file

This diff is incomplete. Download the complete patch.

drivers/mtd/nand/raw/cadence-nand-controller.c

View file

This diff is incomplete. Download the complete patch.

drivers/mtd/nand/raw/denali.c

View file

This diff is incomplete. Download the complete patch.

drivers/mtd/nand/raw/denali.h

View file

This diff is incomplete. Download the complete patch.

drivers/mtd/nand/raw/diskonchip.c

View file

This diff is incomplete. Download the complete patch.

drivers/mtd/nand/raw/fsl_elbc_nand.c

View file

This diff is incomplete. Download the complete patch.

drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c

View file

This diff is incomplete. Download the complete patch.

drivers/mtd/nand/raw/ingenic/Kconfig

View file

This diff is incomplete. Download the complete patch.

drivers/mtd/nand/raw/ingenic/ingenic_ecc.c

View file

This diff is incomplete. Download the complete patch.

drivers/mtd/nand/raw/ingenic/ingenic_nand_drv.c

View file

This diff is incomplete. Download the complete patch.

drivers/mtd/nand/raw/ingenic/jz4725b_bch.c

View file

This diff is incomplete. Download the complete patch.

drivers/mtd/nand/raw/ingenic/jz4780_bch.c

View file

This diff is incomplete. Download the complete patch.

drivers/mtd/nand/raw/internals.h

View file

This diff is incomplete. Download the complete patch.

drivers/mtd/nand/raw/marvell_nand.c

View file

This diff is incomplete. Download the complete patch.

drivers/mtd/nand/raw/meson_nand.c

View file

This diff is incomplete. Download the complete patch.

drivers/mtd/nand/raw/mtk_nand.c

View file

This diff is incomplete. Download the complete patch.

drivers/mtd/nand/raw/nand_base.c

View file

This diff is incomplete. Download the complete patch.

drivers/mtd/nand/raw/nand_hynix.c

View file

This diff is incomplete. Download the complete patch.

drivers/mtd/nand/raw/nand_legacy.c

View file

This diff is incomplete. Download the complete patch.

drivers/mtd/nand/raw/nand_macronix.c

View file

This diff is incomplete. Download the complete patch.

drivers/mtd/nand/raw/nand_toshiba.c

View file

This diff is incomplete. Download the complete patch.

drivers/mtd/nand/raw/nandsim.c

View file

This diff is incomplete. Download the complete patch.

drivers/mtd/nand/raw/omap_elm.c

View file

This diff is incomplete. Download the complete patch.

drivers/mtd/nand/raw/qcom_nandc.c

View file

This diff is incomplete. Download the complete patch.

drivers/mtd/nand/raw/stm32_fmc2_nand.c

View file

This diff is incomplete. Download the complete patch.

drivers/mtd/nand/raw/sunxi_nand.c

View file

This diff is incomplete. Download the complete patch.

drivers/mtd/nand/spi/core.c

View file

This diff is incomplete. Download the complete patch.

drivers/mtd/nand/spi/gigadevice.c

View file

This diff is incomplete. Download the complete patch.

drivers/mtd/nand/spi/macronix.c

View file

This diff is incomplete. Download the complete patch.

drivers/mtd/nand/spi/micron.c

View file

This diff is incomplete. Download the complete patch.

drivers/mtd/nand/spi/paragon.c

View file

This diff is incomplete. Download the complete patch.

drivers/mtd/nand/spi/toshiba.c

View file

This diff is incomplete. Download the complete patch.

drivers/mtd/nand/spi/winbond.c

View file

This diff is incomplete. Download the complete patch.

drivers/mtd/spi-nor/Kconfig

View file

This diff is incomplete. Download the complete patch.

drivers/mtd/spi-nor/Makefile

View file

This diff is incomplete. Download the complete patch.

drivers/mtd/spi-nor/atmel.c

View file

This diff is incomplete. Download the complete patch.

drivers/mtd/spi-nor/catalyst.c

View file

This diff is incomplete. Download the complete patch.

drivers/mtd/spi-nor/controllers/Kconfig

View file

This diff is incomplete. Download the complete patch.

drivers/mtd/spi-nor/controllers/Makefile

View file

This diff is incomplete. Download the complete patch.

drivers/mtd/spi-nor/controllers/aspeed-smc.c

View file

This diff is incomplete. Download the complete patch.

drivers/mtd/spi-nor/controllers/cadence-quadspi.c

View file

This diff is incomplete. Download the complete patch.

drivers/mtd/spi-nor/controllers/hisi-sfc.c

View file

This diff is incomplete. Download the complete patch.

drivers/mtd/spi-nor/controllers/intel-spi-pci.c

View file

This diff is incomplete. Download the complete patch.

drivers/mtd/spi-nor/controllers/intel-spi-platform.c

View file

This diff is incomplete. Download the complete patch.

drivers/mtd/spi-nor/controllers/intel-spi.c

View file

This diff is incomplete. Download the complete patch.

drivers/mtd/spi-nor/controllers/intel-spi.h

View file

This diff is incomplete. Download the complete patch.

drivers/mtd/spi-nor/controllers/nxp-spifi.c

View file

This diff is incomplete. Download the complete patch.

drivers/mtd/spi-nor/core.c

View file

This diff is incomplete. Download the complete patch.

drivers/mtd/spi-nor/core.h

View file

This diff is incomplete. Download the complete patch.

drivers/mtd/spi-nor/eon.c

View file

This diff is incomplete. Download the complete patch.

drivers/mtd/spi-nor/esmt.c

View file

This diff is incomplete. Download the complete patch.

drivers/mtd/spi-nor/everspin.c

View file

This diff is incomplete. Download the complete patch.

drivers/mtd/spi-nor/fujitsu.c

View file

This diff is incomplete. Download the complete patch.

drivers/mtd/spi-nor/gigadevice.c

View file

This diff is incomplete. Download the complete patch.

drivers/mtd/spi-nor/intel.c

View file

This diff is incomplete. Download the complete patch.

drivers/mtd/spi-nor/issi.c

View file

This diff is incomplete. Download the complete patch.

drivers/mtd/spi-nor/macronix.c

View file

This diff is incomplete. Download the complete patch.

drivers/mtd/spi-nor/micron-st.c

View file

This diff is incomplete. Download the complete patch.

drivers/mtd/spi-nor/sfdp.c

View file

This diff is incomplete. Download the complete patch.

drivers/mtd/spi-nor/sfdp.h

View file

This diff is incomplete. Download the complete patch.

drivers/mtd/spi-nor/spansion.c

View file

This diff is incomplete. Download the complete patch.

drivers/mtd/spi-nor/sst.c

View file

This diff is incomplete. Download the complete patch.

drivers/mtd/spi-nor/winbond.c

View file

This diff is incomplete. Download the complete patch.

drivers/mtd/spi-nor/xilinx.c

View file

This diff is incomplete. Download the complete patch.

drivers/mtd/spi-nor/xmc.c

View file

This diff is incomplete. Download the complete patch.

drivers/mtd/ubi/attach.c

View file

This diff is incomplete. Download the complete patch.

drivers/mtd/ubi/build.c

View file

This diff is incomplete. Download the complete patch.

include/linux/mtd/mtd.h

View file

This diff is incomplete. Download the complete patch.

include/linux/mtd/partitions.h

View file

This diff is incomplete. Download the complete patch.

include/linux/mtd/rawnand.h

View file

This diff is incomplete. Download the complete patch.

include/linux/mtd/spi-nor.h

View file

This diff is incomplete. Download the complete patch.

include/linux/mtd/spinand.h

View file

This diff is incomplete. Download the complete patch.