dm: reset: Update uclass to support livetree
authorSimon Glass <sjg@chromium.org>
Fri, 19 May 2017 02:09:50 +0000 (20:09 -0600)
committerSimon Glass <sjg@chromium.org>
Thu, 1 Jun 2017 13:03:15 +0000 (07:03 -0600)
Update the reset domain uclass to support livetree. Fix the xlate() method
which has no callers.

Signed-off-by: Simon Glass <sjg@chromium.org>
drivers/reset/reset-uclass.c
include/reset-uclass.h

index e92b24fa34ac7b767b7077bb7a4034fc2310f283..de3695ffaafc8a581a79c156e6284efd8b694d8f 100644 (file)
@@ -18,7 +18,7 @@ static inline struct reset_ops *reset_dev_ops(struct udevice *dev)
 }
 
 static int reset_of_xlate_default(struct reset_ctl *reset_ctl,
-                                 struct fdtdec_phandle_args *args)
+                                 struct ofnode_phandle_args *args)
 {
        debug("%s(reset_ctl=%p)\n", __func__, reset_ctl);
 
@@ -35,7 +35,7 @@ static int reset_of_xlate_default(struct reset_ctl *reset_ctl,
 int reset_get_by_index(struct udevice *dev, int index,
                       struct reset_ctl *reset_ctl)
 {
-       struct fdtdec_phandle_args args;
+       struct ofnode_phandle_args args;
        int ret;
        struct udevice *dev_reset;
        struct reset_ops *ops;
@@ -43,20 +43,20 @@ int reset_get_by_index(struct udevice *dev, int index,
        debug("%s(dev=%p, index=%d, reset_ctl=%p)\n", __func__, dev, index,
              reset_ctl);
 
-       ret = fdtdec_parse_phandle_with_args(gd->fdt_blob, dev_of_offset(dev),
-                                            "resets", "#reset-cells", 0,
-                                            index, &args);
+       ret = dev_read_phandle_with_args(dev, "resets", "#reset-cells", 0,
+                                         index, &args);
        if (ret) {
-               debug("%s: fdtdec_parse_phandle_with_args failed: %d\n",
+               debug("%s: fdtdec_parse_phandle_with_args() failed: %d\n",
                      __func__, ret);
                return ret;
        }
 
-       ret = uclass_get_device_by_of_offset(UCLASS_RESET, args.node,
-                                            &dev_reset);
+       ret = uclass_get_device_by_ofnode(UCLASS_RESET, args.node,
+                                         &dev_reset);
        if (ret) {
-               debug("%s: uclass_get_device_by_of_offset failed: %d\n",
+               debug("%s: uclass_get_device_by_ofnode() failed: %d\n",
                      __func__, ret);
+               debug("%s %d\n", ofnode_get_name(args.node), args.args[0]);
                return ret;
        }
        ops = reset_dev_ops(dev_reset);
@@ -88,8 +88,7 @@ int reset_get_by_name(struct udevice *dev, const char *name,
        debug("%s(dev=%p, name=%s, reset_ctl=%p)\n", __func__, dev, name,
              reset_ctl);
 
-       index = fdt_stringlist_search(gd->fdt_blob, dev_of_offset(dev),
-                                     "reset-names", name);
+       index = dev_read_stringlist_search(dev, "reset-names", name);
        if (index < 0) {
                debug("fdt_stringlist_search() failed: %d\n", index);
                return index;
index 38c716ff8953cfe364b68f4b8124587fdaeaf582..50fbeb10d6833fab460412b9f7a66e564e4b368c 100644 (file)
@@ -11,7 +11,7 @@
 
 #include <reset.h>
 
-struct fdtdec_phandle_args;
+struct ofnode_phandle_args;
 struct udevice;
 
 /**
@@ -38,7 +38,7 @@ struct reset_ops {
         * @return 0 if OK, or a negative error code.
         */
        int (*of_xlate)(struct reset_ctl *reset_ctl,
-                       struct fdtdec_phandle_args *args);
+                       struct ofnode_phandle_args *args);
        /**
         * request - Request a translated reset control.
         *