1# Copyright (c) 2022 Renesas Electronics Corporation 2# SPDX-License-Identifier: Apache-2.0 3 4description: | 5 The SmartBond pin controller is a singleton node responsible for controlling 6 pin function selection and pin properties, such as routing a UART RX to pin 7 P1.8 and enabling the pullup resistor on that pin. 8 9 The node has the 'pinctrl' node label set in your SoC's devicetree, 10 so you can modify it like this: 11 12 &pinctrl { 13 /* your modifications go here */ 14 }; 15 16 All device pin configurations should be placed in child nodes of the 17 'pinctrl' node, as shown in this example: 18 19 /* You can put this in places like a board-pinctrl.dtsi file in 20 * your board directory, or a devicetree overlay in your application. 21 */ 22 23 /* include definitions and utility macros for the SoC used by the board */ 24 #include <dt-bindings/pinctrl/smartbond-pinctrl.h> 25 26 &pinctrl { 27 /* configuration for uart device, default state */ 28 uart_default: uart_default { 29 /* group 1 */ 30 group1 { 31 /* route UART TX to P0.9 */ 32 pinmux = <SMARTBOND_PINMUX(UART_TX, 0, 9)>; 33 }; 34 /* group 2 */ 35 group2 { 36 /* route UART RX to P0.8 and enable pull-up */ 37 pinmux = <SMARTBOND_PINMUX(UART_RX, 0, 8)>; 38 bias-pull-up; 39 }; 40 }; 41 }; 42 43 The 'uart0_default' child node encodes the pin configurations for a 44 particular state of a device; in this case, the default (that is, active) 45 state. 46 47 As shown, pin configurations are organized in groups within each child node. 48 Each group can specify a list of pin function selections in the 'pinmux' 49 property. Note that 'pinmux' property is an array so you can configure multiple 50 pins at once there. The SMARTBOND_PINMUX macro is used to create pinmux value. 51 52 A group can also specify shared pin properties common to all the specified 53 pins, such as the 'bias-pull-up' property in group 2. Here is a list of 54 supported standard pin properties: 55 56 - bias-pull-up: Enable pull-up resistor. 57 - bias-pull-down: Enable pull-down resistor. 58 59 Note that bias options are mutually exclusive. 60 61 To link this pin configuration with a device, use a pinctrl-N property 62 for some number N, like this example you could place in your board's DTS 63 file: 64 65 #include "board-pinctrl.dtsi" 66 67 &uart { 68 pinctrl-0 = <&uart_default>; 69 pinctrl-names = "default"; 70 }; 71 72compatible: "renesas,smartbond-pinctrl" 73 74include: base.yaml 75 76child-binding: 77 description: | 78 Definitions for a pinctrl state. 79 child-binding: 80 81 include: 82 - name: pincfg-node.yaml 83 property-allowlist: 84 - bias-pull-down 85 - bias-pull-up 86 - output-enable 87 - input-enable 88 89 properties: 90 pinmux: 91 required: true 92 type: array 93 description: | 94 An array of pins sharing the same group properties. The pins should 95 be defined using the SMARTBOND_PINMUX utility macro that encodes the port, 96 pin and function. 97