diff options
author | Sonic Zhang <sonic.zhang@analog.com> | 2013-09-03 04:29:00 -0400 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2013-09-19 08:39:32 -0400 |
commit | ffb7fc0f6d2d630cb9e6e37e67993aaa342819f1 (patch) | |
tree | 4706988a971b9e235e7da19911656b42f4dab713 /arch/blackfin/include | |
parent | e9a03add0c6ed5341fc59ff9c76843c2888a33fa (diff) |
blackfin: gpio: Remove none gpio lib code.
- Remove non gpio lib code from blackfin architecture.
- Limit the lagecy blackfin gpio driver to bf5xx processors only.
- Remove unused definition of the pint power functions.
Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'arch/blackfin/include')
-rw-r--r-- | arch/blackfin/include/asm/gpio.h | 157 |
1 files changed, 20 insertions, 137 deletions
diff --git a/arch/blackfin/include/asm/gpio.h b/arch/blackfin/include/asm/gpio.h index 98d0133346b5..99d338ca2ea4 100644 --- a/arch/blackfin/include/asm/gpio.h +++ b/arch/blackfin/include/asm/gpio.h | |||
@@ -25,8 +25,12 @@ | |||
25 | 25 | ||
26 | #ifndef __ASSEMBLY__ | 26 | #ifndef __ASSEMBLY__ |
27 | 27 | ||
28 | #ifndef CONFIG_PINCTRL | ||
29 | |||
28 | #include <linux/compiler.h> | 30 | #include <linux/compiler.h> |
29 | #include <linux/gpio.h> | 31 | #include <asm/blackfin.h> |
32 | #include <asm/portmux.h> | ||
33 | #include <asm/irq_handler.h> | ||
30 | 34 | ||
31 | /*********************************************************** | 35 | /*********************************************************** |
32 | * | 36 | * |
@@ -45,7 +49,6 @@ | |||
45 | * MODIFICATION HISTORY : | 49 | * MODIFICATION HISTORY : |
46 | **************************************************************/ | 50 | **************************************************************/ |
47 | 51 | ||
48 | #if !BFIN_GPIO_PINT | ||
49 | void set_gpio_dir(unsigned, unsigned short); | 52 | void set_gpio_dir(unsigned, unsigned short); |
50 | void set_gpio_inen(unsigned, unsigned short); | 53 | void set_gpio_inen(unsigned, unsigned short); |
51 | void set_gpio_polar(unsigned, unsigned short); | 54 | void set_gpio_polar(unsigned, unsigned short); |
@@ -115,7 +118,6 @@ struct gpio_port_t { | |||
115 | unsigned short dummy16; | 118 | unsigned short dummy16; |
116 | unsigned short inen; | 119 | unsigned short inen; |
117 | }; | 120 | }; |
118 | #endif | ||
119 | 121 | ||
120 | #ifdef BFIN_SPECIAL_GPIO_BANKS | 122 | #ifdef BFIN_SPECIAL_GPIO_BANKS |
121 | void bfin_special_gpio_free(unsigned gpio); | 123 | void bfin_special_gpio_free(unsigned gpio); |
@@ -127,25 +129,21 @@ void bfin_special_gpio_pm_hibernate_suspend(void); | |||
127 | #endif | 129 | #endif |
128 | 130 | ||
129 | #ifdef CONFIG_PM | 131 | #ifdef CONFIG_PM |
130 | int bfin_pm_standby_ctrl(unsigned ctrl); | 132 | void bfin_gpio_pm_hibernate_restore(void); |
133 | void bfin_gpio_pm_hibernate_suspend(void); | ||
134 | int bfin_gpio_pm_wakeup_ctrl(unsigned gpio, unsigned ctrl); | ||
135 | int bfin_gpio_pm_standby_ctrl(unsigned ctrl); | ||
131 | 136 | ||
132 | static inline int bfin_pm_standby_setup(void) | 137 | static inline int bfin_pm_standby_setup(void) |
133 | { | 138 | { |
134 | return bfin_pm_standby_ctrl(1); | 139 | return bfin_gpio_pm_standby_ctrl(1); |
135 | } | 140 | } |
136 | 141 | ||
137 | static inline void bfin_pm_standby_restore(void) | 142 | static inline void bfin_pm_standby_restore(void) |
138 | { | 143 | { |
139 | bfin_pm_standby_ctrl(0); | 144 | bfin_gpio_pm_standby_ctrl(0); |
140 | } | 145 | } |
141 | 146 | ||
142 | void bfin_gpio_pm_hibernate_restore(void); | ||
143 | void bfin_gpio_pm_hibernate_suspend(void); | ||
144 | void bfin_pint_suspend(void); | ||
145 | void bfin_pint_resume(void); | ||
146 | |||
147 | # if !BFIN_GPIO_PINT | ||
148 | int gpio_pm_wakeup_ctrl(unsigned gpio, unsigned ctrl); | ||
149 | 147 | ||
150 | struct gpio_port_s { | 148 | struct gpio_port_s { |
151 | unsigned short data; | 149 | unsigned short data; |
@@ -161,7 +159,6 @@ struct gpio_port_s { | |||
161 | unsigned short reserved; | 159 | unsigned short reserved; |
162 | unsigned short mux; | 160 | unsigned short mux; |
163 | }; | 161 | }; |
164 | # endif | ||
165 | #endif /*CONFIG_PM*/ | 162 | #endif /*CONFIG_PM*/ |
166 | 163 | ||
167 | /*********************************************************** | 164 | /*********************************************************** |
@@ -178,36 +175,29 @@ struct gpio_port_s { | |||
178 | ************************************************************* | 175 | ************************************************************* |
179 | * MODIFICATION HISTORY : | 176 | * MODIFICATION HISTORY : |
180 | **************************************************************/ | 177 | **************************************************************/ |
181 | |||
182 | int bfin_gpio_request(unsigned gpio, const char *label); | ||
183 | void bfin_gpio_free(unsigned gpio); | ||
184 | int bfin_gpio_irq_request(unsigned gpio, const char *label); | 178 | int bfin_gpio_irq_request(unsigned gpio, const char *label); |
185 | void bfin_gpio_irq_free(unsigned gpio); | 179 | void bfin_gpio_irq_free(unsigned gpio); |
186 | int bfin_gpio_direction_input(unsigned gpio); | 180 | void bfin_gpio_irq_prepare(unsigned gpio); |
187 | int bfin_gpio_direction_output(unsigned gpio, int value); | 181 | |
188 | int bfin_gpio_get_value(unsigned gpio); | 182 | static inline int irq_to_gpio(unsigned irq) |
189 | void bfin_gpio_set_value(unsigned gpio, int value); | 183 | { |
184 | return irq - GPIO_IRQ_BASE; | ||
185 | } | ||
186 | #endif /* CONFIG_PINCTRL */ | ||
190 | 187 | ||
191 | #include <asm/irq.h> | 188 | #include <asm/irq.h> |
192 | #include <asm/errno.h> | 189 | #include <asm/errno.h> |
193 | 190 | ||
194 | #ifdef CONFIG_GPIOLIB | ||
195 | #include <asm-generic/gpio.h> /* cansleep wrappers */ | 191 | #include <asm-generic/gpio.h> /* cansleep wrappers */ |
196 | 192 | ||
197 | static inline int gpio_get_value(unsigned int gpio) | 193 | static inline int gpio_get_value(unsigned int gpio) |
198 | { | 194 | { |
199 | if (gpio < MAX_BLACKFIN_GPIOS) | 195 | return __gpio_get_value(gpio); |
200 | return bfin_gpio_get_value(gpio); | ||
201 | else | ||
202 | return __gpio_get_value(gpio); | ||
203 | } | 196 | } |
204 | 197 | ||
205 | static inline void gpio_set_value(unsigned int gpio, int value) | 198 | static inline void gpio_set_value(unsigned int gpio, int value) |
206 | { | 199 | { |
207 | if (gpio < MAX_BLACKFIN_GPIOS) | 200 | __gpio_set_value(gpio, value); |
208 | bfin_gpio_set_value(gpio, value); | ||
209 | else | ||
210 | __gpio_set_value(gpio, value); | ||
211 | } | 201 | } |
212 | 202 | ||
213 | static inline int gpio_cansleep(unsigned int gpio) | 203 | static inline int gpio_cansleep(unsigned int gpio) |
@@ -219,113 +209,6 @@ static inline int gpio_to_irq(unsigned gpio) | |||
219 | { | 209 | { |
220 | return __gpio_to_irq(gpio); | 210 | return __gpio_to_irq(gpio); |
221 | } | 211 | } |
222 | |||
223 | #else /* !CONFIG_GPIOLIB */ | ||
224 | |||
225 | static inline int gpio_request(unsigned gpio, const char *label) | ||
226 | { | ||
227 | return bfin_gpio_request(gpio, label); | ||
228 | } | ||
229 | |||
230 | static inline void gpio_free(unsigned gpio) | ||
231 | { | ||
232 | return bfin_gpio_free(gpio); | ||
233 | } | ||
234 | |||
235 | static inline int gpio_direction_input(unsigned gpio) | ||
236 | { | ||
237 | return bfin_gpio_direction_input(gpio); | ||
238 | } | ||
239 | |||
240 | static inline int gpio_direction_output(unsigned gpio, int value) | ||
241 | { | ||
242 | return bfin_gpio_direction_output(gpio, value); | ||
243 | } | ||
244 | |||
245 | static inline int gpio_set_debounce(unsigned gpio, unsigned debounce) | ||
246 | { | ||
247 | return -EINVAL; | ||
248 | } | ||
249 | |||
250 | static inline int gpio_request_one(unsigned gpio, unsigned long flags, const char *label) | ||
251 | { | ||
252 | int err; | ||
253 | |||
254 | err = bfin_gpio_request(gpio, label); | ||
255 | if (err) | ||
256 | return err; | ||
257 | |||
258 | if (flags & GPIOF_DIR_IN) | ||
259 | err = bfin_gpio_direction_input(gpio); | ||
260 | else | ||
261 | err = bfin_gpio_direction_output(gpio, | ||
262 | (flags & GPIOF_INIT_HIGH) ? 1 : 0); | ||
263 | |||
264 | if (err) | ||
265 | bfin_gpio_free(gpio); | ||
266 | |||
267 | return err; | ||
268 | } | ||
269 | |||
270 | static inline int gpio_request_array(const struct gpio *array, size_t num) | ||
271 | { | ||
272 | int i, err; | ||
273 | |||
274 | for (i = 0; i < num; i++, array++) { | ||
275 | err = gpio_request_one(array->gpio, array->flags, array->label); | ||
276 | if (err) | ||
277 | goto err_free; | ||
278 | } | ||
279 | return 0; | ||
280 | |||
281 | err_free: | ||
282 | while (i--) | ||
283 | bfin_gpio_free((--array)->gpio); | ||
284 | return err; | ||
285 | } | ||
286 | |||
287 | static inline void gpio_free_array(const struct gpio *array, size_t num) | ||
288 | { | ||
289 | while (num--) | ||
290 | bfin_gpio_free((array++)->gpio); | ||
291 | } | ||
292 | |||
293 | static inline int __gpio_get_value(unsigned gpio) | ||
294 | { | ||
295 | return bfin_gpio_get_value(gpio); | ||
296 | } | ||
297 | |||
298 | static inline void __gpio_set_value(unsigned gpio, int value) | ||
299 | { | ||
300 | return bfin_gpio_set_value(gpio, value); | ||
301 | } | ||
302 | |||
303 | static inline int gpio_get_value(unsigned gpio) | ||
304 | { | ||
305 | return __gpio_get_value(gpio); | ||
306 | } | ||
307 | |||
308 | static inline void gpio_set_value(unsigned gpio, int value) | ||
309 | { | ||
310 | return __gpio_set_value(gpio, value); | ||
311 | } | ||
312 | |||
313 | static inline int gpio_to_irq(unsigned gpio) | ||
314 | { | ||
315 | if (likely(gpio < MAX_BLACKFIN_GPIOS)) | ||
316 | return gpio + GPIO_IRQ_BASE; | ||
317 | |||
318 | return -EINVAL; | ||
319 | } | ||
320 | |||
321 | #include <asm-generic/gpio.h> /* cansleep wrappers */ | ||
322 | #endif /* !CONFIG_GPIOLIB */ | ||
323 | |||
324 | static inline int irq_to_gpio(unsigned irq) | ||
325 | { | ||
326 | return (irq - GPIO_IRQ_BASE); | ||
327 | } | ||
328 | |||
329 | #endif /* __ASSEMBLY__ */ | 212 | #endif /* __ASSEMBLY__ */ |
330 | 213 | ||
331 | #endif /* __ARCH_BLACKFIN_GPIO_H__ */ | 214 | #endif /* __ARCH_BLACKFIN_GPIO_H__ */ |