summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2013-02-26 12:14:36 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2013-03-06 11:41:29 +0100
commita51d06d67900547b68cc133c0d185937cea04fee (patch)
tree91e3c4a7a4c1dd5a69fdd60d500c736b03b4ee51 /common
parent973e58e3abdc70f3d28c61961a4fc7b0acac0719 (diff)
downloadbarebox-a51d06d67900547b68cc133c0d185937cea04fee.tar.gz
barebox-a51d06d67900547b68cc133c0d185937cea04fee.tar.xz
of: remove unused libfdt
Now that we are completely independent of libfdt remove the unused code. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'common')
-rw-r--r--common/memory.c1
-rw-r--r--common/oftree.c175
2 files changed, 0 insertions, 176 deletions
diff --git a/common/memory.c b/common/memory.c
index 61cca0df54..7ec211b8da 100644
--- a/common/memory.c
+++ b/common/memory.c
@@ -21,7 +21,6 @@
#include <memory.h>
#include <of.h>
#include <init.h>
-#include <libfdt.h>
#include <linux/ioport.h>
#include <asm-generic/memory_layout.h>
#include <asm/sections.h>
diff --git a/common/oftree.c b/common/oftree.c
index e6c82d602a..776d301186 100644
--- a/common/oftree.c
+++ b/common/oftree.c
@@ -5,7 +5,6 @@
#include <command.h>
#include <fs.h>
#include <malloc.h>
-#include <libfdt.h>
#include <linux/ctype.h>
#include <asm/byteorder.h>
#include <errno.h>
@@ -99,180 +98,6 @@ void of_print_property(const void *data, int len)
}
}
-static void printf_indent(int level, const char *fmt, ...)
-{
- va_list args;
-
- printf("%*s", level * 8, "");
-
- va_start (args, fmt);
- vprintf(fmt, args);
- va_end (args);
-}
-
-int fdt_print(struct fdt_header *working_fdt, const char *pathp)
-{
- const void *nodep; /* property node pointer */
- int nodeoffset; /* node offset from libfdt */
- int nextoffset; /* next node offset from libfdt */
- uint32_t tag; /* tag */
- int len; /* length of the property */
- int level = 0; /* keep track of nesting level */
- const struct fdt_property *fdt_prop;
-
- nodeoffset = fdt_path_offset(working_fdt, pathp);
- if (nodeoffset < 0) {
- /*
- * Not found or something else bad happened.
- */
- printf("libfdt fdt_path_offset() returned %s\n",
- fdt_strerror(nodeoffset));
- return 1;
- }
-
- while (level >= 0) {
- tag = fdt_next_tag(working_fdt, nodeoffset, &nextoffset);
- switch (tag) {
- case FDT_BEGIN_NODE:
- pathp = fdt_get_name(working_fdt, nodeoffset, NULL);
- if (pathp == NULL)
- pathp = "/* NULL pointer error */";
- if (*pathp == '\0')
- pathp = "/"; /* root is nameless */
- printf_indent(level, "%s {\n",pathp);
- level++;
- if (level >= MAX_LEVEL) {
- printf("Nested too deep, aborting.\n");
- return 1;
- }
- break;
- case FDT_END_NODE:
- level--;
- printf_indent(level, "};\n");
- if (level == 0) {
- level = -1; /* exit the loop */
- }
- break;
- case FDT_PROP:
- fdt_prop = fdt_offset_ptr(working_fdt, nodeoffset,
- sizeof(*fdt_prop));
- pathp = fdt_string(working_fdt,
- fdt32_to_cpu(fdt_prop->nameoff));
- len = fdt32_to_cpu(fdt_prop->len);
- nodep = fdt_prop->data;
- if (len < 0) {
- printf("libfdt fdt_getprop(): %s\n",
- fdt_strerror(len));
- return 1;
- } else if (len == 0) {
- /* the property has no value */
- printf_indent(level, "%s;\n", pathp);
- } else {
- printf_indent(level, "%s = ", pathp);
- of_print_property(nodep, len);
- printf(";\n");
- }
- break;
- case FDT_NOP:
- printf_indent(level, "/* NOP */\n");
- break;
- case FDT_END:
- return 1;
- default:
- printf("Unknown tag 0x%08X\n", tag);
- return 1;
- }
- nodeoffset = nextoffset;
- }
- return 0;
-}
-
-/**
- * fdt_find_and_setprop: Find a node and set it's property
- *
- * @fdt: ptr to device tree
- * @node: path of node
- * @prop: property name
- * @val: ptr to new value
- * @len: length of new property value
- * @create: flag to create the property if it doesn't exist
- *
- * Convenience function to directly set a property given the path to the node.
- */
-int fdt_find_and_setprop(struct fdt_header *fdt, const char *node,
- const char *prop, const void *val, int len, int create)
-{
- int nodeoff = fdt_path_offset(fdt, node);
-
- if (nodeoff < 0)
- return nodeoff;
-
- if ((!create) && (fdt_get_property(fdt, nodeoff, prop, NULL) == NULL))
- return 0; /* create flag not set; so exit quietly */
-
- return fdt_setprop(fdt, nodeoff, prop, val, len);
-}
-
-void do_fixup_by_path(struct fdt_header *fdt, const char *path,
- const char *prop, const void *val, int len, int create)
-{
- int rc = fdt_find_and_setprop(fdt, path, prop, val, len, create);
- if (rc)
- printf("Unable to update property %s:%s, err=%s\n",
- path, prop, fdt_strerror(rc));
-}
-
-void do_fixup_by_path_u32(struct fdt_header *fdt, const char *path,
- const char *prop, u32 val, int create)
-{
- val = cpu_to_fdt32(val);
- do_fixup_by_path(fdt, path, prop, &val, sizeof(val), create);
-}
-
-void do_fixup_by_compatible(struct fdt_header *fdt, const char *compatible,
- const char *prop, const void *val, int len, int create)
-{
- int off = -1;
-
- off = fdt_node_offset_by_compatible(fdt, -1, compatible);
- while (off != -FDT_ERR_NOTFOUND) {
- if (create || (fdt_get_property(fdt, off, prop, 0) != NULL))
- fdt_setprop(fdt, off, prop, val, len);
- off = fdt_node_offset_by_compatible(fdt, off, compatible);
- }
-}
-
-void do_fixup_by_compatible_u32(struct fdt_header *fdt, const char *compatible,
- const char *prop, u32 val, int create)
-{
- val = cpu_to_fdt32(val);
- do_fixup_by_compatible(fdt, compatible, prop, &val, 4, create);
-}
-
-void do_fixup_by_compatible_string(struct fdt_header *fdt, const char *compatible,
- const char *prop, const char *val, int create)
-{
- do_fixup_by_compatible(fdt, compatible, prop, val, strlen(val) + 1,
- create);
-}
-
-int fdt_get_path_or_create(struct fdt_header *fdt, const char *path)
-{
- int nodeoffset;
-
- nodeoffset = fdt_path_offset (fdt, path);
- if (nodeoffset < 0) {
- nodeoffset = fdt_add_subnode(fdt, 0, path + 1);
- if (nodeoffset < 0) {
- printf("WARNING: could not create %s %s.\n",
- path, fdt_strerror(nodeoffset));
- return -EINVAL;
- }
- }
-
- return nodeoffset;
-}
-
static int of_fixup_bootargs(struct device_node *root)
{
struct device_node *node;