Merge branch 'master' of git://www.denx.de/git/u-boot into new-image
diff --git a/Makefile b/Makefile
index adfef9b..c56518f 100644
--- a/Makefile
+++ b/Makefile
@@ -12,7 +12,7 @@
 #
 # This program is distributed in the hope that it will be useful,
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	See the
 # GNU General Public License for more details.
 #
 # You should have received a copy of the GNU General Public License
@@ -24,7 +24,7 @@
 VERSION = 1
 PATCHLEVEL = 3
 SUBLEVEL = 2
-EXTRAVERSION = -rc2
+EXTRAVERSION =
 U_BOOT_VERSION = $(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
 VERSION_FILE = $(obj)include/version_autogenerated.h
 
@@ -118,6 +118,9 @@
 endif
 export obj src
 
+# Make sure CDPATH settings don't interfere
+unexport CDPATH
+
 #########################################################################
 
 ifeq ($(obj)include/config.mk,$(wildcard $(obj)include/config.mk))
@@ -400,6 +403,10 @@
 etags:
 		etags -a -o $(obj)etags `find $(SUBDIRS) $(TAG_SUBDIRS) \
 						-name '*.[ch]' -print`
+cscope:
+		find $(SUBDIRS) $(TAG_SUBDIRS) -name '*.[ch]' -print \
+						> cscope.files
+		cscope -b -q -k
 
 $(obj)System.map:	$(obj)u-boot
 		@$(NM) $< | \
@@ -427,7 +434,7 @@
 all $(obj)u-boot.hex $(obj)u-boot.srec $(obj)u-boot.bin \
 $(obj)u-boot.img $(obj)u-boot.dis $(obj)u-boot \
 $(SUBDIRS) $(VERSION_FILE) gdbtools updater env depend \
-dep tags ctags etags $(obj)System.map:
+dep tags ctags etags cscope $(obj)System.map:
 	@echo "System not configured - see README" >&2
 	@ exit 1
 endif	# config.mk
@@ -489,7 +496,6 @@
 icecube_5100_config:			unconfig
 	@mkdir -p $(obj)include
 	@mkdir -p $(obj)board/icecube
-	@ >$(obj)include/config.h
 	@[ -z "$(findstring LOWBOOT_,$@)" ] || \
 		{ if [ "$(findstring DDR,$@)" ] ; \
 			then echo "TEXT_BASE = 0xFF800000" >$(obj)board/icecube/config.tmp ; \
@@ -530,7 +536,6 @@
 lite5200b_LOWBOOT_config:	unconfig
 	@mkdir -p $(obj)include
 	@mkdir -p $(obj)board/icecube
-	@ >$(obj)include/config.h
 	@ echo "#define CONFIG_MPC5200_DDR"	>>$(obj)include/config.h
 	@ $(XECHO) "... DDR memory revision"
 	@ echo "#define CONFIG_MPC5200"		>>$(obj)include/config.h
@@ -560,7 +565,6 @@
 prs200_highboot_DDR_config:	unconfig
 	@mkdir -p $(obj)include
 	@mkdir -p $(obj)board/mcc200
-	@ >$(obj)include/config.h
 	@[ -n "$(findstring highboot,$@)" ] || \
 		{ $(XECHO) "... with lowboot configuration" ; \
 		}
@@ -591,7 +595,7 @@
 		  $(XECHO) "... with console on COM12" ; \
 		}
 	@[ -z "$(findstring prs200,$@)" ] || \
-		{ echo "#define CONFIG_PRS200"  >>$(obj)include/config.h ;\
+		{ echo "#define CONFIG_PRS200"	>>$(obj)include/config.h ;\
 		}
 	@$(MKCONFIG) -n $@ -a mcc200 ppc mpc5xxx mcc200
 
@@ -601,10 +605,10 @@
 munices_config:	unconfig
 	@$(MKCONFIG) munices ppc mpc5xxx munices
 
-o2dnt_config:
+o2dnt_config:	unconfig
 	@$(MKCONFIG) o2dnt ppc mpc5xxx o2dnt
 
-pf5200_config:  unconfig
+pf5200_config:	unconfig
 	@$(MKCONFIG) pf5200  ppc mpc5xxx pf5200 esd
 
 PM520_config \
@@ -612,7 +616,6 @@
 PM520_ROMBOOT_config \
 PM520_ROMBOOT_DDR_config:	unconfig
 	@mkdir -p $(obj)include
-	@ >$(obj)include/config.h
 	@[ -z "$(findstring DDR,$@)" ] || \
 		{ echo "#define CONFIG_MPC5200_DDR"	>>$(obj)include/config.h ; \
 		  $(XECHO) "... DDR memory revision" ; \
@@ -627,7 +630,7 @@
 	@$(MKCONFIG) -a smmaco4 ppc mpc5xxx tqm5200
 
 cm5200_config:	unconfig
-	@./mkconfig -a cm5200 ppc mpc5xxx cm5200
+	@$(MKCONFIG) -a cm5200 ppc mpc5xxx cm5200
 
 spieval_config:	unconfig
 	@$(MKCONFIG) -a spieval ppc mpc5xxx tqm5200
@@ -655,7 +658,6 @@
 Total5200_Rev2_lowboot_config:	unconfig
 	@mkdir -p $(obj)include
 	@mkdir -p $(obj)board/total5200
-	@ >$(obj)include/config.h
 	@[ -z "$(findstring 5100,$@)" ] || \
 		{ echo "#define CONFIG_MGT5100"		>>$(obj)include/config.h ; \
 		  $(XECHO) "... with MGT5100 processor" ; \
@@ -690,7 +692,6 @@
 TQM5200_STK100_config:	unconfig
 	@mkdir -p $(obj)include
 	@mkdir -p $(obj)board/tqm5200
-	@ >$(obj)include/config.h
 	@[ -z "$(findstring cam5200,$@)" ] || \
 		{ echo "#define CONFIG_CAM5200"	>>$(obj)include/config.h ; \
 		  echo "#define CONFIG_TQM5200S"	>>$(obj)include/config.h ; \
@@ -733,17 +734,24 @@
 #########################################################################
 ## MPC512x Systems
 #########################################################################
-ads5121_config: unconfig
-	@$(MKCONFIG) ads5121 ppc mpc512x ads5121
+ads5121_config \
+ads5121_PCI_config \
+	:		 unconfig
+	@mkdir -p $(obj)include
+	@if [ "$(findstring _PCI_,$@)" ] ; then \
+		echo "#define CONFIG_PCI"  >>$(obj)include/config.h ; \
+		$(XECHO) "... with PCI enabled" ; \
+	fi
+	@$(MKCONFIG) -a ads5121 ppc mpc512x ads5121
 
 
 #########################################################################
 ## MPC8xx Systems
 #########################################################################
 
-Adder_config    \
+Adder_config	\
 Adder87x_config \
-AdderII_config  \
+AdderII_config	\
 	:		unconfig
 	@mkdir -p $(obj)include
 	$(if $(findstring AdderII,$@), \
@@ -751,10 +759,10 @@
 	@$(MKCONFIG) -a Adder ppc mpc8xx adder
 
 AdderUSB_config:	unconfig
-	@./mkconfig -a AdderUSB ppc mpc8xx adder
+	@$(MKCONFIG) -a AdderUSB ppc mpc8xx adder
 
-ADS860_config     \
-FADS823_config    \
+ADS860_config	  \
+FADS823_config	  \
 FADS850SAR_config \
 MPC86xADS_config  \
 MPC885ADS_config  \
@@ -793,7 +801,6 @@
 GEN860T_SC_config	\
 GEN860T_config: unconfig
 	@mkdir -p $(obj)include
-	@ >$(obj)include/config.h
 	@[ -z "$(findstring _SC,$@)" ] || \
 		{ echo "#define CONFIG_SC" >>$(obj)include/config.h ; \
 		  $(XECHO) "With reduced H/W feature set (SC)..." ; \
@@ -820,7 +827,6 @@
 ICU862_100MHz_config	\
 ICU862_config: unconfig
 	@mkdir -p $(obj)include
-	@ >$(obj)include/config.h
 	@[ -z "$(findstring _100MHz,$@)" ] || \
 		{ echo "#define CONFIG_100MHz"	>>$(obj)include/config.h ; \
 		  $(XECHO) "... with 100MHz system clock" ; \
@@ -834,7 +840,6 @@
 IVML24_128_config \
 IVML24_config:	unconfig
 	@mkdir -p $(obj)include
-	@ >$(obj)include/config.h
 	@[ -z "$(findstring IVML24_config,$@)" ] || \
 		 { echo "#define CONFIG_IVML24_16M"	>>$(obj)include/config.h ; \
 		 }
@@ -850,7 +855,6 @@
 IVMS8_128_config \
 IVMS8_config:	unconfig
 	@mkdir -p $(obj)include
-	@ >$(obj)include/config.h
 	@[ -z "$(findstring IVMS8_config,$@)" ] || \
 		 { echo "#define CONFIG_IVMS8_16M"	>>$(obj)include/config.h ; \
 		 }
@@ -865,7 +869,7 @@
 KUP4K_config	:	unconfig
 	@$(MKCONFIG) $(@:_config=) ppc mpc8xx kup4k kup
 
-KUP4X_config    :       unconfig
+KUP4X_config	:	unconfig
 	@$(MKCONFIG) $(@:_config=) ppc mpc8xx kup4x kup
 
 LANTEC_config	:	unconfig
@@ -892,7 +896,6 @@
 NETVIA_V2_config \
 NETVIA_config:		unconfig
 	@mkdir -p $(obj)include
-	@ >$(obj)include/config.h
 	@[ -z "$(findstring NETVIA_config,$@)" ] || \
 		 { echo "#define CONFIG_NETVIA_VERSION 1" >>$(obj)include/config.h ; \
 		  $(XECHO) "... Version 1" ; \
@@ -908,7 +911,6 @@
 NETPHONE_V2_config \
 NETPHONE_config:	unconfig
 	@mkdir -p $(obj)include
-	@ >$(obj)include/config.h
 	@[ -z "$(findstring NETPHONE_config,$@)" ] || \
 		 { echo "#define CONFIG_NETPHONE_VERSION 1" >>$(obj)include/config.h ; \
 		 }
@@ -928,7 +930,6 @@
 NETTA_6412_config \
 NETTA_config:		unconfig
 	@mkdir -p $(obj)include
-	@ >$(obj)include/config.h
 	@[ -z "$(findstring ISDN_,$@)" ] || \
 		 { echo "#define CONFIG_NETTA_ISDN 1" >>$(obj)include/config.h ; \
 		 }
@@ -954,7 +955,6 @@
 NETTA2_V2_config \
 NETTA2_config:		unconfig
 	@mkdir -p $(obj)include
-	@ >$(obj)include/config.h
 	@[ -z "$(findstring NETTA2_config,$@)" ] || \
 		 { echo "#define CONFIG_NETTA2_VERSION 1" >>$(obj)include/config.h ; \
 		 }
@@ -967,7 +967,6 @@
 NC650_Rev2_config \
 CP850_config:	unconfig
 	@mkdir -p $(obj)include
-	@ >$(obj)include/config.h
 	@[ -z "$(findstring CP850,$@)" ] || \
 		 { echo "#define CONFIG_CP850 1" >>$(obj)include/config.h ; \
 		   echo "#define CONFIG_IDS852_REV2 1" >>$(obj)include/config.h ; \
@@ -1014,12 +1013,11 @@
 RPXlite_DW_LCD_config		\
 RPXlite_DW_64_LCD_config	\
 RPXlite_DW_NVRAM_config		\
-RPXlite_DW_NVRAM_64_config      \
+RPXlite_DW_NVRAM_64_config	\
 RPXlite_DW_NVRAM_LCD_config	\
-RPXlite_DW_NVRAM_64_LCD_config  \
+RPXlite_DW_NVRAM_64_LCD_config	\
 RPXlite_DW_config:	unconfig
 	@mkdir -p $(obj)include
-	@ >$(obj)include/config.h
 	@[ -z "$(findstring _64,$@)" ] || \
 		{ echo "#define RPXlite_64MHz"		>>$(obj)include/config.h ; \
 		  $(XECHO) "... with 64MHz system clock ..."; \
@@ -1050,7 +1048,7 @@
 SM850_config	:	unconfig
 	@$(MKCONFIG) $(@:_config=) ppc mpc8xx tqm8xx
 
-spc1920_config:
+spc1920_config:		unconfig
 	@$(MKCONFIG) $(@:_config=) ppc mpc8xx spc1920
 
 SPD823TS_config:	unconfig
@@ -1093,7 +1091,6 @@
 TK885D_config		\
 virtlab2_config:	unconfig
 	@mkdir -p $(obj)include
-	@ >$(obj)include/config.h
 	@[ -z "$(findstring _LCD,$@)" ] || \
 		{ echo "#define CONFIG_LCD"		>>$(obj)include/config.h ; \
 		  echo "#define CONFIG_NEC_NL6448BC20"	>>$(obj)include/config.h ; \
@@ -1338,7 +1335,6 @@
 PPChameleonEVB_ME_33_config	\
 PPChameleonEVB_HI_33_config:	unconfig
 	@mkdir -p $(obj)include
-	@ >$(obj)include/config.h
 	@[ -z "$(findstring EVB_BA,$@)" ] || \
 		{ echo "#define CONFIG_PPCHAMELEON_MODULE_MODEL 0" >>$(obj)include/config.h ; \
 		  $(XECHO) "... BASIC model" ; \
@@ -1660,8 +1656,6 @@
 	@if [ "$(findstring _PCI_,$@)" ] ; then \
 		echo "#define CONFIG_PCI"  >>$(obj)include/config.h ; \
 		$(XECHO) "... with PCI enabled" ; \
-	else \
-		>$(obj)include/config.h ; \
 	fi
 	@if [ "$(findstring _ROMBOOT_,$@)" ] ; then \
 		$(XECHO) "... booting from 8-bit flash" ; \
@@ -1720,7 +1714,6 @@
 	TQM8260_AI_config) CTYPE=MPC8260; CFREQ=300; CACHE=no;	BMODE=60x;;  \
 	TQM8265_AA_config) CTYPE=MPC8265; CFREQ=300; CACHE=no;	BMODE=60x;;  \
 	esac; \
-	>$(obj)include/config.h ; \
 	if [ "$${CTYPE}" != "MPC8260" ] ; then \
 		echo "#define CONFIG_$${CTYPE}"	>>$(obj)include/config.h ; \
 	fi; \
@@ -1743,7 +1736,7 @@
 	@$(MKCONFIG) -a TQM8260 ppc mpc8260 tqm8260
 
 TQM8272_config: unconfig
-	@$(MKCONFIG) -a TQM8272 ppc mpc8260 tqm8272
+	@$(MKCONFIG) TQM8272 ppc mpc8260 tqm8272
 
 VoVPN-GW_66MHz_config	\
 VoVPN-GW_100MHz_config:		unconfig
@@ -1769,7 +1762,6 @@
 	M5235EVB_Flash16_config)	FLASH=16;; \
 	M5235EVB_Flash32_config)	FLASH=32;; \
 	esac; \
-	>$(obj)include/config.h ; \
 	if [ "$${FLASH}" != "16" ] ; then \
 		echo "#define NORFLASH_PS32BIT	1" >> $(obj)include/config.h ; \
 		echo "TEXT_BASE = 0xFFC00000" > $(obj)board/freescale/m5235evb/config.tmp ; \
@@ -1792,14 +1784,12 @@
 EB+MCF-EV123_config :		unconfig
 	@mkdir -p $(obj)include
 	@mkdir -p $(obj)board/BuS/EB+MCF-EV123
-	@ >$(obj)include/config.h
 	@echo "TEXT_BASE = 0xFFE00000"|tee $(obj)board/BuS/EB+MCF-EV123/textbase.mk
 	@$(MKCONFIG) EB+MCF-EV123 m68k mcf52x2 EB+MCF-EV123 BuS
 
 EB+MCF-EV123_internal_config :	unconfig
 	@mkdir -p $(obj)include
 	@mkdir -p $(obj)board/BuS/EB+MCF-EV123
-	@ >$(obj)include/config.h
 	@echo "TEXT_BASE = 0xF0000000"|tee $(obj)board/BuS/EB+MCF-EV123/textbase.mk
 	@$(MKCONFIG) EB+MCF-EV123 m68k mcf52x2 EB+MCF-EV123 BuS
 
@@ -1827,7 +1817,6 @@
 	M5329AFEE_config)	NAND=0;; \
 	M5329BFEE_config)	NAND=16;; \
 	esac; \
-	>$(obj)include/config.h ; \
 	if [ "$${NAND}" != "0" ] ; then \
 		echo "#define NANDFLASH_SIZE	$${NAND}" > $(obj)include/config.h ; \
 	fi
@@ -1837,7 +1826,6 @@
 	@case "$@" in \
 	M5373EVB_config)	NAND=16;; \
 	esac; \
-	>include/config.h ; \
 	if [ "$${NAND}" != "0" ] ; then \
 		echo "#define NANDFLASH_SIZE	$${NAND}" > $(obj)include/config.h ; \
 	fi
@@ -1859,7 +1847,6 @@
 	M54455EVB_i33_config)		FLASH=INTEL; FREQ=33333333;; \
 	M54455EVB_i66_config)		FLASH=INTEL; FREQ=66666666;; \
 	esac; \
-	>$(obj)include/config.h ; \
 	if [ "$${FLASH}" = "INTEL" ] ; then \
 		echo "#undef CFG_ATMEL_BOOT" >> $(obj)include/config.h ; \
 		echo "TEXT_BASE = 0x00000000" > $(obj)board/freescale/m54455evb/config.tmp ; \
@@ -1891,7 +1878,6 @@
 	M5475FFE_config)	BOOT=2;CODE=32;VID=1;USB=1;RAM=64;RAM1=64;; \
 	M5475GFE_config)	BOOT=4;CODE=0;VID=0;USB=0;RAM=64;RAM1=0;; \
 	esac; \
-	>include/config.h ; \
 	echo "#define CFG_BUSCLK	133333333" > $(obj)include/config.h ; \
 	echo "#define CFG_BOOTSZ	$${BOOT}" >> $(obj)include/config.h ; \
 	echo "#define CFG_DRAMSZ	$${RAM}" >> $(obj)include/config.h ; \
@@ -1927,7 +1913,6 @@
 	M5485GFE_config)	BOOT=4;CODE=0;VID=0;USB=0;RAM=64;RAM1=0;; \
 	M5485HFE_config)	BOOT=2;CODE=16;VID=1;USB=0;RAM=64;RAM1=0;; \
 	esac; \
