From 03d67e127685f65513e7b78dacbd4ccaf01053f6 Mon Sep 17 00:00:00 2001 From: Joachim Foerster Date: Fri, 21 Oct 2011 15:48:50 +0200 Subject: 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 Tested-by: Thomas Chou Signed-off-by: Thomas Chou --- arch/nios2/include/asm/gpio.h | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'arch/nios2') diff --git a/arch/nios2/include/asm/gpio.h b/arch/nios2/include/asm/gpio.h index 4b21c8f7f2..908381f5f7 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 * @@ -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); -- cgit v1.2.1