[PATCH 3/6] usb: dwc3: gadget: only resume USB2 PHY in <=HIGHSPEED

Mattijs Korpershoek mkorpershoek at baylibre.com
Tue May 14 14:55:10 CEST 2024


Hi Alexander,

Thank you for the patch.

On ven., avril 12, 2024 at 22:26, "A. Sverdlin" <alexander.sverdlin at siemens.com> wrote:

> From: Felipe Balbi <felipe.balbi at linux.intel.com>
>
> Upstream Linux commit ab2a92e7a608.
>
> As a micro-power optimization, let's only resume the
> USB2 PHY if we're working on <=HIGHSPEED. If we're
> gonna work on SUPERSPEED or SUPERSPEED+, there's no
> point in resuming the USB2 PHY.
>
> Fixes: 2b0f11df84bb ("usb: dwc3: gadget: clear SUSPHY bit before ep cmds")
> Signed-off-by: Felipe Balbi <felipe.balbi at linux.intel.com>
> Signed-off-by: Alexander Sverdlin <alexander.sverdlin at siemens.com>

Reviewed-by: Mattijs Korpershoek <mkorpershoek at baylibre.com>

> ---
>  drivers/usb/dwc3/gadget.c | 12 +++++++-----
>  1 file changed, 7 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
> index 8f6513752f085..00845dbadd27a 100644
> --- a/drivers/usb/dwc3/gadget.c
> +++ b/drivers/usb/dwc3/gadget.c
> @@ -314,11 +314,13 @@ int dwc3_send_gadget_ep_cmd(struct dwc3 *dwc, unsigned ep,
>  	 * We will also set SUSPHY bit to what it was before returning as stated
>  	 * by the same section on Synopsys databook.
>  	 */
> -	reg = dwc3_readl(dwc->regs, DWC3_GUSB2PHYCFG(0));
> -	if (unlikely(reg & DWC3_GUSB2PHYCFG_SUSPHY)) {
> -		susphy = true;
> -		reg &= ~DWC3_GUSB2PHYCFG_SUSPHY;
> -		dwc3_writel(dwc->regs, DWC3_GUSB2PHYCFG(0), reg);
> +	if (dwc->gadget.speed <= USB_SPEED_HIGH) {
> +		reg = dwc3_readl(dwc->regs, DWC3_GUSB2PHYCFG(0));
> +		if (unlikely(reg & DWC3_GUSB2PHYCFG_SUSPHY)) {
> +			susphy = true;
> +			reg &= ~DWC3_GUSB2PHYCFG_SUSPHY;
> +			dwc3_writel(dwc->regs, DWC3_GUSB2PHYCFG(0), reg);
> +		}
>  	}
>  
>  	dwc3_writel(dwc->regs, DWC3_DEPCMDPAR0(ep), params->param0);
> -- 
> 2.44.0


More information about the U-Boot mailing list