All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC 4/8] clk: qcom: gcc-sm8450: Keep usb30 prim gdsc on during runtime suspend
@ 2023-10-17 13:19 Krishna Kurapati
  2023-10-19  0:58 ` Stephen Boyd
  0 siblings, 1 reply; 4+ messages in thread
From: Krishna Kurapati @ 2023-10-17 13:19 UTC (permalink / raw)
  To: Andy Gross, Bjorn Andersson, Konrad Dybcio, Michael Turquette,
	Stephen Boyd
  Cc: linux-clk, linux-kernel, linux-arm-msm, quic_ppratap, quic_jackp,
	Krishna Kurapati

When runtime suspend happens in host mode, if cable is removed at this
instant, it triggers a resume where a xhci register access is done when
gdsc is not on leading to a crash. Keep usb30 prim gdsc as on during
runtime suspend to avoid this crash.

Signed-off-by: Krishna Kurapati <quic_kriskura@quicinc.com>
---
Note: I am not sure if this is the right way or setting GDSC flags to
PWRSTS_RET_ON is the right approach. So for now made this change to
keep GDSC during host mode runtime suspend.

 drivers/clk/qcom/gcc-sm8450.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/clk/qcom/gcc-sm8450.c b/drivers/clk/qcom/gcc-sm8450.c
index 75635d40a12d..47cde2de93a2 100644
--- a/drivers/clk/qcom/gcc-sm8450.c
+++ b/drivers/clk/qcom/gcc-sm8450.c
@@ -2996,6 +2996,7 @@ static struct gdsc usb30_prim_gdsc = {
 	.gdscr = 0x49004,
 	.pd = {
 		.name = "usb30_prim_gdsc",
+		.flags = GENPD_FLAG_RPM_ALWAYS_ON,
 	},
 	.pwrsts = PWRSTS_OFF_ON,
 };
-- 
2.42.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [RFC 4/8] clk: qcom: gcc-sm8450: Keep usb30 prim gdsc on during runtime suspend
  2023-10-17 13:19 [RFC 4/8] clk: qcom: gcc-sm8450: Keep usb30 prim gdsc on during runtime suspend Krishna Kurapati
@ 2023-10-19  0:58 ` Stephen Boyd
  2023-10-19  8:37   ` Krishna Kurapati PSSNV
  0 siblings, 1 reply; 4+ messages in thread
From: Stephen Boyd @ 2023-10-19  0:58 UTC (permalink / raw)
  To: Andy Gross, Bjorn Andersson, Konrad Dybcio, Krishna Kurapati,
	Michael Turquette
  Cc: linux-clk, linux-kernel, linux-arm-msm, quic_ppratap, quic_jackp,
	Krishna Kurapati

Quoting Krishna Kurapati (2023-10-17 06:19:44)
> When runtime suspend happens in host mode, if cable is removed at this
> instant, it triggers a resume where a xhci register access is done when
> gdsc is not on leading to a crash. Keep usb30 prim gdsc as on during
> runtime suspend to avoid this crash.
> 
> Signed-off-by: Krishna Kurapati <quic_kriskura@quicinc.com>
> ---
> Note: I am not sure if this is the right way or setting GDSC flags to
> PWRSTS_RET_ON is the right approach. So for now made this change to

Does using PWRSTS_RET_ON work? Does the GDSC support being turned off or
is the lowest power state retention?

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [RFC 4/8] clk: qcom: gcc-sm8450: Keep usb30 prim gdsc on during runtime suspend
  2023-10-19  0:58 ` Stephen Boyd
@ 2023-10-19  8:37   ` Krishna Kurapati PSSNV
  2023-10-20  0:05     ` Stephen Boyd
  0 siblings, 1 reply; 4+ messages in thread
From: Krishna Kurapati PSSNV @ 2023-10-19  8:37 UTC (permalink / raw)
  To: Stephen Boyd, Andy Gross, Bjorn Andersson, Konrad Dybcio,
	Michael Turquette
  Cc: linux-clk, linux-kernel, linux-arm-msm, quic_ppratap, quic_jackp,
	Udipto Goswami



On 10/19/2023 6:28 AM, Stephen Boyd wrote:
> Quoting Krishna Kurapati (2023-10-17 06:19:44)
>> When runtime suspend happens in host mode, if cable is removed at this
>> instant, it triggers a resume where a xhci register access is done when
>> gdsc is not on leading to a crash. Keep usb30 prim gdsc as on during
>> runtime suspend to avoid this crash.
>>
>> Signed-off-by: Krishna Kurapati <quic_kriskura@quicinc.com>
>> ---
>> Note: I am not sure if this is the right way or setting GDSC flags to
>> PWRSTS_RET_ON is the right approach. So for now made this change to
> 
> Does using PWRSTS_RET_ON work? Does the GDSC support being turned off or
> is the lowest power state retention?

I didn't see any issue when I put it as PWRSTS_RET_ON. If the GDSC is 
off, when we remove cable in host mode, we see a crash because of xhci 
register access. But when I try putting PWRSTS_RET_ON / 
CLK_RPM_ALWAYS_ON it doesn't crash.

Regard,
Krishna,

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [RFC 4/8] clk: qcom: gcc-sm8450: Keep usb30 prim gdsc on during runtime suspend
  2023-10-19  8:37   ` Krishna Kurapati PSSNV
@ 2023-10-20  0:05     ` Stephen Boyd
  0 siblings, 0 replies; 4+ messages in thread
From: Stephen Boyd @ 2023-10-20  0:05 UTC (permalink / raw)
  To: Andy Gross, Bjorn Andersson, Konrad Dybcio,
	Krishna Kurapati PSSNV, Michael Turquette
  Cc: linux-clk, linux-kernel, linux-arm-msm, quic_ppratap, quic_jackp,
	Udipto Goswami

Quoting Krishna Kurapati PSSNV (2023-10-19 01:37:20)
> 
> 
> On 10/19/2023 6:28 AM, Stephen Boyd wrote:
> > Quoting Krishna Kurapati (2023-10-17 06:19:44)
> >> When runtime suspend happens in host mode, if cable is removed at this
> >> instant, it triggers a resume where a xhci register access is done when
> >> gdsc is not on leading to a crash. Keep usb30 prim gdsc as on during
> >> runtime suspend to avoid this crash.
> >>
> >> Signed-off-by: Krishna Kurapati <quic_kriskura@quicinc.com>
> >> ---
> >> Note: I am not sure if this is the right way or setting GDSC flags to
> >> PWRSTS_RET_ON is the right approach. So for now made this change to
> > 
> > Does using PWRSTS_RET_ON work? Does the GDSC support being turned off or
> > is the lowest power state retention?
> 
> I didn't see any issue when I put it as PWRSTS_RET_ON. If the GDSC is 
> off, when we remove cable in host mode, we see a crash because of xhci 
> register access. But when I try putting PWRSTS_RET_ON / 
> CLK_RPM_ALWAYS_ON it doesn't crash.
> 

You need to find out if the GDSC only supports retention mode. Otherwise
it sounds like the xhci register access is happening when the genpd is
off, and thus the driver needs to power on the device before accessing
it.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-10-20  0:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-17 13:19 [RFC 4/8] clk: qcom: gcc-sm8450: Keep usb30 prim gdsc on during runtime suspend Krishna Kurapati
2023-10-19  0:58 ` Stephen Boyd
2023-10-19  8:37   ` Krishna Kurapati PSSNV
2023-10-20  0:05     ` Stephen Boyd

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.