1# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2%YAML 1.2
3---
4$id: http://devicetree.org/schemas/mtd/gpmi-nand.yaml#
5$schema: http://devicetree.org/meta-schemas/core.yaml#
6
7title: Freescale General-Purpose Media Interface (GPMI) binding
8
9maintainers:
10  - Han Xu <han.xu@nxp.com>
11
12description: |
13  The GPMI nand controller provides an interface to control the NAND
14  flash chips. The device tree may optionally contain sub-nodes
15  describing partitions of the address space. See partition.txt for
16  more detail.
17
18properties:
19  compatible:
20    oneOf:
21      - enum:
22          - fsl,imx23-gpmi-nand
23          - fsl,imx28-gpmi-nand
24          - fsl,imx6q-gpmi-nand
25          - fsl,imx6sx-gpmi-nand
26          - fsl,imx7d-gpmi-nand
27      - items:
28          - enum:
29              - fsl,imx8mm-gpmi-nand
30              - fsl,imx8mn-gpmi-nand
31          - const: fsl,imx7d-gpmi-nand
32
33  reg:
34    items:
35      - description: Address and length of gpmi block.
36      - description: Address and length of bch block.
37
38  reg-names:
39    items:
40      - const: gpmi-nand
41      - const: bch
42
43  interrupts:
44    maxItems: 1
45
46  interrupt-names:
47    const: bch
48
49  dmas:
50    maxItems: 1
51
52  dma-names:
53    const: rx-tx
54
55  clocks:
56    minItems: 1
57    maxItems: 5
58
59  clock-names:
60    minItems: 1
61    maxItems: 5
62
63  fsl,use-minimum-ecc:
64    type: boolean
65    description: |
66      Protect this NAND flash with the minimum ECC strength required.
67      The required ECC strength is automatically discoverable for some
68      flash (e.g., according to the ONFI standard). However, note that
69      if this strength is not discoverable or this property is not enabled,
70      the software may chooses an implementation-defined ECC scheme.
71
72  fsl,no-blockmark-swap:
73    type: boolean
74    description: |
75      Don't swap the bad block marker from the OOB area with the byte in
76      the data area but rely on the flash based BBT for identifying bad blocks.
77      NOTE: this is only valid in conjunction with 'nand-on-flash-bbt'.
78      WARNING: on i.MX28 blockmark swapping cannot be disabled for the BootROM
79      in the FCB. Thus, partitions written from Linux with this feature turned
80      on may not be accessible by the BootROM code.
81
82required:
83  - compatible
84  - reg
85  - reg-names
86  - interrupts
87  - interrupt-names
88  - clocks
89  - clock-names
90  - dmas
91  - dma-names
92
93unevaluatedProperties: false
94
95allOf:
96  - $ref: "nand-controller.yaml"
97
98  - if:
99      properties:
100        compatible:
101          contains:
102            enum:
103              - fsl,imx23-gpmi-nand
104              - fsl,imx28-gpmi-nand
105    then:
106      properties:
107        clocks:
108          items:
109            - description: SoC gpmi io clock
110        clock-names:
111          items:
112            - const: gpmi_io
113
114  - if:
115      properties:
116        compatible:
117          contains:
118            enum:
119              - fsl,imx6q-gpmi-nand
120              - fsl,imx6sx-gpmi-nand
121    then:
122      properties:
123        clocks:
124          items:
125            - description: SoC gpmi io clock
126            - description: SoC gpmi apb clock
127            - description: SoC gpmi bch clock
128            - description: SoC gpmi bch apb clock
129            - description: SoC per1 bch clock
130        clock-names:
131          items:
132            - const: gpmi_io
133            - const: gpmi_apb
134            - const: gpmi_bch
135            - const: gpmi_bch_apb
136            - const: per1_bch
137
138  - if:
139      properties:
140        compatible:
141          contains:
142            const: fsl,imx7d-gpmi-nand
143    then:
144      properties:
145        clocks:
146          items:
147            - description: SoC gpmi io clock
148            - description: SoC gpmi bch apb clock
149        clock-names:
150          items:
151            - const: gpmi_io
152            - const: gpmi_bch_apb
153
154examples:
155  - |
156    nand-controller@8000c000 {
157        #address-cells = <1>;
158        #size-cells = <0>;
159        compatible = "fsl,imx28-gpmi-nand";
160        reg = <0x8000c000 0x2000>, <0x8000a000 0x2000>;
161        reg-names = "gpmi-nand", "bch";
162        interrupts = <41>;
163        interrupt-names = "bch";
164        clocks = <&clks 50>;
165        clock-names = "gpmi_io";
166        dmas = <&dma_apbh 4>;
167        dma-names = "rx-tx";
168    };
169