Merge commit 'wd/master'
diff --git a/.gitignore b/.gitignore
index cda275e..37f2c1d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -10,6 +10,7 @@
 *.orig
 *.a
 *.o
+*~
 
 #
 # Top-level generic files
diff --git a/Makefile b/Makefile
index 852dca8..3b339ad 100644
--- a/Makefile
+++ b/Makefile
@@ -312,13 +312,13 @@
 			--start-group $(__LIBS) --end-group $(PLATFORM_LIBS) \
 			-Map u-boot.map -o u-boot
 
-$(OBJS):	$(obj)include/autoconf.mk
+$(OBJS):	depend $(obj)include/autoconf.mk
 		$(MAKE) -C cpu/$(CPU) $(if $(REMOTE_BUILD),$@,$(notdir $@))
 
-$(LIBS):	$(obj)include/autoconf.mk
+$(LIBS):	depend $(obj)include/autoconf.mk
 		$(MAKE) -C $(dir $(subst $(obj),,$@))
 
-$(SUBDIRS):	$(obj)include/autoconf.mk
+$(SUBDIRS):	depend $(obj)include/autoconf.mk
 		$(MAKE) -C $@ all
 
 $(NAND_SPL):	$(VERSION_FILE)	$(obj)include/autoconf.mk
diff --git a/api/api_storage.c b/api/api_storage.c
index 7cd4efb..7e63240 100644
--- a/api/api_storage.c
+++ b/api/api_storage.c
@@ -61,21 +61,21 @@
 
 void dev_stor_init(void)
 {
-#if (CONFIG_COMMANDS & CFG_CMD_IDE)
+#if defined(CONFIG_CMD_IDE)
 	specs[ENUM_IDE].max_dev = CFG_IDE_MAXDEVICE;
 	specs[ENUM_IDE].enum_started = 0;
 	specs[ENUM_IDE].enum_ended = 0;
 	specs[ENUM_IDE].type = DEV_TYP_STOR | DT_STOR_IDE;
 	specs[ENUM_IDE].name = "ide";
 #endif
-#if (CONFIG_COMMANDS & CFG_CMD_USB)
+#if defined(CONFIG_CMD_USB)
 	specs[ENUM_USB].max_dev = USB_MAX_STOR_DEV;
 	specs[ENUM_USB].enum_started = 0;
 	specs[ENUM_USB].enum_ended = 0;
 	specs[ENUM_USB].type = DEV_TYP_STOR | DT_STOR_USB;
 	specs[ENUM_USB].name = "usb";
 #endif
-#if (CONFIG_COMMANDS & CFG_CMD_SCSI)
+#if defined(CONFIG_CMD_SCSI)
 	specs[ENUM_SCSI].max_dev = CFG_SCSI_MAX_DEVICE;
 	specs[ENUM_SCSI].enum_started = 0;
 	specs[ENUM_SCSI].enum_ended = 0;
diff --git a/board/BuS/EB+MCF-EV123/mii.c b/board/BuS/EB+MCF-EV123/mii.c
index ebd3ed9..3ea20a6 100644
--- a/board/BuS/EB+MCF-EV123/mii.c
+++ b/board/BuS/EB+MCF-EV123/mii.c
@@ -132,7 +132,7 @@
 
 	return (mii_reply & 0xffff);	/* data read from phy */
 }
-#endif				/* CFG_DISCOVER_PHY || (CONFIG_COMMANDS & CONFIG_CMD_MII) */
+#endif				/* CFG_DISCOVER_PHY || CONFIG_CMD_MII */
 
 #if defined(CFG_DISCOVER_PHY)
 int mii_discover_phy(struct eth_device *dev)
diff --git a/board/cobra5272/mii.c b/board/cobra5272/mii.c
index fadcbb3..d0a4a39 100644
--- a/board/cobra5272/mii.c
+++ b/board/cobra5272/mii.c
@@ -131,7 +131,7 @@
 
 	return (mii_reply & 0xffff);	/* data read from phy */
 }
-#endif				/* CFG_DISCOVER_PHY || (CONFIG_COMMANDS & CONFIG_CMD_MII) */
+#endif				/* CFG_DISCOVER_PHY || CONFIG_CMD_MII */
 
 #if defined(CFG_DISCOVER_PHY)
 int mii_discover_phy(struct eth_device *dev)
