diff options
Diffstat (limited to 'patches.at91/0209-ARM-at91-gpio-implement-request.patch')
-rw-r--r-- | patches.at91/0209-ARM-at91-gpio-implement-request.patch | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/patches.at91/0209-ARM-at91-gpio-implement-request.patch b/patches.at91/0209-ARM-at91-gpio-implement-request.patch new file mode 100644 index 00000000000000..1b63aea8c70194 --- /dev/null +++ b/patches.at91/0209-ARM-at91-gpio-implement-request.patch @@ -0,0 +1,58 @@ +From 76c442f41acf1572f18ca23d8a7755b5f292e979 Mon Sep 17 00:00:00 2001 +From: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> +Date: Fri, 6 Jul 2012 06:48:33 +0800 +Subject: 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> +--- + arch/arm/mach-at91/gpio.c | 12 ++++++++++++ + 1 file changed, 12 insertions(+) + +diff --git a/arch/arm/mach-at91/gpio.c b/arch/arm/mach-at91/gpio.c +index be42cf0..3b8f463 100644 +--- a/arch/arm/mach-at91/gpio.c ++++ b/arch/arm/mach-at91/gpio.c +@@ -46,6 +46,7 @@ struct at91_gpio_chip { + + #define to_at91_gpio_chip(c) container_of(c, struct at91_gpio_chip, chip) + ++static int at91_gpiolib_request(struct gpio_chip *chip, unsigned offset); + static void at91_gpiolib_dbg_show(struct seq_file *s, struct gpio_chip *chip); + static void at91_gpiolib_set(struct gpio_chip *chip, unsigned offset, int val); + static 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); + { \ + .chip = { \ + .label = name, \ ++ .request = at91_gpiolib_request, \ + .direction_input = at91_gpiolib_direction_input, \ + .direction_output = at91_gpiolib_direction_output, \ + .get = at91_gpiolib_get, \ +@@ -862,6 +864,16 @@ void __init at91_gpio_irq_setup(void) + } + + /* gpiolib support */ ++static int at91_gpiolib_request(struct gpio_chip *chip, unsigned offset) ++{ ++ struct at91_gpio_chip *at91_gpio = to_at91_gpio_chip(chip); ++ void __iomem *pio = at91_gpio->regbase; ++ unsigned mask = 1 << offset; ++ ++ __raw_writel(mask, pio + PIO_PER); ++ return 0; ++} ++ + static int at91_gpiolib_direction_input(struct gpio_chip *chip, + unsigned offset) + { +-- +1.8.0.197.g5a90748 + |