Merge branch 'master' of /home/wd/git/u-boot/custodians
diff --git a/Makefile b/Makefile
index 2a06440..c53de17 100644
--- a/Makefile
+++ b/Makefile
@@ -352,7 +352,7 @@
 $(obj)u-boot:		depend $(SUBDIRS) $(OBJS) $(LIBBOARD) $(LIBS) $(LDSCRIPT)
 		$(GEN_UBOOT)
 ifeq ($(CONFIG_KALLSYMS),y)
-		smap=`$(call SYSTEM_MAP,u-boot) | awk '$$2 ~ /[tTwW]/ {printf $$1 $$3 "\\0"}'` ; \
+		smap=`$(call SYSTEM_MAP,u-boot) | awk '$$2 ~ /[tTwW]/ {printf $$1 $$3 "\\\\000"}'` ; \
 		$(CC) $(CFLAGS) -DSYSTEM_MAP="\"$${smap}\"" -c common/system_map.c -o $(obj)common/system_map.o
 		$(GEN_UBOOT) $(obj)common/system_map.o
 endif
@@ -3627,7 +3627,6 @@
 	@rm -f $(obj)include/asm/proc $(obj)include/asm/arch $(obj)include/asm
 	@[ ! -d $(obj)nand_spl ] || find $(obj)nand_spl -name "*" -type l -print | xargs rm -f
 	@[ ! -d $(obj)onenand_ipl ] || find $(obj)onenand_ipl -name "*" -type l -print | xargs rm -f
-	@[ ! -d $(obj)api_examples ] || find $(obj)api_examples -name "*" -type l -print | xargs rm -f
 
 ifeq ($(OBJTREE),$(SRCTREE))
 mrproper \
diff --git a/api_examples/.gitignore b/api_examples/.gitignore
index 272816f..d7b18dc 100644
--- a/api_examples/.gitignore
+++ b/api_examples/.gitignore
@@ -1,7 +1,2 @@
-crc32.c
-ctype.c
 demo
 demo.bin
-ppcstring.S
-string.c
-vsprintf.c
diff --git a/api_examples/Makefile b/api_examples/Makefile
index 4c01437..2a30bef 100644
--- a/api_examples/Makefile
+++ b/api_examples/Makefile
@@ -29,74 +29,56 @@
 
 include $(TOPDIR)/config.mk
 
-ELF-$(CONFIG_API) += demo
-BIN-$(CONFIG_API) += demo.bin
-ELF	:= $(ELF-y)
-BIN	:= $(BIN-y)
+# Resulting ELF and binary exectuables will be named demo and demo.bin
+OUTPUT-$(CONFIG_API) = $(obj)demo
+OUTPUT = $(OUTPUT-y)
 
-#CFLAGS += -v
+# Source files located in the api_examples directory
+SOBJ_FILES-$(CONFIG_API) += crt0.o
+COBJ_FILES-$(CONFIG_API) += demo.o
+COBJ_FILES-$(CONFIG_API) += glue.o
+COBJ_FILES-$(CONFIG_API) += libgenwrap.o
 
-COBJS-$(CONFIG_API) += $(ELF:=.o)
-SOBJS-$(CONFIG_API) += crt0.o
+# Source files which exist outside the api_examples directory
+EXT_COBJ_FILES-$(CONFIG_API) += lib_generic/crc32.o
+EXT_COBJ_FILES-$(CONFIG_API) += lib_generic/ctype.o
+EXT_COBJ_FILES-$(CONFIG_API) += lib_generic/string.o
+EXT_COBJ_FILES-$(CONFIG_API) += lib_generic/vsprintf.o
 ifeq ($(ARCH),ppc)
-SOBJS-$(CONFIG_API) += ppcstring.o
+EXT_SOBJ_FILES-$(CONFIG_API) += lib_ppc/ppcstring.o
 endif
-COBJS	:= $(COBJS-y)
-SOBJS	:= $(SOBJS-y)
 
