mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Sven Peter" <sven@svenpeter.dev>
To: "Andy Shevchenko" <andriy.shevchenko@linux.intel.com>,
	"Janne Grunau" <j@jannau.net>
Cc: linux-usb@vger.kernel.org, stable@kernel.org,
	"Thinh Nguyen" <Thinh.Nguyen@synopsys.com>,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	"Andrey Smirnov" <andrew.smirnov@gmail.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/1] usb: dwc3: Do not get extcon device when usb-role-switch is used
Date: Mon, 07 Nov 2022 17:00:47 +0100	[thread overview]
Message-ID: <0bc7b309-6f3b-4821-81d0-435671d64e2f@app.fastmail.com> (raw)
In-Reply-To: <Y2jrQgj53z/mhHmm@smile.fi.intel.com>

On Mon, Nov 7, 2022, at 12:25, Andy Shevchenko wrote:
> On Sun, Nov 06, 2022 at 10:48:04PM +0100, Janne Grunau wrote:
>> The change breaks device tree based platforms with PHY device and use
>> usb-role-switch instead of an extcon switch. extcon_find_edev_by_node()
>> will return EPROBE_DEFER if it can not find a device so probing without
>> an extcon device will be deferred indefinitely. Fix this by
>> explicitly checking for usb-role-switch.
>> At least the out-of-tree USB3 support on Apple silicon based platforms
>> using dwc3 with tipd USB Type-C and PD controller is affected by this
>> issue.
>
> We don't care about out-of-tree modules, do we?
>
> OTOH, the problem you are trying to workaround is probably in a (mis)use of
> deferred probe somewhere.
>
> Btw, does it prevent the system boot or you just see the extcon in the list of
> deferred devices after booting?

Which extcon? The commit description already mentions that the issue is that there
is no extcon and that the dwc3 probe gets stuck with EPROBE_DEFER forever.

This happens because the code after Janne's new check looks for the PHY and then
just assumes that if the PHY has a "port" that the other end always is an extcon.
It then tries extcon_find_edev_by_node which will always fail with EPROBE_DEFER
if that node never registers an extcon.

If "usb-role-switch" is used and configured in the DT there is no extcon.
There actually cannot ever be a working extcon with "usb-role-switch" because
the very first thing dwc3_drd_init does is to look for a role switch partner
and then skip the entire extcon setup:

int dwc3_drd_init(struct dwc3 *dwc)
{
	int ret, irq;

	if (ROLE_SWITCH &&
	    device_property_read_bool(dwc->dev, "usb-role-switch"))
		return dwc3_setup_role_switch(dwc);
[....]


This entire issue was actually first fixed in ab7aa2866d29, then broken
again in 0f0101719138 due to a merge resolution, then fixed again with
7a84e7353e23 (where we actually had a brief discussion about this already
on the ML) and then broken again in d182c2e1bc92.

Janne's fix is much less subtle and should hopefully survive this time.

For the patch:

Reviewed-by: Sven Peter <sven@svenpeter.dev>


Best,

Sven

  reply	other threads:[~2022-11-07 16:01 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-06 21:48 Janne Grunau
2022-11-07 11:25 ` Andy Shevchenko
2022-11-07 16:00   ` Sven Peter [this message]
2022-11-08  2:02 ` Thinh Nguyen
2022-11-08 15:43   ` Greg Kroah-Hartman
2022-11-08 17:54     ` Thinh Nguyen

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=0bc7b309-6f3b-4821-81d0-435671d64e2f@app.fastmail.com \
    --to=sven@svenpeter.dev \
    --cc=Thinh.Nguyen@synopsys.com \
    --cc=andrew.smirnov@gmail.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=j@jannau.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=stable@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

all inboxes | Powered by JetHome®