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: cs32$
73              - items:
74                  pattern: c64$
75              - items:
76                  pattern: cs64$
77              - items:
78                  pattern: c128$
79              - items:
80                  pattern: cs128$
81              - items:
82                  pattern: c256$
83              - items:
84                  pattern: cs256$
85              - items:
86                  pattern: c512$
87              - items:
88                  pattern: cs512$
89              - items:
90                  pattern: c1024$
91              - items:
92                  pattern: cs1024$
93              - items:
94                  pattern: c1025$
95              - items:
96                  pattern: cs1025$
97              - items:
98                  pattern: c2048$
99              - items:
100                  pattern: cs2048$
101              - items:
102                  pattern: spd$
103      # These are special cases that don't conform to the above pattern.
104      # Each requires a standard at24 model as fallback.
105      - items:
106          - const: belling,bl24c16a
107          - const: atmel,24c16
108      - items:
109          - enum:
110              - rohm,br24g01
111              - rohm,br24t01
112          - const: atmel,24c01
113      - items:
114          - enum:
115              - nxp,se97b
116              - renesas,r1ex24002
117          - const: atmel,24c02
118      - items:
119          - enum:
120              - onnn,cat24c04
121              - onnn,cat24c05
122              - rohm,br24g04
123          - const: atmel,24c04
124      - items:
125          - const: renesas,r1ex24016
126          - const: atmel,24c16
127      - items:
128          - const: giantec,gt24c32a
129          - const: atmel,24c32
130      - items:
131          - enum:
132              - renesas,r1ex24128
133              - samsung,s524ad0xd1
134          - const: atmel,24c128
135      - pattern: '^atmel,24c(32|64)d-wl$' # Actual vendor is st
136
137  label:
138    description: Descriptive name of the EEPROM.
139
140  reg:
141    maxItems: 1
142
143  pagesize:
144    description:
145      The length of the pagesize for writing. Please consult the
146      manual of your device, that value varies a lot. A wrong value
147      may result in data loss! If not specified, a safety value of
148      '1' is used which will be very slow.
149    $ref: /schemas/types.yaml#/definitions/uint32
150    enum: [1, 8, 16, 32, 64, 128, 256]
151    default: 1
152
153  read-only:
154    $ref: /schemas/types.yaml#/definitions/flag
155    description:
156      Disables writes to the eeprom.
157
158  size:
159    $ref: /schemas/types.yaml#/definitions/uint32
160    description:
161      Total eeprom size in bytes.
162
163  no-read-rollover:
164    $ref: /schemas/types.yaml#/definitions/flag
165    description:
166      Indicates that the multi-address eeprom does not automatically roll
167      over reads to the next slave address. Please consult the manual of
168      your device.
169
170  wp-gpios: true
171
172  address-width:
173    description:
174      Number of address bits.
175    $ref: /schemas/types.yaml#/definitions/uint32
176    default: 8
177    enum: [ 8, 16 ]
178
179  num-addresses:
180    description:
181      Total number of i2c slave addresses this device takes.
182    $ref: /schemas/types.yaml#/definitions/uint32
183    default: 1
184    minimum: 1
185    maximum: 8
186
187  vcc-supply:
188    description:
189      phandle of the regulator that provides the supply voltage.
190
191required:
192  - compatible
193  - reg
194
195unevaluatedProperties: false
196
197examples:
198  - |
199    i2c {
200      #address-cells = <1>;
201      #size-cells = <0>;
202
203      eeprom@52 {
204          compatible = "microchip,24c32", "atmel,24c32";
205          reg = <0x52>;
206          pagesize = <32>;
207          wp-gpios = <&gpio1 3 0>;
208          num-addresses = <8>;
209      };
210    };
211...
212