1# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
2%YAML 1.2
3---
4$id: http://devicetree.org/schemas/mtd/denali,nand.yaml#
5$schema: http://devicetree.org/meta-schemas/core.yaml#
6
7title: Denali NAND controller
8
9maintainers:
10  - Masahiro Yamada <yamada.masahiro@socionext.com>
11
12properties:
13  compatible:
14    enum:
15      - altr,socfpga-denali-nand
16      - socionext,uniphier-denali-nand-v5a
17      - socionext,uniphier-denali-nand-v5b
18
19  reg-names:
20    description: |
21      There are two register regions:
22        nand_data:  host data/command interface
23        denali_reg: register interface
24    items:
25      - const: nand_data
26      - const: denali_reg
27
28  reg:
29    minItems: 2
30    maxItems: 2
31
32  interrupts:
33    maxItems: 1
34
35  clock-names:
36    description: |
37      There are three clocks:
38        nand:   controller core clock
39        nand_x: bus interface clock
40        ecc:    ECC circuit clock
41    items:
42      - const: nand
43      - const: nand_x
44      - const: ecc
45
46  clocks:
47    minItems: 3
48    maxItems: 3
49
50  reset-names:
51    description: |
52      There are two optional resets:
53        nand: controller core reset
54        reg:  register reset
55    oneOf:
56      - items:
57          - const: nand
58          - const: reg
59      - const: nand
60      - const: reg
61
62  resets:
63    minItems: 1
64    maxItems: 2
65
66allOf:
67  - $ref: nand-controller.yaml
68
69  - if:
70      properties:
71        compatible:
72          contains:
73            const: altr,socfpga-denali-nand
74    then:
75      patternProperties:
76        "^nand@[a-f0-9]$":
77          type: object
78          properties:
79            nand-ecc-strength:
80              enum:
81                - 8
82                - 15
83            nand-ecc-step-size:
84              enum:
85                - 512
86
87  - if:
88      properties:
89        compatible:
90          contains:
91            const: socionext,uniphier-denali-nand-v5a
92    then:
93      patternProperties:
94        "^nand@[a-f0-9]$":
95          type: object
96          properties:
97            nand-ecc-strength:
98              enum:
99                - 8
100                - 16
101                - 24
102            nand-ecc-step-size:
103              enum:
104                - 1024
105
106  - if:
107      properties:
108        compatible:
109          contains:
110            const: socionext,uniphier-denali-nand-v5b
111    then:
112      patternProperties:
113        "^nand@[a-f0-9]$":
114          type: object
115          properties:
116            nand-ecc-strength:
117              enum:
118                - 8
119                - 16
120            nand-ecc-step-size:
121              enum:
122                - 1024
123
124required:
125  - compatible
126  - reg
127  - interrupts
128  - clock-names
129  - clocks
130
131unevaluatedProperties: false
132
133examples:
134  - |
135    nand-controller@ff900000 {
136        compatible = "altr,socfpga-denali-nand";
137        reg-names = "nand_data", "denali_reg";
138        reg = <0xff900000 0x20>, <0xffb80000 0x1000>;
139        interrupts = <0 144 4>;
140        clock-names = "nand", "nand_x", "ecc";
141        clocks = <&nand_clk>, <&nand_x_clk>, <&nand_ecc_clk>;
142        reset-names = "nand", "reg";
143        resets = <&nand_rst>, <&nand_reg_rst>;
144        #address-cells = <1>;
145        #size-cells = <0>;
146
147        nand@0 {
148            reg = <0>;
149        };
150    };
151