From 0bd4e39d2ba477f3c274aa233f5c2e1d25dbaa74 Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Fri, 21 Nov 2014 19:47:08 +0900 Subject: fdt: remove fdtdec_get_alias_node() function The fdt_path_offset() checks an alias too. fdtdec_get_alias_node(blob, "foo") is equivalent to fdt_path_offset(blob, "foo"). Signed-off-by: Masahiro Yamada Acked-by: Simon Glass diff --git a/drivers/serial/serial-uclass.c b/drivers/serial/serial-uclass.c index b09053f..d1b5777 100644 --- a/drivers/serial/serial-uclass.c +++ b/drivers/serial/serial-uclass.c @@ -39,7 +39,7 @@ static void serial_find_console_or_panic(void) /* Check for a chosen console */ node = fdtdec_get_chosen_node(gd->fdt_blob, "stdout-path"); if (node < 0) - node = fdtdec_get_alias_node(gd->fdt_blob, "console"); + node = fdt_path_offset(gd->fdt_blob, "console"); if (!uclass_get_device_by_of_offset(UCLASS_SERIAL, node, &dev)) { gd->cur_serial_dev = dev; return; diff --git a/include/fdtdec.h b/include/fdtdec.h index 3da9fab..911f216 100644 --- a/include/fdtdec.h +++ b/include/fdtdec.h @@ -390,17 +390,6 @@ int fdtdec_get_alias_seq(const void *blob, const char *base, int node, int *seqp); /** - * Get the offset of the given alias node - * - * This looks up an alias in /aliases then finds the offset of that node. - * - * @param blob Device tree blob (if NULL, then error is returned) - * @param name Alias name, e.g. "console" - * @return Node offset referred to by that alias, or -ve FDT_ERR_... - */ -int fdtdec_get_alias_node(const void *blob, const char *name); - -/** * Get the offset of the given chosen node * * This looks up a property in /chosen containing the path to another node, diff --git a/lib/fdtdec.c b/lib/fdtdec.c index 7c7e673..f12d6a3 100644 --- a/lib/fdtdec.c +++ b/lib/fdtdec.c @@ -370,21 +370,6 @@ int fdtdec_get_alias_seq(const void *blob, const char *base, int offset, return -ENOENT; } -int fdtdec_get_alias_node(const void *blob, const char *name) -{ - const char *prop; - int alias_node; - int len; - - if (!blob) - return -FDT_ERR_NOTFOUND; - alias_node = fdt_path_offset(blob, "/aliases"); - prop = fdt_getprop(blob, alias_node, name, &len); - if (!prop) - return -FDT_ERR_NOTFOUND; - return fdt_path_offset(blob, prop); -} - int fdtdec_get_chosen_node(const void *blob, const char *name) { const char *prop; -- cgit v0.10.2 From ffccb84c1a8e276fa7263ec4ca8186f06312305c Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Fri, 28 Nov 2014 14:23:51 +0100 Subject: fdt: Fix regression in fdt_pack_reg() After commit 933cdbb479: "fdt: Try to use fdt_address_cells()/fdt_size_cells()" I noticed that allwinner boards would no longer boot. Switching to fdt_address_cells / fdt_size_cells changes the result from bytes to 32 bit words, so when we increment pointers into the blob, we must do so by 32 bit words now. This commit makes allwinner boards boot again. Signed-off-by: Hans de Goede Tested-by: Masahiro Yamada Acked-by: Simon Glass Tested-by: Stefan Roese Tested-by: Vince Hsu diff --git a/common/fdt_support.c b/common/fdt_support.c index ea42c63..6254e34 100644 --- a/common/fdt_support.c +++ b/common/fdt_support.c @@ -370,22 +370,22 @@ static int fdt_pack_reg(const void *fdt, void *buf, u64 *address, u64 *size, int n) { int i; - int address_len = fdt_address_cells(fdt, 0); - int size_len = fdt_size_cells(fdt, 0); + int address_cells = fdt_address_cells(fdt, 0); + int size_cells = fdt_size_cells(fdt, 0); char *p = buf; for (i = 0; i < n; i++) { - if (address_len == 2) + if (address_cells == 2) *(fdt64_t *)p = cpu_to_fdt64(address[i]); else *(fdt32_t *)p = cpu_to_fdt32(address[i]); - p += address_len; + p += 4 * address_cells; - if (size_len == 2) + if (size_cells == 2) *(fdt64_t *)p = cpu_to_fdt64(size[i]); else *(fdt32_t *)p = cpu_to_fdt32(size[i]); - p += size_len; + p += 4 * size_cells; } return p - (char *)buf; -- cgit v0.10.2