summaryrefslogtreecommitdiffstats
path: root/dts/Bindings/mtd/mediatek,mtk-nfc.yaml
blob: ab503a33a2698539081e61048ca9623ef697403f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/mtd/mediatek,mtk-nfc.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: MediaTek(MTK) SoCs raw NAND FLASH controller (NFC)

maintainers:
  - Xiangsheng Hou <xiangsheng.hou@mediatek.com>

properties:
  compatible:
    enum:
      - mediatek,mt2701-nfc
      - mediatek,mt2712-nfc
      - mediatek,mt7622-nfc

  reg:
    items:
      - description: Base physical address and size of NFI.

  interrupts:
    items:
      - description: NFI interrupt

  clocks:
    items:
      - description: clock used for the controller
      - description: clock used for the pad

  clock-names:
    items:
      - const: nfi_clk
      - const: pad_clk

  ecc-engine:
    description: device-tree node of the required ECC engine.
    $ref: /schemas/types.yaml#/definitions/phandle

patternProperties:
  "^nand@[a-f0-9]$":
    $ref: raw-nand-chip.yaml#
    unevaluatedProperties: false
    properties:
      reg:
        maximum: 1
      nand-ecc-mode:
        const: hw

allOf:
  - $ref: nand-controller.yaml#

  - if:
      properties:
        compatible:
          contains:
            const: mediatek,mt2701-nfc
    then:
      patternProperties:
        "^nand@[a-f0-9]$":
          properties:
            nand-ecc-step-size:
              enum: [ 512, 1024 ]
            nand-ecc-strength:
              enum: [4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 28, 32, 36,
                     40, 44, 48, 52, 56, 60]

  - if:
      properties:
        compatible:
          contains:
            const: mediatek,mt2712-nfc
    then:
      patternProperties:
        "^nand@[a-f0-9]$":
          properties:
            nand-ecc-step-size:
              enum: [ 512, 1024 ]
            nand-ecc-strength:
              enum: [4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 28, 32, 36,
                     40, 44, 48, 52, 56, 60, 68, 72, 80]

  - if:
      properties:
        compatible:
          contains:
            const: mediatek,mt7622-nfc
    then:
      patternProperties:
        "^nand@[a-f0-9]$":
          properties:
            nand-ecc-step-size:
              const: 512
            nand-ecc-strength:
              enum: [4, 6, 8, 10, 12]

required:
  - compatible
  - reg
  - interrupts
  - clocks
  - clock-names
  - ecc-engine

unevaluatedProperties: false

examples:
  - |
    #include <dt-bindings/clock/mt2701-clk.h>
    #include <dt-bindings/interrupt-controller/arm-gic.h>
    #include <dt-bindings/interrupt-controller/irq.h>

    soc {
        #address-cells = <2>;
        #size-cells = <2>;

        nand-controller@1100d000 {
            compatible = "mediatek,mt2701-nfc";
            reg = <0 0x1100d000 0 0x1000>;
            interrupts = <GIC_SPI 56 IRQ_TYPE_LEVEL_LOW>;
            clocks = <&pericfg CLK_PERI_NFI>,
                     <&pericfg CLK_PERI_NFI_PAD>;
            clock-names = "nfi_clk", "pad_clk";
            ecc-engine = <&bch>;
            #address-cells = <1>;
            #size-cells = <0>;

            nand@0 {
                reg = <0>;

                nand-on-flash-bbt;
                nand-ecc-mode = "hw";
                nand-ecc-step-size = <1024>;
                nand-ecc-strength = <24>;

                partitions {
                    compatible = "fixed-partitions";
                    #address-cells = <1>;
                    #size-cells = <1>;

                    preloader@0 {
                        label = "pl";
                        read-only;
                        reg = <0x0 0x400000>;
                    };
                    android@400000 {
                        label = "android";
                        reg = <0x400000 0x12c00000>;
                    };
                };
            };
        };
    };