]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
Nios II - Add EPCS Controller bootrom work-around
authorScott McNutt <smcnutt@psyent.com>
Thu, 8 Jun 2006 16:08:12 +0000 (12:08 -0400)
committerScott McNutt <smcnutt@psyent.com>
Thu, 8 Jun 2006 16:08:12 +0000 (12:08 -0400)
  -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

CHANGELOG
cpu/nios2/epcs.c
include/nios2-epcs.h
lib_nios2/board.c

index 5480a69d8f93ad48a36a76578bb0c1969b8928ea..547f90c65e9b6a9a6e43dd17c9fea717ef4c30b5 100644 (file)
--- 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
index fd9fd8498a506023b64d577cce6753afb3a1dce4..414c38c2b1df370f8432777e28bb635a90e028ad 100644 (file)
@@ -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];
index 2c9522cfd8975684d3239353a04fe132f47cbdac..20e0c87c89f91ee556ce3574dd3c63f8a20b097e 100644 (file)
@@ -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.
  */
index cd23037771407993b92229166ed83efc66504702..7ffb3f019b96ecaae1f8f631282051b5b0d24988 100644 (file)
@@ -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 ();