ar71xx: tplinkpart: include module.h
[openwrt.git] / package / switch / src / gpio-bcm947xx.h
1 #ifndef __SWITCH_GPIO_H
2 #define __SWITCH_GPIO_H
3
4 #include <linux/ssb/ssb_embedded.h>
5 #include <linux/bcma/bcma_driver_chipcommon.h>
6 #include <bcm47xx.h>
7
8 static inline u32 gpio_in(void)
9 {
10 switch (bcm47xx_bus_type) {
11 #ifdef CONFIG_BCM47XX_SSB
12 case BCM47XX_BUS_TYPE_SSB:
13 return ssb_gpio_in(&bcm47xx_bus.ssb, ~0);
14 #endif
15 #ifdef CONFIG_BCM47XX_BCMA
16 case BCM47XX_BUS_TYPE_BCMA:
17 return bcma_chipco_gpio_in(&bcm47xx_bus.bcma.bus.drv_cc, ~0);
18 #endif
19 }
20 return -EINVAL;
21 }
22
23 static inline u32 gpio_out(u32 mask, u32 value)
24 {
25 switch (bcm47xx_bus_type) {
26 #ifdef CONFIG_BCM47XX_SSB
27 case BCM47XX_BUS_TYPE_SSB:
28 return ssb_gpio_out(&bcm47xx_bus.ssb, mask, value);
29 #endif
30 #ifdef CONFIG_BCM47XX_BCMA
31 case BCM47XX_BUS_TYPE_BCMA:
32 return bcma_chipco_gpio_out(&bcm47xx_bus.bcma.bus.drv_cc, mask, value);
33 #endif
34 }
35 return -EINVAL;
36 }
37
38 static inline u32 gpio_outen(u32 mask, u32 value)
39 {
40 switch (bcm47xx_bus_type) {
41 #ifdef CONFIG_BCM47XX_SSB
42 case BCM47XX_BUS_TYPE_SSB:
43 ssb_gpio_outen(&bcm47xx_bus.ssb, mask, value);
44 return 0;
45 #endif
46 #ifdef CONFIG_BCM47XX_BCMA
47 case BCM47XX_BUS_TYPE_BCMA:
48 bcma_chipco_gpio_outen(&bcm47xx_bus.bcma.bus.drv_cc, mask, value);
49 return 0;
50 #endif
51 }
52 return -EINVAL;
53 }
54
55 #endif /* __SWITCH_GPIO_H */
This page took 0.055685 seconds and 5 git commands to generate.