diff --git a/board/idmr/mii.c b/board/idmr/mii.c
index f6c63c3..f130e6e 100644
--- a/board/idmr/mii.c
+++ b/board/idmr/mii.c
@@ -131,7 +131,7 @@
 
 	return (mii_reply & 0xffff);	/* data read from phy */
 }
-#endif				/* CFG_DISCOVER_PHY || (CONFIG_COMMANDS & CONFIG_CMD_MII) */
+#endif				/* CFG_DISCOVER_PHY || CONFIG_CMD_MII */
 
 #if defined(CFG_DISCOVER_PHY)
 int mii_discover_phy(struct eth_device *dev)
diff --git a/board/m5271evb/mii.c b/board/m5271evb/mii.c
index 3830ce7..78a7028 100644
--- a/board/m5271evb/mii.c
+++ b/board/m5271evb/mii.c
@@ -131,7 +131,7 @@
 
 	return (mii_reply & 0xffff);	/* data read from phy */
 }
-#endif				/* CFG_DISCOVER_PHY || (CONFIG_COMMANDS & CONFIG_CMD_MII) */
+#endif				/* CFG_DISCOVER_PHY || CONFIG_CMD_MII */
 
 #if defined(CFG_DISCOVER_PHY)
 int mii_discover_phy(struct eth_device *dev)
diff --git a/board/m5272c3/mii.c b/board/m5272c3/mii.c
index 0ecc44a..b30ba80 100644
--- a/board/m5272c3/mii.c
+++ b/board/m5272c3/mii.c
@@ -131,7 +131,7 @@
 
 	return (mii_reply & 0xffff);	/* data read from phy */
 }
-#endif				/* CFG_DISCOVER_PHY || (CONFIG_COMMANDS & CONFIG_CMD_MII) */
+#endif				/* CFG_DISCOVER_PHY || CONFIG_CMD_MII */
 
 #if defined(CFG_DISCOVER_PHY)
 int mii_discover_phy(struct eth_device *dev)
diff --git a/board/m5282evb/mii.c b/board/m5282evb/mii.c
index d7c6d1f..8ae2ec6 100644
--- a/board/m5282evb/mii.c
+++ b/board/m5282evb/mii.c
@@ -132,7 +132,7 @@
 
 	return (mii_reply & 0xffff);	/* data read from phy */
 }
-#endif				/* CFG_DISCOVER_PHY || (CONFIG_COMMANDS & CONFIG_CMD_MII) */
+#endif				/* CFG_DISCOVER_PHY || CONFIG_CMD_MII */
 
 #if defined(CFG_DISCOVER_PHY)
 int mii_discover_phy(struct eth_device *dev)
