[PATCH 1/1] usb: dwc3: dwc3-generic-plat: Add optional VBUS regulator support

Thinh Nguyen Thinh.Nguyen at synopsys.com
Tue Mar 17 17:29:56 PDT 2026


On Mon, Mar 16, 2026, Chukun Pan wrote:
> Some boards provide USB VBUS through a controllable regulator. Add

If we have a specific user, please include it in the change log. In this
case, it looks like spacemit k1 as noted under the "---" line?

> support for the optional vbus-supply property so the regulator can
> be properly managed instead of left always-on. Note that this does
> not apply to USB Hub downstream ports with different VBUS supplies.
> 
> The enabled and disabled actions of the regulator are handled
> automatically by devm_regulator_get_enable_optional().
> 
> Signed-off-by: Chukun Pan <amadeus at jmu.edu.cn>
> ---
> The vbus-supply property has been declared in spacemit,k1-dwc3.yaml
> https://urldefense.com/v3/__https://github.com/torvalds/linux/blob/master/Documentation/devicetree/bindings/usb/spacemit*2Ck1-dwc3.yaml*L71__;JSM!!A4F2R9G_pg!eSm5G5c19zlsLK5DkD6WgQ1EgAL-mnHHd90kLRFzrgMWts8d0dfjK5HglU-SA4RLpLkgMEcA0Z2GgfsR_cBJnnub$ 
> ---
>  drivers/usb/dwc3/dwc3-generic-plat.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/drivers/usb/dwc3/dwc3-generic-plat.c b/drivers/usb/dwc3/dwc3-generic-plat.c
> index e846844e0023..83b4e4d69ba9 100644
> --- a/drivers/usb/dwc3/dwc3-generic-plat.c
> +++ b/drivers/usb/dwc3/dwc3-generic-plat.c
> @@ -12,6 +12,7 @@
>  #include <linux/reset.h>
>  #include <linux/regmap.h>
>  #include <linux/mfd/syscon.h>
> +#include <linux/regulator/consumer.h>
>  #include "glue.h"
>  
>  #define EIC7700_HSP_BUS_FILTER_EN	BIT(0)
> @@ -113,6 +114,10 @@ static int dwc3_generic_probe(struct platform_device *pdev)
>  	if (ret < 0)
>  		return dev_err_probe(dev, ret, "failed to get clocks\n");
>  
> +	ret = devm_regulator_get_enable_optional(dev, "vbus");
> +	if (ret && ret != -ENODEV)
> +		return dev_err_probe(dev, ret, "failed to enable VBUS\n");
> +

The name "vbus" here maybe confusing. This regulator powers the
controller chip and not neccessarily turning on VBUS of the USB bus
power line. Is there a common/different name for regulator id? At least
fix the error message.

Thanks,
Thinh

>  	dwc3g->num_clocks = ret;
>  	dwc3g->dwc.dev = dev;
>  	probe_data.dwc = &dwc3g->dwc;
> -- 
> 2.34.1
> 


More information about the linux-riscv mailing list