summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott McNutt <smcnutt@psyent.com>2006-06-08 12:08:12 -0400
committerScott McNutt <smcnutt@psyent.com>2006-06-08 12:08:12 -0400
commit1f6ce8f5ba013b9cfd2b8f9cea051d70f3b1bc43 (patch)
treec3334c350ad666a82f7a00797c8b86d26a6017d1
parent3d22d0b89bb3d669e27ff98d15ab013fbe04ee87 (diff)
downloadu-boot-imx-1f6ce8f5ba013b9cfd2b8f9cea051d70f3b1bc43.zip
u-boot-imx-1f6ce8f5ba013b9cfd2b8f9cea051d70f3b1bc43.tar.gz
u-boot-imx-1f6ce8f5ba013b9cfd2b8f9cea051d70f3b1bc43.tar.bz2
Nios II - Add EPCS Controller bootrom work-around
-When booting from an epcs controller, the epcs bootrom may leave the slave select in an asserted state causing soft reset hang. This patch ensures slave select is negated at reset. Patch by Scott McNutt, 08 Jun 2006
-rw-r--r--CHANGELOG6
-rw-r--r--cpu/nios2/epcs.c15
-rw-r--r--include/nios2-epcs.h5
-rw-r--r--lib_nios2/board.c10
4 files changed, 36 insertions, 0 deletions
diff --git a/CHANGELOG b/CHANGELOG
index 5480a69..547f90c 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -2,6 +2,12 @@
Changes since U-Boot 1.1.4:
======================================================================
+* Nios II - Add EPCS Controller bootrom work-around
+ -When booting from an epcs controller, the epcs bootrom may leave the
+ slave select in an asserted state causing soft reset hang. This
+ patch ensures slave select is negated at reset.
+ Patch by Scott McNutt, 08 Jun 2006
+
* Update PK1C20 board
-Update base addresses for standard configuration
-Eliminate use of CACHE_BYPASS in board code
diff --git a/cpu/nios2/epcs.c b/cpu/nios2/epcs.c
index fd9fd84..414c38c 100644
--- a/cpu/nios2/epcs.c
+++ b/cpu/nios2/epcs.c
@@ -210,6 +210,21 @@ static struct epcs_devinfo_t devinfo[] = {
{ 0, 0, 0, 0, 0, 0 }
};
+int epcs_reset (void)
+{
+ /* When booting from an epcs controller, the epcs bootrom
+ * code may leave the slave select in an asserted state.
+ * This causes two problems: (1) The initial epcs access
+ * will fail -- not a big deal, and (2) a software reset
+ * will cause the bootrom code to hang since it does not
+ * ensure the select is negated prior to first access -- a
+ * big deal. Here we just negate chip select and everything
+ * gets better :-)
+ */
+ epcs_cs (0); /* Negate chip select */
+ return (0);
+}
+
epcs_devinfo_t *epcs_dev_find (void)
{
unsigned char buf[4];
diff --git a/include/nios2-epcs.h b/include/nios2-epcs.h
index 2c9522c..20e0c87 100644
--- a/include/nios2-epcs.h
+++ b/include/nios2-epcs.h
@@ -38,6 +38,11 @@ typedef struct epcs_devinfo_t {
unsigned char prot_mask; /* Protection mask */
}epcs_devinfo_t;
+/* Resets the epcs controller -- to prevent (potential) soft-reset
+ * problems when booting from the epcs controller
+ */
+extern int epcs_reset (void);
+
/* Returns the devinfo struct if EPCS device is found;
* NULL otherwise.
*/
diff --git a/lib_nios2/board.c b/lib_nios2/board.c
index cd23037..7ffb3f0 100644
--- a/lib_nios2/board.c
+++ b/lib_nios2/board.c
@@ -31,6 +31,9 @@
#ifdef CONFIG_STATUS_LED
#include <status_led.h>
#endif
+#if defined(CFG_NIOS_EPCSBASE)
+#include <nios2-epcs.h>
+#endif
DECLARE_GLOBAL_DATA_PTR;
@@ -93,6 +96,9 @@ init_fnc_t *init_sequence[] = {
#if defined(CONFIG_BOARD_EARLY_INIT_F)
board_early_init_f, /* Call board-specific init code early.*/
#endif
+#if defined(CFG_NIOS_EPCSBASE)
+ epcs_reset,
+#endif
env_init,
serial_init,
@@ -165,6 +171,10 @@ void board_init (void)
WATCHDOG_RESET ();
interrupt_init ();
+#if defined(CONFIG_BOARD_LATE_INIT)
+ board_late_init ();
+#endif
+
/* main_loop */
for (;;) {
WATCHDOG_RESET ();