diff options
author | David S. Miller <davem@davemloft.net> | 2009-03-29 10:40:34 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-03-29 10:40:34 +0200 |
commit | 13223cb02ccfa375f2d683d08d30db5b72264f1e (patch) | |
tree | d3fc7d803d22bbfe03b96cf0ba38041d42c8a1c2 /arch/arm/mach-mmp/include/mach/gpio.h | |
parent | tg3: Add GRO support. (diff) | |
parent | Merge branch 'i2c-for-linus' of git://jdelvare.pck.nerim.net/jdelvare-2.6 (diff) | |
download | linux-13223cb02ccfa375f2d683d08d30db5b72264f1e.tar.xz linux-13223cb02ccfa375f2d683d08d30db5b72264f1e.zip |
Merge branch 'master' of /home/davem/src/GIT/linux-2.6/
Diffstat (limited to 'arch/arm/mach-mmp/include/mach/gpio.h')
-rw-r--r-- | arch/arm/mach-mmp/include/mach/gpio.h | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/arch/arm/mach-mmp/include/mach/gpio.h b/arch/arm/mach-mmp/include/mach/gpio.h new file mode 100644 index 000000000000..ab26d13295c4 --- /dev/null +++ b/arch/arm/mach-mmp/include/mach/gpio.h @@ -0,0 +1,36 @@ +#ifndef __ASM_MACH_GPIO_H +#define __ASM_MACH_GPIO_H + +#include <mach/addr-map.h> +#include <mach/irqs.h> +#include <asm-generic/gpio.h> + +#define GPIO_REGS_VIRT (APB_VIRT_BASE + 0x19000) + +#define BANK_OFF(n) (((n) < 3) ? (n) << 2 : 0x100 + (((n) - 3) << 2)) +#define GPIO_REG(x) (*((volatile u32 *)(GPIO_REGS_VIRT + (x)))) + +#define NR_BUILTIN_GPIO (128) + +#define gpio_to_bank(gpio) ((gpio) >> 5) +#define gpio_to_irq(gpio) (IRQ_GPIO_START + (gpio)) +#define irq_to_gpio(irq) ((irq) - IRQ_GPIO_START) + + +#define __gpio_is_inverted(gpio) (0) +#define __gpio_is_occupied(gpio) (0) + +/* NOTE: these macros are defined here to make optimization of + * gpio_{get,set}_value() to work when 'gpio' is a constant. + * Usage of these macros otherwise is no longer recommended, + * use generic GPIO API whenever possible. + */ +#define GPIO_bit(gpio) (1 << ((gpio) & 0x1f)) + +#define GPLR(x) GPIO_REG(BANK_OFF(gpio_to_bank(x)) + 0x00) +#define GPDR(x) GPIO_REG(BANK_OFF(gpio_to_bank(x)) + 0x0c) +#define GPSR(x) GPIO_REG(BANK_OFF(gpio_to_bank(x)) + 0x18) +#define GPCR(x) GPIO_REG(BANK_OFF(gpio_to_bank(x)) + 0x24) + +#include <plat/gpio.h> +#endif /* __ASM_MACH_GPIO_H */ |