Commit e35a4a4e authored by Linus Torvalds's avatar Linus Torvalds
Browse files

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

Pull MTD updates from Miquel Raynal:
 "There has been a lot of activity in the MTD subsystem recently, with a
  number of SPI-NOR cleanups as well as the introduction of ECC engines
  that can be used by SPI controllers (hence a few SPI patches in here).

  Core MTD changes:
   - Replace the expert mode symbols with a single helper
   - Fix misuses of of_match_ptr()
   - Remove partid and partname debugfs files
   - tests: Fix eraseblock read speed miscalculation for lower partition
     sizes
   - TRX parser: Allow to use on MediaTek MIPS SoCs

  MTD driver changes:
   - spear_smi: use GFP_KERNEL
   - mchp48l640: Add SPI ID table
   - mchp23k256: Add SPI ID table
   - blkdevs: Avoid soft lockups with some mtd/spi devices
   - aspeed-smc: Improve probe resilience

  Hyperbus changes:
   - HBMC_AM654 should depend on ARCH_K3

  NAND core changes:
   - ECC:
      - Add infrastructure to support hardware engines
      - Add a new helper to retrieve the ECC context
      - Provide a helper to retrieve a pilelined engine device

  NAND-ECC changes:
   - Macronix ECC engine:
      - Add Macronix external ECC engine support
      - Support SPI pipelined mode
      - Make two read-only arrays static const
      - Fix compile test issue

  Raw NAND core changes:
   - Fix misuses of of_match_node()
   - Rework of_get_nand_bus_width()
   - Remove of_get_nand_on_flash_bbt() wrapper
   - Protect access to rawnand devices while in suspend
   - bindings: Document the wp-gpios property

  Rax NAND controller driver changes:
   - atmel: Fix refcount issue in atmel_nand_controller_init
   - nandsim:
      - Add NS_PAGE_BYTE_SHIFT macro to replace the repeat pattern
      - Merge repeat codes in ns_switch_state
      - Replace overflow check with kzalloc to single kcalloc
   - rockchip: Fix platform_get_irq.cocci warning
   - stm32_fmc2: Add NAND Write Protect support
   - pl353: Set the nand chip node as the flash node
   - brcmnand: Fix sparse warnings in bcma_nand
   - omap_elm: Remove redundant variable 'errors'
   - gpmi:
      - Support fast edo timings for mx28
      - Validate controller clock rate
      - Fix controller timings setting
   - brcmnand:
      - Add BCMA shim
      - BCMA controller uses command shift of 0
      - Allow platform data instantation
      - Add platform data structure for BCMA
      - Allow working without interrupts
      - Move OF operations out of brcmnand_init_cs()
      - Avoid pdev in brcmnand_init_cs()
      - Allow SoC to provide I/O operations
      - Assign soc as early as possible

  Onenand changes:
   - Check for error irq

  SPI-NAND core changes:
   - Delay a little bit the dirmap creation
   - Create direct mapping descriptors for ECC operations

  SPI-NAND driver changes:
   - macronix: Use random program load

  SPI NOR core changes:
   - Move vendor specific code out of the core into vendor drivers.
   - Unify all function and object names in the vendor modules.
   - Make setup() callback optional to improve readability.
   - Skip erase logic when the SPI_NOR_NO_ERASE flag is set at flash
     declaration.

  SPI changes:
   - Macronix SPI controller:
      - Fix the transmit path
      - Create a helper to configure the controller before an operation
      - Create a helper to ease the start of an operation
      - Add support for direct mapping
      - Add support for pipelined ECC operations
   - spi-mem:
      - Introduce a capability structure
      - Check the controller extra capabilities
      - cadence-quadspi/mxic: Provide capability structures
      - Kill the spi_mem_dtr_supports_op() helper
      - Add an ecc parameter to the spi_mem_op structure

  Binding changes:
   - Dropped mtd/cortina,gemini-flash.txt
   - Convert BCM47xx partitions to json-schema
   - Vendor prefixes: Clarify Macronix prefix
   - SPI NAND: Convert spi-nand description file to yaml
   - Raw NAND chip: Create a NAND chip description
   - Raw NAND controller:
      - Harmonize the property types
      - Fix a comment in the examples
      - Fix the reg property description
   - Describe Macronix NAND ECC engine
   - Macronix SPI controller:
      - Document the nand-ecc-engine property
      - Convert to yaml
      - The interrupt property is not mandatory"

