162306a36Sopenharmony_ci# SPDX-License-Identifier: GPL-2.0-only
262306a36Sopenharmony_ci%YAML 1.2
362306a36Sopenharmony_ci---
462306a36Sopenharmony_ci$id: http://devicetree.org/schemas/mtd/jedec,spi-nor.yaml#
562306a36Sopenharmony_ci$schema: http://devicetree.org/meta-schemas/core.yaml#
662306a36Sopenharmony_ci
762306a36Sopenharmony_cititle: SPI NOR flash ST M25Pxx (and similar) serial flash chips
862306a36Sopenharmony_ci
962306a36Sopenharmony_cimaintainers:
1062306a36Sopenharmony_ci  - Rob Herring <robh@kernel.org>
1162306a36Sopenharmony_ci
1262306a36Sopenharmony_ciallOf:
1362306a36Sopenharmony_ci  - $ref: mtd.yaml#
1462306a36Sopenharmony_ci  - $ref: /schemas/spi/spi-peripheral-props.yaml#
1562306a36Sopenharmony_ci
1662306a36Sopenharmony_ciproperties:
1762306a36Sopenharmony_ci  compatible:
1862306a36Sopenharmony_ci    oneOf:
1962306a36Sopenharmony_ci      - items:
2062306a36Sopenharmony_ci          - pattern: "^((((micron|spansion|st),)?\
2162306a36Sopenharmony_ci              (m25p(40|80|16|32|64|128)|\
2262306a36Sopenharmony_ci              n25q(32b|064|128a11|128a13|256a|512a|164k)))|\
2362306a36Sopenharmony_ci              atmel,at25df(321a|641|081a)|\
2462306a36Sopenharmony_ci              everspin,mr25h(10|40|128|256)|\
2562306a36Sopenharmony_ci              (mxicy|macronix),mx25l(4005a|1606e|6405d|8005|12805d|25635e)|\
2662306a36Sopenharmony_ci              (mxicy|macronix),mx25u(4033|4035)|\
2762306a36Sopenharmony_ci              (spansion,)?s25fl(128s|256s1|512s|008k|064k|164k)|\
2862306a36Sopenharmony_ci              (sst|microchip),sst25vf(016b|032b|040b)|\
2962306a36Sopenharmony_ci              (sst,)?sst26wf016b|\
3062306a36Sopenharmony_ci              (sst,)?sst25wf(040b|080)|\
3162306a36Sopenharmony_ci              winbond,w25x(80|32)|\
3262306a36Sopenharmony_ci              (winbond,)?w25q(16|32(w|dw)?|64(dw)?|80bl|128(fw)?|256))$"
3362306a36Sopenharmony_ci          - const: jedec,spi-nor
3462306a36Sopenharmony_ci      - items:
3562306a36Sopenharmony_ci          - enum:
3662306a36Sopenharmony_ci              - issi,is25lp016d
3762306a36Sopenharmony_ci              - micron,mt25qu02g
3862306a36Sopenharmony_ci              - mxicy,mx25r1635f
3962306a36Sopenharmony_ci              - mxicy,mx25u6435f
4062306a36Sopenharmony_ci              - mxicy,mx25v8035f
4162306a36Sopenharmony_ci              - spansion,s25sl12801
4262306a36Sopenharmony_ci              - spansion,s25fs512s
4362306a36Sopenharmony_ci          - const: jedec,spi-nor
4462306a36Sopenharmony_ci      - const: jedec,spi-nor
4562306a36Sopenharmony_ci    description:
4662306a36Sopenharmony_ci      SPI NOR flashes compatible with the JEDEC SFDP standard or which may be
4762306a36Sopenharmony_ci      identified with the READ ID opcode (0x9F) do not deserve a specific
4862306a36Sopenharmony_ci      compatible. They should instead only be matched against the generic
4962306a36Sopenharmony_ci      "jedec,spi-nor" compatible.
5062306a36Sopenharmony_ci
5162306a36Sopenharmony_ci  reg:
5262306a36Sopenharmony_ci    minItems: 1
5362306a36Sopenharmony_ci    maxItems: 2
5462306a36Sopenharmony_ci
5562306a36Sopenharmony_ci  m25p,fast-read:
5662306a36Sopenharmony_ci    type: boolean
5762306a36Sopenharmony_ci    description:
5862306a36Sopenharmony_ci      Use the "fast read" opcode to read data from the chip instead of the usual
5962306a36Sopenharmony_ci      "read" opcode. This opcode is not supported by all chips and support for
6062306a36Sopenharmony_ci      it can not be detected at runtime. Refer to your chips' datasheet to check
6162306a36Sopenharmony_ci      if this is supported by your chip.
6262306a36Sopenharmony_ci
6362306a36Sopenharmony_ci  broken-flash-reset:
6462306a36Sopenharmony_ci    type: boolean
6562306a36Sopenharmony_ci    description:
6662306a36Sopenharmony_ci      Some flash devices utilize stateful addressing modes (e.g., for 32-bit
6762306a36Sopenharmony_ci      addressing) which need to be managed carefully by a system. Because these
6862306a36Sopenharmony_ci      sorts of flash don't have a standardized software reset command, and
6962306a36Sopenharmony_ci      because some systems don't toggle the flash RESET# pin upon system reset
7062306a36Sopenharmony_ci      (if the pin even exists at all), there are systems which cannot reboot
7162306a36Sopenharmony_ci      properly if the flash is left in the "wrong" state. This boolean flag can
7262306a36Sopenharmony_ci      be used on such systems, to denote the absence of a reliable reset
7362306a36Sopenharmony_ci      mechanism.
7462306a36Sopenharmony_ci
7562306a36Sopenharmony_ci  no-wp:
7662306a36Sopenharmony_ci    type: boolean
7762306a36Sopenharmony_ci    description:
7862306a36Sopenharmony_ci      The status register write disable (SRWD) bit in status register, combined
7962306a36Sopenharmony_ci      with the WP# signal, provides hardware data protection for the device. When
8062306a36Sopenharmony_ci      the SRWD bit is set to 1, and the WP# signal is either driven LOW or hard
8162306a36Sopenharmony_ci      strapped to LOW, the status register nonvolatile bits become read-only and
8262306a36Sopenharmony_ci      the WRITE STATUS REGISTER operation will not execute. The only way to exit
8362306a36Sopenharmony_ci      this hardware-protected mode is to drive WP# HIGH. If the WP# signal of the
8462306a36Sopenharmony_ci      flash device is not connected or is wrongly tied to GND (that includes internal
8562306a36Sopenharmony_ci      pull-downs) then status register permanently becomes read-only as the SRWD bit
8662306a36Sopenharmony_ci      cannot be reset. This boolean flag can be used on such systems to avoid setting
8762306a36Sopenharmony_ci      the SRWD bit while writing the status register. WP# signal hard strapped to GND
8862306a36Sopenharmony_ci      can be a valid use case.
8962306a36Sopenharmony_ci
9062306a36Sopenharmony_ci  reset-gpios:
9162306a36Sopenharmony_ci    description:
9262306a36Sopenharmony_ci      A GPIO line connected to the RESET (active low) signal of the device.
9362306a36Sopenharmony_ci      If "broken-flash-reset" is present then having this property does not
9462306a36Sopenharmony_ci      make any difference.
9562306a36Sopenharmony_ci
9662306a36Sopenharmony_ci  spi-cpol: true
9762306a36Sopenharmony_ci  spi-cpha: true
9862306a36Sopenharmony_ci
9962306a36Sopenharmony_cidependencies:
10062306a36Sopenharmony_ci  spi-cpol: [ spi-cpha ]
10162306a36Sopenharmony_ci  spi-cpha: [ spi-cpol ]
10262306a36Sopenharmony_ci
10362306a36Sopenharmony_ciunevaluatedProperties: false
10462306a36Sopenharmony_ci
10562306a36Sopenharmony_ciexamples:
10662306a36Sopenharmony_ci  - |
10762306a36Sopenharmony_ci    #include <dt-bindings/gpio/gpio.h>
10862306a36Sopenharmony_ci    spi {
10962306a36Sopenharmony_ci        #address-cells = <1>;
11062306a36Sopenharmony_ci        #size-cells = <0>;
11162306a36Sopenharmony_ci
11262306a36Sopenharmony_ci        flash@0 {
11362306a36Sopenharmony_ci            compatible = "spansion,m25p80", "jedec,spi-nor";
11462306a36Sopenharmony_ci            reg = <0>;
11562306a36Sopenharmony_ci            spi-max-frequency = <40000000>;
11662306a36Sopenharmony_ci            m25p,fast-read;
11762306a36Sopenharmony_ci            reset-gpios = <&gpio 12 GPIO_ACTIVE_LOW>;
11862306a36Sopenharmony_ci        };
11962306a36Sopenharmony_ci    };
12062306a36Sopenharmony_ci...
121