diff --git a/common/fdt_support.c b/common/fdt_support.c
index 92f1c7f..69eb667 100644
--- a/common/fdt_support.c
+++ b/common/fdt_support.c
@@ -415,7 +415,7 @@
 {
 #if defined(DEBUG)
 	int i;
-	debug("Updating property '%s/%s' = ", node, prop);
+	debug("Updating property '%s/%s' = ", path, prop);
 	for (i = 0; i < len; i++)
 		debug(" %.2x", *(u8*)(val+i));
 	debug("\n");
@@ -441,7 +441,7 @@
 	int off;
 #if defined(DEBUG)
 	int i;
-	debug("Updating property '%s/%s' = ", node, prop);
+	debug("Updating property '%s' = ", prop);
 	for (i = 0; i < len; i++)
 		debug(" %.2x", *(u8*)(val+i));
 	debug("\n");
@@ -468,7 +468,7 @@
 	int off = -1;
 #if defined(DEBUG)
 	int i;
-	debug("Updating property '%s/%s' = ", node, prop);
+	debug("Updating property '%s' = ", prop);
 	for (i = 0; i < len; i++)
 		debug(" %.2x", *(u8*)(val+i));
 	debug("\n");
diff --git a/config.mk b/config.mk
index 79e5a31..bff95bd 100644
--- a/config.mk
+++ b/config.mk
@@ -147,7 +147,10 @@
 gccincdir := $(shell $(CC) -print-file-name=include)
 
 CPPFLAGS := $(DBGFLAGS) $(OPTFLAGS) $(RELFLAGS)		\
-	-D__KERNEL__ -DTEXT_BASE=$(TEXT_BASE)		\
+	-D__KERNEL__
+ifneq ($(TEXT_BASE),)
+CPPFLAGS += -DTEXT_BASE=$(TEXT_BASE)
+endif
 
 ifneq ($(OBJTREE),$(SRCTREE))
 CPPFLAGS += -I$(OBJTREE)/include2 -I$(OBJTREE)/include
@@ -185,7 +188,10 @@
 
 AFLAGS := $(AFLAGS_DEBUG) -D__ASSEMBLY__ $(CPPFLAGS)
 
-LDFLAGS += -Bstatic -T $(LDSCRIPT) -Ttext $(TEXT_BASE) $(PLATFORM_LDFLAGS)
+LDFLAGS += -Bstatic -T $(LDSCRIPT) $(PLATFORM_LDFLAGS)
+ifneq ($(TEXT_BASE),)
+LDFLAGS += -Ttext $(TEXT_BASE)
+endif
 
 # Location of a usable BFD library, where we define "usable" as
 # "built for ${HOST}, supports ${TARGET}".  Sensible values are
diff --git a/cpu/arm926ejs/cpuinfo.c b/cpu/arm926ejs/cpuinfo.c
index 8c98631..35ba7db 100644
--- a/cpu/arm926ejs/cpuinfo.c
+++ b/cpu/arm926ejs/cpuinfo.c
@@ -18,8 +18,6 @@
 #define omap_readw(x)		*(volatile unsigned short *)(x)
 #define omap_readl(x)		*(volatile unsigned long *)(x)
 
-#define ARRAY_SIZE(x)		(sizeof(x) / sizeof((x)[0]))
-
 #define OMAP_DIE_ID_0		0xfffe1800
 #define OMAP_DIE_ID_1		0xfffe1804
 #define OMAP_PRODUCTION_ID_0	0xfffe2000
diff --git a/drivers/mtd/dataflash.c b/drivers/mtd/dataflash.c
index 91903c8..3ebb706 100644
--- a/drivers/mtd/dataflash.c
+++ b/drivers/mtd/dataflash.c
@@ -304,7 +304,7 @@
 
 	for (i = 0; i < CFG_MAX_DATAFLASH_BANKS; i++)
 		if ( dataflash_info[i].id
-			&& ((((int) addr) & 0xFF000000) ==
+			&& ((((int) *addr) & 0xFF000000) ==
 			dataflash_info[i].logical_address)) {
 			addr_valid = 1;
 			break;
diff --git a/drivers/mtd/jedec_flash.c b/drivers/mtd/jedec_flash.c
index 94e87cb..41aad3b 100644
--- a/drivers/mtd/jedec_flash.c
+++ b/drivers/mtd/jedec_flash.c
@@ -218,10 +218,6 @@
 #endif
 };
 
-
-#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
-
-
 static inline void fill_info(flash_info_t *info, const struct amd_flash_info *jedec_entry, ulong base)
 {
 	int i,j;
diff --git a/drivers/net/cs8900.c b/drivers/net/cs8900.c
index 80c4ba2..55ef346 100644
--- a/drivers/net/cs8900.c
+++ b/drivers/net/cs8900.c
@@ -165,7 +165,7 @@
 				 addr[0], addr[1],
 				 addr[2], addr[3],
 				 addr[4], addr[5]) ;
-			debug ("### Set environment from HW MAC addr = \"%s\"\n",				ethaddr);
+			debug ("### Set environment from HW MAC addr = \"%s\"\n", ethaddr);
 			setenv ("ethaddr", ethaddr);
 		}
 
@@ -317,6 +317,6 @@
 	return 0;
 }
 
-#endif	/* COMMANDS & CFG_NET */
+#endif	/* CONFIG_CMD_NET */
 
 #endif	/* CONFIG_DRIVER_CS8900 */
diff --git a/drivers/net/lan91c96.c b/drivers/net/lan91c96.c
index ecdcbd9..51cfb7e 100644
--- a/drivers/net/lan91c96.c
+++ b/drivers/net/lan91c96.c
@@ -36,12 +36,12 @@
  *   AUI/TP selection  ( mine has 10Base2/10BaseT select )
  *
  * Arguments:
- * 	io	= for the base address
+ *	io	= for the base address
  *	irq	= for the IRQ
  *
  * author:
- * 	Erik Stahlman				( erik@vt.edu )
- * 	Daris A Nevil				( dnevil@snmc.com )
+ *	Erik Stahlman				( erik@vt.edu )
+ *	Daris A Nevil				( dnevil@snmc.com )
  *
  *
  * Hardware multicast code from Peter Cammaert ( pc@denkart.be )
