aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh/include/asm/gpio.h
diff options
context:
space:
mode:
Diffstat (limited to 'arch/sh/include/asm/gpio.h')
-rw-r--r--arch/sh/include/asm/gpio.h70
1 files changed, 42 insertions, 28 deletions
diff --git a/arch/sh/include/asm/gpio.h b/arch/sh/include/asm/gpio.h
index 90673658eb14..61f93da2c62e 100644
--- a/arch/sh/include/asm/gpio.h
+++ b/arch/sh/include/asm/gpio.h
@@ -19,8 +19,42 @@
19#include <cpu/gpio.h> 19#include <cpu/gpio.h>
20#endif 20#endif
21 21
22#define ARCH_NR_GPIOS 512
23#include <asm-generic/gpio.h>
24
25#ifdef CONFIG_GPIOLIB
26
27static inline int gpio_get_value(unsigned gpio)
28{
29 return __gpio_get_value(gpio);
30}
31
32static inline void gpio_set_value(unsigned gpio, int value)
33{
34 __gpio_set_value(gpio, value);
35}
36
37static inline int gpio_cansleep(unsigned gpio)
38{
39 return __gpio_cansleep(gpio);
40}
41
42static inline int gpio_to_irq(unsigned gpio)
43{
44 WARN_ON(1);
45 return -ENOSYS;
46}
47
48static inline int irq_to_gpio(unsigned int irq)
49{
50 WARN_ON(1);
51 return -EINVAL;
52}
53
54#endif /* CONFIG_GPIOLIB */
55
22typedef unsigned short pinmux_enum_t; 56typedef unsigned short pinmux_enum_t;
23typedef unsigned char pinmux_flag_t; 57typedef unsigned short pinmux_flag_t;
24 58
25#define PINMUX_TYPE_NONE 0 59#define PINMUX_TYPE_NONE 0
26#define PINMUX_TYPE_FUNCTION 1 60#define PINMUX_TYPE_FUNCTION 1
@@ -34,6 +68,11 @@ typedef unsigned char pinmux_flag_t;
34#define PINMUX_FLAG_WANT_PULLUP (1 << 3) 68#define PINMUX_FLAG_WANT_PULLUP (1 << 3)
35#define PINMUX_FLAG_WANT_PULLDOWN (1 << 4) 69#define PINMUX_FLAG_WANT_PULLDOWN (1 << 4)
36 70
71#define PINMUX_FLAG_DBIT_SHIFT 5
72#define PINMUX_FLAG_DBIT (0x1f << PINMUX_FLAG_DBIT_SHIFT)
73#define PINMUX_FLAG_DREG_SHIFT 10
74#define PINMUX_FLAG_DREG (0x3f << PINMUX_FLAG_DREG_SHIFT)
75
37struct pinmux_gpio { 76struct pinmux_gpio {
38 pinmux_enum_t enum_id; 77 pinmux_enum_t enum_id;
39 pinmux_flag_t flags; 78 pinmux_flag_t flags;
@@ -54,7 +93,7 @@ struct pinmux_cfg_reg {
54 .enum_ids = (pinmux_enum_t [(r_width / f_width) * (1 << f_width)]) \ 93 .enum_ids = (pinmux_enum_t [(r_width / f_width) * (1 << f_width)]) \
55 94
56struct pinmux_data_reg { 95struct pinmux_data_reg {
57 unsigned long reg, reg_width; 96 unsigned long reg, reg_width, reg_shadow;
58 pinmux_enum_t *enum_ids; 97 pinmux_enum_t *enum_ids;
59}; 98};
60 99
@@ -89,34 +128,9 @@ struct pinmux_info {
89 unsigned int gpio_data_size; 128 unsigned int gpio_data_size;
90 129
91 unsigned long *gpio_in_use; 130 unsigned long *gpio_in_use;
131 struct gpio_chip chip;
92}; 132};
93 133
94int register_pinmux(struct pinmux_info *pip); 134int register_pinmux(struct pinmux_info *pip);
95 135
96int __gpio_request(unsigned gpio);
97static inline int gpio_request(unsigned gpio, const char *label)
98{
99 return __gpio_request(gpio);
100}
101void gpio_free(unsigned gpio);
102int gpio_direction_input(unsigned gpio);
103int gpio_direction_output(unsigned gpio, int value);
104int gpio_get_value(unsigned gpio);
105void gpio_set_value(unsigned gpio, int value);
106
107/* IRQ modes are unspported */
108static inline int gpio_to_irq(unsigned gpio)
109{
110 WARN_ON(1);
111 return -EINVAL;
112}
113
114static inline int irq_to_gpio(unsigned irq)
115{
116 WARN_ON(1);
117 return -EINVAL;
118}
119
120#include <asm-generic/gpio.h>
121
122#endif /* __ASM_SH_GPIO_H */ 136#endif /* __ASM_SH_GPIO_H */