* tag 'mtd/changes-for-5.18' of git://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux: (104 commits)
  mtd: nand: ecc: mxic: Fix compile test issue
  mtd: nand: mxic-ecc: make two read-only arrays static const
  mtd: hyperbus: HBMC_AM654 should depend on ARCH_K3
  mtd: core: Remove partid and partname debugfs files
  dt-bindings: mtd: partitions: convert BCM47xx to the json-schema
  mtd: tests: Fix eraseblock read speed miscalculation for lower partition sizes
  mtd: rawnand: atmel: fix refcount issue in atmel_nand_controller_init
  mtd: rawnand: rockchip: fix platform_get_irq.cocci warning
  mtd: spi-nor: Skip erase logic when SPI_NOR_NO_ERASE is set
  mtd: spi-nor: renumber flags
  mtd: spi-nor: slightly change code style in spi_nor_sr_ready()
  mtd: spi-nor: spansion: rename vendor specific functions and defines
  mtd: spi-nor: spansion: convert USE_CLSR to a manufacturer flag
  mtd: spi-nor: move all spansion specifics into spansion.c
  mtd: spi-nor: spansion: slightly rework control flow in late_init()
  mtd: spi-nor: micron-st: rename vendor specific functions and defines
  mtd: spi-nor: micron-st: convert USE_FSR to a manufacturer flag
  mtd: spi-nor: move all micron-st specifics into micron-st.c
  mtd: spi-nor: xilinx: correct the debug message
  mtd: spi-nor: xilinx: rename vendor specific functions and defines
  ...
parents 8eb48fc7 6cadd424
Loading
Loading
Loading
Loading
+0 −24
Original line number Diff line number Diff line
Flash device on Cortina Systems Gemini SoC

This flash is regular CFI compatible (Intel or AMD extended) flash chips with
some special bits that can be controlled by the machine's system controller.

Required properties:
- compatible : must be "cortina,gemini-flash", "cfi-flash";
- reg : memory address for the flash chip
- syscon : must be a phandle to the system controller
- bank-width : width in bytes of flash interface, should be <2>

For the rest of the properties, see mtd-physmap.yaml.

The device tree may optionally contain sub-nodes describing partitions of the
address space. See partition.txt for more detail.

Example:

flash@30000000 {
	compatible = "cortina,gemini-flash", "cfi-flash";
	reg = <0x30000000 0x01000000>;
	syscon = <&syscon>;
	bank-width = <2>;
};
+17 −1
Original line number Diff line number Diff line
@@ -44,7 +44,9 @@ properties:
              - numonyx,js28f128
              - sst,sst39vf320
              - xlnx,xps-mch-emc-2.00.a
          - const: cfi-flash
          - enum:
              - cfi-flash
              - jedec-flash
      - items:
          - enum:
              - cypress,cy7c1019dv33-10zsxi
@@ -127,6 +129,20 @@ required:
  - compatible
  - reg

if:
  properties:
    compatible:
      contains:
        const: cortina,gemini-flash
then:
  properties:
    syscon:
      $ref: /schemas/types.yaml#/definitions/phandle
      description:
        Phandle to the syscon controller
  required:
    - syscon

# FIXME: A parent bus may define timing properties
additionalProperties: true

+77 −0
Original line number Diff line number Diff line
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/mtd/mxicy,nand-ecc-engine.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: Macronix NAND ECC engine device tree bindings

maintainers:
  - Miquel Raynal <miquel.raynal@bootlin.com>

properties:
  compatible:
    const: mxicy,nand-ecc-engine-rev3

  reg:
    maxItems: 1

  clocks:
    maxItems: 1

  interrupts:
    maxItems: 1

required:
  - compatible
  - reg

additionalProperties: false

