diff options
author | Hauke Mehrtens <hauke@hauke-m.de> | 2012-11-20 17:24:28 -0500 |
---|---|---|
committer | John Crispin <blogic@openwrt.org> | 2012-11-21 15:55:51 -0500 |
commit | ea3488f4696fe22811eb19bee7088b732d3f8fe0 (patch) | |
tree | 21928c292726fb44f831353deee3af0ee032e7b0 /drivers/bcma/driver_chipcommon.c | |
parent | ef85fb28305fad7617f307383ebba554a3a891a2 (diff) |
bcma: add bcma_chipco_gpio_pull{up,down}
Add functions to access the GPIO registers for pullup and pulldown.
These are needed for handling gpio registration.
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Patchwork: http://patchwork.linux-mips.org/patch/4586
Acked-by: Florian Fainelli <florian@openwrt.org>
Diffstat (limited to 'drivers/bcma/driver_chipcommon.c')
-rw-r--r-- | drivers/bcma/driver_chipcommon.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/drivers/bcma/driver_chipcommon.c b/drivers/bcma/driver_chipcommon.c index c9b63d9ff61d..0945383c2271 100644 --- a/drivers/bcma/driver_chipcommon.c +++ b/drivers/bcma/driver_chipcommon.c | |||
@@ -145,6 +145,36 @@ u32 bcma_chipco_gpio_polarity(struct bcma_drv_cc *cc, u32 mask, u32 value) | |||
145 | return res; | 145 | return res; |
146 | } | 146 | } |
147 | 147 | ||
148 | u32 bcma_chipco_gpio_pullup(struct bcma_drv_cc *cc, u32 mask, u32 value) | ||
149 | { | ||
150 | unsigned long flags; | ||
151 | u32 res; | ||
152 | |||
153 | if (cc->core->id.rev < 20) | ||
154 | return 0; | ||
155 | |||
156 | spin_lock_irqsave(&cc->gpio_lock, flags); | ||
157 | res = bcma_cc_write32_masked(cc, BCMA_CC_GPIOPULLUP, mask, value); | ||
158 | spin_unlock_irqrestore(&cc->gpio_lock, flags); | ||
159 | |||
160 | return res; | ||
161 | } | ||
162 | |||
163 | u32 bcma_chipco_gpio_pulldown(struct bcma_drv_cc *cc, u32 mask, u32 value) | ||
164 | { | ||
165 | unsigned long flags; | ||
166 | u32 res; | ||
167 | |||
168 | if (cc->core->id.rev < 20) | ||
169 | return 0; | ||
170 | |||
171 | spin_lock_irqsave(&cc->gpio_lock, flags); | ||
172 | res = bcma_cc_write32_masked(cc, BCMA_CC_GPIOPULLDOWN, mask, value); | ||
173 | spin_unlock_irqrestore(&cc->gpio_lock, flags); | ||
174 | |||
175 | return res; | ||
176 | } | ||
177 | |||
148 | #ifdef CONFIG_BCMA_DRIVER_MIPS | 178 | #ifdef CONFIG_BCMA_DRIVER_MIPS |
149 | void bcma_chipco_serial_init(struct bcma_drv_cc *cc) | 179 | void bcma_chipco_serial_init(struct bcma_drv_cc *cc) |
150 | { | 180 | { |