summaryrefslogtreecommitdiff
path: root/board
diff options
context:
space:
mode:
authorWolfgang Denk <wd@denx.de>2011-11-21 22:00:37 +0100
committerWolfgang Denk <wd@denx.de>2011-11-21 22:00:37 +0100
commitc829ff2e3d1bec9b2019480d82638149327db99e (patch)
tree0bd760629b01f50e0829405abebaa66d1332b7c1 /board
parent05622191e510e495b6a06da6342126e80a3fed8f (diff)
parent4279c53e5b594ed9b09c752df3cf0b4eacf57788 (diff)
downloadu-boot-imx-c829ff2e3d1bec9b2019480d82638149327db99e.zip
u-boot-imx-c829ff2e3d1bec9b2019480d82638149327db99e.tar.gz
u-boot-imx-c829ff2e3d1bec9b2019480d82638149327db99e.tar.bz2
Merge branch 'master' of git://git.denx.de/u-boot-nios
* 'master' of git://git.denx.de/u-boot-nios: nios2: Offer ft_board_setup() capability and call fdt_fixup_ethernet(). board/nios2-generic: Use altera_pio driver and remove board specific driver gpio: Add driver for Altera's PIO core nios2: Pseudo implement dcache_status/enable/disable()
Diffstat (limited to 'board')
-rw-r--r--board/altera/nios2-generic/Makefile1
-rw-r--r--board/altera/nios2-generic/custom_fpga.h1
-rw-r--r--board/altera/nios2-generic/gpio.c71
-rw-r--r--board/altera/nios2-generic/nios2-generic.c8
4 files changed, 9 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/custom_fpga.h b/board/altera/nios2-generic/custom_fpga.h
index f7f3853..fd3ec9a 100644
--- a/board/altera/nios2-generic/custom_fpga.h
+++ b/board/altera/nios2-generic/custom_fpga.h
@@ -51,6 +51,7 @@
/* led_pio.s1 is a altera_avalon_pio */
#define LED_PIO_BASE 0x82120870
#define LED_PIO_WIDTH 8
+#define LED_PIO_RSTVAL 0x0
/* high_res_timer.s1 is a altera_avalon_timer */
#define CONFIG_SYS_TIMER_BASE 0x82120820
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/board/altera/nios2-generic/nios2-generic.c b/board/altera/nios2-generic/nios2-generic.c
index 49ef80d..0f88275 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