]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - board/karo/common/fdt.c
karo: fdt: remove 'vbus-supply' from usbotg node when otg_mode=peripheral
[karo-tx-uboot.git] / board / karo / common / fdt.c
index 08fe69588c723db2765473250afaef21a91a08c4..387208c78e4e317e36ce96a4079121c39812337f 100644 (file)
@@ -209,7 +209,7 @@ static int karo_fdt_disable_node_phandle(void *blob, const char *parent,
 
        ph = fdt_getprop(blob, off, name, NULL);
        if (ph == NULL) {
-               printf("Failed to find '%s' phandle in node '%s'\n", name,
+               debug("Failed to find '%s' phandle in node '%s'\n", name,
                        fdt_get_name(blob, off, NULL));
                return -FDT_ERR_NOTFOUND;
        }
@@ -250,6 +250,7 @@ void karo_fdt_fixup_usb_otg(void *blob, const char *node, const char *phy)
        } else if (otg_mode && strcmp(otg_mode, "otg") == 0) {
                debug("Setting dr_mode to 'host'\n");
                ret = fdt_setprop_string(blob, off, "dr_mode", "otg");
+               disable_phy_pins = 0;
        } else {
                if (otg_mode && strcmp(otg_mode, "none") != 0)
                        printf("Invalid 'otg_mode' setting '%s'; disabling usbotg port\n",
@@ -272,7 +273,11 @@ void karo_fdt_fixup_usb_otg(void *blob, const char *node, const char *phy)
                        goto out;
 
                ret = karo_fdt_disable_node_phandle(blob, node, phy);
+       } else if (disable_phy_pins) {
+               debug("Removing 'vbus-supply' from usbotg node\n");
+               fdt_delprop(blob, off, "vbus-supply");
        }
+
 out:
        if (ret)
                printf("Failed to update usbotg: %s\n", fdt_strerror(ret));
@@ -734,6 +739,7 @@ int karo_fdt_update_fb_mode(void *blob, const char *name)
        return off;
 }
 
+#ifdef CONFIG_SYS_LVDS_IF
 int karo_fdt_get_lcd_bus_width(const void *blob, int default_width)
 {
        int off = fdt_path_offset(blob, "display");
@@ -786,16 +792,29 @@ u8 karo_fdt_get_lvds_channels(const void *blob)
        }
        return lvds_chan_mask;
 }
+#endif
 
 int karo_fdt_get_backlight_polarity(const void *blob)
 {
-       int off = fdt_path_offset(blob, "/backlight");
+#ifdef CONFIG_SYS_LVDS_IF
+       const char *backlight_node = "/backlight0";
+#else
+       const char *backlight_node = "/backlight";
+#endif
+       int off = fdt_path_offset(blob, "backlight"); /* first try alias */
        const struct fdt_property *prop;
        int len;
 
        if (off < 0) {
-               printf("/backlight node not found in DT\n");
-               return off;
+               /*
+                * if no 'backlight' alias exists try finding '/backlight0'
+                * or '/backlight' depending on LVDS or not
+                */
+               off = fdt_path_offset(blob, backlight_node);
+               if (off < 0) {
+                       printf("/backlight node not found in DT\n");
+                       return off;
+               }
        }
 
        prop = fdt_get_property(blob, off, "pwms", &len);