[U-Boot] [PATCH v2 59/71] dm: reset: Update uclass to support livetree

Simon Glass sjg at chromium.org
Wed May 10 14:21:38 UTC 2017


Update the reset domain uclass to support livetree. Fix the xlate() method
which has no callers.

Signed-off-by: Simon Glass <sjg at chromium.org>
---

Changes in v2: None

 drivers/reset/reset-uclass.c | 21 ++++++++++-----------
 include/reset-uclass.h       |  4 ++--
 2 files changed, 12 insertions(+), 13 deletions(-)

diff --git a/drivers/reset/reset-uclass.c b/drivers/reset/reset-uclass.c
index e92b24fa34..de3695ffaa 100644
--- a/drivers/reset/reset-uclass.c
+++ b/drivers/reset/reset-uclass.c
@@ -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;
diff --git a/include/reset-uclass.h b/include/reset-uclass.h
index 38c716ff89..50fbeb10d6 100644
--- a/include/reset-uclass.h
+++ b/include/reset-uclass.h
@@ -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.
 	 *
-- 
2.13.0.rc2.291.g57267f2277-goog



More information about the U-Boot mailing list