[U-Boot] [PATCH] nios2: add epcs, gpio led and mmc_spi to nios2-generic
Thomas Chou
thomas at wytron.com.tw
Tue Apr 27 05:29:45 CEST 2010
Since Wolfgang requests that new driver should be used with a
board, these peripherals are added to the nios2-generic board.
It will exercise drivers in these outstanding patches,
04/17 [PATCH v4] nios2: add gpio support
04/21 [PATCH v2] misc: add gpio based status led driver
04/27 [PATCH v8] spi: add altera spi controller support
04/27 [PATCH v3] mmc: add generic mmc spi driver
Signed-off-by: Thomas Chou <thomas at wytron.com.tw>
---
board/altera/nios2-generic/custom_fpga.h | 29 ++++++++++++++++++++++++++++
board/altera/nios2-generic/nios2-generic.c | 13 ++++++++++++
include/configs/nios2-generic.h | 9 ++++++-
3 files changed, 49 insertions(+), 2 deletions(-)
diff --git a/board/altera/nios2-generic/custom_fpga.h b/board/altera/nios2-generic/custom_fpga.h
index 761f605..4e51ea3 100644
--- a/board/altera/nios2-generic/custom_fpga.h
+++ b/board/altera/nios2-generic/custom_fpga.h
@@ -63,4 +63,33 @@
/* sysid.control_slave is a altera_avalon_sysid */
#define CONFIG_SYS_SYSID_BASE 0x821208b8
+/* epcs_controller.epcs_control_port is a altera_avalon_epcs_flash_controller */
+#define CONFIG_SYS_SPI_BASE 0x82100200
+#define CONFIG_ALTERA_SPI
+#define CONFIG_CMD_SPI
+#define CONFIG_CMD_SF
+#define CONFIG_SF_DEFAULT_SPEED 30000000
+#define CONFIG_SPI_FLASH
+#define CONFIG_SPI_FLASH_STMICRO
+
+/* gpio_0.avalon_slave_0 is a gpio */
+#define CONFIG_SYS_GPIO_BASE 0x82120900
+
+/* mmc_spi.spi_control_port is a altera_avalon_spi */
+#define MMC_SPI_BASE 0x82120940
+#define CONFIG_SYS_ALTERA_SPI_LIST { CONFIG_SYS_SPI_BASE, MMC_SPI_BASE }
+#define CONFIG_ALTERA_SPI
+#define CONFIG_CMD_SPI
+#define CONFIG_CMD_MMC
+#define CONFIG_MMC
+#define CONFIG_GENERIC_MMC
+#define CONFIG_CMD_MMC_SPI
+#define CONFIG_MMC_SPI
+#define CONFIG_MMC_SPI_BUS 1
+#define CONFIG_MMC_SPI_CS 0
+#define CONFIG_MMC_SPI_SPEED 30000000
+#define CONFIG_MMC_SPI_MODE SPI_MODE_3
+#define CONFIG_CMD_FAT
+#define CONFIG_DOS_PARTITION
+
#endif /* _CUSTOM_FPGA_H_ */
diff --git a/board/altera/nios2-generic/nios2-generic.c b/board/altera/nios2-generic/nios2-generic.c
index 89848cf..f19fb1a 100644
--- a/board/altera/nios2-generic/nios2-generic.c
+++ b/board/altera/nios2-generic/nios2-generic.c
@@ -24,6 +24,7 @@
#include <common.h>
#include <netdev.h>
+#include <mmc_spi.h>
void text_base_hook(void); /* nop hook for text_base.S */
@@ -66,3 +67,15 @@ int board_eth_init(bd_t *bis)
return rc;
}
#endif
+
+#ifdef CONFIG_GENERIC_MMC
+int board_mmc_init(bd_t *bis)
+{
+ int rc = 0;
+#ifdef CONFIG_MMC_SPI
+ rc = mmc_spi_init(CONFIG_MMC_SPI_BUS, CONFIG_MMC_SPI_CS,
+ CONFIG_MMC_SPI_SPEED, CONFIG_MMC_SPI_MODE);
+#endif
+ return rc;
+}
+#endif
diff --git a/include/configs/nios2-generic.h b/include/configs/nios2-generic.h
index e83e1e3..3716275 100644
--- a/include/configs/nios2-generic.h
+++ b/include/configs/nios2-generic.h
@@ -63,6 +63,7 @@
* STATUS LED
*/
#define CONFIG_STATUS_LED /* Enable status driver */
+#undef CONFIG_GPIO_LED /* Enable GPIO LED driver */
#define CONFIG_EPLED /* Enable LED PIO driver */
#define CONFIG_SYS_LEDPIO_ADDR LED_PIO_BASE
@@ -108,7 +109,7 @@
#define CONFIG_ENV_SIZE 0x10000 /* 64k, 1 sector */
#define CONFIG_ENV_OVERWRITE /* Serial change Ok */
#define CONFIG_ENV_ADDR ((CONFIG_SYS_RESET_ADDR + \
- CONFIG_SYS_MONITOR_LEN) | \
+ 0x40000) | \
CONFIG_SYS_FLASH_BASE)
/*
@@ -119,7 +120,11 @@
* -The stack is placed below global data (&grows down).
*/
#define CONFIG_MONITOR_IS_IN_RAM
-#define CONFIG_SYS_MONITOR_LEN 0x40000 /* Reserve 256k */
+#if defined(CONFIG_CMD_FAT)
+# define CONFIG_SYS_MONITOR_LEN 0x80000 /* Reserve 512k */
+#else
+# define CONFIG_SYS_MONITOR_LEN 0x40000 /* Reserve 256k */
+#endif
#define CONFIG_SYS_MONITOR_BASE (CONFIG_SYS_SDRAM_BASE + \
CONFIG_SYS_SDRAM_SIZE - \
CONFIG_SYS_MONITOR_LEN)
--
1.6.6.1
More information about the U-Boot
mailing list