1# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
2%YAML 1.2
3---
4$id: "http://devicetree.org/schemas/eeprom/at25.yaml#"
5$schema: "http://devicetree.org/meta-schemas/core.yaml#"
6
7title: SPI EEPROMs or FRAMs compatible with Atmel's AT25
8
9maintainers:
10  - Christian Eggers <ceggers@arri.de>
11
12properties:
13  $nodename:
14    anyOf:
15      - pattern: "^eeprom@[0-9a-f]{1,2}$"
16      - pattern: "^fram@[0-9a-f]{1,2}$"
17
18  # There are multiple known vendors who manufacture EEPROM chips compatible
19  # with Atmel's AT25. The compatible string requires two items where the
20  # 'vendor' and 'model' parts of the first are the actual chip and the second
21  # item is fixed to "atmel,at25". Some existing bindings only have the
22  # "atmel,at25" part and should be fixed by somebody who knows vendor and
23  # product.
24  compatible:
25    oneOf:
26      - items:
27          - enum:
28              - anvo,anv32e61w
29              - atmel,at25256B
30              - fujitsu,mb85rs1mt
31              - fujitsu,mb85rs64
32              - microchip,at25160bn
33              - microchip,25lc040
34              - st,m95m02
35              - st,m95256
36              - cypress,fm25
37
38          - const: atmel,at25
39
40      # Please don't use this alternative for new bindings.
41      - items:
42          - const: atmel,at25
43
44  reg:
45    maxItems: 1
46
47  pagesize:
48    $ref: /schemas/types.yaml#/definitions/uint32
49    enum: [1, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536, 131072]
50    description:
51      Size of the eeprom page. FRAMs don't have pages.
52
53  size:
54    $ref: /schemas/types.yaml#/definitions/uint32
55    description:
56      Total eeprom size in bytes.
57
58  address-width:
59    $ref: /schemas/types.yaml#/definitions/uint32
60    enum: [ 8, 9, 16, 24 ]
61    description:
62      Number of address bits.
63      For 9 bits, the MSB of the address is sent as bit 3 of the instruction
64      byte, before the address byte.
65
66  spi-cpha: true
67
68  spi-cpol: true
69
70  read-only:
71    description:
72      Disable writes to the eeprom.
73    type: boolean
74
75  wp-gpios:
76    maxItems: 1
77    description:
78      GPIO to which the write-protect pin of the chip is connected.
79
80  # Deprecated: at25,byte-len, at25,addr-mode, at25,page-size
81  at25,byte-len:
82    $ref: /schemas/types.yaml#/definitions/uint32
83    description:
84      Total eeprom size in bytes. Deprecated, use "size" property instead.
85    deprecated: true
86
87  at25,addr-mode:
88    $ref: /schemas/types.yaml#/definitions/uint32
89    description:
90      Addr-mode flags, as defined in include/linux/spi/eeprom.h.
91      Deprecated, use "address-width" property instead.
92    deprecated: true
93
94  at25,page-size:
95    $ref: /schemas/types.yaml#/definitions/uint32
96    description:
97      Size of the eeprom page. Deprecated, use "pagesize" property instead.
98    deprecated: true
99
100required:
101  - compatible
102  - reg
103  - spi-max-frequency
104
105allOf:
106  - $ref: /schemas/spi/spi-peripheral-props.yaml#
107  - if:
108      properties:
109        compatible:
110          not:
111            contains:
112              const: cypress,fm25
113    then:
114      required:
115        - pagesize
116        - size
117        - address-width
118
119unevaluatedProperties: false
120
121examples:
122  - |
123    #include <dt-bindings/gpio/gpio.h>
124    spi0 {
125        #address-cells = <1>;
126        #size-cells = <0>;
127
128        eeprom@0 {
129            compatible = "st,m95256", "atmel,at25";
130            reg = <0>;
131            spi-max-frequency = <5000000>;
132            spi-cpha;
133            spi-cpol;
134            wp-gpios = <&gpio1 3 0>;
135
136            pagesize = <64>;
137            size = <32768>;
138            address-width = <16>;
139        };
140
141        fram@1 {
142            compatible = "cypress,fm25", "atmel,at25";
143            reg = <1>;
144            spi-max-frequency = <40000000>;
145        };
146    };
147