]> git.sur5r.net Git - u-boot/blobdiff - drivers/core/read.c
SPDX: Fixup SPDX tags in a few new files
[u-boot] / drivers / core / read.c
index 065589a6abcfa00de066fcad7d11c7197092e2d4..0322cbf33008e91153d2d34904b0ccabe1083f11 100644 (file)
@@ -1,14 +1,19 @@
+// SPDX-License-Identifier: GPL-2.0+
 /*
  * Copyright (c) 2017 Google, Inc
  * Written by Simon Glass <sjg@chromium.org>
- *
- * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #include <common.h>
 #include <dm.h>
+#include <mapmem.h>
 #include <dm/of_access.h>
 
+int dev_read_u32(struct udevice *dev, const char *propname, u32 *outp)
+{
+       return ofnode_read_u32(dev_ofnode(dev), propname, outp);
+}
+
 int dev_read_u32_default(struct udevice *dev, const char *propname, int def)
 {
        return ofnode_read_u32_default(dev_ofnode(dev), propname, def);
@@ -61,11 +66,11 @@ void *dev_read_addr_ptr(struct udevice *dev)
 {
        fdt_addr_t addr = dev_read_addr(dev);
 
-       return (addr == FDT_ADDR_T_NONE) ? NULL : (void *)addr;
+       return (addr == FDT_ADDR_T_NONE) ? NULL : map_sysmem(addr, 0);
 }
 
 fdt_addr_t dev_read_addr_size(struct udevice *dev, const char *property,
-                               fdt_size_t *sizep)
+                             fdt_size_t *sizep)
 {
        return ofnode_get_addr_size(dev_ofnode(dev), property, sizep);
 }
@@ -76,21 +81,38 @@ const char *dev_read_name(struct udevice *dev)
 }
 
 int dev_read_stringlist_search(struct udevice *dev, const char *property,
-                         const char *string)
+                              const char *string)
 {
        return ofnode_stringlist_search(dev_ofnode(dev), property, string);
 }
 
+int dev_read_string_index(struct udevice *dev, const char *propname, int index,
+                         const char **outp)
+{
+       return ofnode_read_string_index(dev_ofnode(dev), propname, index, outp);
+}
+
+int dev_read_string_count(struct udevice *dev, const char *propname)
+{
+       return ofnode_read_string_count(dev_ofnode(dev), propname);
+}
+
 int dev_read_phandle_with_args(struct udevice *dev, const char *list_name,
-                               const char *cells_name, int cell_count,
-                               int index,
-                               struct ofnode_phandle_args *out_args)
+                              const char *cells_name, int cell_count,
+                              int index, struct ofnode_phandle_args *out_args)
 {
        return ofnode_parse_phandle_with_args(dev_ofnode(dev), list_name,
                                              cells_name, cell_count, index,
                                              out_args);
 }
 
+int dev_count_phandle_with_args(struct udevice *dev, const char *list_name,
+                               const char *cells_name)
+{
+       return ofnode_count_phandle_with_args(dev_ofnode(dev), list_name,
+                                             cells_name);
+}
+
 int dev_read_addr_cells(struct udevice *dev)
 {
        return ofnode_read_addr_cells(dev_ofnode(dev));
@@ -177,3 +199,8 @@ int dev_read_resource_byname(struct udevice *dev, const char *name,
 {
        return ofnode_read_resource_byname(dev_ofnode(dev), name, res);
 }
+
+u64 dev_translate_address(struct udevice *dev, const fdt32_t *in_addr)
+{
+       return ofnode_translate_address(dev_ofnode(dev), in_addr);
+}