aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ssb/driver_extif.c
diff options
context:
space:
mode:
authorMichael Buesch <mb@bu3sch.de>2008-02-19 08:53:35 -0500
committerJohn W. Linville <linville@tuxdriver.com>2008-02-20 20:11:49 -0500
commitc2bcbe65fc88d61f9a806367ff6eab76c9eabb3a (patch)
treec882d3016ed4a273b8e7e8fb9b86c1bcb6d6836a /drivers/ssb/driver_extif.c
parent42bfad4f71637c4eb4791aa8062063c4a8526522 (diff)
ssb: Fix the GPIO API
This fixes the GPIO API to be usable. Signed-off-by: Michael Buesch <mb@bu3sch.de> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/ssb/driver_extif.c')
-rw-r--r--drivers/ssb/driver_extif.c24
1 files changed, 20 insertions, 4 deletions
diff --git a/drivers/ssb/driver_extif.c b/drivers/ssb/driver_extif.c
index b1899f422a54..10c6b287f8bb 100644
--- a/drivers/ssb/driver_extif.c
+++ b/drivers/ssb/driver_extif.c
@@ -27,12 +27,14 @@ static inline void extif_write32(struct ssb_extif *extif, u16 offset, u32 value)
27 ssb_write32(extif->dev, offset, value); 27 ssb_write32(extif->dev, offset, value);
28} 28}
29 29
30static inline void extif_write32_masked(struct ssb_extif *extif, u16 offset, 30static inline u32 extif_write32_masked(struct ssb_extif *extif, u16 offset,
31 u32 mask, u32 value) 31 u32 mask, u32 value)
32{ 32{
33 value &= mask; 33 value &= mask;
34 value |= extif_read32(extif, offset) & ~mask; 34 value |= extif_read32(extif, offset) & ~mask;
35 extif_write32(extif, offset, value); 35 extif_write32(extif, offset, value);
36
37 return value;
36} 38}
37 39
38#ifdef CONFIG_SSB_SERIAL 40#ifdef CONFIG_SSB_SERIAL
@@ -120,16 +122,30 @@ u32 ssb_extif_gpio_in(struct ssb_extif *extif, u32 mask)
120{ 122{
121 return extif_read32(extif, SSB_EXTIF_GPIO_IN) & mask; 123 return extif_read32(extif, SSB_EXTIF_GPIO_IN) & mask;
122} 124}
125EXPORT_SYMBOL(ssb_extif_gpio_in);
123 126
124void ssb_extif_gpio_out(struct ssb_extif *extif, u32 mask, u32 value) 127u32 ssb_extif_gpio_out(struct ssb_extif *extif, u32 mask, u32 value)
125{ 128{
126 return extif_write32_masked(extif, SSB_EXTIF_GPIO_OUT(0), 129 return extif_write32_masked(extif, SSB_EXTIF_GPIO_OUT(0),
127 mask, value); 130 mask, value);
128} 131}
132EXPORT_SYMBOL(ssb_extif_gpio_out);
129 133
130void ssb_extif_gpio_outen(struct ssb_extif *extif, u32 mask, u32 value) 134u32 ssb_extif_gpio_outen(struct ssb_extif *extif, u32 mask, u32 value)
131{ 135{
132 return extif_write32_masked(extif, SSB_EXTIF_GPIO_OUTEN(0), 136 return extif_write32_masked(extif, SSB_EXTIF_GPIO_OUTEN(0),
133 mask, value); 137 mask, value);
134} 138}
139EXPORT_SYMBOL(ssb_extif_gpio_outen);
140
141u32 ssb_extif_gpio_polarity(struct ssb_extif *extif, u32 mask, u32 value)
142{
143 return extif_write32_masked(extif, SSB_EXTIF_GPIO_INTPOL, mask, value);
144}
145EXPORT_SYMBOL(ssb_extif_gpio_polarity);
135 146
147u32 ssb_extif_gpio_intmask(struct ssb_extif *extif, u32 mask, u32 value)
148{
149 return extif_write32_masked(extif, SSB_EXTIF_GPIO_INTMASK, mask, value);
150}
151EXPORT_SYMBOL(ssb_extif_gpio_intmask);