diff options
author | Wolfgang Denk <wd@denx.de> | 2009-07-23 01:00:17 +0200 |
---|---|---|
committer | Wolfgang Denk <wd@denx.de> | 2009-07-23 01:00:17 +0200 |
commit | 189eec77795553157c087cd45555695fb3ce2433 (patch) | |
tree | 0fe750bf698742665746ba8a617bcb1b64d2cad0 /include/asm-arm/arch-kirkwood/gpio.h | |
parent | faca03ca0e7b16f551f10fa895cb8d4bbe0122a0 (diff) | |
parent | 84efbf4d144ff8aaed3cca036aebb1fe69eff3f4 (diff) | |
download | u-boot-imx-189eec77795553157c087cd45555695fb3ce2433.zip u-boot-imx-189eec77795553157c087cd45555695fb3ce2433.tar.gz u-boot-imx-189eec77795553157c087cd45555695fb3ce2433.tar.bz2 |
Merge branch 'master' of /home/wd/git/u-boot/custodians
Diffstat (limited to 'include/asm-arm/arch-kirkwood/gpio.h')
-rw-r--r-- | include/asm-arm/arch-kirkwood/gpio.h | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/include/asm-arm/arch-kirkwood/gpio.h b/include/asm-arm/arch-kirkwood/gpio.h new file mode 100644 index 0000000..a79102b --- /dev/null +++ b/include/asm-arm/arch-kirkwood/gpio.h @@ -0,0 +1,53 @@ +/* + * arch/asm-arm/mach-kirkwood/include/mach/gpio.h + * + * This file is licensed under the terms of the GNU General Public + * License version 2. This program is licensed "as is" without any + * warranty of any kind, whether express or implied. + */ + +/* + * Based on (mostly copied from) plat-orion based Linux 2.6 kernel driver. + * Removed kernel level irq handling. Took some macros from kernel to + * allow build. + * + * Dieter Kiermaier dk-arm-linux@gmx.de + */ + +#ifndef __KIRKWOOD_GPIO_H +#define __KIRKWOOD_GPIO_H + +/* got from kernel include/linux/kernel.h */ +#define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d)) +/* got from kernel include/linux/bitops.h */ +#define BITS_PER_BYTE 8 +#define BITS_TO_LONGS(nr) DIV_ROUND_UP(nr, BITS_PER_BYTE * sizeof(long)) + +#define GPIO_MAX 50 +#define GPIO_OFF(pin) (((pin) >> 5) ? 0x0040 : 0x0000) +#define GPIO_OUT(pin) (KW_GPIO0_BASE + GPIO_OFF(pin) + 0x00) +#define GPIO_IO_CONF(pin) (KW_GPIO0_BASE + GPIO_OFF(pin) + 0x04) +#define GPIO_BLINK_EN(pin) (KW_GPIO0_BASE + GPIO_OFF(pin) + 0x08) +#define GPIO_IN_POL(pin) (KW_GPIO0_BASE + GPIO_OFF(pin) + 0x0c) +#define GPIO_DATA_IN(pin) (KW_GPIO0_BASE + GPIO_OFF(pin) + 0x10) +#define GPIO_EDGE_CAUSE(pin) (KW_GPIO0_BASE + GPIO_OFF(pin) + 0x14) +#define GPIO_EDGE_MASK(pin) (KW_GPIO0_BASE + GPIO_OFF(pin) + 0x18) +#define GPIO_LEVEL_MASK(pin) (KW_GPIO0_BASE + GPIO_OFF(pin) + 0x1c) + +/* + * Kirkwood-specific GPIO API + */ + +void kw_gpio_set_valid(unsigned pin, int mode); +int kw_gpio_is_valid(unsigned pin, int mode); +int kw_gpio_direction_input(unsigned pin); +int kw_gpio_direction_output(unsigned pin, int value); +int kw_gpio_get_value(unsigned pin); +void kw_gpio_set_value(unsigned pin, int value); +void kw_gpio_set_blink(unsigned pin, int blink); +void kw_gpio_set_unused(unsigned pin); + +#define GPIO_INPUT_OK (1 << 0) +#define GPIO_OUTPUT_OK (1 << 1) + +#endif |