<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/linux.git/drivers/usb/dwc2, branch v5.4.151</title>
<subtitle>Linux kernel stable tree (mirror)</subtitle>
<id>https://git.radix-linux.su/kernel/linux.git/atom?h=v5.4.151</id>
<link rel='self' href='https://git.radix-linux.su/kernel/linux.git/atom?h=v5.4.151'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/'/>
<updated>2021-09-30T08:09:20+00:00</updated>
<entry>
<title>usb: dwc2: gadget: Fix ISOC transfer complete handling for DDMA</title>
<updated>2021-09-30T08:09:20+00:00</updated>
<author>
<name>Minas Harutyunyan</name>
<email>Minas.Harutyunyan@synopsys.com</email>
</author>
<published>2021-09-11T18:58:30+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=b8c806065160885bfaa64b2d35aa9964457d43a6'/>
<id>urn:sha1:b8c806065160885bfaa64b2d35aa9964457d43a6</id>
<content type='text'>
commit dbe2518b2d8eabffa74dbf7d9fdd7dacddab7fc0 upstream.

When last descriptor in a descriptor list completed with XferComplete
interrupt, core switching to handle next descriptor and assert BNA
interrupt. Both these interrupts are set while dwc2_hsotg_epint()
handler called. Each interrupt should be handled separately: first
XferComplete interrupt then BNA interrupt, otherwise last completed
transfer will not be giveback to function driver as completed
request.

Fixes: 729cac693eec ("usb: dwc2: Change ISOC DDMA flow")
Cc: stable &lt;stable@vger.kernel.org&gt;
Signed-off-by: Minas Harutyunyan &lt;Minas.Harutyunyan@synopsys.com&gt;
Link: https://lore.kernel.org/r/a36981accc26cd674c5d8f8da6164344b94ec1fe.1631386531.git.Minas.Harutyunyan@synopsys.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>usb: dwc2: gadget: Fix ISOC flow for BDMA and Slave</title>
<updated>2021-09-30T08:09:20+00:00</updated>
<author>
<name>Minas Harutyunyan</name>
<email>Minas.Harutyunyan@synopsys.com</email>
</author>
<published>2021-09-09T10:45:15+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=ff275c870e1b8365b0c1844b0b9da37c79cb9789'/>
<id>urn:sha1:ff275c870e1b8365b0c1844b0b9da37c79cb9789</id>
<content type='text'>
commit 91bb163e1e4f88092f50dfaa5a816b658753e4b2 upstream.

According USB spec each ISOC transaction should be performed in a
designated for that transaction interval. On bus errors or delays
in operating system scheduling of client software can result in no
packet being transferred for a (micro)frame. An error indication
should be returned as status to the client software in such a case.

Current implementation in case of missed/dropped interval send same
data in next possible interval instead of reporting missed isoc.

This fix complete requests with -ENODATA if interval elapsed.

HSOTG core in BDMA and Slave modes haven't HW support for
(micro)frames tracking, this is why SW should care about tracking
of (micro)frames. Because of that method and consider operating
system scheduling delays, added few additional checking's of elapsed
target (micro)frame:
1. Immediately before enabling EP to start transfer.
2. With any transfer completion interrupt.
3. With incomplete isoc in/out interrupt.
4. With EP disabled interrupt because of incomplete transfer.
5. With OUT token received while EP disabled interrupt (for OUT
transfers).
6. With NAK replied to IN token interrupt (for IN transfers).

As part of ISOC flow, additionally fixed 'current' and 'target' frame
calculation functions. In HS mode SOF limits provided by DSTS register
is 0x3fff, but in non HS mode this limit is 0x7ff.

Tested by internal tool which also using for dwc3 testing.

Signed-off-by: Minas Harutyunyan &lt;Minas.Harutyunyan@synopsys.com&gt;
Cc: stable &lt;stable@vger.kernel.org&gt;
Link: https://lore.kernel.org/r/95d1423adf4b0f68187c9894820c4b7e964a3f7f.1631175721.git.Minas.Harutyunyan@synopsys.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>usb: dwc2: gadget: Fix sending zero length packet in DDMA mode.</title>
<updated>2021-07-28T11:31:00+00:00</updated>
<author>
<name>Minas Harutyunyan</name>
<email>Minas.Harutyunyan@synopsys.com</email>
</author>
<published>2021-07-20T12:41:24+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=281a94362bbe32c020027a7d6facb37f39723672'/>
<id>urn:sha1:281a94362bbe32c020027a7d6facb37f39723672</id>
<content type='text'>
commit d53dc38857f6dbefabd9eecfcbf67b6eac9a1ef4 upstream.

Sending zero length packet in DDMA mode perform by DMA descriptor
by setting SP (short packet) flag.

For DDMA in function dwc2_hsotg_complete_in() does not need to send
zlp.

Tested by USBCV MSC tests.

