summaryrefslogtreecommitdiff
path: root/target/linux/brcm63xx/files
diff options
context:
space:
mode:
authorFlorian Fainelli <florian@openwrt.org>2009-06-04 10:01:55 +0000
committerFlorian Fainelli <florian@openwrt.org>2009-06-04 10:01:55 +0000
commit9013e936ed5d8c5f5c46d5de45f785ebf866f04c (patch)
tree518d350451d568e864dd734cc10ce27bdcb1904d /target/linux/brcm63xx/files
parent1208ffaedb5e7472a15427dd91ae237146305ab5 (diff)
downloadmtk-20170518-9013e936ed5d8c5f5c46d5de45f785ebf866f04c.zip
mtk-20170518-9013e936ed5d8c5f5c46d5de45f785ebf866f04c.tar.gz
mtk-20170518-9013e936ed5d8c5f5c46d5de45f785ebf866f04c.tar.bz2
cache gpio values in gpio_set
SVN-Revision: 16330
Diffstat (limited to 'target/linux/brcm63xx/files')
-rw-r--r--target/linux/brcm63xx/files/arch/mips/bcm63xx/gpio.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/target/linux/brcm63xx/files/arch/mips/bcm63xx/gpio.c b/target/linux/brcm63xx/files/arch/mips/bcm63xx/gpio.c
index 97e3730..77636aa 100644
--- a/target/linux/brcm63xx/files/arch/mips/bcm63xx/gpio.c
+++ b/target/linux/brcm63xx/files/arch/mips/bcm63xx/gpio.c
@@ -18,12 +18,14 @@
#include <bcm63xx_io.h>
#include <bcm63xx_regs.h>
+static u32 gpio_out_low, gpio_out_high;
+
static void bcm63xx_gpio_set(struct gpio_chip *chip,
unsigned gpio, int val)
{
u32 reg;
u32 mask;
- u32 tmp;
+ u32 *v;
unsigned long flags;
if (gpio >= chip->ngpio)
@@ -32,18 +34,19 @@ static void bcm63xx_gpio_set(struct gpio_chip *chip,
if (gpio < 32) {
reg = GPIO_DATA_LO_REG;
mask = 1 << gpio;
+ v = &gpio_out_low;
} else {
reg = GPIO_DATA_HI_REG;
mask = 1 << (gpio - 32);
+ v = &gpio_out_high;
}
local_irq_save(flags);
- tmp = bcm_gpio_readl(reg);
if (val)
- tmp |= mask;
+ *v |= mask;
else
- tmp &= ~mask;
- bcm_gpio_writel(tmp, reg);
+ *v &= ~mask;
+ bcm_gpio_writel(*v, reg);
local_irq_restore(flags);
}