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|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    allOf:
122      - $ref: /schemas/types.yaml#/definitions/uint32
123    description:
124      The length of the pagesize for writing. Please consult the
125      manual of your device, that value varies a lot. A wrong value
126      may result in data loss! If not specified, a safety value of
127      '1' is used which will be very slow.
128    enum: [ 1, 8, 16, 32, 64, 128, 258 ]
129    default: 1
130
131  read-only:
132    $ref: /schemas/types.yaml#definitions/flag
133    description:
134      Disables writes to the eeprom.
135
136  size:
137    $ref: /schemas/types.yaml#/definitions/uint32
138    description:
139      Total eeprom size in bytes.
140
141  no-read-rollover:
142    $ref: /schemas/types.yaml#definitions/flag
143    description:
144      Indicates that the multi-address eeprom does not automatically roll
145      over reads to the next slave address. Please consult the manual of
146      your device.
147
148  wp-gpios: true
149
150  address-width:
151    allOf:
152      - $ref: /schemas/types.yaml#/definitions/uint32
153    description:
154      Number of address bits.
155    default: 8
156    enum: [ 8, 16 ]
157
158  num-addresses:
159    allOf:
160      - $ref: /schemas/types.yaml#/definitions/uint32
161    description:
162      Total number of i2c slave addresses this device takes.
163    default: 1
164    minimum: 1
165    maximum: 8
166
167  vcc-supply:
168    description:
169      phandle of the regulator that provides the supply voltage.
170
171required:
172  - compatible
173  - reg
174
175examples:
176  - |
177    i2c {
178      #address-cells = <1>;
179      #size-cells = <0>;
180
181      eeprom@52 {
182          compatible = "microchip,24c32", "atmel,24c32";
183          reg = <0x52>;
184          pagesize = <32>;
185          wp-gpios = <&gpio1 3 0>;
186          num-addresses = <8>;
187      };
188    };
189...
190