summaryrefslogtreecommitdiff
path: root/arch/nios2/include
diff options
context:
space:
mode:
authorJoachim Foerster <joachim.foerster@missinglinkelectronics.com>2011-10-21 15:48:50 +0200
committerThomas Chou <thomas@wytron.com.tw>2011-10-28 09:50:49 +0800
commit03d67e127685f65513e7b78dacbd4ccaf01053f6 (patch)
tree689e13ece8dd47b9c03354ac97fcd9d13127c756 /arch/nios2/include
parentf956ad98b2ba10901b6ea04983e679bc5ddc4d7a (diff)
downloadu-boot-imx-03d67e127685f65513e7b78dacbd4ccaf01053f6.zip
u-boot-imx-03d67e127685f65513e7b78dacbd4ccaf01053f6.tar.gz
u-boot-imx-03d67e127685f65513e7b78dacbd4ccaf01053f6.tar.bz2
gpio: Add driver for Altera's PIO core
This driver may handle multiple PIO cores and thus needs to be setup by calling the altera_pio_init() function within the early board setup routine. The driver comes with some extras, see below the copyleft header. Signed-off-by: Joachim Foerster <joachim.foerster@missinglinkelectronics.com> Tested-by: Thomas Chou <thomas@wytron.com.tw> Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Diffstat (limited to 'arch/nios2/include')
-rw-r--r--arch/nios2/include/asm/gpio.h13
1 files changed, 11 insertions, 2 deletions
diff --git a/arch/nios2/include/asm/gpio.h b/arch/nios2/include/asm/gpio.h
index 4b21c8f..908381f 100644
--- a/arch/nios2/include/asm/gpio.h
+++ b/arch/nios2/include/asm/gpio.h
@@ -5,8 +5,8 @@
* bit[0] data
* bit[1] output enable
*
- * when CONFIG_SYS_GPIO_BASE is not defined, board may provide
- * its own driver.
+ * When CONFIG_SYS_GPIO_BASE is not defined, the board may either
+ * provide its own driver or the altera_pio driver may be used.
*
* Copyright (C) 2010 Thomas Chou <thomas@wytron.com.tw>
*
@@ -58,6 +58,15 @@ static inline int gpio_is_valid(int number)
return ((unsigned)number) < CONFIG_SYS_GPIO_WIDTH;
}
#else
+#ifdef CONFIG_ALTERA_PIO
+extern int altera_pio_init(u32 base, u8 width, char iot,
+ u32 rstval, u32 negmask,
+ const char *label);
+
+extern void altera_pio_info(void);
+#define gpio_status() altera_pio_info()
+#endif
+
extern int gpio_request(unsigned gpio, const char *label);
extern int gpio_free(unsigned gpio);
extern int gpio_direction_input(unsigned gpio);