diff options
Diffstat (limited to 'drivers/gpio/gpio-omap.c')
-rw-r--r-- | drivers/gpio/gpio-omap.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c index 8cc9e91e7e4e..47c6056fe850 100644 --- a/drivers/gpio/gpio-omap.c +++ b/drivers/gpio/gpio-omap.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <linux/of_device.h> | 26 | #include <linux/of_device.h> |
27 | #include <linux/irqchip/chained_irq.h> | 27 | #include <linux/irqchip/chained_irq.h> |
28 | #include <linux/gpio.h> | 28 | #include <linux/gpio.h> |
29 | #include <linux/bitops.h> | ||
29 | #include <linux/platform_data/gpio-omap.h> | 30 | #include <linux/platform_data/gpio-omap.h> |
30 | 31 | ||
31 | #define OFF_MODE 1 | 32 | #define OFF_MODE 1 |
@@ -927,6 +928,21 @@ static inline void mpuio_init(struct gpio_bank *bank) | |||
927 | 928 | ||
928 | /*---------------------------------------------------------------------*/ | 929 | /*---------------------------------------------------------------------*/ |
929 | 930 | ||
931 | static int gpio_get_direction(struct gpio_chip *chip, unsigned offset) | ||
932 | { | ||
933 | struct gpio_bank *bank; | ||
934 | unsigned long flags; | ||
935 | void __iomem *reg; | ||
936 | int dir; | ||
937 | |||
938 | bank = container_of(chip, struct gpio_bank, chip); | ||
939 | reg = bank->base + bank->regs->direction; | ||
940 | spin_lock_irqsave(&bank->lock, flags); | ||
941 | dir = !!(readl_relaxed(reg) & BIT(offset)); | ||
942 | spin_unlock_irqrestore(&bank->lock, flags); | ||
943 | return dir; | ||
944 | } | ||
945 | |||
930 | static int gpio_input(struct gpio_chip *chip, unsigned offset) | 946 | static int gpio_input(struct gpio_chip *chip, unsigned offset) |
931 | { | 947 | { |
932 | struct gpio_bank *bank; | 948 | struct gpio_bank *bank; |
@@ -1085,6 +1101,7 @@ static int omap_gpio_chip_init(struct gpio_bank *bank) | |||
1085 | */ | 1101 | */ |
1086 | bank->chip.request = omap_gpio_request; | 1102 | bank->chip.request = omap_gpio_request; |
1087 | bank->chip.free = omap_gpio_free; | 1103 | bank->chip.free = omap_gpio_free; |
1104 | bank->chip.get_direction = gpio_get_direction; | ||
1088 | bank->chip.direction_input = gpio_input; | 1105 | bank->chip.direction_input = gpio_input; |
1089 | bank->chip.get = gpio_get; | 1106 | bank->chip.get = gpio_get; |
1090 | bank->chip.direction_output = gpio_output; | 1107 | bank->chip.direction_output = gpio_output; |