xref: /freebsd/sys/contrib/device-tree/Bindings/mtd/mediatek,mtk-nfc.yaml (revision d0b2dbfa0ecf2bbc9709efc5e20baf8e4b44bbbf)
1# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2%YAML 1.2
3---
4$id: http://devicetree.org/schemas/mtd/mediatek,mtk-nfc.yaml#
5$schema: http://devicetree.org/meta-schemas/core.yaml#
6
7title: MediaTek(MTK) SoCs raw NAND FLASH controller (NFC)
8
9maintainers:
10  - Xiangsheng Hou <xiangsheng.hou@mediatek.com>
11
12properties:
13  compatible:
14    enum:
15      - mediatek,mt2701-nfc
16      - mediatek,mt2712-nfc
17      - mediatek,mt7622-nfc
18
19  reg:
20    items:
21      - description: Base physical address and size of NFI.
22
23  interrupts:
24    items:
25      - description: NFI interrupt
26
27  clocks:
28    items:
29      - description: clock used for the controller
30      - description: clock used for the pad
31
32  clock-names:
33    items:
34      - const: nfi_clk
35      - const: pad_clk
36
37  ecc-engine:
38    description: device-tree node of the required ECC engine.
39    $ref: /schemas/types.yaml#/definitions/phandle
40
41patternProperties:
42  "^nand@[a-f0-9]$":
43    $ref: nand-chip.yaml#
44    unevaluatedProperties: false
45    properties:
46      reg:
47        maximum: 1
48      nand-on-flash-bbt: true
49      nand-ecc-mode:
50        const: hw
51
52allOf:
53  - $ref: nand-controller.yaml#
54
55  - if:
56      properties:
57        compatible:
58          contains:
59            const: mediatek,mt2701-nfc
60    then:
61      patternProperties:
62        "^nand@[a-f0-9]$":
63          properties:
64            nand-ecc-step-size:
65              enum: [ 512, 1024 ]
66            nand-ecc-strength:
67              enum: [4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 28, 32, 36,
68                     40, 44, 48, 52, 56, 60]
69
70  - if:
71      properties:
72        compatible:
73          contains:
74            const: mediatek,mt2712-nfc
75    then:
76      patternProperties:
77        "^nand@[a-f0-9]$":
78          properties:
79            nand-ecc-step-size:
80              enum: [ 512, 1024 ]
81            nand-ecc-strength:
82              enum: [4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 28, 32, 36,
83                     40, 44, 48, 52, 56, 60, 68, 72, 80]
84
85  - if:
86      properties:
87        compatible:
88          contains:
89            const: mediatek,mt7622-nfc
90    then:
91      patternProperties:
92        "^nand@[a-f0-9]$":
93          properties:
94            nand-ecc-step-size:
95              const: 512
96            nand-ecc-strength:
97              enum: [4, 6, 8, 10, 12]
98
99required:
100  - compatible
101  - reg
102  - interrupts
103  - clocks
104  - clock-names
105  - ecc-engine
106
107unevaluatedProperties: false
108
109examples:
110  - |
111    #include <dt-bindings/clock/mt2701-clk.h>
112    #include <dt-bindings/interrupt-controller/arm-gic.h>
113    #include <dt-bindings/interrupt-controller/irq.h>
114
115    soc {
116        #address-cells = <2>;
117        #size-cells = <2>;
118
119        nand-controller@1100d000 {
120            compatible = "mediatek,mt2701-nfc";
121            reg = <0 0x1100d000 0 0x1000>;
122            interrupts = <GIC_SPI 56 IRQ_TYPE_LEVEL_LOW>;
123            clocks = <&pericfg CLK_PERI_NFI>,
124                     <&pericfg CLK_PERI_NFI_PAD>;
125            clock-names = "nfi_clk", "pad_clk";
126            ecc-engine = <&bch>;
127            #address-cells = <1>;
128            #size-cells = <0>;
129
130            nand@0 {
131                reg = <0>;
132
133                nand-on-flash-bbt;
134                nand-ecc-mode = "hw";
135                nand-ecc-step-size = <1024>;
136                nand-ecc-strength = <24>;
137
138                partitions {
139                    compatible = "fixed-partitions";
140                    #address-cells = <1>;
141                    #size-cells = <1>;
142
143                    preloader@0 {
144                        label = "pl";
145                        read-only;
146                        reg = <0x0 0x400000>;
147                    };
148                    android@400000 {
149                        label = "android";
150                        reg = <0x400000 0x12c00000>;
151                    };
152                };
153            };
154        };
155    };
156