aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pinctrl/spear/pinctrl-spear.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-05-22 12:39:42 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-05-22 12:39:42 -0400
commit813a95e5b4fa936bbde10ef89188932745dcd7f4 (patch)
tree571ca345861ffb89b45fabe26fcab4e133c8537b /drivers/pinctrl/spear/pinctrl-spear.h
parent9f639269ed1522c7d69c54cc8b80ab8ee53fcb10 (diff)
parentf3f08dcb9965f42378851ce888fb7539607712e6 (diff)
Merge tag 'pinctrl' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc
Pull arm soc-specific pinctrl changes from Olof Johansson: "With this, five platforms are moving to the relatively new pinctrl subsystem for their pin management, replacing the older soc specific in-kernel interfaces with common code. There is quite a bit of net addition of code for each platform being added to the pinctrl subsystem. But the payback comes later when adding new boards can be done by only providing new device trees instead." Fix up trivial conflicts in arch/arm/mach-ux500/{Makefile,board-mop500.c} * tag 'pinctrl' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc: (61 commits) mtd: nand: gpmi: fix compile error caused by pinctrl call ARM: PRIMA2: select PINCTRL and PINCTRL_SIRF in Kconfig ARM: nomadik: enable PINCTRL_NOMADIK where needed ARM: mxs: enable pinctrl support video: mxsfb: adopt pinctrl support ASoC: mxs-saif: adopt pinctrl support i2c: mxs: adopt pinctrl support mtd: nand: gpmi: adopt pinctrl support mmc: mxs-mmc: adopt pinctrl support serial: mxs-auart: adopt pinctrl support serial: amba-pl011: adopt pinctrl support spi/imx: adopt pinctrl support i2c: imx: adopt pinctrl support can: flexcan: adopt pinctrl support net: fec: adopt pinctrl support ARM: ux500: switch MSP to using pinctrl for pins ARM: ux500: alter MSP registration to return a device pointer ARM: ux500: switch to using pinctrl for uart0 ARM: ux500: delete custom pin control system ARM: ux500: switch over to Nomadik pinctrl driver ...
Diffstat (limited to 'drivers/pinctrl/spear/pinctrl-spear.h')
-rw-r--r--drivers/pinctrl/spear/pinctrl-spear.h142
1 files changed, 142 insertions, 0 deletions
diff --git a/drivers/pinctrl/spear/pinctrl-spear.h b/drivers/pinctrl/spear/pinctrl-spear.h
new file mode 100644
index 000000000000..47a6b5b72f90
--- /dev/null
+++ b/drivers/pinctrl/spear/pinctrl-spear.h
@@ -0,0 +1,142 @@
1/*
2 * Driver header file for the ST Microelectronics SPEAr pinmux
3 *
4 * Copyright (C) 2012 ST Microelectronics
5 * Viresh Kumar <viresh.kumar@st.com>
6 *
7 * This file is licensed under the terms of the GNU General Public
8 * License version 2. This program is licensed "as is" without any
9 * warranty of any kind, whether express or implied.
10 */
11
12#ifndef __PINMUX_SPEAR_H__
13#define __PINMUX_SPEAR_H__
14
15#include <linux/pinctrl/pinctrl.h>
16#include <linux/types.h>
17
18struct platform_device;
19struct device;
20
21/**
22 * struct spear_pmx_mode - SPEAr pmx mode
23 * @name: name of pmx mode
24 * @mode: mode id
25 * @reg: register for configuring this mode
26 * @mask: mask of this mode in reg
27 * @val: val to be configured at reg after doing (val & mask)
28 */
29struct spear_pmx_mode {
30 const char *const name;
31 u16 mode;
32 u16 reg;
33 u16 mask;
34 u32 val;
35};
36
37/**
38 * struct spear_muxreg - SPEAr mux reg configuration
39 * @reg: register offset
40 * @mask: mask bits
41 * @val: val to be written on mask bits
42 */
43struct spear_muxreg {
44 u16 reg;
45 u32 mask;
46 u32 val;
47};
48
49/**
50 * struct spear_modemux - SPEAr mode mux configuration
51 * @modes: mode ids supported by this group of muxregs
52 * @nmuxregs: number of muxreg configurations to be done for modes
53 * @muxregs: array of muxreg configurations to be done for modes
54 */
55struct spear_modemux {
56 u16 modes;
57 u8 nmuxregs;
58 struct spear_muxreg *muxregs;
59};
60
61/**
62 * struct spear_pingroup - SPEAr pin group configurations
63 * @name: name of pin group
64 * @pins: array containing pin numbers
65 * @npins: size of pins array
66 * @modemuxs: array of modemux configurations for this pin group
67 * @nmodemuxs: size of array modemuxs
68 *
69 * A representation of a group of pins in the SPEAr pin controller. Each group
70 * allows some parameter or parameters to be configured.
71 */
72struct spear_pingroup {
73 const char *name;
74 const unsigned *pins;
75 unsigned npins;
76 struct spear_modemux *modemuxs;
77 unsigned nmodemuxs;
78};
79
80/**
81 * struct spear_function - SPEAr pinctrl mux function
82 * @name: The name of the function, exported to pinctrl core.
83 * @groups: An array of pin groups that may select this function.
84 * @ngroups: The number of entries in @groups.
85 */
86struct spear_function {
87 const char *name;
88 const char *const *groups;
89 unsigned ngroups;
90};
91
92/**
93 * struct spear_pinctrl_machdata - SPEAr pin controller machine driver
94 * configuration
95 * @pins: An array describing all pins the pin controller affects.
96 * All pins which are also GPIOs must be listed first within the *array,
97 * and be numbered identically to the GPIO controller's *numbering.
98 * @npins: The numbmer of entries in @pins.
99 * @functions: An array describing all mux functions the SoC supports.
100 * @nfunctions: The numbmer of entries in @functions.
101 * @groups: An array describing all pin groups the pin SoC supports.
102 * @ngroups: The numbmer of entries in @groups.
103 *
104 * @modes_supported: Does SoC support modes
105 * @mode: mode configured from probe
106 * @pmx_modes: array of modes supported by SoC
107 * @npmx_modes: number of entries in pmx_modes.
108 */
109struct spear_pinctrl_machdata {
110 const struct pinctrl_pin_desc *pins;
111 unsigned npins;
112 struct spear_function **functions;
113 unsigned nfunctions;
114 struct spear_pingroup **groups;
115 unsigned ngroups;
116
117 bool modes_supported;
118 u16 mode;
119 struct spear_pmx_mode **pmx_modes;
120 unsigned npmx_modes;
121};
122
123/**
124 * struct spear_pmx - SPEAr pinctrl mux
125 * @dev: pointer to struct dev of platform_device registered
126 * @pctl: pointer to struct pinctrl_dev
127 * @machdata: pointer to SoC or machine specific structure
128 * @vbase: virtual base address of pinmux controller
129 */
130struct spear_pmx {
131 struct device *dev;
132 struct pinctrl_dev *pctl;
133 struct spear_pinctrl_machdata *machdata;
134 void __iomem *vbase;
135};
136
137/* exported routines */
138void __devinit pmx_init_addr(struct spear_pinctrl_machdata *machdata, u16 reg);
139int __devinit spear_pinctrl_probe(struct platform_device *pdev,
140 struct spear_pinctrl_machdata *machdata);
141int __devexit spear_pinctrl_remove(struct platform_device *pdev);
142#endif /* __PINMUX_SPEAR_H__ */