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>
This commit is contained in:
Simon Glass 2017-05-18 20:09:50 -06:00
parent 424b2fe939
commit 40a475e841
2 changed files with 12 additions and 13 deletions

View 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;

View 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.
*