aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pinctrl/spear/pinctrl-spear.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/pinctrl/spear/pinctrl-spear.h')
-rw-r--r--drivers/pinctrl/spear/pinctrl-spear.h46
1 files changed, 46 insertions, 0 deletions
diff --git a/drivers/pinctrl/spear/pinctrl-spear.h b/drivers/pinctrl/spear/pinctrl-spear.h
index d950eb78d939..94f142c10c19 100644
--- a/drivers/pinctrl/spear/pinctrl-spear.h
+++ b/drivers/pinctrl/spear/pinctrl-spear.h
@@ -12,6 +12,7 @@
12#ifndef __PINMUX_SPEAR_H__ 12#ifndef __PINMUX_SPEAR_H__
13#define __PINMUX_SPEAR_H__ 13#define __PINMUX_SPEAR_H__
14 14
15#include <linux/gpio.h>
15#include <linux/pinctrl/pinctrl.h> 16#include <linux/pinctrl/pinctrl.h>
16#include <linux/types.h> 17#include <linux/types.h>
17 18
@@ -46,6 +47,44 @@ struct spear_muxreg {
46 u32 val; 47 u32 val;
47}; 48};
48 49
50struct spear_gpio_pingroup {
51 const unsigned *pins;
52 unsigned npins;
53 struct spear_muxreg *muxregs;
54 u8 nmuxregs;
55};
56
57/* ste: set to enable */
58#define DEFINE_MUXREG(__pins, __muxreg, __mask, __ste) \
59static struct spear_muxreg __pins##_muxregs[] = { \
60 { \
61 .reg = __muxreg, \
62 .mask = __mask, \
63 .val = __ste ? __mask : 0, \
64 }, \
65}
66
67#define DEFINE_2_MUXREG(__pins, __muxreg1, __muxreg2, __mask, __ste1, __ste2) \
68static struct spear_muxreg __pins##_muxregs[] = { \
69 { \
70 .reg = __muxreg1, \
71 .mask = __mask, \
72 .val = __ste1 ? __mask : 0, \
73 }, { \
74 .reg = __muxreg2, \
75 .mask = __mask, \
76 .val = __ste2 ? __mask : 0, \
77 }, \
78}
79
80#define GPIO_PINGROUP(__pins) \
81 { \
82 .pins = __pins, \
83 .npins = ARRAY_SIZE(__pins), \
84 .muxregs = __pins##_muxregs, \
85 .nmuxregs = ARRAY_SIZE(__pins##_muxregs), \
86 }
87
49/** 88/**
50 * struct spear_modemux - SPEAr mode mux configuration 89 * struct spear_modemux - SPEAr mode mux configuration
51 * @modes: mode ids supported by this group of muxregs 90 * @modes: mode ids supported by this group of muxregs
@@ -100,6 +139,8 @@ struct spear_function {
100 * @nfunctions: The numbmer of entries in @functions. 139 * @nfunctions: The numbmer of entries in @functions.
101 * @groups: An array describing all pin groups the pin SoC supports. 140 * @groups: An array describing all pin groups the pin SoC supports.
102 * @ngroups: The numbmer of entries in @groups. 141 * @ngroups: The numbmer of entries in @groups.
142 * @gpio_pingroups: gpio pingroups
143 * @ngpio_pingroups: gpio pingroups count
103 * 144 *
104 * @modes_supported: Does SoC support modes 145 * @modes_supported: Does SoC support modes
105 * @mode: mode configured from probe 146 * @mode: mode configured from probe
@@ -113,6 +154,8 @@ struct spear_pinctrl_machdata {
113 unsigned nfunctions; 154 unsigned nfunctions;
114 struct spear_pingroup **groups; 155 struct spear_pingroup **groups;
115 unsigned ngroups; 156 unsigned ngroups;
157 struct spear_gpio_pingroup *gpio_pingroups;
158 unsigned ngpio_pingroups;
116 159
117 bool modes_supported; 160 bool modes_supported;
118 u16 mode; 161 u16 mode;
@@ -136,6 +179,9 @@ struct spear_pmx {
136 179
137/* exported routines */ 180/* exported routines */
138void __devinit pmx_init_addr(struct spear_pinctrl_machdata *machdata, u16 reg); 181void __devinit pmx_init_addr(struct spear_pinctrl_machdata *machdata, u16 reg);
182void __devinit
183pmx_init_gpio_pingroup_addr(struct spear_gpio_pingroup *gpio_pingroup,
184 unsigned count, u16 reg);
139int __devinit spear_pinctrl_probe(struct platform_device *pdev, 185int __devinit spear_pinctrl_probe(struct platform_device *pdev,
140 struct spear_pinctrl_machdata *machdata); 186 struct spear_pinctrl_machdata *machdata);
141int __devexit spear_pinctrl_remove(struct platform_device *pdev); 187int __devexit spear_pinctrl_remove(struct platform_device *pdev);