-	>include/config.h ; \
 	echo "#define CFG_BUSCLK	100000000" > $(obj)include/config.h ; \
 	echo "#define CFG_BOOTSZ	$${BOOT}" >> $(obj)include/config.h ; \
 	echo "#define CFG_DRAMSZ	$${RAM}" >> $(obj)include/config.h ; \
@@ -1952,8 +1937,7 @@
 MPC8313ERDB_33_config \
 MPC8313ERDB_66_config: unconfig
 	@mkdir -p $(obj)include
-	@echo "" >$(obj)include/config.h ; \
-	if [ "$(findstring _33_,$@)" ] ; then \
+	@if [ "$(findstring _33_,$@)" ] ; then \
 		$(XECHO) -n "...33M ..." ; \
 		echo "#define CFG_33MHZ" >>$(obj)include/config.h ; \
 	fi ; \
@@ -1975,8 +1959,7 @@
 MPC832XEMDS_SLAVE_config \
 MPC832XEMDS_ATM_config:	unconfig
 	@mkdir -p $(obj)include
-	@echo "" >$(obj)include/config.h ; \
-	if [ "$(findstring _HOST_,$@)" ] ; then \
+	@if [ "$(findstring _HOST_,$@)" ] ; then \
 		$(XECHO) -n "... PCI HOST " ; \
 		echo "#define CONFIG_PCI" >>$(obj)include/config.h ; \
 	fi ; \
