public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Ze Huang" <huang.ze@linux.dev>
To: "Chukun Pan" <amadeus@jmu.edu.cn>,
	"Thinh Nguyen" <Thinh.Nguyen@synopsys.com>
Cc: "Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	"Ze Huang" <huang.ze@linux.dev>, "Yixun Lan" <dlan@kernel.org>,
	<linux-riscv@lists.infradead.org>, <linux-kernel@vger.kernel.org>,
	<linux-usb@vger.kernel.org>, <spacemit@lists.linux.dev>
Subject: Re: [PATCH 1/1] usb: dwc3: dwc3-generic-plat: Add optional VBUS regulator support
Date: Tue, 17 Mar 2026 12:15:02 +0800	[thread overview]
Message-ID: <DH4RL1NROT5O.2BN4PC3IH3DV2@linux.dev> (raw)
In-Reply-To: <20260316080000.3130372-1-amadeus@jmu.edu.cn>

On Mon Mar 16, 2026 at 4:00 PM CST, Chukun Pan wrote:
> Some boards provide USB VBUS through a controllable regulator. Add
> 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@jmu.edu.cn>
> ---
> The vbus-supply property has been declared in spacemit,k1-dwc3.yaml
> https://github.com/torvalds/linux/blob/master/Documentation/devicetree/bindings/usb/spacemit%2Ck1-dwc3.yaml#L71
> ---
>  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");
> +
>  	dwc3g->num_clocks = ret;
>  	dwc3g->dwc.dev = dev;
>  	probe_data.dwc = &dwc3g->dwc;

This could be useful for boards with direct-attached VBUS.

Just to clarify, the vbus-supply binding is for potential direct-attached
designs. For current boards (like K1 BPI-F3 and Jupiter) with the VL817 hub,
we'll use onboard_usb_dev instead.

  reply	other threads:[~2026-03-17  4:16 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-16  8:00 [PATCH 1/1] usb: dwc3: dwc3-generic-plat: Add optional VBUS regulator support Chukun Pan
2026-03-17  4:15 ` Ze Huang [this message]
2026-03-18  0:29 ` Thinh Nguyen
2026-03-18  6:30   ` Chukun Pan
2026-03-18 23:15     ` Thinh Nguyen
2026-03-19  6:26       ` Chukun Pan
2026-03-19 21:46         ` Thinh Nguyen
2026-03-20  6:36           ` Chukun Pan
2026-03-20  7:45             ` Ze Huang
2026-03-20  8:18               ` Chukun Pan
2026-03-20  9:50                 ` Ze Huang
2026-03-20 10:40                   ` Chukun Pan
2026-03-20 15:05                     ` Ze Huang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=DH4RL1NROT5O.2BN4PC3IH3DV2@linux.dev \
    --to=huang.ze@linux.dev \
    --cc=Thinh.Nguyen@synopsys.com \
    --cc=amadeus@jmu.edu.cn \
    --cc=dlan@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=spacemit@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox