aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-arm/arch-sa1100/gpio.h
diff options
context:
space:
mode:
authorPhilipp Zabel <philipp.zabel@gmail.com>2007-02-20 16:58:20 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-02-20 20:10:16 -0500
commit5b7e42b2d38e4c4d0cb105a2ad83d43f6957f59e (patch)
tree76758cee84ef63ab138943a2597b645ce58462cb /include/asm-arm/arch-sa1100/gpio.h
parentadff264fe66d78a166dc887f861e7273d0cb1654 (diff)
[PATCH] GPIO API: SA1100 wrapper cleanup
Based on the discussion last december (http://lkml.org/lkml/2006/12/20/241), this patch - adds gpio_direction_input/output functions to generic.c instead of making them inline, - fixes comment and includes and uses inline functions instead of macros in gpio.h Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com> Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/asm-arm/arch-sa1100/gpio.h')
-rw-r--r--include/asm-arm/arch-sa1100/gpio.h34
1 files changed, 14 insertions, 20 deletions
diff --git a/include/asm-arm/arch-sa1100/gpio.h b/include/asm-arm/arch-sa1100/gpio.h
index a331fe3f6e48..da7575b0e5d0 100644
--- a/include/asm-arm/arch-sa1100/gpio.h
+++ b/include/asm-arm/arch-sa1100/gpio.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * linux/include/asm-arm/arch-pxa/gpio.h 2 * linux/include/asm-arm/arch-sa1100/gpio.h
3 * 3 *
4 * SA1100 GPIO wrappers for arch-neutral GPIO calls 4 * SA1100 GPIO wrappers for arch-neutral GPIO calls
5 * 5 *
@@ -24,11 +24,8 @@
24#ifndef __ASM_ARCH_SA1100_GPIO_H 24#ifndef __ASM_ARCH_SA1100_GPIO_H
25#define __ASM_ARCH_SA1100_GPIO_H 25#define __ASM_ARCH_SA1100_GPIO_H
26 26
27#include <asm/arch/SA-1100.h> 27#include <asm/hardware.h>
28#include <asm/arch/irqs.h> 28#include <asm/irq.h>
29#include <asm/arch/hardware.h>
30
31#include <asm/errno.h>
32 29
33static inline int gpio_request(unsigned gpio, const char *label) 30static inline int gpio_request(unsigned gpio, const char *label)
34{ 31{
@@ -40,26 +37,23 @@ static inline void gpio_free(unsigned gpio)
40 return; 37 return;
41} 38}
42 39
43static inline int gpio_direction_input(unsigned gpio) 40extern int gpio_direction_input(unsigned gpio);
41extern int gpio_direction_output(unsigned gpio);
42
43
44static inline int gpio_get_value(unsigned gpio)
44{ 45{
45 if (gpio > GPIO_MAX) 46 return GPLR & GPIO_GPIO(gpio);
46 return -EINVAL;
47 GPDR = (GPDR_In << gpio) 0
48} 47}
49 48
50static inline int gpio_direction_output(unsigned gpio) 49static inline void gpio_set_value(unsigned gpio, int value)
51{ 50{
52 if (gpio > GPIO_MAX) 51 if (value)
53 return -EINVAL; 52 GPSR = GPIO_GPIO(gpio);
54 GPDR = (GPDR_Out << gpio) 0 53 else
54 GPCR = GPIO_GPIO(gpio);
55} 55}
56 56
57#define gpio_get_value(gpio) \
58 (GPLR & GPIO_GPIO(gpio))
59
60#define gpio_set_value(gpio,value) \
61 ((value) ? (GPSR = GPIO_GPIO(gpio)) : (GPCR(gpio) = GPIO_GPIO(gpio)))
62
63#include <asm-generic/gpio.h> /* cansleep wrappers */ 57#include <asm-generic/gpio.h> /* cansleep wrappers */
64 58
65static inline unsigned gpio_to_irq(unsigned gpio) 59static inline unsigned gpio_to_irq(unsigned gpio)