From 9486190f3fabf8b68fd943ab814c16c303c4177b Mon Sep 17 00:00:00 2001 From: florian Date: Thu, 4 Jun 2009 10:01:55 +0000 Subject: [PATCH] [brcm63xx] cache gpio values in gpio_set git-svn-id: svn://svn.openwrt.org/openwrt/trunk@16330 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- .../linux/brcm63xx/files/arch/mips/bcm63xx/gpio.c | 13 ++++++++----- 1 file 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 97e3730c3..77636aa86 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 #include +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); }