<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/drivers/usb/dwc3/core.c, branch linux-6.2.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-6.2.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-6.2.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2023-05-11T14:10:49Z</updated>
<entry>
<title>USB: dwc3: fix runtime pm imbalance on unbind</title>
<updated>2023-05-11T14:10:49Z</updated>
<author>
<name>Johan Hovold</name>
</author>
<published>2023-04-04T07:25:15Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=3eef1c5af52c58ed96f3318188abf92225d122d0'/>
<id>urn:sha1:3eef1c5af52c58ed96f3318188abf92225d122d0</id>
<content type='text'>
commit 44d257e9012ee8040e41d224d0e5bfb5ef5427ea upstream.

Make sure to balance the runtime PM usage count on driver unbind by
adding back the pm_runtime_allow() call that had been erroneously
removed.

Fixes: 266d0493900a ("usb: dwc3: core: don't trigger runtime pm when remove driver")
Cc: stable@vger.kernel.org	# 5.9
Cc: Li Jun &lt;jun.li@nxp.com&gt;
Acked-by: Thinh Nguyen &lt;Thinh.Nguyen@synopsys.com&gt;
Signed-off-by: Johan Hovold &lt;johan+linaro@kernel.org&gt;
Link: https://lore.kernel.org/r/20230404072524.19014-3-johan+linaro@kernel.org
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>USB: dwc3: fix runtime pm imbalance on probe errors</title>
<updated>2023-05-11T14:10:49Z</updated>
<author>
<name>Johan Hovold</name>
</author>
<published>2023-04-04T07:25:14Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=fd3148ea29cf06614c21450987aaf50262ae8233'/>
<id>urn:sha1:fd3148ea29cf06614c21450987aaf50262ae8233</id>
<content type='text'>
commit 9a8ad10c9f2e0925ff26308ec6756b93fc2f4977 upstream.

Make sure not to suspend the device when probe fails to avoid disabling
clocks and phys multiple times.

