*/
plat->hcd_base = devfdt_get_addr(dev);
if (plat->hcd_base == FDT_ADDR_T_NONE) {
- debug("Can't get the XHCI register base address\n");
+ error("Can't get the XHCI register base address\n");
return -ENXIO;
}
}
if (plat->phy_base == FDT_ADDR_T_NONE) {
- debug("Can't get the usbphy register address\n");
+ error("Can't get the usbphy register address\n");
return -ENXIO;
}
-#if defined(CONFIG_DM_USB) && defined(CONFIG_DM_REGULATOR)
/* Vbus regulator */
ret = device_get_supply_regulator(dev, "vbus-supply",
&plat->vbus_supply);
if (ret)
- debug("Can't get vbus supply\n");
-#endif
+ debug("Can't get VBus regulator!\n");
return 0;
}
ret = dwc3_core_init(rkxhci->dwc3_reg);
if (ret) {
- debug("failed to initialize core\n");
+ error("failed to initialize core\n");
return ret;
}
hcor = (struct xhci_hcor *)((uint64_t)ctx->hcd +
HC_LENGTH(xhci_readl(&ctx->hcd->cr_capbase)));
-#if defined(CONFIG_DM_USB) && defined(CONFIG_DM_REGULATOR)
- ret = regulator_set_enable(plat->vbus_supply, true);
- if (ret)
- debug("XHCI: Failed to enable vbus supply\n");
-#endif
+ if (plat->vbus_supply) {
+ ret = regulator_set_enable(plat->vbus_supply, true);
+ if (ret) {
+ error("XHCI: failed to set VBus supply\n");
+ return ret;
+ }
+ }
ret = rockchip_xhci_core_init(ctx, dev);
if (ret) {
- debug("XHCI: failed to initialize controller\n");
+ error("XHCI: failed to initialize controller\n");
return ret;
}
if (ret)
return ret;
-#if defined(CONFIG_DM_USB) && defined(CONFIG_DM_REGULATOR)
- ret = regulator_set_enable(plat->vbus_supply, false);
- if (ret)
- debug("XHCI: Failed to disable vbus supply\n");
-#endif
+ if (plat->vbus_supply) {
+ ret = regulator_set_enable(plat->vbus_supply, false);
+ if (ret)
+ error("XHCI: failed to set VBus supply\n");
+ }
- return 0;
+ return ret;
}
static const struct udevice_id xhci_usb_ids[] = {