Linux-USB Archive mirror
 help / color / mirror / Atom feed
From: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
To: Krishna Kurapati <quic_kriskura@quicinc.com>
Cc: Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
	Rob Herring <robh@kernel.org>,
	Bjorn Andersson <andersson@kernel.org>,
	Wesley Cheng <quic_wcheng@quicinc.com>,
	Konrad Dybcio <konrad.dybcio@linaro.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Conor Dooley <conor+dt@kernel.org>,
	Thinh Nguyen <Thinh.Nguyen@synopsys.com>,
	Felipe Balbi <balbi@kernel.org>, Johan Hovold <johan@kernel.org>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	"linux-arm-msm@vger.kernel.org" <linux-arm-msm@vger.kernel.org>,
	"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"quic_ppratap@quicinc.com" <quic_ppratap@quicinc.com>,
	"quic_jackp@quicinc.com" <quic_jackp@quicinc.com>,
	Bjorn Andersson <quic_bjorande@quicinc.com>
Subject: Re: [PATCH v21 9/9] usb: dwc3: qcom: Add multiport suspend/resume support for wrapper
Date: Wed, 24 Apr 2024 01:18:38 +0000	[thread overview]
Message-ID: <20240424011835.mcbt4o5rlqh4n6zo@synopsys.com> (raw)
In-Reply-To: <20240420044901.884098-10-quic_kriskura@quicinc.com>

On Sat, Apr 20, 2024, Krishna Kurapati wrote:
> Power event IRQ is used for wakeup either when the controller is
> SuperSpeed capable but is missing an SuperSpeed PHY interrupt, or when
> the GIC is not capable of detecting DP/DM High-Speed PHY interrupts.
> 
> The Power event IRQ stat register indicates whether the High-Speed
> phy entered and exited L2 successfully during suspend and resume.
> Indicate the same for all ports of a multiport controller.
> 
> Signed-off-by: Krishna Kurapati <quic_kriskura@quicinc.com>
> Reviewed-by: Bjorn Andersson <quic_bjorande@quicinc.com>
> ---
>  drivers/usb/dwc3/dwc3-qcom.c | 23 +++++++++++++++++------
>  1 file changed, 17 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/usb/dwc3/dwc3-qcom.c b/drivers/usb/dwc3/dwc3-qcom.c
> index b6f13bb14e2c..88fb6706a18d 100644
> --- a/drivers/usb/dwc3/dwc3-qcom.c
> +++ b/drivers/usb/dwc3/dwc3-qcom.c
> @@ -36,7 +36,6 @@
>  #define PIPE3_PHYSTATUS_SW			BIT(3)
>  #define PIPE_UTMI_CLK_DIS			BIT(8)
>  
> -#define PWR_EVNT_IRQ_STAT_REG			0x58
>  #define PWR_EVNT_LPM_IN_L2_MASK			BIT(4)
>  #define PWR_EVNT_LPM_OUT_L2_MASK		BIT(5)
>  
> @@ -55,6 +54,13 @@
>  /* Qualcomm SoCs with multiport support has up to 4 ports */
>  #define DWC3_QCOM_MAX_PORTS	4
>  
> +static const u32 pwr_evnt_irq_stat_reg[DWC3_QCOM_MAX_PORTS] = {
> +	0x58,
> +	0x1dc,
> +	0x228,
> +	0x238,
> +};
> +
>  struct dwc3_qcom_port {
>  	int			qusb2_phy_irq;
>  	int			dp_hs_phy_irq;
> @@ -424,9 +430,11 @@ static int dwc3_qcom_suspend(struct dwc3_qcom *qcom, bool wakeup)
>  	if (qcom->is_suspended)
>  		return 0;
>  
> -	val = readl(qcom->qscratch_base + PWR_EVNT_IRQ_STAT_REG);
> -	if (!(val & PWR_EVNT_LPM_IN_L2_MASK))
> -		dev_err(qcom->dev, "HS-PHY not in L2\n");
> +	for (i = 0; i < qcom->num_ports; i++) {
> +		val = readl(qcom->qscratch_base + pwr_evnt_irq_stat_reg[i]);
> +		if (!(val & PWR_EVNT_LPM_IN_L2_MASK))
> +			dev_err(qcom->dev, "port-%d HS-PHY not in L2\n", i + 1);
> +	}
>  
>  	for (i = qcom->num_clocks - 1; i >= 0; i--)
>  		clk_disable_unprepare(qcom->clks[i]);
> @@ -475,8 +483,11 @@ static int dwc3_qcom_resume(struct dwc3_qcom *qcom, bool wakeup)
>  		dev_warn(qcom->dev, "failed to enable interconnect: %d\n", ret);
>  
>  	/* Clear existing events from PHY related to L2 in/out */
> -	dwc3_qcom_setbits(qcom->qscratch_base, PWR_EVNT_IRQ_STAT_REG,
> -			  PWR_EVNT_LPM_IN_L2_MASK | PWR_EVNT_LPM_OUT_L2_MASK);
> +	for (i = 0; i < qcom->num_ports; i++) {
> +		dwc3_qcom_setbits(qcom->qscratch_base,
> +				  pwr_evnt_irq_stat_reg[i],
> +				  PWR_EVNT_LPM_IN_L2_MASK | PWR_EVNT_LPM_OUT_L2_MASK);
> +	}
>  
>  	qcom->is_suspended = false;
>  
> -- 
> 2.34.1
> 

Acked-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>

Thanks,
Thinh

  parent reply	other threads:[~2024-04-24  1:18 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-20  4:48 [PATCH v21 0/9] Add multiport support for DWC3 controllers Krishna Kurapati
2024-04-20  4:48 ` [PATCH v21 1/9] dt-bindings: usb: Add bindings for multiport properties on DWC3 controller Krishna Kurapati
2024-04-20 11:28   ` Krzysztof Kozlowski
2024-04-22  6:54   ` Johan Hovold
2024-04-20  4:48 ` [PATCH v21 2/9] usb: dwc3: core: Access XHCI address space temporarily to read port info Krishna Kurapati
2024-04-22  6:56   ` Johan Hovold
2024-04-24  1:11   ` Thinh Nguyen
2024-04-20  4:48 ` [PATCH v21 3/9] usb: dwc3: core: Skip setting event buffers for host only controllers Krishna Kurapati
2024-04-20  4:48 ` [PATCH v21 4/9] usb: dwc3: core: Refactor PHY logic to support Multiport Controller Krishna Kurapati
2024-04-22  7:10   ` Johan Hovold
2024-04-24  1:13   ` Thinh Nguyen
2024-04-20  4:48 ` [PATCH v21 5/9] dt-bindings: usb: qcom,dwc3: Add bindings for SC8280 Multiport Krishna Kurapati
2024-04-20 11:31   ` Krzysztof Kozlowski
2024-04-20 13:53     ` Krishna Kurapati PSSNV
2024-04-21 14:03       ` Krzysztof Kozlowski
2024-04-22  7:12   ` Johan Hovold
2024-04-22  7:13   ` Johan Hovold
2024-04-20  4:48 ` [PATCH v21 6/9] usb: dwc3: qcom: Add helper function to request wakeup interrupts Krishna Kurapati
2024-04-22  7:18   ` Johan Hovold
2024-04-24  1:14   ` Thinh Nguyen
2024-04-20  4:48 ` [PATCH v21 7/9] usb: dwc3: qcom: Refactor IRQ handling in glue driver Krishna Kurapati
2024-04-22  7:20   ` Johan Hovold
2024-04-24  1:17   ` Thinh Nguyen
2024-04-20  4:49 ` [PATCH v21 8/9] usb: dwc3: qcom: Enable wakeup for applicable ports of multiport Krishna Kurapati
2024-04-24  1:18   ` Thinh Nguyen
2024-04-20  4:49 ` [PATCH v21 9/9] usb: dwc3: qcom: Add multiport suspend/resume support for wrapper Krishna Kurapati
2024-04-22  7:22   ` Johan Hovold
2024-04-24  1:18   ` Thinh Nguyen [this message]
2024-04-22  1:21 ` [PATCH v21 0/9] Add multiport support for DWC3 controllers Minda Chen
2024-04-22  7:27   ` Johan Hovold
2024-04-22  7:40 ` Johan Hovold

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=20240424011835.mcbt4o5rlqh4n6zo@synopsys.com \
    --to=thinh.nguyen@synopsys.com \
    --cc=andersson@kernel.org \
    --cc=balbi@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=johan@kernel.org \
    --cc=konrad.dybcio@linaro.org \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=quic_bjorande@quicinc.com \
    --cc=quic_jackp@quicinc.com \
    --cc=quic_kriskura@quicinc.com \
    --cc=quic_ppratap@quicinc.com \
    --cc=quic_wcheng@quicinc.com \
    --cc=robh@kernel.org \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).