Fixes: f71b5e2533de ("usb: dwc2: gadget: fix zero length packet transfers")
Cc: stable &lt;stable@vger.kernel.org&gt;
Signed-off-by: Minas Harutyunyan &lt;Minas.Harutyunyan@synopsys.com&gt;
Link: https://lore.kernel.org/r/967bad78c55dd2db1c19714eee3d0a17cf99d74a.1626777738.git.Minas.Harutyunyan@synopsys.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>usb: dwc2: Don't reset the core after setting turnaround time</title>
<updated>2021-07-14T14:53:42+00:00</updated>
<author>
<name>Clément Lassieur</name>
<email>clement@lassieur.org</email>
</author>
<published>2021-06-03T15:59:21+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=d7e33cc4789b0b484c09f83481473ace5efcd420'/>
<id>urn:sha1:d7e33cc4789b0b484c09f83481473ace5efcd420</id>
<content type='text'>
[ Upstream commit aafe93516b8567ab5864e1f4cd3eeabc54fb0e5a ]

Every time the hub signals a reset while we (device) are hsotg-&gt;connected,
dwc2_hsotg_core_init_disconnected() is called, which in turn calls
dwc2_hs_phy_init().

GUSBCFG.USBTrdTim is cleared upon Core Soft Reset, so if
hsotg-&gt;params.phy_utmi_width is 8-bit, the value of GUSBCFG.USBTrdTim (the
default one: 0x5, corresponding to 16-bit) is always different from
hsotg-&gt;params.phy_utmi_width, thus dwc2_core_reset() is called every
time (usbcfg != usbcfg_old), which causes 2 issues:

1) The call to dwc2_core_reset() does another reset 300us after the initial
Chirp K of the first reset (which should last at least Tuch = 1ms), and
messes up the High-speed Detection Handshake: both hub and device drive
current into the D+ and D- lines at the same time.

2) GUSBCFG.USBTrdTim is cleared by the second reset, so its value is always
the default one (0x5).

Setting GUSBCFG.USBTrdTim after the potential call to dwc2_core_reset()
fixes both issues.  It is now set even when select_phy is false because the
cost of the Core Soft Reset is removed.

