aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-at91
diff options
context:
space:
mode:
authorJean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>2012-07-05 18:48:33 -0400
committerJean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>2012-10-12 21:09:28 -0400
commitc18486e10d5801b832b34708f6d2bd266c704793 (patch)
tree1cfe9c42eacccc4d1b5c1678a7288952f96c5096 /arch/arm/mach-at91
parent8d39e0fd080fbc2287bca3f596741a38281634da (diff)
ARM: at91: gpio: implement request
Configure the pin as pio when requested. It is needed to configure the pin as PIO at "request time" when we are using DT. Indeed, the muxing via old AT91 API is not allowed anymore if we are using the plain gpiolib. Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com> Acked-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Diffstat (limited to 'arch/arm/mach-at91')
-rw-r--r--arch/arm/mach-at91/gpio.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/arch/arm/mach-at91/gpio.c b/arch/arm/mach-at91/gpio.c
index be42cf0e74bd..3b8f463bfa1d 100644
--- a/arch/arm/mach-at91/gpio.c
+++ b/arch/arm/mach-at91/gpio.c
@@ -46,6 +46,7 @@ struct at91_gpio_chip {
46 46
47#define to_at91_gpio_chip(c) container_of(c, struct at91_gpio_chip, chip) 47#define to_at91_gpio_chip(c) container_of(c, struct at91_gpio_chip, chip)
48 48
49static int at91_gpiolib_request(struct gpio_chip *chip, unsigned offset);
49static void at91_gpiolib_dbg_show(struct seq_file *s, struct gpio_chip *chip); 50static void at91_gpiolib_dbg_show(struct seq_file *s, struct gpio_chip *chip);
50static void at91_gpiolib_set(struct gpio_chip *chip, unsigned offset, int val); 51static void at91_gpiolib_set(struct gpio_chip *chip, unsigned offset, int val);
51static int at91_gpiolib_get(struct gpio_chip *chip, unsigned offset); 52static int at91_gpiolib_get(struct gpio_chip *chip, unsigned offset);
@@ -59,6 +60,7 @@ static int at91_gpiolib_to_irq(struct gpio_chip *chip, unsigned offset);
59 { \ 60 { \
60 .chip = { \ 61 .chip = { \
61 .label = name, \ 62 .label = name, \
63 .request = at91_gpiolib_request, \
62 .direction_input = at91_gpiolib_direction_input, \ 64 .direction_input = at91_gpiolib_direction_input, \
63 .direction_output = at91_gpiolib_direction_output, \ 65 .direction_output = at91_gpiolib_direction_output, \
64 .get = at91_gpiolib_get, \ 66 .get = at91_gpiolib_get, \
@@ -862,6 +864,16 @@ void __init at91_gpio_irq_setup(void)
862} 864}
863 865
864/* gpiolib support */ 866/* gpiolib support */
867static int at91_gpiolib_request(struct gpio_chip *chip, unsigned offset)
868{
869 struct at91_gpio_chip *at91_gpio = to_at91_gpio_chip(chip);
870 void __iomem *pio = at91_gpio->regbase;
871 unsigned mask = 1 << offset;
872
873 __raw_writel(mask, pio + PIO_PER);
874 return 0;
875}
876
865static int at91_gpiolib_direction_input(struct gpio_chip *chip, 877static int at91_gpiolib_direction_input(struct gpio_chip *chip,
866 unsigned offset) 878 unsigned offset)
867{ 879{