+
+ return node_offset;
+}
+
+void fdt_fixup_dr_usb(void *blob, bd_t *bd)
+{
+ const char *modes[] = { "host", "peripheral", "otg" };
+ const char *phys[] = { "ulpi", "utmi" };
+ const char *mode = NULL;
+ const char *phy_type = NULL;
+ char usb1_defined = 0;
+ int usb_mode_off = -1;
+ int usb_phy_off = -1;
+ char str[5];
+ int i, j;
+
+ for (i = 1; i <= FSL_MAX_NUM_USB_CTRLS; i++) {
+ int mode_idx = -1, phy_idx = -1;
+ sprintf(str, "%s%d", "usb", i);
+ if (hwconfig(str)) {
+ for (j = 0; j < sizeof(modes); j++) {
+ if (hwconfig_subarg_cmp(str, "dr_mode",
+ modes[j])) {
+ mode_idx = j;
+ break;
+ }
+ }
+ for (j = 0; j < sizeof(phys); j++) {
+ if (hwconfig_subarg_cmp(str, "phy_type",
+ phys[j])) {
+ phy_idx = j;
+ break;
+ }
+ }
+ if (mode_idx >= 0)
+ usb_mode_off = fdt_fixup_usb_mode_phy_type(blob,
+ modes[mode_idx], NULL, usb_mode_off);
+ if (phy_idx >= 0)
+ usb_phy_off = fdt_fixup_usb_mode_phy_type(blob,
+ NULL, phys[phy_idx], usb_phy_off);
+ if (!strcmp(str, "usb1"))
+ usb1_defined = 1;
+ if (mode_idx < 0 && phy_idx < 0)
+ printf("WARNING: invalid phy or mode\n");
+ }
+ }
+ if (!usb1_defined) {
+ int usb_off = -1;
+ mode = getenv("usb_dr_mode");
+ phy_type = getenv("usb_phy_type");
+ if (!mode && !phy_type)
+ return;
+ fdt_fixup_usb_mode_phy_type(blob, mode, phy_type, usb_off);
+ }