/* TODO(sjg@chromium.org): Drop fdtdec.h include */
#include <fdtdec.h>
#include <dm/of.h>
+#include <log.h>
/* Enable checks to protect against invalid calls */
#undef OF_CHECKS
* is not a really a pointer to a node: it is an offset value. See above.
*/
typedef union ofnode_union {
- const struct device_node *np; /* will be used for future live tree */
+ const struct device_node *np;
long of_offset;
} ofnode;
};
/**
- * _ofnode_to_np() - convert an ofnode to a live DT node pointer
+ * ofnode_to_np() - convert an ofnode to a live DT node pointer
*
* This cannot be called if the reference contains an offset.
*
if (of_live_active())
return node.np != NULL;
else
- return node.of_offset != -1;
+ return node.of_offset >= 0;
}
/**
* live tree is in use.
*/
assert(!ofnode_valid(node) ||
- (of_live_active() ? _ofnode_to_np(node)
- : _ofnode_to_np(node)));
+ (of_live_active() ? ofnode_to_np(node)
+ : ofnode_to_np(node)));
#endif
return of_live_active() && ofnode_valid(node);
}
* @node: device tree node containing a list
* @list_name: property name that contains a list
* @cells_name: property name that specifies phandles' arguments count
+ * @cells_count: Cell count to use if @cells_name is NULL
* @return number of phandle on success, -ENOENT if @list_name does not
* exist, -EINVAL if a phandle was not found, @cells_name could not
* be found.
*/
int ofnode_count_phandle_with_args(ofnode node, const char *list_name,
- const char *cells_name);
+ const char *cells_name, int cell_count);
/**
* ofnode_path() - find a node by full path
*/
ofnode ofnode_get_chosen_node(const char *propname);
+/**
+ * ofnode_read_aliases_prop() - get the value of a aliases property
+ *
+ * This looks for a property within the /aliases node and returns its value
+ *
+ * @propname: Property name to look for
+ * @sizep: Returns size of property, or FDT_ERR_... error code if function
+ * returns NULL
+ * @return property value if found, else NULL
+ */
+const void *ofnode_read_aliases_prop(const char *propname, int *sizep);
+
+/**
+ * ofnode_get_aliases_node() - get a referenced node from the aliases node
+ *
+ * This looks up a named property in the aliases node and uses that as a path to
+ * look up a code.
+ *
+ * @return the referenced node if present, else ofnode_null()
+ */
+ofnode ofnode_get_aliases_node(const char *propname);
+
struct display_timing;
/**
* ofnode_decode_display_timing() - decode display timings