1# Copyright (c) 2022 ITE Corporation. All Rights Reserved.
2# SPDX-License-Identifier: Apache-2.0
3
4description: |
5    The ITE IT8XXX2 pin controller is a node responsible for controlling
6    pin function selection and pin properties. For example, you can
7    use this node to route UART1 RX and TX setting the alternate
8    function on the pin.
9
10    The node has the 'pinctrl' node label set in your SoC's devicetree,
11    so you can modify it like this:
12
13      &pinctrl {
14              /* your modifications go here */
15      };
16
17    All device pin configurations should be placed in child nodes of the
18    'pinctrl' node, as shown in this example:
19
20      /* You can put this in places like a board-pinctrl.dtsi file in
21       * your board directory, or a devicetree overlay in your application.
22       */
23
24      /* include pre-defined pins and functions for the SoC used by the board */
25      #include <dt-bindings/pinctrl/it8xxx2-pinctrl.h>
26
27      &pinctrl {
28        /* configuration for I2C0 default state */
29        i2c0_clk_pb3_default: i2c0_clk_pb3_default {
30                pinmuxs = <&pinctrlb 3 IT8XXX2_ALT_FUNC_1>;
31                gpio-voltage = "1p8";
32        };
33        i2c0_data_pb4_default: i2c0_data_pb4_default {
34                pinmuxs = <&pinctrlb 4 IT8XXX2_ALT_FUNC_1>;
35                gpio-voltage = "1v8";
36        };
37        /* configuration for UART0 default state */
38        uart1_rx_pb0_default: uart1_rx_pb0_default {
39                pinmuxs = <&pinctrlb 0 IT8XXX2_ALT_FUNC_3>;
40                bias-pull-up;
41        };
42        uart1_tx_pb1_default: uart1_tx_pb1_default {
43                pinmuxs = <&pinctrlb 1 IT8XXX2_ALT_FUNC_3>;
44        };
45      };
46
47    The 'uart1_rx_pb0_default' child node encodes the pin configurations
48    for a particular state of a device; in this case, the default
49    (that is, active) state.
50
51    To link pin configurations with a device, use a pinctrl-N property for some
52    number N, like this example you could place in your board's DTS file:
53
54      #include "board-pinctrl.dtsi"
55
56      &uart0 {
57        pinctrl-0 = <&uart1_rx_pb0_default &uart1_tx_pb1_default>;
58        pinctrl-1 = <&uart1_rx_pb0_sleep &uart1_tx_pb1_sleep>;
59        pinctrl-names = "default", "sleep";
60      };
61
62compatible: "ite,it8xxx2-pinctrl"
63
64include: base.yaml
65
66child-binding:
67  description: |
68      This binding gives a base representation of the ITE IT8XXX2 pins configuration.
69
70  include:
71    - name: pincfg-node.yaml
72      property-allowlist:
73        - bias-high-impedance
74        - bias-pull-pin-default
75        - bias-pull-up
76        - bias-pull-down
77        - input-enable
78        - drive-push-pull
79        - drive-open-drain
80
81  properties:
82    pinmuxs:
83      required: true
84      type: phandle-array
85      description: |
86          ITE IT8XXX2 pin's configuration (pinctrl node, pin and function).
87
88    gpio-voltage:
89      type: string
90      description: |
91          Pin input voltage selection 3.3V or 1.8V. All gpio pins support 3.3V.
92          This property only needs to be configured if the board specifies a
93          pin as 1.8V. So the default is 3.3V.
94          kSI[7:0] and KSO[15:0] pins only support 3.3V.
95      default: "3v3"
96      enum:
97        - "3v3"
98        - "1v8"
99