diff options
author | Ralf Baechle <ralf@linux-mips.org> | 2012-12-13 13:40:13 -0500 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2012-12-13 13:40:13 -0500 |
commit | 241738bd51cb0efe58e6c570223153e970afe3ae (patch) | |
tree | 05263e1ec3fbd58cc4ba5ee69163612fbb769a4a /arch/mips/include/asm/mach-bcm47xx | |
parent | bdf20507da11a9a5b32ef04fa09f352828189aef (diff) | |
parent | ce8f0d0607bcad3ec0e8599be80353204427093e (diff) |
Merge branch 'mips-next' of http://dev.phrozen.org/githttp/mips-next into mips-for-linux-next
Diffstat (limited to 'arch/mips/include/asm/mach-bcm47xx')
-rw-r--r-- | arch/mips/include/asm/mach-bcm47xx/bcm47xx.h | 4 | ||||
-rw-r--r-- | arch/mips/include/asm/mach-bcm47xx/gpio.h | 154 |
2 files changed, 10 insertions, 148 deletions
diff --git a/arch/mips/include/asm/mach-bcm47xx/bcm47xx.h b/arch/mips/include/asm/mach-bcm47xx/bcm47xx.h index 26fdaf40b930..cc7563ba1cbf 100644 --- a/arch/mips/include/asm/mach-bcm47xx/bcm47xx.h +++ b/arch/mips/include/asm/mach-bcm47xx/bcm47xx.h | |||
@@ -44,8 +44,8 @@ union bcm47xx_bus { | |||
44 | extern union bcm47xx_bus bcm47xx_bus; | 44 | extern union bcm47xx_bus bcm47xx_bus; |
45 | extern enum bcm47xx_bus_type bcm47xx_bus_type; | 45 | extern enum bcm47xx_bus_type bcm47xx_bus_type; |
46 | 46 | ||
47 | void bcm47xx_fill_sprom(struct ssb_sprom *sprom, const char *prefix); | 47 | void bcm47xx_fill_sprom(struct ssb_sprom *sprom, const char *prefix, |
48 | void bcm47xx_fill_sprom_ethernet(struct ssb_sprom *sprom, const char *prefix); | 48 | bool fallback); |
49 | 49 | ||
50 | #ifdef CONFIG_BCM47XX_SSB | 50 | #ifdef CONFIG_BCM47XX_SSB |
51 | void bcm47xx_fill_ssb_boardinfo(struct ssb_boardinfo *boardinfo, | 51 | void bcm47xx_fill_ssb_boardinfo(struct ssb_boardinfo *boardinfo, |
diff --git a/arch/mips/include/asm/mach-bcm47xx/gpio.h b/arch/mips/include/asm/mach-bcm47xx/gpio.h index 2ef17e8df403..90daefa24a4d 100644 --- a/arch/mips/include/asm/mach-bcm47xx/gpio.h +++ b/arch/mips/include/asm/mach-bcm47xx/gpio.h | |||
@@ -1,155 +1,17 @@ | |||
1 | /* | 1 | #ifndef __ASM_MIPS_MACH_BCM47XX_GPIO_H |
2 | * This file is subject to the terms and conditions of the GNU General Public | 2 | #define __ASM_MIPS_MACH_BCM47XX_GPIO_H |
3 | * License. See the file "COPYING" in the main directory of this archive | ||
4 | * for more details. | ||
5 | * | ||
6 | * Copyright (C) 2007 Aurelien Jarno <aurelien@aurel32.net> | ||
7 | */ | ||
8 | 3 | ||
9 | #ifndef __BCM47XX_GPIO_H | 4 | #include <asm-generic/gpio.h> |
10 | #define __BCM47XX_GPIO_H | ||
11 | 5 | ||
12 | #include <linux/ssb/ssb_embedded.h> | 6 | #define gpio_get_value __gpio_get_value |
13 | #include <linux/bcma/bcma.h> | 7 | #define gpio_set_value __gpio_set_value |
14 | #include <asm/mach-bcm47xx/bcm47xx.h> | ||
15 | 8 | ||
16 | #define BCM47XX_EXTIF_GPIO_LINES 5 | 9 | #define gpio_cansleep __gpio_cansleep |
17 | #define BCM47XX_CHIPCO_GPIO_LINES 16 | 10 | #define gpio_to_irq __gpio_to_irq |
18 | 11 | ||
19 | extern int gpio_request(unsigned gpio, const char *label); | 12 | static inline int irq_to_gpio(unsigned int irq) |
20 | extern void gpio_free(unsigned gpio); | ||
21 | extern int gpio_to_irq(unsigned gpio); | ||
22 | |||
23 | static inline int gpio_get_value(unsigned gpio) | ||
24 | { | 13 | { |
25 | switch (bcm47xx_bus_type) { | ||
26 | #ifdef CONFIG_BCM47XX_SSB | ||
27 | case BCM47XX_BUS_TYPE_SSB: | ||
28 | return ssb_gpio_in(&bcm47xx_bus.ssb, 1 << gpio); | ||
29 | #endif | ||
30 | #ifdef CONFIG_BCM47XX_BCMA | ||
31 | case BCM47XX_BUS_TYPE_BCMA: | ||
32 | return bcma_chipco_gpio_in(&bcm47xx_bus.bcma.bus.drv_cc, | ||
33 | 1 << gpio); | ||
34 | #endif | ||
35 | } | ||
36 | return -EINVAL; | 14 | return -EINVAL; |
37 | } | 15 | } |
38 | 16 | ||
39 | #define gpio_get_value_cansleep gpio_get_value | ||
40 | |||
41 | static inline void gpio_set_value(unsigned gpio, int value) | ||
42 | { | ||
43 | switch (bcm47xx_bus_type) { | ||
44 | #ifdef CONFIG_BCM47XX_SSB | ||
45 | case BCM47XX_BUS_TYPE_SSB: | ||
46 | ssb_gpio_out(&bcm47xx_bus.ssb, 1 << gpio, | ||
47 | value ? 1 << gpio : 0); | ||
48 | return; | ||
49 | #endif | ||
50 | #ifdef CONFIG_BCM47XX_BCMA | ||
51 | case BCM47XX_BUS_TYPE_BCMA: | ||
52 | bcma_chipco_gpio_out(&bcm47xx_bus.bcma.bus.drv_cc, 1 << gpio, | ||
53 | value ? 1 << gpio : 0); | ||
54 | return; | ||
55 | #endif | 17 | #endif |
56 | } | ||
57 | } | ||
58 | |||
59 | #define gpio_set_value_cansleep gpio_set_value | ||
60 | |||
61 | static inline int gpio_cansleep(unsigned gpio) | ||
62 | { | ||
63 | return 0; | ||
64 | } | ||
65 | |||
66 | static inline int gpio_is_valid(unsigned gpio) | ||
67 | { | ||
68 | return gpio < (BCM47XX_EXTIF_GPIO_LINES + BCM47XX_CHIPCO_GPIO_LINES); | ||
69 | } | ||
70 | |||
71 | |||
72 | static inline int gpio_direction_input(unsigned gpio) | ||
73 | { | ||
74 | switch (bcm47xx_bus_type) { | ||
75 | #ifdef CONFIG_BCM47XX_SSB | ||
76 | case BCM47XX_BUS_TYPE_SSB: | ||
77 | ssb_gpio_outen(&bcm47xx_bus.ssb, 1 << gpio, 0); | ||
78 | return 0; | ||
79 | #endif | ||
80 | #ifdef CONFIG_BCM47XX_BCMA | ||
81 | case BCM47XX_BUS_TYPE_BCMA: | ||
82 | bcma_chipco_gpio_outen(&bcm47xx_bus.bcma.bus.drv_cc, 1 << gpio, | ||
83 | 0); | ||
84 | return 0; | ||
85 | #endif | ||
86 | } | ||
87 | return -EINVAL; | ||
88 | } | ||
89 | |||
90 | static inline int gpio_direction_output(unsigned gpio, int value) | ||
91 | { | ||
92 | switch (bcm47xx_bus_type) { | ||
93 | #ifdef CONFIG_BCM47XX_SSB | ||
94 | case BCM47XX_BUS_TYPE_SSB: | ||
95 | /* first set the gpio out value */ | ||
96 | ssb_gpio_out(&bcm47xx_bus.ssb, 1 << gpio, | ||
97 | value ? 1 << gpio : 0); | ||
98 | /* then set the gpio mode */ | ||
99 | ssb_gpio_outen(&bcm47xx_bus.ssb, 1 << gpio, 1 << gpio); | ||
100 | return 0; | ||
101 | #endif | ||
102 | #ifdef CONFIG_BCM47XX_BCMA | ||
103 | case BCM47XX_BUS_TYPE_BCMA: | ||
104 | /* first set the gpio out value */ | ||
105 | bcma_chipco_gpio_out(&bcm47xx_bus.bcma.bus.drv_cc, 1 << gpio, | ||
106 | value ? 1 << gpio : 0); | ||
107 | /* then set the gpio mode */ | ||
108 | bcma_chipco_gpio_outen(&bcm47xx_bus.bcma.bus.drv_cc, 1 << gpio, | ||
109 | 1 << gpio); | ||
110 | return 0; | ||
111 | #endif | ||
112 | } | ||
113 | return -EINVAL; | ||
114 | } | ||
115 | |||
116 | static inline int gpio_intmask(unsigned gpio, int value) | ||
117 | { | ||
118 | switch (bcm47xx_bus_type) { | ||
119 | #ifdef CONFIG_BCM47XX_SSB | ||
120 | case BCM47XX_BUS_TYPE_SSB: | ||
121 | ssb_gpio_intmask(&bcm47xx_bus.ssb, 1 << gpio, | ||
122 | value ? 1 << gpio : 0); | ||
123 | return 0; | ||
124 | #endif | ||
125 | #ifdef CONFIG_BCM47XX_BCMA | ||
126 | case BCM47XX_BUS_TYPE_BCMA: | ||
127 | bcma_chipco_gpio_intmask(&bcm47xx_bus.bcma.bus.drv_cc, | ||
128 | 1 << gpio, value ? 1 << gpio : 0); | ||
129 | return 0; | ||
130 | #endif | ||
131 | } | ||
132 | return -EINVAL; | ||
133 | } | ||
134 | |||
135 | static inline int gpio_polarity(unsigned gpio, int value) | ||
136 | { | ||
137 | switch (bcm47xx_bus_type) { | ||
138 | #ifdef CONFIG_BCM47XX_SSB | ||
139 | case BCM47XX_BUS_TYPE_SSB: | ||
140 | ssb_gpio_polarity(&bcm47xx_bus.ssb, 1 << gpio, | ||
141 | value ? 1 << gpio : 0); | ||
142 | return 0; | ||
143 | #endif | ||
144 | #ifdef CONFIG_BCM47XX_BCMA | ||
145 | case BCM47XX_BUS_TYPE_BCMA: | ||
146 | bcma_chipco_gpio_polarity(&bcm47xx_bus.bcma.bus.drv_cc, | ||
147 | 1 << gpio, value ? 1 << gpio : 0); | ||
148 | return 0; | ||
149 | #endif | ||
150 | } | ||
151 | return -EINVAL; | ||
152 | } | ||
153 | |||
154 | |||
155 | #endif /* __BCM47XX_GPIO_H */ | ||