1# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2%YAML 1.2
3---
4$id: http://devicetree.org/schemas/mfd/google,cros-ec.yaml#
5$schema: http://devicetree.org/meta-schemas/core.yaml#
6
7title: ChromeOS Embedded Controller
8
9maintainers:
10  - Benson Leung <bleung@chromium.org>
11  - Enric Balletbo i Serra <enric.balletbo@collabora.com>
12  - Guenter Roeck <groeck@chromium.org>
13
14description:
15  Google's ChromeOS EC is a microcontroller which talks to the AP and
16  implements various functions such as keyboard and battery charging.
17  The EC can be connected through various interfaces (I2C, SPI, and others)
18  and the compatible string specifies which interface is being used.
19
20properties:
21  compatible:
22    oneOf:
23      - description:
24          For implementations of the EC is connected through I2C.
25        const: google,cros-ec-i2c
26      - description:
27          For implementations of the EC is connected through SPI.
28        const: google,cros-ec-spi
29      - description:
30          For implementations of the EC is connected through RPMSG.
31        const: google,cros-ec-rpmsg
32
33  google,cros-ec-spi-pre-delay:
34    description:
35      This property specifies the delay in usecs between the
36      assertion of the CS and the first clock pulse.
37    allOf:
38      - $ref: /schemas/types.yaml#/definitions/uint32
39      - default: 0
40      - minimum: 0
41
42  google,cros-ec-spi-msg-delay:
43    description:
44      This property specifies the delay in usecs between messages.
45    allOf:
46      - $ref: /schemas/types.yaml#/definitions/uint32
47      - default: 0
48      - minimum: 0
49
50  google,has-vbc-nvram:
51    description:
52      Some implementations of the EC include a small nvram space used to
53      store verified boot context data. This boolean flag is used to specify
54      whether this nvram is present or not.
55    type: boolean
56
57  spi-max-frequency:
58    description: Maximum SPI frequency of the device in Hz.
59
60  reg:
61    maxItems: 1
62
63  interrupts:
64    maxItems: 1
65
66required:
67  - compatible
68
69if:
70  properties:
71    compatible:
72      contains:
73        enum:
74          - google,cros-ec-i2c
75          - google,cros-ec-rpmsg
76then:
77  properties:
78    google,cros-ec-spi-pre-delay: false
79    google,cros-ec-spi-msg-delay: false
80    spi-max-frequency: false
81
82additionalProperties: false
83
84examples:
85  # Example for I2C
86  - |
87    #include <dt-bindings/gpio/gpio.h>
88    #include <dt-bindings/interrupt-controller/irq.h>
89
90    i2c0 {
91        #address-cells = <1>;
92        #size-cells = <0>;
93
94        cros-ec@1e {
95            compatible = "google,cros-ec-i2c";
96            reg = <0x1e>;
97            interrupts = <6 0>;
98            interrupt-parent = <&gpio0>;
99        };
100    };
101
102  # Example for SPI
103  - |
104    #include <dt-bindings/gpio/gpio.h>
105    #include <dt-bindings/interrupt-controller/irq.h>
106
107    spi0 {
108        #address-cells = <1>;
109        #size-cells = <0>;
110
111        cros-ec@0 {
112            compatible = "google,cros-ec-spi";
113            reg = <0x0>;
114            google,cros-ec-spi-msg-delay = <30>;
115            google,cros-ec-spi-pre-delay = <10>;
116            interrupts = <99 0>;
117            interrupt-parent = <&gpio7>;
118            spi-max-frequency = <5000000>;
119        };
120    };
121
122  # Example for RPMSG
123  - |
124    scp0 {
125        cros-ec {
126            compatible = "google,cros-ec-rpmsg";
127        };
128    };
129...
130