dm: reset: Update uclass to support livetree
Update the reset domain uclass to support livetree. Fix the xlate() method
which has no callers.
Signed-off-by: Simon Glass <sjg@chromium.org>
diff --git a/drivers/reset/reset-uclass.c b/drivers/reset/reset-uclass.c
index e92b24f..de3695f 100644
--- a/drivers/reset/reset-uclass.c
+++ b/drivers/reset/reset-uclass.c
@@ -18,7 +18,7 @@
}
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 @@
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 @@
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 @@
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 38c716ff..50fbeb1 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 @@
* @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.
*