xref: /freebsd-src/sys/contrib/device-tree/Bindings/spi/mediatek,spi-mtk-snfi.yaml (revision cb7aa33ac6cd46a5434798e50363136e64f3ae98)
1d5b0e70fSEmmanuel Vadot# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2d5b0e70fSEmmanuel Vadot%YAML 1.2
3d5b0e70fSEmmanuel Vadot---
4d5b0e70fSEmmanuel Vadot$id: http://devicetree.org/schemas/spi/mediatek,spi-mtk-snfi.yaml#
5d5b0e70fSEmmanuel Vadot$schema: http://devicetree.org/meta-schemas/core.yaml#
6d5b0e70fSEmmanuel Vadot
7d5b0e70fSEmmanuel Vadottitle: SPI-NAND flash controller for MediaTek ARM SoCs
8d5b0e70fSEmmanuel Vadot
9d5b0e70fSEmmanuel Vadotmaintainers:
10d5b0e70fSEmmanuel Vadot  - Chuanhong Guo <gch981213@gmail.com>
11d5b0e70fSEmmanuel Vadot
12d5b0e70fSEmmanuel Vadotdescription: |
13d5b0e70fSEmmanuel Vadot  The Mediatek SPI-NAND flash controller is an extended version of
14d5b0e70fSEmmanuel Vadot  the Mediatek NAND flash controller. It can perform standard SPI
15d5b0e70fSEmmanuel Vadot  instructions with one continuous write and one read for up-to 0xa0
16d5b0e70fSEmmanuel Vadot  bytes. It also supports typical SPI-NAND page cache operations
17d5b0e70fSEmmanuel Vadot  in single, dual or quad IO mode with pipelined ECC encoding/decoding
18d5b0e70fSEmmanuel Vadot  using the accompanying ECC engine. There should be only one spi
19d5b0e70fSEmmanuel Vadot  slave device following generic spi bindings.
20d5b0e70fSEmmanuel Vadot
21d5b0e70fSEmmanuel Vadotproperties:
22d5b0e70fSEmmanuel Vadot  compatible:
23d5b0e70fSEmmanuel Vadot    enum:
24d5b0e70fSEmmanuel Vadot      - mediatek,mt7622-snand
25d5b0e70fSEmmanuel Vadot      - mediatek,mt7629-snand
26*cb7aa33aSEmmanuel Vadot      - mediatek,mt7986-snand
27d5b0e70fSEmmanuel Vadot
28d5b0e70fSEmmanuel Vadot  reg:
29d5b0e70fSEmmanuel Vadot    items:
30d5b0e70fSEmmanuel Vadot      - description: core registers
31d5b0e70fSEmmanuel Vadot
32d5b0e70fSEmmanuel Vadot  interrupts:
33d5b0e70fSEmmanuel Vadot    items:
34d5b0e70fSEmmanuel Vadot      - description: NFI interrupt
35d5b0e70fSEmmanuel Vadot
36d5b0e70fSEmmanuel Vadot  clocks:
37*cb7aa33aSEmmanuel Vadot    minItems: 2
38*cb7aa33aSEmmanuel Vadot    maxItems: 3
39d5b0e70fSEmmanuel Vadot
40d5b0e70fSEmmanuel Vadot  clock-names:
41*cb7aa33aSEmmanuel Vadot    minItems: 2
42*cb7aa33aSEmmanuel Vadot    maxItems: 3
43d5b0e70fSEmmanuel Vadot
44d5b0e70fSEmmanuel Vadot  nand-ecc-engine:
45d5b0e70fSEmmanuel Vadot    description: device-tree node of the accompanying ECC engine.
46d5b0e70fSEmmanuel Vadot    $ref: /schemas/types.yaml#/definitions/phandle
47d5b0e70fSEmmanuel Vadot
48*cb7aa33aSEmmanuel Vadot  mediatek,rx-latch-latency-ns:
49*cb7aa33aSEmmanuel Vadot    description: Data read latch latency, unit is nanoseconds.
50*cb7aa33aSEmmanuel Vadot
51d5b0e70fSEmmanuel Vadotrequired:
52d5b0e70fSEmmanuel Vadot  - compatible
53d5b0e70fSEmmanuel Vadot  - reg
54d5b0e70fSEmmanuel Vadot  - interrupts
55d5b0e70fSEmmanuel Vadot  - clocks
56d5b0e70fSEmmanuel Vadot  - clock-names
57d5b0e70fSEmmanuel Vadot  - nand-ecc-engine
58d5b0e70fSEmmanuel Vadot
59*cb7aa33aSEmmanuel VadotallOf:
60*cb7aa33aSEmmanuel Vadot  - $ref: /schemas/spi/spi-controller.yaml#
61*cb7aa33aSEmmanuel Vadot  - if:
62*cb7aa33aSEmmanuel Vadot      properties:
63*cb7aa33aSEmmanuel Vadot        compatible:
64*cb7aa33aSEmmanuel Vadot          enum:
65*cb7aa33aSEmmanuel Vadot            - mediatek,mt7622-snand
66*cb7aa33aSEmmanuel Vadot            - mediatek,mt7629-snand
67*cb7aa33aSEmmanuel Vadot    then:
68*cb7aa33aSEmmanuel Vadot      properties:
69*cb7aa33aSEmmanuel Vadot        clocks:
70*cb7aa33aSEmmanuel Vadot          items:
71*cb7aa33aSEmmanuel Vadot            - description: clock used for the controller
72*cb7aa33aSEmmanuel Vadot            - description: clock used for the SPI bus
73*cb7aa33aSEmmanuel Vadot        clock-names:
74*cb7aa33aSEmmanuel Vadot          items:
75*cb7aa33aSEmmanuel Vadot            - const: nfi_clk
76*cb7aa33aSEmmanuel Vadot            - const: pad_clk
77*cb7aa33aSEmmanuel Vadot
78*cb7aa33aSEmmanuel Vadot  - if:
79*cb7aa33aSEmmanuel Vadot      properties:
80*cb7aa33aSEmmanuel Vadot        compatible:
81*cb7aa33aSEmmanuel Vadot          enum:
82*cb7aa33aSEmmanuel Vadot            - mediatek,mt7986-snand
83*cb7aa33aSEmmanuel Vadot    then:
84*cb7aa33aSEmmanuel Vadot      properties:
85*cb7aa33aSEmmanuel Vadot        clocks:
86*cb7aa33aSEmmanuel Vadot          items:
87*cb7aa33aSEmmanuel Vadot            - description: clock used for the controller
88*cb7aa33aSEmmanuel Vadot            - description: clock used for the SPI bus
89*cb7aa33aSEmmanuel Vadot            - description: clock used for the AHB bus
90*cb7aa33aSEmmanuel Vadot        clock-names:
91*cb7aa33aSEmmanuel Vadot          items:
92*cb7aa33aSEmmanuel Vadot            - const: nfi_clk
93*cb7aa33aSEmmanuel Vadot            - const: pad_clk
94*cb7aa33aSEmmanuel Vadot            - const: nfi_hclk
95*cb7aa33aSEmmanuel Vadot
96d5b0e70fSEmmanuel VadotunevaluatedProperties: false
97d5b0e70fSEmmanuel Vadot
98d5b0e70fSEmmanuel Vadotexamples:
99d5b0e70fSEmmanuel Vadot  - |
100d5b0e70fSEmmanuel Vadot    #include <dt-bindings/interrupt-controller/irq.h>
101d5b0e70fSEmmanuel Vadot    #include <dt-bindings/interrupt-controller/arm-gic.h>
102d5b0e70fSEmmanuel Vadot    #include <dt-bindings/clock/mt7622-clk.h>
103d5b0e70fSEmmanuel Vadot    soc {
104d5b0e70fSEmmanuel Vadot      #address-cells = <2>;
105d5b0e70fSEmmanuel Vadot      #size-cells = <2>;
106d5b0e70fSEmmanuel Vadot      snfi: spi@1100d000 {
107d5b0e70fSEmmanuel Vadot        compatible = "mediatek,mt7622-snand";
108d5b0e70fSEmmanuel Vadot        reg = <0 0x1100d000 0 0x1000>;
109d5b0e70fSEmmanuel Vadot        interrupts = <GIC_SPI 96 IRQ_TYPE_LEVEL_LOW>;
110d5b0e70fSEmmanuel Vadot        clocks = <&pericfg CLK_PERI_NFI_PD>, <&pericfg CLK_PERI_SNFI_PD>;
111d5b0e70fSEmmanuel Vadot        clock-names = "nfi_clk", "pad_clk";
112d5b0e70fSEmmanuel Vadot        nand-ecc-engine = <&bch>;
113d5b0e70fSEmmanuel Vadot        #address-cells = <1>;
114d5b0e70fSEmmanuel Vadot        #size-cells = <0>;
115d5b0e70fSEmmanuel Vadot
116d5b0e70fSEmmanuel Vadot        flash@0 {
117d5b0e70fSEmmanuel Vadot          compatible = "spi-nand";
118d5b0e70fSEmmanuel Vadot          reg = <0>;
119d5b0e70fSEmmanuel Vadot          spi-tx-bus-width = <4>;
120d5b0e70fSEmmanuel Vadot          spi-rx-bus-width = <4>;
121d5b0e70fSEmmanuel Vadot          nand-ecc-engine = <&snfi>;
122d5b0e70fSEmmanuel Vadot        };
123d5b0e70fSEmmanuel Vadot      };
124d5b0e70fSEmmanuel Vadot    };
125