+static int karo_fdt_disable_node_phandle(void *blob, const char *parent,
+ const char *name)
+{
+ const uint32_t *ph;
+ int off;
+
+ off = fdt_path_offset(blob, parent);
+ if (off < 0) {
+ printf("Failed to find node '%s'\n", parent);
+ return off;
+ }
+
+ ph = fdt_getprop(blob, off, name, NULL);
+ if (ph == NULL) {
+ printf("Failed to find '%s' phandle in node '%s'\n", name,
+ fdt_get_name(blob, off, NULL));
+ return -FDT_ERR_NOTFOUND;
+ }
+
+ off = fdt_node_offset_by_phandle(blob, fdt32_to_cpu(*ph));
+ if (off <= 0) {
+ printf("Failed to find '%s' node via phandle %04x\n",
+ name, fdt32_to_cpu(*ph));
+ return -FDT_ERR_NOTFOUND;
+ }
+ return fdt_set_node_status(blob, off, FDT_STATUS_DISABLED, 0);
+}
+