Fixes: 328082376aea ("usb: dwc3: fix runtime PM in error path")
Cc: stable@vger.kernel.org      # 4.8
Cc: Roger Quadros &lt;rogerq@ti.com&gt;
Acked-by: Thinh Nguyen &lt;Thinh.Nguyen@synopsys.com&gt;
Signed-off-by: Johan Hovold &lt;johan+linaro@kernel.org&gt;
Link: https://lore.kernel.org/r/20230404072524.19014-2-johan+linaro@kernel.org
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>usb: dwc3: core: defer probe on ulpi_read_id timeout</title>
<updated>2022-12-08T15:48:07Z</updated>
<author>
<name>Ferry Toth</name>
</author>
<published>2022-12-05T20:15:27Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=63130462c919ece0ad0d9bb5a1f795ef8d79687e'/>
<id>urn:sha1:63130462c919ece0ad0d9bb5a1f795ef8d79687e</id>
<content type='text'>
Since commit 0f0101719138 ("usb: dwc3: Don't switch OTG -&gt; peripheral
if extcon is present"), Dual Role support on Intel Merrifield platform
broke due to rearranging the call to dwc3_get_extcon().

It appears to be caused by ulpi_read_id() masking the timeout on the first
test write. In the past dwc3 probe continued by calling dwc3_core_soft_reset()
followed by dwc3_get_extcon() which happend to return -EPROBE_DEFER.
On deferred probe ulpi_read_id() finally succeeded. Due to above mentioned
rearranging -EPROBE_DEFER is not returned and probe completes without phy.

On Intel Merrifield the timeout on the first test write issue is reproducible
but it is difficult to find the root cause. Using a mainline kernel and
rootfs with buildroot ulpi_read_id() succeeds. As soon as adding
ftrace / bootconfig to find out why, ulpi_read_id() fails and we can't
analyze the flow. Using another rootfs ulpi_read_id() fails even without
adding ftrace. We suspect the issue is some kind of timing / race, but
merely retrying ulpi_read_id() does not resolve the issue.

As we now changed ulpi_read_id() to return -ETIMEDOUT in this case, we
need to handle the error by calling dwc3_core_soft_reset() and request
-EPROBE_DEFER. On deferred probe ulpi_read_id() is retried and succeeds.

Fixes: ef6a7bcfb01c ("usb: ulpi: Support device discovery via DT")
Cc: stable@vger.kernel.org
Acked-by: Thinh Nguyen &lt;Thinh.Nguyen@synopsys.com&gt;
Signed-off-by: Ferry Toth &lt;ftoth@exalondelft.nl&gt;
Link: https://lore.kernel.org/r/20221205201527.13525-3-ftoth@exalondelft.nl
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>usb: dwc3: Fix race between dwc3_set_mode and __dwc3_set_mode</title>
<updated>2022-11-29T12:27:49Z</updated>
<author>
<name>Sven Peter</name>
</author>
<published>2022-11-28T16:15:26Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=62c73bfea048e66168df09da6d3e4510ecda40bb'/>
<id>urn:sha1:62c73bfea048e66168df09da6d3e4510ecda40bb</id>
<content type='text'>
dwc-&gt;desired_dr_role is changed by dwc3_set_mode inside a spinlock but
then read by __dwc3_set_mode outside of that lock. This can lead to a
race condition when very quick successive role switch events happen:

CPU A
	dwc3_set_mode(DWC3_GCTL_PRTCAP_HOST) // first role switch event
		spin_lock_irqsave(&amp;dwc-&gt;lock, flags);
		dwc-&gt;desired_dr_role = mode; // DWC3_GCTL_PRTCAP_HOST
		spin_unlock_irqrestore(&amp;dwc-&gt;lock, flags);
		queue_work(system_freezable_wq, &amp;dwc-&gt;drd_work);

CPU B
	__dwc3_set_mode
		// ....
		spin_lock_irqsave(&amp;dwc-&gt;lock, flags);
		// desired_dr_role is DWC3_GCTL_PRTCAP_HOST
		dwc3_set_prtcap(dwc, dwc-&gt;desired_dr_role);
		spin_unlock_irqrestore(&amp;dwc-&gt;lock, flags);

CPU A
	dwc3_set_mode(DWC3_GCTL_PRTCAP_DEVICE) // second event
		spin_lock_irqsave(&amp;dwc-&gt;lock, flags);
		dwc-&gt;desired_dr_role = mode; // DWC3_GCTL_PRTCAP_DEVICE
		spin_unlock_irqrestore(&amp;dwc-&gt;lock, flags);

CPU B (continues running __dwc3_set_mode)
	switch (dwc-&gt;desired_dr_role) { // DWC3_GCTL_PRTCAP_DEVICE
	// ....
	case DWC3_GCTL_PRTCAP_DEVICE:
		// ....
		ret = dwc3_gadget_init(dwc);

We then have DWC3_GCTL.DWC3_GCTL_PRTCAPDIR = DWC3_GCTL_PRTCAP_HOST and
dwc-&gt;current_dr_role = DWC3_GCTL_PRTCAP_HOST but initialized the
controller in device mode. It's also possible to get into a state
where both host and device are intialized at the same time.
Fix this race by creating a local copy of desired_dr_role inside
__dwc3_set_mode while holding dwc-&gt;lock.

Fixes: 41ce1456e1db ("usb: dwc3: core: make dwc3_set_mode() work properly")
Cc: stable &lt;stable@kernel.org&gt;
Acked-by: Thinh Nguyen &lt;Thinh.Nguyen@synopsys.com&gt;
Signed-off-by: Sven Peter &lt;sven@svenpeter.dev&gt;
Link: https://lore.kernel.org/r/20221128161526.79730-1-sven@svenpeter.dev
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>usb: dwc3: Do not get extcon device when usb-role-switch is used</title>
<updated>2022-11-08T18:37:27Z</updated>
<author>
<name>Janne Grunau</name>
</author>
<published>2022-11-06T21:48:04Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=d68cc25b7c7fb3034c5a5b5f350a0b858c6d5a45'/>
<id>urn:sha1:d68cc25b7c7fb3034c5a5b5f350a0b858c6d5a45</id>
<content type='text'>
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.

Fixes: d182c2e1bc92 ("usb: dwc3: Don't switch OTG -&gt; peripheral if extcon is present")
Cc: stable@kernel.org
Signed-off-by: Janne Grunau &lt;j@jannau.net&gt;
Acked-by: Thinh Nguyen &lt;Thinh.Nguyen@synopsys.com&gt;
Reviewed-by: Sven Peter &lt;sven@svenpeter.dev&gt;
Link: https://lore.kernel.org/r/20221106214804.2814-1-j@jannau.net
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>usb: dwc3: Don't switch OTG -&gt; peripheral if extcon is present</title>
<updated>2022-10-22T10:29:43Z</updated>
<author>
<name>Andrey Smirnov</name>
</author>
<published>2022-10-17T23:35:10Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=d182c2e1bc92084c038b44c618f29589a4de9f66'/>
<id>urn:sha1:d182c2e1bc92084c038b44c618f29589a4de9f66</id>
<content type='text'>
If the extcon device exists, get the mode from the extcon device. If
the controller is DRD and the driver is unable to determine the mode,
only then default the dr_mode to USB_DR_MODE_PERIPHERAL.

Reported-by: Steev Klimaszewski &lt;steev@kali.org&gt;
Fixes: 7a84e7353e23 ("Revert "usb: dwc3: Don't switch OTG -&gt; peripheral if extcon is present"")
Cc: stable &lt;stable@kernel.org&gt;
Reviewed-by: Thinh Nguyen &lt;Thinh.Nguyen@synopsys.com&gt;
Signed-off-by: Andrey Smirnov &lt;andrew.smirnov@gmail.com&gt;
Signed-off-by: Andy Shevchenko &lt;andriy.shevchenko@linux.intel.com&gt;
Tested-by: Steev Klimaszewski &lt;steev@kali.org&gt;
Acked-by: Thinh Nguyen &lt;Thinh.Nguyen@synopsys.com&gt;
Link: https://lore.kernel.org/r/20221017233510.53336-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>Revert "usb: dwc3: Don't switch OTG -&gt; peripheral if extcon is present"</title>
<updated>2022-09-30T11:56:38Z</updated>
<author>
<name>Andy Shevchenko</name>
</author>
<published>2022-09-27T15:53:32Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=7a84e7353e23202d4f82b05093af4db2b26e6768'/>
<id>urn:sha1:7a84e7353e23202d4f82b05093af4db2b26e6768</id>
<content type='text'>
This reverts commit 0f01017191384e3962fa31520a9fd9846c3d352f.

As pointed out by Ferry this breaks Dual Role support on
Intel Merrifield platforms.

Fixes: 0f0101719138 ("usb: dwc3: Don't switch OTG -&gt; peripheral if extcon is present")
Reported-by: Ferry Toth &lt;fntoth@gmail.com&gt;
Cc: stable@vger.kernel.org
Signed-off-by: Andy Shevchenko &lt;andriy.shevchenko@linux.intel.com&gt;
Tested-by: Ferry Toth &lt;fntoth@gmail.com&gt; # for Merrifield
Reviewed-by: Sven Peter &lt;sven@svenpeter.dev&gt;
Link: https://lore.kernel.org/r/20220927155332.10762-3-andriy.shevchenko@linux.intel.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>Revert "USB: fixup for merge issue with "usb: dwc3: Don't switch OTG -&gt; peripheral if extcon is present""</title>
<updated>2022-09-30T11:56:38Z</updated>
<author>
<name>Andy Shevchenko</name>
</author>
<published>2022-09-27T15:53:31Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=2adc960ce79d3231b02f820daeee434542fe2911'/>
<id>urn:sha1:2adc960ce79d3231b02f820daeee434542fe2911</id>
<content type='text'>
This reverts commit 8bd6b8c4b1009d7d2662138d6bdc6fe58a9274c5.

Prerequisite revert for the reverting of the original commit 0f0101719138.

Fixes: 8bd6b8c4b100 ("USB: fixup for merge issue with "usb: dwc3: Don't switch OTG -&gt; peripheral if extcon is present"")
Fixes: 0f0101719138 ("usb: dwc3: Don't switch OTG -&gt; peripheral if extcon is present")
Reported-by: Ferry Toth &lt;fntoth@gmail.com&gt;
Cc: stable@vger.kernel.org
Signed-off-by: Andy Shevchenko &lt;andriy.shevchenko@linux.intel.com&gt;
Tested-by: Ferry Toth &lt;fntoth@gmail.com&gt; # for Merrifield
Link: https://lore.kernel.org/r/20220927155332.10762-2-andriy.shevchenko@linux.intel.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>Merge 6.0-rc7 into usb-next</title>
<updated>2022-09-26T08:38:21Z</updated>
<author>
<name>Greg Kroah-Hartman</name>
</author>
<published>2022-09-26T08:38:21Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=67102bd31b4e31abb0abbc390381212a2d65db72'/>
<id>urn:sha1:67102bd31b4e31abb0abbc390381212a2d65db72</id>
<content type='text'>
We need the USB fixes in here for other follow-on changes to be able to
be applied successfully.

Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>usb: dwc3: core: fix some leaks in probe</title>
<updated>2022-09-22T13:52:31Z</updated>
<author>
<name>Dan Carpenter</name>
</author>
<published>2022-09-22T11:22:08Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=2a735e4b5580a2a6bbd6572109b4c4f163c57462'/>
<id>urn:sha1:2a735e4b5580a2a6bbd6572109b4c4f163c57462</id>
<content type='text'>
The dwc3_get_properties() function calls:

	dwc-&gt;usb_psy = power_supply_get_by_name(usb_psy_name);

so there is some additional clean up required on these error paths.

Fixes: 6f0764b5adea ("usb: dwc3: add a power supply for current control")
Signed-off-by: Dan Carpenter &lt;dan.carpenter@oracle.com&gt;
Link: https://lore.kernel.org/r/YyxFYFnP53j9sCg+@kili
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
</feed>