-LIB	= $(obj)libglue.a
-LIBCOBJS-$(CONFIG_API) += glue.o crc32.o ctype.o string.o vsprintf.o \
-				libgenwrap.o
-LIBCOBJS := $(LIBCOBJS-y)
+# Create a list of source files so their dependencies can be auto-generated
+SRCS	+= $(addprefix $(SRCTREE)/,$(EXT_COBJ_FILES-y:.o=.c))
+SRCS	+= $(addprefix $(SRCTREE)/,$(EXT_SOBJ_FILES-y:.o=.S))
+SRCS	+= $(addprefix $(SRCTREE)/api_examples/,$(COBJ_FILES-y:.o=.c))
+SRCS	+= $(addprefix $(SRCTREE)/api_examples/,$(SOBJ_FILES-y:.o=.S))
 
-LIBOBJS	= $(addprefix $(obj),$(SOBJS) $(LIBCOBJS))
-
-SRCS	:= $(COBJS:.o=.c) $(LIBCOBJS:.o=.c) $(SOBJS:.o=.S)
-OBJS	:= $(addprefix $(obj),$(COBJS))
-ELF	:= $(addprefix $(obj),$(ELF))
-BIN	:= $(addprefix $(obj),$(BIN))
+# Create a list of object files to be compiled
+OBJS	+= $(addprefix $(obj),$(SOBJ_FILES-y))
+OBJS	+= $(addprefix $(obj),$(COBJ_FILES-y))
+OBJS	+= $(addprefix $(obj),$(notdir $(EXT_COBJ_FILES-y)))
+OBJS	+= $(addprefix $(obj),$(notdir $(EXT_SOBJ_FILES-y)))
 
 gcclibdir := $(shell dirname `$(CC) -print-libgcc-file-name`)
 
 CPPFLAGS += -I..
 
-all:	$(obj).depend $(OBJS) $(LIB) $(ELF) $(BIN)
+all:	$(obj).depend $(OUTPUT)
 
 #########################################################################
-$(LIB):	$(obj).depend $(LIBOBJS)
-		$(AR) $(ARFLAGS) $@ $(LIBOBJS)
-
-$(ELF):
-$(obj)%:	$(obj)%.o $(LIB)
-		$(LD) $(obj)crt0.o -Ttext $(LOAD_ADDR) \
-			-o $@ $< $(LIB) \
-			-L$(gcclibdir) -lgcc
 
-$(BIN):
-$(obj)%.bin:	$(obj)%
-		$(OBJCOPY) -O binary $< $@ 2>/dev/null
+$(OUTPUT):	$(OBJS)
+		$(LD) -Ttext $(LOAD_ADDR) -o $@ $^ -L$(gcclibdir) -lgcc
+		$(OBJCOPY) -O binary $@ $(OUTPUT).bin 2>/dev/null
 
-$(obj)crc32.c:
-	@rm -f $(obj)crc32.c
-	ln -s $(src)../lib_generic/crc32.c $(obj)crc32.c
+# Rule to build generic library C files
+$(obj)%.o: $(SRCTREE)/lib_generic/%.c
+	$(CC) -g $(CFLAGS) -c -o $@ $<
 
-$(obj)ctype.c:
-	@rm -f $(obj)ctype.c
-	ln -s $(src)../lib_generic/ctype.c $(obj)ctype.c
-
-$(obj)string.c:
-	@rm -f $(obj)string.c
-	ln -s $(src)../lib_generic/string.c $(obj)string.c
-
-$(obj)vsprintf.c:
-	@rm -f $(obj)vsprintf.c
-	ln -s $(src)../lib_generic/vsprintf.c $(obj)vsprintf.c
-
-ifeq ($(ARCH),ppc)
-$(obj)ppcstring.S:
-	@rm -f $(obj)ppcstring.S
-	ln -s $(src)../lib_ppc/ppcstring.S $(obj)ppcstring.S
-endif
+# Rule to build architecture-specific library assembly files
+$(obj)%.o: $(SRCTREE)/lib_$(ARCH)/%.S
+	$(CC) -g $(CFLAGS) -c -o $@ $<
 
 #########################################################################
 
