Skip to content

Commit

Permalink
ARM: at91: gpio: implement request
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jean-Christophe PLAGNIOL-VILLARD committed Oct 13, 2012
1 parent 8d39e0f commit c18486e
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions arch/arm/mach-at91/gpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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, \
Expand Down Expand Up @@ -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)
{
Expand Down

0 comments on commit c18486e

Please sign in to comment.