]> git.sur5r.net Git - u-boot/commitdiff
dm: core: Update of_read_fmap_entry() for livetree
authorSimon Glass <sjg@chromium.org>
Mon, 11 Jun 2018 19:07:17 +0000 (13:07 -0600)
committerSimon Glass <sjg@chromium.org>
Mon, 9 Jul 2018 15:11:00 +0000 (09:11 -0600)
Update this function to take an ofnode so that it can work with livetree.

Signed-off-by: Simon Glass <sjg@chromium.org>
drivers/core/of_extra.c
drivers/misc/cros_ec.c
include/dm/of_extra.h

index c76177c5292eb259171e2be6ae5e85f6b6862a87..3243caa5d127c8ea161f20ea3dd7d085e110d3d2 100644 (file)
 #include <dm/of_extra.h>
 #include <dm/ofnode.h>
 
-int of_read_fmap_entry(ofnode node, const char *name,
-                      struct fmap_entry *entry)
+int ofnode_read_fmap_entry(ofnode node, struct fmap_entry *entry)
 {
        const char *prop;
        u32 reg[2];
 
        if (ofnode_read_u32_array(node, "reg", reg, 2)) {
-               debug("Node '%s' has bad/missing 'reg' property\n", name);
-               return -FDT_ERR_NOTFOUND;
+               debug("Node '%s' has bad/missing 'reg' property\n",
+                     ofnode_get_name(node));
+               return -log_ret(ENOENT);
        }
        entry->offset = reg[0];
        entry->length = reg[1];
index 5fd2cd9973945637c3a9260899d84802ee34a284..6f299d407a4c12bcd8136f0f29d73c67043b0153 100644 (file)
@@ -1028,7 +1028,7 @@ int cros_ec_decode_ec_flash(struct udevice *dev, struct fdt_cros_ec *config)
                return -1;
        }
 
-       if (of_read_fmap_entry(flash_node, "flash", &config->flash)) {
+       if (ofnode_read_fmap_entry(flash_node,  &config->flash)) {
                debug("Failed to decode flash node in chrome-ec\n");
                return -1;
        }
@@ -1050,7 +1050,7 @@ int cros_ec_decode_ec_flash(struct udevice *dev, struct fdt_cros_ec *config)
                        return -1;
                }
 
-               if (of_read_fmap_entry(node, "reg", &config->region[region])) {
+               if (ofnode_read_fmap_entry(node, &config->region[region])) {
                        debug("Failed to decode flash region in chrome-ec'\n");
                        return -1;
                }
index 6f1529689f8745e9c0d8891d5bfe7ae77dd65358..e1540c1fbdc3fd7df88bef518a67587fc219d69c 100644 (file)
@@ -34,12 +34,10 @@ struct fmap_entry {
 /**
  * Read a flash entry from the fdt
  *
- * @param node Reference to node to read
- * @param name         Name of node being read
+ * @param node         Reference to node to read
  * @param entry                Place to put offset and size of this node
  * @return 0 if ok, -ve on error
  */
-int of_read_fmap_entry(ofnode node, const char *name,
-                      struct fmap_entry *entry);
+int ofnode_read_fmap_entry(ofnode node, struct fmap_entry *entry);
 
 #endif