]> Pileus Git - ~andy/linux/blobdiff - drivers/gpio/pl061.c
Merge branch 'egalax' into for-linus
[~andy/linux] / drivers / gpio / pl061.c
index cc3b5e0b595a9e4f6962d99904ac6d6b90e99806..105701a1f05be48e87c9862a80a907437e03863d 100644 (file)
@@ -91,6 +91,12 @@ static int pl061_direction_output(struct gpio_chip *gc, unsigned offset,
        gpiodir = readb(chip->base + GPIODIR);
        gpiodir |= 1 << offset;
        writeb(gpiodir, chip->base + GPIODIR);
+
+       /*
+        * gpio value is set again, because pl061 doesn't allow to set value of
+        * a gpio pin before configuring it in OUT mode.
+        */
+       writeb(!!value << offset, chip->base + (1 << (offset + 2)));
        spin_unlock_irqrestore(&chip->lock, flags);
 
        return 0;
@@ -183,7 +189,7 @@ static int pl061_irq_type(unsigned irq, unsigned trigger)
                gpioibe &= ~(1 << offset);
                if (trigger & IRQ_TYPE_EDGE_RISING)
                        gpioiev |= 1 << offset;
-               else
+               else if (trigger & IRQ_TYPE_EDGE_FALLING)
                        gpioiev &= ~(1 << offset);
        }
        writeb(gpioibe, chip->base + GPIOIBE);