146b57806SIkjoon Jang# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
246b57806SIkjoon Jang%YAML 1.2
346b57806SIkjoon Jang---
446b57806SIkjoon Jang$id: http://devicetree.org/schemas/mfd/google,cros-ec.yaml#
546b57806SIkjoon Jang$schema: http://devicetree.org/meta-schemas/core.yaml#
646b57806SIkjoon Jang
746b57806SIkjoon Jangtitle: ChromeOS Embedded Controller
846b57806SIkjoon Jang
946b57806SIkjoon Jangmaintainers:
1046b57806SIkjoon Jang  - Benson Leung <bleung@chromium.org>
1146b57806SIkjoon Jang  - Guenter Roeck <groeck@chromium.org>
1246b57806SIkjoon Jang
1346b57806SIkjoon Jangdescription:
1446b57806SIkjoon Jang  Google's ChromeOS EC is a microcontroller which talks to the AP and
1546b57806SIkjoon Jang  implements various functions such as keyboard and battery charging.
1646b57806SIkjoon Jang  The EC can be connected through various interfaces (I2C, SPI, and others)
1746b57806SIkjoon Jang  and the compatible string specifies which interface is being used.
1846b57806SIkjoon Jang
1946b57806SIkjoon Jangproperties:
2046b57806SIkjoon Jang  compatible:
2146b57806SIkjoon Jang    oneOf:
2246b57806SIkjoon Jang      - description:
237a2f3682SStephen Boyd          For implementations of the EC connected through I2C.
2446b57806SIkjoon Jang        const: google,cros-ec-i2c
2546b57806SIkjoon Jang      - description:
267a2f3682SStephen Boyd          For implementations of the EC connected through SPI.
2746b57806SIkjoon Jang        const: google,cros-ec-spi
2846b57806SIkjoon Jang      - description:
29e068bc0bSStephen Boyd          For implementations of the FPMCU connected through SPI.
30e068bc0bSStephen Boyd        items:
31e068bc0bSStephen Boyd          - const: google,cros-ec-fp
32e068bc0bSStephen Boyd          - const: google,cros-ec-spi
33e068bc0bSStephen Boyd      - description:
347a2f3682SStephen Boyd          For implementations of the EC connected through RPMSG.
3546b57806SIkjoon Jang        const: google,cros-ec-rpmsg
360c8884feSBhanu Prakash Maiya      - description:
370c8884feSBhanu Prakash Maiya          For implementations of the EC connected through UART.
380c8884feSBhanu Prakash Maiya        const: google,cros-ec-uart
3946b57806SIkjoon Jang
407a2f3682SStephen Boyd  controller-data: true
415d7fb8b8SKrzysztof Kozlowski
4246b57806SIkjoon Jang  google,cros-ec-spi-pre-delay:
4346b57806SIkjoon Jang    description:
4446b57806SIkjoon Jang      This property specifies the delay in usecs between the
4546b57806SIkjoon Jang      assertion of the CS and the first clock pulse.
46dca66935SRob Herring    $ref: /schemas/types.yaml#/definitions/uint32
47dca66935SRob Herring    default: 0
4846b57806SIkjoon Jang
4946b57806SIkjoon Jang  google,cros-ec-spi-msg-delay:
5046b57806SIkjoon Jang    description:
5146b57806SIkjoon Jang      This property specifies the delay in usecs between messages.
52dca66935SRob Herring    $ref: /schemas/types.yaml#/definitions/uint32
53dca66935SRob Herring    default: 0
5446b57806SIkjoon Jang
5546b57806SIkjoon Jang  google,has-vbc-nvram:
5646b57806SIkjoon Jang    description:
5746b57806SIkjoon Jang      Some implementations of the EC include a small nvram space used to
5846b57806SIkjoon Jang      store verified boot context data. This boolean flag is used to specify
5946b57806SIkjoon Jang      whether this nvram is present or not.
6046b57806SIkjoon Jang    type: boolean
6146b57806SIkjoon Jang
62e565615cSMatthias Brugger  mediatek,rpmsg-name:
635c024e68SRicardo Cañuelo    description:
645c024e68SRicardo Cañuelo      Must be defined if the cros-ec is a rpmsg device for a Mediatek
65f93afd8eSStephen Boyd      ARM Cortex M4 Co-processor. Contains the name of the rpmsg
665c024e68SRicardo Cañuelo      device. Used to match the subnode to the rpmsg device announced by
675c024e68SRicardo Cañuelo      the SCP.
68*9896a19cSRob Herring    $ref: /schemas/types.yaml#/definitions/string
695c024e68SRicardo Cañuelo
707a2f3682SStephen Boyd  spi-max-frequency: true
7146b57806SIkjoon Jang
7246b57806SIkjoon Jang  reg:
7346b57806SIkjoon Jang    maxItems: 1
7446b57806SIkjoon Jang
7546b57806SIkjoon Jang  interrupts:
7646b57806SIkjoon Jang    maxItems: 1
7746b57806SIkjoon Jang
78e068bc0bSStephen Boyd  reset-gpios:
79e068bc0bSStephen Boyd    maxItems: 1
80e068bc0bSStephen Boyd
81e068bc0bSStephen Boyd  boot0-gpios:
82e068bc0bSStephen Boyd    maxItems: 1
83e068bc0bSStephen Boyd    description: Assert for bootloader mode.
84e068bc0bSStephen Boyd
85e068bc0bSStephen Boyd  vdd-supply: true
86e068bc0bSStephen Boyd
875d7fb8b8SKrzysztof Kozlowski  wakeup-source:
885d7fb8b8SKrzysztof Kozlowski    description: Button can wake-up the system.
895d7fb8b8SKrzysztof Kozlowski
905c024e68SRicardo Cañuelo  '#address-cells':
915c024e68SRicardo Cañuelo    const: 1
925c024e68SRicardo Cañuelo
935c024e68SRicardo Cañuelo  '#size-cells':
945c024e68SRicardo Cañuelo    const: 0
955c024e68SRicardo Cañuelo
965c024e68SRicardo Cañuelo  typec:
97*9896a19cSRob Herring    $ref: /schemas/chrome/google,cros-ec-typec.yaml#
985c024e68SRicardo Cañuelo
995c024e68SRicardo Cañuelo  ec-pwm:
100*9896a19cSRob Herring    $ref: /schemas/pwm/google,cros-ec-pwm.yaml#
1016b94ee66SKrzysztof Kozlowski    deprecated: true
1026b94ee66SKrzysztof Kozlowski
1036b94ee66SKrzysztof Kozlowski  pwm:
104*9896a19cSRob Herring    $ref: /schemas/pwm/google,cros-ec-pwm.yaml#
1055c024e68SRicardo Cañuelo
10620f370efSTzung-Bi Shih  kbd-led-backlight:
107*9896a19cSRob Herring    $ref: /schemas/chrome/google,cros-kbd-led-backlight.yaml#
10820f370efSTzung-Bi Shih
10950d68feeSRicardo Cañuelo  keyboard-controller:
110*9896a19cSRob Herring    $ref: /schemas/input/google,cros-ec-keyb.yaml#
11150d68feeSRicardo Cañuelo
11219ad93bcSStephen Boyd  proximity:
113*9896a19cSRob Herring    $ref: /schemas/iio/proximity/google,cros-ec-mkbp-proximity.yaml#
11419ad93bcSStephen Boyd
1155c024e68SRicardo Cañuelo  codecs:
1165c024e68SRicardo Cañuelo    type: object
1175c024e68SRicardo Cañuelo    additionalProperties: false
1185c024e68SRicardo Cañuelo
1195c024e68SRicardo Cañuelo    properties:
1205c024e68SRicardo Cañuelo      '#address-cells':
1215c024e68SRicardo Cañuelo        const: 2
1225c024e68SRicardo Cañuelo
1235c024e68SRicardo Cañuelo      '#size-cells':
1245c024e68SRicardo Cañuelo        const: 1
1255c024e68SRicardo Cañuelo
1265c024e68SRicardo Cañuelo    patternProperties:
1275c024e68SRicardo Cañuelo      "^ec-codec@[a-f0-9]+$":
1285c024e68SRicardo Cañuelo        type: object
129*9896a19cSRob Herring        $ref: /schemas/sound/google,cros-ec-codec.yaml#
1305c024e68SRicardo Cañuelo
1315c024e68SRicardo Cañuelo    required:
1325c024e68SRicardo Cañuelo      - "#address-cells"
1335c024e68SRicardo Cañuelo      - "#size-cells"
1345c024e68SRicardo Cañuelo
13580cf16deSIkjoon Jang  cbas:
13680cf16deSIkjoon Jang    type: object
13780cf16deSIkjoon Jang
13880cf16deSIkjoon Jang    description:
13980cf16deSIkjoon Jang      This device is used to signal when a detachable base is attached
14080cf16deSIkjoon Jang      to a Chrome OS tablet. This device cannot be detected at runtime.
14180cf16deSIkjoon Jang
14280cf16deSIkjoon Jang    properties:
14380cf16deSIkjoon Jang      compatible:
14480cf16deSIkjoon Jang        const: google,cros-cbas
14580cf16deSIkjoon Jang
14680cf16deSIkjoon Jang    required:
14780cf16deSIkjoon Jang      - compatible
14880cf16deSIkjoon Jang
14980cf16deSIkjoon Jang    additionalProperties: false
15080cf16deSIkjoon Jang
1511acd4577SRicardo CañuelopatternProperties:
1521acd4577SRicardo Cañuelo  "^i2c-tunnel[0-9]*$":
1531acd4577SRicardo Cañuelo    type: object
154*9896a19cSRob Herring    $ref: /schemas/i2c/google,cros-ec-i2c-tunnel.yaml#
1551acd4577SRicardo Cañuelo
1565c024e68SRicardo Cañuelo  "^regulator@[0-9]+$":
1575c024e68SRicardo Cañuelo    type: object
158*9896a19cSRob Herring    $ref: /schemas/regulator/google,cros-ec-regulator.yaml#
1595c024e68SRicardo Cañuelo
1605c024e68SRicardo Cañuelo  "^extcon[0-9]*$":
1615c024e68SRicardo Cañuelo    type: object
162*9896a19cSRob Herring    $ref: /schemas/extcon/extcon-usbc-cros-ec.yaml#
1635c024e68SRicardo Cañuelo
16446b57806SIkjoon Jangrequired:
16546b57806SIkjoon Jang  - compatible
16646b57806SIkjoon Jang
167f412fe11SKrzysztof KozlowskiallOf:
168f412fe11SKrzysztof Kozlowski  - if:
16946b57806SIkjoon Jang      properties:
17046b57806SIkjoon Jang        compatible:
1717a2f3682SStephen Boyd          not:
17246b57806SIkjoon Jang            contains:
1737a2f3682SStephen Boyd              const: google,cros-ec-spi
17446b57806SIkjoon Jang    then:
17546b57806SIkjoon Jang      properties:
1767a2f3682SStephen Boyd        controller-data: false
17746b57806SIkjoon Jang        google,cros-ec-spi-pre-delay: false
17846b57806SIkjoon Jang        google,cros-ec-spi-msg-delay: false
17946b57806SIkjoon Jang        spi-max-frequency: false
180f412fe11SKrzysztof Kozlowski    else:
181f412fe11SKrzysztof Kozlowski      $ref: /schemas/spi/spi-peripheral-props.yaml
18246b57806SIkjoon Jang
1837a2f3682SStephen Boyd  - if:
1847a2f3682SStephen Boyd      properties:
1857a2f3682SStephen Boyd        compatible:
1867a2f3682SStephen Boyd          not:
1877a2f3682SStephen Boyd            contains:
1887a2f3682SStephen Boyd              const: google,cros-ec-rpmsg
1897a2f3682SStephen Boyd    then:
1907a2f3682SStephen Boyd      properties:
1917a2f3682SStephen Boyd        mediatek,rpmsg-name: false
1927a2f3682SStephen Boyd
1930c8884feSBhanu Prakash Maiya  - if:
1940c8884feSBhanu Prakash Maiya      properties:
1950c8884feSBhanu Prakash Maiya        compatible:
1960c8884feSBhanu Prakash Maiya          not:
1970c8884feSBhanu Prakash Maiya            contains:
1980c8884feSBhanu Prakash Maiya              enum:
1990c8884feSBhanu Prakash Maiya                - google,cros-ec-rpmsg
2000c8884feSBhanu Prakash Maiya                - google,cros-ec-uart
2010c8884feSBhanu Prakash Maiya    then:
2027a2f3682SStephen Boyd      required:
2037a2f3682SStephen Boyd        - reg
2047a2f3682SStephen Boyd        - interrupts
2057a2f3682SStephen Boyd
206e068bc0bSStephen Boyd  - if:
207e068bc0bSStephen Boyd      properties:
208e068bc0bSStephen Boyd        compatible:
209e068bc0bSStephen Boyd          contains:
210e068bc0bSStephen Boyd            const: google,cros-ec-fp
211e068bc0bSStephen Boyd    then:
212e068bc0bSStephen Boyd      properties:
213e068bc0bSStephen Boyd        '#address-cells': false
214e068bc0bSStephen Boyd        '#size-cells': false
215e068bc0bSStephen Boyd        typec: false
216e068bc0bSStephen Boyd        ec-pwm: false
217e068bc0bSStephen Boyd        kbd-led-backlight: false
218e068bc0bSStephen Boyd        keyboard-controller: false
219e068bc0bSStephen Boyd        proximity: false
220e068bc0bSStephen Boyd        codecs: false
221e068bc0bSStephen Boyd        cbas: false
222e068bc0bSStephen Boyd
223e068bc0bSStephen Boyd      patternProperties:
224e068bc0bSStephen Boyd        "^i2c-tunnel[0-9]*$": false
225e068bc0bSStephen Boyd        "^regulator@[0-9]+$": false
226e068bc0bSStephen Boyd        "^extcon[0-9]*$": false
227e068bc0bSStephen Boyd
228e068bc0bSStephen Boyd      # Using additionalProperties: false here and
229e068bc0bSStephen Boyd      # listing true properties doesn't work
230e068bc0bSStephen Boyd
231e068bc0bSStephen Boyd      required:
232e068bc0bSStephen Boyd        - reset-gpios
233e068bc0bSStephen Boyd        - boot0-gpios
234e068bc0bSStephen Boyd        - vdd-supply
235e068bc0bSStephen Boyd    else:
236e068bc0bSStephen Boyd      properties:
237e068bc0bSStephen Boyd        reset-gpios: false
238e068bc0bSStephen Boyd        boot0-gpios: false
239e068bc0bSStephen Boyd        vdd-supply: false
240e068bc0bSStephen Boyd
24146b57806SIkjoon JangadditionalProperties: false
24246b57806SIkjoon Jang
24346b57806SIkjoon Jangexamples:
24446b57806SIkjoon Jang  # Example for I2C
24546b57806SIkjoon Jang  - |
24646b57806SIkjoon Jang    #include <dt-bindings/gpio/gpio.h>
24746b57806SIkjoon Jang    #include <dt-bindings/interrupt-controller/irq.h>
24846b57806SIkjoon Jang
24946b57806SIkjoon Jang    i2c {
25046b57806SIkjoon Jang        #address-cells = <1>;
25146b57806SIkjoon Jang        #size-cells = <0>;
25246b57806SIkjoon Jang
25346b57806SIkjoon Jang        cros-ec@1e {
25446b57806SIkjoon Jang            compatible = "google,cros-ec-i2c";
25546b57806SIkjoon Jang            reg = <0x1e>;
25646b57806SIkjoon Jang            interrupts = <6 0>;
25746b57806SIkjoon Jang            interrupt-parent = <&gpio0>;
25846b57806SIkjoon Jang        };
25946b57806SIkjoon Jang    };
26046b57806SIkjoon Jang
26146b57806SIkjoon Jang  # Example for SPI
26246b57806SIkjoon Jang  - |
26346b57806SIkjoon Jang    #include <dt-bindings/gpio/gpio.h>
26446b57806SIkjoon Jang    #include <dt-bindings/interrupt-controller/irq.h>
26546b57806SIkjoon Jang
26646b57806SIkjoon Jang    spi {
26746b57806SIkjoon Jang        #address-cells = <1>;
26846b57806SIkjoon Jang        #size-cells = <0>;
26946b57806SIkjoon Jang
27046b57806SIkjoon Jang        cros-ec@0 {
27146b57806SIkjoon Jang            compatible = "google,cros-ec-spi";
27246b57806SIkjoon Jang            reg = <0x0>;
27346b57806SIkjoon Jang            google,cros-ec-spi-msg-delay = <30>;
27446b57806SIkjoon Jang            google,cros-ec-spi-pre-delay = <10>;
27546b57806SIkjoon Jang            interrupts = <99 0>;
27646b57806SIkjoon Jang            interrupt-parent = <&gpio7>;
27746b57806SIkjoon Jang            spi-max-frequency = <5000000>;
27819ad93bcSStephen Boyd
27919ad93bcSStephen Boyd            proximity {
28019ad93bcSStephen Boyd                compatible = "google,cros-ec-mkbp-proximity";
28119ad93bcSStephen Boyd            };
28280cf16deSIkjoon Jang
28380cf16deSIkjoon Jang            cbas {
28480cf16deSIkjoon Jang                compatible = "google,cros-cbas";
28580cf16deSIkjoon Jang            };
28646b57806SIkjoon Jang        };
28746b57806SIkjoon Jang    };
28846b57806SIkjoon Jang
28946b57806SIkjoon Jang  # Example for RPMSG
29046b57806SIkjoon Jang  - |
29146b57806SIkjoon Jang    scp0 {
29246b57806SIkjoon Jang        cros-ec {
29346b57806SIkjoon Jang            compatible = "google,cros-ec-rpmsg";
29446b57806SIkjoon Jang        };
29546b57806SIkjoon Jang    };
296e068bc0bSStephen Boyd
297e068bc0bSStephen Boyd  # Example for FPMCU
298e068bc0bSStephen Boyd  - |
299e068bc0bSStephen Boyd    spi {
300e068bc0bSStephen Boyd      #address-cells = <0x1>;
301e068bc0bSStephen Boyd      #size-cells = <0x0>;
302e068bc0bSStephen Boyd
303e068bc0bSStephen Boyd      ec@0 {
304e068bc0bSStephen Boyd        compatible = "google,cros-ec-fp", "google,cros-ec-spi";
305e068bc0bSStephen Boyd        reg = <0x0>;
306e068bc0bSStephen Boyd        interrupt-parent = <&gpio_controller>;
307e068bc0bSStephen Boyd        interrupts = <4 IRQ_TYPE_LEVEL_LOW>;
308e068bc0bSStephen Boyd        spi-max-frequency = <3000000>;
309e068bc0bSStephen Boyd        reset-gpios = <&gpio_controller 5 GPIO_ACTIVE_LOW>;
310e068bc0bSStephen Boyd        boot0-gpios = <&gpio_controller 10 GPIO_ACTIVE_HIGH>;
311e068bc0bSStephen Boyd        vdd-supply = <&pp3300_fp_mcu>;
312e068bc0bSStephen Boyd      };
313e068bc0bSStephen Boyd    };
3140c8884feSBhanu Prakash Maiya
3150c8884feSBhanu Prakash Maiya  # Example for UART
3160c8884feSBhanu Prakash Maiya  - |
3170c8884feSBhanu Prakash Maiya    serial {
3180c8884feSBhanu Prakash Maiya        cros-ec {
3190c8884feSBhanu Prakash Maiya            compatible = "google,cros-ec-uart";
3200c8884feSBhanu Prakash Maiya        };
3210c8884feSBhanu Prakash Maiya    };
32246b57806SIkjoon Jang...
323