Ver código fonte

* Add EPCS Controller bootrom work-around for Nios-II
Patch from Scott McNutt 11, Aug 2005
-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.

Heiko Schocher 19 anos atrás
pai
commit
7fd392c2d0
4 arquivos alterados com 37 adições e 1 exclusões
  1. 7 1
      CHANGELOG
  2. 15 0
      cpu/nios2/epcs.c
  3. 5 0
      include/nios2-epcs.h
  4. 10 0
      lib_nios2/board.c

+ 7 - 1
CHANGELOG

@@ -2,8 +2,14 @@
 Changes since U-Boot 1.1.4:
 ======================================================================
 
+* Add EPCS Controller bootrom work-around for Nios-II
+   Patch from Scott McNutt 11, Aug 2005
+   -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.
+
 * Fix I/O Macros and mini-app stubs for Nios-II
-  Patch by Scott McNutt 11, Aug 2005
+  Patch from Scott McNutt 11, Aug 2005
   -Fix asm/io.h macros
   -Eliminate use of CACHE_BYPASS in cpu code
   -Eliminate assembler warnings

+ 15 - 0
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];

+ 5 - 0
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.
  */

+ 10 - 0
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 ();