xref: /linux/Documentation/devicetree/bindings/embedded-controller/google,cros-ec.yaml (revision 55a42f78ffd386e01a5404419f8c5ded7db70a21)
1# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2%YAML 1.2
3---
4$id: http://devicetree.org/schemas/embedded-controller/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  - Guenter Roeck <groeck@chromium.org>
12
13description:
14  Google's ChromeOS EC is a microcontroller which talks to the AP and
15  implements various functions such as keyboard and battery charging.
16  The EC can be connected through various interfaces (I2C, SPI, and others)
17  and the compatible string specifies which interface is being used.
18
19properties:
20  compatible:
21    oneOf:
22      - description:
23          For implementations of the EC connected through I2C.
24        const: google,cros-ec-i2c
25      - description:
26          For implementations of the EC connected through SPI.
27        const: google,cros-ec-spi
28      - description:
29          For implementations of the FPMCU connected through SPI.
30        items:
31          - const: google,cros-ec-fp
32          - const: google,cros-ec-spi
33      - description:
34          For implementations of the EC connected through RPMSG.
35        const: google,cros-ec-rpmsg
36      - description:
37          For implementations of the EC connected through UART.
38        const: google,cros-ec-uart
39
40  controller-data: true
41
42  google,cros-ec-spi-pre-delay:
43    description:
44      This property specifies the delay in usecs between the
45      assertion of the CS and the first clock pulse.
46    $ref: /schemas/types.yaml#/definitions/uint32
47    default: 0
48
49  google,cros-ec-spi-msg-delay:
50    description:
51      This property specifies the delay in usecs between messages.
52    $ref: /schemas/types.yaml#/definitions/uint32
53    default: 0
54
55  google,has-vbc-nvram:
56    description:
57      Some implementations of the EC include a small nvram space used to
58      store verified boot context data. This boolean flag is used to specify
59      whether this nvram is present or not.
60    type: boolean
61
62  mediatek,rpmsg-name:
63    description:
64      Must be defined if the cros-ec is a rpmsg device for a Mediatek
65      ARM Cortex M4 Co-processor. Contains the name of the rpmsg
66      device. Used to match the subnode to the rpmsg device announced by
67      the SCP.
68    $ref: /schemas/types.yaml#/definitions/string
69
70  spi-max-frequency: true
71
72  reg:
73    maxItems: 1
74
75  interrupts:
76    maxItems: 1
77
78  reset-gpios:
79    maxItems: 1
80
81  boot0-gpios:
82    maxItems: 1
83    description: Assert for bootloader mode.
84
85  vdd-supply: true
86
87  wakeup-source:
88    description: Button can wake-up the system.
89
90  '#address-cells':
91    const: 1
92
93  '#size-cells':
94    const: 0
95
96  '#gpio-cells':
97    const: 2
98
99  gpio-controller: true
100
101  typec:
102    $ref: /schemas/chrome/google,cros-ec-typec.yaml#
103
104  ec-pwm:
105    $ref: /schemas/pwm/google,cros-ec-pwm.yaml#
106    deprecated: true
107
108  pwm:
109    $ref: /schemas/pwm/google,cros-ec-pwm.yaml#
110
111  keyboard-controller:
112    $ref: /schemas/input/google,cros-ec-keyb.yaml#
113
114  proximity:
115    $ref: /schemas/iio/proximity/google,cros-ec-mkbp-proximity.yaml#
116
117  codecs:
118    type: object
119    additionalProperties: false
120
121    properties:
122      '#address-cells':
123        const: 2
124
125      '#size-cells':
126        const: 1
127
128    patternProperties:
129      "^ec-codec@[a-f0-9]+$":
130        type: object
131        $ref: /schemas/sound/google,cros-ec-codec.yaml#
132
133    required:
134      - "#address-cells"
135      - "#size-cells"
136
137  cbas:
138    type: object
139
140    description:
141      This device is used to signal when a detachable base is attached
142      to a Chrome OS tablet. This device cannot be detected at runtime.
143
144    properties:
145      compatible:
146        const: google,cros-cbas
147
148    required:
149      - compatible
150
151    additionalProperties: false
152
153patternProperties:
154  "^i2c-tunnel[0-9]*$":
155    type: object
156    $ref: /schemas/i2c/google,cros-ec-i2c-tunnel.yaml#
157
158  "^regulator@[0-9]+$":
159    type: object
160    $ref: /schemas/regulator/google,cros-ec-regulator.yaml#
161
162  "^extcon[0-9]*$":
163    type: object
164    $ref: /schemas/extcon/extcon-usbc-cros-ec.yaml#
165
166required:
167  - compatible
168
169allOf:
170  - if:
171      properties:
172        compatible:
173          not:
174            contains:
175              const: google,cros-ec-spi
176    then:
177      properties:
178        controller-data: false
179        google,cros-ec-spi-pre-delay: false
180        google,cros-ec-spi-msg-delay: false
181        spi-max-frequency: false
182    else:
183      $ref: /schemas/spi/spi-peripheral-props.yaml
184
185  - if:
186      properties:
187        compatible:
188          not:
189            contains:
190              const: google,cros-ec-rpmsg
191    then:
192      properties:
193        mediatek,rpmsg-name: false
194
195  - if:
196      properties:
197        compatible:
198          not:
199            contains:
200              enum:
201                - google,cros-ec-rpmsg
202                - google,cros-ec-uart
203    then:
204      required:
205        - reg
206        - interrupts
207
208  - if:
209      properties:
210        compatible:
211          contains:
212            const: google,cros-ec-fp
213    then:
214      properties:
215        '#address-cells': false
216        '#size-cells': false
217        typec: false
218        ec-pwm: false
219        kbd-led-backlight: false
220        keyboard-controller: false
221        proximity: false
222        codecs: false
223        cbas: false
224
225      patternProperties:
226        "^i2c-tunnel[0-9]*$": false
227        "^regulator@[0-9]+$": false
228        "^extcon[0-9]*$": false
229
230      # Using additionalProperties: false here and
231      # listing true properties doesn't work
232
233      required:
234        - reset-gpios
235        - boot0-gpios
236        - vdd-supply
237    else:
238      properties:
239        reset-gpios: false
240        boot0-gpios: false
241        vdd-supply: false
242
243additionalProperties: false
244
245examples:
246  # Example for I2C
247  - |
248    #include <dt-bindings/gpio/gpio.h>
249    #include <dt-bindings/interrupt-controller/irq.h>
250
251    i2c {
252        #address-cells = <1>;
253        #size-cells = <0>;
254
255        cros-ec@1e {
256            compatible = "google,cros-ec-i2c";
257            reg = <0x1e>;
258            interrupts = <6 0>;
259            interrupt-parent = <&gpio0>;
260        };
261    };
262
263  # Example for SPI
264  - |
265    #include <dt-bindings/gpio/gpio.h>
266    #include <dt-bindings/interrupt-controller/irq.h>
267
268    spi {
269        #address-cells = <1>;
270        #size-cells = <0>;
271
272        cros-ec@0 {
273            compatible = "google,cros-ec-spi";
274            reg = <0x0>;
275            google,cros-ec-spi-msg-delay = <30>;
276            google,cros-ec-spi-pre-delay = <10>;
277            interrupts = <99 0>;
278            interrupt-parent = <&gpio7>;
279            spi-max-frequency = <5000000>;
280            #gpio-cells = <2>;
281            gpio-controller;
282
283            proximity {
284                compatible = "google,cros-ec-mkbp-proximity";
285            };
286
287            cbas {
288                compatible = "google,cros-cbas";
289            };
290        };
291    };
292
293  # Example for RPMSG
294  - |
295    scp0 {
296        cros-ec {
297            compatible = "google,cros-ec-rpmsg";
298        };
299    };
300
301  # Example for FPMCU
302  - |
303    spi {
304      #address-cells = <0x1>;
305      #size-cells = <0x0>;
306
307      ec@0 {
308        compatible = "google,cros-ec-fp", "google,cros-ec-spi";
309        reg = <0x0>;
310        interrupt-parent = <&gpio_controller>;
311        interrupts = <4 IRQ_TYPE_LEVEL_LOW>;
312        spi-max-frequency = <3000000>;
313        reset-gpios = <&gpio_controller 5 GPIO_ACTIVE_LOW>;
314        boot0-gpios = <&gpio_controller 10 GPIO_ACTIVE_HIGH>;
315        vdd-supply = <&pp3300_fp_mcu>;
316      };
317    };
318
319  # Example for UART
320  - |
321    serial {
322        cros-ec {
323            compatible = "google,cros-ec-uart";
324        };
325    };
326...
327