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