diff options
Diffstat (limited to 'arch/mips/include')
-rw-r--r-- | arch/mips/include/asm/mach-bcm47xx/bcm47xx.h | 14 | ||||
-rw-r--r-- | arch/mips/include/asm/mach-bcm47xx/gpio.h | 55 |
2 files changed, 52 insertions, 17 deletions
diff --git a/arch/mips/include/asm/mach-bcm47xx/bcm47xx.h b/arch/mips/include/asm/mach-bcm47xx/bcm47xx.h index d008f47a28bd..7cf481bb1a05 100644 --- a/arch/mips/include/asm/mach-bcm47xx/bcm47xx.h +++ b/arch/mips/include/asm/mach-bcm47xx/bcm47xx.h | |||
@@ -19,7 +19,17 @@ | |||
19 | #ifndef __ASM_BCM47XX_H | 19 | #ifndef __ASM_BCM47XX_H |
20 | #define __ASM_BCM47XX_H | 20 | #define __ASM_BCM47XX_H |
21 | 21 | ||
22 | /* SSB bus */ | 22 | #include <linux/ssb/ssb.h> |
23 | extern struct ssb_bus ssb_bcm47xx; | 23 | |
24 | enum bcm47xx_bus_type { | ||
25 | BCM47XX_BUS_TYPE_SSB, | ||
26 | }; | ||
27 | |||
28 | union bcm47xx_bus { | ||
29 | struct ssb_bus ssb; | ||
30 | }; | ||
31 | |||
32 | extern union bcm47xx_bus bcm47xx_bus; | ||
33 | extern enum bcm47xx_bus_type bcm47xx_bus_type; | ||
24 | 34 | ||
25 | #endif /* __ASM_BCM47XX_H */ | 35 | #endif /* __ASM_BCM47XX_H */ |
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 | ||
22 | static inline int gpio_get_value(unsigned gpio) | 22 | static 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 | ||
27 | static inline void gpio_set_value(unsigned gpio, int value) | 31 | static 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 | ||
32 | static inline int gpio_direction_input(unsigned gpio) | 40 | static 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 | ||
38 | static inline int gpio_direction_output(unsigned gpio, int value) | 50 | static 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 | ||
47 | static inline int gpio_intmask(unsigned gpio, int value) | 64 | static 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 | ||
54 | static inline int gpio_polarity(unsigned gpio, int value) | 75 | static 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 | ||