Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/upstream-linus
[pandora-kernel.git] / arch / openrisc / include / asm / gpio.h
1 /*
2  * OpenRISC Linux
3  *
4  * Linux architectural port borrowing liberally from similar works of
5  * others.  All original copyrights apply as per the original source
6  * declaration.
7  *
8  * OpenRISC implementation:
9  * Copyright (C) 2003 Matjaz Breskvar <phoenix@bsemi.com>
10  * Copyright (C) 2010-2011 Jonas Bonn <jonas@southpole.se>
11  * et al.
12  *
13  * This program is free software; you can redistribute it and/or modify
14  * it under the terms of the GNU General Public License as published by
15  * the Free Software Foundation; either version 2 of the License, or
16  * (at your option) any later version.
17  */
18
19 #ifndef __ASM_OPENRISC_GPIO_H
20 #define __ASM_OPENRISC_GPIO_H
21
22 #include <linux/errno.h>
23 #include <asm-generic/gpio.h>
24
25 #ifdef CONFIG_GPIOLIB
26
27 /*
28  * OpenRISC (or1k) does not have on-chip GPIO's so there is not really
29  * any standardized implementation that makes sense here.  If passing
30  * through gpiolib becomes a bottleneck then it may make sense, on a
31  * case-by-case basis, to implement these inlined/rapid versions.
32  *
33  * Just call gpiolib.
34  */
35 static inline int gpio_get_value(unsigned int gpio)
36 {
37         return __gpio_get_value(gpio);
38 }
39
40 static inline void gpio_set_value(unsigned int gpio, int value)
41 {
42         __gpio_set_value(gpio, value);
43 }
44
45 static inline int gpio_cansleep(unsigned int gpio)
46 {
47         return __gpio_cansleep(gpio);
48 }
49
50 /*
51  * Not implemented, yet.
52  */
53 static inline int gpio_to_irq(unsigned int gpio)
54 {
55         return -ENOSYS;
56 }
57
58 static inline int irq_to_gpio(unsigned int irq)
59 {
60         return -EINVAL;
61 }
62
63 #endif /* CONFIG_GPIOLIB */
64
65 #endif /* __ASM_OPENRISC_GPIO_H */