linux-stable/drivers/usb
Fabrice Gasnier 8e1ec117ef usb: ucsi: stm32: fix command completion handling
Sometimes errors are seen, when doing DR swap, like:
[   24.672481] ucsi-stm32g0-i2c 0-0035: UCSI_GET_PDOS failed (-5)
[   24.720188] ucsi-stm32g0-i2c 0-0035: ucsi_handle_connector_change:
 GET_CONNECTOR_STATUS failed (-5)

There may be some race, which lead to read CCI, before the command complete
flag is set, hence returning -EIO. Similar fix has been done also in
ucsi_acpi [1].

In case of a spurious or otherwise delayed notification it is
possible that CCI still reports the previous completion. The
UCSI spec is aware of this and provides two completion bits in
CCI, one for normal commands and one for acks. As acks and commands
alternate the notification handler can determine if the completion
bit is from the current command.

To fix this add the ACK_PENDING bit for ucsi_stm32g0 and only complete
commands if the completion bit matches.

[1] https://lore.kernel.org/lkml/20240121204123.275441-3-lk@c--e.de/

Fixes: 72849d4fce ("usb: typec: ucsi: stm32g0: add support for stm32g0 controller")
Signed-off-by: Fabrice Gasnier <fabrice.gasnier@foss.st.com>
Link: https://lore.kernel.org/stable/20240612124656.2305603-1-fabrice.gasnier%40foss.st.com
Cc: stable <stable@kernel.org>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Link: https://lore.kernel.org/r/20240612124656.2305603-1-fabrice.gasnier@foss.st.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-06-20 19:34:51 +02:00
..
atm usb: atm: cxacru: fix endpoint checking in cxacru_bind() 2024-06-20 19:34:51 +02:00
c67x00 USB: c67x00: Remove unused declaration c67x00_hcd_msg_received() 2023-10-02 16:42:33 +02:00
cdns3 tracing/treewide: Remove second parameter of __assign_str() 2024-05-22 20:14:47 -04:00
chipidea Revert "usb: chipidea: move ci_ulpi_init after the phy initialization" 2024-06-04 14:51:09 +02:00
class USB: class: cdc-wdm: Fix CPU lockup caused by excessive log messages 2024-06-14 08:47:59 +02:00
common usb: ulpi: Fix debugfs directory leak 2024-01-27 17:41:42 -08:00
core kcov, usb: disable interrupts in kcov_remote_start_usb_softirq 2024-06-04 15:34:44 +02:00
dwc2 Merge 6.9-rc5 into usb-next 2024-04-23 13:33:26 +02:00
dwc3 tracing/treewide: Remove second parameter of __assign_str() 2024-05-22 20:14:47 -04:00
early usb: early: xhci-dbc: Use memcpy_and_pad() 2023-01-31 10:40:54 +01:00
fotg210 usb: fotg210: Add missing kernel doc description 2024-05-11 08:42:03 +01:00
gadget usb: gadget: printer: fix races against disable 2024-06-20 19:33:22 +02:00
host xhci: Handle TD clearing for multiple streams case 2024-06-12 09:43:36 +02:00
image scsi: core: Add a dma_alignment field to the host and host template 2024-04-11 21:37:48 -04:00
isp1760 mm, slab: remove last vestiges of SLAB_MEM_SPREAD 2024-03-12 20:32:19 -07:00
misc USB: fix up for "usb: misc: onboard_hub: rename to onboard_dev" 2024-04-30 18:11:13 +02:00
mon usb: mon: Fix atomicity violation in mon_bin_vma_fault 2024-01-05 10:36:08 +01:00
mtu3 tracing/treewide: Remove second parameter of __assign_str() 2024-05-22 20:14:47 -04:00
musb tracing/treewide: Remove second parameter of __assign_str() 2024-05-22 20:14:47 -04:00
phy usb: phy-generic: add short delay after pulling the reset pin 2024-04-09 17:37:35 +02:00
renesas_usbhs usb: renesas_usbhs: Remove renesas_usbhs_get_info() wrapper 2024-04-18 16:47:49 +02:00
roles Merge v6.8-rc6 into usb-next 2024-02-26 06:53:50 +01:00
serial USB: serial: option: add Telit FN920C04 rmnet compositions 2024-04-18 17:14:49 +02:00
storage usb-storage: alauda: Check whether the media is initialized 2024-06-04 15:36:28 +02:00
typec usb: ucsi: stm32: fix command completion handling 2024-06-20 19:34:51 +02:00
usbip USB: core: Use device_driver directly in struct usb_driver and usb_device_driver 2024-01-04 16:06:32 +01:00
Kconfig usb: pci-quirks: handle HAS_IOPORT dependency for AMD quirk 2023-10-02 16:19:12 +02:00
Makefile USB: xen-hcd: Traverse host/ when CONFIG_USB_XEN_HCD is selected 2024-06-04 15:33:38 +02:00
usb-skeleton.c usb: add usb_set_intfdata() documentation 2022-11-29 08:56:09 +01:00