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          - enum:
106              - rohm,br24g01
107              - rohm,br24t01
108          - const: atmel,24c01
109      - items:
110          - enum:
111              - nxp,se97b
112              - renesas,r1ex24002
113          - const: atmel,24c02
114      - items:
115          - enum:
116              - onnn,cat24c04
117              - onnn,cat24c05
118          - const: atmel,24c04
119      - items:
120          - const: renesas,r1ex24016
121          - const: atmel,24c16
122      - items:
123          - const: giantec,gt24c32a
124          - const: atmel,24c32
125      - items:
126          - enum:
127              - renesas,r1ex24128
128              - samsung,s524ad0xd1
129          - const: atmel,24c128
130
131  label:
132    description: Descriptive name of the EEPROM.
133
134  reg:
135    maxItems: 1
136
137  pagesize:
138    description:
139      The length of the pagesize for writing. Please consult the
140      manual of your device, that value varies a lot. A wrong value
141      may result in data loss! If not specified, a safety value of
142      '1' is used which will be very slow.
143    $ref: /schemas/types.yaml#/definitions/uint32
144    enum: [1, 8, 16, 32, 64, 128, 256]
145    default: 1
146
147  read-only:
148    $ref: /schemas/types.yaml#/definitions/flag
149    description:
150      Disables writes to the eeprom.
151
152  size:
153    $ref: /schemas/types.yaml#/definitions/uint32
154    description:
155      Total eeprom size in bytes.
156
157  no-read-rollover:
158    $ref: /schemas/types.yaml#/definitions/flag
159    description:
160      Indicates that the multi-address eeprom does not automatically roll
161      over reads to the next slave address. Please consult the manual of
162      your device.
163
164  wp-gpios: true
165
166  address-width:
167    description:
168      Number of address bits.
169    $ref: /schemas/types.yaml#/definitions/uint32
170    default: 8
171    enum: [ 8, 16 ]
172
173  num-addresses:
174    description:
175      Total number of i2c slave addresses this device takes.
176    $ref: /schemas/types.yaml#/definitions/uint32
177    default: 1
178    minimum: 1
179    maximum: 8
180
181  vcc-supply:
182    description:
183      phandle of the regulator that provides the supply voltage.
184
185required:
186  - compatible
187  - reg
188
189unevaluatedProperties: false
190
191examples:
192  - |
193    i2c {
194      #address-cells = <1>;
195      #size-cells = <0>;
196
197      eeprom@52 {
198          compatible = "microchip,24c32", "atmel,24c32";
199          reg = <0x52>;
200          pagesize = <32>;
201          wp-gpios = <&gpio1 3 0>;
202          num-addresses = <8>;
203      };
204    };
205...
206