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;
}
} 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",
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));
void karo_fdt_fixup_flexcan(void *blob, int xcvr_present)
{
int ret;
- const char *xcvr_status = xcvr_present ? "disabled" : NULL;
+ const char *xcvr_status = "disabled";
const char *otg_mode = getenv("otg_mode");
-#ifndef CONFIG_SYS_LVDS_IF
if (xcvr_present) {
if (karo_fdt_flexcan_enabled(blob)) {
- karo_fdt_set_lcd_pins(blob, "lcdif_23bit_pins_a");
- xcvr_status = NULL;
- } else {
+ if (!is_lvds()) {
+ debug("Changing LCD to use 23bits only\n");
+ karo_fdt_set_lcd_pins(blob, "lcdif_23bit_pins_a");
+ xcvr_status = NULL;
+ }
+ } else if (!is_lvds()) {
+ debug("Changing LCD to use 24bits\n");
karo_fdt_set_lcd_pins(blob, "lcdif_24bit_pins_a");
}
} else {
- karo_fdt_set_lcd_pins(blob, "lcdif_24bit_pins_a");
+ int off = fdt_path_offset(blob, "can0");
+
+ if (off >= 0)
+ fdt_delprop(blob, off, "xceiver-supply");
+ off = fdt_path_offset(blob, "can1");
+ if (off >= 0)
+ fdt_delprop(blob, off, "xceiver-supply");
+ if (!is_lvds())
+ karo_fdt_set_lcd_pins(blob, "lcdif_24bit_pins_a");
}
-#endif
+
if (otg_mode && strcmp(otg_mode, "host") == 0)
karo_fdt_enable_node(blob, "can1", 0);
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");
}
return lvds_chan_mask;
}
+#endif
+
+int karo_fdt_get_backlight_polarity(const void *blob)
+{
+#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) {
+ /*
+ * 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);
+ if (!prop)
+ printf("'pwms' property not found\n");
+ else
+ debug("'pwms' property has len %d\n", len);
+
+ len /= sizeof(u32);
+ if (prop && len > 3) {
+ const u32 *data = (const u32 *)prop->data;
+ return fdt32_to_cpu(data[3]) == 0;
+ }
+ return 0;
+}