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()
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user