aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDong Aisheng <dong.aisheng@linaro.org>2012-04-27 08:26:16 -0400
committerLinus Walleij <linus.walleij@linaro.org>2012-05-01 19:14:40 -0400
commitae75ff8145384000e27eaa805c12e6971e3bec45 (patch)
treeee39861c7e28f59bf456bc814790d4585d6cb4cb
parent183f1d0c6450ee032d97a2d01ed5eb00e0dbaa49 (diff)
pinctrl: pinctrl-imx: add imx pinctrl core driver
The driver has mux and config support while the gpio is still not supported. For select input setting, the driver will handle it internally and do not need user to take care of it. The pinctrl-imx core driver will parse the dts file and dynamically create the pinmux functions and groups. Each IMX SoC pinctrl driver should register pins with a pin register map including mux register and config register and select input map to core for proper operations. Acked-by: Stephen Warren <swarren@wwwdotorg.org> Acked-by: Shawn Guo <shawn.guo@linaro.org> Signed-off-by: Dong Aisheng <dong.aisheng@linaro.org> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
-rw-r--r--Documentation/devicetree/bindings/pinctrl/fsl,imx-pinctrl.txt95
-rw-r--r--drivers/pinctrl/Kconfig5
-rw-r--r--drivers/pinctrl/Makefile1
-rw-r--r--drivers/pinctrl/pinctrl-imx.c627
-rw-r--r--drivers/pinctrl/pinctrl-imx.h106
5 files changed, 834 insertions, 0 deletions
diff --git a/Documentation/devicetree/bindings/pinctrl/fsl,imx-pinctrl.txt b/Documentation/devicetree/bindings/pinctrl/fsl,imx-pinctrl.txt
new file mode 100644
index 000000000000..ab19e6bc7d3b
--- /dev/null
+++ b/Documentation/devicetree/bindings/pinctrl/fsl,imx-pinctrl.txt
@@ -0,0 +1,95 @@
1* Freescale IOMUX Controller (IOMUXC) for i.MX
2
3The IOMUX Controller (IOMUXC), together with the IOMUX, 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 ALT modes). Since different modules require
7different PAD settings (like pull up, keeper, etc) the IOMUXC 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
14Freescale IMX 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 'mux' selects the function mode(also named mux
17mode) this pin can work on and the 'config' configures various pad settings
18such as pull-up, open drain, drive strength, etc.
19
20Required properties for iomux controller:
21- compatible: "fsl,<soc>-iomuxc"
22 Please refer to each fsl,<soc>-pinctrl.txt binding doc for supported SoCs.
23
24Required properties for pin configuration node:
25- fsl,pins: two integers array, represents a group of pins mux and config
26 setting. The format is fsl,pins = <PIN_FUNC_ID CONFIG>, PIN_FUNC_ID is a
27 pin working on a specific function, CONFIG is the pad setting value like
28 pull-up on this pin. Please refer to fsl,<soc>-pinctrl.txt for the valid
29 pins and functions of each SoC.
30
31Bits used for CONFIG:
32NO_PAD_CTL(1 << 31): indicate this pin does not need config.
33
34SION(1 << 30): Software Input On Field.
35Force the selected mux mode input path no matter of MUX_MODE functionality.
36By default the input path is determined by functionality of the selected
37mux mode (regular).
38
39Other bits are used for PAD setting.
40Please refer to each fsl,<soc>-pinctrl,txt binding doc for SoC specific part
41of bits definitions.
42
43NOTE:
44Some requirements for using fsl,imx-pinctrl binding:
451. We have pin function node defined under iomux controller node to represent
46 what pinmux functions this SoC supports.
472. The pin configuration node intends to work on a specific function should
48 to be defined under that specific function node.
49 The function node's name should represent well about what function
50 this group of pins in this pin configuration node are working on.
513. The driver can use the function node's name and pin configuration node's
52 name describe the pin function and group hierarchy.
53 For example, Linux IMX pinctrl driver takes the function node's name
54 as the function name and pin configuration node's name as group name to
55 create the map table.
564. Each pin configuration node should have a phandle, devices can set pins
57 configurations by referring to the phandle of that pin configuration node.
58
59Examples:
60usdhc@0219c000 { /* uSDHC4 */
61 fsl,card-wired;
62 vmmc-supply = <&reg_3p3v>;
63 status = "okay";
64 pinctrl-names = "default";
65 pinctrl-0 = <&pinctrl_usdhc4_1>;
66};
67
68iomuxc@020e0000 {
69 compatible = "fsl,imx6q-iomuxc";
70 reg = <0x020e0000 0x4000>;
71
72 /* shared pinctrl settings */
73 usdhc4 {
74 pinctrl_usdhc4_1: usdhc4grp-1 {
75 fsl,pins = <1386 0x17059 /* MX6Q_PAD_SD4_CMD__USDHC4_CMD */
76 1392 0x10059 /* MX6Q_PAD_SD4_CLK__USDHC4_CLK */
77 1462 0x17059 /* MX6Q_PAD_SD4_DAT0__USDHC4_DAT0 */
78 1470 0x17059 /* MX6Q_PAD_SD4_DAT1__USDHC4_DAT1 */
79 1478 0x17059 /* MX6Q_PAD_SD4_DAT2__USDHC4_DAT2 */
80 1486 0x17059 /* MX6Q_PAD_SD4_DAT3__USDHC4_DAT3 */
81 1493 0x17059 /* MX6Q_PAD_SD4_DAT4__USDHC4_DAT4 */
82 1501 0x17059 /* MX6Q_PAD_SD4_DAT5__USDHC4_DAT5 */
83 1509 0x17059 /* MX6Q_PAD_SD4_DAT6__USDHC4_DAT6 */
84 1517 0x17059>; /* MX6Q_PAD_SD4_DAT7__USDHC4_DAT7 */
85 };
86 };
87 ....
88};
89Refer to the IOMUXC controller chapter in imx6q datasheet,
900x17059 means enable hysteresis, 47KOhm Pull Up, 50Mhz speed,
9180Ohm driver strength and Fast Slew Rate.
92User should refer to each SoC spec to set the correct value.
93
94TODO: when dtc macro support is available, we can change above raw data
95to dt macro which can get better readability in dts file.
diff --git a/drivers/pinctrl/Kconfig b/drivers/pinctrl/Kconfig
index f73a5ea89754..aad28826d39b 100644
--- a/drivers/pinctrl/Kconfig
+++ b/drivers/pinctrl/Kconfig
@@ -26,6 +26,11 @@ config DEBUG_PINCTRL
26 help 26 help
27 Say Y here to add some extra checks and diagnostics to PINCTRL calls. 27 Say Y here to add some extra checks and diagnostics to PINCTRL calls.
28 28
29config PINCTRL_IMX
30 bool
31 select PINMUX
32 select PINCONF
33
29config PINCTRL_PXA3xx 34config PINCTRL_PXA3xx
30 bool 35 bool
31 select PINMUX 36 select PINMUX
diff --git a/drivers/pinctrl/Makefile b/drivers/pinctrl/Makefile
index 8e3c95a02fbd..a01a97cfe640 100644
--- a/drivers/pinctrl/Makefile
+++ b/drivers/pinctrl/Makefile
@@ -9,6 +9,7 @@ ifeq ($(CONFIG_OF),y)
9obj-$(CONFIG_PINCTRL) += devicetree.o 9obj-$(CONFIG_PINCTRL) += devicetree.o
10endif 10endif
11obj-$(CONFIG_GENERIC_PINCONF) += pinconf-generic.o 11obj-$(CONFIG_GENERIC_PINCONF) += pinconf-generic.o
12obj-$(CONFIG_PINCTRL_IMX) += pinctrl-imx.o
12obj-$(CONFIG_PINCTRL_PXA3xx) += pinctrl-pxa3xx.o 13obj-$(CONFIG_PINCTRL_PXA3xx) += pinctrl-pxa3xx.o
13obj-$(CONFIG_PINCTRL_MMP2) += pinctrl-mmp2.o 14obj-$(CONFIG_PINCTRL_MMP2) += pinctrl-mmp2.o
14obj-$(CONFIG_PINCTRL_PXA168) += pinctrl-pxa168.o 15obj-$(CONFIG_PINCTRL_PXA168) += pinctrl-pxa168.o
diff --git a/drivers/pinctrl/pinctrl-imx.c b/drivers/pinctrl/pinctrl-imx.c
new file mode 100644
index 000000000000..8faf613ff1b2
--- /dev/null
+++ b/drivers/pinctrl/pinctrl-imx.c
@@ -0,0 +1,627 @@
1/*
2 * Core driver for the imx pin controller
3 *
4 * Copyright (C) 2012 Freescale Semiconductor, Inc.
5 * Copyright (C) 2012 Linaro Ltd.
6 *
7 * Author: Dong Aisheng <dong.aisheng@linaro.org>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 */
14
15#include <linux/err.h>
16#include <linux/init.h>
17#include <linux/io.h>
18#include <linux/module.h>
19#include <linux/of.h>
20#include <linux/of_device.h>
21#include <linux/pinctrl/machine.h>
22#include <linux/pinctrl/pinconf.h>
23#include <linux/pinctrl/pinctrl.h>
24#include <linux/pinctrl/pinmux.h>
25#include <linux/slab.h>
26
27#include "core.h"
28#include "pinctrl-imx.h"
29
30#define IMX_PMX_DUMP(info, p, m, c, n) \
31{ \
32 int i, j; \
33 printk("Format: Pin Mux Config\n"); \
34 for (i = 0; i < n; i++) { \
35 j = p[i]; \
36 printk("%s %d 0x%lx\n", \
37 info->pins[j].name, \
38 m[i], c[i]); \
39 } \
40}
41
42/* The bits in CONFIG cell defined in binding doc*/
43#define IMX_NO_PAD_CTL 0x80000000 /* no pin config need */
44#define IMX_PAD_SION 0x40000000 /* set SION */