* Patch by Pierre Aubert, 24 Nov 2003:
  - add a return value for the fpga command
  - add ide_preinit() function called in ide_init if CONFIG_IDE_PREINIT
    is defined. If ide_preinit fails, ide_init is aborted.
  - fix an endianess problem in fat.h
diff --git a/CHANGELOG b/CHANGELOG
index 33f7f34..9d1d84b 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -2,6 +2,12 @@
 Changes since U-Boot 1.0.0:
 ======================================================================
 
+* Patch by Pierre Aubert, 24 Nov 2003:
+  - add a return value for the fpga command
+  - add ide_preinit() function called in ide_init if CONFIG_IDE_PREINIT
+    is defined. If ide_preinit fails, ide_init is aborted.
+  - fix an endianess problem in fat.h
+
 * Patch by Wolter Kamphuis, 05 Dec 2003:
   Add support for SNMC's QS850/QS823/QS860T boards
 
diff --git a/Makefile b/Makefile
index cf5fe54..5defc87 100644
--- a/Makefile
+++ b/Makefile
@@ -80,19 +80,20 @@
 #########################################################################
 # U-Boot objects....order is important (i.e. start must be first)
 
-OBJS  =	cpu/$(CPU)/start.o
+OBJS  = cpu/$(CPU)/start.o
 ifeq ($(CPU),i386)
-OBJS +=	cpu/$(CPU)/start16.o
-OBJS +=	cpu/$(CPU)/reset.o
+OBJS += cpu/$(CPU)/start16.o
+OBJS += cpu/$(CPU)/reset.o
 endif
 ifeq ($(CPU),ppc4xx)
-OBJS +=	cpu/$(CPU)/resetvec.o
+OBJS += cpu/$(CPU)/resetvec.o
 endif
 ifeq ($(CPU),mpc85xx)
 OBJS += cpu/$(CPU)/resetvec.o
 endif
 
-LIBS  =	board/$(BOARDDIR)/lib$(BOARD).a
+LIBS  = lib_generic/libgeneric.a
+LIBS += board/$(BOARDDIR)/lib$(BOARD).a
 LIBS += cpu/$(CPU)/lib$(CPU).a
 LIBS += lib_$(ARCH)/lib$(ARCH).a
 LIBS += fs/jffs2/libjffs2.a fs/fdos/libfdos.a fs/fat/libfat.a
@@ -104,7 +105,7 @@
 LIBS += drivers/sk98lin/libsk98lin.a
 LIBS += post/libpost.a post/cpu/libcpu.a
 LIBS += common/libcommon.a
-LIBS += lib_generic/libgeneric.a
+.PHONY : $(LIBS)
 
 # Add GCC lib
 PLATFORM_LIBS += -L $(shell dirname `$(CC) $(CFLAGS) -print-libgcc-file-name`) -lgcc
@@ -150,7 +151,6 @@
 		$(MAKE) -C `dirname $@`
 
 $(SUBDIRS):
-		@echo "#### MAKE $@ ####"
 		$(MAKE) -C $@ all
 
 gdbtools:
diff --git a/board/trab/auto_update.c b/board/trab/auto_update.c
index af37495..36fdf18 100644
--- a/board/trab/auto_update.c
+++ b/board/trab/auto_update.c
@@ -468,7 +468,7 @@
 	 * check whether a storage device is attached (assume that it's
 	 * a USB memory stick, since nothing else should be attached).
 	 */
-	au_usb_stor_curr_dev = usb_stor_scan(1);
+	au_usb_stor_curr_dev = usb_stor_scan(0);
 	if (au_usb_stor_curr_dev == -1) {
 		debug ("No device found. Not initialized?\n");
 		return -1;
diff --git a/common/cmd_fpga.c b/common/cmd_fpga.c
index 8e180da..41ed459 100644
--- a/common/cmd_fpga.c
+++ b/common/cmd_fpga.c
@@ -70,6 +70,7 @@
     void *fpga_data = NULL;
     char *devstr = getenv("fpga");
     char *datastr = getenv("fpgadata");
+    int rc = FPGA_FAIL;
 
 	if ( devstr ) dev = (int)simple_strtoul( devstr, NULL, 16 );
 	if ( datastr ) fpga_data = (void *)simple_strtoul( datastr, NULL, 16 );
@@ -106,15 +107,15 @@
 		    break;
 
 	    case FPGA_INFO:
-		    fpga_info( dev );
+		    rc = fpga_info( dev );
 		    break;
 
 	    case FPGA_LOAD:
-			fpga_load( dev, fpga_data, data_size );
+                    rc = fpga_load( dev, fpga_data, data_size );
 		    break;
 
 	    case FPGA_DUMP:
-			fpga_dump( dev, fpga_data, data_size );
+                    rc = fpga_dump( dev, fpga_data, data_size );
 		    break;
 
 	    default:
@@ -122,7 +123,7 @@
 		    fpga_usage( cmdtp );
 		    break;
     }