diff --git a/include/configs/HIDDEN_DRAGON.h b/include/configs/HIDDEN_DRAGON.h
index f6777b9..251fe67 100644
--- a/include/configs/HIDDEN_DRAGON.h
+++ b/include/configs/HIDDEN_DRAGON.h
@@ -103,9 +103,7 @@
 #define PCI_ENET1_MEMADDR	0x81000000
 
 #define CONFIG_RTL8139
-#define _IO_BASE	    0x00000000
-/* This macro is used by RTL8139 but not defined in PPC architecture */
-#define KSEG1ADDR(x)	    (x)
+
 /* Make sure the ethaddr can be overwritten
    TODO: Remove this on final product
 */
diff --git a/include/configs/M5253DEMO.h b/include/configs/M5253DEMO.h
index 50b3a03..5e86e4c 100644
--- a/include/configs/M5253DEMO.h
+++ b/include/configs/M5253DEMO.h
@@ -85,7 +85,6 @@
 #	define CONFIG_SYS_ATA_REG_OFFSET	0xA0	/* Offset for normal register accesses */
 #	define CONFIG_SYS_ATA_ALT_OFFSET	0xC0	/* Offset for alternate registers */
 #	define CONFIG_SYS_ATA_STRIDE		4	/* Interval between registers */
-#	define _IO_BASE			0
 #endif
 
 #define CONFIG_NET_MULTI		1
diff --git a/include/configs/M5253EVBE.h b/include/configs/M5253EVBE.h
index cf8b773..df6970c 100644
--- a/include/configs/M5253EVBE.h
+++ b/include/configs/M5253EVBE.h
@@ -91,7 +91,6 @@
 #define CONFIG_SYS_ATA_REG_OFFSET	0xA0	/* Offset for normal register accesses */
 #define CONFIG_SYS_ATA_ALT_OFFSET	0xC0	/* Offset for alternate registers */
 #define CONFIG_SYS_ATA_STRIDE		4	/* Interval between registers */
-#define _IO_BASE		0
 
 #define CONFIG_SYS_PROMPT		"=> "
 #define CONFIG_SYS_LONGHELP		/* undef to save memory */
diff --git a/include/configs/M54455EVB.h b/include/configs/M54455EVB.h
index 101dced..87f3a73 100644
--- a/include/configs/M54455EVB.h
+++ b/include/configs/M54455EVB.h
@@ -180,7 +180,6 @@
 #define CONFIG_SYS_ATA_REG_OFFSET	0xA0	/* Offset for normal register accesses */
 #define CONFIG_SYS_ATA_ALT_OFFSET	0xC0	/* Offset for alternate registers           */
 #define CONFIG_SYS_ATA_STRIDE		4	/* Interval between registers                 */
-#define _IO_BASE		0
 
 /* Realtime clock */
 #define CONFIG_MCFRTC
diff --git a/include/configs/MPC8349ITX.h b/include/configs/MPC8349ITX.h
index f2e574b..d4d3256 100644
--- a/include/configs/MPC8349ITX.h
+++ b/include/configs/MPC8349ITX.h
@@ -360,16 +360,9 @@
 #define CONFIG_SYS_PCI2_IO_SIZE	0x01000000	/* 16M */
 #endif
 
-#define _IO_BASE		0x00000000	/* points to PCI I/O space */
-
 #define CONFIG_NET_MULTI
 #define CONFIG_PCI_PNP			/* do pci plug-and-play */
 
-#ifdef CONFIG_RTL8139
-/* This macro is used by RTL8139 but not defined in PPC architecture */
-#define KSEG1ADDR(x)	    (x)
-#endif
-
 #ifndef CONFIG_PCI_PNP
     #define PCI_ENET0_IOADDR	0x00000000
     #define PCI_ENET0_MEMADDR	CONFIG_SYS_PCI2_MEM_BASE
