1# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
2%YAML 1.2
3---
4$id: http://devicetree.org/schemas/eeprom/at25.yaml#
5$schema: http://devicetree.org/meta-schemas/core.yaml#
6
7title: SPI EEPROMs or FRAMs compatible with Atmel's AT25
8
9maintainers:
10  - Christian Eggers <ceggers@arri.de>
11
12properties:
13  $nodename:
14    anyOf:
15      - pattern: "^eeprom@[0-9a-f]{1,2}$"
16      - pattern: "^fram@[0-9a-f]{1,2}$"
17
18  # There are multiple known vendors who manufacture EEPROM chips compatible
19  # with Atmel's AT25. The compatible string requires two items where the
20  # 'vendor' and 'model' parts of the first are the actual chip and the second
21  # item is fixed to "atmel,at25". Some existing bindings only have the
22  # "atmel,at25" part and should be fixed by somebody who knows vendor and
23  # product.
24  compatible:
25    oneOf:
26      - items:
27          - enum:
28              - anvo,anv32e61w
29              - atmel,at25256B
30              - fujitsu,mb85rs1mt
31              - fujitsu,mb85rs64
32              - microchip,at25160bn
33              - microchip,25lc040
34              - st,m95m02
35              - st,m95256
36              - st,m95640
37              - cypress,fm25
38
39          - const: atmel,at25
40
41      # Please don't use this alternative for new bindings.
42      - items:
43          - const: atmel,at25
44
45  reg:
46    maxItems: 1
47
48  pagesize:
49    $ref: /schemas/types.yaml#/definitions/uint32
50    enum: [1, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536, 131072]
51    description:
52      Size of the eeprom page. FRAMs don't have pages.
53
54  size:
55    $ref: /schemas/types.yaml#/definitions/uint32
56    description:
57      Total eeprom size in bytes.
58
59  address-width:
60    $ref: /schemas/types.yaml#/definitions/uint32
61    enum: [ 8, 9, 16, 24 ]
62    description:
63      Number of address bits.
64      For 9 bits, the MSB of the address is sent as bit 3 of the instruction
65      byte, before the address byte.
66
67  spi-cpha: true
68
69  spi-cpol: true
70
71  read-only:
72    description:
73      Disable writes to the eeprom.
74    type: boolean
75
76  wp-gpios:
77    maxItems: 1
78    description:
79      GPIO to which the write-protect pin of the chip is connected.
80
81  # Deprecated: at25,byte-len, at25,addr-mode, at25,page-size
82  at25,byte-len:
83    $ref: /schemas/types.yaml#/definitions/uint32
84    description:
85      Total eeprom size in bytes. Deprecated, use "size" property instead.
86    deprecated: true
87
88  at25,addr-mode:
89    $ref: /schemas/types.yaml#/definitions/uint32
90    description:
91      Addr-mode flags, as defined in include/linux/spi/eeprom.h.
92      Deprecated, use "address-width" property instead.
93    deprecated: true
94
95  at25,page-size:
96    $ref: /schemas/types.yaml#/definitions/uint32
97    description:
98      Size of the eeprom page. Deprecated, use "pagesize" property instead.
99    deprecated: true
100
101required:
102  - compatible
103  - reg
104  - spi-max-frequency
105
106allOf:
107  - $ref: /schemas/spi/spi-peripheral-props.yaml#
108  - $ref: /schemas/nvmem/nvmem.yaml
109  - if:
110      properties:
111        compatible:
112          not:
113            contains:
114              const: cypress,fm25
115    then:
116      required:
117        - pagesize
118        - size
119        - address-width
120
121unevaluatedProperties: false
122
123examples:
124  - |
125    #include <dt-bindings/gpio/gpio.h>
126    spi {
127        #address-cells = <1>;
128        #size-cells = <0>;
129
130        eeprom@0 {
131            compatible = "st,m95256", "atmel,at25";
132            reg = <0>;
133            spi-max-frequency = <5000000>;
134            spi-cpha;
135            spi-cpol;
136            wp-gpios = <&gpio1 3 0>;
137
138            pagesize = <64>;
139            size = <32768>;
140            address-width = <16>;
141        };
142
143        fram@1 {
144            compatible = "cypress,fm25", "atmel,at25";
145            reg = <1>;
146            spi-max-frequency = <40000000>;
147        };
148    };
149