devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johan Hovold <johan@kernel.org>
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>,
	devicetree@vger.kernel.org, linux-arm-msm@vger.kernel.org,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
	quic_ppratap@quicinc.com, quic_jackp@quicinc.com,
	Johan Hovold <johan+linaro@kernel.org>
Subject: Re: [PATCH v17 7/9] usb: dwc3: qcom: Refactor IRQ handling in glue driver
Date: Tue, 26 Mar 2024 11:44:03 +0100	[thread overview]
Message-ID: <ZgKm89rq4D8SqYQL@hovoldconsulting.com> (raw)
In-Reply-To: <20240326102809.2940123-8-quic_kriskura@quicinc.com>

On Tue, Mar 26, 2024 at 03:58:07PM +0530, Krishna Kurapati wrote:
> On multiport supported controllers, each port has its own DP/DM
> and SS (if super speed capable) interrupts. As per the bindings,
> their interrupt names differ from standard ones having "_x" added
> as suffix (x indicates port number). Identify from the interrupt
> names whether the controller is a multiport controller or not.
> Refactor dwc3_qcom_setup_irq() call to parse multiport interrupts
> along with non-multiport ones accordingly..
> 
> Signed-off-by: Krishna Kurapati <quic_kriskura@quicinc.com>
> Reviewed-by: Johan Hovold <johan+linaro@kernel.org>
> ---
>  drivers/usb/dwc3/dwc3-qcom.c | 137 ++++++++++++++++++++++++++---------
>  1 file changed, 103 insertions(+), 34 deletions(-) 

> -static int dwc3_qcom_setup_irq(struct platform_device *pdev)
> +static int dwc3_qcom_setup_port_irq(struct platform_device *pdev, int port_num, bool is_multiport)

Here you use "port_num", when it's really a (zero-based) port index.

Please change to "port_index".

>  {
>  	struct dwc3_qcom *qcom = platform_get_drvdata(pdev);
> +	const char *irq_name;
>  	int irq;
>  	int ret;
>  
> -	irq = platform_get_irq_byname_optional(pdev, "qusb2_phy");
> +	if (is_multiport)
> +		irq_name = devm_kasprintf(&pdev->dev, GFP_KERNEL, "dp_hs_phy_%d", port_num + 1);
> +	else
> +		irq_name = devm_kasprintf(&pdev->dev, GFP_KERNEL, "dp_hs_phy_irq");
> +	if (!irq_name)
> +		return -ENOMEM;

> +static int dwc3_qcom_find_num_ports(struct platform_device *pdev)
> +{
> +	char irq_name[14];
> +	int port_index;
> +	int irq;
> +
> +	irq = platform_get_irq_byname_optional(pdev, "dp_hs_phy_1");
> +	if (irq <= 0)
> +		return 1;
> +
> +	for (port_index = 2; port_index <= DWC3_MAX_PORTS; port_index++) {

And here you use port_index, when it's really a one-based port number.

I explicitly used "port" when we discussed the update here for this
reason ("port_num" works too).

Please fix this last thing in a v18 and we're good to go.

> +		sprintf(irq_name, "dp_hs_phy_%d", port_index);
> +
> +		irq = platform_get_irq_byname_optional(pdev, irq_name);
> +		if (irq <= 0)
> +			return port_index - 1;
> +	}
> +
> +	return DWC3_MAX_PORTS;
> +}

Johan

  reply	other threads:[~2024-03-26 10:43 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-26 10:28 [PATCH v17 0/9] Add multiport support for DWC3 controllers Krishna Kurapati
2024-03-26 10:28 ` [PATCH v17 1/9] dt-bindings: usb: Add bindings for multiport properties on DWC3 controller Krishna Kurapati
2024-03-26 10:28 ` [PATCH v17 2/9] usb: dwc3: core: Access XHCI address space temporarily to read port info Krishna Kurapati
2024-03-26 10:28 ` [PATCH v17 3/9] usb: dwc3: core: Skip setting event buffers for host only controllers Krishna Kurapati
2024-03-26 10:28 ` [PATCH v17 4/9] usb: dwc3: core: Refactor PHY logic to support Multiport Controller Krishna Kurapati
2024-03-26 10:28 ` [PATCH v17 5/9] dt-bindings: usb: qcom,dwc3: Add bindings for SC8280 Multiport Krishna Kurapati
2024-03-26 10:28 ` [PATCH v17 6/9] usb: dwc3: qcom: Add helper function to request wakeup interrupts Krishna Kurapati
2024-03-26 10:28 ` [PATCH v17 7/9] usb: dwc3: qcom: Refactor IRQ handling in glue driver Krishna Kurapati
2024-03-26 10:44   ` Johan Hovold [this message]
2024-03-26 10:28 ` [PATCH v17 8/9] usb: dwc3: qcom: Enable wakeup for applicable ports of multiport Krishna Kurapati
2024-03-26 10:28 ` [PATCH v17 9/9] usb: dwc3: qcom: Add multiport suspend/resume support for wrapper Krishna Kurapati

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=ZgKm89rq4D8SqYQL@hovoldconsulting.com \
    --to=johan@kernel.org \
    --cc=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+linaro@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_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 NNTP newsgroup(s).