Lines Matching refs:gpio

12 #include <asm-generic/gpio.h>
15 int __mcfgpio_get_value(unsigned gpio);
16 void __mcfgpio_set_value(unsigned gpio, int value);
17 int __mcfgpio_direction_input(unsigned gpio);
18 int __mcfgpio_direction_output(unsigned gpio, int value);
19 int __mcfgpio_request(unsigned gpio);
20 void __mcfgpio_free(unsigned gpio);
23 static inline int __gpio_get_value(unsigned gpio)
25 if (gpio < MCFGPIO_PIN_MAX)
26 return __mcfgpio_get_value(gpio);
31 static inline void __gpio_set_value(unsigned gpio, int value)
33 if (gpio < MCFGPIO_PIN_MAX)
34 __mcfgpio_set_value(gpio, value);
37 static inline int __gpio_cansleep(unsigned gpio)
39 if (gpio < MCFGPIO_PIN_MAX)
45 static inline int __gpio_to_irq(unsigned gpio)
50 static inline int gpio_direction_input(unsigned gpio)
52 if (gpio < MCFGPIO_PIN_MAX)
53 return __mcfgpio_direction_input(gpio);
58 static inline int gpio_direction_output(unsigned gpio, int value)
60 if (gpio < MCFGPIO_PIN_MAX)
61 return __mcfgpio_direction_output(gpio, value);
66 static inline int gpio_request(unsigned gpio, const char *label)
68 if (gpio < MCFGPIO_PIN_MAX)
69 return __mcfgpio_request(gpio);
74 static inline void gpio_free(unsigned gpio)
76 if (gpio < MCFGPIO_PIN_MAX)
77 __mcfgpio_free(gpio);
129 #define mcfgpio_bit(gpio) (1 << ((gpio) % MCFGPIO_PORTSIZE))
130 #define mcfgpio_port(gpio) ((gpio) / MCFGPIO_PORTSIZE)
154 #define MCFGPIO_SETR_PORT(gpio) (MCFGPIO_SETR + \
155 mcfgpio_port(gpio - MCFGPIO_SCR_START))
157 #define MCFGPIO_CLRR_PORT(gpio) (MCFGPIO_CLRR + \
158 mcfgpio_port(gpio - MCFGPIO_SCR_START))
163 #define MCFGPIO_SETR_PORT(gpio) 0
164 #define MCFGPIO_CLRR_PORT(gpio) 0
171 /* return the port pin data register for a gpio */
172 static inline u32 __mcfgpio_ppdr(unsigned gpio)
178 if (gpio < 16)
180 else if (gpio < 32)
185 if (gpio < 32)
194 if (gpio < 8)
197 else if (gpio < 16)
199 else if (gpio < 24)
201 else if (gpio < 32)
203 else if (gpio < 40)
208 return MCFGPIO_PPDR + mcfgpio_port(gpio - MCFGPIO_SCR_START);
214 /* return the port output data register for a gpio */
215 static inline u32 __mcfgpio_podr(unsigned gpio)
221 if (gpio < 16)
223 else if (gpio < 32)
228 if (gpio < 32)
237 if (gpio < 8)
240 else if (gpio < 16)
242 else if (gpio < 24)
244 else if (gpio < 32)
246 else if (gpio < 40)
251 return MCFGPIO_PODR + mcfgpio_port(gpio - MCFGPIO_SCR_START);
257 /* return the port direction data register for a gpio */
258 static inline u32 __mcfgpio_pddr(unsigned gpio)
264 if (gpio < 16)
266 else if (gpio < 32)
271 if (gpio < 32)
280 if (gpio < 8)
283 else if (gpio < 16)
285 else if (gpio < 24)
287 else if (gpio < 32)
289 else if (gpio < 40)
294 return MCFGPIO_PDDR + mcfgpio_port(gpio - MCFGPIO_SCR_START);