Skip to content

Commit ea3488f

Browse files
haukeJohn Crispin
authored andcommitted
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>
1 parent ef85fb2 commit ea3488f

2 files changed

Lines changed: 32 additions & 0 deletions

File tree

‎drivers/bcma/driver_chipcommon.c‎

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,36 @@ u32 bcma_chipco_gpio_polarity(struct bcma_drv_cc *cc, u32 mask, u32 value)
145145
return res;
146146
}
147147

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+
148178
#ifdef CONFIG_BCMA_DRIVER_MIPS
149179
void bcma_chipco_serial_init(struct bcma_drv_cc *cc)
150180
{

‎include/linux/bcma/bcma_driver_chipcommon.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -606,6 +606,8 @@ u32 bcma_chipco_gpio_outen(struct bcma_drv_cc *cc, u32 mask, u32 value);
606606
u32 bcma_chipco_gpio_control(struct bcma_drv_cc *cc, u32 mask, u32 value);
607607
u32 bcma_chipco_gpio_intmask(struct bcma_drv_cc *cc, u32 mask, u32 value);
608608
u32 bcma_chipco_gpio_polarity(struct bcma_drv_cc *cc, u32 mask, u32 value);
609+
u32 bcma_chipco_gpio_pullup(struct bcma_drv_cc *cc, u32 mask, u32 value);
610+
u32 bcma_chipco_gpio_pulldown(struct bcma_drv_cc *cc, u32 mask, u32 value);
609611

610612
/* PMU support */
611613
extern void bcma_pmu_init(struct bcma_drv_cc *cc);

0 commit comments

Comments
 (0)