aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/include/asm/mach-bcm47xx/gpio.h
diff options
context:
space:
mode:
authorHauke Mehrtens <hauke@hauke-m.de>2011-07-22 19:20:12 -0400
committerJohn W. Linville <linville@tuxdriver.com>2011-08-08 14:29:30 -0400
commit08ccf57283f89adbc2ff897ad82d6ad4560db7cd (patch)
tree11d715ac33eab75e57a8e62b0b7d822e316a9145 /arch/mips/include/asm/mach-bcm47xx/gpio.h
parent908debc8da0d5a91418f71c6a462f62bd2ac69ef (diff)
bcm47xx: prepare to support different buses
Prepare bcm47xx to support different System buses. Before adding support for bcma it should be possible to build bcm47xx without the need of ssb. With this patch bcm47xx does not directly contain a ssb_bus, but a union contain all the supported system buses. As a SoC just uses one system bus a union is a good choice. Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> Acked-by: Ralf Baechle <ralf@linux-mips.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'arch/mips/include/asm/mach-bcm47xx/gpio.h')
-rw-r--r--arch/mips/include/asm/mach-bcm47xx/gpio.h55
1 files changed, 40 insertions, 15 deletions
diff --git a/arch/mips/include/asm/mach-bcm47xx/gpio.h b/arch/mips/include/asm/mach-bcm47xx/gpio.h
index 98504142124e..6b78827dd140 100644
--- a/arch/mips/include/asm/mach-bcm47xx/gpio.h
+++ b/arch/mips/include/asm/mach-bcm47xx/gpio.h
@@ -21,41 +21,66 @@ extern int gpio_to_irq(unsigned gpio);
21 21
22static inline int gpio_get_value(unsigned gpio) 22static inline int gpio_get_value(unsigned gpio)
23{ 23{
24 return ssb_gpio_in(&ssb_bcm47xx, 1 << gpio); 24 switch (bcm47xx_bus_type) {
25 case BCM47XX_BUS_TYPE_SSB:
26 return ssb_gpio_in(&bcm47xx_bus.ssb, 1 << gpio);
27 }
28 return -EINVAL;
25} 29}
26 30
27static inline void gpio_set_value(unsigned gpio, int value) 31static inline void gpio_set_value(unsigned gpio, int value)
28{ 32{
29 ssb_gpio_out(&ssb_bcm47xx, 1 << gpio, value ? 1 << gpio : 0); 33 switch (bcm47xx_bus_type) {
34 case BCM47XX_BUS_TYPE_SSB:
35 ssb_gpio_out(&bcm47xx_bus.ssb, 1 << gpio,
36 value ? 1 << gpio : 0);
37 }
30} 38}
31 39
32static inline int gpio_direction_input(unsigned gpio) 40static inline int gpio_direction_input(unsigned gpio)
33{ 41{
34 ssb_gpio_outen(&ssb_bcm47xx, 1 << gpio, 0); 42 switch (bcm47xx_bus_type) {
35 return 0; 43 case BCM47XX_BUS_TYPE_SSB:
44 ssb_gpio_outen(&bcm47xx_bus.ssb, 1 << gpio, 0);
45 return 0;
46 }
47 return -EINVAL;
36} 48}
37 49
38static inline int gpio_direction_output(unsigned gpio, int value) 50static inline int gpio_direction_output(unsigned gpio, int value)
39{ 51{
40 /* first set the gpio out value */ 52 switch (bcm47xx_bus_type) {
41 ssb_gpio_out(&ssb_bcm47xx, 1 << gpio, value ? 1 << gpio : 0); 53 case BCM47XX_BUS_TYPE_SSB:
42 /* then set the gpio mode */ 54 /* first set the gpio out value */
43 ssb_gpio_outen(&ssb_bcm47xx, 1 << gpio, 1 << gpio); 55 ssb_gpio_out(&bcm47xx_bus.ssb, 1 << gpio,
44 return 0; 56 value ? 1 << gpio : 0);
57 /* then set the gpio mode */
58 ssb_gpio_outen(&bcm47xx_bus.ssb, 1 << gpio, 1 << gpio);
59 return 0;
60 }
61 return -EINVAL;
45} 62}
46 63
47static inline int gpio_intmask(unsigned gpio, int value) 64static inline int gpio_intmask(unsigned gpio, int value)
48{ 65{
49 ssb_gpio_intmask(&ssb_bcm47xx, 1 << gpio, 66 switch (bcm47xx_bus_type) {
50 value ? 1 << gpio : 0); 67 case BCM47XX_BUS_TYPE_SSB:
51 return 0; 68 ssb_gpio_intmask(&bcm47xx_bus.ssb, 1 << gpio,
69 value ? 1 << gpio : 0);
70 return 0;
71 }
72 return -EINVAL;
52} 73}
53 74
54static inline int gpio_polarity(unsigned gpio, int value) 75static inline int gpio_polarity(unsigned gpio, int value)
55{ 76{
56 ssb_gpio_polarity(&ssb_bcm47xx, 1 << gpio, 77 switch (bcm47xx_bus_type) {
57 value ? 1 << gpio : 0); 78 case BCM47XX_BUS_TYPE_SSB:
58 return 0; 79 ssb_gpio_polarity(&bcm47xx_bus.ssb, 1 << gpio,
80 value ? 1 << gpio : 0);
81 return 0;
82 }
83 return -EINVAL;
59} 84}
60 85
61 86