diff options
Diffstat (limited to 'cpu/pxa/cpu.c')
-rw-r--r-- | cpu/pxa/cpu.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/cpu/pxa/cpu.c b/cpu/pxa/cpu.c index 6a3c24d..cc9b3ff 100644 --- a/cpu/pxa/cpu.c +++ b/cpu/pxa/cpu.c @@ -32,6 +32,7 @@ #include <common.h> #include <command.h> +#include <asm/arch/pxa-regs.h> int cpu_init (void) { @@ -150,3 +151,21 @@ int dcache_status (void) { return 0; /* always off */ } + +void set_GPIO_mode(int gpio_mode) +{ + int gpio = gpio_mode & GPIO_MD_MASK_NR; + int fn = (gpio_mode & GPIO_MD_MASK_FN) >> 8; + int gafr; + + if (gpio_mode & GPIO_MD_MASK_DIR) + { + GPDR(gpio) |= GPIO_bit(gpio); + } + else + { + GPDR(gpio) &= ~GPIO_bit(gpio); + } + gafr = GAFR(gpio) & ~(0x3 << (((gpio) & 0xf)*2)); + GAFR(gpio) = gafr | (fn << (((gpio) & 0xf)*2)); +} |