1* Atmel AT91 Pinmux Controller 2 3The AT91 Pinmux Controller, enables the IC 4to share one PAD to several functional blocks. The sharing is done by 5multiplexing the PAD input/output signals. For each PAD there are up to 68 muxing options (called periph modes). Since different modules require 7different PAD settings (like pull up, keeper, etc) the controller controls 8also the PAD settings parameters. 9 10Please refer to pinctrl-bindings.txt in this directory for details of the 11common pinctrl bindings used by client devices, including the meaning of the 12phrase "pin configuration node". 13 14Atmel AT91 pin configuration node is a node of a group of pins which can be 15used for a specific device or function. This node represents both mux and config 16of the pins in that group. The 'pins' selects the function mode(also named pin 17mode) this pin can work on and the 'config' configures various pad settings 18such as pull-up, multi drive, etc. 19 20Required properties for iomux controller: 21- compatible: "atmel,at91rm9200-pinctrl" or "atmel,at91sam9x5-pinctrl" 22 or "atmel,sama5d3-pinctrl" 23- atmel,mux-mask: array of mask (periph per bank) to describe if a pin can be 24 configured in this periph mode. All the periph and bank need to be describe. 25 26How to create such array: 27 28Each column will represent the possible peripheral of the pinctrl 29Each line will represent a pio bank 30 31Take an example on the 9260 32Peripheral: 2 ( A and B) 33Bank: 3 (A, B and C) 34=> 35 36 /* A B */ 37 0xffffffff 0xffc00c3b /* pioA */ 38 0xffffffff 0x7fff3ccf /* pioB */ 39 0xffffffff 0x007fffff /* pioC */ 40 41For each peripheral/bank we will descibe in a u32 if a pin can be 42configured in it by putting 1 to the pin bit (1 << pin) 43 44Let's take the pioA on peripheral B 45From the datasheet Table 10-2. 46Peripheral B 47PA0 MCDB0 48PA1 MCCDB 49PA2 50PA3 MCDB3 51PA4 MCDB2 52PA5 MCDB1 53PA6 54PA7 55PA8 56PA9 57PA10 ETX2 58PA11 ETX3 59PA12 60PA13 61PA14 62PA15 63PA16 64PA17 65PA18 66PA19 67PA20 68PA21 69PA22 ETXER 70PA23 ETX2 71PA24 ETX3 72PA25 ERX2 73PA26 ERX3 74PA27 ERXCK 75PA28 ECRS 76PA29 ECOL 77PA30 RXD4 78PA31 TXD4 79 80=> 0xffc00c3b 81 82Required properties for pin configuration node: 83- atmel,pins: 4 integers array, represents a group of pins mux and config 84 setting. The format is atmel,pins = <PIN_BANK PIN_BANK_NUM PERIPH CONFIG>. 85 The PERIPH 0 means gpio, PERIPH 1 is periph A, PERIPH 2 is periph B... 86 PIN_BANK 0 is pioA, PIN_BANK 1 is pioB... 87 88Bits used for CONFIG: 89PULL_UP (1 << 0): indicate this pin needs a pull up. 90MULTIDRIVE (1 << 1): indicate this pin needs to be configured as multi-drive. 91 Multi-drive is equivalent to open-drain type output. 92DEGLITCH (1 << 2): indicate this pin needs deglitch. 93PULL_DOWN (1 << 3): indicate this pin needs a pull down. 94DIS_SCHMIT (1 << 4): indicate this pin needs to the disable schmitt trigger. 95DRIVE_STRENGTH (3 << 5): indicate the drive strength of the pin using the 96 following values: 97 00 - No change (reset state value kept) 98 01 - Low 99 10 - Medium 100 11 - High 101OUTPUT (1 << 7): indicate this pin need to be configured as an output. 102OUTPUT_VAL (1 << 8): output val (1 = high, 0 = low) 103DEBOUNCE (1 << 16): indicate this pin needs debounce. 104DEBOUNCE_VAL (0x3fff << 17): debounce value. 105 106NOTE: 107Some requirements for using atmel,at91rm9200-pinctrl binding: 1081. We have pin function node defined under at91 controller node to represent 109 what pinmux functions this SoC supports. 1102. The driver can use the function node's name and pin configuration node's 111 name describe the pin function and group hierarchy. 112 For example, Linux at91 pinctrl driver takes the function node's name 113 as the function name and pin configuration node's name as group name to 114 create the map table. 1153. Each pin configuration node should have a phandle, devices can set pins 116 configurations by referring to the phandle of that pin configuration node. 1174. The gpio controller must be describe in the pinctrl simple-bus. 118 119Examples: 120 121pinctrl@fffff400 { 122 #address-cells = <1>; 123 #size-cells = <1>; 124 ranges; 125 compatible = "atmel,at91rm9200-pinctrl", "simple-bus"; 126 reg = <0xfffff400 0x600>; 127 128 atmel,mux-mask = < 129 /* A B */ 130 0xffffffff 0xffc00c3b /* pioA */ 131 0xffffffff 0x7fff3ccf /* pioB */ 132 0xffffffff 0x007fffff /* pioC */ 133 >; 134 135 /* shared pinctrl settings */ 136 dbgu { 137 pinctrl_dbgu: dbgu-0 { 138 atmel,pins = 139 <1 14 0x1 0x0 /* PB14 periph A */ 140 1 15 0x1 0x1>; /* PB15 periph A with pullup */ 141 }; 142 }; 143}; 144 145dbgu: serial@fffff200 { 146 compatible = "atmel,at91sam9260-usart"; 147 reg = <0xfffff200 0x200>; 148 interrupts = <1 4 7>; 149 pinctrl-names = "default"; 150 pinctrl-0 = <&pinctrl_dbgu>; 151}; 152