···11+* Atmel AT91 Pinmux Controller22+33+The AT91 Pinmux Controler, enables the IC44+to share one PAD to several functional blocks. The sharing is done by55+multiplexing the PAD input/output signals. For each PAD there are up to66+8 muxing options (called periph modes). Since different modules require77+different PAD settings (like pull up, keeper, etc) the contoller controls88+also the PAD settings parameters.99+1010+Please refer to pinctrl-bindings.txt in this directory for details of the1111+common pinctrl bindings used by client devices, including the meaning of the1212+phrase "pin configuration node".1313+1414+Atmel AT91 pin configuration node is a node of a group of pins which can be1515+used for a specific device or function. This node represents both mux and config1616+of the pins in that group. The 'pins' selects the function mode(also named pin1717+mode) this pin can work on and the 'config' configures various pad settings1818+such as pull-up, multi drive, etc.1919+2020+Required properties for iomux controller:2121+- compatible: "atmel,at91rm9200-pinctrl"2222+- atmel,mux-mask: array of mask (periph per bank) to describe if a pin can be2323+ configured in this periph mode. All the periph and bank need to be describe.2424+2525+How to create such array:2626+2727+Each column will represent the possible peripheral of the pinctrl2828+Each line will represent a pio bank2929+3030+Take an example on the 92603131+Peripheral: 2 ( A and B)3232+Bank: 3 (A, B and C)3333+=>3434+3535+ /* A B */3636+ 0xffffffff 0xffc00c3b /* pioA */3737+ 0xffffffff 0x7fff3ccf /* pioB */3838+ 0xffffffff 0x007fffff /* pioC */3939+4040+For each peripheral/bank we will descibe in a u32 if a pin can can be4141+configured in it by putting 1 to the pin bit (1 << pin)4242+4343+Let's take the pioA on peripheral B4444+From the datasheet Table 10-2.4545+Peripheral B4646+PA0 MCDB04747+PA1 MCCDB4848+PA24949+PA3 MCDB35050+PA4 MCDB25151+PA5 MCDB15252+PA65353+PA75454+PA85555+PA95656+PA10 ETX25757+PA11 ETX35858+PA125959+PA136060+PA146161+PA156262+PA166363+PA176464+PA186565+PA196666+PA206767+PA216868+PA22 ETXER6969+PA23 ETX27070+PA24 ETX37171+PA25 ERX27272+PA26 ERX37373+PA27 ERXCK7474+PA28 ECRS7575+PA29 ECOL7676+PA30 RXD47777+PA31 TXD47878+7979+=> 0xffc00c3b8080+8181+Required properties for pin configuration node:8282+- atmel,pins: 4 integers array, represents a group of pins mux and config8383+ setting. The format is atmel,pins = <PIN_BANK PIN_BANK_NUM PERIPH CONFIG>.8484+ The PERIPH 0 means gpio.8585+8686+Bits used for CONFIG:8787+PULL_UP(1 << 0): indicate this pin need a pull up.8888+MULTIDRIVE(1 << 1): indicate this pin need to be configured as multidrive.8989+9090+NOTE:9191+Some requirements for using atmel,at91rm9200-pinctrl binding:9292+1. We have pin function node defined under at91 controller node to represent9393+ what pinmux functions this SoC supports.9494+2. The driver can use the function node's name and pin configuration node's9595+ name describe the pin function and group hierarchy.9696+ For example, Linux at91 pinctrl driver takes the function node's name9797+ as the function name and pin configuration node's name as group name to9898+ create the map table.9999+3. Each pin configuration node should have a phandle, devices can set pins100100+ configurations by referring to the phandle of that pin configuration node.101101+4. The gpio controller must be describe in the pinctrl simple-bus.102102+103103+Examples:104104+105105+pinctrl@fffff400 {106106+ #address-cells = <1>;107107+ #size-cells = <1>;108108+ ranges;109109+ compatible = "atmel,at91rm9200-pinctrl", "simple-bus";110110+ reg = <0xfffff400 0x600>;111111+112112+ atmel,mux-mask = <113113+ /* A B */114114+ 0xffffffff 0xffc00c3b /* pioA */115115+ 0xffffffff 0x7fff3ccf /* pioB */116116+ 0xffffffff 0x007fffff /* pioC */117117+ >;118118+119119+ /* shared pinctrl settings */120120+ dbgu {121121+ pinctrl_dbgu: dbgu-0 {122122+ atmel,pins =123123+ <1 14 0x1 0x0 /* PB14 periph A */124124+ 1 15 0x1 0x1>; /* PB15 periph with pullup */125125+ };126126+ };127127+};128128+129129+dbgu: serial@fffff200 {130130+ compatible = "atmel,at91sam9260-usart";131131+ reg = <0xfffff200 0x200>;132132+ interrupts = <1 4 7>;133133+ pinctrl-names = "default";134134+ pinctrl-0 = <&pinctrl_dbgu>;135135+ status = "disabled";136136+};
···330330 select IRQ_DOMAIN331331 select NEED_MACH_GPIO_H332332 select NEED_MACH_IO_H if PCCARD333333+ select PINCTRL334334+ select PINCTRL_AT91 if USE_OF333335 help334336 This enables support for systems based on Atmel335337 AT91RM9200 and AT91SAM9* processors.
···11+/*22+ * at91sam9x5ek.dtsi - Device Tree file for AT91SAM9x5CM Base board33+ *44+ * Copyright (C) 2012 Atmel,55+ * 2012 Nicolas Ferre <nicolas.ferre@atmel.com>66+ *77+ * Licensed under GPLv2 or later.88+ */99+/include/ "at91sam9x5cm.dtsi"1010+1111+/ {1212+ model = "Atmel AT91SAM9X5-EK";1313+ compatible = "atmel,at91sam9x5ek", "atmel,at91sam9x5", "atmel,at91sam9";1414+1515+ chosen {1616+ bootargs = "128M console=ttyS0,115200 root=/dev/mtdblock1 rw rootfstype=ubifs ubi.mtd=1 root=ubi0:rootfs";1717+ };1818+1919+ ahb {2020+ apb {2121+ dbgu: serial@fffff200 {2222+ status = "okay";2323+ };2424+2525+ usart0: serial@f801c000 {2626+ status = "okay";2727+ };2828+2929+ macb0: ethernet@f802c000 {3030+ phy-mode = "rmii";3131+ status = "okay";3232+ };3333+3434+ i2c0: i2c@f8010000 {3535+ status = "okay";3636+ };3737+3838+ i2c1: i2c@f8014000 {3939+ status = "okay";4040+ };4141+4242+ i2c2: i2c@f8018000 {4343+ status = "okay";4444+ };4545+ };4646+4747+ usb0: ohci@00600000 {4848+ status = "okay";4949+ num-ports = <2>;5050+ atmel,vbus-gpio = <&pioD 19 15151+ &pioD 20 15252+ >;5353+ };5454+5555+ usb1: ehci@00700000 {5656+ status = "okay";5757+ };5858+ };5959+};
+1
arch/arm/configs/at91_dt_defconfig
···111111CONFIG_I2C_GPIO=y112112CONFIG_SPI=y113113CONFIG_SPI_ATMEL=y114114+CONFIG_PINCTRL_AT91=y114115# CONFIG_HWMON is not set115116CONFIG_WATCHDOG=y116117CONFIG_AT91SAM9X_WATCHDOG=y
···4141#include <linux/gpio.h>4242#include <linux/io.h>4343#include <linux/platform_data/atmel.h>4444+#include <linux/pinctrl/consumer.h>44454546#include <mach/cpu.h>4647···13711370 struct resource *mem;13721371 struct mtd_part_parser_data ppdata = {};13731372 int res;13731373+ struct pinctrl *pinctrl;1374137413751375 mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);13761376 if (!mem) {···14151413 nand_chip->IO_ADDR_R = host->io_base;14161414 nand_chip->IO_ADDR_W = host->io_base;14171415 nand_chip->cmd_ctrl = atmel_nand_cmd_ctrl;14161416+14171417+ pinctrl = devm_pinctrl_get_select_default(&pdev->dev);14181418+ if (IS_ERR(pinctrl)) {14191419+ dev_err(host->dev, "Failed to request pinctrl\n");14201420+ res = PTR_ERR(pinctrl);14211421+ goto err_ecc_ioremap;14221422+ }1418142314191424 if (gpio_is_valid(host->board.rdy_pin)) {14201425 res = gpio_request(host->board.rdy_pin, "nand_rdy");
+9
drivers/pinctrl/Kconfig
···2626 help2727 Say Y here to add some extra checks and diagnostics to PINCTRL calls.28282929+config PINCTRL_AT913030+ bool "AT91 pinctrl driver"3131+ depends on OF3232+ depends on ARCH_AT913333+ select PINMUX3434+ select PINCONF3535+ help3636+ Say Y here to enable the at91 pinctrl driver3737+2938config PINCTRL_BCM28353039 bool3140 select PINMUX