Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
pinctrl-mvebu.h
Go to the documentation of this file.
1 /*
2  * Marvell MVEBU pinctrl driver
3  *
4  * Authors: Sebastian Hesselbarth <[email protected]>
5  * Thomas Petazzoni <[email protected]>
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  */
12 
13 #ifndef __PINCTRL_MVEBU_H__
14 #define __PINCTRL_MVEBU_H__
15 
37  const char *name;
40  unsigned *pins;
41  int (*mpp_get)(struct mvebu_mpp_ctrl *ctrl, unsigned long *config);
42  int (*mpp_set)(struct mvebu_mpp_ctrl *ctrl, unsigned long config);
45 };
46 
72  const char *name;
73  const char *subname;
76 #define MVEBU_SETTING_GPO (1 << 0)
77 #define MVEBU_SETTING_GPI (1 << 1)
78 };
79 
91 };
92 
112  int nmodes;
113  struct pinctrl_gpio_range *gpioranges;
115 };
116 
117 #define MPP_REG_CTRL(_idl, _idh) \
118  { \
119  .name = NULL, \
120  .pid = _idl, \
121  .npins = _idh - _idl + 1, \
122  .pins = (unsigned[_idh - _idl + 1]) { }, \
123  .mpp_get = NULL, \
124  .mpp_set = NULL, \
125  .mpp_gpio_req = NULL, \
126  .mpp_gpio_dir = NULL, \
127  }
128 
129 #define MPP_FUNC_CTRL(_idl, _idh, _name, _func) \
130  { \
131  .name = _name, \
132  .pid = _idl, \
133  .npins = _idh - _idl + 1, \
134  .pins = (unsigned[_idh - _idl + 1]) { }, \
135  .mpp_get = _func ## _get, \
136  .mpp_set = _func ## _set, \
137  .mpp_gpio_req = NULL, \
138  .mpp_gpio_dir = NULL, \
139  }
140 
141 #define MPP_FUNC_GPIO_CTRL(_idl, _idh, _name, _func) \
142  { \
143  .name = _name, \
144  .pid = _idl, \
145  .npins = _idh - _idl + 1, \
146  .pins = (unsigned[_idh - _idl + 1]) { }, \
147  .mpp_get = _func ## _get, \
148  .mpp_set = _func ## _set, \
149  .mpp_gpio_req = _func ## _gpio_req, \
150  .mpp_gpio_dir = _func ## _gpio_dir, \
151  }
152 
153 #define _MPP_VAR_FUNCTION(_val, _name, _subname, _mask) \
154  { \
155  .val = _val, \
156  .name = _name, \
157  .subname = _subname, \
158  .variant = _mask, \
159  .flags = 0, \
160  }
161 
162 #if defined(CONFIG_DEBUG_FS)
163 #define MPP_VAR_FUNCTION(_val, _name, _subname, _mask) \
164  _MPP_VAR_FUNCTION(_val, _name, _subname, _mask)
165 #else
166 #define MPP_VAR_FUNCTION(_val, _name, _subname, _mask) \
167  _MPP_VAR_FUNCTION(_val, _name, NULL, _mask)
168 #endif
169 
170 #define MPP_FUNCTION(_val, _name, _subname) \
171  MPP_VAR_FUNCTION(_val, _name, _subname, (u8)-1)
172 
173 #define MPP_MODE(_id, ...) \
174  { \
175  .pid = _id, \
176  .settings = (struct mvebu_mpp_ctrl_setting[]){ \
177  __VA_ARGS__, { } }, \
178  }
179 
180 #define MPP_GPIO_RANGE(_id, _pinbase, _gpiobase, _npins) \
181  { \
182  .name = "mvebu-gpio", \
183  .id = _id, \
184  .pin_base = _pinbase, \
185  .base = _gpiobase, \
186  .npins = _npins, \
187  }
188 
189 int mvebu_pinctrl_probe(struct platform_device *pdev);
190 int mvebu_pinctrl_remove(struct platform_device *pdev);
191 
192 #endif