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            maxItems: 2
36            items:
37              - pattern: "^(atmel|catalyst|microchip|nxp|ramtron|renesas|rohm|st),(24(c|cs|lc|mac)[0-9]+|spd)$"
38              - pattern: "^atmel,(24(c|cs|mac)[0-9]+|spd)$"
39          - oneOf:
40              - items:
41                  pattern: c00$
42              - items:
43                  pattern: c01$
44              - items:
45                  pattern: cs01$
46              - items:
47                  pattern: c02$
48              - items:
49                  pattern: cs02$
50              - items:
51                  pattern: mac402$
52              - items:
53                  pattern: mac602$
54              - items:
55                  pattern: c04$
56              - items:
57                  pattern: cs04$
58              - items:
59                  pattern: c08$
60              - items:
61                  pattern: cs08$
62              - items:
63                  pattern: c16$
64              - items:
65                  pattern: cs16$
66              - items:
67                  pattern: c32$
68              - items:
69                  pattern: cs32$
70              - items:
71                  pattern: c64$
72              - items:
73                  pattern: cs64$
74              - items:
75                  pattern: c128$
76              - items:
77                  pattern: cs128$
78              - items:
79                  pattern: c256$
80              - items:
81                  pattern: cs256$
82              - items:
83                  pattern: c512$
84              - items:
85                  pattern: cs512$
86              - items:
87                  pattern: c1024$
88              - items:
89                  pattern: cs1024$
90              - items:
91                  pattern: c2048$
92              - items:
93                  pattern: cs2048$
94              - items:
95                  pattern: spd$
96      # These are special cases that don't conform to the above pattern.
97      # Each requires a standard at24 model as fallback.
98      - items:
99          - const: rohm,br24t01
100          - const: atmel,24c01
101      - items:
102          - const: nxp,se97b
103          - const: atmel,24c02
104      - items:
105          - const: renesas,r1ex24002
106          - const: atmel,24c02
107      - items:
108          - const: renesas,r1ex24016
109          - const: atmel,24c16
110      - items:
111          - const: giantec,gt24c32a
112          - const: atmel,24c32
113      - items:
114          - const: renesas,r1ex24128
115          - const: atmel,24c128
116
117  reg:
118    maxItems: 1
119
120  pagesize:
121    description:
122      The length of the pagesize for writing. Please consult the
123      manual of your device, that value varies a lot. A wrong value
124      may result in data loss! If not specified, a safety value of
125      '1' is used which will be very slow.
126    $ref: /schemas/types.yaml#/definitions/uint32
127    enum: [1, 8, 16, 32, 64, 128, 258]
128    default: 1
129
130  read-only:
131    $ref: /schemas/types.yaml#definitions/flag
132    description:
133      Disables writes to the eeprom.
134
135  size:
136    $ref: /schemas/types.yaml#/definitions/uint32
137    description:
138      Total eeprom size in bytes.
139
140  no-read-rollover:
141    $ref: /schemas/types.yaml#definitions/flag
142    description:
143      Indicates that the multi-address eeprom does not automatically roll
144      over reads to the next slave address. Please consult the manual of
145      your device.
146
147  wp-gpios: true
148
149  address-width:
150    description:
151      Number of address bits.
152    $ref: /schemas/types.yaml#/definitions/uint32
153    default: 8
154    enum: [ 8, 16 ]
155
156  num-addresses:
157    description:
158      Total number of i2c slave addresses this device takes.
159    $ref: /schemas/types.yaml#/definitions/uint32
160    default: 1
161    minimum: 1
162    maximum: 8
163
164  vcc-supply:
165    description:
166      phandle of the regulator that provides the supply voltage.
167
168required:
169  - compatible
170  - reg
171
172additionalProperties: false
173
174examples:
175  - |
176    i2c {
177      #address-cells = <1>;
178      #size-cells = <0>;
179
180      eeprom@52 {
181          compatible = "microchip,24c32", "atmel,24c32";
182          reg = <0x52>;
183          pagesize = <32>;
184          wp-gpios = <&gpio1 3 0>;
185          num-addresses = <8>;
186      };
187    };
188...
189