@@ -1998,7 +1981,7 @@
 	if [ "$(findstring _ATM_,$@)" ] ; then \
 		$(XECHO) -n "...ATM..." ; \
 		echo "#define CONFIG_PQ_MDS_PIB 1" >>$(obj)include/config.h ; \
-		echo "#define CONFIG_PQ_MDS_PIB_ATM     1" >>$(obj)include/config.h ; \
+		echo "#define CONFIG_PQ_MDS_PIB_ATM	1" >>$(obj)include/config.h ; \
 	fi ;
 	@$(MKCONFIG) -a MPC832XEMDS ppc mpc83xx mpc832xemds freescale
 
@@ -2025,8 +2008,7 @@
 MPC8360EMDS_SLAVE_config \
 MPC8360EMDS_ATM_config: unconfig
 	@mkdir -p $(obj)include
-	@echo "" >$(obj)include/config.h ; \
-	if [ "$(findstring _HOST_,$@)" ] ; then \
+	@if [ "$(findstring _HOST_,$@)" ] ; then \
 		$(XECHO) -n "... PCI HOST " ; \
 		echo "#define CONFIG_PCI" >>$(obj)include/config.h ; \
 	fi ; \
@@ -2048,16 +2030,15 @@
 	if [ "$(findstring _ATM_,$@)" ] ; then \
 		$(XECHO) -n "...ATM..." ; \
 		echo "#define CONFIG_PQ_MDS_PIB 1" >>$(obj)include/config.h ; \