@@ -53,7 +53,7 @@
  *    o   lan91c96.c (Intel Diagnostic Manager driver)
  *
  * History:
- * 	04/30/03  Mathijs Haarman	Modified smc91111.c (u-boot version)
+ *	04/30/03  Mathijs Haarman	Modified smc91111.c (u-boot version)
  *					for lan91c96
  *---------------------------------------------------------------------------
  */
@@ -296,8 +296,8 @@
 /*
  * Function: smc_reset( void )
  * Purpose:
- *  	This sets the SMC91111 chip to its normal state, hopefully from whatever
- * 	mess that any other DOS driver has put it in.
+ *	This sets the SMC91111 chip to its normal state, hopefully from whatever
+ *	mess that any other DOS driver has put it in.
  *
  * Maybe I should reset more registers to defaults in here?  SOFTRST  should
  * do that for me.
@@ -397,7 +397,7 @@
  *	This sends the actual packet to the SMC9xxx chip.
  *
  * Algorithm:
- * 	First, see if a saved_skb is available.
+ *	First, see if a saved_skb is available.
  *		( this should NOT be called if there is no 'saved_skb'
  *	Now, find the packet number that the chip allocated
  *	Point the data pointers at it in memory
@@ -405,9 +405,9 @@
  *	Dump the packet to chip memory
  *	Check if a last byte is needed ( odd length packet )
  *		if so, set the control flag right
- * 	Tell the card to send it
+ *	Tell the card to send it
  *	Enable the transmit interrupt, so I know if it failed
- * 	Free the kernel data if I actually sent it.
+ *	Free the kernel data if I actually sent it.
  */
 static int smc_send_packet (volatile void *packet, int packet_length)
 {
@@ -865,7 +865,7 @@
 }
 #endif /* 0 */
 
-#endif /* COMMANDS & CFG_NET */
+#endif /* CONFIG_CMD_NET */
 
 
 /* smc_get_ethaddr (bd_t * bd)
diff --git a/drivers/net/netarm_eth.c b/drivers/net/netarm_eth.c
index a99ee5d..ecf45dc 100644
--- a/drivers/net/netarm_eth.c
+++ b/drivers/net/netarm_eth.c
@@ -29,7 +29,6 @@
 #include "netarm_eth.h"
 #include <asm/arch/netarm_registers.h>
 
-
 #if defined(CONFIG_CMD_NET)
 
 static int na_mii_poll_busy (void);
@@ -56,7 +55,6 @@
 	setenv ("ethaddr", ethaddr);
 }
 
-
 static void na_mii_write (int reg, int value)
 {
 	int mii_addr;
@@ -355,6 +353,6 @@
 	return 1;
 }
 
-#endif /* COMMANDS & CFG_NET */
+#endif /* CONFIG_CMD_NET */
 
 #endif /* CONFIG_DRIVER_NETARMETH */
diff --git a/drivers/net/rtl8019.c b/drivers/net/rtl8019.c
index 409a69f..9d62cab 100644
--- a/drivers/net/rtl8019.c
+++ b/drivers/net/rtl8019.c
@@ -36,16 +36,13 @@
 
 #if defined(CONFIG_CMD_NET)
 
-
 /* packet page register access functions */
 
-
 static unsigned char get_reg (unsigned int regno)
 {
 	return (*(unsigned char *) regno);
 }
 
-
 static void put_reg (unsigned int regno, unsigned char val)
 {
 	*(volatile unsigned char *) regno = val;
@@ -91,7 +88,6 @@
 	put_reg (RTL8019_COMMAND, RTL8019_PAGE0);
 }
 
-
 void eth_halt (void)
 {
 	put_reg (RTL8019_COMMAND, 0x01);
@@ -134,7 +130,6 @@
 	return 0;
 }
 
-
 static unsigned char nic_to_pc (void)
 {
 	unsigned char rec_head_status;
@@ -277,6 +272,6 @@
 	return 0;
 }
 
-#endif /* COMMANDS & CFG_NET */
+#endif /* CONFIG_CMD_NET */
 
 #endif /* CONFIG_DRIVER_RTL8019 */
diff --git a/drivers/net/rtl8169.c b/drivers/net/rtl8169.c
index 57ccbd9..d71323f 100644
--- a/drivers/net/rtl8169.c
+++ b/drivers/net/rtl8169.c
@@ -352,8 +352,6 @@
 	return value;
 }
 
