From: Krishna Kurapati PSSNV <quic_kriskura@quicinc.com>
To: Johan Hovold <johan@kernel.org>
Cc: Andy Gross <agross@kernel.org>,
Bjorn Andersson <bjorn.andersson@linaro.org>,
Felipe Balbi <balbi@kernel.org>,
"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
Philipp Zabel <p.zabel@pengutronix.de>,
<linux-arm-msm@vger.kernel.org>, <linux-usb@vger.kernel.org>,
<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2] usb: dwc3: qcom: Defer dwc3-qcom probe if dwc3 isn't probed properly
Date: Thu, 4 Aug 2022 10:20:20 +0530 [thread overview]
Message-ID: <284b0697-e630-8900-9ed6-d83d2f99619c@quicinc.com> (raw)
In-Reply-To: <YulMeEngNyoBOGBP@hovoldconsulting.com>
On 8/2/2022 9:40 PM, Johan Hovold wrote:
> On Fri, Jul 15, 2022 at 06:51:52PM +0530, Krishna Kurapati wrote:
>> On SC7180 devices, it is observed that dwc3 probing is deferred
>> because device_links_check_suppliers() finds that '88e3000.phy'
>> isn't ready yet.
>>
>> As a part of its probe call, dwc3-qcom driver checks if dwc3 core
>> is wakeup capable or not. If the dwc3 core is wakeup capable, driver
>> configures dwc-qcom's power domain to be always ON. Also it configures
>> dp/dm interrupts accordingly to support wakeup from system suspend.
>>
>> More info regarding the same can be found at:
>> commit d9be8d5c5b03 ("usb: dwc3: qcom: Keep power domain on to retain controller status")
>> commit 6895ea55c385 ("usb: dwc3: qcom: Configure wakeup interrupts during suspend")
>>
>> In the event, dwc3 probe gets deferred and is processed after dwc3-qcom
>> probe, driver ends up reading the wakeup capability of dwc3 core as false
>> leading to instability in suspend/resume path.
>>
>> To avoid this scenario, ensure dwc3_probe is successful by checking
>> if appropriate driver is assigned to it or not after the of_platform_populate
>> call. If it isn't then defer dwc3-qcom probe as well.
>>
>> Fixes: 649f5c842ba3 ("usb: dwc3: core: Host wake up support from system suspend")
>> Signed-off-by: Krishna Kurapati <quic_kriskura@quicinc.com>
>> ---
>> v2: Set return value to EPROBE_DEFER to drop reference to dwc3 node
>>
>> drivers/usb/dwc3/dwc3-qcom.c | 3 +++
>> 1 file changed, 3 insertions(+)
>>
>> diff --git a/drivers/usb/dwc3/dwc3-qcom.c b/drivers/usb/dwc3/dwc3-qcom.c
>> index 7703655..6676b39 100644
>> --- a/drivers/usb/dwc3/dwc3-qcom.c
>> +++ b/drivers/usb/dwc3/dwc3-qcom.c
>> @@ -722,6 +722,9 @@ static int dwc3_qcom_of_register_core(struct platform_device *pdev)
>> dev_err(dev, "failed to get dwc3 platform device\n");
>> }
>>
>> + if (!qcom->dwc3->dev.driver)
>> + ret = -EPROBE_DEFER;
>> +
>> node_put:
>> of_node_put(dwc3_np);
> NAK.
>
> We should not be adding hacks like this to the driver.
>
> There are other ways to avoid this, but please take a look at the
> following series which makes the problem identified by this patch go
> away first:
>
> https://lore.kernel.org/all/20220802151404.1797-1-johan+linaro@kernel.org
>
> Johan
Hi Johan,
Thanks for the review and patches. Agreed that if we are moving
wakeup-source to glue driver, dwc3 probe getting deferred won't be an issue.
Regards,
Krishna,
prev parent reply other threads:[~2022-08-04 4:50 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-15 13:21 [PATCH v2] usb: dwc3: qcom: Defer dwc3-qcom probe if dwc3 isn't probed properly Krishna Kurapati
2022-07-15 20:41 ` Matthias Kaehlcke
2022-07-16 4:13 ` Krishna Kurapati PSSNV
2022-07-27 17:31 ` Matthias Kaehlcke
2022-08-02 16:10 ` Johan Hovold
2022-08-04 4:50 ` Krishna Kurapati PSSNV [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=284b0697-e630-8900-9ed6-d83d2f99619c@quicinc.com \
--to=quic_kriskura@quicinc.com \
--cc=agross@kernel.org \
--cc=balbi@kernel.org \
--cc=bjorn.andersson@linaro.org \
--cc=gregkh@linuxfoundation.org \
--cc=johan@kernel.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=p.zabel@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