1 #ifndef __BCM947XX_GPIO_H
2 #define __BCM947XX_GPIO_H
4 #include <linux/ssb/ssb_embedded.h>
6 extern struct ssb_bus ssb;
8 static inline int gpio_request(unsigned gpio, const char *label)
13 static inline void gpio_free(unsigned gpio)
17 static inline int gpio_direction_input(unsigned gpio)
19 ssb_gpio_outen(&ssb, 1 << gpio, 0);
23 static inline int gpio_direction_output(unsigned gpio, int value)
25 ssb_gpio_out(&ssb, 1 << gpio, (value ? 1 << gpio : 0));
26 ssb_gpio_outen(&ssb, 1 << gpio, 1 << gpio);
31 static inline int gpio_to_irq(unsigned gpio)
33 struct ssb_device *dev;
41 return ssb_mips_irq(dev) + 2;
44 static inline int irq_to_gpio(unsigned gpio)
50 static inline int gpio_get_value(unsigned gpio)
52 return !!ssb_gpio_in(&ssb, 1 << gpio);
55 static inline int gpio_set_value(unsigned gpio, int value)
57 ssb_gpio_out(&ssb, 1 << gpio, (value ? 1 << gpio : 0));
62 /* cansleep wrappers */
63 #include <asm-generic/gpio.h>
66 #endif /* __BCM947XX_GPIO_H */