Skip to contentSkip to conversation

Moved fdt command support code to fdt_support.c

PATCH New Jerry Van Baren 2 participants 2 messages Apr 7, 2007 – Apr 9, 2007

lore
Share & tools
lore
#0 lore raw

PATCH 2/2 Moved fdt command support code to fdt_support.c

...in preparation for improving the bootm command's handling of fdt blobs. Also cleaned up some coding sloppiness.

---
 board/mpc8360emds/mpc8360emds.c |   16 ++-
 common/Makefile                 |    2 +-
 common/cmd_bootm.c              |    2 +-
 common/cmd_fdt.c                |  301 ++++--------------------------------
 common/fdt_support.c            |  323 +++++++++++++++++++++++++++++++++++++++
 cpu/mpc83xx/cpu.c               |    1 +
 include/fdt_support.h           |   42 +++++
 7 files changed, 412 insertions(+), 275 deletions(-)
board/mpc8360emds/mpc8360emds.c +13 -3
index deadb5f..5cabe47 100644
@@ -664,19 +664,28 @@ U_BOOT_CMD(ecc, 4, 0, do_ecc,
 
 #if (defined(CONFIG_OF_FLAT_TREE) || defined(CONFIG_OF_LIBFDT)) \
      && defined(CONFIG_OF_BOARD_SETUP)
+
+/*
+ * Prototypes of functions that we use.
+ */
+void ft_cpu_setup(void *blob, bd_t *bd);
+
+#ifdef CONFIG_PCI
+void ft_pci_setup(void *blob, bd_t *bd);
+#endif
+
 void
 ft_board_setup(void *blob, bd_t *bd)
 {
 #if defined(CONFIG_OF_LIBFDT)
 	int nodeoffset;
-	int err;
 	int tmp[2];
 
 	nodeoffset = fdt_path_offset (fdt, "/memory");
 	if (nodeoffset >= 0) {
 		tmp[0] = cpu_to_be32(bd->bi_memstart);
 		tmp[1] = cpu_to_be32(bd->bi_memsize);
-		err = fdt_setprop(fdt, nodeoffset, "reg", tmp, sizeof(tmp));
+		fdt_setprop(fdt, nodeoffset, "reg", tmp, sizeof(tmp));
 	}
 #else
 	u32 *p;
@@ -694,4 +703,5 @@ ft_board_setup(void *blob, bd_t *bd)
 #endif
 	ft_cpu_setup(blob, bd);
 }
-#endif
+#endif /* CONFIG_OF_x */
+
common/Makefile +1 -1
index 74a6af2..5dfd3a8 100644
@@ -45,7 +45,7 @@ COBJS	= main.o ACEX1K.o altera.o bedbug.o circbuf.o cmd_autoscript.o \
 	  env_nand.o env_dataflash.o env_flash.o env_eeprom.o \
 	  env_nvram.o env_nowhere.o \
 	  exports.o \
-	  flash.o fpga.o ft_build.o \
+	  fdt_support.o flash.o fpga.o ft_build.o \
 	  hush.o kgdb.o lcd.o lists.o lynxkdi.o \
 	  memsize.o miiphybb.o miiphyutil.o \
 	  s_record.o serial.o soft_i2c.o soft_spi.o spartan2.o spartan3.o \
common/cmd_bootm.c +1 -1
index 2721216..3eeb03c 100644
@@ -950,7 +950,7 @@ do_bootm_linux (cmd_tbl_t *cmdtp, int flag,
 
 		printf ("   Loading Device Tree to %08lx, end %08lx ... ",
 			of_start, of_start + of_len - 1);
-		err = fdt_open_into(of_start, of_data, of_len);
+		err = fdt_open_into((void *)of_start, (void *)of_data, of_len);
 		if (err != 0) {
 			printf ("libfdt: %s\n", fdt_strerror(err));
 		}
common/cmd_fdt.c +31 -270

340 lines not on this page · raw message

common/fdt_support.c new file +323 -0

323 lines not on this page · raw message

cpu/mpc83xx/cpu.c +1 -0
index 21b1646..aa4d9b1 100644
@@ -364,6 +364,7 @@ ft_cpu_setup(void *blob, bd_t *bd)
 			/*
 			 * If unconditional create or the property already exists...
 			 */
+			err = 0;
 			if ((fixup_props[j].createflags & FT_CREATE) ||
 				(fdt_get_property(fdt, nodeoffset, fixup_props[j].prop, 0))) {
 				if (fixup_props[j].createflags & FT_BUSFREQ) {
include/fdt_support.h new file +42 -0

42 lines not on this page · raw message

Signature · 1 line
1.4.4.4
#1 lore raw

PATCH 2/2 Moved fdt command support code to fdt_support.c

Quoted 4 lines · Jerry Van Baren

...in preparation for improving the bootm command's handling of fdt blobs. Also cleaned up some coding sloppiness.

Wolfgang,

The libfdt support makes my patch, "Abort booting if the DTB version is incompatible", invalid. libfdt has version checking already in it (this patch just changes it), so I'm officially rescinding my patch. Thanks.

Signature · 2 lines
Timur Tabi
Linux Kernel Developer @ Freescale