/* Return: pointer to handle if successful, else appropriate error value.  */
const struct ti_sci_handle* ti_sci_get_by_phandle(struct udevice *dev, const char *property)
/* Return: pointer to handle if successful, else appropriate error value.  */
const struct ti_sci_handle* ti_sci_get_by_phandle(struct udevice *dev, const char *property)
{
	struct ti_sci_info *entry, *info = NULL;
	u32 phandle, err;
	ofnode node;
	err = ofnode_read_u32(dev_ofnode(dev), property, &phandle);
	if (err)
		return ERR_PTR(err);
	node = ofnode_get_by_phandle(phandle);
	if (!ofnode_valid(node))
		return ERR_PTR(-EINVAL);
	list_for_each_entry(entry, &ti_sci_list, list)
		if (ofnode_equal(dev_ofnode(entry->dev), node)) {
			info = entry;
			break;
		}
	if (!info)
		return ERR_PTR(-ENODEV);
	return &info->handle;
}