-		echo "#define CONFIG_PQ_MDS_PIB_ATM     1" >>$(obj)include/config.h ; \
+		echo "#define CONFIG_PQ_MDS_PIB_ATM	1" >>$(obj)include/config.h ; \
 	fi ;
 	@$(MKCONFIG) -a MPC8360EMDS ppc mpc83xx mpc8360emds freescale
 
 MPC8360ERDK_33_config \
 MPC8360ERDK_66_config \
-MPC8360ERDK_config:
+MPC8360ERDK_config:	unconfig
 	@mkdir -p $(obj)include
-	@echo "" >$(obj)include/config.h ; \
-	if [ "$(findstring _33_,$@)" ] ; then \
+	@if [ "$(findstring _33_,$@)" ] ; then \
 		$(XECHO) -n "... CLKIN 33MHz " ; \
 		echo "#define CONFIG_CLKIN_33MHZ" >>$(obj)include/config.h ;\
 	fi ;
@@ -2066,8 +2047,7 @@
 MPC837XEMDS_config \
 MPC837XEMDS_HOST_config:	unconfig
 	@mkdir -p $(obj)include
-	@echo "" >$(obj)include/config.h ; \
-	if [ "$(findstring _HOST_,$@)" ] ; then \
+	@if [ "$(findstring _HOST_,$@)" ] ; then \
 		$(XECHO) -n "... PCI HOST " ; \
 		echo "#define CONFIG_PCI" >>$(obj)include/config.h ; \
 	fi ;
