1# Copyright (c) 2022, Andriy Gelman <andriy.gelman@gmail.com>
2# SPDX-License-Identifier: Apache-2.0
3
4description: |
5  The Infineon XMC4XXX pin controller is responsible for connecting peripheral outputs
6  to specific port/pins (also known as alternate functions) and configures pin properties.
7
8  The pinctrl settings are referenced in a device tree peripheral node. For example in a UART
9  node:
10
11  &usic1ch1 {
12      compatible = "infineon,xmc4xxx-uart";
13      pinctrl-0 = <&uart_tx_p0_1_u1c1 &uart_rx_p0_0_u1c1>;
14      pinctrl-names = "default";
15      input-src = "DX0D";
16      ...
17  };
18
19  pinctrl-0 is the phandle that stores the pin settings for two pins: &uart_tx_p0_1_u1c1
20  and &uart_rx_p0_0_u1c1. These nodes are pre-defined and their naming convention is designed
21  to help the user select the correct pin settings. Note the use of peripheral type,
22  pin direction, port/pin number and USIC in the name.
23
24  The pre-defined nodes only set the alternate function of the output pin. The
25  configuration for the pin (i.e. drive strength) should be set in the board setup.
26  The set of possible configurations are defined in the properties section below (in addition
27  to the inherited property-allowlist list from pincfg-node.yaml).
28
29  To create a new pin configuration, the user may append to the &pinctrl node, for example
30
31  #include <zephyr/dt-bindings/pinctrl/xmc4xxx-pinctrl.h>
32  &pinctrl {
33      my_node_config: my_node_config {
34      pinmux = <XMC4XXX_PINMUX_SET(0, 1, 2)>;
35      drive-push-pull;
36        ... other supported pin configurations ..
37  };
38  where XMC4XXX_PINMUX_SET(PORT, PIN, ALTERNATE_FUNCTION) is a helper macro for setting the
39  alternate function for a given port/pin. Setting ALTERNATE_FUNCTION = 0 means that no
40  alternate function is selected.
41
42  The pinctrl driver only sets the alternate function for output pins. The input mux is
43  handled by the peripheral drivers. For example the &usic1ch1 node has input-src property for
44  this purpose. There are no pre-defined nodes for the input mux and this must be properly set
45  by the user. Refer to the peripheral .yaml file (i.e. infineon,xmc4xxx-uart.yaml) and
46  XMC4XXX documentation.
47
48compatible: "infineon,xmc4xxx-pinctrl"
49
50include: base.yaml
51
52properties:
53  "#address-cells":
54    required: true
55    const: 1
56  "#size-cells":
57    required: true
58    const: 1
59
60child-binding:
61  description: Each child node defines the configuration for a particular state.
62
63  include:
64    - name: pincfg-node.yaml
65      property-allowlist:
66        - bias-pull-down
67        - bias-pull-up
68        - drive-push-pull
69        - drive-open-drain
70        - output-high
71        - output-low
72
73  properties:
74    pinmux:
75      description: |
76        Encodes port/pin and alternate function. See helper macro XMC4XX_PINMUX_SET().
77        Alternate function is only set for output pins; It selects  ALT1-ALT4
78        output line in the GPIO element. The alternate function for input pins is
79        handled separately by the peripheral. It is upto the peripheral to configure which
80        input pin to use (For example see parameter input-src in infineon,xmc4xxx-uart.yaml).
81      required: true
82      type: int
83
84    drive-strength:
85      description: |
86        Drive strength of the output pin. Following options as in XMC_GPIO_OUTPUT_STRENGTH
87        See xmc4_gpio.h. This only has an effect if the pin is in drive-push-pull mode.
88      required: true
89      type: string
90      enum:
91        - "strong-sharp-edge"
92        - "strong-medium-edge"
93        - "strong-soft-edge"
94        - "strong-slow-edge"
95        - "medium"
96        - "medium-unknown1-edge"
97        - "medium-unknown2-edge"
98        - "weak"
99
100    invert-input:
101      description: Inverts the input.
102      type: boolean
103
104    hwctrl:
105      description: Pre-assigns hardware control of the pin to a certain peripheral.
106      required: true
107      type: string
108      enum:
109        - "disabled"
110        - "periph1"
111        - "periph2"
112