- ph = fdt_getprop(blob, off, phy, NULL);
- if (ph == NULL) {
- printf("Failed to find '%s' phandle in node '%s'\n", phy,
- fdt_get_name(blob, off, NULL));
- goto out;
+ ph = fdt_getprop(blob, off, phy, NULL);
+ if (ph == NULL) {
+ printf("Failed to find '%s' phandle in node '%s'\n",
+ phy, node);
+ ret = -FDT_ERR_NOTFOUND;
+ goto out;
+ }
+ off = fdt_node_offset_by_phandle(blob, fdt32_to_cpu(*ph));
+ if (off < 0) {
+ printf("Failed to find '%s' node via phandle %04x\n",
+ phy, fdt32_to_cpu(*ph));
+ ret = off;
+ goto out;
+ }
+ ph = fdt_getprop(blob, off, phy_supply, NULL);
+ if (ph == NULL) {
+ debug("Failed to find '%s' phandle in node '%s'\n",
+ phy_supply, fdt_get_name(blob, off, NULL));
+ ret = -FDT_ERR_NOTFOUND;
+ goto disable_otg;
+ }
+ ret = fdt_node_offset_by_phandle(blob, fdt32_to_cpu(*ph));
+ if (ret > 0) {
+ debug("Disabling node %s via phandle %s:%s\n",
+ fdt_get_name(blob, ret, NULL),
+ fdt_get_name(blob, off, NULL), phy_supply);
+ ret = fdt_set_node_status(blob, ret,
+ FDT_STATUS_DISABLED, 0);
+ }