-#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
-
 static int rtl8169_init_board(struct eth_device *dev)
 {
 	int i;
diff --git a/drivers/rtc/rx8025.c b/drivers/rtc/rx8025.c
index 6c94ae1..9122f12 100644
--- a/drivers/rtc/rx8025.c
+++ b/drivers/rtc/rx8025.c
@@ -142,7 +142,6 @@
 		tmp->tm_hour, tmp->tm_min, tmp->tm_sec);
 }
 
-
 /*
  * Set the RTC
  */
@@ -166,7 +165,6 @@
 	rtc_write (RTC_CTL1_REG_ADDR, RTC_CTL1_BIT_2412);
 }
 
-
 /*
  * Reset the RTC. We setting the date back to 1970-01-01.
  */
@@ -200,7 +198,6 @@
 	return;
 }
 
-
 /*
  * Helper functions
  */
@@ -224,4 +221,4 @@
 	return (((n / 10) << 4) | (n % 10));
 }
 
-#endif /* CONFIG_RTC_RX8025 && (CFG_COMMANDS & CFG_CMD_DATE) */
+#endif /* CONFIG_RTC_RX8025 && CONFIG_CMD_DATE */
diff --git a/include/common.h b/include/common.h
index c4ee3e2..13428b3 100644
--- a/include/common.h
+++ b/include/common.h
@@ -203,8 +203,8 @@
 void	reset_cmd_timeout(void);
 
 /* lib_$(ARCH)/board.c */
-void	board_init_f  (ulong);
-void	board_init_r  (gd_t *, ulong);
+void	board_init_f  (ulong) __attribute__ ((noreturn));
+void	board_init_r  (gd_t *, ulong) __attribute__ ((noreturn));
 int	checkboard    (void);
 int	checkflash    (void);
 int	checkdram     (void);
@@ -665,4 +665,6 @@
 #error Read section CONFIG_SKIP_LOWLEVEL_INIT in README.
 #endif
 
+#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
+
 #endif	/* __COMMON_H_ */
diff --git a/include/configs/munices.h b/include/configs/munices.h
index 2372b57..38b27bb 100644
--- a/include/configs/munices.h
+++ b/include/configs/munices.h
@@ -48,7 +48,7 @@
 #define CONFIG_CMD_PING
 #define CONFIG_CMD_REGINFO
 
-#if (CONFIG_COMMANDS & CFG_CMD_KGDB)
+#if defined(CONFIG_CMD_KGDB)
 #  define CFG_CACHELINE_SHIFT	5	/* log base 2 of the above value */
 #endif
 
diff --git a/include/configs/trizepsiv.h b/include/configs/trizepsiv.h
index 84998d4..7a15d97 100644
--- a/include/configs/trizepsiv.h
+++ b/include/configs/trizepsiv.h
@@ -140,7 +140,7 @@
 #define CONFIG_CMDLINE_TAG	 1	/* enable passing of ATAGs	*/
 /* #define CONFIG_INITRD_TAG	 1 */
 
-#if (CONFIG_COMMANDS & CFG_CMD_KGDB)
+#if defined(CONFIG_CMD_KGDB)
 #define CONFIG_KGDB_BAUDRATE	230400		/* speed to run kgdb serial port */
 #define CONFIG_KGDB_SER_INDEX	2		/* which serial port to use */
 #endif
diff --git a/net/nfs.c b/net/nfs.c
index aa8d612..6573c17 100644
--- a/net/nfs.c
+++ b/net/nfs.c
@@ -34,7 +34,8 @@
 #if defined(CONFIG_CMD_NET) && defined(CONFIG_CMD_NFS)
 
 #define HASHES_PER_LINE 65	/* Number of "loading" hashes per line	*/
-#define NFS_TIMEOUT 60UL
+#define NFS_RETRY_COUNT 30
+#define NFS_TIMEOUT 2UL
 
 static int fs_mounted = 0;
 static unsigned long rpc_id = 0;
@@ -586,6 +587,10 @@
 static void
 NfsTimeout (void)
 {
+	if ( NfsTimeoutCount++ < NFS_RETRY_COUNT ) {
+		NfsSend ();
+		return;
+	}
 	puts ("Timeout\n");
 	NetState = NETLOOP_FAIL;
 	return;