Fixes: 1e868545f2bb ("usb: dwc2: gadget: Move gadget phy init into core phy init")
Signed-off-by: Clément Lassieur &lt;clement@lassieur.org&gt;
Link: https://lore.kernel.org/r/20210603155921.940651-1-clement@lassieur.org
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>usb: dwc2: Fix build in periphal-only mode</title>
<updated>2021-06-10T11:37:11+00:00</updated>
<author>
<name>Phil Elwell</name>
<email>phil@raspberrypi.com</email>
</author>
<published>2021-06-08T12:00:49+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=fe4e0bd4c26c8d81bd352ef8a5fa1afc4cba06b4'/>
<id>urn:sha1:fe4e0bd4c26c8d81bd352ef8a5fa1afc4cba06b4</id>
<content type='text'>
In branches to which 24d209dba5a3 ("usb: dwc2: Fix hibernation between
host and device modes.") has been back-ported, the bus_suspended member
of struct dwc2_hsotg is only present in builds that support host-mode.
To avoid having to pull in several more non-Fix commits in order to
get it to compile, wrap the usage of the member in a macro conditional.

Fixes: 24d209dba5a3 ("usb: dwc2: Fix hibernation between host and device modes.")
Signed-off-by: Phil Elwell &lt;phil@raspberrypi.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>usb: dwc2: Fix gadget DMA unmap direction</title>
<updated>2021-05-19T08:08:31+00:00</updated>
<author>
<name>Phil Elwell</name>
<email>phil@raspberrypi.com</email>
</author>
<published>2021-05-06T11:22:00+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=8f536512db87ead2947091e94a73e870053dad6f'/>
<id>urn:sha1:8f536512db87ead2947091e94a73e870053dad6f</id>
<content type='text'>
commit 75a41ce46bae6cbe7d3bb2584eb844291d642874 upstream.

The dwc2 gadget support maps and unmaps DMA buffers as necessary. When
mapping and unmapping it uses the direction of the endpoint to select
the direction of the DMA transfer, but this fails for Control OUT
transfers because the unmap occurs after the endpoint direction has
been reversed for the status phase.

A possible solution would be to unmap the buffer before the direction
is changed, but a safer, less invasive fix is to remember the buffer
direction independently of the endpoint direction.

Fixes: fe0b94abcdf6 ("usb: dwc2: gadget: manage ep0 state in software")
Acked-by: Minas Harutyunyan &lt;Minas.Harutyunyan@synopsys.com&gt;
Cc: stable &lt;stable@vger.kernel.org&gt;
Signed-off-by: Phil Elwell &lt;phil@raspberrypi.com&gt;
Link: https://lore.kernel.org/r/20210506112200.2893922-1-phil@raspberrypi.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>usb: dwc2: Fix hibernation between host and device modes.</title>
<updated>2021-05-14T07:44:23+00:00</updated>
<author>
<name>Artur Petrosyan</name>
<email>Arthur.Petrosyan@synopsys.com</email>
</author>
<published>2021-04-16T12:47:14+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=ce7b62d857919e511c6d5171c578c4b7e1bf0e67'/>
<id>urn:sha1:ce7b62d857919e511c6d5171c578c4b7e1bf0e67</id>
<content type='text'>
[ Upstream commit 24d209dba5a3959b2ebde7cf3ad40c8015e814cf ]

When core is in hibernation in host mode and a device cable
was connected then driver exited from device hibernation.
However, registers saved for host mode and when exited from
device hibernation register restore would be done for device
register which was wrong because there was no device registers
stored to restore.

- Added dwc_handle_gpwrdn_disc_det() function which handles
  gpwrdn disconnect detect flow and exits hibernation
  without restoring the registers.
- Updated exiting from hibernation in GPWRDN_STS_CHGINT with
  calling dwc_handle_gpwrdn_disc_det() function. Here no register
  is restored which is the solution described above.

Fixes: 65c9c4c6b01f ("usb: dwc2: Add dwc2_handle_gpwrdn_intr() handler")
Acked-by: Minas Harutyunyan &lt;Minas.Harutyunyan@synopsys.com&gt;
Signed-off-by: Artur Petrosyan &lt;Arthur.Petrosyan@synopsys.com&gt;
Signed-off-by: Minas Harutyunyan &lt;Minas.Harutyunyan@synopsys.com&gt;
Link: https://lore.kernel.org/r/20210416124715.75355A005D@mailhost.synopsys.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>usb: dwc2: Fix host mode hibernation exit with remote wakeup flow.</title>
<updated>2021-05-14T07:44:22+00:00</updated>
<author>
<name>Artur Petrosyan</name>
<email>Arthur.Petrosyan@synopsys.com</email>
</author>
<published>2021-04-16T12:47:06+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=6f7ed537ca2d1d53410122def2aad676841b8639'/>
<id>urn:sha1:6f7ed537ca2d1d53410122def2aad676841b8639</id>
<content type='text'>
[ Upstream commit c2db8d7b9568b10e014af83b3c15e39929e3579e ]

Added setting "port_connect_status_change" flag to "1" in order
to re-enumerate, because after exit from hibernation port
connection status is not detected.

Fixes: c5c403dc4336 ("usb: dwc2: Add host/device hibernation functions")
Acked-by: Minas Harutyunyan &lt;Minas.Harutyunyan@synopsys.com&gt;
Signed-off-by: Artur Petrosyan &lt;Arthur.Petrosyan@synopsys.com&gt;
Link: https://lore.kernel.org/r/20210416124707.5EEC2A005D@mailhost.synopsys.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>usb: dwc2: Fix session request interrupt handler</title>
<updated>2021-05-11T12:04:17+00:00</updated>
<author>
<name>Artur Petrosyan</name>
<email>Arthur.Petrosyan@synopsys.com</email>
</author>
<published>2021-04-08T09:45:49+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=943131fda33bfe0dbe9e6bf96b00468deda7da10'/>
<id>urn:sha1:943131fda33bfe0dbe9e6bf96b00468deda7da10</id>
<content type='text'>
commit 42b32b164acecd850edef010915a02418345a033 upstream.

According to programming guide in host mode, port
power must be turned on in session request
interrupt handlers.

Fixes: 21795c826a45 ("usb: dwc2: exit hibernation on session request")
Cc: &lt;stable@vger.kernel.org&gt;
Acked-by: Minas Harutyunyan &lt;Minas.Harutyunyan@synopsys.com&gt;
Signed-off-by: Artur Petrosyan &lt;Arthur.Petrosyan@synopsys.com&gt;
Link: https://lore.kernel.org/r/20210408094550.75484A0094@mailhost.synopsys.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>usb: dwc2: Prevent core suspend when port connection flag is 0</title>
<updated>2021-04-07T12:47:44+00:00</updated>
<author>
<name>Artur Petrosyan</name>
<email>Arthur.Petrosyan@synopsys.com</email>
</author>
<published>2021-03-26T10:25:09+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=fd5ce87aee48e165840c99c0d07b2c3b0b8f091d'/>
<id>urn:sha1:fd5ce87aee48e165840c99c0d07b2c3b0b8f091d</id>
<content type='text'>
commit 93f672804bf2d7a49ef3fd96827ea6290ca1841e upstream.

In host mode port connection status flag is "0" when loading
the driver. After loading the driver system asserts suspend
which is handled by "_dwc2_hcd_suspend()" function. Before
the system suspend the port connection status is "0". As
result need to check the "port_connect_status" if it is "0",
then skipping entering to suspend.

Cc: &lt;stable@vger.kernel.org&gt; # 5.2
Fixes: 6f6d70597c15 ("usb: dwc2: bus suspend/resume for hosts with DWC2_POWER_DOWN_PARAM_NONE")
Signed-off-by: Artur Petrosyan &lt;Arthur.Petrosyan@synopsys.com&gt;
Link: https://lore.kernel.org/r/20210326102510.BDEDEA005D@mailhost.synopsys.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
</feed>
