summaryrefslogtreecommitdiff
path: root/include/dm
diff options
context:
space:
mode:
Diffstat (limited to 'include/dm')
-rw-r--r--include/dm/device_compat.h1
-rw-r--r--include/dm/of_access.h19
-rw-r--r--include/dm/ofnode.h73
-rw-r--r--include/dm/util.h15
4 files changed, 100 insertions, 8 deletions
diff --git a/include/dm/device_compat.h b/include/dm/device_compat.h
index 82d7a7d4924..aa9a6fbb5e3 100644
--- a/include/dm/device_compat.h
+++ b/include/dm/device_compat.h
@@ -14,6 +14,7 @@
#include <log.h>
#include <linux/build_bug.h>
#include <linux/compat.h>
+#include <linux/printk.h>
/*
* Define a new identifier which can be tested on by C code. A similar
diff --git a/include/dm/of_access.h b/include/dm/of_access.h
index c556a18f7d9..9361d0a87bf 100644
--- a/include/dm/of_access.h
+++ b/include/dm/of_access.h
@@ -334,6 +334,25 @@ int of_read_u32_index(const struct device_node *np, const char *propname,
int index, u32 *outp);
/**
+ * of_read_u64_index() - Find and read a 64-bit value from a multi-value
+ * property
+ *
+ * @np: device node from which the property value is to be read.
+ * @propname: name of the property to be searched.
+ * @index: index of the u32 in the list of values
+ * @outp: pointer to return value, modified only if return value is 0.
+ *
+ * Search for a property in a device node and read a 64-bit value from
+ * it.
+ *
+ * Return:
+ * 0 on success, -EINVAL if the property does not exist, or -EOVERFLOW if the
+ * property data isn't large enough.
+ */
+int of_read_u64_index(const struct device_node *np, const char *propname,
+ int index, u64 *outp);
+
+/**
* of_read_u64() - Find and read a 64-bit integer from a property
*
* Search for a property in a device node and read a 64-bit value from
diff --git a/include/dm/ofnode.h b/include/dm/ofnode.h
index 0f38b3e736d..06c969c61fe 100644
--- a/include/dm/ofnode.h
+++ b/include/dm/ofnode.h
@@ -20,6 +20,7 @@
struct resource;
#include <dm/ofnode_decl.h>
+#include <linux/errno.h>
struct ofnode_phandle_args {
ofnode node;
@@ -435,6 +436,18 @@ int ofnode_read_u32_index(ofnode node, const char *propname, int index,
u32 *outp);
/**
+ * ofnode_read_u64_index() - Read a 64-bit integer from a multi-value property
+ *
+ * @node: valid node reference to read property from
+ * @propname: name of the property to read from
+ * @index: index of the integer to return
+ * @outp: place to put value (if found)
+ * Return: 0 if OK, -ve on error
+ */
+int ofnode_read_u64_index(ofnode node, const char *propname, int index,
+ u64 *outp);
+
+/**
* ofnode_read_s32() - Read a 32-bit integer from a property
*
* @node: valid node reference to read property from
@@ -1198,15 +1211,15 @@ int ofnode_read_simple_size_cells(ofnode node);
* determine if a node was bound in one of SPL/TPL stages.
*
* There are 4 settings currently in use
- * - bootph-some-ram: U-Boot proper pre-relocation only
+ * - bootph-some-ram: U-Boot proper pre-relocation phase
* - bootph-all: all phases
* Existing platforms only use it to indicate nodes needed in
* SPL. Should probably be replaced by bootph-pre-ram for new platforms.
- * - bootph-pre-ram: SPL and U-Boot pre-relocation
- * - bootph-pre-sram: TPL and U-Boot pre-relocation
+ * - bootph-pre-ram: SPL phase
+ * - bootph-pre-sram: TPL phase
*
* @node: node to check
- * Return: true if node is needed in SPL/TL, false otherwise
+ * Return: true if node should be or was bound, false otherwise
*/
bool ofnode_pre_reloc(ofnode node);
@@ -1500,6 +1513,47 @@ int ofnode_conf_read_int(const char *prop_name, int default_val);
*/
const char *ofnode_conf_read_str(const char *prop_name);
+/**
+ * ofnode_read_bootscript_address() - Read bootscr-address or bootscr-ram-offset
+ *
+ * @bootscr_address: pointer to 64bit address where bootscr-address property value
+ * is stored
+ * @bootscr_offset: pointer to 64bit offset address where bootscr-ram-offset
+ * property value is stored
+ *
+ * This reads a bootscr-address or bootscr-ram-offset property from
+ * the /options/u-boot/ node of the devicetree. bootscr-address holds the full
+ * address of the boot script file. bootscr-ram-offset holds the boot script
+ * file offset from the start of the ram base address. When bootscr-address is
+ * defined, bootscr-ram-offset property is ignored.
+ *
+ * This only works with the control FDT.
+ *
+ * Return: 0 if OK, -EINVAL if property is not found.
+ */
+int ofnode_read_bootscript_address(u64 *bootscr_address, u64 *bootscr_offset);
+
+/**
+ * ofnode_read_bootscript_flash() - Read bootscr-flash-offset/size
+ *
+ * @bootscr_flash_offset: pointer to 64bit offset where bootscr-flash-offset
+ * property value is stored
+ * @bootscr_flash_size: pointer to 64bit size where bootscr-flash-size property
+ * value is stored
+ *
+ * This reads a bootscr-flash-offset and bootscr-flash-size properties from
+ * the /options/u-boot/ node of the devicetree. bootscr-flash-offset holds
+ * the offset of the boot script file from start of flash. bootscr-flash-size
+ * holds the boot script size in flash. When bootscr-flash-size is not defined,
+ * bootscr-flash-offset property is cleaned.
+ *
+ * This only works with the control FDT.
+ *
+ * Return: 0 if OK, -EINVAL if property is not found or incorrect.
+ */
+int ofnode_read_bootscript_flash(u64 *bootscr_flash_offset,
+ u64 *bootscr_flash_size);
+
#else /* CONFIG_DM */
static inline bool ofnode_conf_read_bool(const char *prop_name)
{
@@ -1516,6 +1570,17 @@ static inline const char *ofnode_conf_read_str(const char *prop_name)
return NULL;
}
+static inline int ofnode_read_bootscript_address(u64 *bootscr_address, u64 *bootscr_offset)
+{
+ return -EINVAL;
+}
+
+static inline int ofnode_read_bootscript_flash(u64 *bootscr_flash_offset,
+ u64 *bootscr_flash_size)
+{
+ return -EINVAL;
+}
+
#endif /* CONFIG_DM */
/**
diff --git a/include/dm/util.h b/include/dm/util.h
index 4bb49e9e8c0..89206cc4966 100644
--- a/include/dm/util.h
+++ b/include/dm/util.h
@@ -27,14 +27,21 @@ struct list_head;
int list_count_items(struct list_head *head);
/**
- * Dump out a tree of all devices
+ * Dump out a tree of all devices starting @uclass
*
+ * @dev_name: udevice name
+ * @extended: true if forword-matching expected
* @sort: Sort by uclass name
*/
-void dm_dump_tree(bool sort);
+void dm_dump_tree(char *dev_name, bool extended, bool sort);
-/* Dump out a list of uclasses and their devices */
-void dm_dump_uclass(void);
+/*
+ * Dump out a list of uclasses and their devices
+ *
+ * @uclass: uclass name
+ * @extended: true if forword-matching expected
+ */
+void dm_dump_uclass(char *uclass, bool extended);
#ifdef CONFIG_DEBUG_DEVRES
/* Dump out a list of device resources */