examples:
  - |
    /* External configuration */
    spi_controller0: spi@43c30000 {
        compatible = "mxicy,mx25f0a-spi";
        reg = <0x43c30000 0x10000>, <0xa0000000 0x4000000>;
        reg-names = "regs", "dirmap";
        clocks = <&clkwizard 0>, <&clkwizard 1>, <&clkc 15>;
        clock-names = "send_clk", "send_dly_clk", "ps_clk";
        #address-cells = <1>;
        #size-cells = <0>;

        flash@0 {
            compatible = "spi-nand";
            reg = <0>;
            nand-ecc-engine = <&ecc_engine0>;
        };
    };

    ecc_engine0: ecc@43c40000 {
        compatible = "mxicy,nand-ecc-engine-rev3";
        reg = <0x43c40000 0x10000>;
    };

  - |
    /* Pipelined configuration */
    spi_controller1: spi@43c30000 {
        compatible = "mxicy,mx25f0a-spi";
        reg = <0x43c30000 0x10000>, <0xa0000000 0x4000000>;
        reg-names = "regs", "dirmap";
        clocks = <&clkwizard 0>, <&clkwizard 1>, <&clkc 15>;
        clock-names = "send_clk", "send_dly_clk", "ps_clk";
        #address-cells = <1>;
        #size-cells = <0>;
        nand-ecc-engine = <&ecc_engine1>;

        flash@0 {
            compatible = "spi-nand";
            reg = <0>;
            nand-ecc-engine = <&spi_controller1>;
        };
    };

    ecc_engine1: ecc@43c40000 {
        compatible = "mxicy,nand-ecc-engine-rev3";
        reg = <0x43c40000 0x10000>;
    };
+70 −0
Original line number Diff line number Diff line
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/mtd/nand-chip.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: NAND Chip and NAND Controller Generic Binding

maintainers:
  - Miquel Raynal <miquel.raynal@bootlin.com>

description: |
  This file covers the generic description of a NAND chip. It implies that the
  bus interface should not be taken into account: both raw NAND devices and
  SPI-NAND devices are concerned by this description.

properties:
  reg:
    description:
      Contains the chip-select IDs.

  nand-ecc-engine:
    description: |
      A phandle on the hardware ECC engine if any. There are
      basically three possibilities:
      1/ The ECC engine is part of the NAND controller, in this
      case the phandle should reference the parent node.
      2/ The ECC engine is part of the NAND part (on-die), in this
      case the phandle should reference the node itself.
      3/ The ECC engine is external, in this case the phandle should
      reference the specific ECC engine node.
    $ref: /schemas/types.yaml#/definitions/phandle

  nand-use-soft-ecc-engine:
    description: Use a software ECC engine.
    type: boolean

  nand-no-ecc-engine:
    description: Do not use any ECC correction.
    type: boolean

  nand-ecc-algo:
    description:
      Desired ECC algorithm.
    $ref: /schemas/types.yaml#/definitions/string
    enum: [hamming, bch, rs]

  nand-ecc-strength:
    description:
      Maximum number of bits that can be corrected per ECC step.
    $ref: /schemas/types.yaml#/definitions/uint32
    minimum: 1

  nand-ecc-step-size:
    description:
      Number of data bytes covered by a single ECC step.
    $ref: /schemas/types.yaml#/definitions/uint32
    minimum: 1

  secure-regions:
    description:
      Regions in the NAND chip which are protected using a secure element
      like Trustzone. This property contains the start address and size of
      the secure regions present.
    $ref: /schemas/types.yaml#/definitions/uint64-matrix

required:
  - reg

additionalProperties: true
+16 −57
Original line number Diff line number Diff line
@@ -39,8 +39,6 @@ properties:
  ranges: true

  cs-gpios:
    minItems: 1
    maxItems: 8
    description:
      Array of chip-select available to the controller. The first
      entries are a 1:1 mapping of the available chip-select on the
@@ -48,51 +46,27 @@ properties:
      chip-select as needed may follow and should be phandles of GPIO
      lines. 'reg' entries of the NAND chip subnodes become indexes of
      this array when this property is present.
    minItems: 1
    maxItems: 8