@@ -2097,10 +2077,9 @@
 MPC8540EVAL_33_config \
 MPC8540EVAL_66_config \
 MPC8540EVAL_33_slave_config \
-MPC8540EVAL_66_slave_config:      unconfig
+MPC8540EVAL_66_slave_config:	  unconfig
 	@mkdir -p $(obj)include
-	@echo "" >$(obj)include/config.h ; \
-	if [ "$(findstring _33_,$@)" ] ; then \
+	@if [ "$(findstring _33_,$@)" ] ; then \
 		$(XECHO) "... 33 MHz PCI" ; \
 	else \
 		echo "#define CONFIG_SYSCLK_66M" >>$(obj)include/config.h ; \
@@ -2120,8 +2099,7 @@
 MPC8541CDS_legacy_config \
 MPC8541CDS_config:	unconfig
 	@mkdir -p $(obj)include
-	@echo "" >$(obj)include/config.h ; \
-	if [ "$(findstring _legacy_,$@)" ] ; then \
+	@if [ "$(findstring _legacy_,$@)" ] ; then \
 		echo "#define CONFIG_LEGACY" >>$(obj)include/config.h ; \
 		$(XECHO) "... legacy" ; \
 	fi
@@ -2133,8 +2111,7 @@
 MPC8548CDS_legacy_config \
 MPC8548CDS_config:	unconfig
 	@mkdir -p $(obj)include
-	@echo "" >$(obj)include/config.h ; \
-	if [ "$(findstring _legacy_,$@)" ] ; then \
+	@if [ "$(findstring _legacy_,$@)" ] ; then \
 		echo "#define CONFIG_LEGACY" >>$(obj)include/config.h ; \
 		$(XECHO) "... legacy" ; \
 	fi
@@ -2143,8 +2120,7 @@
 MPC8555CDS_legacy_config \
 MPC8555CDS_config:	unconfig
 	@mkdir -p $(obj)include
-	@echo "" >$(obj)include/config.h ; \
-	if [ "$(findstring _legacy_,$@)" ] ; then \
+	@if [ "$(findstring _legacy_,$@)" ] ; then \
 		echo "#define CONFIG_LEGACY" >>$(obj)include/config.h ; \
 		$(XECHO) "... legacy" ; \
 	fi
@@ -2167,7 +2143,6 @@
 		echo "#define CONFIG_PCI_66"	>>$(obj)include/config.h ; \
 		$(XECHO) "... 66 MHz PCI" ; \
 	else \
-		>$(obj)include/config.h ; \
 		$(XECHO) "... 33 MHz PCI" ; \
 	fi
 	@$(MKCONFIG) -a SBC8540 ppc mpc85xx sbc8560
@@ -2177,13 +2152,12 @@
 
 sbc8560_config \
 sbc8560_33_config \
-sbc8560_66_config:      unconfig
+sbc8560_66_config:	unconfig
 	@mkdir -p $(obj)include
 	@if [ "$(findstring _66_,$@)" ] ; then \
 		echo "#define CONFIG_PCI_66"	>>$(obj)include/config.h ; \
 		$(XECHO) "... 66 MHz PCI" ; \
 	else \
-		>$(obj)include/config.h ; \
 		$(XECHO) "... 33 MHz PCI" ; \
 	fi
 	@$(MKCONFIG) -a sbc8560 ppc mpc85xx sbc8560
@@ -2197,8 +2171,6 @@
 	@if [ "$(findstring _4M_,$@)" ] ; then \
 		echo "#define CONFIG_STXSSA_4M" >>$(obj)include/config.h ; \
 		$(XECHO) "... with 4 MiB flash memory" ; \
-	else \
-		>$(obj)include/config.h ; \
 	fi
 	@$(MKCONFIG) -a stxssa ppc mpc85xx stxssa
 
@@ -2208,7 +2180,6 @@
 TQM8560_config:		unconfig
 	@mkdir -p $(obj)include
 	@CTYPE=$(subst TQM,,$(@:_config=)); \
-	>$(obj)include/config.h ; \
 	$(XECHO) "... TQM"$${CTYPE}; \
 	echo "#define CONFIG_MPC$${CTYPE}">>$(obj)include/config.h; \
 	echo "#define CONFIG_TQM$${CTYPE}">>$(obj)include/config.h; \
@@ -2228,7 +2199,7 @@
 	@$(MKCONFIG) $(@:_config=) ppc mpc86xx mpc8641hpcn freescale
 
 sbc8641d_config:	unconfig