diff --git a/include/configs/MPC8536DS.h b/include/configs/MPC8536DS.h
index 9e00b89..7085d28 100644
--- a/include/configs/MPC8536DS.h
+++ b/include/configs/MPC8536DS.h
@@ -427,12 +427,6 @@
 #undef CONFIG_TULIP
 #undef CONFIG_RTL8139
 
-#ifdef CONFIG_RTL8139
-/* This macro is used by RTL8139 but not defined in PPC architecture */
-#define KSEG1ADDR(x)		({u32 _x=le32_to_cpu(*(u32 *)(x)); (&_x);})
-#define _IO_BASE	0x00000000
-#endif
-
 #ifndef CONFIG_PCI_PNP
 	#define PCI_ENET0_IOADDR	CONFIG_SYS_PCI1_IO_BUS
 	#define PCI_ENET0_MEMADDR	CONFIG_SYS_PCI1_IO_BUS
diff --git a/include/configs/MPC8544DS.h b/include/configs/MPC8544DS.h
index 59cfde6..1d8fecf 100644
--- a/include/configs/MPC8544DS.h
+++ b/include/configs/MPC8544DS.h
@@ -340,12 +340,6 @@
 #undef CONFIG_TULIP
 #define CONFIG_RTL8139
 
-#ifdef CONFIG_RTL8139
-/* This macro is used by RTL8139 but not defined in PPC architecture */
-#define KSEG1ADDR(x)		(x)
-#define _IO_BASE	0x00000000
-#endif
-
 #ifndef CONFIG_PCI_PNP
 	#define PCI_ENET0_IOADDR	CONFIG_SYS_PCI1_IO_BUS
 	#define PCI_ENET0_MEMADDR	CONFIG_SYS_PCI1_IO_BUS
diff --git a/include/configs/MPC8572DS.h b/include/configs/MPC8572DS.h
index 6f1b1a4..235be51 100644
--- a/include/configs/MPC8572DS.h
+++ b/include/configs/MPC8572DS.h
@@ -484,12 +484,6 @@
 #undef CONFIG_TULIP
 #undef CONFIG_RTL8139
 
-#ifdef CONFIG_RTL8139
-/* This macro is used by RTL8139 but not defined in PPC architecture */
-#define KSEG1ADDR(x)		(x)
-#define _IO_BASE	0x00000000
-#endif
-
 #ifndef CONFIG_PCI_PNP
 	#define PCI_ENET0_IOADDR	CONFIG_SYS_PCIE3_IO_BUS
 	#define PCI_ENET0_MEMADDR	CONFIG_SYS_PCIE3_IO_BUS
diff --git a/include/configs/MPC8610HPCD.h b/include/configs/MPC8610HPCD.h
index 1091043..2f40ef4 100644
--- a/include/configs/MPC8610HPCD.h
+++ b/include/configs/MPC8610HPCD.h
@@ -280,10 +280,6 @@
 #define CONFIG_SYS_PCI1_IO_VIRT	0xe1000000
 #define CONFIG_SYS_PCI1_IO_SIZE	0x00100000	/* 1M */
 
-/* For RTL8139 */
-#define KSEG1ADDR(x)	({u32 _x = le32_to_cpu(*(u32 *)(x)); (&_x); })
-#define _IO_BASE		0x00000000
-
 /* controller 1, Base address 0xa000 */
 #define CONFIG_SYS_PCIE1_MEM_BUS	0xa0000000
 #define CONFIG_SYS_PCIE1_MEM_PHYS	CONFIG_SYS_PCIE1_MEM_BUS
diff --git a/include/configs/MPC8641HPCN.h b/include/configs/MPC8641HPCN.h
index 035874b..60ce0f3 100644
--- a/include/configs/MPC8641HPCN.h
+++ b/include/configs/MPC8641HPCN.h
@@ -348,10 +348,6 @@
 				 | CONFIG_SYS_PHYS_ADDR_HIGH)
 #define CONFIG_SYS_PCI1_IO_SIZE	0x00010000	/* 64K */
 