-    return 0;
+    return (rc);
 }
 
 static void fpga_usage ( cmd_tbl_t *cmdtp )
diff --git a/common/cmd_ide.c b/common/cmd_ide.c
index 45f6368..3f18b00 100644
--- a/common/cmd_ide.c
+++ b/common/cmd_ide.c
@@ -486,6 +486,19 @@
 	unsigned int ata_reset_time;
 	char *s;
 #endif
+#ifdef CONFIG_IDE_8xx_PCCARD
+	extern int pcmcia_on (void);
+	extern int ide_devices_found; /* Initialized in check_ide_device() */
+#endif	/* CONFIG_IDE_8xx_PCCARD */
+
+#ifdef CONFIG_IDE_PREINIT
+	WATCHDOG_RESET();
+
+	if (ide_preinit ()) {
+		puts ("ide_preinit failed\n");
+		return;
+	}
+#endif	/* CONFIG_IDE_PREINIT */
 
 #ifdef CONFIG_IDE_8xx_PCCARD
 	extern int pcmcia_on (void);
@@ -756,12 +769,12 @@
 static void __inline__
 ide_outb(int dev, int port, unsigned char val)
 {
+	PRINTF ("ide_outb (dev= %d, port= %d, val= 0x%02x) : @ 0x%08lx\n",
+		dev, port, val, (ATA_CURR_BASE(dev)+port));
+    
 	/* Ensure I/O operations complete */
 	__asm__ volatile("eieio");
 	*((uchar *)(ATA_CURR_BASE(dev)+port)) = val;
-#if 0
-	printf ("ide_outb: 0x%08lx <== 0x%02x\n", ATA_CURR_BASE(dev)+port, val);
-#endif
 }
 #else	/* ! __PPC__ */
 static void __inline__
@@ -780,9 +793,8 @@
 	/* Ensure I/O operations complete */
 	__asm__ volatile("eieio");
 	val = *((uchar *)(ATA_CURR_BASE(dev)+port));
-#if 0
-	printf ("ide_inb: 0x%08lx ==> 0x%02x\n", ATA_CURR_BASE(dev)+port, val);
-#endif
+	PRINTF ("ide_inb (dev= %d, port= %d) : @ 0x%08lx -> 0x%02x\n",
+		dev, port, (ATA_CURR_BASE(dev)+port), val);
 	return (val);
 }
 #else	/* ! __PPC__ */
diff --git a/include/ata.h b/include/ata.h
index 968b3c4..fa30ee8 100644
--- a/include/ata.h
+++ b/include/ata.h
@@ -37,10 +37,13 @@
  * 8-bit (register) and 16-bit (data) accesses might use different
  * address spaces. This is implemented by the following definitions.
  */
+#ifndef CFG_ATA_STRIDE
+#define CFG_ATA_STRIDE	1
+#endif
 
-#define ATA_IO_DATA(x)	(CFG_ATA_DATA_OFFSET+(x))
-#define ATA_IO_REG(x)	(CFG_ATA_REG_OFFSET +(x))
-#define ATA_IO_ALT(x)	(CFG_ATA_ALT_OFFSET +(x))
+#define ATA_IO_DATA(x)	(CFG_ATA_DATA_OFFSET+((x) * CFG_ATA_STRIDE))
+#define ATA_IO_REG(x)	(CFG_ATA_REG_OFFSET +((x) * CFG_ATA_STRIDE))
+#define ATA_IO_ALT(x)	(CFG_ATA_ALT_OFFSET +((x) * CFG_ATA_STRIDE))
 
 /*
  * I/O Register Descriptions
diff --git a/include/fat.h b/include/fat.h
index 6f0f40f..3f9c5f3 100644
--- a/include/fat.h
+++ b/include/fat.h
@@ -89,7 +89,7 @@
 #define FAT2CPU16	le16_to_cpu
 #define FAT2CPU32	le32_to_cpu
 #else
-#if 1
+#if __LITTLE_ENDIAN
 #define FAT2CPU16(x)	(x)
 #define FAT2CPU32(x)	(x)
 #else