|
@@ -21,41 +21,66 @@ extern int gpio_to_irq(unsigned gpio);
|
|
|
|
|
|
static inline int gpio_get_value(unsigned gpio)
|
|
|
{
|
|
|
- return ssb_gpio_in(&ssb_bcm47xx, 1 << gpio);
|
|
|
+ switch (bcm47xx_bus_type) {
|
|
|
+ case BCM47XX_BUS_TYPE_SSB:
|
|
|
+ return ssb_gpio_in(&bcm47xx_bus.ssb, 1 << gpio);
|
|
|
+ }
|
|
|
+ return -EINVAL;
|
|
|
}
|
|
|
|
|
|
static inline void gpio_set_value(unsigned gpio, int value)
|
|
|
{
|
|
|
- ssb_gpio_out(&ssb_bcm47xx, 1 << gpio, value ? 1 << gpio : 0);
|
|
|
+ switch (bcm47xx_bus_type) {
|
|
|
+ case BCM47XX_BUS_TYPE_SSB:
|
|
|
+ ssb_gpio_out(&bcm47xx_bus.ssb, 1 << gpio,
|
|
|
+ value ? 1 << gpio : 0);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
static inline int gpio_direction_input(unsigned gpio)
|
|
|
{
|
|
|
- ssb_gpio_outen(&ssb_bcm47xx, 1 << gpio, 0);
|
|
|
- return 0;
|
|
|
+ switch (bcm47xx_bus_type) {
|
|
|
+ case BCM47XX_BUS_TYPE_SSB:
|
|
|
+ ssb_gpio_outen(&bcm47xx_bus.ssb, 1 << gpio, 0);
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ return -EINVAL;
|
|
|
}
|
|
|
|
|
|
static inline int gpio_direction_output(unsigned gpio, int value)
|
|
|
{
|
|
|
- /* first set the gpio out value */
|
|
|
- ssb_gpio_out(&ssb_bcm47xx, 1 << gpio, value ? 1 << gpio : 0);
|
|
|
- /* then set the gpio mode */
|
|
|
- ssb_gpio_outen(&ssb_bcm47xx, 1 << gpio, 1 << gpio);
|
|
|
- return 0;
|
|
|
+ switch (bcm47xx_bus_type) {
|
|
|
+ case BCM47XX_BUS_TYPE_SSB:
|
|
|
+ /* first set the gpio out value */
|
|
|
+ ssb_gpio_out(&bcm47xx_bus.ssb, 1 << gpio,
|
|
|
+ value ? 1 << gpio : 0);
|
|
|
+ /* then set the gpio mode */
|
|
|
+ ssb_gpio_outen(&bcm47xx_bus.ssb, 1 << gpio, 1 << gpio);
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ return -EINVAL;
|
|
|
}
|
|
|
|
|
|
static inline int gpio_intmask(unsigned gpio, int value)
|
|
|
{
|
|
|
- ssb_gpio_intmask(&ssb_bcm47xx, 1 << gpio,
|
|
|
- value ? 1 << gpio : 0);
|
|
|
- return 0;
|
|
|
+ switch (bcm47xx_bus_type) {
|
|
|
+ case BCM47XX_BUS_TYPE_SSB:
|
|
|
+ ssb_gpio_intmask(&bcm47xx_bus.ssb, 1 << gpio,
|
|
|
+ value ? 1 << gpio : 0);
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ return -EINVAL;
|
|
|
}
|
|
|
|
|
|
static inline int gpio_polarity(unsigned gpio, int value)
|
|
|
{
|
|
|
- ssb_gpio_polarity(&ssb_bcm47xx, 1 << gpio,
|
|
|
- value ? 1 << gpio : 0);
|
|
|
- return 0;
|
|
|
+ switch (bcm47xx_bus_type) {
|
|
|
+ case BCM47XX_BUS_TYPE_SSB:
|
|
|
+ ssb_gpio_polarity(&bcm47xx_bus.ssb, 1 << gpio,
|
|
|
+ value ? 1 << gpio : 0);
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ return -EINVAL;
|
|
|
}
|
|
|
|
|
|
|