mirror of
https://github.com/Fishwaldo/u-boot.git
synced 2025-04-19 21:01:31 +00:00
usb: host: xhci-rockchip: use fixed regulator to control vbus
Use fixed regulator to control the voltage of vbus. Enable vbus supply when usb start and disable vbus supply when usb stop. Signed-off-by: Meng Dongyang <daniel.meng@rock-chips.com> Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com> Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
This commit is contained in:
parent
e85f00abda
commit
26a8b80fac
1 changed files with 18 additions and 18 deletions
|
@ -48,7 +48,7 @@ static int xhci_usb_ofdata_to_platdata(struct udevice *dev)
|
||||||
*/
|
*/
|
||||||
plat->hcd_base = devfdt_get_addr(dev);
|
plat->hcd_base = devfdt_get_addr(dev);
|
||||||
if (plat->hcd_base == FDT_ADDR_T_NONE) {
|
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;
|
return -ENXIO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,17 +62,15 @@ static int xhci_usb_ofdata_to_platdata(struct udevice *dev)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (plat->phy_base == FDT_ADDR_T_NONE) {
|
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;
|
return -ENXIO;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(CONFIG_DM_USB) && defined(CONFIG_DM_REGULATOR)
|
|
||||||
/* Vbus regulator */
|
/* Vbus regulator */
|
||||||
ret = device_get_supply_regulator(dev, "vbus-supply",
|
ret = device_get_supply_regulator(dev, "vbus-supply",
|
||||||
&plat->vbus_supply);
|
&plat->vbus_supply);
|
||||||
if (ret)
|
if (ret)
|
||||||
debug("Can't get vbus supply\n");
|
debug("Can't get VBus regulator!\n");
|
||||||
#endif
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -121,7 +119,7 @@ static int rockchip_xhci_core_init(struct rockchip_xhci *rkxhci,
|
||||||
|
|
||||||
ret = dwc3_core_init(rkxhci->dwc3_reg);
|
ret = dwc3_core_init(rkxhci->dwc3_reg);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
debug("failed to initialize core\n");
|
error("failed to initialize core\n");
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -150,15 +148,17 @@ static int xhci_usb_probe(struct udevice *dev)
|
||||||
hcor = (struct xhci_hcor *)((uint64_t)ctx->hcd +
|
hcor = (struct xhci_hcor *)((uint64_t)ctx->hcd +
|
||||||
HC_LENGTH(xhci_readl(&ctx->hcd->cr_capbase)));
|
HC_LENGTH(xhci_readl(&ctx->hcd->cr_capbase)));
|
||||||
|
|
||||||
#if defined(CONFIG_DM_USB) && defined(CONFIG_DM_REGULATOR)
|
if (plat->vbus_supply) {
|
||||||
ret = regulator_set_enable(plat->vbus_supply, true);
|
ret = regulator_set_enable(plat->vbus_supply, true);
|
||||||
if (ret)
|
if (ret) {
|
||||||
debug("XHCI: Failed to enable vbus supply\n");
|
error("XHCI: failed to set VBus supply\n");
|
||||||
#endif
|
return ret;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ret = rockchip_xhci_core_init(ctx, dev);
|
ret = rockchip_xhci_core_init(ctx, dev);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
debug("XHCI: failed to initialize controller\n");
|
error("XHCI: failed to initialize controller\n");
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -178,13 +178,13 @@ static int xhci_usb_remove(struct udevice *dev)
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
#if defined(CONFIG_DM_USB) && defined(CONFIG_DM_REGULATOR)
|
if (plat->vbus_supply) {
|
||||||
ret = regulator_set_enable(plat->vbus_supply, false);
|
ret = regulator_set_enable(plat->vbus_supply, false);
|
||||||
if (ret)
|
if (ret)
|
||||||
debug("XHCI: Failed to disable vbus supply\n");
|
error("XHCI: failed to set VBus supply\n");
|
||||||
#endif
|
}
|
||||||
|
|
||||||
return 0;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct udevice_id xhci_usb_ids[] = {
|
static const struct udevice_id xhci_usb_ids[] = {
|
||||||
|
|
Loading…
Add table
Reference in a new issue