1# SPDX-License-Identifier: GPL-2.0-only
2# Copyright 2019 BayLibre SAS
3%YAML 1.2
4---
5$id: http://devicetree.org/schemas/eeprom/at24.yaml#
6$schema: http://devicetree.org/meta-schemas/core.yaml#
7
8title: I2C EEPROMs compatible with Atmel's AT24
9
10maintainers:
11  - Bartosz Golaszewski <bgolaszewski@baylibre.com>
12
13allOf:
14  - $ref: /schemas/nvmem/nvmem.yaml
15
16select:
17  properties:
18    compatible:
19      contains:
20        pattern: "^atmel,(24(c|cs|mac)[0-9]+|spd)$"
21  required:
22    - compatible
23
24properties:
25  $nodename:
26    pattern: "^eeprom@[0-9a-f]{1,2}$"
27
28  # There are multiple known vendors who manufacture EEPROM chips compatible
29  # with Atmel's AT24. The compatible string requires either a single item
30  # if the memory comes from Atmel (in which case the vendor part must be
31  # 'atmel') or two items with the same 'model' part where the vendor part of
32  # the first one is the actual manufacturer and the second item is the
33  # corresponding 'atmel,<model>' from Atmel.
34  compatible:
35    oneOf:
36      - allOf:
37          - minItems: 1
38            items:
39              - pattern: "^(atmel|catalyst|microchip|nxp|ramtron|renesas|rohm|st),(24(c|cs|lc|mac)[0-9]+|spd)$"
40              - pattern: "^atmel,(24(c|cs|mac)[0-9]+|spd)$"
41          - oneOf:
42              - items:
43                  pattern: c00$
44              - items:
45                  pattern: c01$
46              - items:
47                  pattern: cs01$
48              - items:
49                  pattern: c02$
50              - items:
51                  pattern: cs02$
52              - items:
53                  pattern: mac402$
54              - items:
55                  pattern: mac602$
56              - items:
57                  pattern: c04$
58              - items:
59                  pattern: cs04$
60              - items:
61                  pattern: c08$
62              - items:
63                  pattern: cs08$
64              - items:
65                  pattern: c16$
66              - items:
67                  pattern: cs16$
68              - items:
69                  pattern: c32$
70              - items:
71                  pattern: cs32$
72              - items:
73                  pattern: c64$
74              - items:
75                  pattern: cs64$
76              - items:
77                  pattern: c128$
78              - items:
79                  pattern: cs128$
80              - items:
81                  pattern: c256$
82              - items:
83                  pattern: cs256$
84              - items:
85                  pattern: c512$
86              - items:
87                  pattern: cs512$
88              - items:
89                  pattern: c1024$
90              - items:
91                  pattern: cs1024$
92              - items:
93                  pattern: c1025$
94              - items:
95                  pattern: cs1025$
96              - items:
97                  pattern: c2048$
98              - items:
99                  pattern: cs2048$
100              - items:
101                  pattern: spd$
102      # These are special cases that don't conform to the above pattern.
103      # Each requires a standard at24 model as fallback.
104      - items:
105          - const: belling,bl24c16a
106          - const: atmel,24c16
107      - items:
108          - enum:
109              - rohm,br24g01
110              - rohm,br24t01
111          - const: atmel,24c01
112      - items:
113          - enum:
114              - nxp,se97b
115              - renesas,r1ex24002
116          - const: atmel,24c02
117      - items:
118          - enum:
119              - onnn,cat24c04
120              - onnn,cat24c05
121          - const: atmel,24c04
122      - items:
123          - const: renesas,r1ex24016
124          - const: atmel,24c16
125      - items:
126          - const: giantec,gt24c32a
127          - const: atmel,24c32
128      - items:
129          - enum:
130              - renesas,r1ex24128
131              - samsung,s524ad0xd1
132          - const: atmel,24c128
133
134  label:
135    description: Descriptive name of the EEPROM.
136
137  reg:
138    maxItems: 1
139
140  pagesize:
141    description:
142      The length of the pagesize for writing. Please consult the
143      manual of your device, that value varies a lot. A wrong value
144      may result in data loss! If not specified, a safety value of
145      '1' is used which will be very slow.
146    $ref: /schemas/types.yaml#/definitions/uint32
147    enum: [1, 8, 16, 32, 64, 128, 256]
148    default: 1
149
150  read-only:
151    $ref: /schemas/types.yaml#/definitions/flag
152    description:
153      Disables writes to the eeprom.
154
155  size:
156    $ref: /schemas/types.yaml#/definitions/uint32
157    description:
158      Total eeprom size in bytes.
159
160  no-read-rollover:
161    $ref: /schemas/types.yaml#/definitions/flag
162    description:
163      Indicates that the multi-address eeprom does not automatically roll
164      over reads to the next slave address. Please consult the manual of
165      your device.
166
167  wp-gpios: true
168
169  address-width:
170    description:
171      Number of address bits.
172    $ref: /schemas/types.yaml#/definitions/uint32
173    default: 8
174    enum: [ 8, 16 ]
175
176  num-addresses:
177    description:
178      Total number of i2c slave addresses this device takes.
179    $ref: /schemas/types.yaml#/definitions/uint32
180    default: 1
181    minimum: 1
182    maximum: 8
183
184  vcc-supply:
185    description:
186      phandle of the regulator that provides the supply voltage.
187
188required:
189  - compatible
190  - reg
191
192unevaluatedProperties: false
193
194examples:
195  - |
196    i2c {
197      #address-cells = <1>;
198      #size-cells = <0>;
199
200      eeprom@52 {
201          compatible = "microchip,24c32", "atmel,24c32";
202          reg = <0x52>;
203          pagesize = <32>;
204          wp-gpios = <&gpio1 3 0>;
205          num-addresses = <8>;
206      };
207    };
208...
209