1# Copyright (c) 2022 Silicon Labs 2# SPDX-License-Identifier: Apache-2.0 3 4description: | 5 The Silabs pin controller is a singleton node responsible for controlling 6 pin function selection and pin properties. For example, you can use this 7 node to route UART0 RX to pin P0.1 and enable the pull-up resistor on the 8 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 &pinctrl { 24 /* configuration for usart0 device, default state */ 25 usart0_default: usart0_default { 26 /* group 1 ('group1' name is arbitrary) */ 27 group1 { 28 /* configure P0.1 as UART_TX and P0.2 as UART_RTS */ 29 psels = <GECKO_PSEL(UART_TX, A, 1)>, <GECKO_PSEL(UART_RTS, A, 2)>; 30 }; 31 /* group 2 */ 32 group2 { 33 /* configure P0.3 as UART_RX and P0.4 as UART_CTS */ 34 psels = <GECKO_PSEL(UART_RX, A, 3)>, <GECKO_PSEL(UART_CTS, A, 4)>; 35 }; 36 }; 37 }; 38 39 The 'usart0_default' child node encodes the pin configurations for a 40 particular state of a device; in this case, the default (that is, active) 41 state. You would specify the low-power configuration for the same device 42 in a separate child node. 43 44 As shown, pin configurations are organized in groups within each child node. 45 Each group can specify a list of pin function selections in the 'psels' 46 property. The GECKO_PSEL macro is used to specify a pin function selection. 47 Available pin functions can be found in the 48 include/dt-bindings/pinctrl/gecko-pinctrl.h header file. 49 50 To link this pin configuration with a device, use a pinctrl-N property 51 for some number N, like this example you could place in your board's DTS 52 file: 53 54 #include "board-pinctrl.dtsi" 55 56 &usart0 { 57 pinctrl-0 = <&usart0_default>; 58 pinctrl-names = "default"; 59 }; 60 61compatible: "silabs,gecko-pinctrl" 62 63include: base.yaml 64 65child-binding: 66 description: | 67 Silabs pin controller pin configuration state nodes. 68 include: pincfg-node.yaml 69 child-binding: 70 description: | 71 Silabs pin controller pin configuration group. 72 properties: 73 psels: 74 required: true 75 type: array 76 description: | 77 An array of pins sharing the same group properties. The pins should 78 be defined using the GECKO_PSEL utility macro that encodes the port, 79 pin and function. 80