16732ae5cSJean-Christophe PLAGNIOL-VILLARD* Atmel AT91 Pinmux Controller 26732ae5cSJean-Christophe PLAGNIOL-VILLARD 3372c1d6dSMasanari IidaThe AT91 Pinmux Controller, enables the IC 46732ae5cSJean-Christophe PLAGNIOL-VILLARDto share one PAD to several functional blocks. The sharing is done by 56732ae5cSJean-Christophe PLAGNIOL-VILLARDmultiplexing the PAD input/output signals. For each PAD there are up to 66732ae5cSJean-Christophe PLAGNIOL-VILLARD8 muxing options (called periph modes). Since different modules require 75e553521SColin Ian Kingdifferent PAD settings (like pull up, keeper, etc) the controller controls 86732ae5cSJean-Christophe PLAGNIOL-VILLARDalso the PAD settings parameters. 96732ae5cSJean-Christophe PLAGNIOL-VILLARD 106732ae5cSJean-Christophe PLAGNIOL-VILLARDPlease refer to pinctrl-bindings.txt in this directory for details of the 116732ae5cSJean-Christophe PLAGNIOL-VILLARDcommon pinctrl bindings used by client devices, including the meaning of the 126732ae5cSJean-Christophe PLAGNIOL-VILLARDphrase "pin configuration node". 136732ae5cSJean-Christophe PLAGNIOL-VILLARD 146732ae5cSJean-Christophe PLAGNIOL-VILLARDAtmel AT91 pin configuration node is a node of a group of pins which can be 156732ae5cSJean-Christophe PLAGNIOL-VILLARDused for a specific device or function. This node represents both mux and config 166732ae5cSJean-Christophe PLAGNIOL-VILLARDof the pins in that group. The 'pins' selects the function mode(also named pin 176732ae5cSJean-Christophe PLAGNIOL-VILLARDmode) this pin can work on and the 'config' configures various pad settings 186732ae5cSJean-Christophe PLAGNIOL-VILLARDsuch as pull-up, multi drive, etc. 196732ae5cSJean-Christophe PLAGNIOL-VILLARD 206732ae5cSJean-Christophe PLAGNIOL-VILLARDRequired properties for iomux controller: 212467f110SBoris BREZILLON- compatible: "atmel,at91rm9200-pinctrl" or "atmel,at91sam9x5-pinctrl" 22fde84f19SClaudiu Beznea or "atmel,sama5d3-pinctrl" or "microchip,sam9x60-pinctrl" 236732ae5cSJean-Christophe PLAGNIOL-VILLARD- atmel,mux-mask: array of mask (periph per bank) to describe if a pin can be 246732ae5cSJean-Christophe PLAGNIOL-VILLARD configured in this periph mode. All the periph and bank need to be describe. 256732ae5cSJean-Christophe PLAGNIOL-VILLARD 266732ae5cSJean-Christophe PLAGNIOL-VILLARDHow to create such array: 276732ae5cSJean-Christophe PLAGNIOL-VILLARD 286732ae5cSJean-Christophe PLAGNIOL-VILLARDEach column will represent the possible peripheral of the pinctrl 296732ae5cSJean-Christophe PLAGNIOL-VILLARDEach line will represent a pio bank 306732ae5cSJean-Christophe PLAGNIOL-VILLARD 316732ae5cSJean-Christophe PLAGNIOL-VILLARDTake an example on the 9260 326732ae5cSJean-Christophe PLAGNIOL-VILLARDPeripheral: 2 ( A and B) 336732ae5cSJean-Christophe PLAGNIOL-VILLARDBank: 3 (A, B and C) 346732ae5cSJean-Christophe PLAGNIOL-VILLARD=> 356732ae5cSJean-Christophe PLAGNIOL-VILLARD 366732ae5cSJean-Christophe PLAGNIOL-VILLARD /* A B */ 376732ae5cSJean-Christophe PLAGNIOL-VILLARD 0xffffffff 0xffc00c3b /* pioA */ 386732ae5cSJean-Christophe PLAGNIOL-VILLARD 0xffffffff 0x7fff3ccf /* pioB */ 396732ae5cSJean-Christophe PLAGNIOL-VILLARD 0xffffffff 0x007fffff /* pioC */ 406732ae5cSJean-Christophe PLAGNIOL-VILLARD 41*f55f7f81SJonathan NeuschäferFor each peripheral/bank we will describe in a u32 if a pin can be 426732ae5cSJean-Christophe PLAGNIOL-VILLARDconfigured in it by putting 1 to the pin bit (1 << pin) 436732ae5cSJean-Christophe PLAGNIOL-VILLARD 446732ae5cSJean-Christophe PLAGNIOL-VILLARDLet's take the pioA on peripheral B 456732ae5cSJean-Christophe PLAGNIOL-VILLARDFrom the datasheet Table 10-2. 466732ae5cSJean-Christophe PLAGNIOL-VILLARDPeripheral B 476732ae5cSJean-Christophe PLAGNIOL-VILLARDPA0 MCDB0 486732ae5cSJean-Christophe PLAGNIOL-VILLARDPA1 MCCDB 496732ae5cSJean-Christophe PLAGNIOL-VILLARDPA2 506732ae5cSJean-Christophe PLAGNIOL-VILLARDPA3 MCDB3 516732ae5cSJean-Christophe PLAGNIOL-VILLARDPA4 MCDB2 526732ae5cSJean-Christophe PLAGNIOL-VILLARDPA5 MCDB1 536732ae5cSJean-Christophe PLAGNIOL-VILLARDPA6 546732ae5cSJean-Christophe PLAGNIOL-VILLARDPA7 556732ae5cSJean-Christophe PLAGNIOL-VILLARDPA8 566732ae5cSJean-Christophe PLAGNIOL-VILLARDPA9 576732ae5cSJean-Christophe PLAGNIOL-VILLARDPA10 ETX2 586732ae5cSJean-Christophe PLAGNIOL-VILLARDPA11 ETX3 596732ae5cSJean-Christophe PLAGNIOL-VILLARDPA12 606732ae5cSJean-Christophe PLAGNIOL-VILLARDPA13 616732ae5cSJean-Christophe PLAGNIOL-VILLARDPA14 626732ae5cSJean-Christophe PLAGNIOL-VILLARDPA15 636732ae5cSJean-Christophe PLAGNIOL-VILLARDPA16 646732ae5cSJean-Christophe PLAGNIOL-VILLARDPA17 656732ae5cSJean-Christophe PLAGNIOL-VILLARDPA18 666732ae5cSJean-Christophe PLAGNIOL-VILLARDPA19 676732ae5cSJean-Christophe PLAGNIOL-VILLARDPA20 686732ae5cSJean-Christophe PLAGNIOL-VILLARDPA21 696732ae5cSJean-Christophe PLAGNIOL-VILLARDPA22 ETXER 706732ae5cSJean-Christophe PLAGNIOL-VILLARDPA23 ETX2 716732ae5cSJean-Christophe PLAGNIOL-VILLARDPA24 ETX3 726732ae5cSJean-Christophe PLAGNIOL-VILLARDPA25 ERX2 736732ae5cSJean-Christophe PLAGNIOL-VILLARDPA26 ERX3 746732ae5cSJean-Christophe PLAGNIOL-VILLARDPA27 ERXCK 756732ae5cSJean-Christophe PLAGNIOL-VILLARDPA28 ECRS 766732ae5cSJean-Christophe PLAGNIOL-VILLARDPA29 ECOL 776732ae5cSJean-Christophe PLAGNIOL-VILLARDPA30 RXD4 786732ae5cSJean-Christophe PLAGNIOL-VILLARDPA31 TXD4 796732ae5cSJean-Christophe PLAGNIOL-VILLARD 806732ae5cSJean-Christophe PLAGNIOL-VILLARD=> 0xffc00c3b 816732ae5cSJean-Christophe PLAGNIOL-VILLARD 826732ae5cSJean-Christophe PLAGNIOL-VILLARDRequired properties for pin configuration node: 836732ae5cSJean-Christophe PLAGNIOL-VILLARD- atmel,pins: 4 integers array, represents a group of pins mux and config 846732ae5cSJean-Christophe PLAGNIOL-VILLARD setting. The format is atmel,pins = <PIN_BANK PIN_BANK_NUM PERIPH CONFIG>. 8545976c01SRichard Genoud The PERIPH 0 means gpio, PERIPH 1 is periph A, PERIPH 2 is periph B... 8645976c01SRichard Genoud PIN_BANK 0 is pioA, PIN_BANK 1 is pioB... 876732ae5cSJean-Christophe PLAGNIOL-VILLARD 886732ae5cSJean-Christophe PLAGNIOL-VILLARDBits used for CONFIG: 892de5da57SMarek RoszkoPULL_UP (1 << 0): indicate this pin needs a pull up. 902de5da57SMarek RoszkoMULTIDRIVE (1 << 1): indicate this pin needs to be configured as multi-drive. 912de5da57SMarek Roszko Multi-drive is equivalent to open-drain type output. 922de5da57SMarek RoszkoDEGLITCH (1 << 2): indicate this pin needs deglitch. 932de5da57SMarek RoszkoPULL_DOWN (1 << 3): indicate this pin needs a pull down. 942de5da57SMarek RoszkoDIS_SCHMIT (1 << 4): indicate this pin needs to the disable schmitt trigger. 952de5da57SMarek RoszkoDRIVE_STRENGTH (3 << 5): indicate the drive strength of the pin using the 962de5da57SMarek Roszko following values: 972de5da57SMarek Roszko 00 - No change (reset state value kept) 982de5da57SMarek Roszko 01 - Low 992de5da57SMarek Roszko 10 - Medium 1002de5da57SMarek Roszko 11 - High 10196bb12deSBoris BREZILLONOUTPUT (1 << 7): indicate this pin need to be configured as an output. 10296bb12deSBoris BREZILLONOUTPUT_VAL (1 << 8): output val (1 = high, 0 = low) 1035e07a820SClaudiu BezneaSLEWRATE (1 << 9): slew rate of the pin: 0 = disable, 1 = enable 1042de5da57SMarek RoszkoDEBOUNCE (1 << 16): indicate this pin needs debounce. 1052de5da57SMarek RoszkoDEBOUNCE_VAL (0x3fff << 17): debounce value. 1066732ae5cSJean-Christophe PLAGNIOL-VILLARD 1076732ae5cSJean-Christophe PLAGNIOL-VILLARDNOTE: 1086732ae5cSJean-Christophe PLAGNIOL-VILLARDSome requirements for using atmel,at91rm9200-pinctrl binding: 1096732ae5cSJean-Christophe PLAGNIOL-VILLARD1. We have pin function node defined under at91 controller node to represent 1106732ae5cSJean-Christophe PLAGNIOL-VILLARD what pinmux functions this SoC supports. 1116732ae5cSJean-Christophe PLAGNIOL-VILLARD2. The driver can use the function node's name and pin configuration node's 1126732ae5cSJean-Christophe PLAGNIOL-VILLARD name describe the pin function and group hierarchy. 1136732ae5cSJean-Christophe PLAGNIOL-VILLARD For example, Linux at91 pinctrl driver takes the function node's name 1146732ae5cSJean-Christophe PLAGNIOL-VILLARD as the function name and pin configuration node's name as group name to 1156732ae5cSJean-Christophe PLAGNIOL-VILLARD create the map table. 1166732ae5cSJean-Christophe PLAGNIOL-VILLARD3. Each pin configuration node should have a phandle, devices can set pins 1176732ae5cSJean-Christophe PLAGNIOL-VILLARD configurations by referring to the phandle of that pin configuration node. 1186732ae5cSJean-Christophe PLAGNIOL-VILLARD4. The gpio controller must be describe in the pinctrl simple-bus. 1196732ae5cSJean-Christophe PLAGNIOL-VILLARD 1201d741f2eSClaudiu BezneaFor each bank the required properties are: 121fde84f19SClaudiu Beznea- compatible: "atmel,at91sam9x5-gpio" or "atmel,at91rm9200-gpio" or 122fde84f19SClaudiu Beznea "microchip,sam9x60-gpio" 1231d741f2eSClaudiu Beznea- reg: physical base address and length of the controller's registers 1241d741f2eSClaudiu Beznea- interrupts: interrupt outputs from the controller 1251d741f2eSClaudiu Beznea- interrupt-controller: marks the device node as an interrupt controller 1261d741f2eSClaudiu Beznea- #interrupt-cells: should be 2; refer to ../interrupt-controller/interrupts.txt 1271d741f2eSClaudiu Beznea for more details. 1281d741f2eSClaudiu Beznea- gpio-controller 1291d741f2eSClaudiu Beznea- #gpio-cells: should be 2; the first cell is the GPIO number and the second 1301d741f2eSClaudiu Beznea cell specifies GPIO flags as defined in <dt-bindings/gpio/gpio.h>. 1311d741f2eSClaudiu Beznea- clocks: bank clock 1321d741f2eSClaudiu Beznea 1336732ae5cSJean-Christophe PLAGNIOL-VILLARDExamples: 1346732ae5cSJean-Christophe PLAGNIOL-VILLARD 1356732ae5cSJean-Christophe PLAGNIOL-VILLARDpinctrl@fffff400 { 1366732ae5cSJean-Christophe PLAGNIOL-VILLARD #address-cells = <1>; 1376732ae5cSJean-Christophe PLAGNIOL-VILLARD #size-cells = <1>; 1386732ae5cSJean-Christophe PLAGNIOL-VILLARD ranges; 1396732ae5cSJean-Christophe PLAGNIOL-VILLARD compatible = "atmel,at91rm9200-pinctrl", "simple-bus"; 1406732ae5cSJean-Christophe PLAGNIOL-VILLARD reg = <0xfffff400 0x600>; 1416732ae5cSJean-Christophe PLAGNIOL-VILLARD 1421d741f2eSClaudiu Beznea pioA: gpio@fffff400 { 1431d741f2eSClaudiu Beznea compatible = "atmel,at91sam9x5-gpio"; 1441d741f2eSClaudiu Beznea reg = <0xfffff400 0x200>; 1451d741f2eSClaudiu Beznea interrupts = <2 IRQ_TYPE_LEVEL_HIGH 1>; 1461d741f2eSClaudiu Beznea #gpio-cells = <2>; 1471d741f2eSClaudiu Beznea gpio-controller; 1481d741f2eSClaudiu Beznea interrupt-controller; 1491d741f2eSClaudiu Beznea #interrupt-cells = <2>; 1501d741f2eSClaudiu Beznea clocks = <&pmc PMC_TYPE_PERIPHERAL 2>; 1511d741f2eSClaudiu Beznea }; 1521d741f2eSClaudiu Beznea 1536732ae5cSJean-Christophe PLAGNIOL-VILLARD atmel,mux-mask = < 1546732ae5cSJean-Christophe PLAGNIOL-VILLARD /* A B */ 1556732ae5cSJean-Christophe PLAGNIOL-VILLARD 0xffffffff 0xffc00c3b /* pioA */ 1566732ae5cSJean-Christophe PLAGNIOL-VILLARD 0xffffffff 0x7fff3ccf /* pioB */ 1576732ae5cSJean-Christophe PLAGNIOL-VILLARD 0xffffffff 0x007fffff /* pioC */ 1586732ae5cSJean-Christophe PLAGNIOL-VILLARD >; 1596732ae5cSJean-Christophe PLAGNIOL-VILLARD 1606732ae5cSJean-Christophe PLAGNIOL-VILLARD /* shared pinctrl settings */ 1616732ae5cSJean-Christophe PLAGNIOL-VILLARD dbgu { 1626732ae5cSJean-Christophe PLAGNIOL-VILLARD pinctrl_dbgu: dbgu-0 { 1636732ae5cSJean-Christophe PLAGNIOL-VILLARD atmel,pins = 1646732ae5cSJean-Christophe PLAGNIOL-VILLARD <1 14 0x1 0x0 /* PB14 periph A */ 16545976c01SRichard Genoud 1 15 0x1 0x1>; /* PB15 periph A with pullup */ 1666732ae5cSJean-Christophe PLAGNIOL-VILLARD }; 1676732ae5cSJean-Christophe PLAGNIOL-VILLARD }; 1686732ae5cSJean-Christophe PLAGNIOL-VILLARD}; 1696732ae5cSJean-Christophe PLAGNIOL-VILLARD 1706732ae5cSJean-Christophe PLAGNIOL-VILLARDdbgu: serial@fffff200 { 1716732ae5cSJean-Christophe PLAGNIOL-VILLARD compatible = "atmel,at91sam9260-usart"; 1726732ae5cSJean-Christophe PLAGNIOL-VILLARD reg = <0xfffff200 0x200>; 1736732ae5cSJean-Christophe PLAGNIOL-VILLARD interrupts = <1 4 7>; 1746732ae5cSJean-Christophe PLAGNIOL-VILLARD pinctrl-names = "default"; 1756732ae5cSJean-Christophe PLAGNIOL-VILLARD pinctrl-0 = <&pinctrl_dbgu>; 1766732ae5cSJean-Christophe PLAGNIOL-VILLARD}; 177