]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
6.6-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 9 Mar 2025 20:31:48 +0000 (21:31 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 9 Mar 2025 20:31:48 +0000 (21:31 +0100)
added patches:
kbuild-userprogs-use-correct-lld-when-linking-through-clang.patch
revert-drivers-card_reader-rtsx_usb-restore-interrupt-based-detection.patch
usb-atm-cxacru-fix-a-flaw-in-existing-endpoint-checks.patch
usb-dwc3-gadget-prevent-irq-storm-when-th-re-executes.patch
usb-dwc3-set-suspendenable-soon-after-phy-init.patch
usb-gadget-check-bmattributes-only-if-configuration-is-valid.patch
usb-gadget-fix-setting-self-powered-state-on-suspend.patch
usb-gadget-set-self-powered-based-on-maxpower-and-bmattributes.patch
usb-gadget-u_ether-set-is_suspend-flag-if-remote-wakeup-fails.patch
usb-hub-lack-of-clearing-xhc-resources.patch
usb-quirks-add-delay_init-and-no_lpm-for-prolific-mass-storage-card-reader.patch
usb-renesas_usbhs-call-clk_put.patch
usb-renesas_usbhs-flush-the-notify_hotplug_work.patch
usb-renesas_usbhs-use-devm_usb_get_phy.patch
usb-typec-tcpci_rt1711h-unmask-alert-interrupts-to-fix-functionality.patch
usb-typec-ucsi-fix-null-pointer-access.patch
usb-typec-ucsi-increase-timeout-for-ppm-reset-operations.patch

18 files changed:
queue-6.6/kbuild-userprogs-use-correct-lld-when-linking-through-clang.patch [new file with mode: 0644]
queue-6.6/revert-drivers-card_reader-rtsx_usb-restore-interrupt-based-detection.patch [new file with mode: 0644]
queue-6.6/series
queue-6.6/usb-atm-cxacru-fix-a-flaw-in-existing-endpoint-checks.patch [new file with mode: 0644]
queue-6.6/usb-dwc3-gadget-prevent-irq-storm-when-th-re-executes.patch [new file with mode: 0644]
queue-6.6/usb-dwc3-set-suspendenable-soon-after-phy-init.patch [new file with mode: 0644]
queue-6.6/usb-gadget-check-bmattributes-only-if-configuration-is-valid.patch [new file with mode: 0644]
queue-6.6/usb-gadget-fix-setting-self-powered-state-on-suspend.patch [new file with mode: 0644]
queue-6.6/usb-gadget-set-self-powered-based-on-maxpower-and-bmattributes.patch [new file with mode: 0644]
queue-6.6/usb-gadget-u_ether-set-is_suspend-flag-if-remote-wakeup-fails.patch [new file with mode: 0644]
queue-6.6/usb-hub-lack-of-clearing-xhc-resources.patch [new file with mode: 0644]
queue-6.6/usb-quirks-add-delay_init-and-no_lpm-for-prolific-mass-storage-card-reader.patch [new file with mode: 0644]
queue-6.6/usb-renesas_usbhs-call-clk_put.patch [new file with mode: 0644]
queue-6.6/usb-renesas_usbhs-flush-the-notify_hotplug_work.patch [new file with mode: 0644]
queue-6.6/usb-renesas_usbhs-use-devm_usb_get_phy.patch [new file with mode: 0644]
queue-6.6/usb-typec-tcpci_rt1711h-unmask-alert-interrupts-to-fix-functionality.patch [new file with mode: 0644]
queue-6.6/usb-typec-ucsi-fix-null-pointer-access.patch [new file with mode: 0644]
queue-6.6/usb-typec-ucsi-increase-timeout-for-ppm-reset-operations.patch [new file with mode: 0644]

diff --git a/queue-6.6/kbuild-userprogs-use-correct-lld-when-linking-through-clang.patch b/queue-6.6/kbuild-userprogs-use-correct-lld-when-linking-through-clang.patch
new file mode 100644 (file)
index 0000000..d3c7752
--- /dev/null
@@ -0,0 +1,50 @@
+From dfc1b168a8c4b376fa222b27b97c2c4ad4b786e1 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Thomas=20Wei=C3=9Fschuh?= <thomas.weissschuh@linutronix.de>
+Date: Mon, 17 Feb 2025 08:27:54 +0100
+Subject: kbuild: userprogs: use correct lld when linking through clang
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
+
+commit dfc1b168a8c4b376fa222b27b97c2c4ad4b786e1 upstream.
+
+The userprog infrastructure links objects files through $(CC).
+Either explicitly by manually calling $(CC) on multiple object files or
+implicitly by directly compiling a source file to an executable.
+The documentation at Documentation/kbuild/llvm.rst indicates that ld.lld
+would be used for linking if LLVM=1 is specified.
+However clang instead will use either a globally installed cross linker
+from $PATH called ${target}-ld or fall back to the system linker, which
+probably does not support crosslinking.
+For the normal kernel build this is not an issue because the linker is
+always executed directly, without the compiler being involved.
+
+Explicitly pass --ld-path to clang so $(LD) is respected.
+As clang 13.0.1 is required to build the kernel, this option is available.
+
+Fixes: 7f3a59db274c ("kbuild: add infrastructure to build userspace programs")
+Cc: stable@vger.kernel.org # needs wrapping in $(cc-option) for < 6.9
+Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
+Reviewed-by: Nathan Chancellor <nathan@kernel.org>
+Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ Makefile |    5 +++++
+ 1 file changed, 5 insertions(+)
+
+--- a/Makefile
++++ b/Makefile
+@@ -1057,6 +1057,11 @@ endif
+ KBUILD_USERCFLAGS  += $(filter -m32 -m64 --target=%, $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS))
+ KBUILD_USERLDFLAGS += $(filter -m32 -m64 --target=%, $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS))
++# userspace programs are linked via the compiler, use the correct linker
++ifeq ($(CONFIG_CC_IS_CLANG)$(CONFIG_LD_IS_LLD),yy)
++KBUILD_USERLDFLAGS += --ld-path=$(LD)
++endif
++
+ # make the checker run with the right architecture
+ CHECKFLAGS += --arch=$(ARCH)
diff --git a/queue-6.6/revert-drivers-card_reader-rtsx_usb-restore-interrupt-based-detection.patch b/queue-6.6/revert-drivers-card_reader-rtsx_usb-restore-interrupt-based-detection.patch
new file mode 100644 (file)
index 0000000..2685345
--- /dev/null
@@ -0,0 +1,59 @@
+From 2397d61ee45cddb8f3bd3a3a9840ef0f0b5aa843 Mon Sep 17 00:00:00 2001
+From: Christian Heusel <christian@heusel.eu>
+Date: Mon, 24 Feb 2025 09:32:59 +0100
+Subject: Revert "drivers/card_reader/rtsx_usb: Restore interrupt based detection"
+
+From: Christian Heusel <christian@heusel.eu>
+
+commit 2397d61ee45cddb8f3bd3a3a9840ef0f0b5aa843 upstream.
+
+This reverts commit 235b630eda072d7e7b102ab346d6b8a2c028a772.
+
+This commit was found responsible for issues with SD card recognition,
+as users had to re-insert their cards in the readers and wait for a
+while. As for some people the SD card was involved in the boot process
+it also caused boot failures.
+
+Cc: stable@vger.kernel.org
+Link: https://bbs.archlinux.org/viewtopic.php?id=303321
+Fixes: 235b630eda07 ("drivers/card_reader/rtsx_usb: Restore interrupt based detection")
+Reported-by: qf <quintafeira@tutanota.com>
+Closes: https://lore.kernel.org/all/1de87dfa-1e81-45b7-8dcb-ad86c21d5352@heusel.eu
+Signed-off-by: Christian Heusel <christian@heusel.eu>
+Link: https://lore.kernel.org/r/20250224-revert-sdcard-patch-v1-1-d1a457fbb796@heusel.eu
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/misc/cardreader/rtsx_usb.c |   15 ---------------
+ 1 file changed, 15 deletions(-)
+
+--- a/drivers/misc/cardreader/rtsx_usb.c
++++ b/drivers/misc/cardreader/rtsx_usb.c
+@@ -286,7 +286,6 @@ static int rtsx_usb_get_status_with_bulk
+ int rtsx_usb_get_card_status(struct rtsx_ucr *ucr, u16 *status)
+ {
+       int ret;
+-      u8 interrupt_val = 0;
+       u16 *buf;
+       if (!status)
+@@ -309,20 +308,6 @@ int rtsx_usb_get_card_status(struct rtsx
+               ret = rtsx_usb_get_status_with_bulk(ucr, status);
+       }
+-      rtsx_usb_read_register(ucr, CARD_INT_PEND, &interrupt_val);
+-      /* Cross check presence with interrupts */
+-      if (*status & XD_CD)
+-              if (!(interrupt_val & XD_INT))
+-                      *status &= ~XD_CD;
+-
+-      if (*status & SD_CD)
+-              if (!(interrupt_val & SD_INT))
+-                      *status &= ~SD_CD;
+-
+-      if (*status & MS_CD)
+-              if (!(interrupt_val & MS_INT))
+-                      *status &= ~MS_CD;
+-
+       /* usb_control_msg may return positive when success */
+       if (ret < 0)
+               return ret;
index 5eacca79b589c1640f819124ca642879934eebb5..93a073c9822fc222678f89e76aedd78993cf84df 100644 (file)
@@ -93,3 +93,20 @@ net-ipv6-fix-missing-dst-ref-drop-in-ila-lwtunnel.patch
 gpio-rcar-fix-missing-of_node_put-call.patch
 fs-pipe-do-not-open-code-pipe-head-tail-logic-in-fio.patch
 fs-pipe-fix-pipe-buffer-index-use-in-fuse.patch
+revert-drivers-card_reader-rtsx_usb-restore-interrupt-based-detection.patch
+usb-renesas_usbhs-call-clk_put.patch
+usb-renesas_usbhs-use-devm_usb_get_phy.patch
+usb-hub-lack-of-clearing-xhc-resources.patch
+usb-quirks-add-delay_init-and-no_lpm-for-prolific-mass-storage-card-reader.patch
+usb-typec-ucsi-fix-null-pointer-access.patch
+usb-renesas_usbhs-flush-the-notify_hotplug_work.patch
+usb-gadget-u_ether-set-is_suspend-flag-if-remote-wakeup-fails.patch
+usb-atm-cxacru-fix-a-flaw-in-existing-endpoint-checks.patch
+usb-dwc3-set-suspendenable-soon-after-phy-init.patch
+usb-dwc3-gadget-prevent-irq-storm-when-th-re-executes.patch
+usb-typec-ucsi-increase-timeout-for-ppm-reset-operations.patch
+usb-typec-tcpci_rt1711h-unmask-alert-interrupts-to-fix-functionality.patch
+usb-gadget-set-self-powered-based-on-maxpower-and-bmattributes.patch
+usb-gadget-fix-setting-self-powered-state-on-suspend.patch
+usb-gadget-check-bmattributes-only-if-configuration-is-valid.patch
+kbuild-userprogs-use-correct-lld-when-linking-through-clang.patch
diff --git a/queue-6.6/usb-atm-cxacru-fix-a-flaw-in-existing-endpoint-checks.patch b/queue-6.6/usb-atm-cxacru-fix-a-flaw-in-existing-endpoint-checks.patch
new file mode 100644 (file)
index 0000000..8364b6c
--- /dev/null
@@ -0,0 +1,83 @@
+From c90aad369899a607cfbc002bebeafd51e31900cd Mon Sep 17 00:00:00 2001
+From: Nikita Zhandarovich <n.zhandarovich@fintech.ru>
+Date: Thu, 13 Feb 2025 15:22:57 +0300
+Subject: usb: atm: cxacru: fix a flaw in existing endpoint checks
+
+From: Nikita Zhandarovich <n.zhandarovich@fintech.ru>
+
+commit c90aad369899a607cfbc002bebeafd51e31900cd upstream.
+
+Syzbot once again identified a flaw in usb endpoint checking, see [1].
+This time the issue stems from a commit authored by me (2eabb655a968
+("usb: atm: cxacru: fix endpoint checking in cxacru_bind()")).
+
+While using usb_find_common_endpoints() may usually be enough to
+discard devices with wrong endpoints, in this case one needs more
+than just finding and identifying the sufficient number of endpoints
+of correct types - one needs to check the endpoint's address as well.
+
+Since cxacru_bind() fills URBs with CXACRU_EP_CMD address in mind,
+switch the endpoint verification approach to usb_check_XXX_endpoints()
+instead to fix incomplete ep testing.
+
+[1] Syzbot report:
+usb 5-1: BOGUS urb xfer, pipe 3 != type 1
+WARNING: CPU: 0 PID: 1378 at drivers/usb/core/urb.c:504 usb_submit_urb+0xc4e/0x18c0 drivers/usb/core/urb.c:503
+...
+RIP: 0010:usb_submit_urb+0xc4e/0x18c0 drivers/usb/core/urb.c:503
+...
+Call Trace:
+ <TASK>
+ cxacru_cm+0x3c8/0xe50 drivers/usb/atm/cxacru.c:649
+ cxacru_card_status drivers/usb/atm/cxacru.c:760 [inline]
+ cxacru_bind+0xcf9/0x1150 drivers/usb/atm/cxacru.c:1223
+ usbatm_usb_probe+0x314/0x1d30 drivers/usb/atm/usbatm.c:1058
+ cxacru_usb_probe+0x184/0x220 drivers/usb/atm/cxacru.c:1377
+ usb_probe_interface+0x641/0xbb0 drivers/usb/core/driver.c:396
+ really_probe+0x2b9/0xad0 drivers/base/dd.c:658
+ __driver_probe_device+0x1a2/0x390 drivers/base/dd.c:800
+ driver_probe_device+0x50/0x430 drivers/base/dd.c:830
+...
+
+Reported-and-tested-by: syzbot+ccbbc229a024fa3e13b5@syzkaller.appspotmail.com
+Closes: https://syzkaller.appspot.com/bug?extid=ccbbc229a024fa3e13b5
+Fixes: 2eabb655a968 ("usb: atm: cxacru: fix endpoint checking in cxacru_bind()")
+Cc: stable@kernel.org
+Signed-off-by: Nikita Zhandarovich <n.zhandarovich@fintech.ru>
+Link: https://lore.kernel.org/r/20250213122259.730772-1-n.zhandarovich@fintech.ru
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/usb/atm/cxacru.c |   13 +++++++------
+ 1 file changed, 7 insertions(+), 6 deletions(-)
+
+--- a/drivers/usb/atm/cxacru.c
++++ b/drivers/usb/atm/cxacru.c
+@@ -1131,7 +1131,10 @@ static int cxacru_bind(struct usbatm_dat
+       struct cxacru_data *instance;
+       struct usb_device *usb_dev = interface_to_usbdev(intf);
+       struct usb_host_endpoint *cmd_ep = usb_dev->ep_in[CXACRU_EP_CMD];
+-      struct usb_endpoint_descriptor *in, *out;
++      static const u8 ep_addrs[] = {
++              CXACRU_EP_CMD + USB_DIR_IN,
++              CXACRU_EP_CMD + USB_DIR_OUT,
++              0};
+       int ret;
+       /* instance init */
+@@ -1179,13 +1182,11 @@ static int cxacru_bind(struct usbatm_dat
+       }
+       if (usb_endpoint_xfer_int(&cmd_ep->desc))
+-              ret = usb_find_common_endpoints(intf->cur_altsetting,
+-                                              NULL, NULL, &in, &out);
++              ret = usb_check_int_endpoints(intf, ep_addrs);
+       else
+-              ret = usb_find_common_endpoints(intf->cur_altsetting,
+-                                              &in, &out, NULL, NULL);
++              ret = usb_check_bulk_endpoints(intf, ep_addrs);
+-      if (ret) {
++      if (!ret) {
+               usb_err(usbatm_instance, "cxacru_bind: interface has incorrect endpoints\n");
+               ret = -ENODEV;
+               goto fail;
diff --git a/queue-6.6/usb-dwc3-gadget-prevent-irq-storm-when-th-re-executes.patch b/queue-6.6/usb-dwc3-gadget-prevent-irq-storm-when-th-re-executes.patch
new file mode 100644 (file)
index 0000000..fcf640e
--- /dev/null
@@ -0,0 +1,112 @@
+From 69c58deec19628c8a686030102176484eb94fed4 Mon Sep 17 00:00:00 2001
+From: Badhri Jagan Sridharan <badhri@google.com>
+Date: Sun, 16 Feb 2025 22:30:02 +0000
+Subject: usb: dwc3: gadget: Prevent irq storm when TH re-executes
+
+From: Badhri Jagan Sridharan <badhri@google.com>
+
+commit 69c58deec19628c8a686030102176484eb94fed4 upstream.
+
+While commit d325a1de49d6 ("usb: dwc3: gadget: Prevent losing events in
+event cache") makes sure that top half(TH) does not end up overwriting the
+cached events before processing them when the TH gets invoked more than one
+time, returning IRQ_HANDLED results in occasional irq storm where the TH
+hogs the CPU. The irq storm can be prevented by the flag before event
+handler busy is cleared. Default enable interrupt moderation in all
+versions which support them.
+
+ftrace event stub during dwc3 irq storm:
+    irq/504_dwc3-1111  ( 1111) [000] .... 70.000866: irq_handler_exit: irq=14 ret=handled
+    irq/504_dwc3-1111  ( 1111) [000] .... 70.000872: irq_handler_entry: irq=504 name=dwc3
+    irq/504_dwc3-1111  ( 1111) [000] .... 70.000874: irq_handler_exit: irq=504 ret=handled
+    irq/504_dwc3-1111  ( 1111) [000] .... 70.000881: irq_handler_entry: irq=504 name=dwc3
+    irq/504_dwc3-1111  ( 1111) [000] .... 70.000883: irq_handler_exit: irq=504 ret=handled
+    irq/504_dwc3-1111  ( 1111) [000] .... 70.000889: irq_handler_entry: irq=504 name=dwc3
+    irq/504_dwc3-1111  ( 1111) [000] .... 70.000892: irq_handler_exit: irq=504 ret=handled
+    irq/504_dwc3-1111  ( 1111) [000] .... 70.000898: irq_handler_entry: irq=504 name=dwc3
+    irq/504_dwc3-1111  ( 1111) [000] .... 70.000901: irq_handler_exit: irq=504 ret=handled
+    irq/504_dwc3-1111  ( 1111) [000] .... 70.000907: irq_handler_entry: irq=504 name=dwc3
+    irq/504_dwc3-1111  ( 1111) [000] .... 70.000909: irq_handler_exit: irq=504 ret=handled
+    irq/504_dwc3-1111  ( 1111) [000] .... 70.000915: irq_handler_entry: irq=504 name=dwc3
+    irq/504_dwc3-1111  ( 1111) [000] .... 70.000918: irq_handler_exit: irq=504 ret=handled
+    irq/504_dwc3-1111  ( 1111) [000] .... 70.000924: irq_handler_entry: irq=504 name=dwc3
+    irq/504_dwc3-1111  ( 1111) [000] .... 70.000927: irq_handler_exit: irq=504 ret=handled
+    irq/504_dwc3-1111  ( 1111) [000] .... 70.000933: irq_handler_entry: irq=504 name=dwc3
+    irq/504_dwc3-1111  ( 1111) [000] .... 70.000935: irq_handler_exit: irq=504 ret=handled
+    ....
+
+Cc: stable <stable@kernel.org>
+Suggested-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
+Fixes: d325a1de49d6 ("usb: dwc3: gadget: Prevent losing events in event cache")
+Signed-off-by: Badhri Jagan Sridharan <badhri@google.com>
+Acked-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
+Link: https://lore.kernel.org/r/20250216223003.3568039-1-badhri@google.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/usb/dwc3/core.c   |   16 ++++++----------
+ drivers/usb/dwc3/gadget.c |   10 +++++++---
+ 2 files changed, 13 insertions(+), 13 deletions(-)
+
+--- a/drivers/usb/dwc3/core.c
++++ b/drivers/usb/dwc3/core.c
+@@ -1671,8 +1671,6 @@ static void dwc3_get_properties(struct d
+       dwc->tx_thr_num_pkt_prd = tx_thr_num_pkt_prd;
+       dwc->tx_max_burst_prd = tx_max_burst_prd;
+-      dwc->imod_interval = 0;
+-
+       dwc->tx_fifo_resize_max_num = tx_fifo_resize_max_num;
+ }
+@@ -1690,21 +1688,19 @@ static void dwc3_check_params(struct dwc
+       unsigned int hwparam_gen =
+               DWC3_GHWPARAMS3_SSPHY_IFC(dwc->hwparams.hwparams3);
+-      /* Check for proper value of imod_interval */
+-      if (dwc->imod_interval && !dwc3_has_imod(dwc)) {
+-              dev_warn(dwc->dev, "Interrupt moderation not supported\n");
+-              dwc->imod_interval = 0;
+-      }
+-
+       /*
++       * Enable IMOD for all supporting controllers.
++       *
++       * Particularly, DWC_usb3 v3.00a must enable this feature for
++       * the following reason:
++       *
+        * Workaround for STAR 9000961433 which affects only version
+        * 3.00a of the DWC_usb3 core. This prevents the controller
+        * interrupt from being masked while handling events. IMOD
+        * allows us to work around this issue. Enable it for the
+        * affected version.
+        */
+-      if (!dwc->imod_interval &&
+-          DWC3_VER_IS(DWC3, 300A))
++      if (dwc3_has_imod((dwc)))
+               dwc->imod_interval = 1;
+       /* Check the maximum_speed parameter */
+--- a/drivers/usb/dwc3/gadget.c
++++ b/drivers/usb/dwc3/gadget.c
+@@ -4507,14 +4507,18 @@ static irqreturn_t dwc3_process_event_bu
+       dwc3_writel(dwc->regs, DWC3_GEVNTSIZ(0),
+                   DWC3_GEVNTSIZ_SIZE(evt->length));
++      evt->flags &= ~DWC3_EVENT_PENDING;
++      /*
++       * Add an explicit write memory barrier to make sure that the update of
++       * clearing DWC3_EVENT_PENDING is observed in dwc3_check_event_buf()
++       */
++      wmb();
++
+       if (dwc->imod_interval) {
+               dwc3_writel(dwc->regs, DWC3_GEVNTCOUNT(0), DWC3_GEVNTCOUNT_EHB);
+               dwc3_writel(dwc->regs, DWC3_DEV_IMOD(0), dwc->imod_interval);
+       }
+-      /* Keep the clearing of DWC3_EVENT_PENDING at the end */
+-      evt->flags &= ~DWC3_EVENT_PENDING;
+-
+       return ret;
+ }
diff --git a/queue-6.6/usb-dwc3-set-suspendenable-soon-after-phy-init.patch b/queue-6.6/usb-dwc3-set-suspendenable-soon-after-phy-init.patch
new file mode 100644 (file)
index 0000000..5f38be5
--- /dev/null
@@ -0,0 +1,213 @@
+From cc5bfc4e16fc1d1c520cd7bb28646e82b6e69217 Mon Sep 17 00:00:00 2001
+From: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
+Date: Thu, 30 Jan 2025 23:49:31 +0000
+Subject: usb: dwc3: Set SUSPENDENABLE soon after phy init
+
+From: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
+
+commit cc5bfc4e16fc1d1c520cd7bb28646e82b6e69217 upstream.
+
+After phy initialization, some phy operations can only be executed while
+in lower P states. Ensure GUSB3PIPECTL.SUSPENDENABLE and
+GUSB2PHYCFG.SUSPHY are set soon after initialization to avoid blocking
+phy ops.
+
+Previously the SUSPENDENABLE bits are only set after the controller
+initialization, which may not happen right away if there's no gadget
+driver or xhci driver bound. Revise this to clear SUSPENDENABLE bits
+only when there's mode switching (change in GCTL.PRTCAPDIR).
+
+Fixes: 6d735722063a ("usb: dwc3: core: Prevent phy suspend during init")
+Cc: stable <stable@kernel.org>
+Signed-off-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
+Link: https://lore.kernel.org/r/633aef0afee7d56d2316f7cc3e1b2a6d518a8cc9.1738280911.git.Thinh.Nguyen@synopsys.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/usb/dwc3/core.c |   69 +++++++++++++++++++++++++++++-------------------
+ drivers/usb/dwc3/core.h |    2 -
+ drivers/usb/dwc3/drd.c  |    4 +-
+ 3 files changed, 45 insertions(+), 30 deletions(-)
+
+--- a/drivers/usb/dwc3/core.c
++++ b/drivers/usb/dwc3/core.c
+@@ -125,11 +125,24 @@ void dwc3_enable_susphy(struct dwc3 *dwc
+       dwc3_writel(dwc->regs, DWC3_GUSB2PHYCFG(0), reg);
+ }
+-void dwc3_set_prtcap(struct dwc3 *dwc, u32 mode)
++void dwc3_set_prtcap(struct dwc3 *dwc, u32 mode, bool ignore_susphy)
+ {
++      unsigned int hw_mode;
+       u32 reg;
+       reg = dwc3_readl(dwc->regs, DWC3_GCTL);
++
++       /*
++        * For DRD controllers, GUSB3PIPECTL.SUSPENDENABLE and
++        * GUSB2PHYCFG.SUSPHY should be cleared during mode switching,
++        * and they can be set after core initialization.
++        */
++      hw_mode = DWC3_GHWPARAMS0_MODE(dwc->hwparams.hwparams0);
++      if (hw_mode == DWC3_GHWPARAMS0_MODE_DRD && !ignore_susphy) {
++              if (DWC3_GCTL_PRTCAP(reg) != mode)
++                      dwc3_enable_susphy(dwc, false);
++      }
++
+       reg &= ~(DWC3_GCTL_PRTCAPDIR(DWC3_GCTL_PRTCAP_OTG));
+       reg |= DWC3_GCTL_PRTCAPDIR(mode);
+       dwc3_writel(dwc->regs, DWC3_GCTL, reg);
+@@ -209,7 +222,7 @@ static void __dwc3_set_mode(struct work_
+       spin_lock_irqsave(&dwc->lock, flags);
+-      dwc3_set_prtcap(dwc, desired_dr_role);
++      dwc3_set_prtcap(dwc, desired_dr_role, false);
+       spin_unlock_irqrestore(&dwc->lock, flags);
+@@ -643,16 +656,7 @@ static int dwc3_phy_setup(struct dwc3 *d
+        */
+       reg &= ~DWC3_GUSB3PIPECTL_UX_EXIT_PX;
+-      /*
+-       * Above DWC_usb3.0 1.94a, it is recommended to set
+-       * DWC3_GUSB3PIPECTL_SUSPHY to '0' during coreConsultant configuration.
+-       * So default value will be '0' when the core is reset. Application
+-       * needs to set it to '1' after the core initialization is completed.
+-       *
+-       * Similarly for DRD controllers, GUSB3PIPECTL.SUSPENDENABLE must be
+-       * cleared after power-on reset, and it can be set after core
+-       * initialization.
+-       */
++      /* Ensure the GUSB3PIPECTL.SUSPENDENABLE is cleared prior to phy init. */
+       reg &= ~DWC3_GUSB3PIPECTL_SUSPHY;
+       if (dwc->u2ss_inp3_quirk)
+@@ -725,15 +729,7 @@ static int dwc3_phy_setup(struct dwc3 *d
+               break;
+       }
+-      /*
+-       * Above DWC_usb3.0 1.94a, it is recommended to set
+-       * DWC3_GUSB2PHYCFG_SUSPHY to '0' during coreConsultant configuration.
+-       * So default value will be '0' when the core is reset. Application
+-       * needs to set it to '1' after the core initialization is completed.
+-       *
+-       * Similarly for DRD controllers, GUSB2PHYCFG.SUSPHY must be cleared
+-       * after power-on reset, and it can be set after core initialization.
+-       */
++      /* Ensure the GUSB2PHYCFG.SUSPHY is cleared prior to phy init. */
+       reg &= ~DWC3_GUSB2PHYCFG_SUSPHY;
+       if (dwc->dis_enblslpm_quirk)
+@@ -809,6 +805,25 @@ static int dwc3_phy_power_on(struct dwc3
+       if (ret < 0)
+               goto err_power_off_usb2_phy;
++      /*
++       * Above DWC_usb3.0 1.94a, it is recommended to set
++       * DWC3_GUSB3PIPECTL_SUSPHY and DWC3_GUSB2PHYCFG_SUSPHY to '0' during
++       * coreConsultant configuration. So default value will be '0' when the
++       * core is reset. Application needs to set it to '1' after the core
++       * initialization is completed.
++       *
++       * Certain phy requires to be in P0 power state during initialization.
++       * Make sure GUSB3PIPECTL.SUSPENDENABLE and GUSB2PHYCFG.SUSPHY are clear
++       * prior to phy init to maintain in the P0 state.
++       *
++       * After phy initialization, some phy operations can only be executed
++       * while in lower P states. Ensure GUSB3PIPECTL.SUSPENDENABLE and
++       * GUSB2PHYCFG.SUSPHY are set soon after initialization to avoid
++       * blocking phy ops.
++       */
++      if (!DWC3_VER_IS_WITHIN(DWC3, ANY, 194A))
++              dwc3_enable_susphy(dwc, true);
++
+       return 0;
+ err_power_off_usb2_phy:
+@@ -1432,7 +1447,7 @@ static int dwc3_core_init_mode(struct dw
+       switch (dwc->dr_mode) {
+       case USB_DR_MODE_PERIPHERAL:
+-              dwc3_set_prtcap(dwc, DWC3_GCTL_PRTCAP_DEVICE);
++              dwc3_set_prtcap(dwc, DWC3_GCTL_PRTCAP_DEVICE, false);
+               if (dwc->usb2_phy)
+                       otg_set_vbus(dwc->usb2_phy->otg, false);
+@@ -1444,7 +1459,7 @@ static int dwc3_core_init_mode(struct dw
+                       return dev_err_probe(dev, ret, "failed to initialize gadget\n");
+               break;
+       case USB_DR_MODE_HOST:
+-              dwc3_set_prtcap(dwc, DWC3_GCTL_PRTCAP_HOST);
++              dwc3_set_prtcap(dwc, DWC3_GCTL_PRTCAP_HOST, false);
+               if (dwc->usb2_phy)
+                       otg_set_vbus(dwc->usb2_phy->otg, true);
+@@ -1487,7 +1502,7 @@ static void dwc3_core_exit_mode(struct d
+       }
+       /* de-assert DRVVBUS for HOST and OTG mode */
+-      dwc3_set_prtcap(dwc, DWC3_GCTL_PRTCAP_DEVICE);
++      dwc3_set_prtcap(dwc, DWC3_GCTL_PRTCAP_DEVICE, true);
+ }
+ static void dwc3_get_properties(struct dwc3 *dwc)
+@@ -2192,7 +2207,7 @@ static int dwc3_resume_common(struct dwc
+               if (ret)
+                       return ret;
+-              dwc3_set_prtcap(dwc, DWC3_GCTL_PRTCAP_DEVICE);
++              dwc3_set_prtcap(dwc, DWC3_GCTL_PRTCAP_DEVICE, true);
+               dwc3_gadget_resume(dwc);
+               break;
+       case DWC3_GCTL_PRTCAP_HOST:
+@@ -2200,7 +2215,7 @@ static int dwc3_resume_common(struct dwc
+                       ret = dwc3_core_init_for_resume(dwc);
+                       if (ret)
+                               return ret;
+-                      dwc3_set_prtcap(dwc, DWC3_GCTL_PRTCAP_HOST);
++                      dwc3_set_prtcap(dwc, DWC3_GCTL_PRTCAP_HOST, true);
+                       break;
+               }
+               /* Restore GUSB2PHYCFG bits that were modified in suspend */
+@@ -2225,7 +2240,7 @@ static int dwc3_resume_common(struct dwc
+               if (ret)
+                       return ret;
+-              dwc3_set_prtcap(dwc, dwc->current_dr_role);
++              dwc3_set_prtcap(dwc, dwc->current_dr_role, true);
+               dwc3_otg_init(dwc);
+               if (dwc->current_otg_role == DWC3_OTG_ROLE_HOST) {
+--- a/drivers/usb/dwc3/core.h
++++ b/drivers/usb/dwc3/core.h
+@@ -1531,7 +1531,7 @@ struct dwc3_gadget_ep_cmd_params {
+ #define DWC3_HAS_OTG                  BIT(3)
+ /* prototypes */
+-void dwc3_set_prtcap(struct dwc3 *dwc, u32 mode);
++void dwc3_set_prtcap(struct dwc3 *dwc, u32 mode, bool ignore_susphy);
+ void dwc3_set_mode(struct dwc3 *dwc, u32 mode);
+ u32 dwc3_core_fifo_space(struct dwc3_ep *dep, u8 type);
+--- a/drivers/usb/dwc3/drd.c
++++ b/drivers/usb/dwc3/drd.c
+@@ -173,7 +173,7 @@ void dwc3_otg_init(struct dwc3 *dwc)
+        * block "Initialize GCTL for OTG operation".
+        */
+       /* GCTL.PrtCapDir=2'b11 */
+-      dwc3_set_prtcap(dwc, DWC3_GCTL_PRTCAP_OTG);
++      dwc3_set_prtcap(dwc, DWC3_GCTL_PRTCAP_OTG, true);
+       /* GUSB2PHYCFG0.SusPHY=0 */
+       reg = dwc3_readl(dwc->regs, DWC3_GUSB2PHYCFG(0));
+       reg &= ~DWC3_GUSB2PHYCFG_SUSPHY;
+@@ -553,7 +553,7 @@ int dwc3_drd_init(struct dwc3 *dwc)
+               dwc3_drd_update(dwc);
+       } else {
+-              dwc3_set_prtcap(dwc, DWC3_GCTL_PRTCAP_OTG);
++              dwc3_set_prtcap(dwc, DWC3_GCTL_PRTCAP_OTG, true);
+               /* use OTG block to get ID event */
+               irq = dwc3_otg_get_irq(dwc);
diff --git a/queue-6.6/usb-gadget-check-bmattributes-only-if-configuration-is-valid.patch b/queue-6.6/usb-gadget-check-bmattributes-only-if-configuration-is-valid.patch
new file mode 100644 (file)
index 0000000..acbfba1
--- /dev/null
@@ -0,0 +1,32 @@
+From 8e812e9355a6f14dffd54a33d951ca403b9732f5 Mon Sep 17 00:00:00 2001
+From: Prashanth K <prashanth.k@oss.qualcomm.com>
+Date: Mon, 24 Feb 2025 14:26:04 +0530
+Subject: usb: gadget: Check bmAttributes only if configuration is valid
+
+From: Prashanth K <prashanth.k@oss.qualcomm.com>
+
+commit 8e812e9355a6f14dffd54a33d951ca403b9732f5 upstream.
+
+If the USB configuration is not valid, then avoid checking for
+bmAttributes to prevent null pointer deference.
+
+Cc: stable <stable@kernel.org>
+Fixes: 40e89ff5750f ("usb: gadget: Set self-powered based on MaxPower and bmAttributes")
+Signed-off-by: Prashanth K <prashanth.k@oss.qualcomm.com>
+Link: https://lore.kernel.org/r/20250224085604.417327-1-prashanth.k@oss.qualcomm.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/usb/gadget/composite.c |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/usb/gadget/composite.c
++++ b/drivers/usb/gadget/composite.c
+@@ -1051,7 +1051,7 @@ static int set_config(struct usb_composi
+               usb_gadget_set_remote_wakeup(gadget, 0);
+ done:
+       if (power > USB_SELF_POWER_VBUS_MAX_DRAW ||
+-          !(c->bmAttributes & USB_CONFIG_ATT_SELFPOWER))
++          (c && !(c->bmAttributes & USB_CONFIG_ATT_SELFPOWER)))
+               usb_gadget_clear_selfpowered(gadget);
+       else
+               usb_gadget_set_selfpowered(gadget);
diff --git a/queue-6.6/usb-gadget-fix-setting-self-powered-state-on-suspend.patch b/queue-6.6/usb-gadget-fix-setting-self-powered-state-on-suspend.patch
new file mode 100644 (file)
index 0000000..18de864
--- /dev/null
@@ -0,0 +1,32 @@
+From c783e1258f29c5caac9eea0aea6b172870f1baf8 Mon Sep 17 00:00:00 2001
+From: Marek Szyprowski <m.szyprowski@samsung.com>
+Date: Thu, 20 Feb 2025 13:03:14 +0100
+Subject: usb: gadget: Fix setting self-powered state on suspend
+
+From: Marek Szyprowski <m.szyprowski@samsung.com>
+
+commit c783e1258f29c5caac9eea0aea6b172870f1baf8 upstream.
+
+cdev->config might be NULL, so check it before dereferencing.
+
+CC: stable <stable@kernel.org>
+Fixes: 40e89ff5750f ("usb: gadget: Set self-powered based on MaxPower and bmAttributes")
+Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
+Link: https://lore.kernel.org/r/20250220120314.3614330-1-m.szyprowski@samsung.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/usb/gadget/composite.c |    3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+--- a/drivers/usb/gadget/composite.c
++++ b/drivers/usb/gadget/composite.c
+@@ -2616,7 +2616,8 @@ void composite_suspend(struct usb_gadget
+       cdev->suspended = 1;
+-      if (cdev->config->bmAttributes & USB_CONFIG_ATT_SELFPOWER)
++      if (cdev->config &&
++          cdev->config->bmAttributes & USB_CONFIG_ATT_SELFPOWER)
+               usb_gadget_set_selfpowered(gadget);
+       usb_gadget_vbus_draw(gadget, 2);
diff --git a/queue-6.6/usb-gadget-set-self-powered-based-on-maxpower-and-bmattributes.patch b/queue-6.6/usb-gadget-set-self-powered-based-on-maxpower-and-bmattributes.patch
new file mode 100644 (file)
index 0000000..5f64889
--- /dev/null
@@ -0,0 +1,68 @@
+From 40e89ff5750fca2c1d6da93f98a2038716bba86c Mon Sep 17 00:00:00 2001
+From: Prashanth K <prashanth.k@oss.qualcomm.com>
+Date: Mon, 17 Feb 2025 17:33:28 +0530
+Subject: usb: gadget: Set self-powered based on MaxPower and bmAttributes
+
+From: Prashanth K <prashanth.k@oss.qualcomm.com>
+
+commit 40e89ff5750fca2c1d6da93f98a2038716bba86c upstream.
+
+Currently the USB gadget will be set as bus-powered based solely
+on whether its bMaxPower is greater than 100mA, but this may miss
+devices that may legitimately draw less than 100mA but still want
+to report as bus-powered. Similarly during suspend & resume, USB
+gadget is incorrectly marked as bus/self powered without checking
+the bmAttributes field. Fix these by configuring the USB gadget
+as self or bus powered based on bmAttributes, and explicitly set
+it as bus-powered if it draws more than 100mA.
+
+Cc: stable <stable@kernel.org>
+Fixes: 5e5caf4fa8d3 ("usb: gadget: composite: Inform controller driver of self-powered")
+Signed-off-by: Prashanth K <prashanth.k@oss.qualcomm.com>
+Link: https://lore.kernel.org/r/20250217120328.2446639-1-prashanth.k@oss.qualcomm.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/usb/gadget/composite.c |   16 +++++++++++-----
+ 1 file changed, 11 insertions(+), 5 deletions(-)
+
+--- a/drivers/usb/gadget/composite.c
++++ b/drivers/usb/gadget/composite.c
+@@ -1050,10 +1050,11 @@ static int set_config(struct usb_composi
+       else
+               usb_gadget_set_remote_wakeup(gadget, 0);
+ done:
+-      if (power <= USB_SELF_POWER_VBUS_MAX_DRAW)
+-              usb_gadget_set_selfpowered(gadget);
+-      else
++      if (power > USB_SELF_POWER_VBUS_MAX_DRAW ||
++          !(c->bmAttributes & USB_CONFIG_ATT_SELFPOWER))
+               usb_gadget_clear_selfpowered(gadget);
++      else
++              usb_gadget_set_selfpowered(gadget);
+       usb_gadget_vbus_draw(gadget, power);
+       if (result >= 0 && cdev->delayed_status)
+@@ -2615,7 +2616,9 @@ void composite_suspend(struct usb_gadget
+       cdev->suspended = 1;
+-      usb_gadget_set_selfpowered(gadget);
++      if (cdev->config->bmAttributes & USB_CONFIG_ATT_SELFPOWER)
++              usb_gadget_set_selfpowered(gadget);
++
+       usb_gadget_vbus_draw(gadget, 2);
+ }
+@@ -2649,8 +2652,11 @@ void composite_resume(struct usb_gadget
+               else
+                       maxpower = min(maxpower, 900U);
+-              if (maxpower > USB_SELF_POWER_VBUS_MAX_DRAW)
++              if (maxpower > USB_SELF_POWER_VBUS_MAX_DRAW ||
++                  !(cdev->config->bmAttributes & USB_CONFIG_ATT_SELFPOWER))
+                       usb_gadget_clear_selfpowered(gadget);
++              else
++                      usb_gadget_set_selfpowered(gadget);
+               usb_gadget_vbus_draw(gadget, maxpower);
+       } else {
diff --git a/queue-6.6/usb-gadget-u_ether-set-is_suspend-flag-if-remote-wakeup-fails.patch b/queue-6.6/usb-gadget-u_ether-set-is_suspend-flag-if-remote-wakeup-fails.patch
new file mode 100644 (file)
index 0000000..6a41b48
--- /dev/null
@@ -0,0 +1,40 @@
+From 17c2c87c37862c3e95b55f660681cc6e8d66660e Mon Sep 17 00:00:00 2001
+From: Prashanth K <prashanth.k@oss.qualcomm.com>
+Date: Wed, 12 Feb 2025 15:38:40 +0530
+Subject: usb: gadget: u_ether: Set is_suspend flag if remote wakeup fails
+
+From: Prashanth K <prashanth.k@oss.qualcomm.com>
+
+commit 17c2c87c37862c3e95b55f660681cc6e8d66660e upstream.
+
+Currently while UDC suspends, u_ether attempts to remote wakeup
+the host if there are any pending transfers. However, if remote
+wakeup fails, the UDC remains suspended but the is_suspend flag
+is not set. And since is_suspend flag isn't set, the subsequent
+eth_start_xmit() would queue USB requests to suspended UDC.
+
+To fix this, bail out from gether_suspend() only if remote wakeup
+operation is successful.
+
+Cc: stable <stable@kernel.org>
+Fixes: 0a1af6dfa077 ("usb: gadget: f_ecm: Add suspend/resume and remote wakeup support")
+Signed-off-by: Prashanth K <prashanth.k@oss.qualcomm.com>
+Link: https://lore.kernel.org/r/20250212100840.3812153-1-prashanth.k@oss.qualcomm.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/usb/gadget/function/u_ether.c |    4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/drivers/usb/gadget/function/u_ether.c
++++ b/drivers/usb/gadget/function/u_ether.c
+@@ -1052,8 +1052,8 @@ void gether_suspend(struct gether *link)
+                * There is a transfer in progress. So we trigger a remote
+                * wakeup to inform the host.
+                */
+-              ether_wakeup_host(dev->port_usb);
+-              return;
++              if (!ether_wakeup_host(dev->port_usb))
++                      return;
+       }
+       spin_lock_irqsave(&dev->lock, flags);
+       link->is_suspend = true;
diff --git a/queue-6.6/usb-hub-lack-of-clearing-xhc-resources.patch b/queue-6.6/usb-hub-lack-of-clearing-xhc-resources.patch
new file mode 100644 (file)
index 0000000..2a4c81e
--- /dev/null
@@ -0,0 +1,90 @@
+From 2b66ef84d0d2a0ea955b40bd306f5e3abbc5cf9c Mon Sep 17 00:00:00 2001
+From: Pawel Laszczak <pawell@cadence.com>
+Date: Fri, 28 Feb 2025 07:50:25 +0000
+Subject: usb: hub: lack of clearing xHC resources
+
+From: Pawel Laszczak <pawell@cadence.com>
+
+commit 2b66ef84d0d2a0ea955b40bd306f5e3abbc5cf9c upstream.
+
+The xHC resources allocated for USB devices are not released in correct
+order after resuming in case when while suspend device was reconnected.
+
+This issue has been detected during the fallowing scenario:
+- connect hub HS to root port
+- connect LS/FS device to hub port
+- wait for enumeration to finish
+- force host to suspend
+- reconnect hub attached to root port
+- wake host
+
+For this scenario during enumeration of USB LS/FS device the Cadence xHC
+reports completion error code for xHC commands because the xHC resources
+used for devices has not been properly released.
+XHCI specification doesn't mention that device can be reset in any order
+so, we should not treat this issue as Cadence xHC controller bug.
+Similar as during disconnecting in this case the device resources should
+be cleared starting form the last usb device in tree toward the root hub.
+To fix this issue usbcore driver should call hcd->driver->reset_device
+for all USB devices connected to hub which was reconnected while
+suspending.
+
+Fixes: 3d82904559f4 ("usb: cdnsp: cdns3 Add main part of Cadence USBSSP DRD Driver")
+Cc: stable <stable@kernel.org>
+Signed-off-by: Pawel Laszczak <pawell@cadence.com>
+Reviewed-by: Alan Stern <stern@rowland.harvard.edu>
+Link: https://lore.kernel.org/r/PH7PR07MB953841E38C088678ACDCF6EEDDCC2@PH7PR07MB9538.namprd07.prod.outlook.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/usb/core/hub.c |   33 +++++++++++++++++++++++++++++++++
+ 1 file changed, 33 insertions(+)
+
+--- a/drivers/usb/core/hub.c
++++ b/drivers/usb/core/hub.c
+@@ -6034,6 +6034,36 @@ void usb_hub_cleanup(void)
+ } /* usb_hub_cleanup() */
+ /**
++ * hub_hc_release_resources - clear resources used by host controller
++ * @udev: pointer to device being released
++ *
++ * Context: task context, might sleep
++ *
++ * Function releases the host controller resources in correct order before
++ * making any operation on resuming usb device. The host controller resources
++ * allocated for devices in tree should be released starting from the last
++ * usb device in tree toward the root hub. This function is used only during
++ * resuming device when usb device require reinitialization – that is, when
++ * flag udev->reset_resume is set.
++ *
++ * This call is synchronous, and may not be used in an interrupt context.
++ */
++static void hub_hc_release_resources(struct usb_device *udev)
++{
++      struct usb_hub *hub = usb_hub_to_struct_hub(udev);
++      struct usb_hcd *hcd = bus_to_hcd(udev->bus);
++      int i;
++
++      /* Release up resources for all children before this device */
++      for (i = 0; i < udev->maxchild; i++)
++              if (hub->ports[i]->child)
++                      hub_hc_release_resources(hub->ports[i]->child);
++
++      if (hcd->driver->reset_device)
++              hcd->driver->reset_device(hcd, udev);
++}
++
++/**
+  * usb_reset_and_verify_device - perform a USB port reset to reinitialize a device
+  * @udev: device to reset (not in SUSPENDED or NOTATTACHED state)
+  *
+@@ -6097,6 +6127,9 @@ static int usb_reset_and_verify_device(s
+       bos = udev->bos;
+       udev->bos = NULL;
++      if (udev->reset_resume)
++              hub_hc_release_resources(udev);
++
+       mutex_lock(hcd->address0_mutex);
+       for (i = 0; i < PORT_INIT_TRIES; ++i) {
diff --git a/queue-6.6/usb-quirks-add-delay_init-and-no_lpm-for-prolific-mass-storage-card-reader.patch b/queue-6.6/usb-quirks-add-delay_init-and-no_lpm-for-prolific-mass-storage-card-reader.patch
new file mode 100644 (file)
index 0000000..256ecc4
--- /dev/null
@@ -0,0 +1,36 @@
+From ff712188daa3fe3ce7e11e530b4dca3826dae14a Mon Sep 17 00:00:00 2001
+From: Miao Li <limiao@kylinos.cn>
+Date: Tue, 4 Mar 2025 15:07:57 +0800
+Subject: usb: quirks: Add DELAY_INIT and NO_LPM for Prolific Mass Storage Card Reader
+
+From: Miao Li <limiao@kylinos.cn>
+
+commit ff712188daa3fe3ce7e11e530b4dca3826dae14a upstream.
+
+When used on Huawei hisi platforms, Prolific Mass Storage Card Reader
+which the VID:PID is in 067b:2731 might fail to enumerate at boot time
+and doesn't work well with LPM enabled, combination quirks:
+       USB_QUIRK_DELAY_INIT + USB_QUIRK_NO_LPM
+fixed the problems.
+
+Signed-off-by: Miao Li <limiao@kylinos.cn>
+Cc: stable <stable@kernel.org>
+Link: https://lore.kernel.org/r/20250304070757.139473-1-limiao870622@163.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/usb/core/quirks.c |    4 ++++
+ 1 file changed, 4 insertions(+)
+
+--- a/drivers/usb/core/quirks.c
++++ b/drivers/usb/core/quirks.c
+@@ -341,6 +341,10 @@ static const struct usb_device_id usb_qu
+       { USB_DEVICE(0x0638, 0x0a13), .driver_info =
+         USB_QUIRK_STRING_FETCH_255 },
++      /* Prolific Single-LUN Mass Storage Card Reader */
++      { USB_DEVICE(0x067b, 0x2731), .driver_info = USB_QUIRK_DELAY_INIT |
++        USB_QUIRK_NO_LPM },
++
+       /* Saitek Cyborg Gold Joystick */
+       { USB_DEVICE(0x06a3, 0x0006), .driver_info =
+                       USB_QUIRK_CONFIG_INTF_STRINGS },
diff --git a/queue-6.6/usb-renesas_usbhs-call-clk_put.patch b/queue-6.6/usb-renesas_usbhs-call-clk_put.patch
new file mode 100644 (file)
index 0000000..329be3b
--- /dev/null
@@ -0,0 +1,37 @@
+From b5ea08aa883da05106fcc683d12489a4292d1122 Mon Sep 17 00:00:00 2001
+From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
+Date: Tue, 25 Feb 2025 13:02:46 +0200
+Subject: usb: renesas_usbhs: Call clk_put()
+
+From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
+
+commit b5ea08aa883da05106fcc683d12489a4292d1122 upstream.
+
+Clocks acquired with of_clk_get() need to be freed with clk_put(). Call
+clk_put() on priv->clks[0] on error path.
+
+Fixes: 3df0e240caba ("usb: renesas_usbhs: Add multiple clocks management")
+Cc: stable <stable@kernel.org>
+Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
+Tested-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
+Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
+Link: https://lore.kernel.org/r/20250225110248.870417-2-claudiu.beznea.uj@bp.renesas.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/usb/renesas_usbhs/common.c |    4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+--- a/drivers/usb/renesas_usbhs/common.c
++++ b/drivers/usb/renesas_usbhs/common.c
+@@ -312,8 +312,10 @@ static int usbhsc_clk_get(struct device
+       priv->clks[1] = of_clk_get(dev_of_node(dev), 1);
+       if (PTR_ERR(priv->clks[1]) == -ENOENT)
+               priv->clks[1] = NULL;
+-      else if (IS_ERR(priv->clks[1]))
++      else if (IS_ERR(priv->clks[1])) {
++              clk_put(priv->clks[0]);
+               return PTR_ERR(priv->clks[1]);
++      }
+       return 0;
+ }
diff --git a/queue-6.6/usb-renesas_usbhs-flush-the-notify_hotplug_work.patch b/queue-6.6/usb-renesas_usbhs-flush-the-notify_hotplug_work.patch
new file mode 100644 (file)
index 0000000..c28b377
--- /dev/null
@@ -0,0 +1,39 @@
+From 552ca6b87e3778f3dd5b87842f95138162e16c82 Mon Sep 17 00:00:00 2001
+From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
+Date: Tue, 25 Feb 2025 13:02:48 +0200
+Subject: usb: renesas_usbhs: Flush the notify_hotplug_work
+
+From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
+
+commit 552ca6b87e3778f3dd5b87842f95138162e16c82 upstream.
+
+When performing continuous unbind/bind operations on the USB drivers
+available on the Renesas RZ/G2L SoC, a kernel crash with the message
+"Unable to handle kernel NULL pointer dereference at virtual address"
+may occur. This issue points to the usbhsc_notify_hotplug() function.
+
+Flush the delayed work to avoid its execution when driver resources are
+unavailable.
+
+Fixes: bc57381e6347 ("usb: renesas_usbhs: use delayed_work instead of work_struct")
+Cc: stable <stable@kernel.org>
+Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
+Tested-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
+Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
+Link: https://lore.kernel.org/r/20250225110248.870417-4-claudiu.beznea.uj@bp.renesas.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/usb/renesas_usbhs/common.c |    2 ++
+ 1 file changed, 2 insertions(+)
+
+--- a/drivers/usb/renesas_usbhs/common.c
++++ b/drivers/usb/renesas_usbhs/common.c
+@@ -770,6 +770,8 @@ static void usbhs_remove(struct platform
+       dev_dbg(&pdev->dev, "usb remove\n");
++      flush_delayed_work(&priv->notify_hotplug_work);
++
+       /* power off */
+       if (!usbhs_get_dparam(priv, runtime_pwctrl))
+               usbhsc_power_ctrl(priv, 0);
diff --git a/queue-6.6/usb-renesas_usbhs-use-devm_usb_get_phy.patch b/queue-6.6/usb-renesas_usbhs-use-devm_usb_get_phy.patch
new file mode 100644 (file)
index 0000000..d082afd
--- /dev/null
@@ -0,0 +1,37 @@
+From e0c92440938930e7fa7aa6362780d39cdea34449 Mon Sep 17 00:00:00 2001
+From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
+Date: Tue, 25 Feb 2025 13:02:47 +0200
+Subject: usb: renesas_usbhs: Use devm_usb_get_phy()
+
+From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
+
+commit e0c92440938930e7fa7aa6362780d39cdea34449 upstream.
+
+The gpriv->transceiver is retrieved in probe() through usb_get_phy() but
+never released. Use devm_usb_get_phy() to handle this scenario.
+
+This issue was identified through code investigation. No issue was found
+without this change.
+
+Fixes: b5a2875605ca ("usb: renesas_usbhs: Allow an OTG PHY driver to provide VBUS")
+Cc: stable <stable@kernel.org>
+Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
+Tested-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
+Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
+Link: https://lore.kernel.org/r/20250225110248.870417-3-claudiu.beznea.uj@bp.renesas.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/usb/renesas_usbhs/mod_gadget.c |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/usb/renesas_usbhs/mod_gadget.c
++++ b/drivers/usb/renesas_usbhs/mod_gadget.c
+@@ -1094,7 +1094,7 @@ int usbhs_mod_gadget_probe(struct usbhs_
+               goto usbhs_mod_gadget_probe_err_gpriv;
+       }
+-      gpriv->transceiver = usb_get_phy(USB_PHY_TYPE_UNDEFINED);
++      gpriv->transceiver = devm_usb_get_phy(dev, USB_PHY_TYPE_UNDEFINED);
+       dev_info(dev, "%stransceiver found\n",
+                !IS_ERR(gpriv->transceiver) ? "" : "no ");
diff --git a/queue-6.6/usb-typec-tcpci_rt1711h-unmask-alert-interrupts-to-fix-functionality.patch b/queue-6.6/usb-typec-tcpci_rt1711h-unmask-alert-interrupts-to-fix-functionality.patch
new file mode 100644 (file)
index 0000000..7b1acf0
--- /dev/null
@@ -0,0 +1,55 @@
+From d6b82dafd17db0658f089b9cdec573982ca82bc5 Mon Sep 17 00:00:00 2001
+From: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
+Date: Wed, 19 Feb 2025 12:47:00 +0100
+Subject: usb: typec: tcpci_rt1711h: Unmask alert interrupts to fix functionality
+
+From: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
+
+commit d6b82dafd17db0658f089b9cdec573982ca82bc5 upstream.
+
+During probe, the TCPC alert interrupts are getting masked to
+avoid unwanted interrupts during chip setup: this is ok to do
+but there is no unmasking happening at any later time, which
+means that the chip will not raise any interrupt, essentially
+making it not functional as, while internally it does perform
+all of the intended functions, it won't signal anything to the
+outside.
+
+Unmask the alert interrupts to fix functionality.
+
+Fixes: ce08eaeb6388 ("staging: typec: rt1711h typec chip driver")
+Cc: stable <stable@kernel.org>
+Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
+Link: https://lore.kernel.org/r/20250219114700.41700-1-angelogioacchino.delregno@collabora.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/usb/typec/tcpm/tcpci_rt1711h.c |   11 +++++++++++
+ 1 file changed, 11 insertions(+)
+
+--- a/drivers/usb/typec/tcpm/tcpci_rt1711h.c
++++ b/drivers/usb/typec/tcpm/tcpci_rt1711h.c
+@@ -331,6 +331,11 @@ static int rt1711h_probe(struct i2c_clie
+ {
+       int ret;
+       struct rt1711h_chip *chip;
++      const u16 alert_mask = TCPC_ALERT_TX_SUCCESS | TCPC_ALERT_TX_DISCARDED |
++                             TCPC_ALERT_TX_FAILED | TCPC_ALERT_RX_HARD_RST |
++                             TCPC_ALERT_RX_STATUS | TCPC_ALERT_POWER_STATUS |
++                             TCPC_ALERT_CC_STATUS | TCPC_ALERT_RX_BUF_OVF |
++                             TCPC_ALERT_FAULT;
+       chip = devm_kzalloc(&client->dev, sizeof(*chip), GFP_KERNEL);
+       if (!chip)
+@@ -379,6 +384,12 @@ static int rt1711h_probe(struct i2c_clie
+                                       dev_name(chip->dev), chip);
+       if (ret < 0)
+               return ret;
++
++      /* Enable alert interrupts */
++      ret = rt1711h_write16(chip, TCPC_ALERT_MASK, alert_mask);
++      if (ret < 0)
++              return ret;
++
+       enable_irq_wake(client->irq);
+       return 0;
diff --git a/queue-6.6/usb-typec-ucsi-fix-null-pointer-access.patch b/queue-6.6/usb-typec-ucsi-fix-null-pointer-access.patch
new file mode 100644 (file)
index 0000000..cba0cdd
--- /dev/null
@@ -0,0 +1,63 @@
+From b13abcb7ddd8d38de769486db5bd917537b32ab1 Mon Sep 17 00:00:00 2001
+From: Andrei Kuchynski <akuchynski@chromium.org>
+Date: Wed, 5 Mar 2025 11:17:39 +0000
+Subject: usb: typec: ucsi: Fix NULL pointer access
+
+From: Andrei Kuchynski <akuchynski@chromium.org>
+
+commit b13abcb7ddd8d38de769486db5bd917537b32ab1 upstream.
+
+Resources should be released only after all threads that utilize them
+have been destroyed.
+This commit ensures that resources are not released prematurely by waiting
+for the associated workqueue to complete before deallocating them.
+
+Cc: stable <stable@kernel.org>
+Fixes: b9aa02ca39a4 ("usb: typec: ucsi: Add polling mechanism for partner tasks like alt mode checking")
+Signed-off-by: Andrei Kuchynski <akuchynski@chromium.org>
+Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
+Link: https://lore.kernel.org/r/20250305111739.1489003-2-akuchynski@chromium.org
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/usb/typec/ucsi/ucsi.c |   13 +++++++------
+ 1 file changed, 7 insertions(+), 6 deletions(-)
+
+--- a/drivers/usb/typec/ucsi/ucsi.c
++++ b/drivers/usb/typec/ucsi/ucsi.c
+@@ -1465,11 +1465,11 @@ static int ucsi_init(struct ucsi *ucsi)
+ err_unregister:
+       for (con = connector; con->port; con++) {
++              if (con->wq)
++                      destroy_workqueue(con->wq);
+               ucsi_unregister_partner(con);
+               ucsi_unregister_altmodes(con, UCSI_RECIPIENT_CON);
+               ucsi_unregister_port_psy(con);
+-              if (con->wq)
+-                      destroy_workqueue(con->wq);
+               usb_power_delivery_unregister_capabilities(con->port_sink_caps);
+               con->port_sink_caps = NULL;
+@@ -1651,10 +1651,6 @@ void ucsi_unregister(struct ucsi *ucsi)
+       for (i = 0; i < ucsi->cap.num_connectors; i++) {
+               cancel_work_sync(&ucsi->connector[i].work);
+-              ucsi_unregister_partner(&ucsi->connector[i]);
+-              ucsi_unregister_altmodes(&ucsi->connector[i],
+-                                       UCSI_RECIPIENT_CON);
+-              ucsi_unregister_port_psy(&ucsi->connector[i]);
+               if (ucsi->connector[i].wq) {
+                       struct ucsi_work *uwork;
+@@ -1670,6 +1666,11 @@ void ucsi_unregister(struct ucsi *ucsi)
+                       destroy_workqueue(ucsi->connector[i].wq);
+               }
++              ucsi_unregister_partner(&ucsi->connector[i]);
++              ucsi_unregister_altmodes(&ucsi->connector[i],
++                                       UCSI_RECIPIENT_CON);
++              ucsi_unregister_port_psy(&ucsi->connector[i]);
++
+               usb_power_delivery_unregister_capabilities(ucsi->connector[i].port_sink_caps);
+               ucsi->connector[i].port_sink_caps = NULL;
+               usb_power_delivery_unregister_capabilities(ucsi->connector[i].port_source_caps);
diff --git a/queue-6.6/usb-typec-ucsi-increase-timeout-for-ppm-reset-operations.patch b/queue-6.6/usb-typec-ucsi-increase-timeout-for-ppm-reset-operations.patch
new file mode 100644 (file)
index 0000000..f1f50a6
--- /dev/null
@@ -0,0 +1,51 @@
+From bf4f9ae1cb08ccaafbe6874be6c46f59b83ae778 Mon Sep 17 00:00:00 2001
+From: Fedor Pchelkin <boddah8794@gmail.com>
+Date: Mon, 17 Feb 2025 13:54:40 +0300
+Subject: usb: typec: ucsi: increase timeout for PPM reset operations
+
+From: Fedor Pchelkin <boddah8794@gmail.com>
+
+commit bf4f9ae1cb08ccaafbe6874be6c46f59b83ae778 upstream.
+
+It is observed that on some systems an initial PPM reset during the boot
+phase can trigger a timeout:
+
+[    6.482546] ucsi_acpi USBC000:00: failed to reset PPM!
+[    6.482551] ucsi_acpi USBC000:00: error -ETIMEDOUT: PPM init failed
+
+Still, increasing the timeout value, albeit being the most straightforward
+solution, eliminates the problem: the initial PPM reset may take up to
+~8000-10000ms on some Lenovo laptops. When it is reset after the above
+period of time (or even if ucsi_reset_ppm() is not called overall), UCSI
+works as expected.
+
+Moreover, if the ucsi_acpi module is loaded/unloaded manually after the
+system has booted, reading the CCI values and resetting the PPM works
+perfectly, without any timeout. Thus it's only a boot-time issue.
+
+The reason for this behavior is not clear but it may be the consequence
+of some tricks that the firmware performs or be an actual firmware bug.
+As a workaround, increase the timeout to avoid failing the UCSI
+initialization prematurely.
+
+Fixes: b1b59e16075f ("usb: typec: ucsi: Increase command completion timeout value")
+Cc: stable <stable@kernel.org>
+Signed-off-by: Fedor Pchelkin <boddah8794@gmail.com>
+Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
+Link: https://lore.kernel.org/r/20250217105442.113486-3-boddah8794@gmail.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/usb/typec/ucsi/ucsi.c |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/usb/typec/ucsi/ucsi.c
++++ b/drivers/usb/typec/ucsi/ucsi.c
+@@ -25,7 +25,7 @@
+  * difficult to estimate the time it takes for the system to process the command
+  * before it is actually passed to the PPM.
+  */
+-#define UCSI_TIMEOUT_MS               5000
++#define UCSI_TIMEOUT_MS               10000
+ /*
+  * UCSI_SWAP_TIMEOUT_MS - Timeout for role swap requests