mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Minas Harutyunyan <Minas.Harutyunyan@synopsys.com>
To: Michael Grzeschik <m.grzeschik@pengutronix.de>,
	Minas Harutyunyan <Minas.Harutyunyan@synopsys.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: "linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"kernel@pengutronix.de" <kernel@pengutronix.de>
Subject: Re: [PATCH] usb: dwc2: also exit clock_gating when stopping udc while suspended
Date: Fri, 18 Apr 2025 12:25:56 +0000	[thread overview]
Message-ID: <add96b11-ddec-84b9-c17e-6dabe0dd8ffd@synopsys.com> (raw)
In-Reply-To: <20250417-dwc2_clock_gating-v1-1-8ea7c4d53d73@pengutronix.de>



On 4/17/25 21:40, Michael Grzeschik wrote:
> It is possible that the gadget will be disabled, while the udc is
> suspended. When enabling the udc in that case, the clock gating
> will not be enabled again. Leaving the phy unclocked. Even when the
> udc is not enabled, connecting this powered but not clocked phy leads
> to enumeration errors on the host side.
> 
> To ensure that the clock gating will be in an valid state, we ensure
> that the clock gating will be enabled before stopping the udc.
> 
> Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>

Acked-by: Minas Harutyunyan <hminas@synopsys.com>

> ---
>   drivers/usb/dwc2/gadget.c | 6 ++++++
>   1 file changed, 6 insertions(+)
> 
> diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c
> index 300ea4969f0cf..f323fb5597b32 100644
> --- a/drivers/usb/dwc2/gadget.c
> +++ b/drivers/usb/dwc2/gadget.c
> @@ -4604,6 +4604,12 @@ static int dwc2_hsotg_udc_stop(struct usb_gadget *gadget)
>   	if (!hsotg)
>   		return -ENODEV;
>   
> +	/* Exit clock gating when driver is stopped. */
> +	if (hsotg->params.power_down == DWC2_POWER_DOWN_PARAM_NONE &&
> +	    hsotg->bus_suspended && !hsotg->params.no_clock_gating) {
> +		dwc2_gadget_exit_clock_gating(hsotg, 0);
> +	}
> +
>   	/* all endpoints should be shutdown */
>   	for (ep = 1; ep < hsotg->num_of_eps; ep++) {
>   		if (hsotg->eps_in[ep])
> 
> ---
> base-commit: cfb2e2c57aef75a414c0f18445c7441df5bc13be
> change-id: 20250417-dwc2_clock_gating-579a87fcdf93
> 
> Best regards,

      reply	other threads:[~2025-04-18 13:03 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-17 17:40 Michael Grzeschik
2025-04-18 12:25 ` Minas Harutyunyan [this message]

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=add96b11-ddec-84b9-c17e-6dabe0dd8ffd@synopsys.com \
    --to=minas.harutyunyan@synopsys.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=kernel@pengutronix.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=m.grzeschik@pengutronix.de \
    /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

all inboxes | Powered by JetHome®