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