Merge with http://opensource.freescale.com/pub/scm/u-boot-85xx.git#for_wd
diff --git a/board/cds/mpc8541cds/mpc8541cds.c b/board/cds/mpc8541cds/mpc8541cds.c
index c2b3009..a42904c 100644
--- a/board/cds/mpc8541cds/mpc8541cds.c
+++ b/board/cds/mpc8541cds/mpc8541cds.c
@@ -497,8 +497,6 @@
 pci_init_board(void)
 {
 #ifdef CONFIG_PCI
-	extern void pci_mpc85xx_init(struct pci_controller **hose);
-
-	pci_mpc85xx_init(&hose);
+	pci_mpc85xx_init(hose);
 #endif
 }
diff --git a/board/cds/mpc8548cds/mpc8548cds.c b/board/cds/mpc8548cds/mpc8548cds.c
index 6eedb4a..ab5835d 100644
--- a/board/cds/mpc8548cds/mpc8548cds.c
+++ b/board/cds/mpc8548cds/mpc8548cds.c
@@ -322,8 +322,6 @@
 pci_init_board(void)
 {
 #ifdef CONFIG_PCI
-	extern void pci_mpc85xx_init(struct pci_controller **hose);
-
 	pci_mpc85xx_init(&hose);
 #endif
 }
diff --git a/board/cds/mpc8555cds/mpc8555cds.c b/board/cds/mpc8555cds/mpc8555cds.c
index 012181c..d980ea6 100644
--- a/board/cds/mpc8555cds/mpc8555cds.c
+++ b/board/cds/mpc8555cds/mpc8555cds.c
@@ -497,8 +497,6 @@
 pci_init_board(void)
 {
 #ifdef CONFIG_PCI
-	extern void pci_mpc85xx_init(struct pci_controller *hose);
-
 	pci_mpc85xx_init(hose);
 #endif
 }
diff --git a/board/mpc8540ads/mpc8540ads.c b/board/mpc8540ads/mpc8540ads.c
index fbcb397..914e51a 100644
--- a/board/mpc8540ads/mpc8540ads.c
+++ b/board/mpc8540ads/mpc8540ads.c
@@ -33,7 +33,6 @@
 
 #if defined(CONFIG_OF_FLAT_TREE)
 #include <ft_build.h>
-extern void ft_cpu_setup(void *blob, bd_t *bd);
 #endif
 
 
@@ -327,8 +326,6 @@
 pci_init_board(void)
 {
 #ifdef CONFIG_PCI
-	extern void pci_mpc85xx_init(struct pci_controller *hose);
-
 	pci_mpc85xx_init(&hose);
 #endif /* CONFIG_PCI */
 }
diff --git a/board/mpc8560ads/mpc8560ads.c b/board/mpc8560ads/mpc8560ads.c
index f9d75e8..c1572a3 100644
--- a/board/mpc8560ads/mpc8560ads.c
+++ b/board/mpc8560ads/mpc8560ads.c
@@ -539,8 +539,6 @@
 pci_init_board(void)
 {
 #ifdef CONFIG_PCI
-	extern void pci_mpc85xx_init(struct pci_controller *hose);
-
 	pci_mpc85xx_init(&hose);
 #endif /* CONFIG_PCI */
 }
diff --git a/board/pm854/pm854.c b/board/pm854/pm854.c
index 94c492f..6ead1d0 100644
--- a/board/pm854/pm854.c
+++ b/board/pm854/pm854.c
@@ -289,8 +289,6 @@
 pci_init_board(void)
 {
 #ifdef CONFIG_PCI
-	extern void pci_mpc85xx_init(struct pci_controller *hose);
-
 	pci_mpc85xx_init(&hose);
 #endif /* CONFIG_PCI */
 }
diff --git a/board/pm856/pm856.c b/board/pm856/pm856.c
index 5044708..a100754 100644
--- a/board/pm856/pm856.c
+++ b/board/pm856/pm856.c
@@ -442,8 +442,6 @@
 pci_init_board(void)
 {
 #ifdef CONFIG_PCI
-	extern void pci_mpc85xx_init(struct pci_controller *hose);
-
 	pci_mpc85xx_init(&hose);
 #endif /* CONFIG_PCI */
 }
diff --git a/board/stxgp3/stxgp3.c b/board/stxgp3/stxgp3.c
index 2b3949c..a58c043 100644
--- a/board/stxgp3/stxgp3.c
+++ b/board/stxgp3/stxgp3.c
@@ -375,8 +375,6 @@
 pci_init_board(void)
 {
 #ifdef CONFIG_PCI
-	extern void pci_mpc85xx_init(struct pci_controller *hose);
-
 	pci_mpc85xx_init(&hose);
 #endif /* CONFIG_PCI */
 }
diff --git a/board/tqm85xx/tqm85xx.c b/board/tqm85xx/tqm85xx.c
index b4ef5af..256c076 100644
--- a/board/tqm85xx/tqm85xx.c
+++ b/board/tqm85xx/tqm85xx.c
@@ -408,8 +408,6 @@
 void pci_init_board (void)
 {
 #ifdef CONFIG_PCI
-	extern void pci_mpc85xx_init (struct pci_controller *hose);
-
 	pci_mpc85xx_init (&hose);
 #endif /* CONFIG_PCI */
 }
diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c
index bc84ae3..d913f5c 100644
--- a/common/cmd_bootm.c
+++ b/common/cmd_bootm.c
@@ -510,7 +510,7 @@
 #endif /* CONFIG_SILENT_CONSOLE */
 
 #ifdef CONFIG_PPC
-static void
+static void  __attribute__((noinline))
 do_bootm_linux (cmd_tbl_t *cmdtp, int flag,
 		int	argc, char *argv[],
 		ulong	addr,
@@ -625,7 +625,7 @@
 	/* Look for a '-' which indicates to ignore the ramdisk argument */
 	if (argc >= 3 && strcmp(argv[2], "-") ==  0) {
 			debug ("Skipping initrd\n");
-			data = 0;
+			len = data = 0;
 		}
 	else
 #endif
@@ -900,8 +900,6 @@
 	(*kernel) (kbd, initrd_start, initrd_end, cmd_start, cmd_end);
 
 #else
-	ft_setup(of_flat_tree, kbd, initrd_start, initrd_end);
-	/* ft_dump_blob(of_flat_tree); */
 
 #if defined(CFG_INIT_RAM_LOCK) && !defined(CONFIG_E500)
 	unlock_ram_in_cache();
@@ -917,9 +915,12 @@
 	if (getenv("disable_of") != NULL)
 		(*kernel) ((bd_t *)of_flat_tree, initrd_start, initrd_end,
 			cmd_start, cmd_end);
-	else
+	else {
+		ft_setup(of_flat_tree, kbd, initrd_start, initrd_end);
+		/* ft_dump_blob(of_flat_tree); */
 		(*kernel) ((bd_t *)of_flat_tree, (ulong)kernel, 0, 0, 0);
-
+	}
+		
 #endif
 }
 #endif /* CONFIG_PPC */
diff --git a/common/ft_build.c b/common/ft_build.c
index f76c582..980e40f 100644
--- a/common/ft_build.c
+++ b/common/ft_build.c
@@ -87,9 +87,9 @@
 
 	p = cxt->p;
 	while (p < cxt->p_end) {
-		if (strcmp(p, name) == 0)
+		if (strcmp((char *)p, name) == 0)
 			return p - cxt->p;
-		p += strlen(p) + 1;
+		p += strlen((char *)p) + 1;
 	}
 
 	return -1;
@@ -103,7 +103,7 @@
 	if (off == -1) {
 		memcpy(cxt->p_end, name, strlen(name) + 1);
 		off = cxt->p_end - cxt->p;
-		cxt->p_end += strlen(name) + 2;
+		cxt->p_end += strlen(name) + 1;
 	}
 
 	/* now put offset from beginning of *STRUCTURE* */
@@ -143,9 +143,9 @@
 	cxt->p_rsvmap += SIZE_OF_RSVMAP_ENTRY;
 	}
 
-	cxt->p_start = (char*)bph + bph->off_dt_struct;
-	cxt->p_end = (char *)bph + bph->totalsize;
-	cxt->p = (char *)bph + bph->off_dt_strings;
+	cxt->p_start = (u8 *)bph + bph->off_dt_struct;
+	cxt->p_end = (u8 *)bph + bph->totalsize;
+	cxt->p = (u8 *)bph + bph->off_dt_strings;
 }
 
 /* add a reserver physical area to the rsvmap */
diff --git a/cpu/mpc85xx/pci.c b/cpu/mpc85xx/pci.c
index cfb7dcd..84f839a 100644
--- a/cpu/mpc85xx/pci.c
+++ b/cpu/mpc85xx/pci.c
@@ -29,6 +29,9 @@
 #include <asm/cpm_85xx.h>
 #include <pci.h>
 
+#if defined(CONFIG_OF_FLAT_TREE)
+#include <ft_build.h>
+#endif
 
 #if defined(CONFIG_PCI)
 
@@ -42,7 +45,9 @@
 
 	volatile immap_t    *immap = (immap_t *)CFG_CCSRBAR;
 	volatile ccsr_pcix_t *pcix = &immap->im_pcix;
+#ifdef CONFIG_MPC85XX_PCI2
 	volatile ccsr_pcix_t *pcix2 = &immap->im_pcix2;
+#endif
 	volatile ccsr_gur_t *gur = &immap->im_gur;
 	struct pci_controller * hose;
 
diff --git a/include/ft_build.h b/include/ft_build.h
index f515687..89c689c 100644
--- a/include/ft_build.h
+++ b/include/ft_build.h
@@ -64,6 +64,8 @@
 
 #ifdef CONFIG_OF_BOARD_SETUP
 void ft_board_setup(void *blob, bd_t *bd);
+void ft_cpu_setup(void *blob, bd_t *bd);
+void ft_pci_setup(void *blob, bd_t *bd);
 #endif
 
 #endif
diff --git a/include/pci.h b/include/pci.h
index e0e8783..cc216e1 100644
--- a/include/pci.h
+++ b/include/pci.h
@@ -501,4 +501,7 @@
 extern void pci_mpc824x_init (struct pci_controller *hose);
 #endif
 
+#ifdef CONFIG_MPC85xx 
+extern void pci_mpc85xx_init (struct pci_controller *hose);
+#endif
 #endif	/* _PCI_H */