patternProperties:
  "^nand@[a-f0-9]$":
    type: object
    $ref: "nand-chip.yaml#"

    properties:
      reg:
        description:
          Contains the native Ready/Busy IDs.

      nand-ecc-engine:
        allOf:
          - $ref: /schemas/types.yaml#/definitions/phandle
        description: |
          A phandle on the hardware ECC engine if any. There are
          basically three possibilities:
          1/ The ECC engine is part of the NAND controller, in this
          case the phandle should reference the parent node.
          2/ The ECC engine is part of the NAND part (on-die), in this
          case the phandle should reference the node itself.
          3/ The ECC engine is external, in this case the phandle should
          reference the specific ECC engine node.

      nand-use-soft-ecc-engine:
        type: boolean
        description: Use a software ECC engine.

      nand-no-ecc-engine:
        type: boolean
        description: Do not use any ECC correction.
          Contains the chip-select IDs.

      nand-ecc-placement:
        allOf:
          - $ref: /schemas/types.yaml#/definitions/string
          - enum: [ oob, interleaved ]
        description:
          Location of the ECC bytes. This location is unknown by default
          but can be explicitly set to "oob", if all ECC bytes are
          known to be stored in the OOB area, or "interleaved" if ECC
          bytes will be interleaved with regular data in the main area.

      nand-ecc-algo:
        description:
          Desired ECC algorithm.
        $ref: /schemas/types.yaml#/definitions/string
        enum: [hamming, bch, rs]
        enum: [ oob, interleaved ]

      nand-bus-width:
        description:
@@ -102,7 +76,6 @@ patternProperties:
        default: 8

      nand-on-flash-bbt:
        $ref: /schemas/types.yaml#/definitions/flag
        description:
          With this property, the OS will search the device for a Bad
          Block Table (BBT). If not found, it will create one, reserve
@@ -111,21 +84,9 @@ patternProperties:
          few pages of all the blocks will be scanned at boot time to
          find Bad Block Markers (BBM). These markers will help to
          build a volatile BBT in RAM.

      nand-ecc-strength:
        description:
          Maximum number of bits that can be corrected per ECC step.
        $ref: /schemas/types.yaml#/definitions/uint32
        minimum: 1

      nand-ecc-step-size:
        description:
          Number of data bytes covered by a single ECC step.
        $ref: /schemas/types.yaml#/definitions/uint32
        minimum: 1
        $ref: /schemas/types.yaml#/definitions/flag

      nand-ecc-maximize:
        $ref: /schemas/types.yaml#/definitions/flag
        description:
          Whether or not the ECC strength should be maximized. The
          maximum ECC strength is both controller and chip
@@ -134,18 +95,19 @@ patternProperties:
          constraint into account. This is particularly useful when
          only the in-band area is used by the upper layers, and you
          want to make your NAND as reliable as possible.
        $ref: /schemas/types.yaml#/definitions/flag

      nand-is-boot-medium:
        $ref: /schemas/types.yaml#/definitions/flag
        description:
          Whether or not the NAND chip is a boot medium. Drivers might
          use this information to select ECC algorithms supported by
          the boot ROM or similar restrictions.
        $ref: /schemas/types.yaml#/definitions/flag

      nand-rb:
        $ref: /schemas/types.yaml#/definitions/uint32-array
        description:
          Contains the native Ready/Busy IDs.
        $ref: /schemas/types.yaml#/definitions/uint32-array

      rb-gpios:
        description:
@@ -154,12 +116,12 @@ patternProperties:
          Ready/Busy pins. Active state refers to the NAND ready state and
          should be set to GPIOD_ACTIVE_HIGH unless the signal is inverted.

      secure-regions:
        $ref: /schemas/types.yaml#/definitions/uint64-matrix
      wp-gpios:
        description:
          Regions in the NAND chip which are protected using a secure element
          like Trustzone. This property contains the start address and size of
          the secure regions present.
          Contains one GPIO descriptor for the Write Protect pin.
          Active state refers to the NAND Write Protect state and should be
          set to GPIOD_ACTIVE_LOW unless the signal is inverted.
        maxItems: 1

    required:
      - reg
@@ -181,10 +143,7 @@ examples:

      nand@0 {
        reg = <0>; /* Native CS */
        nand-use-soft-ecc-engine;
        nand-ecc-algo = "bch";

        /* controller specific properties */
        /* NAND chip specific properties */
      };

      nand@1 {
Loading