diff options
author | Joachim Foerster <joachim.foerster@missinglinkelectronics.com> | 2011-10-21 15:48:50 +0200 |
---|---|---|
committer | Thomas Chou <thomas@wytron.com.tw> | 2011-10-28 09:50:49 +0800 |
commit | 03d67e127685f65513e7b78dacbd4ccaf01053f6 (patch) | |
tree | 689e13ece8dd47b9c03354ac97fcd9d13127c756 /board/altera/nios2-generic/nios2-generic.c | |
parent | f956ad98b2ba10901b6ea04983e679bc5ddc4d7a (diff) |
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 'board/altera/nios2-generic/nios2-generic.c')
-rw-r--r-- | board/altera/nios2-generic/nios2-generic.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/board/altera/nios2-generic/nios2-generic.c b/board/altera/nios2-generic/nios2-generic.c index 49ef80de96d..0f882756f5e 100644 --- a/board/altera/nios2-generic/nios2-generic.c +++ b/board/altera/nios2-generic/nios2-generic.c @@ -26,6 +26,7 @@ #include <netdev.h> #include <mtd/cfi_flash.h> #include <asm/io.h> +#include <asm/gpio.h> void text_base_hook(void); /* nop hook for text_base.S */ @@ -43,6 +44,13 @@ void early_flash_cmd_reset(void) int board_early_init_f(void) { text_base_hook(); +#ifdef CONFIG_ALTERA_PIO +#ifdef LED_PIO_BASE + altera_pio_init(LED_PIO_BASE, LED_PIO_WIDTH, 'o', + LED_PIO_RSTVAL, (1 << LED_PIO_WIDTH) - 1, + "led"); +#endif +#endif #if defined(CONFIG_ENV_IS_IN_FLASH) && defined(CONFIG_ENV_ADDR) early_flash_cmd_reset(); #endif |