-	@./mkconfig $(@:_config=) ppc mpc86xx sbc8641d
+	@$(MKCONFIG) $(@:_config=) ppc mpc86xx sbc8641d
 
 #########################################################################
 ## 74xx/7xx Systems
@@ -2445,7 +2416,6 @@
 trab_old_config:	unconfig
 	@mkdir -p $(obj)include
 	@mkdir -p $(obj)board/trab
-	@ >$(obj)include/config.h
 	@[ -z "$(findstring _bigram,$@)" ] || \
 		{ echo "#define CONFIG_FLASH_8MB"  >>$(obj)include/config.h ; \
 		  echo "#define CONFIG_RAM_32MB"   >>$(obj)include/config.h ; \
@@ -2487,8 +2457,7 @@
 
 gth2_config		:	unconfig
 	@mkdir -p $(obj)include
-	@ >$(obj)include/config.h
-	@echo "#define CONFIG_GTH2 1" >>$(obj)include/config.h
+	@echo "#define CONFIG_GTH2 1" >$(obj)include/config.h
 	@$(MKCONFIG) -a gth2 mips mips gth2
 
 #########################################################################
@@ -2551,7 +2520,7 @@
 csb226_config	:	unconfig
 	@$(MKCONFIG) $(@:_config=) arm pxa csb226
 
-delta_config :
+delta_config :	unconfig
 	@$(MKCONFIG) $(@:_config=) arm pxa delta
 
 innokom_config	:	unconfig
@@ -2573,13 +2542,11 @@
 	@$(MKCONFIG) $(@:_config=) arm pxa logodl
 
 pdnb3_config \
-scpu_config:    unconfig
+scpu_config:	unconfig
 	@mkdir -p $(obj)include
 	@if [ "$(findstring scpu_,$@)" ] ; then \
-		echo "#define CONFIG_SCPU"      >>$(obj)include/config.h ; \
+		echo "#define CONFIG_SCPU"	>>$(obj)include/config.h ; \
 		$(XECHO) "... on SCPU board variant" ; \
-	else \
-		>$(obj)include/config.h ; \
 	fi
 	@$(MKCONFIG) -a pdnb3 arm ixp pdnb3 prodrive
 
@@ -2611,6 +2578,7 @@
 	@$(MKCONFIG) $(@:_config=) arm arm1136 omap2420h4
 
 apollon_config		: unconfig
+	@mkdir -p $(obj)include
 	@echo "#define CONFIG_ONENAND_U_BOOT" > $(obj)include/config.h
 	@$(MKCONFIG) $(@:_config=) arm arm1136 apollon
 	@echo "CONFIG_ONENAND_U_BOOT = y" >> $(obj)include/config.mk
@@ -2644,7 +2612,6 @@
 incaip_150MHz_config	\
 incaip_config: unconfig
 	@mkdir -p $(obj)include
-	@ >$(obj)include/config.h
 	@[ -z "$(findstring _100MHz,$@)" ] || \
 		{ echo "#define CPU_CLOCK_RATE 100000000" >>$(obj)include/config.h ; \
 		  $(XECHO) "... with 100MHz system clock" ; \
@@ -2667,44 +2634,37 @@
 #########################################################################
 dbau1000_config		:	unconfig
 	@mkdir -p $(obj)include
-	@ >$(obj)include/config.h
-	@echo "#define CONFIG_DBAU1000 1" >>$(obj)include/config.h
+	@echo "#define CONFIG_DBAU1000 1" >$(obj)include/config.h
 	@$(MKCONFIG) -a dbau1x00 mips mips dbau1x00
 
 dbau1100_config		:	unconfig
 	@mkdir -p $(obj)include
-	@ >$(obj)include/config.h
-	@echo "#define CONFIG_DBAU1100 1" >>$(obj)include/config.h
+	@echo "#define CONFIG_DBAU1100 1" >$(obj)include/config.h
 	@$(MKCONFIG) -a dbau1x00 mips mips dbau1x00
 
 dbau1500_config		:	unconfig
 	@mkdir -p $(obj)include
-	@ >$(obj)include/config.h
-	@echo "#define CONFIG_DBAU1500 1" >>$(obj)include/config.h
+	@echo "#define CONFIG_DBAU1500 1" >$(obj)include/config.h
 	@$(MKCONFIG) -a dbau1x00 mips mips dbau1x00
 
 dbau1550_config		:	unconfig
 	@mkdir -p $(obj)include
-	@ >$(obj)include/config.h
-	@echo "#define CONFIG_DBAU1550 1" >>$(obj)include/config.h
+	@echo "#define CONFIG_DBAU1550 1" >$(obj)include/config.h
 	@$(MKCONFIG) -a dbau1x00 mips mips dbau1x00
 
 dbau1550_el_config	:	unconfig
 	@mkdir -p $(obj)include
-	@ >$(obj)include/config.h
-	@echo "#define CONFIG_DBAU1550 1" >>$(obj)include/config.h
+	@echo "#define CONFIG_DBAU1550 1" >$(obj)include/config.h
 	@$(MKCONFIG) -a dbau1x00 mips mips dbau1x00
 
 pb1000_config		:	unconfig
 	@mkdir -p $(obj)include
-	@ >$(obj)include/config.h
-	@echo "#define CONFIG_PB1000 1" >>$(obj)include/config.h
+	@echo "#define CONFIG_PB1000 1" >$(obj)include/config.h
 	@$(MKCONFIG) -a pb1x00 mips mips pb1x00
 
 qemu_mips_config: unconfig
 	@mkdir -p $(obj)include
-	@ >$(obj)include/config.h
-	@echo "#define CONFIG_QEMU_MIPS 1" >>$(obj)include/config.h
+	@echo "#define CONFIG_QEMU_MIPS 1" >$(obj)include/config.h
 	@$(MKCONFIG) -a qemu-mips mips mips qemu-mips
 
 #########################################################################
@@ -2725,7 +2685,6 @@
 DK1C20_standard_32_config	\
 DK1C20_config:	unconfig
 	@mkdir -p $(obj)include
-	@ >$(obj)include/config.h
 	@[ -z "$(findstring _safe_32,$@)" ] || \
 		{ echo "#define CONFIG_NIOS_SAFE_32 1" >>$(obj)include/config.h ; \
 		  $(XECHO) "... NIOS 'safe_32' configuration" ; \
@@ -2745,7 +2704,6 @@
 DK1S10_mtx_ldk_20_config	\
 DK1S10_config:	unconfig
 	@mkdir -p $(obj)include
-	@ >$(obj)include/config.h
 	@[ -z "$(findstring _safe_32,$@)" ] || \
 		{ echo "#define CONFIG_NIOS_SAFE_32 1" >>$(obj)include/config.h ; \
 		  $(XECHO) "... NIOS 'safe_32' configuration" ; \
@@ -2768,7 +2726,6 @@
 ADNPESC1_base_32_config		\
 ADNPESC1_config: unconfig
 	@mkdir -p $(obj)include
-	@ >$(obj)include/config.h
 	@[ -z "$(findstring _DNPEVA2,$@)" ] || \
 		{ echo "#define CONFIG_DNPEVA2 1" >>$(obj)include/config.h ; \
 		  $(XECHO) "... DNP/EVA2 configuration" ; \
@@ -2810,20 +2767,17 @@
 #########################################################################
 suzaku_config:	unconfig
 	@mkdir -p $(obj)include
-	@ >$(obj)include/config.h
-	@echo "#define CONFIG_SUZAKU 1" >> $(obj)include/config.h
+	@echo "#define CONFIG_SUZAKU 1" > $(obj)include/config.h
 	@$(MKCONFIG) -a $(@:_config=) microblaze microblaze suzaku AtmarkTechno
 
 ml401_config:	unconfig
 	@mkdir -p $(obj)include
-	@ >$(obj)include/config.h
-	@echo "#define CONFIG_ML401 1" >> $(obj)include/config.h
+	@echo "#define CONFIG_ML401 1" > $(obj)include/config.h
 	@$(MKCONFIG) -a $(@:_config=) microblaze microblaze ml401 xilinx
 
 xupv2p_config:	unconfig
 	@mkdir -p $(obj)include
-	@ >$(obj)include/config.h
-	@echo "#define CONFIG_XUPV2P 1" >> $(obj)include/config.h
+	@echo "#define CONFIG_XUPV2P 1" > $(obj)include/config.h
 	@$(MKCONFIG) -a $(@:_config=) microblaze microblaze xupv2p xilinx
 
 #========================================================================
@@ -2867,70 +2821,62 @@
 ## sh3 (Renesas SuperH)
 #########################################################################
 ms7720se_config: unconfig
-	@ >include/config.h
-	@echo "#define CONFIG_MS7720SE 1" >> include/config.h
-	@./mkconfig -a $(@:_config=) sh sh3 ms7720se
+	@echo "#define CONFIG_MS7720SE 1" > include/config.h
+	@$(MKCONFIG) -a $(@:_config=) sh sh3 ms7720se
 
 #########################################################################
 ## sh4 (Renesas SuperH)
 #########################################################################
 ms7750se_config: unconfig
-	@ >$(obj)include/config.h
-	@echo "#define CONFIG_MS7750SE 1" >> $(obj)include/config.h
-	@./mkconfig -a $(@:_config=) sh sh4 ms7750se
+	@echo "#define CONFIG_MS7750SE 1" > $(obj)include/config.h
+	@$(MKCONFIG) -a $(@:_config=) sh sh4 ms7750se
 
-ms7722se_config :       unconfig
-	@ >$(obj)include/config.h
-	@echo "#define CONFIG_MS7722SE 1" >> $(obj)include/config.h
-	@./mkconfig -a $(@:_config=) sh sh4 ms7722se
+ms7722se_config :	unconfig
+	@echo "#define CONFIG_MS7722SE 1" > $(obj)include/config.h
+	@$(MKCONFIG) -a $(@:_config=) sh sh4 ms7722se
 
 #########################################################################
 #########################################################################
 #########################################################################
 
 clean:
+	@rm -f $(obj)examples/82559_eeprom $(obj)examples/eepro100_eeprom \
+	       $(obj)examples/hello_world  $(obj)examples/interrupt	  \
+	       $(obj)examples/mem_to_mem_idma2intr			  \
+	       $(obj)examples/sched	   $(obj)examples/smc91111_eeprom \
+	       $(obj)examples/test_burst   $(obj)examples/timer
+	@rm -f $(obj)tools/bmp_logo	   $(obj)tools/easylogo/easylogo  \
+	       $(obj)tools/env/{fw_printenv,fw_setenv}			  \
+	       $(obj)tools/envcrc					  \
+	       $(obj)tools/gdb/{astest,gdbcont,gdbsend}			  \
+	       $(obj)tools/gen_eth_addr    $(obj)tools/img2srec		  \
+	       $(obj)tools/mkimage	   $(obj)tools/mpc86x_clk	  \
+	       $(obj)tools/ncb		   $(obj)tools/ubsha1
+	@rm -f $(obj)board/cray/L1/{bootscript.c,bootscript.image}	  \
+	       $(obj)board/netstar/{eeprom,crcek,crcit,*.srec,*.bin}	  \
+	       $(obj)board/trab/trab_fkt   $(obj)board/voiceblue/eeprom   \
+	       $(obj)board/{integratorap,integratorcp}/u-boot.lds	  \
+	       $(obj)board/{bf533-ezkit,bf533-stamp,bf537-stamp,bf561-ezkit}/u-boot.lds
+	@rm -f $(obj)include/bmp_logo.h $(obj)nand_spl/{u-boot-spl,u-boot-spl.map}
+	@rm -f $(obj)onenand_ipl/onenand-{ipl,ipl.bin,ipl-2k.bin,ipl.map}
+	@rm -f $(obj)api_examples/demo $(VERSION_FILE)
 	@find $(OBJTREE) -type f \
 		\( -name 'core' -o -name '*.bak' -o -name '*~' \
-		-o -name '*.o'  -o -name '*.a'  \) -print \
+		-o -name '*.o'	-o -name '*.a'	\) -print \
 		| xargs rm -f
-	@rm -f $(obj)examples/hello_world $(obj)examples/timer \
-	      $(obj)examples/eepro100_eeprom $(obj)examples/sched \
-	      $(obj)examples/mem_to_mem_idma2intr $(obj)examples/82559_eeprom \
-	      $(obj)examples/smc91111_eeprom $(obj)examples/interrupt \
-	      $(obj)examples/test_burst
-	@rm -f $(obj)tools/img2srec $(obj)tools/mkimage $(obj)tools/envcrc \
-		$(obj)tools/gen_eth_addr $(obj)tools/ubsha1
-	@rm -f $(obj)tools/mpc86x_clk $(obj)tools/ncb
-	@rm -f $(obj)tools/easylogo/easylogo $(obj)tools/bmp_logo
-	@rm -f $(obj)tools/gdb/astest $(obj)tools/gdb/gdbcont $(obj)tools/gdb/gdbsend
-	@rm -f $(obj)tools/env/fw_printenv $(obj)tools/env/fw_setenv
-	@rm -f $(obj)board/cray/L1/bootscript.c $(obj)board/cray/L1/bootscript.image
-	@rm -f $(obj)board/netstar/eeprom $(obj)board/netstar/crcek $(obj)board/netstar/crcit
-	@rm -f $(obj)board/netstar/*.srec $(obj)board/netstar/*.bin
-	@rm -f $(obj)board/trab/trab_fkt $(obj)board/voiceblue/eeprom
-	@rm -f $(obj)board/integratorap/u-boot.lds $(obj)board/integratorcp/u-boot.lds
-	@rm -f $(obj)board/bf533-ezkit/u-boot.lds $(obj)board/bf533-stamp/u-boot.lds
-	@rm -f $(obj)board/bf537-stamp/u-boot.lds $(obj)board/bf561-ezkit/u-boot.lds
-	@rm -f $(obj)include/bmp_logo.h
-	@rm -f $(obj)nand_spl/u-boot-spl $(obj)nand_spl/u-boot-spl.map
-	@rm -f $(obj)onenand_ipl/onenand-ipl $(obj)onenand_ipl/onenand-ipl.bin \
-		$(obj)onenand_ipl/onenand-ipl-2k.bin $(obj)onenand_ipl/onenand-ipl.map
-	@rm -f $(obj)api_examples/demo $(VERSION_FILE)
 
 clobber:	clean
 	@find $(OBJTREE) -type f \( -name .depend \
 		-o -name '*.srec' -o -name '*.bin' -o -name u-boot.img \) \
 		-print0 \
 		| xargs -0 rm -f
-	@rm -f $(OBJS) $(obj)*.bak $(obj)ctags $(obj)etags $(obj)TAGS
-	@rm -fr $(obj)*.*~
+	@rm -f $(OBJS) $(obj)*.bak $(obj)ctags $(obj)etags $(obj)TAGS \
+		$(obj)cscope.* $(obj)*.*~
 	@rm -f $(obj)u-boot $(obj)u-boot.map $(obj)u-boot.hex $(ALL)
-	@rm -f $(obj)tools/crc32.c $(obj)tools/environment.c $(obj)tools/env/crc32.c
-	@rm -f $(obj)tools/sha1.c $(obj)tools/image.c
-	@rm -f $(obj)tools/fdt.c $(obj)tools/fdt_ro.c $(obj)tools/fdt_rw.c
-	@rm -f $(obj)tools/fdt_strerror.c $(obj)tools/fdt_wip.c
-	@rm -f $(obj)tools/libfdt_internal.h
-	@rm -f $(obj)tools/inca-swap-bytes $(obj)cpu/mpc824x/bedbug_603e.c
+	@rm -f $(obj)tools/{crc32.c,environment.c,env/crc32.c,sha1.c,inca-swap-bytes}
+	@rm -f $(obj)tools/{image.c,fdt.c,fdt_ro.c,fdt_rw.c,fdt_strerror.c}
+	@rm -f $(obj)tools/{fdt_wip.c,libfdt_internal.h}
+	@rm -f $(obj)cpu/mpc824x/bedbug_603e.c
 	@rm -f $(obj)include/asm/proc $(obj)include/asm/arch $(obj)include/asm
 	@[ ! -d $(obj)nand_spl ] || find $(obj)nand_spl -lname "*" -print | xargs rm -f
 	@[ ! -d $(obj)onenand_ipl ] || find $(obj)onenand_ipl -lname "*" -print | xargs rm -f