-/* For RTL8139 */
-#define KSEG1ADDR(x)		({u32 _x=le32_to_cpu(*(u32 *)(x)); (&_x);})
-#define _IO_BASE		0x00000000
-
 #ifdef CONFIG_PHYS_64BIT
 /*
  * Use the same PCI bus address on PCI1 and PCI2 if we have PHYS_64BIT.
diff --git a/include/configs/MVBLM7.h b/include/configs/MVBLM7.h
index 9675205..ac8cb57 100644
--- a/include/configs/MVBLM7.h
+++ b/include/configs/MVBLM7.h
@@ -193,8 +193,6 @@
 #define CONFIG_SYS_PCI1_IO_PHYS	0xE2000000
 #define CONFIG_SYS_PCI1_IO_SIZE	0x01000000
 
-#define _IO_BASE		0x00000000
-
 #define CONFIG_NET_MULTI	1
 #define CONFIG_NET_RETRY_COUNT	3
 
diff --git a/include/configs/P2020DS.h b/include/configs/P2020DS.h
index 9306860..676f013 100644
--- a/include/configs/P2020DS.h
+++ b/include/configs/P2020DS.h
@@ -519,12 +519,6 @@
 #undef CONFIG_TULIP
 #define CONFIG_RTL8139
 
-#ifdef CONFIG_RTL8139
-/* This macro is used by RTL8139 but not defined in PPC architecture */
-#define KSEG1ADDR(x)		(x)
-#define _IO_BASE	0x00000000
-#endif
-
 #ifndef CONFIG_PCI_PNP
 	#define PCI_ENET0_IOADDR	CONFIG_SYS_PCIE3_IO_BUS
 	#define PCI_ENET0_MEMADDR	CONFIG_SYS_PCIE3_IO_BUS
diff --git a/include/configs/mpc7448hpc2.h b/include/configs/mpc7448hpc2.h
index 7d42155..4f98ba4 100644
--- a/include/configs/mpc7448hpc2.h
+++ b/include/configs/mpc7448hpc2.h
@@ -124,8 +124,6 @@
 
 /* Networking Configuration */
 
-#define KSEG1ADDR(a)	(a)	/* Needed by the rtl8139 driver */
-
 #define CONFIG_TSI108_ETH
 #define CONFIG_TSI108_ETH_NUM_PORTS	2
 
@@ -303,8 +301,6 @@
 
 #define CONFIG_SYS_PCI_IO_SIZE		0x01000000	/* 16MB */
 
-#define _IO_BASE		0x00000000	/* points to PCI I/O space      */
-
 /* PCI Config Space mapping */
 #define CONFIG_SYS_PCI_CFG_BASE	0xfb000000	/* Changed from FE000000 */
 #define CONFIG_SYS_PCI_CFG_SIZE	0x01000000	/* 16MB */
diff --git a/include/configs/r2dplus.h b/include/configs/r2dplus.h
index 6fa1eaf..37d4fff 100644
--- a/include/configs/r2dplus.h
+++ b/include/configs/r2dplus.h
@@ -123,7 +123,5 @@
  */
 #define CONFIG_NET_MULTI
 #define CONFIG_RTL8139
-#define _IO_BASE		0x00000000
-#define KSEG1ADDR(x)		(x)
 
 #endif /* __CONFIG_H */
diff --git a/include/pci_ids.h b/include/pci_ids.h
index ae642b1..400c540 100644
--- a/include/pci_ids.h
+++ b/include/pci_ids.h
@@ -1519,6 +1519,8 @@
 #define PCI_DEVICE_ID_AUREAL_VORTEX_1	0x0001
 #define PCI_DEVICE_ID_AUREAL_VORTEX_2	0x0002
 
+#define PCI_VENDOR_ID_ESDGMBH		0x12fe
+
 #define PCI_VENDOR_ID_CBOARDS		0x1307
 #define PCI_DEVICE_ID_CBOARDS_DAS1602_16 0x0001