diff options
author | Arnd Bergmann <arnd@arndb.de> | 2011-11-02 02:46:10 +0100 |
---|---|---|
committer | Arnd Bergmann <arnd@arndb.de> | 2011-11-02 02:46:10 +0100 |
commit | 884897e6a10a86de0e611a76f4bf3fd0068a672c (patch) | |
tree | 019689fb9d129404af1efba4df10975bc9e0a57a /drivers/gpio/gpio-sa1100.c | |
parent | c72dbae971400e466ad9ff16c920cd6d9d8c55a1 (diff) | |
parent | 8b61f37440388ebbd2a894178fe098f2e70ab392 (diff) | |
download | linux-884897e6a10a86de0e611a76f4bf3fd0068a672c.tar.gz linux-884897e6a10a86de0e611a76f4bf3fd0068a672c.tar.bz2 linux-884897e6a10a86de0e611a76f4bf3fd0068a672c.zip |
Merge branch 'highbank/soc' into next/soc
Conflicts:
arch/arm/mach-mxs/include/mach/gpio.h
arch/arm/mach-omap2/board-generic.c
arch/arm/plat-mxc/include/mach/gpio.h
Diffstat (limited to 'drivers/gpio/gpio-sa1100.c')
-rw-r--r-- | drivers/gpio/gpio-sa1100.c | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/drivers/gpio/gpio-sa1100.c b/drivers/gpio/gpio-sa1100.c new file mode 100644 index 000000000000..b6c1f6d80649 --- /dev/null +++ b/drivers/gpio/gpio-sa1100.c @@ -0,0 +1,63 @@ +/* + * linux/arch/arm/mach-sa1100/gpio.c + * + * Generic SA-1100 GPIO handling + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ +#include <linux/gpio.h> +#include <linux/init.h> +#include <linux/module.h> + +#include <mach/hardware.h> + +static int sa1100_gpio_get(struct gpio_chip *chip, unsigned offset) +{ + return GPLR & GPIO_GPIO(offset); +} + +static void sa1100_gpio_set(struct gpio_chip *chip, unsigned offset, int value) +{ + if (value) + GPSR = GPIO_GPIO(offset); + else + GPCR = GPIO_GPIO(offset); +} + +static int sa1100_direction_input(struct gpio_chip *chip, unsigned offset) +{ + unsigned long flags; + + local_irq_save(flags); + GPDR &= ~GPIO_GPIO(offset); + local_irq_restore(flags); + return 0; +} + +static int sa1100_direction_output(struct gpio_chip *chip, unsigned offset, int value) +{ + unsigned long flags; + + local_irq_save(flags); + sa1100_gpio_set(chip, offset, value); + GPDR |= GPIO_GPIO(offset); + local_irq_restore(flags); + return 0; +} + +static struct gpio_chip sa1100_gpio_chip = { + .label = "gpio", + .direction_input = sa1100_direction_input, + .direction_output = sa1100_direction_output, + .set = sa1100_gpio_set, + .get = sa1100_gpio_get, + .base = 0, + .ngpio = GPIO_MAX + 1, +}; + +void __init sa1100_init_gpio(void) +{ + gpiochip_add(&sa1100_gpio_chip); +} |