summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoachim Foerster <joachim.foerster@missinglinkelectronics.com>2011-10-21 15:48:51 +0200
committerThomas Chou <thomas@wytron.com.tw>2011-10-28 09:51:19 +0800
commitdf969b5ffd62449f3625dacb036bef107d5306d4 (patch)
tree2fb05ca0b04c46547ae919bb13e75a897992acd7
parent03d67e127685f65513e7b78dacbd4ccaf01053f6 (diff)
downloadu-boot-imx-df969b5ffd62449f3625dacb036bef107d5306d4.zip
u-boot-imx-df969b5ffd62449f3625dacb036bef107d5306d4.tar.gz
u-boot-imx-df969b5ffd62449f3625dacb036bef107d5306d4.tar.bz2
board/nios2-generic: Use altera_pio driver and remove board specific driver
Signed-off-by: Joachim Foerster <joachim.foerster@missinglinkelectronics.com> Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
-rw-r--r--board/altera/nios2-generic/Makefile1
-rw-r--r--board/altera/nios2-generic/gpio.c71
-rw-r--r--include/configs/nios2-generic.h4
3 files changed, 4 insertions, 72 deletions
diff --git a/board/altera/nios2-generic/Makefile b/board/altera/nios2-generic/Makefile
index 359f590..59fd465 100644
--- a/board/altera/nios2-generic/Makefile
+++ b/board/altera/nios2-generic/Makefile
@@ -32,7 +32,6 @@ LIB = $(obj)lib$(BOARD).o
COBJS-y := $(BOARD).o
COBJS-$(CONFIG_CMD_IDE) += ../common/cfide.o
COBJS-$(CONFIG_EPLED) += ../common/epled.o
-COBJS-$(CONFIG_GPIO) += gpio.o
COBJS-$(CONFIG_SEVENSEG) += ../common/sevenseg.o
SOBJS-y := text_base.o
diff --git a/board/altera/nios2-generic/gpio.c b/board/altera/nios2-generic/gpio.c
deleted file mode 100644
index 4a30564..0000000
--- a/board/altera/nios2-generic/gpio.c
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * board gpio driver
- *
- * Copyright (C) 2010 Thomas Chou <thomas@wytron.com.tw>
- * Licensed under the GPL-2 or later.
- */
-#include <common.h>
-#include <asm/io.h>
-
-#ifndef CONFIG_SYS_GPIO_BASE
-
-#define ALTERA_PIO_BASE LED_PIO_BASE
-#define ALTERA_PIO_WIDTH LED_PIO_WIDTH
-#define ALTERA_PIO_DATA (ALTERA_PIO_BASE + 0)
-#define ALTERA_PIO_DIR (ALTERA_PIO_BASE + 4)
-static u32 pio_data_reg;
-static u32 pio_dir_reg;
-
-int gpio_request(unsigned gpio, const char *label)
-{
- return 0;
-}
-
-int gpio_free(unsigned gpio)
-{
- return 0;
-}
-
-int gpio_direction_input(unsigned gpio)
-{
- u32 mask = 1 << gpio;
- writel(pio_dir_reg &= ~mask, ALTERA_PIO_DIR);
- return 0;
-}
-
-int gpio_direction_output(unsigned gpio, int value)
-{
- u32 mask = 1 << gpio;
- if (value)
- pio_data_reg |= mask;
- else
- pio_data_reg &= ~mask;
- writel(pio_data_reg, ALTERA_PIO_DATA);
- writel(pio_dir_reg |= mask, ALTERA_PIO_DIR);
- return 0;
-}
-
-int gpio_get_value(unsigned gpio)
-{
- u32 mask = 1 << gpio;
- if (pio_dir_reg & mask)
- return (pio_data_reg & mask) ? 1 : 0;
- else
- return (readl(ALTERA_PIO_DATA) & mask) ? 1 : 0;
-}
-
-void gpio_set_value(unsigned gpio, int value)
-{
- u32 mask = 1 << gpio;
- if (value)
- pio_data_reg |= mask;
- else
- pio_data_reg &= ~mask;
- writel(pio_data_reg, ALTERA_PIO_DATA);
-}
-
-int gpio_is_valid(int number)
-{
- return ((unsigned)number) < ALTERA_PIO_WIDTH;
-}
-#endif
diff --git a/include/configs/nios2-generic.h b/include/configs/nios2-generic.h
index 1395939..9ba35e8 100644
--- a/include/configs/nios2-generic.h
+++ b/include/configs/nios2-generic.h
@@ -63,6 +63,10 @@
/*
* STATUS LED
*/
+#define CONFIG_ALTERA_PIO
+#define CONFIG_SYS_ALTERA_PIO_NUM 1
+#define CONFIG_SYS_ALTERA_PIO_GPIO_NUM LED_PIO_WIDTH
+
#define CONFIG_STATUS_LED /* Enable status driver */
#define CONFIG_GPIO_LED /* Enable GPIO LED driver */
#define CONFIG_GPIO /* Enable GPIO driver */